From 4702bd1d65f7252d4d2b49bca285653da20a361e Mon Sep 17 00:00:00 2001 From: thanicz Date: Wed, 7 Jan 2026 09:36:26 +0100 Subject: [PATCH] KNOX-3234: Upgrade Admin UI Angular to 21+, bootstrap to 5+ --- gateway-admin-ui/.eslintrc.json | 98 -- .../admin-ui/app/app.component.spec.ts | 53 - .../admin-ui/app/app.component.ts | 14 +- gateway-admin-ui/admin-ui/app/app.module.ts | 97 -- .../app/descriptor/descriptor.component.css | 0 .../app/descriptor/descriptor.component.html | 3 - .../descriptor/descriptor.component.spec.ts | 41 - .../app/descriptor/descriptor.component.ts | 29 - .../gateway-version.component.ts | 37 +- gateway-admin-ui/admin-ui/app/index.ts | 18 - gateway-admin-ui/admin-ui/app/main.ts | 21 - .../{resource-detail => model}/descriptor.ts | 2 +- .../app/{ => model}/gateway-version.ts | 0 .../provider-config.ts | 0 .../app/{resource => model}/resource.ts | 2 - .../app/{resource => model}/service.ts | 0 .../servicedefinition.ts | 4 - .../session-information.ts} | 3 - .../admin-ui/app/{ => model}/topology.ts | 0 .../new-desc-wizard.component.css | 23 + .../new-desc-wizard.component.html | 244 ++--- .../new-desc-wizard.component.spec.ts | 41 - .../new-desc-wizard.component.ts | 24 +- .../provider-config-selector.component.html | 39 +- ...provider-config-selector.component.spec.ts | 41 - .../provider-config-selector.component.ts | 25 +- .../AnonymousProviderConfig.ts | 2 +- .../authentication-wizard.ts | 3 +- .../authorization-wizard.ts | 3 +- .../provider-config-wizard/category-wizard.ts | 2 +- .../csrf-provider-config.ts | 3 +- .../display-binding-provider-config.ts | 6 +- .../app/provider-config-wizard/ha-wizard.ts | 2 +- .../hostmap-provider-wizard.ts | 2 +- .../identity-assertion-wizard.ts | 5 +- .../provider-config-wizard.component.html | 249 ++--- .../provider-config-wizard.component.spec.ts | 41 - .../provider-config-wizard.component.ts | 24 +- .../provider-contributor-wizard.ts | 2 +- .../webappsec-provider-config.ts | 2 +- .../webappsec-wizard.ts | 5 +- .../resource-detail.component.css | 14 +- .../resource-detail.component.html | 956 ++++++++++-------- .../resource-detail.component.spec.ts | 41 - .../resource-detail.component.ts | 79 +- .../app/resource/resource.component.css | 58 ++ .../app/resource/resource.component.html | 88 +- .../app/resource/resource.component.spec.ts | 41 - .../app/resource/resource.component.ts | 52 +- .../resourcetypes/resourcetypes.component.css | 45 + .../resourcetypes.component.html | 28 +- .../resourcetypes.component.spec.ts | 41 - .../resourcetypes/resourcetypes.component.ts | 4 +- .../new-service-definition.component.css | 24 +- .../new-service-definition.component.html | 40 +- .../new-service-definition.component.ts | 44 +- .../app/service-definition/rewrite.rules.ts | 21 - .../servicedefinition-detail.component.ts | 210 ++-- .../{ => service}/gateway-version.service.ts | 19 +- .../{resource => service}/resource.service.ts | 100 +- .../resourcetypes.service.ts | 4 +- .../servicedefinition.service.ts | 95 +- .../session.information.service.ts | 19 +- .../app/{ => service}/topology.service.ts | 68 +- .../session.information.component.html | 0 .../session.information.component.ts | 11 +- .../admin-ui/app/topology-detail.component.ts | 209 ---- .../topology-detail.component.ts | 269 +++++ .../app/{ => topology}/topology.component.ts | 24 +- .../admin-ui/app/utils/json-pretty.pipe.ts | 4 +- .../admin-ui/app/utils/modal.component.ts | 55 + .../admin-ui/app/utils/tabs.component.ts | 15 +- .../admin-ui/app/utils/validation-utils.ts | 2 +- .../admin-ui/app/utils/xml.pipe.ts | 4 +- .../admin-ui/assets/sticky-footer.css | 24 - gateway-admin-ui/admin-ui/index.html | 50 +- gateway-admin-ui/admin-ui/main.ts | 28 +- .../rewrite.rule.ts => material-theme.scss} | 11 +- gateway-admin-ui/admin-ui/polyfills.ts | 20 +- gateway-admin-ui/admin-ui/styles.css | 9 - gateway-admin-ui/admin-ui/styles.scss | 354 +++++++ gateway-admin-ui/admin-ui/tsconfig.json | 11 +- gateway-admin-ui/admin-ui/typings.d.ts | 18 - gateway-admin-ui/angular.json | 45 +- gateway-admin-ui/eslint.config.js | 76 ++ gateway-admin-ui/package.json | 75 +- gateway-admin-ui/pom.xml | 8 +- .../session.information.component.html | 1 - .../session.information.component.html | 1 - 89 files changed, 2313 insertions(+), 2312 deletions(-) delete mode 100644 gateway-admin-ui/.eslintrc.json delete mode 100644 gateway-admin-ui/admin-ui/app/app.component.spec.ts delete mode 100644 gateway-admin-ui/admin-ui/app/app.module.ts delete mode 100644 gateway-admin-ui/admin-ui/app/descriptor/descriptor.component.css delete mode 100644 gateway-admin-ui/admin-ui/app/descriptor/descriptor.component.html delete mode 100644 gateway-admin-ui/admin-ui/app/descriptor/descriptor.component.spec.ts delete mode 100644 gateway-admin-ui/admin-ui/app/descriptor/descriptor.component.ts rename gateway-admin-ui/admin-ui/app/{ => gateway-version}/gateway-version.component.ts (62%) delete mode 100644 gateway-admin-ui/admin-ui/app/index.ts delete mode 100644 gateway-admin-ui/admin-ui/app/main.ts rename gateway-admin-ui/admin-ui/app/{resource-detail => model}/descriptor.ts (98%) rename gateway-admin-ui/admin-ui/app/{ => model}/gateway-version.ts (100%) rename gateway-admin-ui/admin-ui/app/{resource-detail => model}/provider-config.ts (100%) rename gateway-admin-ui/admin-ui/app/{resource => model}/resource.ts (95%) rename gateway-admin-ui/admin-ui/app/{resource => model}/service.ts (100%) rename gateway-admin-ui/admin-ui/app/{service-definition => model}/servicedefinition.ts (89%) rename gateway-admin-ui/admin-ui/app/{sessionInformation/session.information.ts => model/session-information.ts} (91%) rename gateway-admin-ui/admin-ui/app/{ => model}/topology.ts (100%) delete mode 100644 gateway-admin-ui/admin-ui/app/new-desc-wizard/new-desc-wizard.component.spec.ts delete mode 100644 gateway-admin-ui/admin-ui/app/provider-config-selector/provider-config-selector.component.spec.ts delete mode 100644 gateway-admin-ui/admin-ui/app/provider-config-wizard/provider-config-wizard.component.spec.ts delete mode 100644 gateway-admin-ui/admin-ui/app/resource-detail/resource-detail.component.spec.ts delete mode 100644 gateway-admin-ui/admin-ui/app/resource/resource.component.spec.ts delete mode 100644 gateway-admin-ui/admin-ui/app/resourcetypes/resourcetypes.component.spec.ts delete mode 100644 gateway-admin-ui/admin-ui/app/service-definition/rewrite.rules.ts rename gateway-admin-ui/admin-ui/app/{ => service}/gateway-version.service.ts (77%) rename gateway-admin-ui/admin-ui/app/{resource => service}/resource.service.ts (80%) rename gateway-admin-ui/admin-ui/app/{resourcetypes => service}/resourcetypes.service.ts (95%) rename gateway-admin-ui/admin-ui/app/{service-definition => service}/servicedefinition.service.ts (53%) rename gateway-admin-ui/admin-ui/app/{sessionInformation => service}/session.information.service.ts (83%) rename gateway-admin-ui/admin-ui/app/{ => service}/topology.service.ts (67%) rename gateway-admin-ui/admin-ui/app/{sessionInformation => session-information}/session.information.component.html (100%) rename gateway-admin-ui/admin-ui/app/{sessionInformation => session-information}/session.information.component.ts (91%) delete mode 100644 gateway-admin-ui/admin-ui/app/topology-detail.component.ts create mode 100644 gateway-admin-ui/admin-ui/app/topology-detail/topology-detail.component.ts rename gateway-admin-ui/admin-ui/app/{ => topology}/topology.component.ts (74%) create mode 100644 gateway-admin-ui/admin-ui/app/utils/modal.component.ts delete mode 100644 gateway-admin-ui/admin-ui/assets/sticky-footer.css rename gateway-admin-ui/admin-ui/{app/service-definition/rewrite.rule.ts => material-theme.scss} (86%) delete mode 100644 gateway-admin-ui/admin-ui/styles.css create mode 100644 gateway-admin-ui/admin-ui/styles.scss delete mode 100644 gateway-admin-ui/admin-ui/typings.d.ts create mode 100644 gateway-admin-ui/eslint.config.js diff --git a/gateway-admin-ui/.eslintrc.json b/gateway-admin-ui/.eslintrc.json deleted file mode 100644 index 71378a09f6..0000000000 --- a/gateway-admin-ui/.eslintrc.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "root": true, - "overrides": [ - { - "files": [ - "*.ts" - ], - "parserOptions": { - "project": [ - "admin-ui/tsconfig.json" - ], - "createDefaultProgram": true - }, - "extends": [ - "plugin:@angular-eslint/recommended", - "plugin:@angular-eslint/template/process-inline-templates" - ], - "rules": { - "@typescript-eslint/naming-convention": [ - "error", - { - "selector": ["class"], - "format": ["PascalCase"] - } - ], - "spaced-comment": "error", - "curly": "error", - "eol-last": "error", - "guard-for-in": "error", - "no-unused-labels": "error", - "max-len": [ - "error", - { "code": 140 } - ], - "@typescript-eslint/explicit-member-accessibility": [ - "off", - {"accessibility": "no-public"} - ], - "@typescript-eslint/member-ordering": [ - "error", - { "default": ["static-field", "instance-field", "field", "method"] } - ], - "no-caller": "error", - "no-bitwise": "error", - "no-console": "off", - "no-new-wrappers": "error", - "no-debugger": "error", - "no-redeclare": "off", - "no-empty": "error", - "no-eval": "error", - "@typescript-eslint/no-inferrable-types": "error", - "no-shadow": "error", - "dot-notation": "off", - "no-fallthrough": "error", - "no-trailing-spaces": "error", - "no-unused-expressions": "error", - "no-var": "error", - "sort-keys": "off", - "brace-style": ["error","1tbs", { "allowSingleLine": true }], - "quotes": ["error", "single"], - "radix": "error", - "@typescript-eslint/semi": "error", - "eqeqeq": ["error", "always", {"null": "ignore"}], - "@typescript-eslint/type-annotation-spacing": "error", - "@angular-eslint/directive-selector": [ - "error", - { - "type": "attribute", - "prefix": "app", - "style": "camelCase" - } - ], - "@angular-eslint/component-selector": [ - "error", - { - "type": "element", - "prefix": "app", - "style": "kebab-case" - } - ], - "@angular-eslint/no-input-rename": "off", - "@angular-eslint/no-output-rename": "error", - "@angular-eslint/use-pipe-transform-interface": "error", - "@angular-eslint/component-class-suffix": "error", - "@angular-eslint/directive-class-suffix": "error" - } - }, - { - "files": [ - "*.html" - ], - "extends": [ - "plugin:@angular-eslint/template/recommended" - ], - "rules": {} - } - ] -} diff --git a/gateway-admin-ui/admin-ui/app/app.component.spec.ts b/gateway-admin-ui/admin-ui/app/app.component.spec.ts deleted file mode 100644 index f341605862..0000000000 --- a/gateway-admin-ui/admin-ui/app/app.component.spec.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* tslint:disable:no-unused-variable */ -import {AppComponent} from './app.component'; - -import {TestBed} from '@angular/core/testing'; - -import {By} from '@angular/platform-browser'; - -// SPECS - -// Delete this -describe('Smoke test', () => { - it('should run a passing test', () => { - expect(true).toEqual(true, 'should pass'); - }); -}); - -describe('AppComponent with TCB', function () { - beforeEach(() => { - TestBed.configureTestingModule({declarations: [AppComponent]}); - }); - - it('should instantiate component', () => { - let fixture = TestBed.createComponent(AppComponent); - expect(fixture.componentInstance instanceof AppComponent).toBe(true, 'should create AppComponent'); - }); - - it('should have expected

text', () => { - let fixture = TestBed.createComponent(AppComponent); - fixture.detectChanges(); - - let h1 = fixture.debugElement.query(el => el.name === 'h1').nativeElement; // it works - - h1 = fixture.debugElement.query(By.css('h1')).nativeElement; // preferred - - expect(h1.innerText).toMatch(/angular 2 app/i, '

should say something about "Angular 2 App"'); - }); -}); diff --git a/gateway-admin-ui/admin-ui/app/app.component.ts b/gateway-admin-ui/admin-ui/app/app.component.ts index 63fd7e777b..d2bed8c8a3 100644 --- a/gateway-admin-ui/admin-ui/app/app.component.ts +++ b/gateway-admin-ui/admin-ui/app/app.component.ts @@ -15,14 +15,14 @@ * limitations under the License. */ import {Component} from '@angular/core'; -import {TopologyService} from './topology.service'; -import {ServiceDefinitionService} from './service-definition/servicedefinition.service'; -import {ResourceTypesService} from './resourcetypes/resourcetypes.service'; +import {ResourcetypesComponent} from './resourcetypes/resourcetypes.component'; +import {ResourceComponent} from './resource/resource.component'; +import {ResourceDetailComponent} from './resource-detail/resource-detail.component'; @Component({ selector: 'app-resource-management', template: ` -
+
@@ -36,12 +36,8 @@ import {ResourceTypesService} from './resourcetypes/resourcetypes.service';
`, - providers: [TopologyService, ServiceDefinitionService, ResourceTypesService] + imports: [ResourcetypesComponent, ResourceComponent, ResourceDetailComponent] }) export class AppComponent { - constructor(private topologyService: TopologyService, - private serviceDefinitionService: ServiceDefinitionService, - private resourcetypesService: ResourceTypesService) { - } } diff --git a/gateway-admin-ui/admin-ui/app/app.module.ts b/gateway-admin-ui/admin-ui/app/app.module.ts deleted file mode 100644 index bc51ea9e94..0000000000 --- a/gateway-admin-ui/admin-ui/app/app.module.ts +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import {NgModule} from '@angular/core'; -import {DataTableModule} from 'angular2-datatable'; -import {BrowserModule} from '@angular/platform-browser'; -import {HttpClientModule, HttpClientXsrfModule} from '@angular/common/http'; -import {FormsModule} from '@angular/forms'; -import {CustomFormsModule} from 'ng2-validation'; -import {APP_BASE_HREF} from '@angular/common'; - -import {AppComponent} from './app.component'; -import {TopologyService} from './topology.service'; -import {ServiceDefinitionService} from './service-definition/servicedefinition.service'; -import {ServiceDefinitionDetailComponent} from './service-definition/servicedefinition-detail.component'; -import {NewServiceDefinitionComponent} from './service-definition/new-service-definition.component'; -import {GatewayVersionService} from './gateway-version.service'; -import {GatewayVersionComponent} from './gateway-version.component'; -import {TopologyComponent} from './topology.component'; -import {TopologyDetailComponent} from './topology-detail.component'; -import {XmlPipe} from './utils/xml.pipe'; -import {JsonPrettyPipe} from './utils/json-pretty.pipe'; -import {TabComponent} from './utils/tab.component'; -import {TabsComponent} from './utils/tabs.component'; - -import {AceEditorModule} from 'ng2-ace-editor'; -import {BsModalModule} from 'ng2-bs3-modal'; -import {ResourcetypesComponent} from './resourcetypes/resourcetypes.component'; -import {ResourceTypesService} from './resourcetypes/resourcetypes.service'; -import {ResourceComponent} from './resource/resource.component'; -import {ResourceService} from './resource/resource.service'; -import {DescriptorComponent} from './descriptor/descriptor.component'; -import {ResourceDetailComponent} from './resource-detail/resource-detail.component'; -import {ProviderConfigSelectorComponent} from './provider-config-selector/provider-config-selector.component'; -import {NewDescWizardComponent} from './new-desc-wizard/new-desc-wizard.component'; -import {ProviderConfigWizardComponent} from './provider-config-wizard/provider-config-wizard.component'; -import {SessionInformationComponent} from './sessionInformation/session.information.component'; -import {SafeHtmlPipe} from './sessionInformation/session.information.component'; - -@NgModule({ - imports: [BrowserModule, - HttpClientModule, - HttpClientXsrfModule, - FormsModule, - CustomFormsModule, - BsModalModule, - AceEditorModule, - DataTableModule - ], - declarations: [AppComponent, - TopologyComponent, - TopologyDetailComponent, - ServiceDefinitionDetailComponent, - NewServiceDefinitionComponent, - GatewayVersionComponent, - XmlPipe, - JsonPrettyPipe, - TabsComponent, - TabComponent, - ResourcetypesComponent, - ResourceComponent, - DescriptorComponent, - ResourceDetailComponent, - ProviderConfigSelectorComponent, - NewDescWizardComponent, - ProviderConfigWizardComponent, - SessionInformationComponent, - SafeHtmlPipe - ], - providers: [TopologyService, - ServiceDefinitionService, - GatewayVersionService, - ResourceComponent, - ResourceTypesService, - ResourceService, - {provide: APP_BASE_HREF, useValue: '/'} - ], - bootstrap: [AppComponent, - GatewayVersionComponent, - SessionInformationComponent - ] -}) -export class AppModule { -} diff --git a/gateway-admin-ui/admin-ui/app/descriptor/descriptor.component.css b/gateway-admin-ui/admin-ui/app/descriptor/descriptor.component.css deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/gateway-admin-ui/admin-ui/app/descriptor/descriptor.component.html b/gateway-admin-ui/admin-ui/app/descriptor/descriptor.component.html deleted file mode 100644 index c4e7fc1ef8..0000000000 --- a/gateway-admin-ui/admin-ui/app/descriptor/descriptor.component.html +++ /dev/null @@ -1,3 +0,0 @@ -

- descriptor works! -

diff --git a/gateway-admin-ui/admin-ui/app/descriptor/descriptor.component.spec.ts b/gateway-admin-ui/admin-ui/app/descriptor/descriptor.component.spec.ts deleted file mode 100644 index 850d7064b9..0000000000 --- a/gateway-admin-ui/admin-ui/app/descriptor/descriptor.component.spec.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import {async, ComponentFixture, TestBed} from '@angular/core/testing'; - -import {DescriptorComponent} from './descriptor.component'; - -describe('DescriptorComponent', () => { - let component: DescriptorComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [DescriptorComponent] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(DescriptorComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/gateway-admin-ui/admin-ui/app/descriptor/descriptor.component.ts b/gateway-admin-ui/admin-ui/app/descriptor/descriptor.component.ts deleted file mode 100644 index c0a4471641..0000000000 --- a/gateway-admin-ui/admin-ui/app/descriptor/descriptor.component.ts +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import {Component, OnInit} from '@angular/core'; - -@Component({ - selector: 'app-descriptor', - templateUrl: './descriptor.component.html', - styleUrls: ['./descriptor.component.css'] -}) -export class DescriptorComponent { - - constructor() { - } - -} diff --git a/gateway-admin-ui/admin-ui/app/gateway-version.component.ts b/gateway-admin-ui/admin-ui/app/gateway-version/gateway-version.component.ts similarity index 62% rename from gateway-admin-ui/admin-ui/app/gateway-version.component.ts rename to gateway-admin-ui/admin-ui/app/gateway-version/gateway-version.component.ts index 602e889e6e..4f315a488d 100644 --- a/gateway-admin-ui/admin-ui/app/gateway-version.component.ts +++ b/gateway-admin-ui/admin-ui/app/gateway-version/gateway-version.component.ts @@ -15,17 +15,39 @@ * limitations under the License. */ import {Component, OnInit} from '@angular/core'; -import {GatewayVersion} from './gateway-version'; -import {GatewayVersionService} from './gateway-version.service'; +import {GatewayVersion} from '../model/gateway-version'; +import {GatewayVersionService} from '../service/gateway-version.service'; + @Component({ selector: 'app-gateway-version', template: ` -
- Version {{this.gatewayVersion.version}} - Hash {{this.gatewayVersion.hash}} -
`, - providers: [GatewayVersionService] + @if (gatewayVersion) { + Version {{gatewayVersion.version}} + | + Hash {{gatewayVersion.hash}} + } + `, + styles: [` + :host { + display: inline; + } + + .version-item { + font-size: 12px; + color: #888; + } + + .version-item strong { + color: #555; + margin-right: 3px; + } + + .version-divider { + margin: 0 8px; + color: #ccc; + } + `] }) export class GatewayVersionComponent implements OnInit { @@ -42,4 +64,3 @@ export class GatewayVersionComponent implements OnInit { this.getVersion(); } } - diff --git a/gateway-admin-ui/admin-ui/app/index.ts b/gateway-admin-ui/admin-ui/app/index.ts deleted file mode 100644 index d7b550ca9e..0000000000 --- a/gateway-admin-ui/admin-ui/app/index.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export * from './app.component'; -export * from './app.module'; diff --git a/gateway-admin-ui/admin-ui/app/main.ts b/gateway-admin-ui/admin-ui/app/main.ts deleted file mode 100644 index 03ea8874ff..0000000000 --- a/gateway-admin-ui/admin-ui/app/main.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; - -import {AppModule} from './app.module'; - -platformBrowserDynamic().bootstrapModule(AppModule); diff --git a/gateway-admin-ui/admin-ui/app/resource-detail/descriptor.ts b/gateway-admin-ui/admin-ui/app/model/descriptor.ts similarity index 98% rename from gateway-admin-ui/admin-ui/app/resource-detail/descriptor.ts rename to gateway-admin-ui/admin-ui/app/model/descriptor.ts index 85d90ae022..e9ee90cadb 100644 --- a/gateway-admin-ui/admin-ui/app/resource-detail/descriptor.ts +++ b/gateway-admin-ui/admin-ui/app/model/descriptor.ts @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {Service} from '../resource/service'; +import {Service} from './service'; export class Descriptor { discoveryType: string; diff --git a/gateway-admin-ui/admin-ui/app/gateway-version.ts b/gateway-admin-ui/admin-ui/app/model/gateway-version.ts similarity index 100% rename from gateway-admin-ui/admin-ui/app/gateway-version.ts rename to gateway-admin-ui/admin-ui/app/model/gateway-version.ts diff --git a/gateway-admin-ui/admin-ui/app/resource-detail/provider-config.ts b/gateway-admin-ui/admin-ui/app/model/provider-config.ts similarity index 100% rename from gateway-admin-ui/admin-ui/app/resource-detail/provider-config.ts rename to gateway-admin-ui/admin-ui/app/model/provider-config.ts diff --git a/gateway-admin-ui/admin-ui/app/resource/resource.ts b/gateway-admin-ui/admin-ui/app/model/resource.ts similarity index 95% rename from gateway-admin-ui/admin-ui/app/resource/resource.ts rename to gateway-admin-ui/admin-ui/app/model/resource.ts index 1cdc2e8ba0..b8774ce198 100644 --- a/gateway-admin-ui/admin-ui/app/resource/resource.ts +++ b/gateway-admin-ui/admin-ui/app/model/resource.ts @@ -18,8 +18,6 @@ export class Resource { timestamp: number; name: string; - uri: string; href: string; - content: string; service: string; } diff --git a/gateway-admin-ui/admin-ui/app/resource/service.ts b/gateway-admin-ui/admin-ui/app/model/service.ts similarity index 100% rename from gateway-admin-ui/admin-ui/app/resource/service.ts rename to gateway-admin-ui/admin-ui/app/model/service.ts diff --git a/gateway-admin-ui/admin-ui/app/service-definition/servicedefinition.ts b/gateway-admin-ui/admin-ui/app/model/servicedefinition.ts similarity index 89% rename from gateway-admin-ui/admin-ui/app/service-definition/servicedefinition.ts rename to gateway-admin-ui/admin-ui/app/model/servicedefinition.ts index 8a71e6a49c..456914855a 100644 --- a/gateway-admin-ui/admin-ui/app/service-definition/servicedefinition.ts +++ b/gateway-admin-ui/admin-ui/app/model/servicedefinition.ts @@ -14,11 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {RewriteRules} from './rewrite.rules'; -import {Service} from './service'; - export class ServiceDefinition { - name: string; service: string; role: string; version: string; diff --git a/gateway-admin-ui/admin-ui/app/sessionInformation/session.information.ts b/gateway-admin-ui/admin-ui/app/model/session-information.ts similarity index 91% rename from gateway-admin-ui/admin-ui/app/sessionInformation/session.information.ts rename to gateway-admin-ui/admin-ui/app/model/session-information.ts index 8bdefe3d75..98a8dbcfbc 100644 --- a/gateway-admin-ui/admin-ui/app/sessionInformation/session.information.ts +++ b/gateway-admin-ui/admin-ui/app/model/session-information.ts @@ -17,8 +17,5 @@ export class SessionInformation { user: string; - logoutUrl: string; - logoutPageUrl: string; - globalLgoutPageUrl: string; bannerText: string; } diff --git a/gateway-admin-ui/admin-ui/app/topology.ts b/gateway-admin-ui/admin-ui/app/model/topology.ts similarity index 100% rename from gateway-admin-ui/admin-ui/app/topology.ts rename to gateway-admin-ui/admin-ui/app/model/topology.ts diff --git a/gateway-admin-ui/admin-ui/app/new-desc-wizard/new-desc-wizard.component.css b/gateway-admin-ui/admin-ui/app/new-desc-wizard/new-desc-wizard.component.css index 0cc494ab8c..1bd97a818f 100644 --- a/gateway-admin-ui/admin-ui/app/new-desc-wizard/new-desc-wizard.component.css +++ b/gateway-admin-ui/admin-ui/app/new-desc-wizard/new-desc-wizard.component.css @@ -2,4 +2,27 @@ td { border-collapse: collapse; padding: 8px; vertical-align: top; +} + +.services-table { + table-layout: fixed; + width: 100%; +} + +.service-checkbox { + display: flex; + align-items: baseline; + gap: 6px; + margin: 4px 0; + cursor: pointer; + font-weight: normal; +} + +.service-checkbox input[type="checkbox"] { + flex-shrink: 0; +} + +.service-checkbox span { + overflow: hidden; + text-overflow: ellipsis; } \ No newline at end of file diff --git a/gateway-admin-ui/admin-ui/app/new-desc-wizard/new-desc-wizard.component.html b/gateway-admin-ui/admin-ui/app/new-desc-wizard/new-desc-wizard.component.html index 1c9a9770af..4872dcf6e3 100644 --- a/gateway-admin-ui/admin-ui/app/new-desc-wizard/new-desc-wizard.component.html +++ b/gateway-admin-ui/admin-ui/app/new-desc-wizard/new-desc-wizard.component.html @@ -1,149 +1,157 @@ - - + + + + diff --git a/gateway-admin-ui/admin-ui/app/new-desc-wizard/new-desc-wizard.component.spec.ts b/gateway-admin-ui/admin-ui/app/new-desc-wizard/new-desc-wizard.component.spec.ts deleted file mode 100644 index 5222c23a7e..0000000000 --- a/gateway-admin-ui/admin-ui/app/new-desc-wizard/new-desc-wizard.component.spec.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import {async, ComponentFixture, TestBed} from '@angular/core/testing'; - -import {NewDescWizardComponent} from './new-desc-wizard.component'; - -describe('NewDescWizardComponent', () => { - let component: NewDescWizardComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [NewDescWizardComponent] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(NewDescWizardComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/gateway-admin-ui/admin-ui/app/new-desc-wizard/new-desc-wizard.component.ts b/gateway-admin-ui/admin-ui/app/new-desc-wizard/new-desc-wizard.component.ts index 4794b26a37..022122ea14 100644 --- a/gateway-admin-ui/admin-ui/app/new-desc-wizard/new-desc-wizard.component.ts +++ b/gateway-admin-ui/admin-ui/app/new-desc-wizard/new-desc-wizard.component.ts @@ -15,20 +15,22 @@ * limitations under the License. */ import {Component, OnInit, ViewChild} from '@angular/core'; -import {BsModalComponent} from 'ng2-bs3-modal'; +import {FormsModule} from '@angular/forms'; import {ProviderConfigSelectorComponent} from '../provider-config-selector/provider-config-selector.component'; -import {Descriptor} from '../resource-detail/descriptor'; -import {ResourceService} from '../resource/resource.service'; -import {Resource} from '../resource/resource'; -import {ResourceTypesService} from '../resourcetypes/resourcetypes.service'; +import {Descriptor} from '../model/descriptor'; +import {ResourceService} from '../service/resource.service'; +import {Resource} from '../model/resource'; +import {ResourceTypesService} from '../service/resourcetypes.service'; import {ValidationUtils} from '../utils/validation-utils'; -import {HttpErrorResponse} from '@angular/common/http'; +import {ModalComponent} from '../utils/modal.component'; +import { HttpErrorResponse } from '@angular/common/http'; @Component({ selector: 'app-new-desc-wizard', templateUrl: './new-desc-wizard.component.html', - styleUrls: ['./new-desc-wizard.component.css'] + styleUrls: ['./new-desc-wizard.component.css'], + imports: [FormsModule, ProviderConfigSelectorComponent, ModalComponent] }) export class NewDescWizardComponent implements OnInit { @@ -80,7 +82,7 @@ export class NewDescWizardComponent implements OnInit { 'ZEPPELINWS']; @ViewChild('newDescriptorModal') - childModal: BsModalComponent; + childModal: ModalComponent; @ViewChild('choosePC') chooseProviderConfigModal: ProviderConfigSelectorComponent; @@ -102,9 +104,9 @@ export class NewDescWizardComponent implements OnInit { this.descriptor = new Descriptor(); } - open(size?: string) { + open() { this.reset(); - this.childModal.open(size ? size : 'lg'); + this.childModal.open('lg'); } reset() { @@ -157,7 +159,7 @@ export class NewDescWizardComponent implements OnInit { } } }); - this.childModal.close(); // close the dialog if there was no error + this.childModal.dismiss(); }).catch((err: HttpErrorResponse) => { this.existingReadOnlyTopology = (err.status === 409); console.error('Error creating ' + this.descriptorName + ' : ' + err.message); diff --git a/gateway-admin-ui/admin-ui/app/provider-config-selector/provider-config-selector.component.html b/gateway-admin-ui/admin-ui/app/provider-config-selector/provider-config-selector.component.html index 71dd9fea30..2179ac8613 100644 --- a/gateway-admin-ui/admin-ui/app/provider-config-selector/provider-config-selector.component.html +++ b/gateway-admin-ui/admin-ui/app/provider-config-selector/provider-config-selector.component.html @@ -1,28 +1,25 @@ - - + + + + diff --git a/gateway-admin-ui/admin-ui/app/provider-config-selector/provider-config-selector.component.spec.ts b/gateway-admin-ui/admin-ui/app/provider-config-selector/provider-config-selector.component.spec.ts deleted file mode 100644 index 1ea1a46485..0000000000 --- a/gateway-admin-ui/admin-ui/app/provider-config-selector/provider-config-selector.component.spec.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import {async, ComponentFixture, TestBed} from '@angular/core/testing'; - -import {ProviderConfigSelectorComponent} from './provider-config-selector.component'; - -describe('ProviderConfigSelectorComponent', () => { - let component: ProviderConfigSelectorComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ProviderConfigSelectorComponent] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ProviderConfigSelectorComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/gateway-admin-ui/admin-ui/app/provider-config-selector/provider-config-selector.component.ts b/gateway-admin-ui/admin-ui/app/provider-config-selector/provider-config-selector.component.ts index ab5a3f0165..67894f3824 100644 --- a/gateway-admin-ui/admin-ui/app/provider-config-selector/provider-config-selector.component.ts +++ b/gateway-admin-ui/admin-ui/app/provider-config-selector/provider-config-selector.component.ts @@ -14,23 +14,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {Component, OnInit, ViewChild} from '@angular/core'; -import {ResourceService} from '../resource/resource.service'; -import {Resource} from '../resource/resource'; -import {BsModalComponent} from 'ng2-bs3-modal'; -import {Descriptor} from '../resource-detail/descriptor'; -import {HttpErrorResponse} from '@angular/common/http'; +import {Component, ViewChild} from '@angular/core'; +import {FormsModule} from '@angular/forms'; +import {ResourceService} from '../service/resource.service'; +import {Resource} from '../model/resource'; +import {Descriptor} from '../model/descriptor'; +import {ModalComponent} from '../utils/modal.component'; +import { HttpErrorResponse } from '@angular/common/http'; @Component({ selector: 'app-provider-config-selector', templateUrl: './provider-config-selector.component.html', - styleUrls: ['./provider-config-selector.component.css'] + styleUrls: ['./provider-config-selector.component.css'], + imports: [FormsModule, ModalComponent] }) export class ProviderConfigSelectorComponent { @ViewChild('chooseProviderConfigModal') - private childModal: BsModalComponent; + private childModal: ModalComponent; private providerConfigs: Resource[]; @@ -42,16 +44,15 @@ export class ProviderConfigSelectorComponent { constructor(private resourceService: ResourceService) { } - open(desc: Descriptor, size?: string) { + open(desc: Descriptor) { this.descriptor = desc; - this.selectedName = desc.providerConfig; // Set the default selection based on the current ref in the descriptor + this.selectedName = desc.providerConfig; - // Load the available provider configs every time this modal is open this.resourceService.getResources('Provider Configurations') .then(result => this.providerConfigs = result) .catch((err: HttpErrorResponse) => console.debug('Error access provider configurations: ' + err)); - this.childModal.open(size); + this.childModal.open('sm'); } onClose() { diff --git a/gateway-admin-ui/admin-ui/app/provider-config-wizard/AnonymousProviderConfig.ts b/gateway-admin-ui/admin-ui/app/provider-config-wizard/AnonymousProviderConfig.ts index b34ec60e58..c0cc1a2428 100644 --- a/gateway-admin-ui/admin-ui/app/provider-config-wizard/AnonymousProviderConfig.ts +++ b/gateway-admin-ui/admin-ui/app/provider-config-wizard/AnonymousProviderConfig.ts @@ -30,7 +30,7 @@ export class AnonymousProviderConfig extends AuthenticationProviderConfig { return this.displayBindingPropertyNames; } - getDisplayNamePropertyBinding(name: string): string { + getDisplayNamePropertyBinding(_name: string): string { return null; } diff --git a/gateway-admin-ui/admin-ui/app/provider-config-wizard/authentication-wizard.ts b/gateway-admin-ui/admin-ui/app/provider-config-wizard/authentication-wizard.ts index 3b1ee4da57..1ccf0f8d25 100644 --- a/gateway-admin-ui/admin-ui/app/provider-config-wizard/authentication-wizard.ts +++ b/gateway-admin-ui/admin-ui/app/provider-config-wizard/authentication-wizard.ts @@ -82,8 +82,7 @@ export class AuthenticationWizard extends CategoryWizard { onChange() { let configType = AuthenticationWizard.typeConfigMap.get(this.selectedType); if (configType) { - this.providerConfig = Object.create(configType.prototype) as AuthenticationProviderConfig; - this.providerConfig = this.providerConfig.constructor.apply(this.providerConfig); + this.providerConfig = new (configType as any)(); (this.providerConfig as AuthenticationProviderConfig).setType(this.selectedType); } else { console.debug('AuthenticationWizard --> No provider configuration type mapped for ' + this.selectedType); diff --git a/gateway-admin-ui/admin-ui/app/provider-config-wizard/authorization-wizard.ts b/gateway-admin-ui/admin-ui/app/provider-config-wizard/authorization-wizard.ts index 5d64810d33..845d4f888c 100644 --- a/gateway-admin-ui/admin-ui/app/provider-config-wizard/authorization-wizard.ts +++ b/gateway-admin-ui/admin-ui/app/provider-config-wizard/authorization-wizard.ts @@ -42,8 +42,7 @@ export class AuthorizationWizard extends CategoryWizard { onChange() { let configType = AuthorizationWizard.typeConfigMap.get(this.selectedType); if (configType) { - this.providerConfig = Object.create(configType.prototype) as DisplayBindingProviderConfig; - this.providerConfig = this.providerConfig.constructor.apply(this.providerConfig); + this.providerConfig = new (configType as any)(); (this.providerConfig as DisplayBindingProviderConfig).setType(this.selectedType); } else { console.debug('AuthorizationWizard --> No provider configuration type mapped for ' + this.selectedType); diff --git a/gateway-admin-ui/admin-ui/app/provider-config-wizard/category-wizard.ts b/gateway-admin-ui/admin-ui/app/provider-config-wizard/category-wizard.ts index a28e15fefd..17c514289a 100644 --- a/gateway-admin-ui/admin-ui/app/provider-config-wizard/category-wizard.ts +++ b/gateway-admin-ui/admin-ui/app/provider-config-wizard/category-wizard.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import {ProviderConfig} from '../resource-detail/provider-config'; +import {ProviderConfig} from '../model/provider-config'; export abstract class CategoryWizard { diff --git a/gateway-admin-ui/admin-ui/app/provider-config-wizard/csrf-provider-config.ts b/gateway-admin-ui/admin-ui/app/provider-config-wizard/csrf-provider-config.ts index 10044e2167..a3e56d29a4 100644 --- a/gateway-admin-ui/admin-ui/app/provider-config-wizard/csrf-provider-config.ts +++ b/gateway-admin-ui/admin-ui/app/provider-config-wizard/csrf-provider-config.ts @@ -57,12 +57,13 @@ export class CSRFProviderConfig extends WebAppSecurityContributor { case CSRFProviderConfig.CUSTOM_HEADER: isValid = ValidationUtils.isValidString(value); break; - case CSRFProviderConfig.METHODS_TO_IGNORE: + case CSRFProviderConfig.METHODS_TO_IGNORE: { let methodList: string[] = value.split(','); for (let method of methodList) { isValid = isValid && ValidationUtils.isValidHTTPMethod(method.trim().toUpperCase()); } break; + } default: } } diff --git a/gateway-admin-ui/admin-ui/app/provider-config-wizard/display-binding-provider-config.ts b/gateway-admin-ui/admin-ui/app/provider-config-wizard/display-binding-provider-config.ts index 7d864cf275..4d89ae47ff 100644 --- a/gateway-admin-ui/admin-ui/app/provider-config-wizard/display-binding-provider-config.ts +++ b/gateway-admin-ui/admin-ui/app/provider-config-wizard/display-binding-provider-config.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import {ProviderConfig} from '../resource-detail/provider-config'; +import {ProviderConfig} from '../model/provider-config'; export abstract class DisplayBindingProviderConfig extends ProviderConfig { @@ -59,11 +59,11 @@ export abstract class DisplayBindingProviderConfig extends ProviderConfig { return this.params[name]; } - isPasswordParam(name: string): boolean { + isPasswordParam(_name: string): boolean { return false; } - isValidParamValue(paramName: string) { + isValidParamValue(_paramName: string) { return true; } diff --git a/gateway-admin-ui/admin-ui/app/provider-config-wizard/ha-wizard.ts b/gateway-admin-ui/admin-ui/app/provider-config-wizard/ha-wizard.ts index 84f489b2f3..7078cea8a2 100644 --- a/gateway-admin-ui/admin-ui/app/provider-config-wizard/ha-wizard.ts +++ b/gateway-admin-ui/admin-ui/app/provider-config-wizard/ha-wizard.ts @@ -16,7 +16,7 @@ */ import {CategoryWizard} from './category-wizard'; -import {ProviderConfig} from '../resource-detail/provider-config'; +import {ProviderConfig} from '../model/provider-config'; import {ProviderContributorWizard} from './provider-contributor-wizard'; import {HaProviderConfig} from './ha-provider-config'; import {DisplayBindingProviderConfig} from './display-binding-provider-config'; diff --git a/gateway-admin-ui/admin-ui/app/provider-config-wizard/hostmap-provider-wizard.ts b/gateway-admin-ui/admin-ui/app/provider-config-wizard/hostmap-provider-wizard.ts index 8fedb3e986..1ab1cee131 100644 --- a/gateway-admin-ui/admin-ui/app/provider-config-wizard/hostmap-provider-wizard.ts +++ b/gateway-admin-ui/admin-ui/app/provider-config-wizard/hostmap-provider-wizard.ts @@ -15,7 +15,7 @@ * limitations under the License. */ import {CategoryWizard} from './category-wizard'; -import {ProviderConfig} from '../resource-detail/provider-config'; +import {ProviderConfig} from '../model/provider-config'; export class HostMapProviderWizard extends CategoryWizard { private stepCount = 2; diff --git a/gateway-admin-ui/admin-ui/app/provider-config-wizard/identity-assertion-wizard.ts b/gateway-admin-ui/admin-ui/app/provider-config-wizard/identity-assertion-wizard.ts index 126c8a9552..8c9e4007f3 100644 --- a/gateway-admin-ui/admin-ui/app/provider-config-wizard/identity-assertion-wizard.ts +++ b/gateway-admin-ui/admin-ui/app/provider-config-wizard/identity-assertion-wizard.ts @@ -16,7 +16,7 @@ */ import {CategoryWizard} from './category-wizard'; -import {ProviderConfig} from '../resource-detail/provider-config'; +import {ProviderConfig} from '../model/provider-config'; import {IdentityAssertionProviderConfig} from './identity-assertion-provider-config'; import {DefaultIdAssertionProviderConfig} from './default-idassertion-provider-config'; import {ConcatAssertionProviderConfig} from './concat-idassertion-provider-config'; @@ -59,8 +59,7 @@ export class IdentityAssertionWizard extends CategoryWizard { onChange() { let configType = IdentityAssertionWizard.typeConfigMap.get(this.selectedType); if (configType) { - this.providerConfig = Object.create(configType.prototype) as IdentityAssertionProviderConfig; - this.providerConfig = this.providerConfig.constructor.apply(this.providerConfig); + this.providerConfig = new (configType as any)(); (this.providerConfig as IdentityAssertionProviderConfig).setType(this.selectedType); } else { console.debug('IdentityAssertionWizard --> No provider configuration type mapped for ' + this.selectedType); diff --git a/gateway-admin-ui/admin-ui/app/provider-config-wizard/provider-config-wizard.component.html b/gateway-admin-ui/admin-ui/app/provider-config-wizard/provider-config-wizard.component.html index 46cd5dc21e..3c93852e0e 100644 --- a/gateway-admin-ui/admin-ui/app/provider-config-wizard/provider-config-wizard.component.html +++ b/gateway-admin-ui/admin-ui/app/provider-config-wizard/provider-config-wizard.component.html @@ -1,133 +1,150 @@ - - + + + + } -
- Choose a Provider Category

-
- -
-
+ @if (isProviderCategoryStep()) { +
+ Choose a Provider Category

+ @for (pc of getProviderCategories(); track pc) { +
+ +
+ } +
+ } -
- Choose a {{ selectedCategory }} Provider Type

-
- -
-
+ @if (isProviderTypeStep()) { +
+ Choose a {{ selectedCategory }} Provider Type

+ @for (pt of getProviderTypes(); track pt) { +
+ +
+ } +
+ } -
- Specify {{ getCategoryWizard().getSelectedType() }} Provider Parameters

- - - - - -
{{pt}} - - - - - show - - invalid -
-
- + @if (isProviderParamsStep()) { +
+ Specify {{ getCategoryWizard().getSelectedType() }} Provider Parameters

+ + @for (pt of getProviderParams(); track pt) { + + + + + } +
{{pt}} + + + + @if (isPasswordParam(pt)) { + + show + + } + @if (!isValidParamValue(pt)) { + Invalid value + } +
+
+ } - - +
+ + diff --git a/gateway-admin-ui/admin-ui/app/provider-config-wizard/provider-config-wizard.component.spec.ts b/gateway-admin-ui/admin-ui/app/provider-config-wizard/provider-config-wizard.component.spec.ts deleted file mode 100644 index 2897ef0f62..0000000000 --- a/gateway-admin-ui/admin-ui/app/provider-config-wizard/provider-config-wizard.component.spec.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import {async, ComponentFixture, TestBed} from '@angular/core/testing'; - -import {ProviderConfigWizardComponent} from './provider-config-wizard.component'; - -describe('ProviderConfigWizardComponent', () => { - let component: ProviderConfigWizardComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ProviderConfigWizardComponent] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ProviderConfigWizardComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/gateway-admin-ui/admin-ui/app/provider-config-wizard/provider-config-wizard.component.ts b/gateway-admin-ui/admin-ui/app/provider-config-wizard/provider-config-wizard.component.ts index a4b03a7e80..4ed21c631a 100644 --- a/gateway-admin-ui/admin-ui/app/provider-config-wizard/provider-config-wizard.component.ts +++ b/gateway-admin-ui/admin-ui/app/provider-config-wizard/provider-config-wizard.component.ts @@ -16,28 +16,30 @@ */ import {Component, OnInit, ViewChild} from '@angular/core'; -import {ResourceTypesService} from '../resourcetypes/resourcetypes.service'; -import {ResourceService} from '../resource/resource.service'; -import {BsModalComponent} from 'ng2-bs3-modal'; -import {ProviderConfig} from '../resource-detail/provider-config'; +import {FormsModule} from '@angular/forms'; +import {ResourceTypesService} from '../service/resourcetypes.service'; +import {ResourceService} from '../service/resource.service'; +import {ProviderConfig} from '../model/provider-config'; import {AuthenticationWizard} from './authentication-wizard'; import {CategoryWizard} from './category-wizard'; import {AuthorizationWizard} from './authorization-wizard'; import {IdentityAssertionWizard} from './identity-assertion-wizard'; import {HaWizard} from './ha-wizard'; -import {Resource} from '../resource/resource'; +import {Resource} from '../model/resource'; import {DisplayBindingProviderConfig} from './display-binding-provider-config'; import {OrderedParamContainer} from './ordered-param-container'; import {HostMapProviderWizard} from './hostmap-provider-wizard'; import {ProviderContributorWizard} from './provider-contributor-wizard'; import {WebAppSecurityWizard} from './webappsec-wizard'; import {ValidationUtils} from '../utils/validation-utils'; -import {HttpErrorResponse} from '@angular/common/http'; +import {ModalComponent} from '../utils/modal.component'; +import { HttpErrorResponse } from '@angular/common/http'; @Component({ selector: 'app-provider-config-wizard', templateUrl: './provider-config-wizard.component.html', - styleUrls: ['./provider-config-wizard.component.css'] + styleUrls: ['./provider-config-wizard.component.css'], + imports: [FormsModule, ModalComponent] }) export class ProviderConfigWizardComponent implements OnInit { private static CATEGORY_STEP = 1; @@ -70,7 +72,7 @@ export class ProviderConfigWizardComponent implements OnInit { ]); @ViewChild('newProviderConfigModal') - childModal: BsModalComponent; + childModal: ModalComponent; private step = 0; @@ -105,9 +107,9 @@ export class ProviderConfigWizardComponent implements OnInit { this.selectedCategory = ProviderConfigWizardComponent.CATEGORY_AUTHENTICATION; // Default to authentication } - open(size?: string) { + open() { this.reset(); - this.childModal.open(size ? size : 'lg'); + this.childModal.open('lg'); } reset() { @@ -226,7 +228,7 @@ export class ProviderConfigWizardComponent implements OnInit { } } }); - this.childModal.close(); // close the dialog if there was no error + this.childModal.dismiss(); }).catch((err: HttpErrorResponse) => { this.existingReadOnlyProvider = (err.status === 409); console.error('Error creating ' + newResource + ' : ' + err.message); diff --git a/gateway-admin-ui/admin-ui/app/provider-config-wizard/provider-contributor-wizard.ts b/gateway-admin-ui/admin-ui/app/provider-config-wizard/provider-contributor-wizard.ts index 59062bd8b6..ae32cbda7d 100644 --- a/gateway-admin-ui/admin-ui/app/provider-config-wizard/provider-contributor-wizard.ts +++ b/gateway-admin-ui/admin-ui/app/provider-config-wizard/provider-contributor-wizard.ts @@ -16,7 +16,7 @@ */ -import {ProviderConfig} from '../resource-detail/provider-config'; +import {ProviderConfig} from '../model/provider-config'; export interface ProviderContributorWizard { diff --git a/gateway-admin-ui/admin-ui/app/provider-config-wizard/webappsec-provider-config.ts b/gateway-admin-ui/admin-ui/app/provider-config-wizard/webappsec-provider-config.ts index 1825034d41..cb78133d45 100644 --- a/gateway-admin-ui/admin-ui/app/provider-config-wizard/webappsec-provider-config.ts +++ b/gateway-admin-ui/admin-ui/app/provider-config-wizard/webappsec-provider-config.ts @@ -33,7 +33,7 @@ export class WebAppSecurityProviderConfig extends DisplayBindingProviderConfig { return []; } - getDisplayNamePropertyBinding(name: string): string { + getDisplayNamePropertyBinding(_name: string): string { return null; } } diff --git a/gateway-admin-ui/admin-ui/app/provider-config-wizard/webappsec-wizard.ts b/gateway-admin-ui/admin-ui/app/provider-config-wizard/webappsec-wizard.ts index 1f097ce57a..f712ec6652 100644 --- a/gateway-admin-ui/admin-ui/app/provider-config-wizard/webappsec-wizard.ts +++ b/gateway-admin-ui/admin-ui/app/provider-config-wizard/webappsec-wizard.ts @@ -16,7 +16,7 @@ */ import {CategoryWizard} from './category-wizard'; -import {ProviderConfig} from '../resource-detail/provider-config'; +import {ProviderConfig} from '../model/provider-config'; import {ProviderContributorWizard} from './provider-contributor-wizard'; import {DisplayBindingProviderConfig} from './display-binding-provider-config'; import {WebAppSecurityProviderConfig} from './webappsec-provider-config'; @@ -68,8 +68,7 @@ export class WebAppSecurityWizard extends CategoryWizard implements ProviderCont onChange() { let configType = WebAppSecurityWizard.typeConfigMap.get(this.selectedType); if (configType) { - this.providerConfig = Object.create(configType.prototype) as WebAppSecurityContributor; - this.providerConfig = this.providerConfig.constructor.apply(this.providerConfig); + this.providerConfig = new (configType as any)(); (this.providerConfig as WebAppSecurityContributor).setType(this.selectedType); } else { console.debug('WebAppSecurityWizard --> No provider configuration type mapped for ' + this.selectedType); diff --git a/gateway-admin-ui/admin-ui/app/resource-detail/resource-detail.component.css b/gateway-admin-ui/admin-ui/app/resource-detail/resource-detail.component.css index c1343e95c9..c9380855fe 100644 --- a/gateway-admin-ui/admin-ui/app/resource-detail/resource-detail.component.css +++ b/gateway-admin-ui/admin-ui/app/resource-detail/resource-detail.component.css @@ -16,10 +16,12 @@ } .inline-editable:hover:after { - font-family: 'Glyphicons Halflings'; - content: "\270f"; + font-family: 'Material Icons'; + content: "\e254"; + font-size: 14px; position: relative; - left: 10px; + left: 6px; + color: #4caf50; } .inline-editable.editable-empty, @@ -42,7 +44,6 @@ .inline-editor.select { width: auto; display: inline; - border-radius: 5px; } .inline-editor.inline-editor-button-group { @@ -63,5 +64,8 @@ } .inline-glyph { - vertical-align: 2%; + display: inline-block; + vertical-align: middle; + line-height: 1; } + diff --git a/gateway-admin-ui/admin-ui/app/resource-detail/resource-detail.component.html b/gateway-admin-ui/admin-ui/app/resource-detail/resource-detail.component.html index 9b1455e3c0..35cf22c0df 100644 --- a/gateway-admin-ui/admin-ui/app/resource-detail/resource-detail.component.html +++ b/gateway-admin-ui/admin-ui/app/resource-detail/resource-detail.component.html @@ -1,363 +1,418 @@ -
+@if (resourceType && resourceType !== 'Topologies' && resourceType !== 'Service Definitions') { +

{{ getTitleSubject() }} Detail - Read Only (generated file) - {{resourceService.getResourceDisplayName(resource)}} + @if (showEditOptions() === false) { + Read Only (generated file) + } + @if (hasSelectedResource()) { + {{resourceService.getResourceDisplayName(resource)}} + }

-
- + @if (hasSelectedResource() && resourceType === 'Provider Configurations') { +
+ @if (referencedProviderConfigError) { + + }
Providers - - - - - - - -
-
-
-   - - {{ provider.role }} - -
-
- Name {{ provider.name }}
- Enabled 
-
- - Params - - - - - - - -
- - - - - - -
- - {{ paramName }} - {{provider.params[paramName]}} - - + @if (!isAddingProvider) { + add_circle + } + @if (isAddingProvider) { + + + - - -
-
+ + } +
+ @for (provider of providers; track provider.name) { +
+
+   + {{isShowProvider(provider) ? 'expand_more' : 'chevron_right'}} + {{ provider.role }} + cancel
-
-
+ @if (isShowProvider(provider)) { +
+ Name {{ provider.name }}
+ Enabled 
+
+ {{isShowProviderParams(provider) ? 'expand_more' : 'chevron_right'}} + Params + @if (!isAddingProviderParam(provider)) { + add_circle + } + @if (isAddingProviderParam(provider)) { + + + + + + + } + @if (isShowProviderParams(provider)) { +
+ + @for (paramName of getProviderParamNames(provider); track paramName) { + + + + + + } +
+ cancel + {{ paramName }} + @if (!getProviderParamEditFlag(provider, paramName)) { + {{provider.params[paramName]}} + } + @if (getProviderParamEditFlag(provider, paramName)) { + + + + + + } +
+
+ } +
+
+ } +
+ } -
- - - -   - - +
+ @if (showEditOptions()) { + + + +   + + + }
+ } -
+ @if (hasSelectedResource() && resourceType === 'Descriptors') { +
Provider Configuration  - {{descriptor.providerConfig}} - - - - - + @if (!editModePC) { + {{descriptor.providerConfig}} + } + @if (editModePC) { + + + + + + }   - + + edit +
-

+
- + {{isShowServices() ? 'expand_more' : 'chevron_right'}} Services - - - - - - -
-
- - - - + + } + + @if (isShowServices()) { +
+
-
- {{ service.name }} - ({{service.version}} - ) - - - - - - - -
-
- - Params  - - - - - - - -
-
- - - - - - -
- - {{ paramKey }} - {{descriptor.getServiceParamValue(service, paramKey)}} - - - - - -
-
-
- - URLs  - - - - - - -
-
- - - - - -
- - - {{url}} - - + @if (!isAddingService) { + add_circle + } + @if (isAddingService) { + + - - -
-
-
+ @for (service of descriptor.services; track service.name) { + + + + }
+
+ @if (!getServiceVersionEditFlag(service) && !service.version) { + {{ service.name }} + } @else { + {{ service.name }} + } + @if (!getServiceVersionEditFlag(service) && service.version) { + ({{service.version}}) + } + @if (getServiceVersionEditFlag(service)) { + + + + + + } + + cancel +
+
+ {{isShowServiceParams(service) ? 'expand_more' : 'chevron_right'}} + Params  + @if (!isAddingServiceParam(service)) { + add_circle + } + @if (isAddingServiceParam(service)) { + + + + + + + } +
+ @if (isShowServiceParams(service)) { +
+ @if (descriptor.getServiceParamNames(service).length > 0) { + + @for (paramKey of descriptor.getServiceParamNames(service); track paramKey) { + + + + + + } +
+ cancel + {{ paramKey }} + @if (!getServiceParamEditFlag(service, paramKey)) { + {{descriptor.getServiceParamValue(service, paramKey)}} + } + @if (getServiceParamEditFlag(service, paramKey)) { + + + + + + } +
+ } +
+ } +
+ {{isShowServiceURLs(service) ? 'expand_more' : 'chevron_right'}} + URLs  + @if (!isAddingServiceURL(service)) { + add_circle + } + @if (isAddingServiceURL(service)) { + + + + + + } +
+ @if (isShowServiceURLs(service)) { +
+ @if (service.urls && service.urls.length > 0) { + + @for (url of service.urls; track trackByServiceURLIndex($index, url); let i = $index) { + + + + + } +
+ cancel + + @if (!getServiceURLEditFlag(service, i)) { + {{url}} + } + @if (getServiceURLEditFlag(service, i)) { + + + + + + } +
+ } +
+ } +
+ }
- + {{isShowServiceDiscovery() ? 'expand_more' : 'chevron_right'}} Discovery Details
-
+ @if (isShowServiceDiscovery()) { +
@@ -370,10 +425,11 @@

@@ -385,21 +441,26 @@

(click)="editModeAddress=true"> Address -    + @if (!editModeAddress && !descriptor.discoveryAddress) { +    + }

@@ -409,21 +470,26 @@

(click)="editModeCluster=true"> Cluster -    + @if (!editModeCluster && !descriptor.discoveryCluster) { +    + }

@@ -433,21 +499,26 @@

(click)="editModeUser=true"> Username -    + @if (!editModeUser && !descriptor.discoveryUser) { +    + }

@@ -457,109 +528,112 @@

(click)="editModeAlias=true"> Password Alias -    + @if (!editModeAlias && !descriptor.discoveryPassAlias) { +    + }

- {{ descriptor.discoveryAddress }} - - - - - + @if (!editModeAddress) { + {{ descriptor.discoveryAddress }} + } + @if (editModeAddress) { + + + + + + }
- {{ descriptor.discoveryCluster}} - - - - - + @if (!editModeCluster) { + {{ descriptor.discoveryCluster}} + } + @if (editModeCluster) { + + + + + + }
- {{ descriptor.discoveryUser }} - - - - - + @if (!editModeUser) { + {{ descriptor.discoveryUser }} + } + @if (editModeUser) { + + + + + + }
- {{ descriptor.discoveryPassAlias }} - - - - - + @if (!editModeAlias) { + {{ descriptor.discoveryPassAlias }} + } + @if (editModeAlias) { + + + + + + }
+ }
-
- - - -   - - +
+ @if (showEditOptions()) { + + + +   + + + }
+ } -
- - +
+ + + + + - - + + + + +
+} -
+@if (resourceType === 'Topologies') { +
+} -
+@if (resourceType === 'Service Definitions') { +
-
\ No newline at end of file +
+} diff --git a/gateway-admin-ui/admin-ui/app/resource-detail/resource-detail.component.spec.ts b/gateway-admin-ui/admin-ui/app/resource-detail/resource-detail.component.spec.ts deleted file mode 100644 index a081aee9a6..0000000000 --- a/gateway-admin-ui/admin-ui/app/resource-detail/resource-detail.component.spec.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import {async, ComponentFixture, TestBed} from '@angular/core/testing'; - -import {ResourceDetailComponent} from './resource-detail.component'; - -describe('ResourceDetailComponent', () => { - let component: ResourceDetailComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ResourceDetailComponent] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ResourceDetailComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/gateway-admin-ui/admin-ui/app/resource-detail/resource-detail.component.ts b/gateway-admin-ui/admin-ui/app/resource-detail/resource-detail.component.ts index bc110064e4..93b09fbdd9 100644 --- a/gateway-admin-ui/admin-ui/app/resource-detail/resource-detail.component.ts +++ b/gateway-admin-ui/admin-ui/app/resource-detail/resource-detail.component.ts @@ -15,25 +15,27 @@ * limitations under the License. */ import {Component, OnInit, ViewChild} from '@angular/core'; -import {ResourceService} from '../resource/resource.service'; -import {Resource} from '../resource/resource'; -import {ProviderConfig} from './provider-config'; -import {Descriptor} from './descriptor'; -import {Service} from '../resource/service'; -// Commented out in scope of KNOX-2834 (see below) -// import {parseString} from 'xml2js'; - -import 'brace/theme/monokai'; -import 'brace/mode/xml'; +import {FormsModule} from '@angular/forms'; +import {ResourceService} from '../service/resource.service'; +import {Resource} from '../model/resource'; +import {ProviderConfig} from '../model/provider-config'; +import {Descriptor} from '../model/descriptor'; +import {Service} from '../model/service'; import {ProviderConfigSelectorComponent} from '../provider-config-selector/provider-config-selector.component'; -import {ResourceTypesService} from '../resourcetypes/resourcetypes.service'; -import {HttpErrorResponse} from '@angular/common/http'; +import {ResourceTypesService} from '../service/resourcetypes.service'; +import {TopologyDetailComponent} from '../topology-detail/topology-detail.component'; +import {ServiceDefinitionDetailComponent} from '../service-definition/servicedefinition-detail.component'; +import {ModalComponent} from '../utils/modal.component'; +import { HttpErrorResponse } from '@angular/common/http'; +import * as yaml from 'js-yaml'; @Component({ selector: 'app-resource-detail', templateUrl: './resource-detail.component.html', - styleUrls: ['./resource-detail.component.css'] + styleUrls: ['./resource-detail.component.css'], + imports: [FormsModule, ProviderConfigSelectorComponent, + TopologyDetailComponent, ServiceDefinitionDetailComponent, ModalComponent] }) export class ResourceDetailComponent implements OnInit { @@ -43,8 +45,6 @@ export class ResourceDetailComponent implements OnInit { private static emptyDescriptor: Descriptor = new Descriptor(); - title: string; - resourceType: string; resource: Resource; resourceContent: string; @@ -119,48 +119,10 @@ export class ResourceDetailComponent implements OnInit { this.providers = contentObj['providers']; this.readOnlyProviderConfig = contentObj['readOnly']; } else if (res.name.endsWith('yaml') || res.name.endsWith('yml')) { - // Parse the YAML representation - let yaml = require('js-yaml'); - contentObj = yaml.safeLoad(this.resourceContent); + contentObj = yaml.load(this.resourceContent); this.providers = contentObj['providers']; this.readOnlyProviderConfig = contentObj['readOnly']; } - /* Commented out in scope of KNOX-2834, because documentation does not mention supporting - XML shared provider files and xml2js library is not compatible with angular 14. - - else if (res.name.endsWith('xml')) { - // Parse the XML representation - - parseString(this.resourceContent, - (error, result) => { - if (error) { - console.log('Error parsing ' + res.name + ' error: ' + error); - } else { - // Parsing the XML is a bit less straight-forward - let tempProviders = new Array(); - result['gateway'].provider.forEach(entry => { - let providerConfig: ProviderConfig = new ProviderConfig(); - providerConfig.role = entry.role[0]; - providerConfig.name = entry.name[0]; - providerConfig.enabled = entry.enabled[0]; - - // There may not be params - if (entry.param) { - let params = new Map(); - for (let i = 0; i < entry.param.length; i++) { - let param = entry.param[i]; - params[param.name[0]] = param.value[0]; - } - providerConfig.params = params; - } - tempProviders.push(providerConfig); - }); - this.providers = tempProviders; - this.readOnlyProviderConfig = result['gateway'].readOnly; - } - } - ); - } */ } catch (e) { console.error('ResourceDetailComponent --> setProviderConfigContent() --> Error parsing ' + res.name + ' content: ' + e); this.providers = null; // Clear detail display @@ -176,7 +138,6 @@ export class ResourceDetailComponent implements OnInit { if (res.name.endsWith('json')) { contentObj = JSON.parse(this.resourceContent); } else if (res.name.endsWith('yaml') || res.name.endsWith('yml')) { - let yaml = require('js-yaml'); contentObj = yaml.load(this.resourceContent); } let tempDesc = new Descriptor(); @@ -331,7 +292,7 @@ export class ResourceDetailComponent implements OnInit { } onRemoveProviderParam(pc: ProviderConfig, paramName: string) { - if (pc.params.hasOwnProperty(paramName)) { + if (Object.prototype.hasOwnProperty.call(pc.params, paramName)) { delete pc.params[paramName]; } this.changedProviders = this.providers; @@ -352,7 +313,7 @@ export class ResourceDetailComponent implements OnInit { for (let i = 0; i < this.descriptor.services.length; i++) { if (this.descriptor.services[i].name === serviceName) { let service = this.descriptor.services[i]; - if (service.params.hasOwnProperty(paramName)) { + if (Object.prototype.hasOwnProperty.call(service.params, paramName)) { delete service.params[paramName]; this.descriptor.setDirty(); done = true; @@ -548,7 +509,7 @@ export class ResourceDetailComponent implements OnInit { } // This method is required to maintain focus on descriptor service URLs when they're being edited. - trackByServiceURLIndex(index: any, item: any) { + trackByServiceURLIndex(index: any, _item: any) { return index; } @@ -573,7 +534,7 @@ export class ResourceDetailComponent implements OnInit { showEditOptions(): boolean { if (this.resourceType === 'Descriptors' && this.descriptor.readOnly) { - return !Boolean(this.descriptor.readOnly); + return !this.descriptor.readOnly; } if (this.resourceType === 'Provider Configurations' && this.readOnlyProviderConfig) { diff --git a/gateway-admin-ui/admin-ui/app/resource/resource.component.css b/gateway-admin-ui/admin-ui/app/resource/resource.component.css index e69de29bb2..135714db5d 100644 --- a/gateway-admin-ui/admin-ui/app/resource/resource.component.css +++ b/gateway-admin-ui/admin-ui/app/resource/resource.component.css @@ -0,0 +1,58 @@ +.table-header { + display: flex; + align-items: center; + justify-content: space-between; + padding: 6px 12px; + background-color: #fff; + border-bottom: 2px solid #4caf50; +} + +.table-title { + font-weight: 600; + font-size: 13px; + color: #333; +} + +:host ::ng-deep .mat-mdc-table { + background-color: #fff; +} + +:host ::ng-deep .mat-mdc-header-row { + height: 32px; + background-color: #fafafa; +} + +:host ::ng-deep .mat-mdc-header-cell { + font-size: 12px; + font-weight: 600; + color: #555; + padding: 0 12px; +} + +:host ::ng-deep .mat-mdc-row { + height: 30px; +} + +:host ::ng-deep .mat-mdc-cell { + font-size: 13px; + padding: 0 12px; + border-bottom-color: #eee; +} + +:host ::ng-deep tr.mat-mdc-row:nth-child(even) { + background-color: #f9fdf9; +} + +:host ::ng-deep tr.mat-mdc-row:hover { + background-color: #e8f5e9; +} + +:host ::ng-deep tr.mat-mdc-row.selected, +:host ::ng-deep tr.mat-mdc-row.active { + background-color: #c8e6c9; +} + +:host ::ng-deep .mat-mdc-paginator { + font-size: 12px; + border-top: 1px solid #eee; +} diff --git a/gateway-admin-ui/admin-ui/app/resource/resource.component.html b/gateway-admin-ui/admin-ui/app/resource/resource.component.html index 4845e60393..e7ddab505a 100644 --- a/gateway-admin-ui/admin-ui/app/resource/resource.component.html +++ b/gateway-admin-ui/admin-ui/app/resource/resource.component.html @@ -1,51 +1,47 @@
-
- - - - - - - - - - - - - - - - - - -
- - {{ getResourceTypeSingularDisplayName(resourceType) }} - - - - - Timestamp
{{resourceService.getResourceDisplayName(resource)}}{{resource.timestamp | date:'medium'}}
- -
+
+ {{ getResourceTypeSingularDisplayName(resourceType) }} + @if (resourceType === 'Provider Configurations') { + add_circle + } + @if (resourceType === 'Descriptors') { + add_circle + } + @if (resourceType === 'Service Definitions') { + add_circle + }
+ + + + + + + + + + + + + + +
Name{{resourceService.getResourceDisplayName(resource)}}Timestamp{{resource.timestamp | date:'medium'}}
+ + +
diff --git a/gateway-admin-ui/admin-ui/app/resource/resource.component.spec.ts b/gateway-admin-ui/admin-ui/app/resource/resource.component.spec.ts deleted file mode 100644 index f5f4bc59b4..0000000000 --- a/gateway-admin-ui/admin-ui/app/resource/resource.component.spec.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import {async, ComponentFixture, TestBed} from '@angular/core/testing'; - -import {ResourceComponent} from './resource.component'; - -describe('ResourceComponent', () => { - let component: ResourceComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ResourceComponent] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ResourceComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/gateway-admin-ui/admin-ui/app/resource/resource.component.ts b/gateway-admin-ui/admin-ui/app/resource/resource.component.ts index 6ba0b1cff4..0a23830106 100644 --- a/gateway-admin-ui/admin-ui/app/resource/resource.component.ts +++ b/gateway-admin-ui/admin-ui/app/resource/resource.component.ts @@ -14,26 +14,35 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {Component, OnInit} from '@angular/core'; -import {ResourceTypesService} from '../resourcetypes/resourcetypes.service'; -import {ResourceService} from './resource.service'; -import {Resource} from './resource'; -import {TopologyService} from '../topology.service'; -import {Topology} from '../topology'; -import {ServiceDefinitionService} from '../service-definition/servicedefinition.service'; -import {ServiceDefinition} from '../service-definition/servicedefinition'; -import {HttpErrorResponse} from '@angular/common/http'; +import {Component, OnInit, ViewChild, AfterViewInit} from '@angular/core'; +import {DatePipe} from '@angular/common'; +import {MatTableModule, MatTableDataSource} from '@angular/material/table'; +import {MatPaginatorModule, MatPaginator} from '@angular/material/paginator'; +import {ResourceTypesService} from '../service/resourcetypes.service'; +import {ResourceService} from '../service/resource.service'; +import {Resource} from '../model/resource'; +import {TopologyService} from '../service/topology.service'; +import {Topology} from '../model/topology'; +import {ServiceDefinitionService} from '../service/servicedefinition.service'; +import {ServiceDefinition} from '../model/servicedefinition'; +import {NewDescWizardComponent} from '../new-desc-wizard/new-desc-wizard.component'; +import {ProviderConfigWizardComponent} from '../provider-config-wizard/provider-config-wizard.component'; +import {NewServiceDefinitionComponent} from '../service-definition/new-service-definition.component'; +import { HttpErrorResponse } from '@angular/common/http'; @Component({ selector: 'app-resource', templateUrl: './resource.component.html', - styleUrls: ['./resource.component.css'] + styleUrls: ['./resource.component.css'], + imports: [DatePipe, MatTableModule, MatPaginatorModule, + NewDescWizardComponent, ProviderConfigWizardComponent, NewServiceDefinitionComponent] }) -export class ResourceComponent implements OnInit { +export class ResourceComponent implements OnInit, AfterViewInit { resourceType: string; - value: any; - resources: Resource[]; selectedResource: Resource; + dataSource = new MatTableDataSource([]); + + @ViewChild(MatPaginator) paginator: MatPaginator; constructor(private resourceTypesService: ResourceTypesService, private resourceService: ResourceService, @@ -45,15 +54,25 @@ export class ResourceComponent implements OnInit { this.resourceTypesService.selectedResourceType$.subscribe(resourceType => this.setResourceType(resourceType)); } + ngAfterViewInit() { + this.dataSource.paginator = this.paginator; + } + + getDisplayedColumns(): string[] { + if (this.resourceType === 'Topologies') { + return ['name', 'timestamp']; + } + return ['name']; + } + setResourceType(resType: string) { - // Clear the selected resource, so it can be removed from the list on refresh if necessary this.selectedResource = null; this.resourceType = resType; this.resourceService.selectedResourceType(this.resourceType); this.resourceService.getResources(resType) .then(resources => { - this.resources = resources; + this.dataSource.data = resources; let debugMsg = 'ResourceComponent --> Found ' + resources.length + ' ' + resType + ' resources\n'; for (let res of resources) { @@ -73,7 +92,6 @@ export class ResourceComponent implements OnInit { onSelect(resource: Resource) { this.selectedResource = resource; - // If it's a topology resource, notify the topology service if (this.resourceType === 'Topologies') { let topology = new Topology(); topology.name = resource.name; @@ -81,13 +99,11 @@ export class ResourceComponent implements OnInit { this.topologyService.selectedTopology(topology); } else if (this.resourceType === 'Service Definitions') { let serviceDefinition = new ServiceDefinition(); - serviceDefinition.name = resource.name; serviceDefinition.service = resource.service['name']; serviceDefinition.role = resource.service['role']; serviceDefinition.version = resource.service['version']; this.serviceDefinitionService.selectedServiceDefinition(serviceDefinition); } else { - // Otherwise, notify the resource service this.resourceService.selectedResource(resource); } } diff --git a/gateway-admin-ui/admin-ui/app/resourcetypes/resourcetypes.component.css b/gateway-admin-ui/admin-ui/app/resourcetypes/resourcetypes.component.css index e69de29bb2..ba98cb320e 100644 --- a/gateway-admin-ui/admin-ui/app/resourcetypes/resourcetypes.component.css +++ b/gateway-admin-ui/admin-ui/app/resourcetypes/resourcetypes.component.css @@ -0,0 +1,45 @@ +.resource-types-panel { + border: 1px solid #ddd; + border-radius: 4px; + overflow: hidden; +} + +.resource-types-header { + padding: 8px 12px; + font-weight: 600; + font-size: 13px; + color: #333; + background-color: #fff; + border-bottom: 2px solid #4caf50; +} + +.resource-types-list { + list-style: none; + margin: 0; + padding: 0; +} + +.resource-type-item { + padding: 8px 12px; + font-size: 13px; + border-bottom: 1px solid #eee; + transition: background-color 0.1s; +} + +.resource-type-item:last-child { + border-bottom: none; +} + +.resource-type-item:hover { + background-color: #e8f5e9; +} + +.resource-type-item.selected { + background-color: #4caf50; + color: #fff; + font-weight: 500; +} + +.resource-type-item.selected:hover { + background-color: #388e3c; +} diff --git a/gateway-admin-ui/admin-ui/app/resourcetypes/resourcetypes.component.html b/gateway-admin-ui/admin-ui/app/resourcetypes/resourcetypes.component.html index e845392620..c22963ad99 100644 --- a/gateway-admin-ui/admin-ui/app/resourcetypes/resourcetypes.component.html +++ b/gateway-admin-ui/admin-ui/app/resourcetypes/resourcetypes.component.html @@ -1,18 +1,12 @@ -
- - - - - - - - - - - -
Resource Types
{{type}}
+
+
Resource Types
+
    + @for (type of resourceTypes; track type) { +
  • + {{type}} +
  • + } +
diff --git a/gateway-admin-ui/admin-ui/app/resourcetypes/resourcetypes.component.spec.ts b/gateway-admin-ui/admin-ui/app/resourcetypes/resourcetypes.component.spec.ts deleted file mode 100644 index 2790701ba8..0000000000 --- a/gateway-admin-ui/admin-ui/app/resourcetypes/resourcetypes.component.spec.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import {async, ComponentFixture, TestBed} from '@angular/core/testing'; - -import {ResourcetypesComponent} from './resourcetypes.component'; - -describe('ResourcetypesComponent', () => { - let component: ResourcetypesComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ResourcetypesComponent] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ResourcetypesComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/gateway-admin-ui/admin-ui/app/resourcetypes/resourcetypes.component.ts b/gateway-admin-ui/admin-ui/app/resourcetypes/resourcetypes.component.ts index f278e838ef..5a62a935c0 100644 --- a/gateway-admin-ui/admin-ui/app/resourcetypes/resourcetypes.component.ts +++ b/gateway-admin-ui/admin-ui/app/resourcetypes/resourcetypes.component.ts @@ -14,8 +14,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {Component, Injectable, OnInit} from '@angular/core'; -import {ResourceTypesService} from './resourcetypes.service'; +import {Component, OnInit} from '@angular/core'; +import {ResourceTypesService} from '../service/resourcetypes.service'; @Component({ selector: 'app-resourcetypes', diff --git a/gateway-admin-ui/admin-ui/app/service-definition/new-service-definition.component.css b/gateway-admin-ui/admin-ui/app/service-definition/new-service-definition.component.css index 0cc494ab8c..52e0fee937 100644 --- a/gateway-admin-ui/admin-ui/app/service-definition/new-service-definition.component.css +++ b/gateway-admin-ui/admin-ui/app/service-definition/new-service-definition.component.css @@ -2,4 +2,26 @@ td { border-collapse: collapse; padding: 8px; vertical-align: top; -} \ No newline at end of file +} + +.code-editor-modal { + min-height: 430px; + width: 100%; + padding: 12px; + background-color: #272822; + color: #f8f8f2; + border: 1px solid #3e3d32; + border-radius: 4px; + outline: none; + resize: vertical; + font-family: 'Menlo', 'Monaco', 'Courier New', monospace; + font-size: 12px; + line-height: 18px; + tab-size: 4; + white-space: pre; + overflow: auto; +} + +.code-editor-modal::selection { + background-color: #49483e; +} diff --git a/gateway-admin-ui/admin-ui/app/service-definition/new-service-definition.component.html b/gateway-admin-ui/admin-ui/app/service-definition/new-service-definition.component.html index 89a2716f31..a18816a76c 100644 --- a/gateway-admin-ui/admin-ui/app/service-definition/new-service-definition.component.html +++ b/gateway-admin-ui/admin-ui/app/service-definition/new-service-definition.component.html @@ -1,27 +1,21 @@ - - + +