From 7041554c4df48fc0bf8d7e69ff3b4ef86c0afb32 Mon Sep 17 00:00:00 2001 From: Ted Jones Date: Mon, 2 Apr 2018 15:09:34 -0500 Subject: [PATCH] Changed dataservice list detail to match connection list detail. Also refactored dataservice detail from basic content. --- .../connection-details.component.html | 1 - .../basic-content.component.html | 16 ----- .../basic-content.component.ts | 32 ---------- .../dataservices-details.component.html | 12 ++++ .../dataservices-details.component.ts | 59 +++++++++++++++++++ .../dataservices-list.component.css | 5 ++ .../dataservices-list.component.html | 2 +- .../dataservices-list.component.spec.ts | 4 +- .../dataservices.component.spec.ts | 4 +- .../app/dataservices/dataservices.module.ts | 4 +- .../shared/dataservices-constants.ts | 3 + 11 files changed, 86 insertions(+), 56 deletions(-) delete mode 100644 ngapp/src/app/dataservices/dataservices-list/basic-content.component.html delete mode 100644 ngapp/src/app/dataservices/dataservices-list/basic-content.component.ts create mode 100644 ngapp/src/app/dataservices/dataservices-list/dataservices-details.component.html create mode 100644 ngapp/src/app/dataservices/dataservices-list/dataservices-details.component.ts diff --git a/ngapp/src/app/connections/connections-list/connection-details.component.html b/ngapp/src/app/connections/connections-list/connection-details.component.html index 1dc06f2e..5b7bfe52 100644 --- a/ngapp/src/app/connections/connections-list/connection-details.component.html +++ b/ngapp/src/app/connections/connections-list/connection-details.component.html @@ -1,4 +1,3 @@ -
Properties
-
-

- Name -

-

- {{ item.getId() }} -

-

- Description -

-

- {{ item.getDescription() }} -

-
- diff --git a/ngapp/src/app/dataservices/dataservices-list/basic-content.component.ts b/ngapp/src/app/dataservices/dataservices-list/basic-content.component.ts deleted file mode 100644 index 015dc33a..00000000 --- a/ngapp/src/app/dataservices/dataservices-list/basic-content.component.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * @license - * Copyright 2017 JBoss Inc - * - * Licensed 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, Input, ViewEncapsulation } from "@angular/core"; - -@Component({ - encapsulation: ViewEncapsulation.None, - selector: "app-basic-content", - templateUrl: "basic-content.component.html" -}) -export class BasicContentComponent { - @Input() public item: any; - - constructor() { - // nothing to do - } - -} diff --git a/ngapp/src/app/dataservices/dataservices-list/dataservices-details.component.html b/ngapp/src/app/dataservices/dataservices-list/dataservices-details.component.html new file mode 100644 index 00000000..9d534b20 --- /dev/null +++ b/ngapp/src/app/dataservices/dataservices-list/dataservices-details.component.html @@ -0,0 +1,12 @@ + + +
+
{{ item[ 0 ] }}
+
{{ item[ 1 ] }}
+
+
+
diff --git a/ngapp/src/app/dataservices/dataservices-list/dataservices-details.component.ts b/ngapp/src/app/dataservices/dataservices-list/dataservices-details.component.ts new file mode 100644 index 00000000..e8227d8d --- /dev/null +++ b/ngapp/src/app/dataservices/dataservices-list/dataservices-details.component.ts @@ -0,0 +1,59 @@ +/** + * @license + * Copyright 2017 JBoss Inc + * + * Licensed 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, Input, OnInit, ViewEncapsulation } from "@angular/core"; +import { Dataservice } from "@dataservices/shared/dataservice.model"; +import { ListConfig } from "patternfly-ng"; +import { DataservicesConstants } from "../shared/dataservices-constants"; + +@Component({ + encapsulation: ViewEncapsulation.None, + selector: "app-dataservices-details", + templateUrl: "dataservices-details.component.html" +}) +export class DataservicesDetailsComponent implements OnInit { + @Input() public item: Dataservice; + + public listConfig: ListConfig; + + constructor() { + // nothing to do + } + + public ngOnInit(): void { + this.listConfig = { + dblClick: false, + multiSelect: false, + selectItems: false, + showCheckbox: false, + useExpandItems: false + }; + } + + /** + * @returns {string[][]} the properties of a dataservice + */ + public get properties(): string[][] { + const props = [ + [ DataservicesConstants.dataserviceNameLabel, this.item.getId() ], + [ DataservicesConstants.descriptionLabel, this.item.getDescription() ] + ]; + + return props; + } + +} diff --git a/ngapp/src/app/dataservices/dataservices-list/dataservices-list.component.css b/ngapp/src/app/dataservices/dataservices-list/dataservices-list.component.css index bde71f9e..ef78a19d 100644 --- a/ngapp/src/app/dataservices/dataservices-list/dataservices-list.component.css +++ b/ngapp/src/app/dataservices/dataservices-list/dataservices-list.component.css @@ -31,3 +31,8 @@ a.list-pf-title.view-name { color: var(--card-body-color); margin-left: 10px !important; } + +.dataservices-details-properties { + padding-left: 40px; +} + diff --git a/ngapp/src/app/dataservices/dataservices-list/dataservices-list.component.html b/ngapp/src/app/dataservices/dataservices-list/dataservices-list.component.html index 608ab6fd..42b6300e 100644 --- a/ngapp/src/app/dataservices/dataservices-list/dataservices-list.component.html +++ b/ngapp/src/app/dataservices/dataservices-list/dataservices-list.component.html @@ -75,7 +75,7 @@ - +
diff --git a/ngapp/src/app/dataservices/dataservices-list/dataservices-list.component.spec.ts b/ngapp/src/app/dataservices/dataservices-list/dataservices-list.component.spec.ts index a054ea1f..ffd92d2b 100644 --- a/ngapp/src/app/dataservices/dataservices-list/dataservices-list.component.spec.ts +++ b/ngapp/src/app/dataservices/dataservices-list/dataservices-list.component.spec.ts @@ -1,7 +1,7 @@ import { async, ComponentFixture, TestBed } from "@angular/core/testing"; import { RouterTestingModule } from "@angular/router/testing"; import { LoggerService } from "@core/logger.service"; -import { BasicContentComponent } from "@dataservices/dataservices-list/basic-content.component"; +import { DataservicesDetailsComponent } from "@dataservices/dataservices-list/dataservices-details.component"; import { DataservicesListComponent } from "@dataservices/dataservices-list/dataservices-list.component"; import { ViewsContentComponent } from "@dataservices/dataservices-list/views-content.component"; import { PatternFlyNgModule } from "patternfly-ng"; @@ -13,7 +13,7 @@ describe("DataservicesListComponent", () => { beforeEach(async(() => { TestBed.configureTestingModule({ imports: [ PatternFlyNgModule, RouterTestingModule ], - declarations: [ BasicContentComponent, DataservicesListComponent, ViewsContentComponent ], + declarations: [ DataservicesDetailsComponent, DataservicesListComponent, ViewsContentComponent ], providers: [ LoggerService ] }) .compileComponents().then(() => { diff --git a/ngapp/src/app/dataservices/dataservices.component.spec.ts b/ngapp/src/app/dataservices/dataservices.component.spec.ts index 7b0c4b02..56ba94db 100644 --- a/ngapp/src/app/dataservices/dataservices.component.spec.ts +++ b/ngapp/src/app/dataservices/dataservices.component.spec.ts @@ -10,7 +10,7 @@ import { CoreModule } from "@core/core.module"; import { MockAppSettingsService } from "@core/mock-app-settings.service"; import { DataserviceCardComponent } from "@dataservices/dataservices-cards/dataservice-card/dataservice-card.component"; import { DataservicesCardsComponent } from "@dataservices/dataservices-cards/dataservices-cards.component"; -import { BasicContentComponent } from "@dataservices/dataservices-list/basic-content.component"; +import { DataservicesDetailsComponent } from "@dataservices/dataservices-list/dataservices-details.component"; import { DataservicesListComponent } from "@dataservices/dataservices-list/dataservices-list.component"; import { ViewsContentComponent } from "@dataservices/dataservices-list/views-content.component"; import { DataservicesComponent } from "@dataservices/dataservices.component"; @@ -34,7 +34,7 @@ describe("DataservicesComponent", () => { TestBed.configureTestingModule({ imports: [ CoreModule, FormsModule, HttpModule, ModalModule.forRoot(), PatternFlyNgModule, RouterTestingModule, SharedModule, CodemirrorModule ], - declarations: [ BasicContentComponent, + declarations: [ DataservicesDetailsComponent, DataservicesComponent, DataservicesListComponent, DataservicesCardsComponent, diff --git a/ngapp/src/app/dataservices/dataservices.module.ts b/ngapp/src/app/dataservices/dataservices.module.ts index 79f579ce..5b3ff8d2 100644 --- a/ngapp/src/app/dataservices/dataservices.module.ts +++ b/ngapp/src/app/dataservices/dataservices.module.ts @@ -24,7 +24,7 @@ import { AppSettingsService } from "@core/app-settings.service"; import { CoreModule } from "@core/core.module"; import { LoggerService } from "@core/logger.service"; import { DataservicesCardsComponent } from "@dataservices/dataservices-cards/dataservices-cards.component"; -import { BasicContentComponent } from "@dataservices/dataservices-list/basic-content.component"; +import { DataservicesDetailsComponent } from "@dataservices/dataservices-list/dataservices-details.component"; import { DataservicesListComponent } from "@dataservices/dataservices-list/dataservices-list.component"; import { ViewsContentComponent } from "@dataservices/dataservices-list/views-content.component"; import { DataservicesRoutingModule } from "@dataservices/dataservices-routing.module"; @@ -61,7 +61,7 @@ import { TestDataserviceComponent } from "./test-dataservice/test-dataservice.co CodemirrorModule ], declarations: [ - BasicContentComponent, + DataservicesDetailsComponent, ViewsContentComponent, DataservicesCardsComponent, DataservicesComponent, diff --git a/ngapp/src/app/dataservices/shared/dataservices-constants.ts b/ngapp/src/app/dataservices/shared/dataservices-constants.ts index 0874b584..56c6c79c 100644 --- a/ngapp/src/app/dataservices/shared/dataservices-constants.ts +++ b/ngapp/src/app/dataservices/shared/dataservices-constants.ts @@ -29,6 +29,9 @@ export class DataservicesConstants { public static readonly testDataserviceRoute = DataservicesConstants.dataservicesRootRoute + "/test-dataservice"; public static readonly testDataservicePath = DataservicesConstants.dataservicesRootPath + "/test-dataservice"; + public static dataserviceNameLabel = "Name"; + public static descriptionLabel = "Description"; + public static readonly dataservicesNavItem: NavigationItemConfig = { title: "Data Services", iconStyleClass: "fa fa-fw fa-table",