diff --git a/README.md b/README.md index be0b671c3..561c84a5a 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,14 @@ +[Общие работы по проекту](/COD2/PORTAL_COD2/projects/22) + # IS#26 Портал ЦОД-2 -Живет на 60м сервере. Тестовый отсутствует +Prod Portal9966/ (10.252.44.28) +Test Potal-t/ (10.252.44.60) ## Стэк ## 1. Python 3.10 2. Vuetify3 -3. Временная схема - файловая БД SQLITE +3. MySQL 4. Redis ## Особенности веток ## @@ -16,34 +19,31 @@ npm version patch производится на ветке razrab окончательная сборка - на main ## Схема ## -стрелки надо передумать ```mermaid flowchart TD -A[PORTAL COD2] <-->|Запрос к серверу| C{Nginx} - - - - C <-->|Фронт| F[Vuetify] - F<-->D[Gunicorn] - D <-->|Виртуальное окружение | E{manage.py} - - E <--> |Вспомогательная БД портала| P[dbsqlite] - E-->|Сервер Авторизации|G[10.252.44.13] - G <-->|Active directory|AD - G <--> |БД Справочника| J[БД 10.252.44.33] - C <--> H[Daphne] - - H <--> I[Redis] - E <--> I - E<-->|БД Справочника| J +A[Клиент] <-->|Запрос к серверу PORTAL9966/ или PORTAL-t/| B{Nginx:80} + B <-->|Фронт /| C[Vuetify 3 /var/www/PORTAL_COD2/src/front/dist] + B <-->|бэк /api /admin /ws| D{Daphne :9966} + D<--> |/ws| E[Django channels] + E<-->F[Redis :6379] + D<-->|Admin|G{Django} + G<-->|10.252.44.13:8005|H[Авторизация FAST API сервер] + H<-->J[Active Directory] + G<-->|10.252.44.33:3306|I[MySQL БД Справочник] + B<-->|/static /media|K[Файлы /var/www/PORTAL_COD2/src/media /var/www/PORTAL_COD2/src/static/ ] ``` ## Установка и настройка ## ### Первоначальная установка после клонирования в папку. В случае неисправностей, идти примерно по этому же пути ### +Инициализация проекта: + +- Инициализировать git +- Выполнить git clone + 1. В каталоге проекта Создаем окружение ``` python3.10 -m venv env ``` @@ -57,13 +57,26 @@ A[PORTAL COD2] <-->|Запрос к серверу| C{Nginx} ``` cd sys ``` ```pip install -r r.txt --proxy= http://...``` +Если нет proxy: + +На машине разработки выполнить команду ```pip download -r ../r.txt``` + +Команда для установки python +```pip install --no-index --find-links /Путь_К_Папке_С_Пакетами/ -r r.txt``` + +Запушить изменения в ветку + +Синхронизировать ветку на сервере + +``` git pull ``` + +Если произошла ошибка: ``` git reset --hard ``` + 4. переходим в каталог src ``` cd ../src/``` -5. В каталог src разархивируем portal.zip из sys - Бд живет на том же сервере, что и проект (60) - +5. В каталог src разархивируем portal.zip из sys Прописываем подключения в settings.py @@ -77,16 +90,12 @@ A[PORTAL COD2] <-->|Запрос к серверу| C{Nginx} На этом работы непосредственно с бэкэндом завершены ### Порты ### -!ВНИМАТЕЛЬНО ПОСМОТРЕТЬ NGINX API proxy ?! - - Vuetify : 9966 - - Gunicorn: 9965 - - Daphne: 9967 + Daphne: 9966 ### Настройка NGINX, GUNICORN, Vuetify, Daphne ### В каталоге sys расположены примерные файлы конфигов для тестового и боевого серверов + + Тестовый сервер: /sys/test_server При копировании убедиться, что пути соответствуют системе #### NGINX Vuetify #### @@ -94,7 +103,11 @@ A[PORTAL COD2] <-->|Запрос к серверу| C{Nginx} /etc/nginx/sites-enabled -#### GUNICORN, Daphne #### - +#### Daphne #### Файлы .service кладем в каталог /etc/systemd/system +Проверяем путь виртуального окружения и порт в файле на соответствие с конфигурацией Nginx + +#### Запуск сервера #### +Запускаем Daphne ``` Start portaldaphne ``` +Перезагружаем Nginx ``` Restart nginx ``` \ No newline at end of file diff --git a/src/accounts/backends.py b/src/accounts/backends.py index cbab68229..f5cb17208 100644 --- a/src/accounts/backends.py +++ b/src/accounts/backends.py @@ -89,8 +89,7 @@ class CustomAuth(ModelBackend): homeuser.last_login=user.last_login user.id=homeuser.id homeuser.userinfo = user - # print("OOOOOOOOOOOOOOOOOOOO") - # print(homeuser) + return homeuser # except Exception as e: diff --git a/src/accounts/renderers.py b/src/accounts/renderers.py index 713ad1c4a..8d0437125 100644 --- a/src/accounts/renderers.py +++ b/src/accounts/renderers.py @@ -15,7 +15,6 @@ class UserJSONRenderer(JSONRenderer): if token is not None and isinstance(token, bytes): # Как говорится выше, декодирует token если он имеет тип bytes. data['token'] = token.decode('utf-8') - # print(data) # Наконец, мы можем отобразить наши данные в простанстве имен 'user'. return json.dumps({ 'user': data, diff --git a/src/accounts/views.py b/src/accounts/views.py index 6698a06f8..932c812ae 100644 --- a/src/accounts/views.py +++ b/src/accounts/views.py @@ -76,7 +76,7 @@ class getuserAPIView(APIView): dt=datetime.now() queryset = DictEmployee.objects.get(login=request.query_params.get('userlogin')) r=CardUserSerializer(queryset).data - print(datetime.now()-dt) + return Response(CardUserSerializer(queryset).data) diff --git a/src/feedback/serializers.py b/src/feedback/serializers.py index 21ee1aca6..d9acb1470 100644 --- a/src/feedback/serializers.py +++ b/src/feedback/serializers.py @@ -19,9 +19,9 @@ class RatingStatusSerializer(serializers.ModelSerializer): class RatingStatusStatSerializer(serializers.ModelSerializer): author = serializers.SerializerMethodField('get_user') - time_create = serializers.CharField(source='usercom.time_create') - comment = serializers.CharField(source='usercom.comment') - utility = serializers.CharField(source='usercom.utility') + time_create = serializers.DateTimeField(source='usercom.time_create') + # comment = serializers.CharField(source='usercom.comment') + # utility = serializers.CharField(source='usercom.utility') namecrit = serializers.CharField(source='crit.name') ico = serializers.CharField(source='crit.ico') color = serializers.CharField(source='crit.color') @@ -48,10 +48,15 @@ class BaseCriteriaSerializer(serializers.ModelSerializer): # return super().to_representation(instance) class UserCommentSerializer(serializers.ModelSerializer): - + author = serializers.SerializerMethodField('get_user') class Meta: model = UserComment - fields = ['id', 'user', 'time_create'] + fields = '__all__' + + def get_user(self, obj): + + # obj.user + return ShortUserSerializer(DictEmployee.objects.get(login=obj.user)).data class UserCommerializer(serializers.ModelSerializer): diff --git a/src/feedback/views.py b/src/feedback/views.py index 8c8aa6b88..afead93ca 100644 --- a/src/feedback/views.py +++ b/src/feedback/views.py @@ -36,7 +36,6 @@ class FeedbackAPIView(APIView): def post(self, request): comment, created = UserComment.objects.update_or_create(id=request.data['nowcomment']['id'],user_id=self.request.user.id, defaults={'comment':request.data['nowcomment']['comment'], 'time_create':datetime.datetime.now()}) - for x in request.data['nowrating']: RatingStatus.objects.update_or_create(id=x['id'], defaults={'rating':x['rating'], 'crit_id':x['crit'], 'usercom_id':comment.id}) return Response({}) diff --git a/src/front/package-lock.json b/src/front/package-lock.json index f4fe31a9f..953ccd8ac 100644 --- a/src/front/package-lock.json +++ b/src/front/package-lock.json @@ -1,22 +1,27 @@ { "name": "front", - "version": "0.0.47", + "version": "0.0.53", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "front", - "version": "0.0.47", + "version": "0.0.53", "dependencies": { + "-": "^0.0.1", "@mdi/font": "7.0.96", "@vuelidate/core": "^2.0.3", "@vuelidate/validators": "^2.0.3", + "adapter": "^1.0.0-beta.10", "axios": "^1.4.0", "chart.js": "^4.4.1", + "chartjs": "^0.3.24", + "chartjs-adapter-moment": "^1.0.1", "chartjs-plugin-datalabels": "^2.2.0", "date-fns": "^2.30.0", "express-vue": "^5.12.0", - "moment": "^2.29.4", + "file-saver": "^2.0.5", + "moment": "^2.30.1", "pinia": "^2.0.23", "roboto-fontface": "*", "v-tooltip": "^2.1.3", @@ -24,6 +29,7 @@ "vue-cal": "^4.8.1", "vue-chartjs": "^5.3.0", "vue-jwt-decode": "^0.1.0", + "vue-pdf-embed": "^2.0.2", "vue-router": "^4.0.0", "vue3-autocounter": "^1.0.6", "vuelidate": "^0.7.7", @@ -49,6 +55,11 @@ "vite-plugin-vuetify": "^1.0.0" } }, + "node_modules/-": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/-/-/--0.0.1.tgz", + "integrity": "sha512-3HfneK3DGAm05fpyj20sT3apkNcvPpCuccOThOPdzz8sY7GgQGe0l93XH9bt+YzibcTIgUAIMoyVJI740RtgyQ==" + }, "node_modules/@aashutoshrathi/word-wrap": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", @@ -3039,6 +3050,26 @@ "resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.3.2.tgz", "integrity": "sha512-fuscdXJ9G1qb7W8VdHi+IwRqij3lBkosAm4ydQtEmbY58OzHXqQhvlxqEkoz0yssNVn38bcpRWgA9PP+OGoisw==" }, + "node_modules/@mapbox/node-pre-gyp": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.11.tgz", + "integrity": "sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==", + "optional": true, + "dependencies": { + "detect-libc": "^2.0.0", + "https-proxy-agent": "^5.0.0", + "make-dir": "^3.1.0", + "node-fetch": "^2.6.7", + "nopt": "^5.0.0", + "npmlog": "^5.0.1", + "rimraf": "^3.0.2", + "semver": "^7.3.5", + "tar": "^6.1.11" + }, + "bin": { + "node-pre-gyp": "bin/node-pre-gyp" + } + }, "node_modules/@mdi/font": { "version": "7.0.96", "resolved": "https://registry.npmjs.org/@mdi/font/-/font-7.0.96.tgz", @@ -6009,6 +6040,12 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, + "node_modules/abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "optional": true + }, "node_modules/accepts": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", @@ -6070,6 +6107,11 @@ "node": ">=0.4.0" } }, + "node_modules/adapter": { + "version": "1.0.0-beta.10", + "resolved": "https://registry.npmjs.org/adapter/-/adapter-1.0.0-beta.10.tgz", + "integrity": "sha512-4O3XRzPNeYfaEGFF+lIImH3tVJQEbA45+9oxGE0Y5PnqVmIoenmtvX/JA65n6Zt5TidRHcixLgb/1JcUuugK8w==" + }, "node_modules/address": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/address/-/address-1.2.2.tgz", @@ -6083,7 +6125,7 @@ "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "dev": true, + "devOptional": true, "dependencies": { "debug": "4" }, @@ -6200,6 +6242,19 @@ "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" }, + "node_modules/are-we-there-yet": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz", + "integrity": "sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==", + "optional": true, + "dependencies": { + "delegates": "^1.0.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -7325,6 +7380,21 @@ } ] }, + "node_modules/canvas": { + "version": "2.11.2", + "resolved": "https://registry.npmjs.org/canvas/-/canvas-2.11.2.tgz", + "integrity": "sha512-ItanGBMrmRV7Py2Z+Xhs7cT+FNt5K0vPL4p9EZ/UX/Mu7hFbkxSjKF2KVtPwX7UYWp7dRKnrTvReflgrItJbdw==", + "hasInstallScript": true, + "optional": true, + "dependencies": { + "@mapbox/node-pre-gyp": "^1.0.0", + "nan": "^2.17.0", + "simple-get": "^3.0.3" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -7365,6 +7435,20 @@ "pnpm": ">=7" } }, + "node_modules/chartjs": { + "version": "0.3.24", + "resolved": "https://registry.npmjs.org/chartjs/-/chartjs-0.3.24.tgz", + "integrity": "sha512-h6G9qcDqmFYnSWqjWCzQMeOLiypS+pM6Fq2Rj7LPty8Kjx5yHonwwJ7oEHImZpQ2u9Pu36XGYfardvvBiQVrhg==" + }, + "node_modules/chartjs-adapter-moment": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/chartjs-adapter-moment/-/chartjs-adapter-moment-1.0.1.tgz", + "integrity": "sha512-Uz+nTX/GxocuqXpGylxK19YG4R3OSVf8326D+HwSTsNw1LgzyIGRo+Qujwro1wy6X+soNSnfj5t2vZ+r6EaDmA==", + "peerDependencies": { + "chart.js": ">=3.0.0", + "moment": "^2.10.2" + } + }, "node_modules/chartjs-plugin-datalabels": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/chartjs-plugin-datalabels/-/chartjs-plugin-datalabels-2.2.0.tgz", @@ -7416,7 +7500,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", - "dev": true, + "devOptional": true, "engines": { "node": ">=10" } @@ -7847,6 +7931,15 @@ "color-name": "^1.0.0" } }, + "node_modules/color-support": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", + "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", + "optional": true, + "bin": { + "color-support": "bin.js" + } + }, "node_modules/color/node_modules/color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", @@ -8034,6 +8127,12 @@ "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz", "integrity": "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==" }, + "node_modules/console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==", + "optional": true + }, "node_modules/consolidate": { "version": "0.15.1", "resolved": "https://registry.npmjs.org/consolidate/-/consolidate-0.15.1.tgz", @@ -8620,6 +8719,18 @@ "node": ">=0.10" } }, + "node_modules/decompress-response": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-4.2.1.tgz", + "integrity": "sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==", + "optional": true, + "dependencies": { + "mimic-response": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/deep-equal": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.2.2.tgz", @@ -8770,6 +8881,12 @@ "node": ">=0.4.0" } }, + "node_modules/delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==", + "optional": true + }, "node_modules/depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", @@ -8838,6 +8955,15 @@ "node": ">=8" } }, + "node_modules/detect-libc": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz", + "integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==", + "optional": true, + "engines": { + "node": ">=8" + } + }, "node_modules/detect-node-es": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/detect-node-es/-/detect-node-es-1.1.0.tgz", @@ -10577,6 +10703,11 @@ "node": "^10.12.0 || >=12.0.0" } }, + "node_modules/file-saver": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/file-saver/-/file-saver-2.0.5.tgz", + "integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA==" + }, "node_modules/file-system-cache": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/file-system-cache/-/file-system-cache-2.3.0.tgz", @@ -10963,7 +11094,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", - "dev": true, + "devOptional": true, "dependencies": { "minipass": "^3.0.0" }, @@ -10975,7 +11106,7 @@ "version": "3.3.6", "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", - "dev": true, + "devOptional": true, "dependencies": { "yallist": "^4.0.0" }, @@ -11058,6 +11189,26 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/gauge": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-3.0.2.tgz", + "integrity": "sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==", + "optional": true, + "dependencies": { + "aproba": "^1.0.3 || ^2.0.0", + "color-support": "^1.1.2", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.1", + "object-assign": "^4.1.1", + "signal-exit": "^3.0.0", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "wide-align": "^1.1.2" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -11440,6 +11591,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==", + "optional": true + }, "node_modules/has-value": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", @@ -11617,7 +11774,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", - "dev": true, + "devOptional": true, "dependencies": { "agent-base": "6", "debug": "4" @@ -13193,7 +13350,7 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, + "devOptional": true, "dependencies": { "yallist": "^4.0.0" }, @@ -13492,6 +13649,18 @@ "node": ">=6" } }, + "node_modules/mimic-response": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-2.1.0.tgz", + "integrity": "sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA==", + "optional": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", @@ -13525,7 +13694,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", - "dev": true, + "devOptional": true, "engines": { "node": ">=8" } @@ -13534,7 +13703,7 @@ "version": "2.1.2", "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", - "dev": true, + "devOptional": true, "dependencies": { "minipass": "^3.0.0", "yallist": "^4.0.0" @@ -13547,7 +13716,7 @@ "version": "3.3.6", "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", - "dev": true, + "devOptional": true, "dependencies": { "yallist": "^4.0.0" }, @@ -13659,9 +13828,9 @@ } }, "node_modules/moment": { - "version": "2.29.4", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", - "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==", + "version": "2.30.1", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz", + "integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==", "engines": { "node": "*" } @@ -13804,7 +13973,7 @@ "version": "2.7.0", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "dev": true, + "devOptional": true, "dependencies": { "whatwg-url": "^5.0.0" }, @@ -13988,6 +14157,21 @@ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz", "integrity": "sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==" }, + "node_modules/nopt": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", + "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", + "optional": true, + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/normalize-package-data": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", @@ -14051,6 +14235,18 @@ "node": ">=8" } }, + "node_modules/npmlog": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-5.0.1.tgz", + "integrity": "sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==", + "optional": true, + "dependencies": { + "are-we-there-yet": "^2.0.0", + "console-control-strings": "^1.1.0", + "gauge": "^3.0.0", + "set-blocking": "^2.0.0" + } + }, "node_modules/nth-check": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", @@ -14607,6 +14803,15 @@ "node": ">=8" } }, + "node_modules/path2d-polyfill": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path2d-polyfill/-/path2d-polyfill-2.0.1.tgz", + "integrity": "sha512-ad/3bsalbbWhmBo0D6FZ4RNMwsLsPpL6gnvhuSaU5Vm7b06Kr5ubSltQQ0T7YKsiJQO+g22zJ4dJKNTXIyOXtA==", + "optional": true, + "engines": { + "node": ">=8" + } + }, "node_modules/pathe": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.1.tgz", @@ -14628,6 +14833,18 @@ "node": ">=0.12" } }, + "node_modules/pdfjs-dist": { + "version": "3.11.174", + "resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-3.11.174.tgz", + "integrity": "sha512-TdTZPf1trZ8/UFu5Cx/GXB7GZM30LT+wWUNfsi6Bq8ePLnb+woNKtDymI2mxZYBpMbonNFqKmiz684DIfnd8dA==", + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "canvas": "^2.11.2", + "path2d-polyfill": "^2.0.1" + } + }, "node_modules/peek-stream": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/peek-stream/-/peek-stream-1.1.3.tgz", @@ -19089,7 +19306,7 @@ "version": "7.5.4", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", - "dev": true, + "devOptional": true, "dependencies": { "lru-cache": "^6.0.0" }, @@ -19322,6 +19539,17 @@ } ] }, + "node_modules/simple-get": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-3.1.1.tgz", + "integrity": "sha512-CQ5LTKGfCpvE1K0n2us+kuMPbk/q0EKl82s4aheV9oXjFEz6W/Y7oQFVJuU6QG77hRT4Ghb5RURteF5vnWjupA==", + "optional": true, + "dependencies": { + "decompress-response": "^4.2.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, "node_modules/simple-update-notifier": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", @@ -20240,7 +20468,7 @@ "version": "6.2.0", "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.0.tgz", "integrity": "sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==", - "dev": true, + "devOptional": true, "dependencies": { "chownr": "^2.0.0", "fs-minipass": "^2.0.0", @@ -20291,7 +20519,7 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", - "dev": true, + "devOptional": true, "bin": { "mkdirp": "bin/cmd.js" }, @@ -20777,7 +21005,7 @@ "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", - "dev": true + "devOptional": true }, "node_modules/traverse-chain": { "version": "0.1.0", @@ -21687,6 +21915,17 @@ "node": ">=4.0.0" } }, + "node_modules/vue-pdf-embed": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/vue-pdf-embed/-/vue-pdf-embed-2.0.2.tgz", + "integrity": "sha512-Zxzv3DaNRj1NwJKIA/CMjvcA/Q0mlA8ASDBUVzYQ62o/s2WgF/Au/ZC4jlMr/P8CLznlyL8tIY7kqXHD7HLcAg==", + "dependencies": { + "pdfjs-dist": "^3.11.174" + }, + "peerDependencies": { + "vue": "^3.3.0" + } + }, "node_modules/vue-pronto": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/vue-pronto/-/vue-pronto-2.4.0.tgz", @@ -22708,9 +22947,9 @@ } }, "node_modules/vuetify": { - "version": "3.4.10", - "resolved": "https://registry.npmjs.org/vuetify/-/vuetify-3.4.10.tgz", - "integrity": "sha512-tObGoumCJxuK26OpS/CLZZIJAgDtN2cnd31vJscVhpuf6jeMD7wh8IsgfZownAOXU1FcKWVQwn1RSDsoXk5cJA==", + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/vuetify/-/vuetify-3.5.2.tgz", + "integrity": "sha512-H/g9+8Loykt50qe9mruHkwWsAIgfQ8gO+SPTAV2uaCFmfYPSFRfu0aGcZ42iWu4bZ9ZkgswIIDaVsfnKINd8yg==", "engines": { "node": "^12.20 || >=14.13" }, @@ -23079,7 +23318,7 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", - "dev": true + "devOptional": true }, "node_modules/webpack": { "version": "4.47.0", @@ -23387,7 +23626,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dev": true, + "devOptional": true, "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" @@ -23470,6 +23709,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/wide-align": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", + "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", + "optional": true, + "dependencies": { + "string-width": "^1.0.2 || 2 || 3 || 4" + } + }, "node_modules/with": { "version": "7.0.2", "resolved": "https://registry.npmjs.org/with/-/with-7.0.2.tgz", @@ -23700,7 +23948,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true + "devOptional": true }, "node_modules/yargs": { "version": "13.3.2", diff --git a/src/front/package.json b/src/front/package.json index ed17d552b..97b07549c 100644 --- a/src/front/package.json +++ b/src/front/package.json @@ -1,6 +1,6 @@ { "name": "front", - "version": "0.0.47", + "version": "0.0.53", "scripts": { "dev": "vite", "build": "vite build", @@ -10,15 +10,20 @@ "build-storybook": "storybook build" }, "dependencies": { + "-": "^0.0.1", "@mdi/font": "7.0.96", "@vuelidate/core": "^2.0.3", "@vuelidate/validators": "^2.0.3", + "adapter": "^1.0.0-beta.10", "axios": "^1.4.0", "chart.js": "^4.4.1", + "chartjs": "^0.3.24", + "chartjs-adapter-moment": "^1.0.1", "chartjs-plugin-datalabels": "^2.2.0", "date-fns": "^2.30.0", "express-vue": "^5.12.0", - "moment": "^2.29.4", + "file-saver": "^2.0.5", + "moment": "^2.30.1", "pinia": "^2.0.23", "roboto-fontface": "*", "v-tooltip": "^2.1.3", @@ -26,6 +31,7 @@ "vue-cal": "^4.8.1", "vue-chartjs": "^5.3.0", "vue-jwt-decode": "^0.1.0", + "vue-pdf-embed": "^2.0.2", "vue-router": "^4.0.0", "vue3-autocounter": "^1.0.6", "vuelidate": "^0.7.7", diff --git a/src/front/src/App.vue b/src/front/src/App.vue index 22bcf7899..3a46c43e3 100644 --- a/src/front/src/App.vue +++ b/src/front/src/App.vue @@ -45,9 +45,7 @@ import {useAccountStore} from '@/store/AccountStore' background: rgb(var(--v-theme-scrollbar)) } -.pointer { - cursor:pointer -} + .bggrad { background: linear-gradient(to top right, rgba(19,84,122,.8), rgba(128,208,199,.8)); @@ -68,4 +66,7 @@ import {useAccountStore} from '@/store/AccountStore' gap: 5px; } +.w100 { + max-width: 100%!important +} diff --git a/src/front/src/components/UI/aboutportal/card-feedback.vue b/src/front/src/components/UI/aboutportal/card-feedback.vue new file mode 100644 index 000000000..b3eeb2e6e --- /dev/null +++ b/src/front/src/components/UI/aboutportal/card-feedback.vue @@ -0,0 +1,52 @@ + + + + + + + + + + + + всего + + + за период + + + + + + {{data.all}} + {{data.period}} + + + + + + + + + + + + \ No newline at end of file diff --git a/src/front/src/components/UI/aboutportal/card-top-comment.vue b/src/front/src/components/UI/aboutportal/card-top-comment.vue new file mode 100644 index 000000000..e14ae7f6d --- /dev/null +++ b/src/front/src/components/UI/aboutportal/card-top-comment.vue @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + Оставлено комментариев + + + Последний комментарий оставлен {{formaComaTime(top.comment[0].time_create)}} + {{top.comment[0].comment}} + + + + + + + + + + +Поставлено оценок + + + + + + + {{top.comment.length}} + {{top.score}} + + + + + + + + + + За выбранный период активных критиков нет + + + + + + + + + + \ No newline at end of file diff --git a/src/front/src/components/UI/aboutportal/card-total.vue b/src/front/src/components/UI/aboutportal/card-total.vue index 975fe1a69..0aee205a2 100644 --- a/src/front/src/components/UI/aboutportal/card-total.vue +++ b/src/front/src/components/UI/aboutportal/card-total.vue @@ -1,38 +1,69 @@ - - class="text-center d-flex flex-column" - height="150px" - > - - - - {{name}} - - - - - - {{total}} - - - + + + {{indicator.title}} + + + + + + {{indicator.tooltip}} + + + + + + + {{indicator.abb}} + + + + + + + + + + + + Данных нет + + + + + + diff --git a/src/front/src/components/UI/aboutportal/feedmodul.vue b/src/front/src/components/UI/aboutportal/feedmodul.vue index 816ba26e2..0295cefd8 100644 --- a/src/front/src/components/UI/aboutportal/feedmodul.vue +++ b/src/front/src/components/UI/aboutportal/feedmodul.vue @@ -1,156 +1,120 @@ - - - - - - - - - - - - Оценок за выбранный период нет - - + + + + + + + + + Последний комментарий оставлен: {{formaComaTime(feedback.last_comment.time_create)}} - - - + + - - - - - - + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/front/src/components/UI/aboutportal/pattern-card-feed.vue b/src/front/src/components/UI/aboutportal/pattern-card-feed.vue new file mode 100644 index 000000000..26e81d35b --- /dev/null +++ b/src/front/src/components/UI/aboutportal/pattern-card-feed.vue @@ -0,0 +1,33 @@ + + + + + + + {{title}} + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/front/src/components/UI/aboutportal/pattern-card.vue b/src/front/src/components/UI/aboutportal/pattern-card.vue new file mode 100644 index 000000000..6834134db --- /dev/null +++ b/src/front/src/components/UI/aboutportal/pattern-card.vue @@ -0,0 +1,48 @@ + + + + + + + {{title}} + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/front/src/components/UI/aboutportal/portal-traffic.vue b/src/front/src/components/UI/aboutportal/portal-traffic.vue new file mode 100644 index 000000000..e45ea402d --- /dev/null +++ b/src/front/src/components/UI/aboutportal/portal-traffic.vue @@ -0,0 +1,194 @@ + + + + + + + + сегодня + за период + + + + + + + + + + + + + + + + {{val.tooltip}} + + + + + + + + + + {{ val.user.length }} + + + + + + {{n}} + + + + + + {{ val.proc }}% + + + + + + + + {{parseFloat(((val.user.length * 100 /val.previos)-100).toFixed(2))}} % + + + 0% + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/front/src/components/UI/aboutportal/rating-page.vue b/src/front/src/components/UI/aboutportal/rating-page.vue new file mode 100644 index 000000000..bcd8a8ad7 --- /dev/null +++ b/src/front/src/components/UI/aboutportal/rating-page.vue @@ -0,0 +1,283 @@ + + + + + + + + + + + + {{ value }} + + + + + + + + {{value}} + + + + + + + {{n}} + + + + + + + + + + + + + + + + {{value}} + + + + + + + + {{n}} + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/front/src/components/UI/aboutportal/toolbar-filter.vue b/src/front/src/components/UI/aboutportal/toolbar-filter.vue new file mode 100644 index 000000000..cb118c6bf --- /dev/null +++ b/src/front/src/components/UI/aboutportal/toolbar-filter.vue @@ -0,0 +1,61 @@ + + + + Статистика портала за период с + + + + по + + + + + + + + + \ No newline at end of file diff --git a/src/front/src/components/UI/aboutportal/top-user.vue b/src/front/src/components/UI/aboutportal/top-user.vue index 4fe06b67b..0e7b5526e 100644 --- a/src/front/src/components/UI/aboutportal/top-user.vue +++ b/src/front/src/components/UI/aboutportal/top-user.vue @@ -1,80 +1,292 @@ - - - {{name}} - - - - - - - - - - - - - {{users.count}} - - - {{x}} - - - - - - - - + + + + + + + + + + + + + + + + + toggleSort(column)" + > + {{ column.title }} + + + + + + + {{ column.tooltip }} + + + + + + + + + + + + + + + + + toggleSort(column)" + > + {{ column.title }} + + + + + + + + + + + + + + {{ value }} + + + + + + {{ value }} + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/front/src/components/UI/date-select.vue b/src/front/src/components/UI/date-select.vue index 6d10e3590..7c9923707 100644 --- a/src/front/src/components/UI/date-select.vue +++ b/src/front/src/components/UI/date-select.vue @@ -9,7 +9,7 @@ @@ -44,37 +46,42 @@ + + \ No newline at end of file diff --git a/src/front/src/components/UI/feedback/star-like.vue b/src/front/src/components/UI/feedback/star-like.vue index e6eaafe58..81e10bfcf 100644 --- a/src/front/src/components/UI/feedback/star-like.vue +++ b/src/front/src/components/UI/feedback/star-like.vue @@ -1,54 +1,111 @@ - - - + - + + + {{x.name}} + + + + + + + + + + + + + + + + + + + + + + - - - - - - {{x.name}} - - - - - - - - - + + {{x.name}} + + + + + + + - + + + + + За выбранный период оценок нет + + + + + + + + + \ No newline at end of file diff --git a/src/front/src/components/UI/fiousercard/listUser.vue b/src/front/src/components/UI/fiousercard/listUser.vue index 1e29abcf6..bfc1bb295 100644 --- a/src/front/src/components/UI/fiousercard/listUser.vue +++ b/src/front/src/components/UI/fiousercard/listUser.vue @@ -1,36 +1,65 @@ - - - - - - - - - {{author.fio}} - - - {{author.post}} - - - - - - + + + + + + + {{author.fio}} + + + {{author.post}} + + + + + + + + {{splitname(author)}} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/front/src/components/UI/tooltip-text.vue b/src/front/src/components/UI/tooltip-text.vue new file mode 100644 index 000000000..73e810c04 --- /dev/null +++ b/src/front/src/components/UI/tooltip-text.vue @@ -0,0 +1,37 @@ + + + + + {{text}} + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/front/src/components/cardLike.vue b/src/front/src/components/cardLike.vue index 97e04c699..bd3171a20 100644 --- a/src/front/src/components/cardLike.vue +++ b/src/front/src/components/cardLike.vue @@ -15,7 +15,7 @@ @@ -80,7 +80,7 @@ export default { feedbackdata.value = data.data if (feedbackdata.value.nowrating.length == 0) { for (let x of feedbackdata.value.basecrit) { - feedbackdata.value.nowrating.push({rating: x.rating, crit: x.id, id: null}) + feedbackdata.value.nowrating.push({ratings: x.rating, crit: x.id, id: null}) } } if (feedbackdata.value.nowcomment === null) { @@ -118,6 +118,7 @@ export default { } function feedSend() { + console.log(feedbackdata.value.nowrating, 'feedbackdata.value.nowrating----------------------'); axiosApiInstance.post(`api/feedback/feedbackdata/`, {nowrating : feedbackdata.value.nowrating, nowcomment: feedbackdata.value.nowcomment} ).then(data => {}) menusCloses() } diff --git a/src/front/src/components/carousel-list.vue b/src/front/src/components/carousel-list.vue index 37b4d0ae2..4c5eae674 100644 --- a/src/front/src/components/carousel-list.vue +++ b/src/front/src/components/carousel-list.vue @@ -1,102 +1,88 @@ - - - - - - - - + + + - - - - {{x.title}} - - - - - - - - - - - - - - - - - - - - - + + + + + {{x.title}} + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/front/src/views/safety/ChaptersSafety.vue b/src/front/src/views/safety/ChaptersSafety.vue new file mode 100644 index 000000000..27b5edcf9 --- /dev/null +++ b/src/front/src/views/safety/ChaptersSafety.vue @@ -0,0 +1,179 @@ + + + + + + Основная информация + Документация + Тестирование + + + + + + + + + + + + + + + + {{ item.name }} + + + + {{ category.name }} + + + + + + + + + {{ file.name }} + + + + + + + + + + + + {{ responsibilityData.name.replace(/\.[^/.]+$/, "") }} + + + {{ file.file_name }} + + + + + + + + + + + + + + + + + + + + Закрыть + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/front/src/views/safety/MainInfoSafety.vue b/src/front/src/views/safety/MainInfoSafety.vue new file mode 100644 index 000000000..6e379dce5 --- /dev/null +++ b/src/front/src/views/safety/MainInfoSafety.vue @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Ответственные за противопожарную безопасность + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/front/src/views/safety/TestSafety.vue b/src/front/src/views/safety/TestSafety.vue new file mode 100644 index 000000000..8b64bead7 --- /dev/null +++ b/src/front/src/views/safety/TestSafety.vue @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + Back + + + + Next + + + + + + + + + + Количество баллов: {{ selected }} + + + + + + + \ No newline at end of file diff --git a/src/garbage/views.py b/src/garbage/views.py index 982a5d3cd..bb8b4c31f 100644 --- a/src/garbage/views.py +++ b/src/garbage/views.py @@ -7,5 +7,4 @@ from .serializers import * class CaorusAPIView(ListAPIView): def get(self, request): queryset = Carousels.objects.using('add_base').all().order_by('order') - print(queryset, '----------------queryset') return Response(CarouselsSerializer(queryset, many=True).data) \ No newline at end of file diff --git a/src/navigation/models.py b/src/navigation/models.py index 800dadb39..35e8136d6 100644 --- a/src/navigation/models.py +++ b/src/navigation/models.py @@ -126,14 +126,14 @@ class CommentNews(models.Model): names.short_description="ФИО" class Carousels(models.Model): - title=models.CharField(max_length=255, verbose_name='Заголовок') - text= models.TextField(max_length=260, null=True, verbose_name='Сообщение') + title=models.CharField(max_length=255, blank=True, null=True, verbose_name='Заголовок') + text= models.TextField(max_length=260, blank=True, null=True, verbose_name='Сообщение') cdate =models.DateTimeField(default=datetime.now, verbose_name='Дата создания') author = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, on_delete=models.PROTECT, verbose_name='Автор новости') link = models.ImageField(upload_to='newsimage/%Y/%m/%d', null=True, default="newsimage/default.jpg", verbose_name='Картинка') published = models.BooleanField(default=True, verbose_name='Опубликован') enddate = models.DateTimeField(default=datetime.now().replace(hour=23,minute=0,second=0,microsecond=0) + timedelta(days=7), verbose_name='Дата снятия с публикации') - sender = models.ForeignKey(BaseSender, on_delete=models.PROTECT, related_name='get_sender', verbose_name='Тематика') + sender = models.ForeignKey(BaseSender, on_delete=models.PROTECT, related_name='get_base_sender', verbose_name='Тематика') order = models.IntegerField(verbose_name='Порядок сортировки', null=True, blank=True) class Meta: @@ -169,8 +169,8 @@ class BirthdayText(models.Model): class Screensaver(models.Model): img = models.ImageField(upload_to='screengallery/%Y/%m/%d', null=True, verbose_name='Изображение') - cdate =models.DateField(default=date.today().replace(year=1990), null=True, verbose_name='Дата начала периода') - enddate = models.DateField(default= date.today().replace(year=1990), verbose_name='Дата окончания периода', null=True) + cdate =models.DateField(default=date.today().replace(year=1992), null=True, verbose_name='Дата начала периода') + enddate = models.DateField(default= date.today().replace(year=1992), verbose_name='Дата окончания периода', null=True) class Meta: diff --git a/src/navigation/serializers.py b/src/navigation/serializers.py index 26079e6d9..31208deba 100644 --- a/src/navigation/serializers.py +++ b/src/navigation/serializers.py @@ -77,15 +77,23 @@ class NewsSerializer(serializers.ModelSerializer): return CommentNewsSerializer(obj.get_comment_news.all(), many=True).data def get_gallery(self, obj): - # print(obj.get_gallery.all(), '---------------------') # return 'gal' return GallerySerializer(obj.get_gallery_news.all(), many=True).data +class BaseSenderSerializer(serializers.ModelSerializer): + + class Meta: + model = BaseSender + fields = '__all__' + class CarouselsSerializer(serializers.ModelSerializer): + senders = serializers.CharField(source='sender.img') class Meta: model = Carousels - fields = '__all__' + fields = ['title', 'text', 'link', 'senders'] + + class ScreensaverSerializer(serializers.ModelSerializer): diff --git a/src/navigation/views.py b/src/navigation/views.py index 8e583a7ca..386b141ca 100644 --- a/src/navigation/views.py +++ b/src/navigation/views.py @@ -45,11 +45,11 @@ class NewsAPIView(ListAPIView): def get(self, request): if request.GET.__contains__('id'): - print('Получена одна новость по ид') + newsqueryset = News.objects.filter(pk=int(request.GET.get('id'))) allnews = 1 else: - print('Получены все новости по ид') + newsqueryset = News.objects.all().order_by('-cdate') allnews =newsqueryset.count() @@ -100,18 +100,18 @@ class NewsCrossroadAPIView(ListAPIView): def get(self, request): if request.GET.__contains__('id'): - print('Получена одна новость по ид') + newsqueryset = News.objects.filter(pk=int(request.GET.get('id'))) countpage= 0 else: - print('Получены все новости по ид') + newsqueryset = News.objects.all().order_by('-cdate') countpage = newsqueryset.count() if request.GET.get("name") == "/": - print('Запрос на новости для главной страницы') + newsqueryset = newsqueryset[:10] else: - print('Запрос на новости с пагинацией') + pagesel = int(request.GET.get("page"))*int(request.GET.get("countpage")) @@ -153,27 +153,16 @@ class NewsCrossroadAPIView(ListAPIView): class CarouselsAPIView(ListAPIView): permission_classes = (AllowAny,) - serializer_class = CarouselsSerializer + def get(self, request): - queryset = Carousels.objects.filter(published=True, cdate__lte=datetime.now(), enddate__gte=datetime.now()).order_by('sender__order') + + result = CarouselsSerializer(queryset, many= True).data - result = [] - for x in queryset: - a=model_to_dict(x) - a['link']= str(x.link.url) - a['show'] = False - a['author'] = model_to_dict(x.author.user) - if x.sender.img: - a['sender'] = str(x.sender.img.url) - else: - a['sender'] = None - result.append(a) - - manbrd = DictEmployee.objects.filter(birthdate__month=date.today().month).order_by('birthdate__day') + manbrd = DictEmployee.objects.filter(birthdate__month=date.today().month, birthdate__day__gte=date.today().day).order_by('birthdate__day') if len(manbrd) > 0 : nowday= manbrd.filter(birthdate__day=date.today().day) @@ -187,7 +176,7 @@ class CarouselsAPIView(ListAPIView): "sender": "/media/default/dr.png", } - # birthday = [] + if len(nowday) > 0 : diff --git a/src/package-lock.json b/src/package-lock.json index f3256dd58..69d3e50ae 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -8,7 +8,7 @@ "date-fns": "^2.30.0", "vue3-autocounter": "^1.0.6" }, - "version": "0.0.1" + "version": "0.0.2" }, "node_modules/@babel/parser": { "version": "7.22.16", @@ -281,5 +281,5 @@ } } }, - "version": "0.0.1" + "version": "0.0.2" } diff --git a/src/package.json b/src/package.json index aeccb237b..db6855639 100644 --- a/src/package.json +++ b/src/package.json @@ -3,5 +3,5 @@ "date-fns": "^2.30.0", "vue3-autocounter": "^1.0.6" }, - "version": "0.0.1" + "version": "0.0.2" } diff --git a/src/r.txt b/src/r.txt index 8f5bec3b5..b8c98b9db 100644 Binary files a/src/r.txt and b/src/r.txt differ diff --git a/src/safety/__init__.py b/src/safety/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/src/safety/admin.py b/src/safety/admin.py new file mode 100644 index 000000000..c8e8555f7 --- /dev/null +++ b/src/safety/admin.py @@ -0,0 +1,13 @@ +from django.contrib import admin + +from .models import SafetyFile +# Register your models here. + + +class SafetyFileAdmin(admin.ModelAdmin): + list_display = ('name', 'chapter_id', 'category_id', 'sign_date') + list_editable = ('sign_date', 'category_id') + list_filter = ('name', 'sign_date', 'category_id',) + fields = ('name', 'url', 'chapter_id', 'category_id', 'sign_date') + +admin.site.register(SafetyFile, SafetyFileAdmin) \ No newline at end of file diff --git a/src/safety/apps.py b/src/safety/apps.py new file mode 100644 index 000000000..cfab6d215 --- /dev/null +++ b/src/safety/apps.py @@ -0,0 +1,7 @@ +from django.apps import AppConfig + + +class SafetyConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'safety' + verbose_name = 'Раздел Безопасность' diff --git a/src/safety/models.py b/src/safety/models.py new file mode 100644 index 000000000..1ff6bd9f8 --- /dev/null +++ b/src/safety/models.py @@ -0,0 +1,50 @@ +from django.db import models +from enum import Enum + +# Create your models here. + +class EnumChoice(Enum): + @classmethod + def get_choices(cls): + return [(enum_.name, enum_.value) for enum_ in cls] + +class SafetyChapter(EnumChoice): + fire_safety = "Пожарная безопасность" + information_safety = "Информационная безопасность" + occupational_safety = "Охрана труда" + access_mode = "Пропускной и внутриобъектовый режим" + civil_defense = "Гражданская оборона" + state_secrets = "Защита гостайны" + military_registration = "Мобилизационная подготовка и воинский учет" + +class SafetyDocumentCategory(EnumChoice): + regulations = "Нормативные документы" + instructions = "Инструкции" + orders = "Приказы" + provisions = "Положения" + educational_materials = "Учебные материалы" + laws = "Законы" + decrees = "Указы" + resolutions = "Постановления" + thematic_materials = "Тематические материалы" + methodological_materials = "Методологические материалы" + evacuation_plan = 'План эвакуации' + + +# Общая модель для раздела "Безопасность" +class SafetyFile(models.Model): + name = models.CharField(verbose_name='Имя документа', max_length=255) + url = models.FileField(verbose_name='Путь до файла',upload_to='safety') + chapter_id = models.CharField(verbose_name='Раздел', max_length=255, blank=False, db_index=True, choices=SafetyChapter.get_choices()) + category_id = models.CharField(verbose_name='Категория документа', max_length=255, blank=False, db_index=True, choices=SafetyDocumentCategory.get_choices()) + sign_date = models.DateField(verbose_name='Дата документа') + created_at = models.DateTimeField(verbose_name='Дата загрузки файла', auto_now_add=True) + update_at = models.DateTimeField(verbose_name='Дата обновления файла', auto_now=True) + + class Meta: + + verbose_name = 'Документы раздела безопасности' + verbose_name_plural = 'Документы раздела безопасности' + + def __str__(self): + return str(self.name) \ No newline at end of file diff --git a/src/safety/serializers.py b/src/safety/serializers.py new file mode 100644 index 000000000..1aa52367f --- /dev/null +++ b/src/safety/serializers.py @@ -0,0 +1,10 @@ +from rest_framework import serializers +from .models import * + +class SafetyFileSerializer(serializers.ModelSerializer): + chapter_name = serializers.CharField(source='get_chapter_id_display') + category_name = serializers.CharField(source='get_category_id_display') + + class Meta: + model = SafetyFile + fields = '__all__' \ No newline at end of file diff --git a/src/safety/tests.py b/src/safety/tests.py new file mode 100644 index 000000000..7ce503c2d --- /dev/null +++ b/src/safety/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/src/safety/urls.py b/src/safety/urls.py new file mode 100644 index 000000000..a9c71245c --- /dev/null +++ b/src/safety/urls.py @@ -0,0 +1,10 @@ +from django.urls import path +from rest_framework.routers import DefaultRouter + +from .views import * + +urlpatterns = [ + path('files/', SafetyFileAPIView.as_view(), name='safety_files'), + path('responsibility/', SafetyResponsebilityAPIView.as_view(), name='responsibility'), + path('committee_files/', CommitteeFilesAPIView.as_view(), name='committee_files') +] \ No newline at end of file diff --git a/src/safety/views.py b/src/safety/views.py new file mode 100644 index 000000000..fa155b8bf --- /dev/null +++ b/src/safety/views.py @@ -0,0 +1,53 @@ +from itertools import groupby + +from django.shortcuts import render +from rest_framework.views import APIView +from rest_framework.response import Response +from .serializers import * +from .models import * +from userauth.serializers import * +from userauth.models import * +# Create your views here. + +class SafetyFileAPIView(APIView): + def get(self, request): + + chapters = self.request.query_params.get('chapter_id', 1) + all_file = SafetyFile.objects.filter(chapter_id=chapters).order_by('chapter_id', 'category_id').all() + serializer_for_file = SafetyFileSerializer(instance=all_file, many=True) + + data = [] + + for (chapter_id, chapter_name), row in groupby(serializer_for_file.data, lambda x: (x['chapter_id'], x['chapter_name'])): + chapter = { + 'id': chapter_id, + 'name': chapter_name, + 'categories': [] + } + data.append(chapter) + for (category_id, category_name), files in groupby(row, lambda x: (x['category_id'], x['category_name'])): + chapter['categories'].append({ + 'id': category_id, + 'name': category_name, + 'files': [file for file in files] + }) + + return Response(data) + +class SafetyResponsebilityAPIView(APIView): + + def get(self, request): + + fireuser = OrderResponsibility.objects.get(id=54) + responsobility_users = OrderResponsibilitySerializer(fireuser) + + return Response(responsobility_users.data) + +class CommitteeFilesAPIView(APIView): + + def get(self, request): + + committee_files = Committee1.objects.get(id=106) + files = Committee1Serializer(committee_files) + + return Response(files.data) \ No newline at end of file diff --git a/src/userauth/serializers.py b/src/userauth/serializers.py index 32ad54472..8bb917c93 100644 --- a/src/userauth/serializers.py +++ b/src/userauth/serializers.py @@ -8,16 +8,17 @@ class FileResponsiblitySerializer(serializers.ModelSerializer): class Meta: model = OrderResponsibilityFiles - fields = ['file_name', 'id'] + fields = ['file_name', 'id', 'id_order_responsibility'] class ResponsibilityUsersSerializer(serializers.ModelSerializer): fio=serializers.CharField(source='id_dict_employee.fio') id = serializers.IntegerField(source='id_dict_employee.id') + login = serializers.CharField(source='id_dict_employee.login') class Meta: model=OrderResponsibilityEmployee - fields=['fio','id'] + fields=['fio','id', 'login'] class OrderResponsibilitySerializer(serializers.ModelSerializer): @@ -30,7 +31,7 @@ class OrderResponsibilitySerializer(serializers.ModelSerializer): fields = '__all__' def respons_users(self,obj): - data = OrderResponsibilityEmployee.objects.filter(id_order_responsibility=obj.respons_users.id_order_responsibility) + data = OrderResponsibilityEmployee.objects.filter(id_order_responsibility=obj.id) return ResponsibilityUsersSerializer(data,many=True).data class Committee1FilesSerializer(serializers.ModelSerializer): @@ -112,10 +113,10 @@ class CardUserSerializer(serializers.ModelSerializer): class ShortUserSerializer(serializers.ModelSerializer): - + # login = serializers.CharField() - class Meta: - + class Meta: model = DictEmployee - fields = ['familyname', 'name', 'parentname', 'id', 'login', 'post', 'department'] \ No newline at end of file + fields = ['familyname', 'name', 'parentname', 'id', 'login', 'post', 'department'] + # fields='__all__' \ No newline at end of file diff --git a/src/watcher/serializers.py b/src/watcher/serializers.py index bf0621e92..036c77651 100644 --- a/src/watcher/serializers.py +++ b/src/watcher/serializers.py @@ -15,3 +15,27 @@ class CountSerializer(serializers.ModelSerializer): def get_user(self, obj): return ShortUserSerializer(DictEmployee.objects.get(login=obj.user)).data + +class VisitdateSerializer(serializers.ModelSerializer): + class Meta: + model = CountVisitor + fields = ['visitdate'] + + +class PagesSerializer(serializers.ModelSerializer): + user = serializers.SerializerMethodField('get_user') + pages = serializers.CharField(source='pages.page') + fullPath = serializers.CharField(source='pages.fullPath') + ico = serializers.CharField(source='pages.ico') + + class Meta: + model = CountVisitor + fields = ['user', 'pages', 'fullPath', 'ico', 'visitdate', 'count'] + + def get_user(self, obj): + + return ShortUserSerializer(obj.user.user).data + + + + diff --git a/src/watcher/urls.py b/src/watcher/urls.py index 261002e4a..53d81a2b2 100644 --- a/src/watcher/urls.py +++ b/src/watcher/urls.py @@ -3,6 +3,7 @@ from .views import * urlpatterns = [ path('counter/', Counter.as_view(),name="CountVisitors"), + path('testwatcher/', TestwatcherAPIView.as_view(), name="Testwatcher"), path('selectedlinks/', SelectedLinksAPIView.as_view(),name="SelectedLinks") # path('', views.Watchuser.as_view()), selectedlinks diff --git a/src/watcher/views.py b/src/watcher/views.py index c02e965a4..94a4613f6 100644 --- a/src/watcher/views.py +++ b/src/watcher/views.py @@ -6,8 +6,8 @@ from rest_framework.permissions import AllowAny, IsAuthenticated from rest_framework.response import Response from django.views.generic import ListView from .serializers import * -from datetime import date -from django.db.models import Sum +from datetime import date, datetime, timedelta +from django.db.models import Sum, Q, Count, Avg, F, Max from userauth.models import * from feedback.models import * from feedback.serializers import * @@ -18,20 +18,19 @@ class Counter(ListAPIView): permission_classes = (AllowAny,) serializer_class = CountSerializer + + def get(self, request): - res = CountVisitor.objects.filter(visitdate__range=[request.GET.get("start"), request.GET.get("end")]).annotate(Sum('count')) - - result = CountSerializer(res, many=True).data + data = UserComment.objects.filter(Q(time_create__range=['2024-01-01', '2024-03-01']), ~Q(comment='')). \ + values().order_by('-time_create') + - - # Обратная связь - feed = RatingStatus.objects.filter(usercom__time_create__range=[request.GET.get("start"), request.GET.get("end")]) - feedback = RatingStatusStatSerializer(feed, many=True).data - - return Response({'result':result, 'feedback':feedback}) + return Response(data) + def post(self, request): + myfullPath = request.data['fullPath'] if "?" in myfullPath: myfullPath= myfullPath.split("?")[0] @@ -40,16 +39,18 @@ class Counter(ListAPIView): if request.data['user__id'] is not None: watch,create = CountVisitor.objects.get_or_create(user = User(id=request.data['user__id']),pages=page, visitdate=date.today()) - # else: - # watch,create = CountVisitor.objects.get_or_create(user__id__isnull=True, pages=page, visitdate=date.today()) + watch.count+=1 watch.save() - + + datavisit = CountVisitor.objects.filter(pages=page.id).earliest('visitdate') + res = {"totalvisit": CountVisitor.objects.filter(pages=page.id).aggregate(Sum('count'))['count__sum'], "visittoday":CountVisitor.objects.filter(visitdate=date.today(), pages=page.id).aggregate(Sum('count'))['count__sum'], - "uniqtoday" : CountVisitor.objects.filter(visitdate=date.today(), pages=page.id).count() + "uniqtoday" : CountVisitor.objects.filter(visitdate=date.today(), pages=page.id).count(), + "visitdate" : VisitdateSerializer(datavisit).data['visitdate'] } - + return Response(res) class SelectedLinksAPIView(ListAPIView): @@ -60,4 +61,52 @@ class SelectedLinksAPIView(ListAPIView): sort = res.order_by('-count__sum')[:20] return Response(sort) + +class TestwatcherAPIView(ListAPIView): + + def get(self, request): + + data_start = datetime.strptime(request.GET.get("start"), "%Y-%m-%d").date() + data_end = datetime.strptime(request.GET.get("end"), "%Y-%m-%d").date() + data_rating = data_end + timedelta(days=1) + beetween = data_end - (data_start - timedelta(days=1)) + +# + res = CountVisitor.objects.filter(visitdate__lt = request.GET.get("start"), visitdate__gte=data_start - beetween*2).distinct().values('visitdate','user__user_id') + # .annotate(total=Count('user', distinct=True)).order_by('visitdate') + per = CountVisitor.objects.filter(Q(visitdate__lte = request.GET.get("end"), visitdate__gte =request.GET.get("start")) | Q(visitdate=date.today())) + + # Обратная связь + feed = UserComment.objects.all() + rating = RatingStatus.objects.values('crit__name', 'crit__ico', 'crit__color', 'rating').filter(usercom__time_create__range=[request.GET.get("start"), data_rating]) + + + d = feed.filter(time_create__range=[request.GET.get("start"), data_rating]) + return Response({ + 'beforperiod': res, + 'period': PagesSerializer(per, many= True).data, + 'staff': DictEmployee.objects.filter(Q(deleteddate__isnull= True) | Q(deleteddate__gte = request.GET.get("end"))).count(), + 'feedback': { + 'feed': UserCommentSerializer(d, many=True).data, + + 'criteria': list(rating.values('crit__name').annotate(ratings=Avg('rating'), name=F('crit__name'), ico=F('crit__ico'), color=F('crit__color')).values('ratings', 'name', 'ico', 'color')), + 'data': { + 'score': { + 'title': 'Поставлено оценок', + 'all': feed.count(), + 'period': feed.filter(time_create__range=[request.GET.get("start"), request.GET.get("end")]).count() + }, + 'comment': { + 'title': 'Оставлено комментариев', + 'all': feed.filter(~Q(comment='')).count(), + 'period': feed.filter(Q(time_create__range=[request.GET.get("start"), request.GET.get("end")]) & ~Q(comment='')).count() + } + }, + 'last_comment': feed.values('time_create').filter(~Q(comment='')).latest('time_create'), + + }, + + }) + + \ No newline at end of file diff --git a/sys/portal.conf b/sys/portal.conf deleted file mode 100644 index bf65e2ea9..000000000 --- a/sys/portal.conf +++ /dev/null @@ -1,150 +0,0 @@ - - -# Daphne, Django channels backend -upstream portal-backend { - server 127.0.0.1:9967; - } - -#Flask backend for UKD Wizard -# -#upstream wizard-backend { -# server 10.252.44.60:8888; -# } - -# PORTAL Test server -server { - - listen 9966; - server_name 9966; - - - send_timeout 600; - proxy_connect_timeout 600; - proxy_send_timeout 600; - proxy_read_timeout 600; - - root /var/www/PORTAL_COD2/src/front/dist/; - include /etc/nginx/mime.types; - access_log /var/log/nginx/portal.access.log; - error_log /var/log/nginx/portal.error.log; - - location / { - try_files $uri /index.html; - } - -# location ~ ^.*/static/(.+\.xlsx)/$ { -# alias /var/www/portal/portal/static; -# } - - location /static { - autoindex on; - alias /var/www/PORTAL_COD2/src/portal/static/; - } - - location /media { - alias /var/www/PORTAL_COD2/src/portal/media; - - } - - location ^~ /api/ { - client_max_body_size 100m; - include proxy_params; - proxy_pass http://127.0.0.1:8085; - } -# error_page 500 502 503 504 /500.html; -# location = /500.html { -# root /var/www/proj/; -# internal; -# } -# location /testing { -# fastcgi_pass unix:/does/not/exit; -#} -# VS 20220530 - Test reverse proxy for statistics as susbsite -## location /stat { -## rewrite ^/stat(.*) /$1 break; -# proxy_set_header Host "stat"; -### 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; -### autoindex on; -# -### proxy_pass http://127.0.0.1:8080; -### } - - -location /ws/ { - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - proxy_redirect off; - proxy_pass http://portal-backend; - 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-Host $server_name; - } - -# Wizard integration -# vs@20220831 -#location /wizard/ { -# proxy_http_version 1.1; -# proxy_set_header Upgrade $http_upgrade; -# proxy_set_header Connection "upgrade"; - #proxy_redirect off; -# proxy_set_header Host $host; -#proxy_set_header Host $http_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-Host $server_name; -# proxy_set_header X-Forwarded-Proto $scheme; -# proxy_pass http://wizard-backend/; - #proxy_pass http://wizard-backend/wizard; -# include proxy_params; -# } -##location /_next/ { -## proxy_http_version 1.1; -## proxy_set_header Upgrade $http_upgrade; -## proxy_set_header Connection "upgrade"; -## #proxy_redirect off; -## proxy_set_header Host $host; -#proxy_set_header Host $http_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-Host $server_name; -## proxy_set_header X-Forwarded-Proto $scheme; -## proxy_pass http://wizard-backend/; -## #proxy_pass http://wizard-backend/wizard; -# include proxy_params; -## } - -# Test redirection - all works fine. -# http://ukt/node-red/ -> http://10.252.44.35:1880/ -# vs@20220831 -## location /node-red/ { -## proxy_http_version 1.1; -## proxy_set_header Upgrade $http_upgrade; -## proxy_set_header Connection "upgrade"; -## proxy_set_header Host 10.252.44.35; -## 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; -## proxy_pass http://10.252.44.35:1880/; -## } -# Does not work -##location ^~ /wiki/ { -## proxy_http_version 1.1; -## proxy_set_header Upgrade $http_upgrade; -## proxy_set_header Connection "upgrade"; -## proxy_redirect off; -## #proxy_set_header Host $host; -## #proxy_set_header Host $http_host; -## proxy_set_header Host wiki.cod2.regions.tax.nalog.ru; - - - - - - - - -} diff --git a/sys/portal.service b/sys/test_server/daphne/portal.service(old_gunicorn) similarity index 98% rename from sys/portal.service rename to sys/test_server/daphne/portal.service(old_gunicorn) index 8c1368828..dfaa03d80 100644 --- a/sys/portal.service +++ b/sys/test_server/daphne/portal.service(old_gunicorn) @@ -7,7 +7,7 @@ After=network.target [Service] User=root #WorkingDirectory=/var/www/proj/DQM/dqmback -WorkingDirectory=/var/www/PORTAL_COD2/src/ +WorkingDirectory=/var/www/PORTAL_COD2/src # --timeout NNN - set timeout for gunicorn to NNN sec, default - 30sec # --access-logfile FILENAME - log all requests to file FILENAMEA # --error-logfile FILENAME - set error log file to FILENAME diff --git a/sys/portaldaphne.service b/sys/test_server/daphne/portaldaphne.service similarity index 85% rename from sys/portaldaphne.service rename to sys/test_server/daphne/portaldaphne.service index 1d94b7bb6..69fc3f186 100644 --- a/sys/portaldaphne.service +++ b/sys/test_server/daphne/portaldaphne.service @@ -7,7 +7,7 @@ Type=simple User=root #Group = nginx WorkingDirectory=/var/www/PORTAL_COD2/src -ExecStart=/var/www/PORTAL_COD2/env/bin/python /var/www/PORTAL_COD2/env/bin/daphne -p 9967 portal.asgi:application +ExecStart=/var/www/PORTAL_COD2/env/bin/python /var/www/PORTAL_COD2/env/bin/daphne -p 9966 portal.asgi:application Restart=on-failure [Install] diff --git a/sys/test_server/nginx/portal.conf b/sys/test_server/nginx/portal.conf new file mode 100644 index 000000000..668f79142 --- /dev/null +++ b/sys/test_server/nginx/portal.conf @@ -0,0 +1,65 @@ + + +# Daphne, Django channels backend +upstream portal-backend { + server 127.0.0.1:9966; + } + + +# PORTAL Test server +server { + + listen 80; + + server_name portal-t portal-t.cod2.regions.tax.nalog.ru; + + send_timeout 600; + proxy_connect_timeout 600; + proxy_send_timeout 600; + proxy_read_timeout 600; + + root /var/www/PORTAL_COD2/src/front/dist/; + include /etc/nginx/mime.types; + access_log /var/log/nginx/portal.access.log; + error_log /var/log/nginx/portal.error.log; + + location / { + try_files $uri /index.html; + } + + + + location /static { + autoindex on; + alias /var/www/PORTAL_COD2/src/static/; + } + + location /media { + alias /var/www/PORTAL_COD2/src/media; + + } + + location ^~ /api/ { + client_max_body_size 100m; + include proxy_params; + proxy_pass http://portal-backend; + } + + location ^~ /admin { + include proxy_params; + proxy_pass http://portal-backend; +} + + +location /ws/ { + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_redirect off; + proxy_pass http://portal-backend; + 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-Host $server_name; + } +}
Количество баллов: {{ selected }}