22 Commits

Author SHA1 Message Date
Primakov Alexandr Alexandrovich
e21b41f9ca 3.1.1
Some checks failed
platform/bro/pipeline/head This commit looks good
platform/gitea-bro-js/journal.pl/pipeline/head There was a failure building this commit
platform/bro/pipeline/tag This commit looks good
2024-08-12 00:05:37 +03:00
Primakov Alexandr Alexandrovich
cb3629bd43 global __webpack_public_path__ 2024-08-12 00:05:30 +03:00
Primakov Alexandr Alexandrovich
65216843ac 3.1.0
All checks were successful
platform/bro/pipeline/head This commit looks good
2024-08-11 23:55:48 +03:00
Primakov Alexandr Alexandrovich
a76fce5506 ym
All checks were successful
platform/bro/pipeline/head This commit looks good
2024-08-11 23:54:27 +03:00
Primakov Alexandr Alexandrovich
c842befc8f 3.0.0
All checks were successful
platform/bro/pipeline/head This commit looks good
platform/bro/pipeline/tag This commit looks good
2024-08-11 23:36:53 +03:00
Primakov Alexandr Alexandrovich
fb267a11f9 remove comment
Some checks failed
platform/bro/pipeline/head This commit looks good
platform/gitea-bro-js/journal.pl/pipeline/head There was a failure building this commit
platform/bro-js/journal.pl/pipeline/head This commit looks good
2024-08-07 23:37:45 +03:00
Primakov Alexandr Alexandrovich
a94acbf7d3 better Jenkins file
Some checks failed
platform/bro/pipeline/head This commit looks good
platform/gitea-bro-js/journal.pl/pipeline/head There was a failure building this commit
platform/bro-js/journal.pl/pipeline/head This commit looks good
2024-08-07 23:32:19 +03:00
1cd1e26751 Merge pull request 'move 2 brojs' (#28) from feature/bro-js into master
All checks were successful
platform/bro/pipeline/head This commit looks good
Reviewed-on: #28
2024-08-05 22:30:26 +03:00
Primakov Alexandr Alexandrovich
d7b521c2ec move 2 brojs
All checks were successful
platform/bro/pipeline/head This commit looks good
platform/bro/pipeline/pr-master This commit looks good
2024-08-05 22:10:34 +03:00
Primakov Alexandr Alexandrovich
a669e2af81 2.4.5
All checks were successful
platform/bro/pipeline/head This commit looks good
2024-08-03 22:59:57 +03:00
Primakov Alexandr Alexandrovich
f093c0f3ad fix kc config -> bro-js 2024-08-03 22:59:49 +03:00
61cfd689f8 2.4.4
All checks were successful
platform/bro/pipeline/head This commit looks good
2024-04-27 11:54:26 +03:00
82a54022b2 Merge pull request '#25 Отображение только времени в случае сгрупированных по дате лекций' (#26) from feature/lesson-date-time into master
All checks were successful
platform/bro/pipeline/head This commit looks good
Reviewed-on: https://git.inno-js.ru/bro-js/journal.pl/pulls/26
2024-04-15 13:48:39 +03:00
f28c644da5 #25 Отображение только времени в случае сгрупированных по дате лекций
All checks were successful
platform/bro/pipeline/head This commit looks good
platform/bro/pipeline/pr-master This commit looks good
2024-04-15 13:45:35 +03:00
50bf5b31b6 2.4.3
All checks were successful
platform/bro/pipeline/head This commit looks good
2024-04-11 13:03:27 +03:00
5670a96696 check jenkins script
All checks were successful
platform/bro/pipeline/head This commit looks good
2024-04-11 12:52:40 +03:00
3a13b68a3d 2.4.2
All checks were successful
platform/bro/pipeline/head This commit looks good
2024-04-09 23:38:59 +03:00
fc3366d52a gropu and sort lessons
All checks were successful
platform/bro/pipeline/head This commit looks good
2024-04-09 23:38:51 +03:00
99c95d0706 2.4.1
All checks were successful
platform/bro/pipeline/head This commit looks good
2024-04-09 22:56:02 +03:00
0bdae7fc23 bugfix sorting & grouping
All checks were successful
platform/bro/pipeline/head This commit looks good
2024-04-09 22:53:51 +03:00
814e089a67 2.4.0
All checks were successful
platform/bro/pipeline/head This commit looks good
2024-04-09 21:25:44 +03:00
8f08b5ca52 group by date feature
All checks were successful
platform/bro/pipeline/head This commit looks good
2024-04-09 21:25:36 +03:00
16 changed files with 1617 additions and 3485 deletions

22
Jenkinsfile vendored
View File

@@ -1,7 +1,7 @@
pipeline { pipeline {
agent { agent {
docker { docker {
image 'node:18' image 'node:20'
} }
} }
@@ -10,10 +10,28 @@ pipeline {
steps { steps {
sh 'node -v' sh 'node -v'
sh 'npm -v' sh 'npm -v'
script {
String tag = sh(returnStdout: true, script: 'git tag --contains').trim()
String branchName = sh(returnStdout: true, script: 'git rev-parse --abbrev-ref HEAD').trim()
String commit = sh(returnStdout: true, script: 'git log -1 --oneline').trim()
String commitMsg = commit.substring(commit.indexOf(' ')).trim()
if (tag) {
currentBuild.displayName = "#${BUILD_NUMBER}, tag ${tag}"
} else {
currentBuild.displayName = "#${BUILD_NUMBER}, branch ${branchName}"
}
String author = sh(returnStdout: true, script: "git log -1 --pretty=format:'%an'").trim()
currentBuild.description = "${author}<br />${commitMsg}"
echo 'starting installing'
sh 'npm ci' sh 'npm ci'
} }
} }
}
stage('checks') {
parallel {
stage('eslint') { stage('eslint') {
steps { steps {
sh 'npm run eslint' sh 'npm run eslint'
@@ -25,6 +43,8 @@ pipeline {
sh 'npm run build' sh 'npm run build'
} }
} }
}
}
stage('clean-all') { stage('clean-all') {
steps { steps {

View File

@@ -19,7 +19,7 @@ npm install
пропишите в hosts строку пропишите в hosts строку
``` ```
127.0.0.1 ift-b1.kc.inno-js.test 127.0.0.1 journal.test
``` ```
## Запуск ## Запуск
@@ -28,4 +28,4 @@ npm install
npm start npm start
``` ```
откройте в браузере [проект](http://ift-b1.kc.inno-js.test) откройте в браузере [проект](http://journal.test)

View File

@@ -4,24 +4,28 @@ module.exports = {
apiPath: 'stubs/api', apiPath: 'stubs/api',
webpackConfig: { webpackConfig: {
output: { output: {
publicPath: `/static/${pkg.name}/${process.env.VERSION || pkg.version}/` publicPath: `/static/${pkg.name}/${process.env.VERSION || pkg.version}/`,
} },
}, },
navigations: { navigations: {
'journal.main': '/journal.pl' 'journal.main': '/journal.pl',
}, },
features: { features: {
'journal': { journal: {
// add your features here in the format [featureName]: { value: string } 'lesson.bar': {
"lesson.bar": { on: true,
"on": true, value: '',
"value": "", key: 'lesson.bar',
"key": "lesson.bar" },
} 'group.by.date': {
on: true,
value: '',
key: 'group.by.date',
},
}, },
}, },
config: { config: {
"journal.back.url": "/api", 'journal.back.url': '/api',
"journal.polling-interval": "10000" 'journal.polling-interval': '10000',
} },
} }

2
index.d.ts vendored
View File

@@ -2,3 +2,5 @@ declare module '*.svg' {
const src: string; const src: string;
export default src; export default src;
} }
declare const __webpack_public_path__: string;

4734
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,31 +1,31 @@
{ {
"name": "journal.pl", "name": "journal.pl",
"version": "2.3.0", "version": "3.1.1",
"description": "inno-js platform journal ui repo", "description": "bro-js platform journal ui repo",
"main": "./src/index.tsx", "main": "./src/index.tsx",
"scripts": { "scripts": {
"start": "start chrome http://ift-b1.kc.inno-js.test/journal.pl & ijl-cli server --port=80", "start": "brojs server --port=8099 --with-open-browser",
"build": "npm run clean && ijl-cli build --dev", "build": "npm run clean && brojs build --dev",
"build:prod": "npm run clean && ijl-cli build", "build:prod": "npm run clean && brojs build",
"clean": "rimraf dist", "clean": "rimraf dist",
"test": "echo ok", "test": "echo ok",
"eslint": "npx eslint ." "eslint": "npx eslint ."
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "ssh://git@85.143.175.152:10022/omni-tech/journal.pl.git" "url": "ssh://git@85.143.175.152:222/bro-js/journal.pl.git"
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@ijl/cli": "^5.0.3",
"@typescript-eslint/eslint-plugin": "^7.4.0", "@typescript-eslint/eslint-plugin": "^7.4.0",
"@typescript-eslint/parser": "^7.4.0", "@typescript-eslint/parser": "^7.4.0",
"eslint": "^8.57.0", "eslint": "^8.57.0",
"eslint-plugin-react": "^7.34.1" "eslint-plugin-react": "^7.34.1"
}, },
"dependencies": { "dependencies": {
"@brojs/cli": "^0.0.4-alpha.9",
"@chakra-ui/icons": "^2.1.1", "@chakra-ui/icons": "^2.1.1",
"@chakra-ui/react": "^2.8.2", "@chakra-ui/react": "^2.8.2",
"@emotion/react": "^11.11.4", "@emotion/react": "^11.11.4",
@@ -35,18 +35,19 @@
"@types/react": "^18.2.60", "@types/react": "^18.2.60",
"@types/react-dom": "^18.2.19", "@types/react-dom": "^18.2.19",
"dayjs": "^1.11.10", "dayjs": "^1.11.10",
"express": "^4.18.2", "express": "^4.19.2",
"js-sha256": "^0.11.0", "js-sha256": "^0.11.0",
"keycloak-js": "^23.0.7", "keycloak-js": "^23.0.7",
"prettier": "^3.2.5", "prettier": "^3.2.5",
"qrcode": "^1.5.3", "qrcode": "^1.5.3",
"react": "^18.2.0", "react": "^18.3.1",
"react-dom": "^18.2.0", "react-dom": "^18.3.1",
"react-helmet": "^6.1.0", "react-helmet": "^6.1.0",
"react-hook-form": "^7.51.2", "react-hook-form": "^7.51.2",
"react-redux": "^9.1.0", "react-redux": "^9.1.0",
"react-router-dom": "^6.22.1", "react-router-dom": "^6.22.1",
"redux": "^5.0.1", "redux": "^5.0.1",
"typescript": "^5.3.3" "typescript": "^5.3.3",
"webpack-hot-middleware": "^2.26.1"
} }
} }

View File

@@ -1,5 +1,5 @@
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react' import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
import { getConfigValue } from '@ijl/cli' import { getConfigValue } from '@brojs/cli'
import { keycloak } from '../kc' import { keycloak } from '../kc'
import { import {

View File

@@ -1,8 +1,8 @@
import Keycloak from 'keycloak-js'; import Keycloak from 'keycloak-js';
export const keycloak = new Keycloak({ export const keycloak = new Keycloak({
url: 'https://kc.inno-js.ru', url: 'https://kc.bro-js.ru',
realm: 'inno-js', realm: 'bro-js',
clientId: 'journal' clientId: 'journal'
}); });

View File

@@ -10,8 +10,7 @@ import { Dashboard } from './dashboard';
dayjs.locale('ru', ruLocale); dayjs.locale('ru', ruLocale);
const App = ({ store }) => { const App = ({ store }) => (
return(
<ChakraProvider> <ChakraProvider>
<BrowserRouter> <BrowserRouter>
<Helmet> <Helmet>
@@ -81,7 +80,6 @@ const App = ({ store }) => {
</BrowserRouter> </BrowserRouter>
</ChakraProvider> </ChakraProvider>
) )
}
export default App; export default App;

View File

@@ -1,7 +1,7 @@
import React, { useEffect, Suspense } from 'react' import React, { useEffect, Suspense } from 'react'
import { Routes, Route, useNavigate } from 'react-router-dom' import { Routes, Route, useNavigate } from 'react-router-dom'
import { Provider } from 'react-redux' import { Provider } from 'react-redux'
import { getNavigationsValue } from '@ijl/cli' import { getNavigationsValue } from '@brojs/cli'
import { Box, Container, Spinner, VStack } from '@chakra-ui/react' import { Box, Container, Spinner, VStack } from '@chakra-ui/react'
import { import {

View File

@@ -2,6 +2,7 @@ import React from 'react';
import ReactDOM from 'react-dom/client'; import ReactDOM from 'react-dom/client';
import App from './app'; import App from './app';
import './ym';
import { keycloak } from "./__data__/kc"; import { keycloak } from "./__data__/kc";
import { createStore } from "./__data__/store"; import { createStore } from "./__data__/store";
@@ -12,7 +13,7 @@ let rootElement: ReactDOM.Root
export const mount = async (Сomponent, element = document.getElementById('app')) => { export const mount = async (Сomponent, element = document.getElementById('app')) => {
let user = null; let user = null;
try { try {
await keycloak.init({ onLoad: "login-required" }); // 'login-required' }); await keycloak.init({ onLoad: "login-required" });
user = { ...(await keycloak.loadUserInfo()), ...keycloak.tokenParsed }; user = { ...(await keycloak.loadUserInfo()), ...keycloak.tokenParsed };
} catch (error) { } catch (error) {
console.error("Failed to initialize adapter:", error); console.error("Failed to initialize adapter:", error);

View File

@@ -1,7 +1,7 @@
import React, { useCallback, useEffect, useRef, useState } from 'react' import React, { useCallback, useEffect, useRef, useState } from 'react'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { Link as ConnectedLink } from 'react-router-dom' import { Link as ConnectedLink } from 'react-router-dom'
import { getNavigationsValue } from '@ijl/cli' import { getNavigationsValue } from '@brojs/cli'
import { import {
Box, Box,
CardHeader, CardHeader,

View File

@@ -3,7 +3,7 @@ import { useParams, Link } from 'react-router-dom'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import QRCode from 'qrcode' import QRCode from 'qrcode'
import { sha256 } from 'js-sha256' import { sha256 } from 'js-sha256'
import { getConfigValue, getNavigationsValue } from '@ijl/cli' import { getConfigValue, getNavigationsValue } from '@brojs/cli'
import { import {
Box, Box,
Breadcrumb, Breadcrumb,

View File

@@ -1,8 +1,13 @@
import React, { useEffect, useRef, useState } from 'react' import React, {
useEffect,
useMemo,
useRef,
useState,
} from 'react'
import { ResponsiveBar } from '@nivo/bar' import { ResponsiveBar } from '@nivo/bar'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { Link, useParams } from 'react-router-dom' import { Link, useParams } from 'react-router-dom'
import { getNavigationsValue, getFeatures } from '@ijl/cli' import { getNavigationsValue, getFeatures } from '@brojs/cli'
import { useForm, Controller } from 'react-hook-form' import { useForm, Controller } from 'react-hook-form'
import { import {
Breadcrumb, Breadcrumb,
@@ -52,13 +57,13 @@ import { api } from '../__data__/api/api'
import { isTeacher } from '../utils/user' import { isTeacher } from '../utils/user'
import { qrCode } from '../assets' import { qrCode } from '../assets'
import { Lesson } from '../__data__/model' import { Lesson } from '../__data__/model'
import pkg from '../../package.json'
import { ErrorSpan, BreadcrumbsWrapper } from './style' import { ErrorSpan, BreadcrumbsWrapper } from './style'
const features = getFeatures('journal') const features = getFeatures('journal')
const barFeature = features?.['lesson.bar'] const barFeature = features?.['lesson.bar']
const groupByDate = features?.['group.by.date']
interface NewLessonForm { interface NewLessonForm {
name: string name: string
@@ -178,7 +183,7 @@ const LessonForm = ({
const LessonList = () => { const LessonList = () => {
const { courseId } = useParams() const { courseId } = useParams()
const user = useAppSelector((s) => s.user) const user = useAppSelector((s) => s.user)
const { data, isLoading, error } = api.useLessonListQuery(courseId) const { data, isLoading, error, isSuccess } = api.useLessonListQuery(courseId)
const [createLesson, crLQuery] = api.useCreateLessonMutation() const [createLesson, crLQuery] = api.useCreateLessonMutation()
const [deleteLesson, deletingRqst] = api.useDeleteLessonMutation() const [deleteLesson, deletingRqst] = api.useDeleteLessonMutation()
const [updateLesson, updateLessonRqst] = api.useUpdateLessonMutation() const [updateLesson, updateLessonRqst] = api.useUpdateLessonMutation()
@@ -189,6 +194,37 @@ const LessonList = () => {
const toastRef = useRef(null) const toastRef = useRef(null)
const createdLessonRef = useRef(null) const createdLessonRef = useRef(null)
const [editLesson, setEditLesson] = useState<Lesson>(null) const [editLesson, setEditLesson] = useState<Lesson>(null)
const sorted = useMemo(() => [...(data?.body || [])]?.sort((a, b) => a.date > b.date ? 1 : -1), [data, data?.body])
const lessonCalc = useMemo(() => {
if (!isSuccess) {
return []
}
if (!groupByDate) {
return [{ date: '', data: sorted }]
}
const lessonsData = []
for (let i = 0; i < sorted.length; i++) {
const element = sorted[i]
const find = lessonsData.find(
(item) => dayjs(element.date).diff(dayjs(item.date), 'day') === 0,
)
if (find) {
find.data.push(element)
} else {
lessonsData.push({
date: element.date,
data: [element],
})
}
}
return lessonsData.sort((a, b) => a.date < b.date? 1 : -1)
}, [groupByDate, isSuccess, sorted])
const onSubmit = (lessonData) => { const onSubmit = (lessonData) => {
toastRef.current = toast({ toastRef.current = toast({
@@ -369,10 +405,10 @@ const LessonList = () => {
)} )}
</Box> </Box>
)} )}
{barFeature && ( {barFeature && sorted?.length && (
<Box height="300"> <Box height="300">
<Bar <Bar
data={data?.body.map((lesson, index) => ({ data={sorted.map((lesson, index) => ({
lessonIndex: `#${index + 1}`, lessonIndex: `#${index + 1}`,
count: lesson.students.length, count: lesson.students.length,
}))} }))}
@@ -397,7 +433,10 @@ const LessonList = () => {
</Tr> </Tr>
</Thead> </Thead>
<Tbody> <Tbody>
{data?.body?.map((lesson) => ( {lessonCalc?.map(({ data: lessons, date }) => (
<React.Fragment key={date}>
{date && <Tr><Td colSpan={isTeacher(user) ? 5 : 3}>{dayjs(date).format('DD MMMM YYYY')}</Td></Tr>}
{lessons.map((lesson) => (
<Tr key={lesson._id}> <Tr key={lesson._id}>
{isTeacher(user) && ( {isTeacher(user) && (
<Td> <Td>
@@ -414,7 +453,7 @@ const LessonList = () => {
</Td> </Td>
)} )}
<Td textAlign="center"> <Td textAlign="center">
{dayjs(lesson.date).format('H:mm DD.MM.YY')} {dayjs(lesson.date).format(groupByDate ? 'HH:mm' : 'HH:mm DD.MM.YY')}
</Td> </Td>
<Td>{lesson.name}</Td> <Td>{lesson.name}</Td>
{isTeacher(user) && ( {isTeacher(user) && (
@@ -432,7 +471,9 @@ const LessonList = () => {
> >
Edit Edit
</MenuItem> </MenuItem>
<MenuItem onClick={() => setlessonToDelete(lesson)}> <MenuItem
onClick={() => setlessonToDelete(lesson)}
>
Delete Delete
</MenuItem> </MenuItem>
</MenuList> </MenuList>
@@ -442,6 +483,8 @@ const LessonList = () => {
<Td isNumeric>{lesson.students.length}</Td> <Td isNumeric>{lesson.students.length}</Td>
</Tr> </Tr>
))} ))}
</React.Fragment>
))}
</Tbody> </Tbody>
</Table> </Table>
</TableContainer> </TableContainer>
@@ -452,7 +495,7 @@ const LessonList = () => {
export default LessonList export default LessonList
const Bar = ({ data /* see data tab */ }) => ( const Bar = ({ data }) => (
<ResponsiveBar <ResponsiveBar
data={data} data={data}
keys={['count']} keys={['count']}

15
src/ym.ts Normal file
View File

@@ -0,0 +1,15 @@
(function (m, e, t, r, i, k, a) {
m[i] = m[i] || function () { (m[i].a = m[i].a || []).push(arguments) };
// @ts-ignore
m[i].l = 1 * new Date();
for (var j = 0; j < document.scripts.length; j++) { if (document.scripts[j].src === r) { return; } }
k = e.createElement(t), a = e.getElementsByTagName(t)[0], k.async = 1, k.src = r, a.parentNode.insertBefore(k, a)
})(window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");
// @ts-ignore
ym(98045358, "init", {
clickmap: true,
trackLinks: true,
accurateTrackBounce: true,
webvisor: true
});