Skip to content
Snippets Groups Projects
Verified Commit 217bb4ba authored by Sebastian Bergandy's avatar Sebastian Bergandy :keyboard:
Browse files

Merge branch 'main' into OZG-7418-Tooltips-ersetzen

parents 76d791ef 9e2ebb37
No related branches found
No related tags found
1 merge request!4OZG-7418 Ersetze matTooltip durch die neue tooltip Directive
Showing
with 52 additions and 267 deletions
......@@ -58,11 +58,6 @@
@if (apiRoot | hasLink: apiRootLinkRel.CONFIGURATION) {
<admin-menu-container data-test-id="menu-container"></admin-menu-container>
}
@if (apiRoot | hasLink: apiRootLinkRel.AGGREGATION_MAPPING) {
<ods-nav-item data-test-id="statistik-navigation" caption="Statistik" path="/statistik">
<ods-statistic-icon icon />
</ods-nav-item>
}
</ods-navbar>
<main class="flex-1 overflow-y-auto bg-white px-6 py-4">
<router-outlet
......
......@@ -27,6 +27,7 @@ import { HasLinkPipe, createEmptyStateResource, createStateResource } from '@alf
import { Mock, dispatchEventFromFixture, existsAsHtmlElement, mock, notExistsAsHtmlElement } from '@alfa-client/test-utils';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ActivatedRoute, Router, RouterOutlet } from '@angular/router';
import { AuthenticationService } from '@authentication';
import {
AdminLogoIconComponent,
MailboxIconComponent,
......@@ -35,7 +36,6 @@ import {
OrgaUnitIconComponent,
UsersIconComponent,
} from '@ods/system';
import { AuthenticationService } from '@authentication';
import { MenuContainerComponent } from 'libs/admin/configuration/src/lib/menu-container/menu-container.component';
import { createApiRootResource } from 'libs/api-root-shared/test/api-root';
import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
......@@ -53,7 +53,7 @@ describe('AppComponent', () => {
const buildInfoSelector: string = getDataTestIdOf('build-info');
const userProfileButtonSelector: string = getDataTestIdOf('user-profile-button');
const usersRolesNavigationSelector: string = getDataTestIdOf('users-roles-navigation');
const statistikNavigationSelector: string = getDataTestIdOf('statistik-navigation');
const organisationsEinheitenNavigationSelector: string = getDataTestIdOf('organisations-einheiten-navigation');
const logoLink: string = getDataTestIdOf('logo-link');
const routerOutletSelector: string = getDataTestIdOf('router-outlet');
......@@ -241,21 +241,6 @@ describe('AppComponent', () => {
notExistsAsHtmlElement(fixture, organisationsEinheitenNavigationSelector);
});
it('should show statistik if link in apiRoot exists', () => {
component.apiRootStateResource$ = of(
createStateResource(createApiRootResource([ApiRootLinkRel.AGGREGATION_MAPPING, ApiRootLinkRel.CONFIGURATION])),
);
fixture.detectChanges();
existsAsHtmlElement(fixture, statistikNavigationSelector);
});
it('should not show statistik if link in apiRoot does not exists', () => {
fixture.detectChanges();
notExistsAsHtmlElement(fixture, statistikNavigationSelector);
});
});
describe('menu', () => {
......
......@@ -28,8 +28,8 @@ import { Route } from '@angular/router';
import { OrganisationsEinheitFormPageComponent } from '../pages/organisationseinheit/organisationseinheit-form-page/organisationseinheit-form-page.component';
import { OrganisationsEinheitPageComponent } from '../pages/organisationseinheit/organisationseinheit-page/organisationseinheit-page.component';
import { PostfachPageComponent } from '../pages/postfach/postfach-page/postfach-page.component';
import { UnavailablePageComponent } from '../pages/unavailable/unavailable-page/unavailable-page.component';
import { StatistikPageComponent } from '../pages/statistik/statistik-page/statistik-page.component';
import { UnavailablePageComponent } from '../pages/unavailable/unavailable-page/unavailable-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 { apiRootGuard, configurationGuard } from './app.guard';
......@@ -83,5 +83,7 @@ export const appRoutes: Route[] = [
path: ROUTES.STATISTIK,
component: StatistikPageComponent,
title: 'Admin | Statistik',
canActivate: [configurationGuard],
data: <GuardData>{ linkRelName: ConfigurationLinkRel.AGGREGATION_MAPPINGS },
},
];
......@@ -23,8 +23,4 @@
unter der Lizenz sind dem Lizenztext zu entnehmen.
-->
<ng-container *ngIf="(apiRootStateResource$ | async)?.resource as apiRoot">
@if (apiRoot | hasLink: apiRootLinkRel.ORGANISATIONS_EINHEIT) {
<admin-organisations-einheit-form-container data-test-id="organisations-einheit-form" />
\ No newline at end of file
}
</ng-container>
\ No newline at end of file
......@@ -22,33 +22,18 @@
* unter der Lizenz sind dem Lizenztext zu entnehmen.
*/
import { OrganisationsEinheitFormContainerComponent } from '@admin-client/organisations-einheit';
import { ApiRootLinkRel, ApiRootResource, ApiRootService } from '@alfa-client/api-root-shared';
import { createStateResource, StateResource, TechSharedModule } from '@alfa-client/tech-shared';
import { existsAsHtmlElement, mock, Mock, notExistsAsHtmlElement } from '@alfa-client/test-utils';
import { CommonModule } from '@angular/common';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { createApiRootResource } from 'libs/api-root-shared/test/api-root';
import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { singleColdCompleted } from 'libs/tech-shared/test/marbles';
import { MockComponent } from 'ng-mocks';
import { Observable, of } from 'rxjs';
import { OrganisationsEinheitFormPageComponent } from './organisationseinheit-form-page.component';
describe('OrganisationsEinheitFormPageComponent', () => {
let component: OrganisationsEinheitFormPageComponent;
let fixture: ComponentFixture<OrganisationsEinheitFormPageComponent>;
const organisationsEinheitFormSelector: string = getDataTestIdOf('organisations-einheit-form');
let apiRootService: Mock<ApiRootService>;
beforeEach(async () => {
apiRootService = mock(ApiRootService);
await TestBed.configureTestingModule({
imports: [CommonModule, TechSharedModule],
imports: [],
declarations: [OrganisationsEinheitFormPageComponent, MockComponent(OrganisationsEinheitFormContainerComponent)],
providers: [{ provide: ApiRootService, useValue: apiRootService }],
}).compileComponents();
});
......@@ -62,45 +47,4 @@ describe('OrganisationsEinheitFormPageComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
describe('component', () => {
describe('ngOnInit', () => {
const apiRootStateResource: StateResource<ApiRootResource> = createStateResource(createApiRootResource());
const apiRootStateResource$: Observable<StateResource<ApiRootResource>> = of(apiRootStateResource);
beforeEach(() => {
apiRootService.getApiRoot.mockReturnValue(apiRootStateResource$);
});
it('should call apiRootService getApiRoot', () => {
component.ngOnInit();
expect(apiRootService.getApiRoot).toHaveBeenCalled();
});
it('should get apiRootStateResource$', () => {
component.ngOnInit();
expect(component.apiRootStateResource$).toBeObservable(singleColdCompleted(apiRootStateResource));
});
});
});
describe('template', () => {
describe('admin-organisationseinheit-form-container', () => {
it('should be rendered if apiRootState has link', () => {
component.apiRootStateResource$ = of(createStateResource(createApiRootResource([ApiRootLinkRel.ORGANISATIONS_EINHEIT])));
fixture.detectChanges();
existsAsHtmlElement(fixture, organisationsEinheitFormSelector);
});
it('should not be rendered if apiRootState has no link', () => {
component.apiRootStateResource$ = of(createStateResource(createApiRootResource()));
fixture.detectChanges();
notExistsAsHtmlElement(fixture, organisationsEinheitFormSelector);
});
});
});
});
......@@ -22,27 +22,12 @@
* unter der Lizenz sind dem Lizenztext zu entnehmen.
*/
import { OrganisationsEinheitFormContainerComponent } from '@admin-client/organisations-einheit';
import { ApiRootLinkRel, ApiRootResource, ApiRootService } from '@alfa-client/api-root-shared';
import { createEmptyStateResource, StateResource } from '@alfa-client/tech-shared';
import { UiModule } from '@alfa-client/ui';
import { CommonModule } from '@angular/common';
import { Component, inject, OnInit } from '@angular/core';
import { Observable, of } from 'rxjs';
import { Component } from '@angular/core';
@Component({
selector: 'organisationseinheit-form-page',
templateUrl: './organisationseinheit-form-page.component.html',
standalone: true,
imports: [CommonModule, UiModule, OrganisationsEinheitFormContainerComponent],
imports: [OrganisationsEinheitFormContainerComponent],
})
export class OrganisationsEinheitFormPageComponent implements OnInit {
private apiRootService = inject(ApiRootService);
public apiRootStateResource$: Observable<StateResource<ApiRootResource>> = of(createEmptyStateResource<ApiRootResource>());
public readonly apiRootLinkRel = ApiRootLinkRel;
ngOnInit(): void {
this.apiRootStateResource$ = this.apiRootService.getApiRoot();
}
}
export class OrganisationsEinheitFormPageComponent {}
......@@ -23,8 +23,4 @@
unter der Lizenz sind dem Lizenztext zu entnehmen.
-->
<ng-container *ngIf="(apiRootStateResource$ | async)?.resource as apiRoot">
@if (apiRoot | hasLink: apiRootLinkRel.ORGANISATIONS_EINHEIT) {
<admin-organisations-einheit-container data-test-id="organisations-einheit-container" />
}
</ng-container>
......@@ -22,33 +22,18 @@
* unter der Lizenz sind dem Lizenztext zu entnehmen.
*/
import { OrganisationsEinheitContainerComponent } from '@admin-client/organisations-einheit';
import { ApiRootLinkRel, ApiRootResource, ApiRootService } from '@alfa-client/api-root-shared';
import { createStateResource, StateResource, TechSharedModule } from '@alfa-client/tech-shared';
import { existsAsHtmlElement, mock, Mock, notExistsAsHtmlElement } from '@alfa-client/test-utils';
import { CommonModule } from '@angular/common';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { createApiRootResource } from 'libs/api-root-shared/test/api-root';
import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { singleColdCompleted } from 'libs/tech-shared/test/marbles';
import { MockComponent } from 'ng-mocks';
import { Observable, of } from 'rxjs';
import { OrganisationsEinheitPageComponent } from './organisationseinheit-page.component';
describe('OrganisationsEinheitPageComponent', () => {
let component: OrganisationsEinheitPageComponent;
let fixture: ComponentFixture<OrganisationsEinheitPageComponent>;
const organisationsEinheitContainerSelector: string = getDataTestIdOf('organisations-einheit-container');
let apiRootService: Mock<ApiRootService>;
beforeEach(async () => {
apiRootService = mock(ApiRootService);
await TestBed.configureTestingModule({
imports: [CommonModule, TechSharedModule],
imports: [],
declarations: [OrganisationsEinheitPageComponent, MockComponent(OrganisationsEinheitContainerComponent)],
providers: [{ provide: ApiRootService, useValue: apiRootService }],
}).compileComponents();
});
......@@ -62,45 +47,4 @@ describe('OrganisationsEinheitPageComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
describe('component', () => {
describe('ngOnInit', () => {
const apiRootStateResource: StateResource<ApiRootResource> = createStateResource(createApiRootResource());
const apiRootStateResource$: Observable<StateResource<ApiRootResource>> = of(apiRootStateResource);
beforeEach(() => {
apiRootService.getApiRoot.mockReturnValue(apiRootStateResource$);
});
it('should call apiRootService getApiRoot', () => {
component.ngOnInit();
expect(apiRootService.getApiRoot).toHaveBeenCalled();
});
it('should get apiRootStateResource$', () => {
component.ngOnInit();
expect(component.apiRootStateResource$).toBeObservable(singleColdCompleted(apiRootStateResource));
});
});
});
describe('template', () => {
describe('admin-organisationseinheit-container', () => {
it('should be rendered if apiRootState has link', () => {
component.apiRootStateResource$ = of(createStateResource(createApiRootResource([ApiRootLinkRel.ORGANISATIONS_EINHEIT])));
fixture.detectChanges();
existsAsHtmlElement(fixture, organisationsEinheitContainerSelector);
});
it('should not be rendered if apiRootState has no link', () => {
component.apiRootStateResource$ = of(createStateResource(createApiRootResource()));
fixture.detectChanges();
notExistsAsHtmlElement(fixture, organisationsEinheitContainerSelector);
});
});
});
});
......@@ -22,27 +22,12 @@
* unter der Lizenz sind dem Lizenztext zu entnehmen.
*/
import { OrganisationsEinheitContainerComponent } from '@admin-client/organisations-einheit';
import { ApiRootLinkRel, ApiRootResource, ApiRootService } from '@alfa-client/api-root-shared';
import { createEmptyStateResource, StateResource } from '@alfa-client/tech-shared';
import { UiModule } from '@alfa-client/ui';
import { CommonModule } from '@angular/common';
import { Component, inject, OnInit } from '@angular/core';
import { Observable, of } from 'rxjs';
import { Component } from '@angular/core';
@Component({
selector: 'organisationseinheit-page',
templateUrl: './organisationseinheit-page.component.html',
standalone: true,
imports: [CommonModule, OrganisationsEinheitContainerComponent, UiModule],
imports: [OrganisationsEinheitContainerComponent],
})
export class OrganisationsEinheitPageComponent implements OnInit {
private apiRootService = inject(ApiRootService);
public apiRootStateResource$: Observable<StateResource<ApiRootResource>> = of(createEmptyStateResource<ApiRootResource>());
public readonly apiRootLinkRel = ApiRootLinkRel;
ngOnInit(): void {
this.apiRootStateResource$ = this.apiRootService.getApiRoot();
}
}
export class OrganisationsEinheitPageComponent {}
......@@ -23,8 +23,4 @@
unter der Lizenz sind dem Lizenztext zu entnehmen.
-->
<ng-container *ngIf="(apiRootStateResource$ | async)?.resource as apiRoot">
@if (apiRoot | hasLink: apiRootLinkRel.AGGREGATION_MAPPING) {
<admin-statistik-container data-test-id="statistik-container" />
}
</ng-container>
......@@ -22,33 +22,18 @@
* unter der Lizenz sind dem Lizenztext zu entnehmen.
*/
import { StatistikContainerComponent } from '@admin-client/statistik';
import { ApiRootLinkRel, ApiRootResource, ApiRootService } from '@alfa-client/api-root-shared';
import { createStateResource, StateResource, TechSharedModule } from '@alfa-client/tech-shared';
import { existsAsHtmlElement, mock, Mock, notExistsAsHtmlElement } from '@alfa-client/test-utils';
import { CommonModule } from '@angular/common';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { createApiRootResource } from 'libs/api-root-shared/test/api-root';
import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { singleColdCompleted } from 'libs/tech-shared/test/marbles';
import { MockComponent } from 'ng-mocks';
import { Observable, of } from 'rxjs';
import { StatistikPageComponent } from './statistik-page.component';
describe('StatistikPageComponent', () => {
let component: StatistikPageComponent;
let fixture: ComponentFixture<StatistikPageComponent>;
const statistikContainerSelector: string = getDataTestIdOf('statistik-container');
let apiRootService: Mock<ApiRootService>;
beforeEach(async () => {
apiRootService = mock(ApiRootService);
await TestBed.configureTestingModule({
imports: [CommonModule, TechSharedModule],
imports: [],
declarations: [StatistikPageComponent, MockComponent(StatistikContainerComponent)],
providers: [{ provide: ApiRootService, useValue: apiRootService }],
}).compileComponents();
});
......@@ -62,45 +47,4 @@ describe('StatistikPageComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
describe('component', () => {
describe('ngOnInit', () => {
const apiRootStateResource: StateResource<ApiRootResource> = createStateResource(createApiRootResource());
const apiRootStateResource$: Observable<StateResource<ApiRootResource>> = of(apiRootStateResource);
beforeEach(() => {
apiRootService.getApiRoot.mockReturnValue(apiRootStateResource$);
});
it('should call apiRootService getApiRoot', () => {
component.ngOnInit();
expect(apiRootService.getApiRoot).toHaveBeenCalled();
});
it('should get apiRootStateResource$', () => {
component.ngOnInit();
expect(component.apiRootStateResource$).toBeObservable(singleColdCompleted(apiRootStateResource));
});
});
});
describe('template', () => {
describe('statistik-organisationseinheit-container', () => {
it('should be rendered if apiRootState has link', () => {
component.apiRootStateResource$ = of(createStateResource(createApiRootResource([ApiRootLinkRel.AGGREGATION_MAPPING])));
fixture.detectChanges();
existsAsHtmlElement(fixture, statistikContainerSelector);
});
it('should not be rendered if apiRootState has no link', () => {
component.apiRootStateResource$ = of(createStateResource(createApiRootResource()));
fixture.detectChanges();
notExistsAsHtmlElement(fixture, statistikContainerSelector);
});
});
});
});
......@@ -22,26 +22,12 @@
* unter der Lizenz sind dem Lizenztext zu entnehmen.
*/
import { StatistikContainerComponent } from '@admin-client/statistik';
import { ApiRootLinkRel, ApiRootResource, ApiRootService } from '@alfa-client/api-root-shared';
import { createEmptyStateResource, StateResource, TechSharedModule } from '@alfa-client/tech-shared';
import { CommonModule } from '@angular/common';
import { Component, inject, OnInit } from '@angular/core';
import { Observable, of } from 'rxjs';
import { Component } from '@angular/core';
@Component({
selector: 'app-statistik-page',
standalone: true,
imports: [CommonModule, StatistikContainerComponent, TechSharedModule],
imports: [StatistikContainerComponent],
templateUrl: './statistik-page.component.html',
})
export class StatistikPageComponent implements OnInit {
private readonly apiRootService = inject(ApiRootService);
public apiRootStateResource$: Observable<StateResource<ApiRootResource>> = of(createEmptyStateResource<ApiRootResource>());
public readonly apiRootLinkRel = ApiRootLinkRel;
ngOnInit(): void {
this.apiRootStateResource$ = this.apiRootService.getApiRoot();
}
}
export class StatistikPageComponent {}
......@@ -30,8 +30,8 @@
@import 'libs/design-system/src/lib/tailwind-preset/root.css';
@import 'libs/ui/src/lib/font/font_material';
@import 'typeface-roboto/index.css';
@import '../../shared/styles/abstracts/variables';
@import '../../shared/styles/material/snackbar';
@import '../../alfa/src/styles/abstracts/variables';
@import '../../alfa/src/styles/material/snackbar';
@include mat.all-component-typographies();
@include mat.core();
......
......@@ -33,8 +33,7 @@
@import 'libs/ui/src/lib/font/font_material';
@import 'typeface-roboto/index.css';
@import '../../../shared/styles/abstracts/variables';
@import '../../../shared/styles/material/snackbar';
@import 'abstracts/variables';
@import 'base/setup';
@import 'layout/main';
@import 'material/autocomplete';
......@@ -45,6 +44,7 @@
@import 'material/list';
@import 'material/menu';
@import 'material/tabs';
@import 'material/snackbar';
@import 'material/typography';
@import 'libs/navigation/src/lib/header-container/header/header.theme';
@import 'libs/ui/src/lib/ui/expansion-panel/expansion-panel.theme';
......
......@@ -23,4 +23,5 @@
*/
export enum ConfigurationLinkRel {
SETTING = 'settings',
AGGREGATION_MAPPINGS = 'aggregationMappings',
}
......@@ -3,3 +3,8 @@
<ods-mailbox-icon icon />
</ods-nav-item>
}
@if (configurationStateResource.resource | hasLink: configurationLinkRel.AGGREGATION_MAPPINGS) {
<ods-nav-item data-test-id="statistik-navigation" caption="Statistik" path="/statistik">
<ods-statistic-icon icon />
</ods-nav-item>
}
......@@ -13,6 +13,7 @@ describe('MenuComponent', () => {
let fixture: ComponentFixture<MenuComponent>;
const postfachNavigation: string = getDataTestIdOf('postfach-navigation');
const statistikNavigationSelector: string = getDataTestIdOf('statistik-navigation');
beforeEach(async () => {
await TestBed.configureTestingModule({
......@@ -47,4 +48,24 @@ describe('MenuComponent', () => {
notExistsAsHtmlElement(fixture, postfachNavigation);
});
});
describe('statistic navigation', () => {
it('should show if settings link is present', () => {
component.configurationStateResource = createStateResource(
createConfigurationResource([ConfigurationLinkRel.AGGREGATION_MAPPINGS]),
);
fixture.detectChanges();
existsAsHtmlElement(fixture, statistikNavigationSelector);
});
it('should hide if settings link is missing', () => {
component.configurationStateResource = createStateResource(createConfigurationResource());
fixture.detectChanges();
notExistsAsHtmlElement(fixture, statistikNavigationSelector);
});
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment