chore [P-12]: kdkdk

This commit is contained in:
Nukeap committed 2025-02-10 13:06:51 +03:00
1 parent c156614ee3
commit bcdcabb4a1
12 files changed
+312 -44

No files matched your search

+5 -3
View File
@@ -8,9 +8,10 @@ WORKDIR /app
# Копируем package.json и package-lock.json (если доступен) в рабочую директорию # Копируем package.json и package-lock.json (если доступен) в рабочую директорию
COPY --chown=app:app package.json ./ COPY --chown=app:app package.json ./
# COPY package-lock.json ./ # Раскомментируйте эту строку, если у вас есть package-lock.json # COPY package-lock.json ./ # Раскомментируйте эту строку, если у вас есть package-lock.json
# COPY --chown=app:app ./docs/ ./docs/ COPY --chown=app:app ./docs/ ./docs/
# Очищаем кэш npm и устанавливаем зависимости # Очищаем кэш npm и устанавливаем зависимости
# RUN npm install RUN npm install
# RUN npm run githooks # RUN npm run githooks
COPY --chown=app:app src/front/package.json ./src/front/package.json COPY --chown=app:app src/front/package.json ./src/front/package.json
RUN npm install --prefix ./src/front RUN npm install --prefix ./src/front
@@ -24,4 +25,5 @@ EXPOSE 5173 3000
# Команда для запуска приложения # Команда для запуска приложения
# & npm run dev --prefix ./src/front # & npm run dev --prefix ./src/front
# & npm run dev --prefix ./src/front # & npm run dev --prefix ./src/front
CMD ["sh", "-c", "npm run dev --prefix ./src/front "] # CMD ["sh", "-c", "npm run dev --prefix ./src/front "]
CMD ["sh", "-c", "npm run docs:dev & npm run dev --prefix ./src/front "]
+7 -13
View File
@@ -12,22 +12,14 @@ services:
context: ./ context: ./
volumes: volumes:
- ./docs:/app/docs - ./docs:/app/docs
- ./src/front:/app/src/front
- /app/node_modules - /app/node_modules
- /app/src/front/node_modules - /app/src/front/node_modules
ports: ports:
- "3000:3000" - "3000:3000"
- "5173:5173"
develop:
watch:
- action: sync
path: ./src/front
target: /app/src/front
ignore:
- node_modules/
- action: rebuild
path: package.json
networks: networks:
- dev - dev
@@ -57,9 +49,11 @@ services:
restart: restart:
always always
build: build:
context: ./src/back context: .
dockerfile: src/back/Dockerfile
ports: ports:
- "8000:8000" - "8000:8000"
env_file: env_file:
- src/back/portal/.env - src/back/portal/.env
networks: networks:
+4 -4
View File
@@ -528,6 +528,10 @@ export default withMermaid({
"text": "MainmenuStore", "text": "MainmenuStore",
"link": "/src/store/MainmenuStore" "link": "/src/store/MainmenuStore"
}, },
{
"text": "UseAlertStore",
"link": "/src/store/UseAlertStore"
},
{ {
"text": "WeekendsStore", "text": "WeekendsStore",
"link": "/src/store/WeekendsStore" "link": "/src/store/WeekendsStore"
@@ -539,10 +543,6 @@ export default withMermaid({
{ {
"text": "index", "text": "index",
"link": "/src/store/index" "link": "/src/store/index"
},
{
"text": "useAlertStore",
"link": "/src/store/useAlertStore"
} }
] ]
}, },
+95 -16
View File
@@ -3,44 +3,109 @@
<div> <div>
<h2>Результаты тестов:</h2> <h2>Результаты тестов:</h2>
<!-- Общее состояние тестов -->
<div v-if="results.success" class="success">✅ Все тесты успешно пройдены!</div> <div v-if="results.success" class="success">✅ Все тесты успешно пройдены!</div>
<div v-else-if="results.numFailedTestSuites > 0" class="error"> <div v-else-if="results.numFailedTestSuites > 0" class="error">
❌ Ошибки в тестах: {{ results.numFailedTestSuites }} ❌ Ошибки в тестах: {{ results.numFailedTestSuites }} из {{ results.numTotalTestSuites }}
</div> </div>
<div v-else class="warning">⚠️ Некоторые тесты не завершились корректно.</div>
<!-- Сообщения об ошибках -->
<pre v-if="errorMessage" class="error-log">{{ errorMessage }}</pre> <pre v-if="errorMessage" class="error-log">{{ errorMessage }}</pre>
<ul> <!-- Сводная информация -->
<li v-for="test in results.testResults" :key="test.name"> <div v-if="results.testResults" class="summary">
<strong>{{ test.name }}</strong> <h3>Сводка по тестам:</h3>
<br> <ul>
<span v-if="test.status === 'passed'" class="passed">✅ Успешно</span> <li><strong>Общее количество тестов:</strong> {{ results.numTotalTests }}</li>
<span v-else class="failed">❌ Ошибка</span> <li>
<pre v-if="test.message" class="error-log">{{ test.message }}</pre> <strong>Пройдено:</strong> {{ results.numPassedTests }} ({{
</li> getPercentage(results.numPassedTests, results.numTotalTests)
</ul> }}%)
</li>
<li>
<strong>Неудачных:</strong> {{ results.numFailedTests }} ({{
getPercentage(results.numFailedTests, results.numTotalTests)
}}%)
</li>
</ul>
</div>
<!-- Список успешных тестов -->
<div v-if="passedTests.length">
<h3>Успешные тесты:</h3>
<ul>
<li v-for="test in passedTests" :key="test.fullName">
<strong>{{ test.fullName }}</strong> ✅ ({{ test.duration }} мс)
</li>
</ul>
</div>
<!-- Список неудачных тестов -->
<div v-if="failedTests.length">
<h3>Неудачные тесты:</h3>
<ul>
<li v-for="test in failedTests" :key="test.fullName">
<strong>{{ test.fullName }}</strong> ❌ ({{ test.duration }} мс)
<pre v-if="test.failureMessages.length" class="error-log">
{{ test.failureMessages.join('\n') }}
</pre>
</li>
</ul>
</div>
</div> </div>
</template> </template>
<script setup> <script setup>
import { ref, onMounted } from 'vue'; import { ref, onMounted, computed, watch } from 'vue';
const results = ref({}); const results = ref({});
const errorMessage = ref(''); const errorMessage = ref('');
// Функция для вычисления процента успешных/неудачных тестов
const getPercentage = (num, total) => {
return ((num / total) * 100).toFixed(2);
};
// Загружаем результаты тестов при монтировании компонента
onMounted(async () => { onMounted(async () => {
try { try {
const response = await fetch('/test-results.json'); const response = await fetch('/test-results.json');
const data = await response.json(); const data = await response.json();
results.value = data; results.value = data;
// Если есть ошибки, собираем все сообщения об ошибках
if (!data.success) { if (!data.success) {
errorMessage.value = data.testResults.map((t) => t.message).join('\n\n'); errorMessage.value = data.testResults
.map((t) => (t.failureMessages ? t.failureMessages.join('\n') : ''))
.join('\n\n');
} }
} catch (error) { } catch (error) {}
errorMessage.value = `Ошибка при загрузке результатов: ${error.message}`; });
}
// Вычисляем успешные и неудачные тесты
const passedTests = computed(() => {
const assertionResults = results.value?.testResults?.[0]?.assertionResults;
return (
assertionResults
?.filter((test) => test.status === 'passed')
.map((test) => ({
...test,
failureMessages: test.failureMessages || [],
})) || []
);
});
const failedTests = computed(() => {
const assertionResults = results.value?.testResults?.[0]?.assertionResults;
return (
assertionResults
?.filter((test) => test.status === 'failed')
.map((test) => ({
...test,
failureMessages: test.failureMessages || [],
})) || []
);
}); });
</script> </script>
@@ -55,6 +120,11 @@ onMounted(async () => {
font-weight: bold; font-weight: bold;
} }
.warning {
color: orange;
font-weight: bold;
}
.passed { .passed {
color: green; color: green;
} }
@@ -70,4 +140,13 @@ onMounted(async () => {
white-space: pre-wrap; white-space: pre-wrap;
font-family: monospace; font-family: monospace;
} }
.summary {
margin-bottom: 20px;
}
.duration {
color: #555;
font-style: italic;
}
</style> </style>
+2 -2
View File
@@ -1,9 +1,9 @@
# useAlertStore # UseAlertStore
Описание отсутствует. Описание отсутствует.
```js ```js
import * as useAlertStore from '@/components/store/useAlertStore'; import * as UseAlertStore from '@/components/store/UseAlertStore';
``` ```
--- ---
+6 -5
View File
@@ -8,20 +8,21 @@ RUN apt-get update && apt-get install -y \
pkg-config pkg-config
# Копируем файлы зависимостей в контейнер # Копируем файлы зависимостей в контейнер
COPY r.txt . COPY src/back/r.txt .
# Устанавливаем зависимости # Устанавливаем зависимости
RUN pip install -r r.txt RUN pip install -r r.txt
# Копируем все файлы проекта в контейнер # Копируем все файлы проекта в контейнер
COPY . . COPY src/back/ .
COPY sys/wait-for-it.sh /usr/local/bin/wait-for-it
# Выполняем миграции (при необходимости) # Выполняем миграции (при необходимости)
# RUN python manage.py makemigrations # RUN python manage.py makemigrations
# RUN python manage.py migrate # RUN python manage.py migrate
RUN chmod +x /usr/local/bin/wait-for-it
# Открываем порт, на котором будет работать приложение # Открываем порт, на котором будет работать приложение
EXPOSE 8000 EXPOSE 8000
# Команда для запуска приложения # Команда для запуска приложения
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"] # CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
CMD ["wait-for-it", "db:3306", "--", "python", "manage.py", "runserver", "0.0.0.0:8000"]
+1 -1
View File
@@ -43,7 +43,7 @@ CSRF_TRUSTED_ORIGINS = [
'http://127.0.0.1', 'http://127.0.0.1',
'http://yourdomain.com', # Add your production domain here 'http://yourdomain.com', # Add your production domain here
] ]
ALLOWED_HOSTS = ["*","portal-t",'portal9966','localhost','127.0.0.1'] ALLOWED_HOSTS = ["*","portal-t",'portal9966','localhost','0.0.0.0']
CHANNEL_LAYERS = { CHANNEL_LAYERS = {
"default": { "default": {
"BACKEND": "channels_redis.core.RedisChannelLayer", "BACKEND": "channels_redis.core.RedisChannelLayer",
+1
View File
@@ -1,6 +1,7 @@
{ {
"name": "front", "name": "front",
"version": "0.0.85", "version": "0.0.85",
"type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "vite build", "build": "vite build",
@@ -13,6 +13,8 @@
<template v-if="accountStore.cod2user"> <template v-if="accountStore.cod2user">
<vcard-user :author="accountStore.user" /> <vcard-user :author="accountStore.user" />
<v-tooltip location="bottom"> <v-tooltip location="bottom">
<template v-slot:activator="{ props }"> <template v-slot:activator="{ props }">
<v-btn color="black_and_white" v-bind="props" dark to="/faq" icon="mdi-comment-question-outline" /> <v-btn color="black_and_white" v-bind="props" dark to="/faq" icon="mdi-comment-question-outline" />
</template> </template>
@@ -25,11 +25,14 @@ export default {
const feedalert = useAlertStore().alert; const feedalert = useAlertStore().alert;
watch( watch(
() => feedalert, () => feedalert,
() => { () => {
setTimeout(function () { setTimeout(function () {
feedalert.text = ""; feedalert.text = "";
feedalert.ico = ""; feedalert.ico = "";
feedalert.color = ""; feedalert.color = "";
feedalert.alert = false; feedalert.alert = false;
}, 8000); }, 8000);
+4
View File
@@ -38,5 +38,9 @@ export default defineConfig({
server: { server: {
host: '0.0.0.0', host: '0.0.0.0',
port: 3000, port: 3000,
hmr:{
host: '0.0.0.0',
port: 3000,
}
}, },
}) })
+182
View File
@@ -0,0 +1,182 @@
#!/usr/bin/env bash
# Use this script to test if a given TCP host/port are available
WAITFORIT_cmdname=${0##*/}
echoerr() { if [[ $WAITFORIT_QUIET -ne 1 ]]; then echo "$@" 1>&2; fi }
usage()
{
cat << USAGE >&2
Usage:
$WAITFORIT_cmdname host:port [-s] [-t timeout] [-- command args]
-h HOST | --host=HOST Host or IP under test
-p PORT | --port=PORT TCP port under test
Alternatively, you specify the host and port as host:port
-s | --strict Only execute subcommand if the test succeeds
-q | --quiet Don't output any status messages
-t TIMEOUT | --timeout=TIMEOUT
Timeout in seconds, zero for no timeout
-- COMMAND ARGS Execute command with args after the test finishes
USAGE
exit 1
}
wait_for()
{
if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then
echoerr "$WAITFORIT_cmdname: waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT"
else
echoerr "$WAITFORIT_cmdname: waiting for $WAITFORIT_HOST:$WAITFORIT_PORT without a timeout"
fi
WAITFORIT_start_ts=$(date +%s)
while :
do
if [[ $WAITFORIT_ISBUSY -eq 1 ]]; then
nc -z $WAITFORIT_HOST $WAITFORIT_PORT
WAITFORIT_result=$?
else
(echo -n > /dev/tcp/$WAITFORIT_HOST/$WAITFORIT_PORT) >/dev/null 2>&1
WAITFORIT_result=$?
fi
if [[ $WAITFORIT_result -eq 0 ]]; then
WAITFORIT_end_ts=$(date +%s)
echoerr "$WAITFORIT_cmdname: $WAITFORIT_HOST:$WAITFORIT_PORT is available after $((WAITFORIT_end_ts - WAITFORIT_start_ts)) seconds"
break
fi
sleep 1
done
return $WAITFORIT_result
}
wait_for_wrapper()
{
# In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692
if [[ $WAITFORIT_QUIET -eq 1 ]]; then
timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --quiet --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT &
else
timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT &
fi
WAITFORIT_PID=$!
trap "kill -INT -$WAITFORIT_PID" INT
wait $WAITFORIT_PID
WAITFORIT_RESULT=$?
if [[ $WAITFORIT_RESULT -ne 0 ]]; then
echoerr "$WAITFORIT_cmdname: timeout occurred after waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT"
fi
return $WAITFORIT_RESULT
}
# process arguments
while [[ $# -gt 0 ]]
do
case "$1" in
*:* )
WAITFORIT_hostport=(${1//:/ })
WAITFORIT_HOST=${WAITFORIT_hostport[0]}
WAITFORIT_PORT=${WAITFORIT_hostport[1]}
shift 1
;;
--child)
WAITFORIT_CHILD=1
shift 1
;;
-q | --quiet)
WAITFORIT_QUIET=1
shift 1
;;
-s | --strict)
WAITFORIT_STRICT=1
shift 1
;;
-h)
WAITFORIT_HOST="$2"
if [[ $WAITFORIT_HOST == "" ]]; then break; fi
shift 2
;;
--host=*)
WAITFORIT_HOST="${1#*=}"
shift 1
;;
-p)
WAITFORIT_PORT="$2"
if [[ $WAITFORIT_PORT == "" ]]; then break; fi
shift 2
;;
--port=*)
WAITFORIT_PORT="${1#*=}"
shift 1
;;
-t)
WAITFORIT_TIMEOUT="$2"
if [[ $WAITFORIT_TIMEOUT == "" ]]; then break; fi
shift 2
;;
--timeout=*)
WAITFORIT_TIMEOUT="${1#*=}"
shift 1
;;
--)
shift
WAITFORIT_CLI=("$@")
break
;;
--help)
usage
;;
*)
echoerr "Unknown argument: $1"
usage
;;
esac
done
if [[ "$WAITFORIT_HOST" == "" || "$WAITFORIT_PORT" == "" ]]; then
echoerr "Error: you need to provide a host and port to test."
usage
fi
WAITFORIT_TIMEOUT=${WAITFORIT_TIMEOUT:-15}
WAITFORIT_STRICT=${WAITFORIT_STRICT:-0}
WAITFORIT_CHILD=${WAITFORIT_CHILD:-0}
WAITFORIT_QUIET=${WAITFORIT_QUIET:-0}
# Check to see if timeout is from busybox?
WAITFORIT_TIMEOUT_PATH=$(type -p timeout)
WAITFORIT_TIMEOUT_PATH=$(realpath $WAITFORIT_TIMEOUT_PATH 2>/dev/null || readlink -f $WAITFORIT_TIMEOUT_PATH)
WAITFORIT_BUSYTIMEFLAG=""
if [[ $WAITFORIT_TIMEOUT_PATH =~ "busybox" ]]; then
WAITFORIT_ISBUSY=1
# Check if busybox timeout uses -t flag
# (recent Alpine versions don't support -t anymore)
if timeout &>/dev/stdout | grep -q -e '-t '; then
WAITFORIT_BUSYTIMEFLAG="-t"
fi
else
WAITFORIT_ISBUSY=0
fi
if [[ $WAITFORIT_CHILD -gt 0 ]]; then
wait_for
WAITFORIT_RESULT=$?
exit $WAITFORIT_RESULT
else
if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then
wait_for_wrapper
WAITFORIT_RESULT=$?
else
wait_for
WAITFORIT_RESULT=$?
fi
fi
if [[ $WAITFORIT_CLI != "" ]]; then
if [[ $WAITFORIT_RESULT -ne 0 && $WAITFORIT_STRICT -eq 1 ]]; then
echoerr "$WAITFORIT_cmdname: strict mode, refusing to execute subprocess"
exit $WAITFORIT_RESULT
fi
exec "${WAITFORIT_CLI[@]}"
else
exit $WAITFORIT_RESULT
fi