Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

revert to work #26

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 0 additions & 128 deletions .github/workflows/image-builder-test.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
name: WEB-Product
name: FRONTEND

on:
push:
branches: [latest]
branches: [main, testing, latest]
paths: [src/**]
tags: [ v* ]
pull_request:
branches: [latest]
types: [closed]
types: [opened, reopened, synchronize, ready_for_review]
paths: [src/**]

env:
Expand Down Expand Up @@ -37,51 +36,6 @@ jobs:
envkey_REACT_APP_DEV: ${{ secrets.PROD_DEV }}
file_name: .env
directory: ./src/
# -
# name: Generate Nginx configuration file
# run: |
# cat <<EOT >> ./nginx.conf
# events {
# worker_connections 1024;
# }

# http {
# server {
# listen ${{ secrets.PROD_PORT1 }};
# server_name sci.cugrader.com www.sci.cugrader.com;

# # Redirect HTTP to HTTPS
# location / {
# return 301 https://\$host\$request_uri;
# }
# }

# server {
# listen ${{ secrets.PROD_PORT2 }} ssl;
# server_name sci.cugrader.com www.sci.cugrader.com;

# ssl_certificate ${{ secrets.PROD_CERT }};
# ssl_certificate_key ${{ secrets.PROD_CERTKEY }};

# ssl_protocols TLSv1.2 TLSv1.3;
# ssl_prefer_server_ciphers on;

# location / {
# root /usr/share/nginx/html;
# index index.html;
# try_files \$uri \$uri/ /index.html;
# }

# location /api {
# proxy_pass ${{ secrets.PROD_API }};
# proxy_set_header Host \$host;
# proxy_set_header X-Real-IP \$remote_addr;
# proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Proto \$scheme;
# }
# }
# }
# EOT
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand All @@ -105,7 +59,7 @@ jobs:
type=semver,pattern={{major}}
-
name: Log into registry ${{ env.REGISTRY }}
if: github.event_name == 'push' || github.event_name == 'pull_request'
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
Expand All @@ -121,8 +75,8 @@ jobs:
uses: docker/build-push-action@v5
with:
context: "."
push: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
cache-to: type=gha,mode=max
12 changes: 0 additions & 12 deletions CHANGELOG.md

This file was deleted.

2 changes: 0 additions & 2 deletions dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ COPY nginx.conf /etc/nginx/nginx.conf
# Expose ports 80 and 443
EXPOSE 80
EXPOSE 443
EXPOSE 8080
EXPOSE 8443

# Start Nginx
CMD ["nginx", "-g", "daemon off;"]
2 changes: 1 addition & 1 deletion nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ http {
}

location /api {
proxy_pass http://sci.cugrader.com:5000;
proxy_pass http://sci.cugrader.com:5000; # Adjust to your backend container name and port
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Expand Down
2 changes: 1 addition & 1 deletion src/src/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import ClassEdit from '../pages/PF/ClassEdit';
import AssignList from '../pages/PF/AssignList';
import AssignCreate from '../pages/PF/AssignCreate';
import AssignEdit from '../pages/PF/AssignEdit';
import AssignSus from '../pages/PF/AssignSus';
import AssignSus from '../pages/PF/AssignSus';
import Sentin from '../pages/PF/Sentin';
import StudentList from '../pages/PF/StudentList';
import TAmanage from '../pages/PF/TAmanage'
Expand Down
66 changes: 66 additions & 0 deletions src/src/pages/Login.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import React,{useEffect} from 'react';
import withReactContent from 'sweetalert2-react-content';
import Swal from 'sweetalert2'
import 'bootstrap/dist/css/bootstrap.min.css';
import 'bootstrap/dist/js/bootstrap.bundle.min.js';
import Cookies from 'js-cookie';
Expand All @@ -15,6 +17,70 @@ const loginRedir = async () => {

function Login() {

// pre write for cunet

// const [username, setUsername] = useState('');
// const [password, setPassword] = useState('');

// async function loginRedir(){
// //validate input
// if(username.length != 10){
// withReactContent(Swal).fire({
// title: "Username must be 10 characters!",
// icon: "error"
// })
// return
// }

// if(isNaN(username)){
// withReactContent(Swal).fire({
// title: "Username must contain only numbers!",
// icon: "error"
// })
// return
// }

// if(password.length <= 0){
// withReactContent(Swal).fire({
// title: "Password is require!",
// icon: "error"
// })
// return
// }

// //request login to backend
// const response = await fetch(`http://${process.env.REACT_APP_BACKENDHOST}:${process.env.REACT_APP_BACKENDPORT}/glob/auth/login`, {
// method: "POST",
// credentials: "include",
// headers: {
// "Content-type": "application/json; charset=UTF-8",
// "Access-Control-Allow-Origin": "*"
// },
// body: JSON.stringify({
// "username": username,
// "password": password
// })
// })

// var data = await response.json();
// //if user valid set cookie and sent to Home
// if(data['success']){
// Cookies.set("UID", data["data"]["uid"])
// Cookies.set("type", data["data"]["type"])
// withReactContent(Swal).fire({
// title: "Login successfully!",
// icon: "success"
// }).then((result) => {
// window.location.href = "/"
// })
// }else{
// withReactContent(Swal).fire({
// title: "Username or Password is invalid!",
// icon: "error"
// });
// }
// }

useEffect(() => {
document.body.style.backgroundColor = "#F2F2F2"
})
Expand Down
Loading