Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
696d56a
Layout for application created, documentation added.
mroki58 Jun 16, 2025
1a45249
First idea for running test container. Created image with dockerfile…
mroki58 Jun 17, 2025
38f90ed
Session data taken correctly but it rerenders page again which throws…
mroki58 Jun 18, 2025
6b93174
Merge branch 'dev' into feature/TKN/OGUI-1711/implement-overall-layout
mroki58 Aug 20, 2025
6faffd1
- Added eslint configuration with established assumptions
mroki58 Aug 21, 2025
8231106
Merge remote-tracking branch 'origin/dev' into feature/TKN/OGUI-1724/…
mroki58 Aug 22, 2025
3374b5b
- Moved test files for UI to webapp folder
mroki58 Aug 22, 2025
8643941
Merge branch 'feature/TKN/OGUI-1711/implement-overall-layout' into fe…
mroki58 Aug 22, 2025
f0700da
- Proposed session checking logic with context api and hooks.
mroki58 Aug 24, 2025
5311ebf
- Proposed Tokenization project github workflow for UI tests ( eslint…
mroki58 Aug 25, 2025
5232c19
Double import fix
mroki58 Sep 3, 2025
ef7ecfb
Test commit for checking pushing with cuurent tokenization.yml
mroki58 Sep 3, 2025
7ae3345
npm ci => npm i because of some errors in lock file
mroki58 Sep 3, 2025
b75be95
- dependencies for building application taken from dev to normal depe…
mroki58 Sep 3, 2025
8fe9693
Actions for lint-checking in backend (waiting for guys for their chan…
mroki58 Sep 3, 2025
c2f5922
Merge branch 'feature/TKN/OGUI-1724/prepare-testing-env' into feature…
mroki58 Sep 3, 2025
05f7465
Typo correct
mroki58 Sep 3, 2025
7505c32
Updating .dockerignore
mroki58 Sep 3, 2025
d473dcf
Adjust test file
mroki58 Sep 3, 2025
a2a4648
Fixed type error in sidebar.tsx - changed wrong Props type
mroki58 Sep 19, 2025
15bf271
Adjusted eslint configuration file for linting and fixing mocha tests…
mroki58 Oct 7, 2025
e7cfafa
Merge branch 'dev' into feature/TKN/OGUI-1724/prepare-testing-env
mroki58 Oct 7, 2025
054f07a
Upgrade GitHub Actions to use latest versions
mroki58 Oct 31, 2025
3094201
Merge remote-tracking branch 'origin/dev' into feature/TKN/OGUI-1724/…
mroki58 Nov 4, 2025
e1f79de
Formatting error fix
mroki58 Nov 4, 2025
f344da3
package.jjson duplication remove
mroki58 Nov 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/tokenization.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Tokenization
on:
pull_request:
paths:
- 'Tokenization/**/*'
- '.github/workflows/tokenization.yml'
push:
branches:
- 'dev'

jobs:
lint-check-backend:
name: Check eslint rules for backend on ubuntu-latest
runs-on: ubuntu-latest
timeout-minutes: 6
steps:
- uses: actions/checkout@v5
- name: Setup node
uses: actions/setup-node@v5
with:
node-version: '22.x'
- run: (cd Tokenization/backend; npm i)
lint-check-webapp:
name: Check eslint rules for webapp on ubuntu-latest
runs-on: ubuntu-latest
timeout-minutes: 6
steps:
- uses: actions/checkout@v5
- name: Setup node
uses: actions/setup-node@v5
with:
node-version: '22.x'
- run: (cd Tokenization/webapp; npm i )
- run: (cd Tokenization/webapp; npm run typecheck)
- run: (cd Tokenization/webapp; npm run lint)

ui-test:
needs: lint-check-webapp
name: UI-tests for webapp application
runs-on: ubuntu-latest
timeout-minutes: 6
steps:
- uses: actions/checkout@v5
- name: Setup node
uses: actions/setup-node@v5
with:
node-version: '22.x'
- run: (cd Tokenization/webapp; npm run docker:test)
48 changes: 48 additions & 0 deletions Tokenization/docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
services:
install-backend:
image: node:22-alpine
working_dir: /var/workspace
volumes:
- ./backend:/var/workspace
command: ["npm", "install", "--no-save", "--silent"]

backend:
image: node:22-alpine
working_dir: /var/workspace
volumes:
- ./backend:/var/workspace
command: ["npm", "run", "dev"]
healthcheck:
interval: 1s
test: ["CMD-SHELL",
"node", "-c",
"node --input-type=module -e \"process.exit((await fetch('http://backend:8080/api/healthcheck')).ok === true ? 0 : 1)\""]
depends_on:
install-backend:
condition: service_completed_successfully


prod-container:
build:
context: .
dockerfile: Dockerfile
target: production
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/"]
interval: 5s
timeout: 3s
retries: 5
depends_on:
backend:
condition: service_healthy

ui-tests:
build:
context: .
dockerfile: Dockerfile
target: test
volumes:
- ./webapp/tests:/var/workspace/tests
depends_on:
prod-container:
condition: service_healthy
2 changes: 1 addition & 1 deletion Tokenization/webapp/app/contexts/sessionContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { useLocation, useNavigate } from 'react-router';
* - token: Authentication token
* - username: User's username
* - access: Array of user's access roles
*
*
*/
interface Session {
personid: string | null;
Expand Down
7 changes: 6 additions & 1 deletion Tokenization/webapp/app/hooks/session.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ import { SessionContext } from '../contexts/sessionContext';
/**
* Custom hook to access the current user session data.
*
* @returns {Session} The current session object
* @returns {Session} The current session object containing:
* - personid: User's person ID
* - name: User's display name
* - token: Authentication token
* - username: User's username
* - access: Array of user's access roles
*
* @throws {Error} If the hook is used outside of SessionProvider
*
Expand Down
131 changes: 87 additions & 44 deletions Tokenization/webapp/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import pluginReactHooks from 'eslint-plugin-react-hooks';
import jsdoc from 'eslint-plugin-jsdoc';
import stylisticTs from '@stylistic/eslint-plugin-ts';
import stylisticJs from '@stylistic/eslint-plugin-js';
import mochaPlugin from 'eslint-plugin-mocha';

const licenseHeader = `/**
* @license
Expand Down Expand Up @@ -70,8 +71,6 @@ const licenseHeaderRule = {
export default [
{
ignores: [
'test/',
'tests/',
'node_modules/',
'build/',
'dist/',
Expand All @@ -86,35 +85,71 @@ export default [
],
},

pluginJs.configs.recommended,
...tseslint.configs.recommended,
pluginReact.configs.flat.recommended,

{
files: ['**/*.{js,mjs,cjs,ts,tsx,jsx}'],
files: ['**/*.{js,cjs,mjs}'],
...pluginJs.configs['flat/recommended'],
},

{
files: ['**/*.{ts,tsx,jsx}'],
...pluginJs.configs['flat/recommended'],
...pluginReact.configs.flat.recommended,
...tseslint.configs['flat/recommended']
},
{
files: ['**/*.{js,cjs,mjs,ts,tsx,jsx}'],
plugins: {
'@stylistic/js': stylisticJs,
custom: {
rules: {
'license-header': licenseHeaderRule,
},
},
},
rules: {
// JS-only stylistic rules (aplikowane globalnie)
'@stylistic/js/indent': ['error', 2],
'@stylistic/js/quotes': ['error', 'single', { avoidEscape: true }],
'@stylistic/js/semi': 'error',
'@stylistic/js/space-before-blocks': 'error',
'@stylistic/js/space-infix-ops': 'error',
'@stylistic/js/object-curly-spacing': ['error', 'always'],
'@stylistic/js/keyword-spacing': 'error',
'@stylistic/js/comma-dangle': ['error', 'always-multiline'],
'@stylistic/js/comma-spacing': ['error', { before: false, after: true }],

// other JS stylistic helpers
'@stylistic/js/array-bracket-spacing': ['error', 'never'],
'@stylistic/js/brace-style': ['error', '1tbs'],
'@stylistic/js/no-trailing-spaces': 'error',
'@stylistic/js/eol-last': ['error', 'always'],
'@stylistic/js/max-len': ['error', { code: 145 }],
'@stylistic/js/no-multiple-empty-lines': ['error', { max: 1, maxEOF: 0 }],

// keep license rule active everywhere
'custom/license-header': 'error',
}

},

{
files: ['**/*.{ts,tsx,jsx}'],

plugins: {
'@typescript-eslint': tseslint.plugin,
'react': pluginReact,
'react-hooks': pluginReactHooks,
'jsdoc': jsdoc,
'@stylistic/ts': stylisticTs,
'@stylistic/js': stylisticJs,
'custom': {
rules: {
'license-header': licenseHeaderRule,
},
},
},

languageOptions: {
parser: tseslint.parser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
ecmaFeatures: { jsx: true },
project: './tsconfig.json',
},
globals: {
Expand All @@ -124,44 +159,30 @@ export default [
React: 'readonly',
},
},

settings: {
react: {
version: 'detect',
},
jsdoc: {
mode: 'typescript',
tagNamePreference: {
returns: 'return',
},
},
react: { version: 'detect' },
jsdoc: { mode: 'typescript', tagNamePreference: { returns: 'return' } },
},

rules: {
// === CUSTOM RULES ===
'custom/license-header': 'error',

// === TYPESCRIPT SPECIFIC RULES ===
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_', ignoreRestSiblings: true },
],
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/prefer-nullish-coalescing': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
'@typescript-eslint/no-non-null-assertion': 'warn',
'@typescript-eslint/consistent-type-imports': 'error',

// === REACT SPECIFIC RULES ===
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',

// === GENERAL CODE QUALITY ===
'arrow-body-style': ['error', 'as-needed'],
'curly': 'error',
Expand All @@ -174,7 +195,7 @@ export default [
'prefer-destructuring': 'warn',
'prefer-template': 'error',
'radix': 'error',

// === COMMENTS AND DOCUMENTATION ===
'capitalized-comments': ['error', 'always'],
'jsdoc/require-description': 'error',
Expand All @@ -191,8 +212,8 @@ export default [
},
},
],
// === TYPESCRIPT STYLISTIC RULES (only ones that exist) ===

// === TYPESCRIPT STYLISTIC RULES (moved here) ===
'@stylistic/ts/comma-dangle': ['error', 'always-multiline'],
'@stylistic/ts/comma-spacing': ['error', { before: false, after: true }],
'@stylistic/ts/indent': ['error', 2],
Expand All @@ -204,20 +225,42 @@ export default [
'@stylistic/ts/keyword-spacing': 'error',
'@stylistic/ts/type-annotation-spacing': 'error',
'@stylistic/ts/member-delimiter-style': 'error',
// === JAVASCRIPT STYLISTIC RULES ===

// keep JS stylistic ones if you need them additionally in TS:
'@stylistic/js/array-bracket-spacing': ['error', 'never'],
'@stylistic/js/brace-style': ['error', '1tbs'],
'@stylistic/js/no-trailing-spaces': 'error',
'@stylistic/js/eol-last': ['error', 'always'],
'@stylistic/js/max-len': ['error', { code: 145 }],
"@stylistic/js/no-multiple-empty-lines": ["error", { "max": 1, "maxEOF": 0 }],
'@stylistic/js/no-multiple-empty-lines': ['error', { max: 1, maxEOF: 0 }],

// === DISABLED RULES ===
'no-magic-numbers': 'off',
'sort-keys': 'off',
'sort-imports': 'off',
'sort-vars': 'off',
},
},
{
files: ['app/test/**/*.cjs'],
extends: [
pluginJs.configs.recommended,
mochaPlugin.configs.recommended,
],
plugins: {
mocha: mochaPlugin,
},
languageOptions: {
sourceType: 'script',
ecmaVersion: 'latest',
globals: {
...globals.node,
...globals.mocha,
window: 'readonly'
},
},
rules: {
'mocha/no-setup-in-describe': 'off',
},
}
];
Loading