From 9e51af602d2667b2b64082e2c2ff3bf8a314a42e Mon Sep 17 00:00:00 2001 From: Christian Badura Date: Wed, 21 Feb 2024 15:58:12 +0100 Subject: [PATCH] fix: use absolute paths in all files --- src/app/app.component.spec.ts | 3 +- src/app/services/menu-state.service.ts | 2 +- src/app/services/menu-tree.service.ts | 2 +- .../image-container.component.ts | 2 +- src/app/shared/label.resolver.spec.ts | 2 +- src/app/shared/shared.module.ts | 2 +- .../theme-color-box.component.spec.ts | 68 ++-- src/app/shared/utils.ts | 3 +- .../workspace-create.component.ts | 2 +- .../menu-tree/menu-tree.component.spec.ts | 380 +++++++++--------- .../menu/menu-tree/menu-tree.component.ts | 6 +- .../workspace-detail/menu/menu.component.ts | 10 +- .../workspace-detail/menu/menu.module.ts | 8 +- .../workspace-detail.component.ts | 12 +- .../workspace-detail.module.ts | 20 +- .../workspace-images/logo/logo.component.ts | 2 +- .../workspace-images.component.ts | 6 +- .../workspace-intern.component.spec.ts | 12 +- .../workspace-props.component.ts | 10 +- .../workspace-roles.component.ts | 3 +- .../choose-file/choose-file.component.spec.ts | 2 +- .../choose-file/choose-file.component.ts | 2 +- .../confirm/confirm.component.ts | 2 +- .../preview/preview.component.ts | 4 +- .../workspace-import.component.ts | 4 +- .../workspace-search.component.ts | 5 +- src/app/workspace/workspace.module.ts | 16 +- 27 files changed, 301 insertions(+), 289 deletions(-) diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index 6f40566d..1145fad7 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -1,8 +1,9 @@ import { NO_ERRORS_SCHEMA } from '@angular/core' import { TestBed } from '@angular/core/testing' -import { AppComponent } from './app.component' import { RouterTestingModule } from '@angular/router/testing' +import { AppComponent } from 'src/app/app.component' + describe('AppComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ diff --git a/src/app/services/menu-state.service.ts b/src/app/services/menu-state.service.ts index 4fc59596..fd7d7c04 100644 --- a/src/app/services/menu-state.service.ts +++ b/src/app/services/menu-state.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core' -import { MenuItem } from '../shared/generated' +import { MenuItem } from 'src/app/shared/generated' export interface MenuState { selectedPortal?: string diff --git a/src/app/services/menu-tree.service.ts b/src/app/services/menu-tree.service.ts index b313ab5a..4b25503a 100644 --- a/src/app/services/menu-tree.service.ts +++ b/src/app/services/menu-tree.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core' import { TreeNode } from 'primeng/api' -import { MenuItem } from '../shared/generated' +import { MenuItem } from 'src/app/shared/generated' export interface NewPosition { id: string | undefined diff --git a/src/app/shared/image-container/image-container.component.ts b/src/app/shared/image-container/image-container.component.ts index 3b963311..da30c3ef 100644 --- a/src/app/shared/image-container/image-container.component.ts +++ b/src/app/shared/image-container/image-container.component.ts @@ -1,5 +1,5 @@ import { Component, Input, OnChanges, SimpleChanges } from '@angular/core' -import { environment } from '../../../environments/environment' +import { environment } from 'src/environments/environment' @Component({ selector: 'app-image-container', diff --git a/src/app/shared/label.resolver.spec.ts b/src/app/shared/label.resolver.spec.ts index e629df1b..da9687fa 100644 --- a/src/app/shared/label.resolver.spec.ts +++ b/src/app/shared/label.resolver.spec.ts @@ -1,5 +1,5 @@ import { Observable, of } from 'rxjs' -import { LabelResolver } from './label.resolver' +import { LabelResolver } from 'src/app/shared/label.resolver' let labelResolver: LabelResolver diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index 38eedd54..dd668e70 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -41,7 +41,7 @@ import { import { Configuration } from 'src/app/shared/generated' import { environment } from 'src/environments/environment' -import { LabelResolver } from './label.resolver' +import { LabelResolver } from 'src/app/shared/label.resolver' import { ImageContainerComponent } from './image-container/image-container.component' import { ThemeColorBoxComponent } from './theme-color-box/theme-color-box.component' diff --git a/src/app/shared/theme-color-box/theme-color-box.component.spec.ts b/src/app/shared/theme-color-box/theme-color-box.component.spec.ts index 007e5607..f4188f85 100644 --- a/src/app/shared/theme-color-box/theme-color-box.component.spec.ts +++ b/src/app/shared/theme-color-box/theme-color-box.component.spec.ts @@ -1,39 +1,39 @@ -// import { NO_ERRORS_SCHEMA } from '@angular/core' -// import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing' -// // import { HttpClient } from '@angular/common/http' -// import { HttpClientTestingModule } from '@angular/common/http/testing' -// // import { TranslateLoader, TranslateModule } from '@ngx-translate/core' +import { NO_ERRORS_SCHEMA } from '@angular/core' +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing' +// import { HttpClient } from '@angular/common/http' +import { HttpClientTestingModule } from '@angular/common/http/testing' +// import { TranslateLoader, TranslateModule } from '@ngx-translate/core' -// import { ThemeColorBoxComponent } from './theme-color-box.component' +import { ThemeColorBoxComponent } from './theme-color-box.component' -// describe('ThemeColorBoxComponent', () => { -// let component: ThemeColorBoxComponent -// let fixture: ComponentFixture +describe('ThemeColorBoxComponent', () => { + let component: ThemeColorBoxComponent + let fixture: ComponentFixture -// beforeEach(waitForAsync(() => { -// TestBed.configureTestingModule({ -// declarations: [ThemeColorBoxComponent], -// imports: [ -// HttpClientTestingModule -// /* TranslateModule.forRoot({ -// loader: { -// provide: TranslateLoader, -// useFactory: HttpLoaderFactory, -// deps: [HttpClient] -// } -// }) */ -// ], -// schemas: [NO_ERRORS_SCHEMA] -// }).compileComponents() -// })) + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [ThemeColorBoxComponent], + imports: [ + HttpClientTestingModule + /* TranslateModule.forRoot({ + loader: { + provide: TranslateLoader, + useFactory: HttpLoaderFactory, + deps: [HttpClient] + } + }) */ + ], + schemas: [NO_ERRORS_SCHEMA] + }).compileComponents() + })) -// beforeEach(() => { -// fixture = TestBed.createComponent(ThemeColorBoxComponent) -// component = fixture.componentInstance -// fixture.detectChanges() -// }) + beforeEach(() => { + fixture = TestBed.createComponent(ThemeColorBoxComponent) + component = fixture.componentInstance + fixture.detectChanges() + }) -// it('should create', () => { -// expect(component).toBeTruthy() -// }) -// }) + it('should create', () => { + expect(component).toBeTruthy() + }) +}) diff --git a/src/app/shared/utils.ts b/src/app/shared/utils.ts index 9e62804b..43c2ad54 100644 --- a/src/app/shared/utils.ts +++ b/src/app/shared/utils.ts @@ -1,7 +1,8 @@ // import { MicrofrontendDTO } from '@onecx/portal-integration-angular' import { AbstractControl, FormArray, FormGroup } from '@angular/forms' import { SelectItem } from 'primeng/api' -import { Workspace /* , ThemeDTO */ } from './generated' + +import { Workspace /* , ThemeDTO */ } from 'src/app/shared/generated' export function limitText(text: string, limit: number): string { if (text) { diff --git a/src/app/workspace/workspace-create/workspace-create.component.ts b/src/app/workspace/workspace-create/workspace-create.component.ts index d0ae3884..976e5f17 100644 --- a/src/app/workspace/workspace-create/workspace-create.component.ts +++ b/src/app/workspace/workspace-create/workspace-create.component.ts @@ -8,7 +8,7 @@ import { FileUpload } from 'primeng/fileupload' import { PortalMessageService, UserService } from '@onecx/portal-integration-angular' -import { LogoState } from './logo-state' +import { LogoState } from 'src/app/workspace/workspace-create/logo-state' // import { setFetchUrls , sortThemeByName } from '../../shared/utils' import { /* ImageV1APIService, */ diff --git a/src/app/workspace/workspace-detail/menu/menu-tree/menu-tree.component.spec.ts b/src/app/workspace/workspace-detail/menu/menu-tree/menu-tree.component.spec.ts index 556cb4b8..05ef85b6 100644 --- a/src/app/workspace/workspace-detail/menu/menu-tree/menu-tree.component.spec.ts +++ b/src/app/workspace/workspace-detail/menu/menu-tree/menu-tree.component.spec.ts @@ -1,190 +1,190 @@ -// import { NO_ERRORS_SCHEMA, SimpleChanges, SimpleChange } from '@angular/core' -// import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing' -// // import { HttpClient } from '@angular/common/http' -// import { HttpClientTestingModule } from '@angular/common/http/testing' -// // import { TranslateLoader, TranslateModule } from '@ngx-translate/core' - -// // import { HttpLoaderFactory } from 'src/app/shared/shared.module' -// import { MenuTreeComponent } from './menu-tree.component' -// import { MenuTreeService } from 'src/app/services/menu-tree.service' -// import { MenuStateService, MenuState } from 'src/app/services/menu-state.service' - -// const state: MenuState = { -// pageSize: 0, -// showDetails: false, -// rootFilter: true, -// treeMode: true, -// treeExpansionState: new Map() -// } - -// const items = [ -// { key: 'key', id: 'id', i18n: { ['lang']: 'en' }, children: [{ key: 'key', id: 'id' }], disabled: true }, -// { key: 'key2', badge: 'angle-double-down', id: 'id' } -// ] - -// describe('MenuTreeComponent', () => { -// let component: MenuTreeComponent -// let fixture: ComponentFixture - -// const treeServiceSpy = jasmine.createSpyObj('MenuTreeService', ['calculateNewNodesPositions']) -// const stateServiceSpy = jasmine.createSpyObj('MenuStateService', ['getState']) - -// beforeEach(waitForAsync(() => { -// TestBed.configureTestingModule({ -// declarations: [MenuTreeComponent], -// imports: [ -// HttpClientTestingModule -// /* TranslateModule.forRoot({ -// loader: { -// provide: TranslateLoader, -// useFactory: HttpLoaderFactory, -// deps: [HttpClient] -// } -// }) */ -// ], -// schemas: [NO_ERRORS_SCHEMA], -// providers: [ -// { provide: MenuTreeService, useValue: treeServiceSpy }, -// { provide: MenuStateService, useValue: stateServiceSpy } -// ] -// }).compileComponents() -// treeServiceSpy.calculateNewNodesPositions.calls.reset() -// stateServiceSpy.getState.calls.reset() -// })) - -// beforeEach(() => { -// fixture = TestBed.createComponent(MenuTreeComponent) -// component = fixture.componentInstance -// fixture.detectChanges() -// }) - -// it('should create', () => { -// expect(component).toBeTruthy() -// }) - -// it('should set menuTreeNodes onChanges if portalDetail & changes correct: langExists false', () => { -// stateServiceSpy.getState.and.returnValue(state) -// const changes: SimpleChanges = { -// updateTree: new SimpleChange(null, component.updateTree, true) -// } -// component.portalMenuItems = items - -// component.ngOnChanges(changes) - -// expect(component.treeExpanded).toBeTrue() -// }) - -// it('should expand tree nodes on expandAll', () => { -// const mockExpansionState: Map = new Map() -// stateServiceSpy.getState.and.returnValue({ -// treeExpansionState: mockExpansionState, -// pageSize: 0, -// showDetails: false, -// rootFilter: true, -// treeMode: true -// }) -// component.menuTreeNodes = [ -// { key: '1', expanded: false, children: [{ key: '1-1', children: [{ key: '1-1-1' }] }] }, -// { key: '2' } -// ] - -// component.expandAll() - -// expect(stateServiceSpy.getState().treeExpansionState.get('1')).toBeTrue() -// }) - -// it('should collapse tree nodes on collapseAll', () => { -// const mockExpansionState: Map = new Map() -// stateServiceSpy.getState.and.returnValue({ -// treeExpansionState: mockExpansionState, -// pageSize: 0, -// showDetails: false, -// rootFilter: true, -// treeMode: true -// }) -// component.menuTreeNodes = [ -// { key: '1', expanded: true, children: [{ key: '1-1', children: [{ key: '1-1-1' }] }] }, -// { key: '2' } -// ] - -// component.collapseAll() - -// expect(stateServiceSpy.getState().treeExpansionState.get('1')).toBeFalse() -// }) - -// it('should update menu items onDrop: return before pushing items', () => { -// const event = { -// dragNode: { key: 'draggedNodeId', parent: { key: 'oldParentNodeId' } }, -// dropNode: { key: 'newParentNodeId', children: [{ key: 'draggedNodeId' }], parent: { key: 'parent key' } } -// } -// treeServiceSpy.calculateNewNodesPositions.and.returnValue([{ id: 'id', position: 1 }]) -// component.portalMenuItems = items - -// component.onDrop(event) - -// expect(treeServiceSpy.calculateNewNodesPositions).toHaveBeenCalledWith( -// 'oldParentNodeId', -// 'newParentNodeId', -// component.menuTreeNodes -// ) -// }) - -// it('should update menu items onDrop: other branches: complete updating the structure', () => { -// const event = { -// dragNode: { key: 'draggedNodeId', parent: { key: 'oldParentNodeId' } }, -// dropNode: { key: 'newParentNodeId', children: [{ key: 'otherdraggedNodeId' }], parent: { key: 'parent key' } } -// } -// treeServiceSpy.calculateNewNodesPositions.and.returnValue([{ id: 'id', position: 1 }]) -// spyOn(component.updateMenuStructureEmitter, 'emit') -// component.portalMenuItems = items -// const expectedItems = [ -// { -// key: 'key', -// id: 'id', -// parentItemId: undefined, -// i18n: { lang: 'en' }, -// position: 1, -// disabled: true, -// portalExit: undefined -// } -// ] - -// component.onDrop(event) - -// expect(component.updateMenuStructureEmitter.emit).toHaveBeenCalledWith(expectedItems) -// }) - -// it('should set treeExpansionState onHierarchyViewChange', () => { -// const mockExpansionState: Map = new Map() -// stateServiceSpy.getState.and.returnValue({ -// treeExpansionState: mockExpansionState, -// pageSize: 0, -// showDetails: false, -// rootFilter: true, -// treeMode: true -// }) -// const event = { node: { key: 'node', expanded: true } } -// spyOn(mockExpansionState, 'set').and.callThrough() - -// component.onHierarchyViewChange(event) - -// expect(stateServiceSpy.getState().treeExpansionState.set).toHaveBeenCalledWith(event.node.key, event.node.expanded) -// }) - -// it('should set languagePreviewValue and mapToTree onLanguagePreviewChange', () => { -// const lang = 'de' -// component.portalMenuItems = items -// const mockExpansionState: Map = new Map() -// stateServiceSpy.getState.and.returnValue({ -// treeExpansionState: mockExpansionState, -// pageSize: 0, -// showDetails: false, -// rootFilter: true, -// treeMode: true -// }) - -// component.onLanguagesPreviewChange(lang) - -// expect(component.languagesPreviewValue).toEqual(lang) -// }) -// }) +import { NO_ERRORS_SCHEMA, SimpleChanges, SimpleChange } from '@angular/core' +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing' +// import { HttpClient } from '@angular/common/http' +import { HttpClientTestingModule } from '@angular/common/http/testing' +// import { TranslateLoader, TranslateModule } from '@ngx-translate/core' + +// import { HttpLoaderFactory } from 'src/app/shared/shared.module' +import { MenuTreeComponent } from 'src/app/workspace/workspace-detail/menu/menu-tree/menu-tree.component' +import { MenuTreeService } from 'src/app/services/menu-tree.service' +import { MenuStateService, MenuState } from 'src/app/services/menu-state.service' + +const state: MenuState = { + pageSize: 0, + showDetails: false, + rootFilter: true, + treeMode: true, + treeExpansionState: new Map() +} + +const items = [ + { key: 'key', id: 'id', i18n: { ['lang']: 'en' }, children: [{ key: 'key', id: 'id' }], disabled: true }, + { key: 'key2', badge: 'angle-double-down', id: 'id' } +] + +describe('MenuTreeComponent', () => { + let component: MenuTreeComponent + let fixture: ComponentFixture + + const treeServiceSpy = jasmine.createSpyObj('MenuTreeService', ['calculateNewNodesPositions']) + const stateServiceSpy = jasmine.createSpyObj('MenuStateService', ['getState']) + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [MenuTreeComponent], + imports: [ + HttpClientTestingModule + /* TranslateModule.forRoot({ + loader: { + provide: TranslateLoader, + useFactory: HttpLoaderFactory, + deps: [HttpClient] + } + }) */ + ], + schemas: [NO_ERRORS_SCHEMA], + providers: [ + { provide: MenuTreeService, useValue: treeServiceSpy }, + { provide: MenuStateService, useValue: stateServiceSpy } + ] + }).compileComponents() + treeServiceSpy.calculateNewNodesPositions.calls.reset() + stateServiceSpy.getState.calls.reset() + })) + + beforeEach(() => { + fixture = TestBed.createComponent(MenuTreeComponent) + component = fixture.componentInstance + fixture.detectChanges() + }) + + it('should create', () => { + expect(component).toBeTruthy() + }) + + it('should set menuTreeNodes onChanges if workspaceDetail & changes correct: langExists false', () => { + stateServiceSpy.getState.and.returnValue(state) + const changes: SimpleChanges = { + updateTree: new SimpleChange(null, component.updateTree, true) + } + component.workspaceMenuItems = items + + component.ngOnChanges(changes) + + expect(component.treeExpanded).toBeTrue() + }) + + it('should expand tree nodes on expandAll', () => { + const mockExpansionState: Map = new Map() + stateServiceSpy.getState.and.returnValue({ + treeExpansionState: mockExpansionState, + pageSize: 0, + showDetails: false, + rootFilter: true, + treeMode: true + }) + component.menuTreeNodes = [ + { key: '1', expanded: false, children: [{ key: '1-1', children: [{ key: '1-1-1' }] }] }, + { key: '2' } + ] + + component.expandAll() + + expect(stateServiceSpy.getState().treeExpansionState.get('1')).toBeTrue() + }) + + it('should collapse tree nodes on collapseAll', () => { + const mockExpansionState: Map = new Map() + stateServiceSpy.getState.and.returnValue({ + treeExpansionState: mockExpansionState, + pageSize: 0, + showDetails: false, + rootFilter: true, + treeMode: true + }) + component.menuTreeNodes = [ + { key: '1', expanded: true, children: [{ key: '1-1', children: [{ key: '1-1-1' }] }] }, + { key: '2' } + ] + + component.collapseAll() + + expect(stateServiceSpy.getState().treeExpansionState.get('1')).toBeFalse() + }) + + it('should update menu items onDrop: return before pushing items', () => { + const event = { + dragNode: { key: 'draggedNodeId', parent: { key: 'oldParentNodeId' } }, + dropNode: { key: 'newParentNodeId', children: [{ key: 'draggedNodeId' }], parent: { key: 'parent key' } } + } + treeServiceSpy.calculateNewNodesPositions.and.returnValue([{ id: 'id', position: 1 }]) + component.workspaceMenuItems = items + + component.onDrop(event) + + expect(treeServiceSpy.calculateNewNodesPositions).toHaveBeenCalledWith( + 'oldParentNodeId', + 'newParentNodeId', + component.menuTreeNodes + ) + }) + + it('should update menu items onDrop: other branches: complete updating the structure', () => { + const event = { + dragNode: { key: 'draggedNodeId', parent: { key: 'oldParentNodeId' } }, + dropNode: { key: 'newParentNodeId', children: [{ key: 'otherdraggedNodeId' }], parent: { key: 'parent key' } } + } + treeServiceSpy.calculateNewNodesPositions.and.returnValue([{ id: 'id', position: 1 }]) + spyOn(component.updateMenuStructureEmitter, 'emit') + component.workspaceMenuItems = items + const expectedItems = [ + { + key: 'key', + id: 'id', + parentItemId: undefined, + i18n: { lang: 'en' }, + position: 1, + disabled: true, + portalExit: undefined + } + ] + + component.onDrop(event) + + expect(component.updateMenuStructureEmitter.emit).toHaveBeenCalledWith(expectedItems) + }) + + it('should set treeExpansionState onHierarchyViewChange', () => { + const mockExpansionState: Map = new Map() + stateServiceSpy.getState.and.returnValue({ + treeExpansionState: mockExpansionState, + pageSize: 0, + showDetails: false, + rootFilter: true, + treeMode: true + }) + const event = { node: { key: 'node', expanded: true } } + spyOn(mockExpansionState, 'set').and.callThrough() + + component.onHierarchyViewChange(event) + + expect(stateServiceSpy.getState().treeExpansionState.set).toHaveBeenCalledWith(event.node.key, event.node.expanded) + }) + + it('should set languagePreviewValue and mapToTree onLanguagePreviewChange', () => { + const lang = 'de' + component.workspaceMenuItems = items + const mockExpansionState: Map = new Map() + stateServiceSpy.getState.and.returnValue({ + treeExpansionState: mockExpansionState, + pageSize: 0, + showDetails: false, + rootFilter: true, + treeMode: true + }) + + component.onLanguagesPreviewChange(lang) + + expect(component.languagesPreviewValue).toEqual(lang) + }) +}) diff --git a/src/app/workspace/workspace-detail/menu/menu-tree/menu-tree.component.ts b/src/app/workspace/workspace-detail/menu/menu-tree/menu-tree.component.ts index cad9ff6b..b8688d82 100644 --- a/src/app/workspace/workspace-detail/menu/menu-tree/menu-tree.component.ts +++ b/src/app/workspace/workspace-detail/menu/menu-tree/menu-tree.component.ts @@ -1,9 +1,9 @@ import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core' import { SelectItem, TreeNode } from 'primeng/api' -import { MenuItem } from '../../../../shared/generated' -import { MenuTreeService } from '../../../../services/menu-tree.service' -import { MenuStateService } from '../../../../services/menu-state.service' +import { MenuItem } from 'src/app/shared/generated' +import { MenuTreeService } from 'src/app/services/menu-tree.service' +import { MenuStateService } from 'src/app/services/menu-state.service' @Component({ selector: 'app-menu-tree', diff --git a/src/app/workspace/workspace-detail/menu/menu.component.ts b/src/app/workspace/workspace-detail/menu/menu.component.ts index 41c9536a..a428320f 100644 --- a/src/app/workspace/workspace-detail/menu/menu.component.ts +++ b/src/app/workspace/workspace-detail/menu/menu.component.ts @@ -23,11 +23,11 @@ import { CreateUpdateMenuItem, MenuSnapshot, PatchMenuItemsRequest -} from '../../../shared/generated' -import { limitText, dropDownSortItemsByLabel } from '../../../shared/utils' -import { MenuStringConst } from '../../..//model/menu-string-const' -import { MenuStateService } from '../../../services/menu-state.service' -import { IconService } from './iconservice' +} from 'src/app/shared/generated' +import { limitText, dropDownSortItemsByLabel } from 'src/app/shared/utils' +import { MenuStringConst } from 'src/app//model/menu-string-const' +import { MenuStateService } from 'src/app/services/menu-state.service' +import { IconService } from 'src/app/workspace/workspace-detail/menu/iconservice' type LanguageItem = SelectItem & { data: string } type I18N = { [key: string]: string } diff --git a/src/app/workspace/workspace-detail/menu/menu.module.ts b/src/app/workspace/workspace-detail/menu/menu.module.ts index b2568f91..f90b6ccb 100644 --- a/src/app/workspace/workspace-detail/menu/menu.module.ts +++ b/src/app/workspace/workspace-detail/menu/menu.module.ts @@ -5,11 +5,11 @@ import { RouterModule, Routes } from '@angular/router' import { TreeDragDropService } from 'primeng/api' import { addInitializeModuleGuard, InitializeModuleGuard, PortalCoreModule } from '@onecx/portal-integration-angular' -import { SharedModule } from '../../../shared/shared.module' +import { SharedModule } from 'src/app/shared/shared.module' -import { MenuTreeService } from '../../../services/menu-tree.service' -import { MenuTreeComponent } from './menu-tree/menu-tree.component' -import { MenuComponent } from './menu.component' +import { MenuTreeService } from 'src/app/services/menu-tree.service' +import { MenuTreeComponent } from 'src/app/workspace/workspace-detail/menu/menu-tree/menu-tree.component' +import { MenuComponent } from 'src/app/workspace/workspace-detail/menu/menu.component' const routes: Routes = [ { diff --git a/src/app/workspace/workspace-detail/workspace-detail.component.ts b/src/app/workspace/workspace-detail/workspace-detail.component.ts index 61dab81a..dc2fbee5 100644 --- a/src/app/workspace/workspace-detail/workspace-detail.component.ts +++ b/src/app/workspace/workspace-detail/workspace-detail.component.ts @@ -6,13 +6,13 @@ import { FileSaver } from 'file-saver' import { Observable, map } from 'rxjs' import { Action, ObjectDetailItem, PortalMessageService, UserService } from '@onecx/portal-integration-angular' -import { WorkspaceSnapshot, Workspace, WorkspaceAPIService } from '../../shared/generated' -import { environment } from '../../../environments/environment' +import { WorkspaceSnapshot, Workspace, WorkspaceAPIService } from 'src/app/shared/generated' +import { environment } from 'src/environments/environment' -import { WorkspacePropsComponent } from './workspace-props/workspace-props.component' -import { WorkspaceRolesComponent } from './workspace-roles/workspace-roles.component' -import { WorkspaceInternComponent } from './workspace-intern/workspace-intern.component' -import { WorkspaceContactComponent } from './workspace-contact/workspace-contact.component' +import { WorkspacePropsComponent } from 'src/app/workspace/workspace-detail/workspace-props/workspace-props.component' +import { WorkspaceRolesComponent } from 'src/app/workspace/workspace-detail/workspace-roles/workspace-roles.component' +import { WorkspaceInternComponent } from 'src/app/workspace/workspace-detail/workspace-intern/workspace-intern.component' +import { WorkspaceContactComponent } from 'src/app/workspace/workspace-detail/workspace-contact/workspace-contact.component' @Component({ selector: 'app-workspace-detail', diff --git a/src/app/workspace/workspace-detail/workspace-detail.module.ts b/src/app/workspace/workspace-detail/workspace-detail.module.ts index 61cc2faa..b3e9c21d 100644 --- a/src/app/workspace/workspace-detail/workspace-detail.module.ts +++ b/src/app/workspace/workspace-detail/workspace-detail.module.ts @@ -4,17 +4,17 @@ import { FormsModule } from '@angular/forms' import { RouterModule, Routes } from '@angular/router' import { addInitializeModuleGuard, InitializeModuleGuard, PortalCoreModule } from '@onecx/portal-integration-angular' -import { SharedModule } from '../../shared/shared.module' -import { LabelResolver } from '../../shared/label.resolver' +import { SharedModule } from 'src/app/shared/shared.module' +import { LabelResolver } from 'src/app/shared/label.resolver' -import { WorkspaceDetailComponent } from './workspace-detail.component' -import { WorkspacePropsComponent } from './workspace-props/workspace-props.component' -import { WorkspaceRolesComponent } from './workspace-roles/workspace-roles.component' -import { WorkspaceInternComponent } from './workspace-intern/workspace-intern.component' -import { WorkspaceImagesComponent } from './workspace-images/workspace-images.component' -import { WorkspaceContactComponent } from './workspace-contact/workspace-contact.component' -import { ProductComponent } from './products/products.component' -import { LogoComponent } from './workspace-images/logo/logo.component' +import { WorkspaceDetailComponent } from 'src/app/workspace/workspace-detail/workspace-detail.component' +import { WorkspacePropsComponent } from 'src/app/workspace/workspace-detail/workspace-props/workspace-props.component' +import { WorkspaceRolesComponent } from 'src/app/workspace/workspace-detail/workspace-roles/workspace-roles.component' +import { WorkspaceInternComponent } from 'src/app/workspace/workspace-detail/workspace-intern/workspace-intern.component' +import { WorkspaceImagesComponent } from 'src/app/workspace/workspace-detail/workspace-images/workspace-images.component' +import { WorkspaceContactComponent } from 'src/app/workspace/workspace-detail/workspace-contact/workspace-contact.component' +import { ProductComponent } from 'src/app/workspace/workspace-detail/products/products.component' +import { LogoComponent } from 'src/app/workspace/workspace-detail/workspace-images/logo/logo.component' const routes: Routes = [ { diff --git a/src/app/workspace/workspace-detail/workspace-images/logo/logo.component.ts b/src/app/workspace/workspace-detail/workspace-images/logo/logo.component.ts index 61426bdc..3bbdc4e5 100644 --- a/src/app/workspace/workspace-detail/workspace-images/logo/logo.component.ts +++ b/src/app/workspace/workspace-detail/workspace-images/logo/logo.component.ts @@ -1,5 +1,5 @@ import { Component, Input, OnChanges, SimpleChanges } from '@angular/core' -import { environment } from '../../../../../environments/environment' +import { environment } from 'src/environments/environment' @Component({ selector: 'app-logo', diff --git a/src/app/workspace/workspace-detail/workspace-images/workspace-images.component.ts b/src/app/workspace/workspace-detail/workspace-images/workspace-images.component.ts index f99ce00f..b5be0aab 100644 --- a/src/app/workspace/workspace-detail/workspace-images/workspace-images.component.ts +++ b/src/app/workspace/workspace-detail/workspace-images/workspace-images.component.ts @@ -3,9 +3,9 @@ import { FormArray, FormBuilder, FormControl, FormControlState, FormGroup } from import { TranslateService } from '@ngx-translate/core' import { PortalMessageService } from '@onecx/portal-integration-angular' -import { /* ImageV1APIService, */ WorkspaceAPIService, Workspace } from '../../../shared/generated' -import { cloneWorkspaceWithMicrofrontendsArray } from '../../../shared/utils' -import { LogoState } from '../../workspace-create/logo-state' +import { /* ImageV1APIService, */ WorkspaceAPIService, Workspace } from 'src/app/shared/generated' +import { cloneWorkspaceWithMicrofrontendsArray } from 'src/app/shared/utils' +import { LogoState } from 'src/app/workspace/workspace-create/logo-state' export interface PortalImageForm { url: FormControl diff --git a/src/app/workspace/workspace-detail/workspace-intern/workspace-intern.component.spec.ts b/src/app/workspace/workspace-detail/workspace-intern/workspace-intern.component.spec.ts index 85b64103..4c7fcc12 100644 --- a/src/app/workspace/workspace-detail/workspace-intern/workspace-intern.component.spec.ts +++ b/src/app/workspace/workspace-detail/workspace-intern/workspace-intern.component.spec.ts @@ -3,10 +3,20 @@ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing' import { HttpClient } from '@angular/common/http' import { HttpClientTestingModule } from '@angular/common/http/testing' import { TranslateLoader, TranslateModule } from '@ngx-translate/core' +import { Observable } from 'rxjs' +import { MfeInfo } from '@onecx/integration-interface' import { AppStateService, createTranslateLoader } from '@onecx/portal-integration-angular' import { WorkspaceInternComponent } from 'src/app/workspace/workspace-detail/workspace-intern/workspace-intern.component' +let currentMfe$: Observable> +let globalLoading$: Observable + +const appStateServiceMock = { + currentMfe$: { asObservable: () => currentMfe$ }, + globalLoading$: { asObservable: () => globalLoading$ } +} + describe('WorkspaceInternComponent', () => { let component: WorkspaceInternComponent let fixture: ComponentFixture @@ -17,7 +27,6 @@ describe('WorkspaceInternComponent', () => { imports: [ HttpClientTestingModule, TranslateModule.forRoot({ - isolate: true, loader: { provide: TranslateLoader, useFactory: createTranslateLoader, @@ -25,6 +34,7 @@ describe('WorkspaceInternComponent', () => { } }) ], + providers: [{ provide: AppStateService, useValue: appStateServiceMock }], schemas: [NO_ERRORS_SCHEMA] }).compileComponents() })) diff --git a/src/app/workspace/workspace-detail/workspace-props/workspace-props.component.ts b/src/app/workspace/workspace-detail/workspace-props/workspace-props.component.ts index ad5d0d19..534f1791 100644 --- a/src/app/workspace/workspace-detail/workspace-props/workspace-props.component.ts +++ b/src/app/workspace/workspace-detail/workspace-props/workspace-props.component.ts @@ -15,15 +15,15 @@ import { import { // ImageV1APIService, WorkspaceAPIService /* , ThemeDTO, ThemesAPIService */ -} from '../../../shared/generated' -import { Workspace } from '../../../shared/generated' -import { environment } from '../../../../environments/environment' -import { LogoState } from '../../workspace-create/logo-state' +} from 'src/app/shared/generated' +import { Workspace } from 'src/app/shared/generated' +import { environment } from 'src/environments/environment' +import { LogoState } from 'src/app/workspace/workspace-create/logo-state' import { setFetchUrls, copyToClipboard // sortThemeByName -} from '../../../shared/utils' +} from 'src/app/shared/utils' @Component({ selector: 'app-workspace-props', diff --git a/src/app/workspace/workspace-detail/workspace-roles/workspace-roles.component.ts b/src/app/workspace/workspace-detail/workspace-roles/workspace-roles.component.ts index 4f5ffdf9..42f27a6c 100644 --- a/src/app/workspace/workspace-detail/workspace-roles/workspace-roles.component.ts +++ b/src/app/workspace/workspace-detail/workspace-roles/workspace-roles.component.ts @@ -1,8 +1,7 @@ import { Component, Input, Output, SimpleChanges, OnChanges, EventEmitter } from '@angular/core' import { FormArray, FormControl } from '@angular/forms' -import { WorkspaceAPIService } from '../../../shared/generated' -import { Workspace } from '../../../shared/generated' +import { Workspace, WorkspaceAPIService } from '../../../shared/generated' import { PortalMessageService } from '@onecx/portal-integration-angular' @Component({ diff --git a/src/app/workspace/workspace-import/choose-file/choose-file.component.spec.ts b/src/app/workspace/workspace-import/choose-file/choose-file.component.spec.ts index 2cddbb84..1c06b6e1 100644 --- a/src/app/workspace/workspace-import/choose-file/choose-file.component.spec.ts +++ b/src/app/workspace/workspace-import/choose-file/choose-file.component.spec.ts @@ -8,7 +8,7 @@ import { of, throwError } from 'rxjs' import { PortalMessageService } from '@onecx/portal-integration-angular' // import { HttpLoaderFactory } from 'src/app/shared/shared.module' import { ChooseFileComponent } from './choose-file.component' -import { WorkspaceAPIService, WorkspaceSnapshot } from '../../../shared/generated' +import { WorkspaceAPIService, WorkspaceSnapshot } from 'src/app/shared/generated' const snapshot: WorkspaceSnapshot = { workspaces: { diff --git a/src/app/workspace/workspace-import/choose-file/choose-file.component.ts b/src/app/workspace/workspace-import/choose-file/choose-file.component.ts index b7e468cc..375edec2 100644 --- a/src/app/workspace/workspace-import/choose-file/choose-file.component.ts +++ b/src/app/workspace/workspace-import/choose-file/choose-file.component.ts @@ -1,7 +1,7 @@ import { Component, EventEmitter, OnInit, Output } from '@angular/core' import { HttpHeaders } from '@angular/common/http' import { TranslateService } from '@ngx-translate/core' -import { WorkspaceSnapshot, EximWorkspaceMenuItem } from '../../../shared/generated' +import { WorkspaceSnapshot, EximWorkspaceMenuItem } from 'src/app/shared/generated' @Component({ selector: 'app-import-choose-file', diff --git a/src/app/workspace/workspace-import/confirm/confirm.component.ts b/src/app/workspace/workspace-import/confirm/confirm.component.ts index 8437a577..82c4691c 100644 --- a/src/app/workspace/workspace-import/confirm/confirm.component.ts +++ b/src/app/workspace/workspace-import/confirm/confirm.component.ts @@ -3,7 +3,7 @@ import { /* ThemeDTO, ThemesAPIService, */ WorkspaceAPIService, SearchWorkspacesResponse, WorkspaceAbstract -} from '../../../shared/generated' +} from 'src/app/shared/generated' @Component({ selector: 'app-import-confirm', diff --git a/src/app/workspace/workspace-import/preview/preview.component.ts b/src/app/workspace/workspace-import/preview/preview.component.ts index 1d423072..6dbb98d6 100644 --- a/src/app/workspace/workspace-import/preview/preview.component.ts +++ b/src/app/workspace/workspace-import/preview/preview.component.ts @@ -8,8 +8,8 @@ import { WorkspaceSnapshot // MicrofrontendRegistrationDTO // ThemesAPIService -} from '../../../shared/generated' -import { forceFormValidation /* , sortThemeByName */ } from '../../../shared/utils' +} from 'src/app/shared/generated' +import { forceFormValidation /* , sortThemeByName */ } from 'src/app/shared/utils' @Component({ selector: 'app-import-preview', diff --git a/src/app/workspace/workspace-import/workspace-import.component.ts b/src/app/workspace/workspace-import/workspace-import.component.ts index e020f691..50e94d80 100644 --- a/src/app/workspace/workspace-import/workspace-import.component.ts +++ b/src/app/workspace/workspace-import/workspace-import.component.ts @@ -5,8 +5,8 @@ import { TranslateService } from '@ngx-translate/core' import { PortalMessageService, UserService } from '@onecx/portal-integration-angular' -import { PreviewComponent } from './preview/preview.component' -import { ConfirmComponent } from './confirm/confirm.component' +import { PreviewComponent } from 'src/app/workspace/workspace-import/preview/preview.component' +import { ConfirmComponent } from 'src/app/workspace/workspace-import/confirm/confirm.component' import { WorkspaceAPIService, EximWorkspaceMenuItem, WorkspaceSnapshot } from 'src/app/shared/generated' @Component({ diff --git a/src/app/workspace/workspace-search/workspace-search.component.ts b/src/app/workspace/workspace-search/workspace-search.component.ts index ea724571..44fa0887 100644 --- a/src/app/workspace/workspace-search/workspace-search.component.ts +++ b/src/app/workspace/workspace-search/workspace-search.component.ts @@ -2,9 +2,10 @@ import { Component, OnInit, ViewChild } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' import { finalize } from 'rxjs' import { TranslateService } from '@ngx-translate/core' + import { Action, DataViewControlTranslations, PortalMessageService } from '@onecx/portal-integration-angular' -import { limitText } from '../../shared/utils' -import { SearchWorkspacesResponse, Workspace, WorkspaceAPIService, WorkspaceAbstract } from '../../shared/generated' +import { limitText } from 'src/app/shared/utils' +import { SearchWorkspacesResponse, Workspace, WorkspaceAPIService, WorkspaceAbstract } from 'src/app/shared/generated' @Component({ selector: 'app-workspace-search', diff --git a/src/app/workspace/workspace.module.ts b/src/app/workspace/workspace.module.ts index f4fcdf9b..c3f1907e 100644 --- a/src/app/workspace/workspace.module.ts +++ b/src/app/workspace/workspace.module.ts @@ -4,15 +4,15 @@ import { FormsModule } from '@angular/forms' import { RouterModule, Routes } from '@angular/router' import { addInitializeModuleGuard, InitializeModuleGuard, PortalCoreModule } from '@onecx/portal-integration-angular' -import { SharedModule } from '../shared/shared.module' -import { LabelResolver } from '../shared/label.resolver' +import { SharedModule } from 'src/app/shared/shared.module' +import { LabelResolver } from 'src/app/shared/label.resolver' -import { WorkspaceSearchComponent } from './workspace-search/workspace-search.component' -import { WorkspaceCreateComponent } from './workspace-create/workspace-create.component' -import { WorkspaceImportComponent } from './workspace-import/workspace-import.component' -import { ChooseFileComponent } from './workspace-import/choose-file/choose-file.component' -import { PreviewComponent } from './workspace-import/preview/preview.component' -import { ConfirmComponent } from './workspace-import/confirm/confirm.component' +import { WorkspaceSearchComponent } from 'src/app/workspace/workspace-search/workspace-search.component' +import { WorkspaceCreateComponent } from 'src/app/workspace/workspace-create/workspace-create.component' +import { WorkspaceImportComponent } from 'src/app/workspace/workspace-import/workspace-import.component' +import { ChooseFileComponent } from 'src/app/workspace/workspace-import/choose-file/choose-file.component' +import { PreviewComponent } from 'src/app/workspace/workspace-import/preview/preview.component' +import { ConfirmComponent } from 'src/app/workspace/workspace-import/confirm/confirm.component' const routes: Routes = [ {