Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 2023-ujoncdelutan
  • 2023-update
  • master
  • 1.0
  • 1.0.1
  • 1.0.10
  • 1.0.12
  • 1.0.13
  • 1.0.14
  • 1.0.15
  • 1.0.16
  • 1.0.17
  • 1.0.18
  • 1.0.19
  • 1.0.2
  • 1.0.3
  • 1.0.4
  • 1.0.5
  • 1.0.6
  • 1.0.7
  • 1.0.8
  • 1.0.9
  • 1.1.0
  • 1.1.1
  • 1.1.2
  • 1.1.3
  • 1.1.4
  • 1.1.5
  • 1.2.0
  • 1.3.0
  • 1.3.1
  • 1.3.10
  • 1.3.11
  • 1.3.12
  • 1.3.13
  • 1.3.14
  • 1.3.15
  • 1.3.16
  • 1.3.17
  • 1.3.18
  • 1.3.19
  • 1.3.2
  • 1.3.3
  • 1.3.4
  • 1.3.5
  • 1.3.6
  • 1.3.7
  • 1.3.8
  • 1.3.9
  • 1.4.0
  • 1.4.1
  • 1.4.2
  • 1.4.3
  • 1.4.4
  • 1.4.5
  • 1.4.6
  • 1.4.7
57 results

Target

Select target project
  • kszk/devteam/kszkepzes/old/kszkepzes-frontend
  • kbgergely/kszkepzes-frontend
2 results
Select Git revision
  • master
  • 1.0
  • 1.0.1
  • 1.0.10
  • 1.0.12
  • 1.0.13
  • 1.0.14
  • 1.0.15
  • 1.0.16
  • 1.0.17
  • 1.0.18
  • 1.0.19
  • 1.0.2
  • 1.0.3
  • 1.0.4
  • 1.0.5
  • 1.0.6
  • 1.0.7
  • 1.0.8
  • 1.0.9
  • 1.1.0
  • 1.1.1
  • 1.1.2
  • 1.1.3
  • 1.1.4
  • 1.1.5
  • 1.2.0
  • 1.3.0
  • 1.3.1
29 results
Show changes
Commits on Source (93)
Showing
with 26555 additions and 17386 deletions
image: node:latest variables:
CONTAINER_IMAGE: 'harbor.sch.bme.hu/kszk-kepzes/frontend:$CI_COMMIT_REF_NAME'
stages: stages:
- Build - Pre Build
- Docker Build
- deploy
PreBuild:
Install_Test: stage: Pre Build
stage: Build # tags: [kszk]
image: node:14.19-alpine3.14
script: script:
- 'echo -n "Node version: " && node --version \
&& echo -n "NPM version: " && npm --version'
- npm install - npm install
- ./node_modules/.bin/eslint . - npm run build
cache:
paths:
- build/
artifacts:
expire_in: 1 day
paths:
- build/
only:
- tags
Docker build:
stage: Docker Build
# tags: [kszk]
only:
- tags
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: ['']
script:
- echo "{\"auths\":{\"harbor.sch.bme.hu\":{\"username\":\"$REGISTRY_USER\",\"password\":\"$REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CONTAINER_IMAGE
Deploy to Kubernetes:
stage: deploy
image: alpine
tags: [k9r]
environment:
name: master
before_script:
- chmod 600 $KUBECONFIG
- apk add --no-cache curl
- curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
- chmod +x ./kubectl
- mv ./kubectl /usr/local/bin/kubectl
- kubectl version
script:
- cd k8s
- sed -i "s|##IMAGETAG##|${CI_COMMIT_REF_NAME}|" deployment.yaml
- kubectl apply -f ./
only:
- tags
FROM node:10-alpine FROM nginx:1.19.2
WORKDIR /opt/app # copy the files builded with npm run build
ENV TZ Europe/Budapest COPY build /var/www
RUN apk add --no-cache tzdata && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone COPY nginx.conf /etc/nginx/nginx.conf
# Copying application files
COPY ./src ./src
COPY ./public ./public
COPY package.json yarn.lock package-lock.json ./
# Installing dependencies
RUN npm install
RUN npm install serve
RUN yarn build
# Running
EXPOSE 3000 EXPOSE 3000
ENTRYPOINT ["npm", "run", "deploy"]
ENTRYPOINT ["nginx","-g","daemon off;"]
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: kszkepzes-frontend
namespace: kszk-kepzes-site
spec:
replicas: 1
selector:
matchLabels:
app: kszkepzes-frontend
strategy:
type: Recreate
template:
metadata:
labels:
app: kszkepzes-frontend
spec:
containers:
- name: kszkepzes-frontend
image: harbor.sch.bme.hu/kszk-kepzes/frontend:##IMAGETAG##
imagePullPolicy: 'Always'
ports:
- containerPort: 3000
resources:
limits:
memory: 200Mi
imagePullSecrets:
- name: harbor
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
namespace: kszk-kepzes-site
annotations:
cert-manager.io/cluster-issuer: letsencrypt
kubernetes.io/tls-acme: "true"
name: kszkepzes-frontend
spec:
rules:
- host: "ujonc.kszk.bme.hu"
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: kszkepzes-frontend
port:
number: 3000
tls:
- hosts:
- "ujonc.kszk.bme.hu"
secretName: kszkepzes-cert
\ No newline at end of file
---
apiVersion: v1
kind: Service
metadata:
name: kszkepzes-frontend
namespace: kszk-kepzes-site
spec:
type: ClusterIP
ports:
- port: 3000
targetPort: 3000
name: front
protocol: TCP
selector:
app: kszkepzes-frontend
# auto detects a good number of processes to run
worker_processes auto;
#Provides the configuration file context in which the directives that affect connection processing are specified.
events {
# Sets the maximum number of simultaneous connections that can be opened by a worker process.
worker_connections 8000;
# Tells the worker to accept multiple connections at a time
multi_accept on;
}
http {
# what times to include
include /etc/nginx/mime.types;
# what is the default one
default_type application/octet-stream;
# Sets the path, format, and configuration for a buffered log write
log_format compression '$remote_addr - $remote_user [$time_local] '
'"$request" $status $upstream_addr '
'"$http_referer" "$http_user_agent"';
server {
# listen on port 80
listen 3000;
# save logs here
access_log /var/log/nginx/access.log compression;
# where the root here
root /var/www;
# what file to server as index
index index.html index.htm;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to redirecting to index.html
try_files $uri $uri/ /index.html;
}
# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
}
# Javascript and CSS files
location ~* \.(?:css|js)$ {
try_files $uri =404;
expires 1y;
access_log off;
add_header Cache-Control "public, max-age=60";
}
# Any route containing a file extension (e.g. /devicesfile.js)
location ~ ^.+\..+$ {
try_files $uri =404;
}
}
}
This diff is collapsed.
...@@ -3,17 +3,18 @@ ...@@ -3,17 +3,18 @@
"version": "0.2.8", "version": "0.2.8",
"private": false, "private": false,
"dependencies": { "dependencies": {
"axios": "^0.19.2", "axios": "^0.21.1",
"eslint-plugin-flowtype": "^4.6.0", "eslint-plugin-flowtype": "^4.7.0",
"moment": "^2.24.0", "http-proxy-middleware": "^1.0.6",
"npm": "^6.13.7", "moment": "^2.29.1",
"npm": "^6.14.11",
"prop-types": "^15.7.2", "prop-types": "^15.7.2",
"react": "^16.12.0", "react": "^16.14.0",
"react-datepicker": "^2.11.0", "react-datepicker": "^2.16.0",
"react-dom": "^16.12.0", "react-dom": "^16.14.0",
"react-redux": "^7.1.3", "react-redux": "^7.2.2",
"react-router-dom": "^5.1.2", "react-router-dom": "^5.2.0",
"react-scripts": "^3.3.0", "react-scripts": "^3.4.4",
"react-slick": "^0.25.2", "react-slick": "^0.25.2",
"redux": "^4.0.5", "redux": "^4.0.5",
"redux-logger": "^3.0.6", "redux-logger": "^3.0.6",
...@@ -27,15 +28,14 @@ ...@@ -27,15 +28,14 @@
"start": "react-scripts start", "start": "react-scripts start",
"build": "react-scripts build", "build": "react-scripts build",
"test": "react-scripts test --env=jsdom", "test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject", "eject": "react-scripts eject"
"deploy": "serve -l 3000 -s build"
}, },
"devDependencies": { "devDependencies": {
"eslint": "6.8.0", "eslint": "6.8.0",
"eslint-config-airbnb": "^18.0.1", "eslint-config-airbnb": "^18.2.1",
"eslint-plugin-import": "^2.20.0", "eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsx-a11y": "^6.2.3", "eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.18.0" "eslint-plugin-react": "^7.22.0"
}, },
"browserslist": [ "browserslist": [
">0.2%", ">0.2%",
......
<!doctype html> <!DOCTYPE html>
<html lang="hu"> <html lang="hu">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta
<meta name="theme-color" content="#000000"> name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="theme-color" content="#000000" />
<!-- <!--
manifest.json provides metadata used when your web app is added to the manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/ homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
--> -->
<meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" /> <meta http-equiv="Expires" content="0" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json"> <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico"> <link
<link rel="stylesheet" href="index.css"> rel="shortcut icon"
type="image/svg+xml"
href="%PUBLIC_URL%/kszk_circle_lightblue.svg"
/>
<link rel="stylesheet" href="%PUBLIC_URL%/index.css" />
<!-- <!--
Notice the use of %PUBLIC_URL% in the tags above. Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build. It will be replaced with the URL of the `public` folder during the build.
...@@ -22,12 +29,10 @@ ...@@ -22,12 +29,10 @@
work correctly both with client-side routing and a non-root public URL. work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`. Learn how to configure a non-root public URL by running `npm run build`.
--> -->
<title>KSZKépzés 2020</title> <title>KSZKépzés 2025</title>
</head> </head>
<body> <body>
<noscript> <noscript> You need to enable JavaScript to run this app. </noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root" style="height: 100%"></div> <div id="root" style="height: 100%"></div>
<!-- <!--
This HTML file is a template. This HTML file is a template.
......
This diff is collapsed.
import axios from './session';
import { import {
GET_USERDATA, PROFILE_CHANGE, GROUP_CHANGE, GET_DEADLINE, GET_DEADLINE,
GET_USERDATA,
GROUP_CHANGE,
PROFILE_CHANGE,
} from './types'; } from './types';
import axios from './session';
export const getUserData = () => ( export const getUserData = () => async (dispatch) => {
async (dispatch) => {
try { try {
const user = await axios.get('/api/v1/profiles/me'); const user = await axios.get('/api/v1/profiles/me');
const { const {
...@@ -56,12 +58,15 @@ export const getUserData = () => ( ...@@ -56,12 +58,15 @@ export const getUserData = () => (
}); });
} catch (e) { } catch (e) {
console.log(e); console.log(e);
// Invalid session bug workaround
if (!e.response) {
window.location = "/oidc/logout"
} }
} }
); };
export const getDeadline = () => ( export const getDeadline = () => async (dispatch) => {
async (dispatch) => {
try { try {
const response = await axios.get('/api/v1/profiles/deadline'); const response = await axios.get('/api/v1/profiles/deadline');
...@@ -72,23 +77,24 @@ export const getDeadline = () => ( ...@@ -72,23 +77,24 @@ export const getDeadline = () => (
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
} };
);
export const textChange = ({ target: { name, value } }) => ( export const textChange = ({ target: { name, value } }) => (dispatch) => {
(dispatch) => {
dispatch({ type: PROFILE_CHANGE, payload: value, target: name }); dispatch({ type: PROFILE_CHANGE, payload: value, target: name });
} };
);
export const groupChange = (groups) => ( export const groupChange = (groups) => (dispatch) =>
(dispatch) => (dispatch({ type: GROUP_CHANGE, payload: groups })) dispatch({ type: GROUP_CHANGE, payload: groups });
);
export const submitRegistration = ({ export const submitRegistration = ({
nick, groups, signed, motivationAbout, motivationProfession, motivationExercise, id, nick,
}) => ( groups,
async () => { signed,
motivationAbout,
motivationProfession,
motivationExercise,
id,
}) => async () => {
try { try {
const response = await axios.patch(`/api/v1/profiles/${id}/`, { const response = await axios.patch(`/api/v1/profiles/${id}/`, {
nick, nick,
...@@ -104,7 +110,7 @@ export const submitRegistration = ({ ...@@ -104,7 +110,7 @@ export const submitRegistration = ({
alert('Mentés nem sikerült!'); alert('Mentés nem sikerült!');
} }
} catch (e) { } catch (e) {
console.log(e); console.log(e, e.response);
} alert('Mentés nem sikerült!');
} }
); };
import axios from './session';
import { GET_GROUPS } from './types'; import { GET_GROUPS } from './types';
import axios from './session';
export const getGroups = () => ( export const getGroups = () => async (dispatch) => {
async (dispatch) => {
try { try {
const response = await axios.get('/api/v1/groups'); const response = await axios.get('/api/v1/groups');
dispatch({ dispatch({
...@@ -12,5 +11,4 @@ export const getGroups = () => ( ...@@ -12,5 +11,4 @@ export const getGroups = () => (
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
} };
);
import axios from './session';
import { GET_IMAGES } from './types'; import { GET_IMAGES } from './types';
import axios from './session';
export const getImages = () => ( export const getImages = () => async (dispatch) => {
async (dispatch) => {
try { try {
const response = await axios.get('/api/v1/images'); const response = await axios.get('/api/v1/images');
dispatch({ dispatch({
...@@ -12,5 +11,4 @@ export const getImages = () => ( ...@@ -12,5 +11,4 @@ export const getImages = () => (
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
} };
);
import axios from './session';
import { import {
GET_TASKS, ADD_DOCUMENT,
GET_SOLUTIONS, ADD_SOLUTION,
ADD_TASK, ADD_TASK,
CHECK,
CLEAR_WRITE,
CORRECT_SOLUTION,
DELETE_TASK, DELETE_TASK,
WRITE_TASK,
EDIT_TASK, EDIT_TASK,
GET_DOCUMENTS,
GET_PROFILES,
GET_SOLUTIONS,
GET_TASKS,
SELECT_SOLUTION,
SELECT_TASK, SELECT_TASK,
CLEAR_WRITE, SETCHECKTRUE,
ADD_SOLUTION,
WRITE_SOLUTION, WRITE_SOLUTION,
WRITE_SOLUTION_FILE, WRITE_SOLUTION_FILE,
GET_PROFILES, WRITE_TASK,
ADD_DOCUMENT,
GET_DOCUMENTS,
CORRECT_SOLUTION,
SELECT_SOLUTION,
CHECK, SETCHECKTRUE,
} from './types'; } from './types';
export const getTasks = () => ( import axios from './session';
async (dispatch) => {
export const getTasks = () => async (dispatch) => {
try { try {
const response = await axios.get('/api/v1/homework/tasks/'); const response = await axios.get('/api/v1/homework/tasks/');
dispatch({ dispatch({
...@@ -30,13 +31,13 @@ export const getTasks = () => ( ...@@ -30,13 +31,13 @@ export const getTasks = () => (
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
} };
);
export const getSolutions = (taskId) => ( export const getSolutions = (taskId) => async (dispatch) => {
async (dispatch) => {
try { try {
const response = await axios.get('/api/v1/homework/solutions/', { task: taskId }); const response = await axios.get('/api/v1/homework/solutions/', {
task: taskId,
});
dispatch({ dispatch({
type: GET_SOLUTIONS, type: GET_SOLUTIONS,
payload: response.data, payload: response.data,
...@@ -44,13 +45,11 @@ export const getSolutions = (taskId) => ( ...@@ -44,13 +45,11 @@ export const getSolutions = (taskId) => (
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
} };
);
export const addTask = ({ export const addTask = ({ title, text, deadline, bits }) => async (
title, text, deadline, bits, dispatch
}) => ( ) => {
async (dispatch) => {
try { try {
const response = await axios.post('/api/v1/homework/tasks/', { const response = await axios.post('/api/v1/homework/tasks/', {
title, title,
...@@ -67,17 +66,11 @@ export const addTask = ({ ...@@ -67,17 +66,11 @@ export const addTask = ({
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
} };
);
export const editTask = ({ export const editTask = ({ id, title, text, deadline, bits }) => async (
id, dispatch
title, ) => {
text,
deadline,
bits,
}) => (
async (dispatch) => {
try { try {
const response = await axios.patch(`/api/v1/homework/tasks/${id}/`, { const response = await axios.patch(`/api/v1/homework/tasks/${id}/`, {
title, title,
...@@ -89,17 +82,14 @@ export const editTask = ({ ...@@ -89,17 +82,14 @@ export const editTask = ({
dispatch({ dispatch({
type: EDIT_TASK, type: EDIT_TASK,
payload: response.data, payload: response.data,
}); });
} }
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
} };
);
export const deleteTask = (task) => ( export const deleteTask = (task) => async (dispatch) => {
async (dispatch) => {
try { try {
const response = await axios.delete(`/api/v1/homework/tasks/${task.id}/`); const response = await axios.delete(`/api/v1/homework/tasks/${task.id}/`);
if (!response.data.id) { if (!response.data.id) {
...@@ -111,18 +101,15 @@ export const deleteTask = (task) => ( ...@@ -111,18 +101,15 @@ export const deleteTask = (task) => (
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
}); };
export const setSelectedTask = (task) => ( export const setSelectedTask = (task) => (dispatch) => {
(dispatch) => {
dispatch({ type: SELECT_TASK, payload: task }); dispatch({ type: SELECT_TASK, payload: task });
} };
);
export const addDocument = ({ export const addDocument = ({ name, description, file, solution }) => async (
name, description, file, solution, dispatch
}) => ( ) => {
async (dispatch) => {
try { try {
const formData = new FormData(); const formData = new FormData();
formData.append('name', name); formData.append('name', name);
...@@ -144,13 +131,17 @@ export const addDocument = ({ ...@@ -144,13 +131,17 @@ export const addDocument = ({
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
} };
);
export const addSolution = ({ export const addSolution = ({
task, accepted, corrected, note, name, description, file, task,
}) => ( accepted,
async (dispatch) => { corrected,
note,
name,
description,
file,
}) => async (dispatch) => {
try { try {
const response = await axios.post('/api/v1/homework/solutions/', { const response = await axios.post('/api/v1/homework/solutions/', {
task, task,
...@@ -177,7 +168,11 @@ export const addSolution = ({ ...@@ -177,7 +168,11 @@ export const addSolution = ({
'content-type': 'multipart/form-data', 'content-type': 'multipart/form-data',
}, },
}; };
const responsedoc = await axios.post('/api/v1/documents/', formData, config); const responsedoc = await axios.post(
'/api/v1/documents/',
formData,
config
);
if (responsedoc.data.id) { if (responsedoc.data.id) {
dispatch({ dispatch({
type: ADD_DOCUMENT, type: ADD_DOCUMENT,
...@@ -187,13 +182,13 @@ export const addSolution = ({ ...@@ -187,13 +182,13 @@ export const addSolution = ({
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
} };
);
export const getDocuments = (solutionID) => ( export const getDocuments = (solutionID) => async (dispatch) => {
async (dispatch) => {
try { try {
const response = await axios.get('/api/v1/documents', { params: { solution: solutionID } }); const response = await axios.get('/api/v1/documents', {
params: { solution: solutionID },
});
dispatch({ dispatch({
type: GET_DOCUMENTS, type: GET_DOCUMENTS,
payload: response.data, payload: response.data,
...@@ -201,41 +196,29 @@ export const getDocuments = (solutionID) => ( ...@@ -201,41 +196,29 @@ export const getDocuments = (solutionID) => (
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
} };
);
export const writeSolution = ({ target: { name, value } }) => ( export const writeSolution = ({ target: { name, value } }) => (dispatch) => {
(dispatch) => {
dispatch({ type: WRITE_SOLUTION, payload: value, target: name }); dispatch({ type: WRITE_SOLUTION, payload: value, target: name });
} };
);
export const writeSolutionFile = ({ target: { files } }) => ( export const writeSolutionFile = ({ target: { files } }) => (dispatch) => {
(dispatch) => {
dispatch({ type: WRITE_SOLUTION_FILE, payload: files[0], target: 'file' }); dispatch({ type: WRITE_SOLUTION_FILE, payload: files[0], target: 'file' });
} };
);
export const writeTask = ({ target: { name, value } }) => ( export const writeTask = ({ target: { name, value } }) => (dispatch) => {
(dispatch) => {
dispatch({ type: WRITE_TASK, payload: value, target: name }); dispatch({ type: WRITE_TASK, payload: value, target: name });
} };
);
export const writeTaskDeadline = ({ name, value }) => ( export const writeTaskDeadline = ({ name, value }) => (dispatch) => {
(dispatch) => {
dispatch({ type: WRITE_TASK, payload: value, target: name }); dispatch({ type: WRITE_TASK, payload: value, target: name });
} };
);
export const clearWrite = () => ( export const clearWrite = () => (dispatch) => {
(dispatch) => {
dispatch({ type: CLEAR_WRITE }); dispatch({ type: CLEAR_WRITE });
} };
);
export const getProfiles = () => ( export const getProfiles = () => async (dispatch) => {
async (dispatch) => {
try { try {
const response = await axios.get('/api/v1/profiles/'); const response = await axios.get('/api/v1/profiles/');
dispatch({ dispatch({
...@@ -245,11 +228,11 @@ export const getProfiles = () => ( ...@@ -245,11 +228,11 @@ export const getProfiles = () => (
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
} };
);
export const correctSolution = (id, corrected, accepted, note) => ( export const correctSolution = (id, corrected, accepted, note) => async (
async (dispatch) => { dispatch
) => {
try { try {
const response = await axios.patch(`/api/v1/homework/solutions/${id}/`, { const response = await axios.patch(`/api/v1/homework/solutions/${id}/`, {
corrected, corrected,
...@@ -260,32 +243,24 @@ export const correctSolution = (id, corrected, accepted, note) => ( ...@@ -260,32 +243,24 @@ export const correctSolution = (id, corrected, accepted, note) => (
dispatch({ dispatch({
type: CORRECT_SOLUTION, type: CORRECT_SOLUTION,
payload: response.data, payload: response.data,
}); });
} }
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
} };
);
export const check = (name) => ( export const check = (name) => (dispatch) => {
(dispatch) => {
dispatch({ type: CHECK, target: name }); dispatch({ type: CHECK, target: name });
} };
);
export const setchecktrue = (name) => ( export const setchecktrue = (name) => (dispatch) => {
(dispatch) => {
dispatch({ type: SETCHECKTRUE, target: name }); dispatch({ type: SETCHECKTRUE, target: name });
} };
);
export const selectSolution = (solution) => ( export const selectSolution = (solution) => (dispatch) => {
(dispatch) => {
dispatch({ dispatch({
type: SELECT_SOLUTION, type: SELECT_SOLUTION,
payload: solution, payload: solution,
}); });
} };
);
import axios from './session';
import { GET_MENTORS } from './types'; import { GET_MENTORS } from './types';
import axios from './session';
export const getMentors = () => ( export const getMentors = () => async (dispatch) => {
async (dispatch) => {
try { try {
const response = await axios.get('/api/v1/mentors'); const response = await axios.get('/api/v1/mentors');
dispatch({ dispatch({
...@@ -12,5 +11,4 @@ export const getMentors = () => ( ...@@ -12,5 +11,4 @@ export const getMentors = () => (
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
} };
);
import axios from './session';
import { import {
GET_NEWS, WRITE_NEWS, ADD_NEWS, DELETE_NEWS, ADD_NEWS,
CLEAR_WRITE, SELECT_NEWS, EDIT_NEWS, CLEAR_WRITE,
DELETE_NEWS,
EDIT_NEWS,
GET_NEWS,
SELECT_NEWS,
WRITE_NEWS,
} from './types'; } from './types';
export const getNews = () => ( import axios from './session';
async (dispatch) => {
export const getNews = () => async (dispatch) => {
try { try {
const response = await axios.get('/api/v1/news'); const response = await axios.get('/api/v1/news');
dispatch({ dispatch({
...@@ -15,11 +20,9 @@ export const getNews = () => ( ...@@ -15,11 +20,9 @@ export const getNews = () => (
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
} };
);
export const postNews = ({ title, updated_by, text }) => ( export const postNews = ({ title, updated_by, text }) => async (dispatch) => {
async (dispatch) => {
try { try {
const response = await axios.post('/api/v1/news/', { const response = await axios.post('/api/v1/news/', {
updated_by, updated_by,
...@@ -38,13 +41,11 @@ export const postNews = ({ title, updated_by, text }) => ( ...@@ -38,13 +41,11 @@ export const postNews = ({ title, updated_by, text }) => (
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
} };
);
export const editNews = ({ export const editNews = ({ id, title, text, updated_by }) => async (
id, title, text, updated_by, dispatch
}) => ( ) => {
async (dispatch) => {
try { try {
const response = await axios.patch(`/api/v1/news/${id}/`, { const response = await axios.patch(`/api/v1/news/${id}/`, {
updated_by, updated_by,
...@@ -56,7 +57,6 @@ export const editNews = ({ ...@@ -56,7 +57,6 @@ export const editNews = ({
dispatch({ dispatch({
type: EDIT_NEWS, type: EDIT_NEWS,
payload: response.data, payload: response.data,
}); });
} else { } else {
alert('Mentés nem sikerült!'); alert('Mentés nem sikerült!');
...@@ -64,11 +64,9 @@ export const editNews = ({ ...@@ -64,11 +64,9 @@ export const editNews = ({
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
} };
);
export const deleteNews = (news) => ( export const deleteNews = (news) => async (dispatch) => {
async (dispatch) => {
try { try {
const response = await axios.delete(`/api/v1/news/${news.id}/`); const response = await axios.delete(`/api/v1/news/${news.id}/`);
if (!response.data.id) { if (!response.data.id) {
...@@ -83,22 +81,16 @@ export const deleteNews = (news) => ( ...@@ -83,22 +81,16 @@ export const deleteNews = (news) => (
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
}); };
export const writeNews = ({ target: { name, value } }) => ( export const writeNews = ({ target: { name, value } }) => (dispatch) => {
(dispatch) => {
dispatch({ type: WRITE_NEWS, payload: value, target: name }); dispatch({ type: WRITE_NEWS, payload: value, target: name });
} };
);
export const clearWrite = () => ( export const clearWrite = () => (dispatch) => {
(dispatch) => {
dispatch({ type: CLEAR_WRITE }); dispatch({ type: CLEAR_WRITE });
} };
);
export const setSelectedNews = (item) => ( export const setSelectedNews = (item) => (dispatch) => {
(dispatch) => {
dispatch({ type: SELECT_NEWS, payload: item }); dispatch({ type: SELECT_NEWS, payload: item });
} };
);
import axios from './session';
import { import {
GET_NOTES_BY_EVENT,
WRITE_NOTE,
ADD_EVENT_NOTE, ADD_EVENT_NOTE,
CLEAR_WRITE, CLEAR_WRITE,
GET_NOTES_BY_EVENT,
WRITE_NOTE,
} from './types'; } from './types';
export const getNotesByEvent = (id) => ( import axios from './session';
async (dispatch) => {
export const getNotesByEvent = (id) => async (dispatch) => {
try { try {
const response = await axios.get('/api/v1/notes/', { params: { eventID: id } }); const response = await axios.get('/api/v1/notes/', {
params: { eventID: id },
});
dispatch({ dispatch({
type: GET_NOTES_BY_EVENT, type: GET_NOTES_BY_EVENT,
payload: response.data, payload: response.data,
...@@ -17,15 +19,14 @@ export const getNotesByEvent = (id) => ( ...@@ -17,15 +19,14 @@ export const getNotesByEvent = (id) => (
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
} };
);
export const writeNote = (event) => ((dispatch) => (dispatch( export const writeNote = (event) => (dispatch) =>
{ type: WRITE_NOTE, payload: event.target.value }, dispatch({ type: WRITE_NOTE, payload: event.target.value });
)));
export const postEventNote = ({ eventid, userid, note }) => ( export const postEventNote = ({ eventid, userid, note }) => async (
async (dispatch) => { dispatch
) => {
try { try {
const response = await axios.post('/api/v1/notes/', { const response = await axios.post('/api/v1/notes/', {
event: eventid || '', event: eventid || '',
...@@ -42,10 +43,8 @@ export const postEventNote = ({ eventid, userid, note }) => ( ...@@ -42,10 +43,8 @@ export const postEventNote = ({ eventid, userid, note }) => (
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
}); };
export const clearWrite = () => ( export const clearWrite = () => (dispatch) => {
(dispatch) => {
dispatch({ type: CLEAR_WRITE }); dispatch({ type: CLEAR_WRITE });
} };
);
import axios from './session';
import { import {
GET_EVENTS, ABSENT_CHANGE,
GET_EVENT_BY_ID,
GET_TRAINEES,
VISITOR_CHANGE,
WRITE_EVENT,
ADD_EVENT, ADD_EVENT,
CHANGE_NO,
DELETE_EVENT, DELETE_EVENT,
GET_EVENTS,
GET_EVENT_BY_ID,
GET_PROFILES, GET_PROFILES,
GET_SELECTED_PROFILE, GET_SELECTED_PROFILE,
GET_TRAINEES,
SET_STATUS, SET_STATUS,
ABSENT_CHANGE, VISITOR_CHANGE,
CHANGE_NO, WRITE_EVENT,
} from './types'; } from './types';
export const getStaffEvents = () => ( import axios from './session';
async (dispatch) => {
export const getStaffEvents = () => async (dispatch) => {
try { try {
const response = await axios.get('/api/v1/staff_events/'); const response = await axios.get('/api/v1/staff_events/');
dispatch({ dispatch({
...@@ -25,11 +25,9 @@ export const getStaffEvents = () => ( ...@@ -25,11 +25,9 @@ export const getStaffEvents = () => (
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
} };
);
export const getStudentEvents = () => ( export const getStudentEvents = () => async (dispatch) => {
async (dispatch) => {
try { try {
const response = await axios.get('/api/v1/student_events/'); const response = await axios.get('/api/v1/student_events/');
dispatch({ dispatch({
...@@ -39,11 +37,9 @@ export const getStudentEvents = () => ( ...@@ -39,11 +37,9 @@ export const getStudentEvents = () => (
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
} };
);
export const getEventById = (id) => ( export const getEventById = (id) => async (dispatch) => {
async (dispatch) => {
try { try {
const response = await axios.get(`/api/v1/staff_events/${id}`); const response = await axios.get(`/api/v1/staff_events/${id}`);
dispatch({ dispatch({
...@@ -53,11 +49,9 @@ export const getEventById = (id) => ( ...@@ -53,11 +49,9 @@ export const getEventById = (id) => (
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
} };
);
export const getTrainees = () => ( export const getTrainees = () => async (dispatch) => {
async (dispatch) => {
try { try {
const response = await axios.get('/api/v1/profiles/'); const response = await axios.get('/api/v1/profiles/');
dispatch({ dispatch({
...@@ -67,24 +61,22 @@ export const getTrainees = () => ( ...@@ -67,24 +61,22 @@ export const getTrainees = () => (
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
} };
);
export const visitorChange = ({ id, value }) => { export const visitorChange = ({ id, value }) => {
switch (value) { switch (value) {
case 'Visitor': case 'Visitor':
return ((dispatch) => (dispatch({ type: VISITOR_CHANGE, payload: id }))); return (dispatch) => dispatch({ type: VISITOR_CHANGE, payload: id });
case 'Absent': case 'Absent':
return ((dispatch) => (dispatch({ type: ABSENT_CHANGE, payload: id }))); return (dispatch) => dispatch({ type: ABSENT_CHANGE, payload: id });
case 'No': case 'No':
return ((dispatch) => (dispatch({ type: CHANGE_NO, payload: id }))); return (dispatch) => dispatch({ type: CHANGE_NO, payload: id });
default: default:
return null; return null;
} }
}; };
export const submitVisitors = ({ id, visitors, absent }) => ( export const submitVisitors = ({ id, visitors, absent }) => async () => {
async () => {
try { try {
const response = await axios.patch(`/api/v1/staff_events/${id}/`, { const response = await axios.patch(`/api/v1/staff_events/${id}/`, {
visitors, visitors,
...@@ -98,24 +90,17 @@ export const submitVisitors = ({ id, visitors, absent }) => ( ...@@ -98,24 +90,17 @@ export const submitVisitors = ({ id, visitors, absent }) => (
console.log(e); console.log(e);
return false; return false;
} }
} };
);
export const writeEvent = ({ target: { name, value } }) => ( export const writeEvent = ({ target: { name, value } }) => (dispatch) => {
(dispatch) => {
dispatch({ type: WRITE_EVENT, payload: value, target: name }); dispatch({ type: WRITE_EVENT, payload: value, target: name });
} };
);
export const eventDate = (name, value) => ( export const eventDate = (name, value) => (dispatch) => {
(dispatch) => {
dispatch({ type: WRITE_EVENT, payload: value, target: name }); dispatch({ type: WRITE_EVENT, payload: value, target: name });
} };
);
export const addEvent = ({ name, date, description }) => ( export const addEvent = ({ name, date, description }) => async (dispatch) => {
async (dispatch) => {
try { try {
const response = await axios.post('/api/v1/staff_events/', { const response = await axios.post('/api/v1/staff_events/', {
name, name,
...@@ -135,11 +120,9 @@ export const addEvent = ({ name, date, description }) => ( ...@@ -135,11 +120,9 @@ export const addEvent = ({ name, date, description }) => (
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
} };
);
export const deleteEvent = (event) => ( export const deleteEvent = (event) => async (dispatch) => {
async (dispatch) => {
try { try {
const response = await axios.delete(`/api/v1/staff_events/${event.id}/`); const response = await axios.delete(`/api/v1/staff_events/${event.id}/`);
if (!response.data.id) { if (!response.data.id) {
...@@ -154,10 +137,9 @@ export const deleteEvent = (event) => ( ...@@ -154,10 +137,9 @@ export const deleteEvent = (event) => (
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
}); };
export const getProfiles = () => ( export const getProfiles = () => async (dispatch) => {
async (dispatch) => {
try { try {
const response = await axios.get('/api/v1/profiles/'); const response = await axios.get('/api/v1/profiles/');
dispatch({ dispatch({
...@@ -167,11 +149,9 @@ export const getProfiles = () => ( ...@@ -167,11 +149,9 @@ export const getProfiles = () => (
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
} };
);
export const setStatus = (id, status) => ( export const setStatus = (id, status) => async (dispatch) => {
async (dispatch) => {
try { try {
const response = await axios.patch(`/api/v1/profiles/${id}/`, { const response = await axios.patch(`/api/v1/profiles/${id}/`, {
role: status, role: status,
...@@ -185,11 +165,9 @@ export const setStatus = (id, status) => ( ...@@ -185,11 +165,9 @@ export const setStatus = (id, status) => (
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
} };
);
export const getSelectedProfile = (id) => ( export const getSelectedProfile = (id) => async (dispatch) => {
async (dispatch) => {
try { try {
const response = await axios.get(`/api/v1/profiles/${id}/`); const response = await axios.get(`/api/v1/profiles/${id}/`);
dispatch({ dispatch({
...@@ -199,5 +177,4 @@ export const getSelectedProfile = (id) => ( ...@@ -199,5 +177,4 @@ export const getSelectedProfile = (id) => (
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
} };
);
import React from 'react'; import Footer from './Footer';
import Header from './Header'; import Header from './Header';
import Main from './Main'; import Main from './Main';
import Footer from './Footer'; import React from 'react';
const App = () => ( const App = () => (
<div style={{ minHeight: '100%', position: 'relative' }}> <div style={{ minHeight: '100%', position: 'relative', paddingBottom: '3em' }}>
<header id='header'> <header id="header">
<Header /> <Header />
</header> </header>
<main id='main' style={{ minHeight: '100%', position: 'relative' }}> <main id="main" style={{ minHeight: '100%', position: 'relative' }}>
<Main /> <Main />
</main> </main>
<footer id='footer' style={{ position: 'absolute', width: '100%', bottom: '0' }}> <footer
id="footer"
style={{ position: 'absolute', width: '100%', bottom: '0' }}
>
<Footer /> <Footer />
</footer> </footer>
</div> </div>
......
import React from 'react'; import { Container, Segment } from "semantic-ui-react";
import { Container, Segment } from 'semantic-ui-react';
import React from "react";
const Footer = () => ( const Footer = () => (
<Segment inverted vertical textAlign='center'> <Segment inverted vertical textAlign="center">
<Container> <Container>
<p textalign='center'>Created by DevTeam &copy; 2018-2020.</p> <p textalign="center">Created by DevTeam &copy; 2018-2025.</p>
</Container> </Container>
</Segment> </Segment>
); );
export default Footer; export default Footer;