@genesislcap/blank-app-seed 3.20.5 → 3.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.genx/package.json +1 -1
- package/.genx/static.js +8 -0
- package/.genx/templates/angular/chart.hbs +21 -9
- package/.genx/templates/angular/entityManager.hbs +57 -45
- package/.genx/templates/angular/form.hbs +21 -8
- package/.genx/templates/angular/grid.hbs +30 -18
- package/.genx/templates/angular/route.hbs +8 -5
- package/.genx/templates/web-components/component/component.column.defs.hbs +6 -0
- package/.genx/templates/web-components/component/component.create.form.hbs +8 -0
- package/.genx/templates/web-components/component/component.gridOptions.hbs +6 -0
- package/.genx/templates/web-components/component/component.hbs +13 -0
- package/.genx/templates/web-components/component/component.index.hbs +1 -0
- package/.genx/templates/web-components/component/component.styles.hbs +7 -0
- package/.genx/templates/web-components/component/component.template.hbs +23 -0
- package/.genx/templates/web-components/component/component.update.form.hbs +5 -0
- package/.genx/templates/web-components/entityManager.hbs +5 -11
- package/.genx/templates/web-components/form.hbs +1 -3
- package/.genx/templates/web-components/grid.hbs +1 -3
- package/.genx/templates/web-components/gridLayout.hbs +30 -0
- package/.genx/templates/web-components/horizontalLayout.hbs +7 -0
- package/.genx/templates/web-components/route.template.hbs +8 -2
- package/.genx/templates/web-components/tabsLayout.hbs +7 -0
- package/.genx/utils/formatRouteData.js +5 -0
- package/.genx/utils/generateRoute.js +8 -0
- package/.genx/utils/generateTile.js +137 -0
- package/.genx/utils/gridSerializers.js +10 -10
- package/.genx/utils/registerPartials.js +4 -3
- package/CHANGELOG.md +14 -0
- package/client-tmp/angular/angular.json +21 -12
- package/client-tmp/angular/package.json +45 -20
- package/client-tmp/angular/src/app/app-routing.module.ts +10 -3
- package/client-tmp/angular/src/app/app.component.spec.ts +2 -8
- package/client-tmp/angular/src/app/app.component.ts +0 -1
- package/client-tmp/angular/src/app/app.config.ts +1 -0
- package/client-tmp/angular/src/app/components/error-message/error-message.component.html +15 -0
- package/client-tmp/angular/src/app/components/error-message/error-message.component.spec.ts +74 -0
- package/client-tmp/angular/src/app/components/error-message/error-message.component.ts +15 -0
- package/client-tmp/angular/src/app/guards/auth.guard.ts +3 -3
- package/client-tmp/angular/src/app/guards/permissions.guard.ts +24 -0
- package/client-tmp/angular/src/app/layouts/blank/blank.layout.html +0 -1
- package/client-tmp/angular/src/app/layouts/blank/blank.layout.spec.ts +1 -1
- package/client-tmp/angular/src/app/layouts/default/default.layout.html +0 -1
- package/client-tmp/angular/src/app/layouts/default/default.layout.spec.ts +30 -15
- package/client-tmp/angular/src/app/pages/auth-login/auth-login.component.spec.ts +6 -6
- package/client-tmp/angular/src/app/pages/not-permitted/not-permitted.component.html +4 -0
- package/client-tmp/angular/src/app/pages/not-permitted/not-permitted.component.scss +12 -0
- package/client-tmp/angular/src/app/pages/not-permitted/not-permitted.component.spec.ts +32 -0
- package/client-tmp/angular/src/app/pages/not-permitted/not-permitted.component.ts +13 -0
- package/client-tmp/angular/src/app/services/auth.service.ts +12 -4
- package/client-tmp/angular/src/app/share/foundation-login.ts +3 -0
- package/client-tmp/angular/src/app/utils/index.ts +1 -0
- package/client-tmp/angular/src/app/utils/permissions.ts +7 -0
- package/client-tmp/angular/src/styles/_mixins.scss +8 -0
- package/package.json +1 -1
- /package/.genx/templates/{gridLayout.hbs → angular/gridLayout.hbs} +0 -0
- /package/.genx/templates/{horizontalLayout.hbs → angular/horizontalLayout.hbs} +0 -0
- /package/.genx/templates/{tabsLayout.hbs → angular/tabsLayout.hbs} +0 -0
|
@@ -1,34 +1,49 @@
|
|
|
1
|
-
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
2
1
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
3
|
-
import {
|
|
4
|
-
import * as StateChangerSelector from '../../store/state-changer/state-changer.selectors';
|
|
5
|
-
|
|
2
|
+
import { Router } from '@angular/router';
|
|
6
3
|
import { DefaultLayoutComponent } from './default.layout';
|
|
4
|
+
import { ElementRef, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
5
|
+
|
|
6
|
+
class MockRouter {
|
|
7
|
+
navigate = jasmine.createSpy('navigate');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
class MockElementRef implements ElementRef {
|
|
11
|
+
nativeElement = {};
|
|
12
|
+
}
|
|
7
13
|
|
|
8
14
|
describe('DefaultLayoutComponent', () => {
|
|
9
15
|
let component: DefaultLayoutComponent;
|
|
10
16
|
let fixture: ComponentFixture<DefaultLayoutComponent>;
|
|
17
|
+
let router: MockRouter;
|
|
18
|
+
let elementRef: MockElementRef;
|
|
11
19
|
|
|
12
|
-
beforeEach(() => {
|
|
13
|
-
TestBed.configureTestingModule({
|
|
20
|
+
beforeEach(async () => {
|
|
21
|
+
await TestBed.configureTestingModule({
|
|
14
22
|
declarations: [DefaultLayoutComponent],
|
|
15
23
|
providers: [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
selectors: [
|
|
19
|
-
{ selector: StateChangerSelector.getCriteria, value: 'initial-criteria' },
|
|
20
|
-
{ selector: StateChangerSelector.getResourceName, value: 'initial-resource-name' },
|
|
21
|
-
],
|
|
22
|
-
}),
|
|
24
|
+
{ provide: Router, useClass: MockRouter },
|
|
25
|
+
{ provide: ElementRef, useClass: MockElementRef }
|
|
23
26
|
],
|
|
24
|
-
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
25
|
-
});
|
|
27
|
+
schemas: [ CUSTOM_ELEMENTS_SCHEMA ],
|
|
28
|
+
}).compileComponents();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
beforeEach(() => {
|
|
26
32
|
fixture = TestBed.createComponent(DefaultLayoutComponent);
|
|
27
33
|
component = fixture.componentInstance;
|
|
34
|
+
router = TestBed.inject(Router) as unknown as MockRouter;
|
|
35
|
+
elementRef = TestBed.inject(ElementRef) as unknown as MockElementRef;
|
|
36
|
+
component.designSystemProviderElement = elementRef;
|
|
28
37
|
fixture.detectChanges();
|
|
29
38
|
});
|
|
30
39
|
|
|
31
40
|
it('should create', () => {
|
|
32
41
|
expect(component).toBeTruthy();
|
|
33
42
|
});
|
|
43
|
+
|
|
44
|
+
it('should navigate to a path', () => {
|
|
45
|
+
const path = 'some/path';
|
|
46
|
+
component.navigateAngular(path);
|
|
47
|
+
expect(router.navigate).toHaveBeenCalledWith([path]);
|
|
48
|
+
});
|
|
34
49
|
});
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { AuthLoginComponent } from './auth-login.component';
|
|
4
4
|
|
|
5
|
-
describe('
|
|
6
|
-
let component:
|
|
7
|
-
let fixture: ComponentFixture<
|
|
5
|
+
describe('AuthLoginComponent', () => {
|
|
6
|
+
let component: AuthLoginComponent;
|
|
7
|
+
let fixture: ComponentFixture<AuthLoginComponent>;
|
|
8
8
|
|
|
9
9
|
beforeEach(async () => {
|
|
10
10
|
await TestBed.configureTestingModule({
|
|
11
|
-
imports: [
|
|
11
|
+
imports: [AuthLoginComponent],
|
|
12
12
|
}).compileComponents();
|
|
13
13
|
|
|
14
|
-
fixture = TestBed.createComponent(
|
|
14
|
+
fixture = TestBed.createComponent(AuthLoginComponent);
|
|
15
15
|
component = fixture.componentInstance;
|
|
16
16
|
fixture.detectChanges();
|
|
17
17
|
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { NotPermittedComponent } from './not-permitted.component';
|
|
3
|
+
|
|
4
|
+
const MESSAGE_NOT_PERMITTED = 'You do not have permission to access this part of the application, please contact your administrator.';
|
|
5
|
+
|
|
6
|
+
describe('NotPermittedComponent', () => {
|
|
7
|
+
let component: NotPermittedComponent;
|
|
8
|
+
let fixture: ComponentFixture<NotPermittedComponent>;
|
|
9
|
+
|
|
10
|
+
beforeEach(async () => {
|
|
11
|
+
await TestBed.configureTestingModule({
|
|
12
|
+
imports: [ NotPermittedComponent ]
|
|
13
|
+
})
|
|
14
|
+
.compileComponents();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
fixture = TestBed.createComponent(NotPermittedComponent);
|
|
19
|
+
component = fixture.componentInstance;
|
|
20
|
+
fixture.detectChanges();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('should create', () => {
|
|
24
|
+
expect(component).toBeTruthy();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('should display the correct error message', () => {
|
|
28
|
+
const compiled = fixture.nativeElement;
|
|
29
|
+
const errorMessageElement = compiled.querySelector('app-error-message h1');
|
|
30
|
+
expect(errorMessageElement.textContent).toBe(MESSAGE_NOT_PERMITTED);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
2
|
+
import { ErrorMessageComponent } from '../../components/error-message/error-message.component';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'app-not-permitted',
|
|
6
|
+
standalone: true,
|
|
7
|
+
imports: [ ErrorMessageComponent ],
|
|
8
|
+
templateUrl: './not-permitted.component.html',
|
|
9
|
+
styleUrls: ['./not-permitted.component.scss'],
|
|
10
|
+
schemas: [ CUSTOM_ELEMENTS_SCHEMA ],
|
|
11
|
+
})
|
|
12
|
+
export class NotPermittedComponent {
|
|
13
|
+
}
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import { Injectable } from '@angular/core';
|
|
2
2
|
import { Auth } from '@genesislcap/foundation-comms';
|
|
3
|
-
import {DI} from "@microsoft/fast-foundation";
|
|
3
|
+
import { DI } from "@microsoft/fast-foundation";
|
|
4
4
|
|
|
5
5
|
@Injectable({
|
|
6
6
|
providedIn: 'root',
|
|
7
7
|
})
|
|
8
8
|
export class AuthService {
|
|
9
|
+
auth: Auth;
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
constructor() {
|
|
12
|
+
this.auth = DI.getOrCreateDOMContainer().get(Auth);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
isUserAuthenticated(): boolean {
|
|
16
|
+
return this.auth.isLoggedIn;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
hasUserPermission(permissionCode: string): boolean {
|
|
20
|
+
return this.auth.currentUser.hasPermission(permissionCode);
|
|
13
21
|
}
|
|
14
22
|
}
|
|
@@ -3,6 +3,9 @@ import type { Router } from '@angular/router';
|
|
|
3
3
|
import { AUTH_PATH } from '../app.config';
|
|
4
4
|
import { DI } from '@microsoft/fast-foundation';
|
|
5
5
|
|
|
6
|
+
// eslint-disable-next-line
|
|
7
|
+
declare var GENX_ENABLE_SSO: boolean;
|
|
8
|
+
|
|
6
9
|
const ssoSettings =
|
|
7
10
|
typeof GENX_ENABLE_SSO !== 'undefined' && GENX_ENABLE_SSO === true
|
|
8
11
|
? {
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|