Skip to content
Snippets Groups Projects
Commit 44a6acc4 authored by Alexander Reifschneider's avatar Alexander Reifschneider
Browse files

OZG-6986 Add statistic page

parent 84fe68c8
No related branches found
No related tags found
1 merge request!15OZG-6986 Add statistic page
Showing
with 304 additions and 1 deletion
...@@ -45,8 +45,8 @@ ...@@ -45,8 +45,8 @@
<ods-nav-item data-test-id="users-roles-navigation" caption="Benutzer & Rollen" path="/benutzer_und_rollen"> <ods-nav-item data-test-id="users-roles-navigation" caption="Benutzer & Rollen" path="/benutzer_und_rollen">
<ods-users-icon class="stroke-text" icon /> <ods-users-icon class="stroke-text" icon />
</ods-nav-item> </ods-nav-item>
<hr />
</ng-container> </ng-container>
<hr />
<ng-container *ngIf="environment.features.postfach"> <ng-container *ngIf="environment.features.postfach">
<ods-nav-item data-test-id="postfach-navigation" caption="Postfach" path="/postfach"> <ods-nav-item data-test-id="postfach-navigation" caption="Postfach" path="/postfach">
<ods-mailbox-icon icon /> <ods-mailbox-icon icon />
...@@ -61,6 +61,12 @@ ...@@ -61,6 +61,12 @@
<ods-orga-unit-icon icon /> <ods-orga-unit-icon icon />
</ods-nav-item> </ods-nav-item>
</ng-container> </ng-container>
<hr />
<!-- <ng-container *ngIf="environment.features.statistik"> -->
<ods-nav-item data-test-id="statistic-navigation" caption="Statistik" path="/statistik">
<ods-statistic-icon icon />
</ods-nav-item>
<!-- </ng-container> -->
</ng-container> </ng-container>
</ods-navbar> </ods-navbar>
<main class="flex-1 overflow-y-auto bg-white px-6 py-4"> <main class="flex-1 overflow-y-auto bg-white px-6 py-4">
......
...@@ -65,6 +65,7 @@ describe('AppComponent', () => { ...@@ -65,6 +65,7 @@ describe('AppComponent', () => {
const navigationSelector: string = getDataTestIdOf('navigation'); const navigationSelector: string = getDataTestIdOf('navigation');
const usersRolesNavigationSelector: string = getDataTestIdOf('users-roles-navigation'); const usersRolesNavigationSelector: string = getDataTestIdOf('users-roles-navigation');
const postfachNavigationSelector: string = getDataTestIdOf('postfach-navigation'); const postfachNavigationSelector: string = getDataTestIdOf('postfach-navigation');
const statistikNavigationSelector: string = getDataTestIdOf('statistik-navigation');
const organisationsEinheitenNavigationSelector: string = getDataTestIdOf('organisations-einheiten-navigation'); const organisationsEinheitenNavigationSelector: string = getDataTestIdOf('organisations-einheiten-navigation');
const logoLink: string = getDataTestIdOf('logo-link'); const logoLink: string = getDataTestIdOf('logo-link');
const routerOutletSelector: string = getDataTestIdOf('router-outlet'); const routerOutletSelector: string = getDataTestIdOf('router-outlet');
...@@ -253,6 +254,20 @@ describe('AppComponent', () => { ...@@ -253,6 +254,20 @@ describe('AppComponent', () => {
notExistsAsHtmlElement(fixture, postfachNavigationSelector); notExistsAsHtmlElement(fixture, postfachNavigationSelector);
}); });
// it('should show statistik link if statistik feature toggle is true', () => {
// component.environment.features.statistik = true;
// fixture.detectChanges();
// existsAsHtmlElement(fixture, statistikNavigationSelector);
// });
// it('should not show statistik link if statistik feature toggle is false', () => {
// component.environment.features.statistik = false;
// fixture.detectChanges();
// notExistsAsHtmlElement(fixture, statistikNavigationSelector);
// });
it('should show benutzer & rollen if benutzerRollen feature toggle is true', () => { it('should show benutzer & rollen if benutzerRollen feature toggle is true', () => {
component.environment.features.benutzerRollen = true; component.environment.features.benutzerRollen = true;
fixture.detectChanges(); fixture.detectChanges();
......
...@@ -34,6 +34,7 @@ import { ...@@ -34,6 +34,7 @@ import {
NavbarComponent, NavbarComponent,
NavItemComponent, NavItemComponent,
OrgaUnitIconComponent, OrgaUnitIconComponent,
StatisticIconComponent,
UsersIconComponent, UsersIconComponent,
} from '@ods/system'; } from '@ods/system';
import { AuthenticationService } from 'libs/authentication/src/lib/authentication.service'; import { AuthenticationService } from 'libs/authentication/src/lib/authentication.service';
...@@ -55,6 +56,7 @@ import { UnavailablePageComponent } from '../pages/unavailable/unavailable-page/ ...@@ -55,6 +56,7 @@ import { UnavailablePageComponent } from '../pages/unavailable/unavailable-page/
AdminLogoIconComponent, AdminLogoIconComponent,
MailboxIconComponent, MailboxIconComponent,
OrgaUnitIconComponent, OrgaUnitIconComponent,
StatisticIconComponent,
RouterOutlet, RouterOutlet,
UnavailablePageComponent, UnavailablePageComponent,
BuildInfoComponent, BuildInfoComponent,
......
...@@ -26,6 +26,7 @@ import { Route } from '@angular/router'; ...@@ -26,6 +26,7 @@ import { Route } from '@angular/router';
import { OrganisationsEinheitFormPageComponent } from '../pages/organisationseinheit/organisationseinheit-form-page/organisationseinheit-form-page.component'; import { OrganisationsEinheitFormPageComponent } from '../pages/organisationseinheit/organisationseinheit-form-page/organisationseinheit-form-page.component';
import { OrganisationsEinheitPageComponent } from '../pages/organisationseinheit/organisationseinheit-page/organisationseinheit-page.component'; import { OrganisationsEinheitPageComponent } from '../pages/organisationseinheit/organisationseinheit-page/organisationseinheit-page.component';
import { PostfachPageComponent } from '../pages/postfach/postfach-page/postfach-page.component'; import { PostfachPageComponent } from '../pages/postfach/postfach-page/postfach-page.component';
import { StatistikPageComponent } from '../pages/statistik/statistik-page/statistik-page.component';
import { UserAddPageComponent } from '../pages/users-roles/user-add-page/user-add-page.component'; import { UserAddPageComponent } from '../pages/users-roles/user-add-page/user-add-page.component';
import { UserRolesPageComponent } from '../pages/users-roles/user-roles-page/user-roles-page.component'; import { UserRolesPageComponent } from '../pages/users-roles/user-roles-page/user-roles-page.component';
...@@ -60,4 +61,9 @@ export const appRoutes: Route[] = [ ...@@ -60,4 +61,9 @@ export const appRoutes: Route[] = [
component: OrganisationsEinheitFormPageComponent, component: OrganisationsEinheitFormPageComponent,
title: 'Admin | Organisationseinheit', title: 'Admin | Organisationseinheit',
}, },
{
path: ROUTES.STATISTIK,
component: StatistikPageComponent,
title: 'Admin | Statistik',
},
]; ];
<!-- @if (environment.features.statistik) { -->
<admin-statistik-container data-test-id="statistik-container" />
<!-- } -->
import { getEnvironmentFactory } from '@alfa-client/environment-shared';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { createEnvironment } from 'libs/environment-shared/test/environment';
import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { StatistikPageComponent } from './statistik-page.component';
describe('StatistikPageComponent', () => {
let component: StatistikPageComponent;
let fixture: ComponentFixture<StatistikPageComponent>;
const statistikContainerSelector: string = getDataTestIdOf('statistik-container');
const environment = createEnvironment();
(getEnvironmentFactory as jest.Mock).mockReturnValue(environment);
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [StatistikPageComponent],
}).compileComponents();
fixture = TestBed.createComponent(StatistikPageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
// describe('template', () => {
// describe('admin-statistik-container', () => {
// it('should be rendered if feature toggle statistik is true', () => {
// environment.features.statistik = true;
// fixture.detectChanges();
// existsAsHtmlElement(fixture, statistikContainerSelector);
// });
// it('should not be rendered if feature toggle postfach is false', () => {
// environment.features.statistik = false;
// fixture.detectChanges();
// notExistsAsHtmlElement(fixture, statistikContainerSelector);
// });
// });
// });
});
import { StatistikContainerComponent } from '@admin-client/statistik';
import { CommonModule } from '@angular/common';
import { Component } from '@angular/core';
@Component({
selector: 'app-statistik-page',
standalone: true,
imports: [CommonModule, StatistikContainerComponent],
templateUrl: './statistik-page.component.html',
})
export class StatistikPageComponent {}
...@@ -26,4 +26,5 @@ export const ROUTES = { ...@@ -26,4 +26,5 @@ export const ROUTES = {
BENUTZER_UND_ROLLEN: 'benutzer_und_rollen', BENUTZER_UND_ROLLEN: 'benutzer_und_rollen',
BENUTZER_UND_ROLLEN_NEU: 'benutzer_und_rollen/neu', BENUTZER_UND_ROLLEN_NEU: 'benutzer_und_rollen/neu',
ORGANISATIONSEINHEITEN: 'organisationseinheiten', ORGANISATIONSEINHEITEN: 'organisationseinheiten',
STATISTIK: 'statistik',
}; };
{
"extends": ["../../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts"],
"extends": ["plugin:@nx/angular", "plugin:@angular-eslint/template/process-inline-templates"],
"rules": {
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "admin",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "admin",
"style": "kebab-case"
}
]
}
},
{
"files": ["*.html"],
"extends": ["plugin:@nx/angular-template"],
"rules": {}
}
]
}
# statistik
This library was generated with [Nx](https://nx.dev).
## Running unit tests
Run `nx test statistik` to execute the unit tests.
export default {
displayName: 'admin-statistik',
preset: '../../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
coverageDirectory: '../../../coverage/libs/admin/statistik',
transform: {
'^.+\\.(ts|mjs|js|html)$': [
'jest-preset-angular',
{
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
},
],
},
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
snapshotSerializers: [
'jest-preset-angular/build/serializers/no-ng-attributes',
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment',
],
};
{
"name": "admin-statistik",
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/admin/statistik/src",
"prefix": "admin",
"projectType": "library",
"tags": [],
"targets": {
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"tsConfig": "libs/admin/statistik/tsconfig.lib.json",
"jestConfig": "libs/admin/statistik/jest.config.ts"
}
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
}
}
}
export * from './lib/statistik-container/statistik-container.component';
<h1 class="heading-1">Statistik</h1>
/*
* Copyright (C) 2024 Das Land Schleswig-Holstein vertreten durch den
* Ministerpräsidenten des Landes Schleswig-Holstein
* Staatskanzlei
* Abteilung Digitalisierung und zentrales IT-Management der Landesregierung
*
* Lizenziert unter der EUPL, Version 1.2 oder - sobald
* diese von der Europäischen Kommission genehmigt wurden -
* Folgeversionen der EUPL ("Lizenz");
* Sie dürfen dieses Werk ausschließlich gemäß
* dieser Lizenz nutzen.
* Eine Kopie der Lizenz finden Sie hier:
*
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
*
* Sofern nicht durch anwendbare Rechtsvorschriften
* gefordert oder in schriftlicher Form vereinbart, wird
* die unter der Lizenz verbreitete Software "so wie sie
* ist", OHNE JEGLICHE GEWÄHRLEISTUNG ODER BEDINGUNGEN -
* ausdrücklich oder stillschweigend - verbreitet.
* Die sprachspezifischen Genehmigungen und Beschränkungen
* unter der Lizenz sind dem Lizenztext zu entnehmen.
*/
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { StatistikContainerComponent } from './statistik-container.component';
describe('StatistikContainerComponent', () => {
let component: StatistikContainerComponent;
let fixture: ComponentFixture<StatistikContainerComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [StatistikContainerComponent],
});
});
beforeEach(() => {
fixture = TestBed.createComponent(StatistikContainerComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
/*
* Copyright (C) 2024 Das Land Schleswig-Holstein vertreten durch den
* Ministerpräsidenten des Landes Schleswig-Holstein
* Staatskanzlei
* Abteilung Digitalisierung und zentrales IT-Management der Landesregierung
*
* Lizenziert unter der EUPL, Version 1.2 oder - sobald
* diese von der Europäischen Kommission genehmigt wurden -
* Folgeversionen der EUPL ("Lizenz");
* Sie dürfen dieses Werk ausschließlich gemäß
* dieser Lizenz nutzen.
* Eine Kopie der Lizenz finden Sie hier:
*
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
*
* Sofern nicht durch anwendbare Rechtsvorschriften
* gefordert oder in schriftlicher Form vereinbart, wird
* die unter der Lizenz verbreitete Software "so wie sie
* ist", OHNE JEGLICHE GEWÄHRLEISTUNG ODER BEDINGUNGEN -
* ausdrücklich oder stillschweigend - verbreitet.
* Die sprachspezifischen Genehmigungen und Beschränkungen
* unter der Lizenz sind dem Lizenztext zu entnehmen.
*/
import { CommonModule } from '@angular/common';
import { Component } from '@angular/core';
@Component({
selector: 'admin-statistik-container',
templateUrl: './statistik-container.component.html',
standalone: true,
imports: [CommonModule],
})
export class StatistikContainerComponent {}
globalThis.ngJest = {
testEnvironmentOptions: {
errorOnUnknownElements: true,
errorOnUnknownProperties: true,
},
};
import 'jest-preset-angular/setup-jest';
{
"extends": "../../../tsconfig.base.json",
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
],
"compilerOptions": {
"target": "es2022"
}
}
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../../dist/out-tsc",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": []
},
"exclude": ["src/**/*.spec.ts", "src/test-setup.ts", "jest.config.ts", "src/**/*.test.ts"],
"include": ["src/**/*.ts"]
}
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"],
"target": "ES2022",
"useDefineForClassFields": false
},
"files": ["src/test-setup.ts"],
"include": ["**/*.test.ts", "**/*.spec.ts", "**/*.d.ts", "jest.config.ts"]
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment