This repository has been archived by the owner on Nov 22, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TEIIDTOOLS-309 Rework Connections Summary page in Beetle Studio
- created ConnectionCardComponent - updated connection cards to patternfly-ng - increase dataservice create polling duration time to 2 minutes - created style theme - style changes to dataservice card and also changed to use theme when possible - style changes to selected table card and also changed to use theme when possible
- Loading branch information
1 parent
7023882
commit b61b416
Showing
32 changed files
with
995 additions
and
450 deletions.
There are no files selected for viewing
Empty file.
55 changes: 55 additions & 0 deletions
55
ngapp/src/app/connections/connections-cards/connection-card/connection-card.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<pfng-card [config]="cardConfig" | ||
[headerTemplate]="tableHeaderTemplate" | ||
(onActionSelect)="onShowDetails($event)" | ||
(click)="onSelect()" | ||
[class]="isSelected() ? 'object-card-selected' : 'object-card'" | ||
(selectedConnections)="selectedConnections"> | ||
<ng-template #tableHeaderTemplate> | ||
<div class="row card-toolbar"> | ||
<div class="form-group pull-right col-xs-1 card-toolbar-dropdown-action-group"> | ||
<pfng-action [config]="actionConfig" | ||
(onActionSelect)="handleAction($event)"> | ||
</pfng-action> | ||
</div> | ||
<span class="pull-right fa pficon-connected card-action-icon" | ||
(click)="onClick(pingEvent)" | ||
data-toggle="tooltip" | ||
data-placement="right" | ||
title="Determine if accessible"> | ||
</span> | ||
<span class="pull-right fa fa-edit card-action-icon" | ||
(click)="onClick(editEvent)" | ||
data-toggle="tooltip" | ||
data-placement="right" | ||
title="Edit properties"> | ||
</span> | ||
</div> | ||
<div class="row card-pf-title text-center object-card-title"> | ||
<div class="fa fa-plug object-inline-icon"></div> | ||
<a [routerLink]="[connection.getId()]" (click)="onClick(editEvent)">{{ connection.name }}</a> | ||
</div> | ||
<div class="row"> | ||
<div class="object-card-description">{{ connection.description }}</div> | ||
</div> | ||
</ng-template> | ||
<div class="object-card-body"> | ||
<div *ngIf="showDetails"> | ||
<div [class]="isSelected() ? 'object-card-body-title-selected' : 'object-card-body-title'">Properties</div> | ||
<div [class]="isSelected() ? 'col-sm-12 properties-group-selected' : 'col-sm-12 properties-group'"> | ||
<div class="form-group"> | ||
<pfng-list | ||
[config]="listConfig" | ||
[itemTemplate]="itemTemplate" | ||
[items]="properties"> | ||
<ng-template #itemTemplate let-item="item"> | ||
<div class="object-card-body-item"> | ||
<div class="col-sm-6 property-name">{{ item[ 0 ] }}</div> | ||
<div class="col-sm-6 property-value">{{ item[ 1 ] }}</div> | ||
</div> | ||
</ng-template> | ||
</pfng-list> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</pfng-card> |
36 changes: 36 additions & 0 deletions
36
...p/src/app/connections/connections-cards/connection-card/connection-card.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { async, ComponentFixture, TestBed } from "@angular/core/testing"; | ||
import { RouterTestingModule } from "@angular/router/testing"; | ||
import { Connection } from "@connections/shared/connection.model"; | ||
import { LoggerService } from "@core/logger.service"; | ||
import { PatternFlyNgModule } from "patternfly-ng"; | ||
import { ConnectionCardComponent } from "./connection-card.component"; | ||
|
||
describe("ConnectionCardComponent", () => { | ||
let component: ConnectionCardComponent; | ||
let fixture: ComponentFixture<ConnectionCardComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [ PatternFlyNgModule, RouterTestingModule ], | ||
declarations: [ ConnectionCardComponent ], | ||
providers: [ LoggerService ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(ConnectionCardComponent); | ||
component = fixture.componentInstance; | ||
|
||
const connection = new Connection(); | ||
connection.setId( "MyConnection" ); | ||
component.connection = connection; | ||
component.selectedConnections = [ connection ]; | ||
|
||
fixture.detectChanges(); | ||
}); | ||
|
||
it("should be created", () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
156 changes: 156 additions & 0 deletions
156
ngapp/src/app/connections/connections-cards/connection-card/connection-card.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
/** | ||
* @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, EventEmitter, Input, OnInit, Output, ViewEncapsulation } from "@angular/core"; | ||
import { Connection } from "@connections/shared/connection.model"; | ||
import { ConnectionsConstants } from "@connections/shared/connections-constants"; | ||
import { LoggerService } from "@core/logger.service"; | ||
import { Action, ActionConfig, CardAction, CardConfig, ListConfig } from "patternfly-ng"; | ||
|
||
@Component({ | ||
encapsulation: ViewEncapsulation.None, | ||
selector: "app-connection-card", | ||
templateUrl: "./connection-card.component.html", | ||
styleUrls: ["./connection-card.component.css"] | ||
}) | ||
export class ConnectionCardComponent implements OnInit { | ||
|
||
public static readonly deleteConnectionEvent = "delete"; | ||
public static readonly editConnectionEvent = "edit"; | ||
public static readonly pingConnectionEvent = "ping"; | ||
|
||
public readonly editEvent = ConnectionCardComponent.editConnectionEvent; | ||
public readonly pingEvent = ConnectionCardComponent.pingConnectionEvent; | ||
|
||
@Input() public connection: Connection; | ||
@Input() public selectedConnections: Connection[]; | ||
@Output() public cardEvent: EventEmitter< {} > = new EventEmitter< {} >(); | ||
@Output() public selectEvent: EventEmitter< Connection > = new EventEmitter< Connection >(); | ||
|
||
public actionConfig: ActionConfig; | ||
public cardConfig: CardConfig; | ||
public listConfig: ListConfig; | ||
public showDetails = false; | ||
|
||
private readonly deleteActionId = "delete"; | ||
private logger: LoggerService; | ||
|
||
constructor( logger: LoggerService ) { | ||
this.logger = logger; | ||
} | ||
|
||
/** | ||
* @returns {string[][]} the properties of a connection | ||
*/ | ||
public get properties(): string[][] { | ||
const props = [ | ||
[ ConnectionsConstants.jndiNamePropertyLabel, this.connection.getJndiName() ], | ||
[ ConnectionsConstants.driverNamePropertyLabel, this.connection.getDriverName() ], | ||
[ ConnectionsConstants.serviceCatalogSourceNameLabel, this.connection.getServiceCatalogSourceName() ], | ||
]; | ||
|
||
return props; | ||
} | ||
|
||
/** | ||
* Event handler for when a toolbar kebab action is clicked. | ||
* @param {Action} action the action that was selected. | ||
*/ | ||
public handleAction( action: Action ): void { | ||
if ( action.id === this.deleteActionId ) { | ||
this.onClick( ConnectionCardComponent.deleteConnectionEvent ); | ||
} else { | ||
this.logger.error( "Action '" + action.id + "' not handled." ); | ||
} | ||
} | ||
|
||
/** | ||
* @returns {boolean} `true` if the connection represented by this card is selected | ||
*/ | ||
public isSelected(): boolean { | ||
return this.selectedConnections.indexOf( this.connection ) !== -1; | ||
} | ||
|
||
/** | ||
* Initializes the ActionConfig, CardConfig, and ListConfig. | ||
*/ | ||
public ngOnInit(): void { | ||
this.actionConfig = { | ||
primaryActions: [ | ||
], | ||
moreActions: [ | ||
{ | ||
id: this.deleteActionId, | ||
title: "Delete", | ||
tooltip: "Delete the connection" | ||
} | ||
] | ||
} as ActionConfig; | ||
|
||
this.cardConfig = { | ||
action: { | ||
id: "showDetails", | ||
hypertext: this.showDetailsTitle, | ||
iconStyleClass: "fa fa-info-circle" | ||
}, | ||
titleBorder: true, | ||
noPadding: true, | ||
topBorder: false | ||
} as CardConfig; | ||
|
||
this.listConfig = { | ||
dblClick: false, | ||
multiSelect: false, | ||
selectItems: false, | ||
selectedItems: this.selectedConnections, | ||
showCheckbox: false, | ||
useExpandItems: false | ||
} as ListConfig; | ||
} | ||
|
||
/** | ||
* An event handler for when a toolbar action is invoked. | ||
* @param {string} type the type of event being processed | ||
*/ | ||
public onClick( type: string ): void { | ||
this.cardEvent.emit( { eventType: type, connectionName: this.connection.getId() } ); | ||
} | ||
|
||
/** | ||
* An event handler for when the card is clicked. | ||
*/ | ||
public onSelect(): void { | ||
this.selectEvent.emit( this.connection ); | ||
} | ||
|
||
/** | ||
* An event handler for footer action link. | ||
* @param {CardAction} $event the event being processed | ||
*/ | ||
public onShowDetails( $event: CardAction ): void { | ||
this.showDetails = !this.showDetails; | ||
$event.hypertext = this.showDetailsTitle; | ||
} | ||
|
||
/** | ||
* @returns {string} the footer details action text | ||
*/ | ||
public get showDetailsTitle(): string { | ||
return this.showDetails ? "Hide Details" : "Show Details"; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 38 additions & 30 deletions
68
ngapp/src/app/connections/connections-cards/connections-cards.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,40 @@ | ||
<div class="container-fluid container-cards-pf"> | ||
<div class="row row-cards-pf"> | ||
|
||
<div class="col-xs-12 col-sm-3 col-md-3" *ngFor="let connection of connections"> | ||
<div class="card-pf card-pf-accented card-pf-aggregate-status connection-card" [class.active]="isSelected(connection)" (click)="toggleConnectionSelected(connection)"> | ||
<div class="card-pf-body"> | ||
<!-- title --> | ||
<h2 class="connection-card-title"> | ||
<span class="fa fa-fw fa-plug connection-card-icon"></span> | ||
<span><a [routerLink]="[connection.getId()]">{{ connection.getId() }}</a></span> | ||
<span class="pull-right pficon-delete connection-card-action-icon" style="color:darkred;" (click)="onDeleteConnection(connection.getId())"></span> | ||
</h2> | ||
<hr/> | ||
<div> | ||
<span><b i18n="@@connectionTagsLabel.jndi" >JNDI:</b> {{ connection.getJndiName() }}</span> | ||
</div> | ||
<div> | ||
<span><b i18n="@@connectionTagsLabel.driver" >Driver:</b> {{ connection.getDriverName() }}</span> | ||
</div> | ||
<!-- | ||
<div class="connection-tags" *ngIf="connection.tags && connection.tags.length > 0"> | ||
<span class="connection-tags-label">Tags:</span> | ||
<span class="connection-tag" *ngFor="let tag of connection.tags" (click)="selectTag(tag, $event)">{{ tag }}</span> | ||
</div> | ||
<p class="connection-description">{{connection.description}}</p> | ||
--> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="row-cards-pf"> | ||
<div class="col-xs-12 col-sm-3 col-md-3" *ngFor="let connection of connections"> | ||
<app-connection-card [connection]="connection" | ||
[selectedConnections]="selectedConnections" | ||
(cardEvent)="onCardEvent($event)" | ||
(selectEvent)="onSelectEvent($event)"></app-connection-card> | ||
</div> | ||
</div> | ||
<!--<div class="container-fluid container-cards-pf">--> | ||
<!--<div class="row row-cards-pf">--> | ||
|
||
<!--<div class="col-xs-12 col-sm-3 col-md-3" *ngFor="let connection of connections">--> | ||
<!--<div class="card-pf card-pf-accented card-pf-aggregate-status connection-card" [class.active]="isSelected(connection)" (click)="toggleConnectionSelected(connection)">--> | ||
<!--<div class="card-pf-body">--> | ||
<!--<!– title –>--> | ||
<!--<h2 class="connection-card-title">--> | ||
<!--<span class="fa fa-fw fa-plug connection-card-icon"></span>--> | ||
<!--<span><a [routerLink]="[connection.getId()]">{{ connection.getId() }}</a></span>--> | ||
<!--<span class="pull-right pficon-delete connection-card-action-icon" style="color:darkred;" (click)="onDeleteConnection(connection.getId())"></span>--> | ||
<!--</h2>--> | ||
<!--<hr/>--> | ||
<!--<div>--> | ||
<!--<span><b i18n="@@connectionTagsLabel.jndi" >JNDI:</b> {{ connection.getJndiName() }}</span>--> | ||
<!--</div>--> | ||
<!--<div>--> | ||
<!--<span><b i18n="@@connectionTagsLabel.driver" >Driver:</b> {{ connection.getDriverName() }}</span>--> | ||
<!--</div>--> | ||
<!--<!–--> | ||
<!--<div class="connection-tags" *ngIf="connection.tags && connection.tags.length > 0">--> | ||
<!--<span class="connection-tags-label">Tags:</span>--> | ||
<!--<span class="connection-tag" *ngFor="let tag of connection.tags" (click)="selectTag(tag, $event)">{{ tag }}</span>--> | ||
<!--</div>--> | ||
<!--<p class="connection-description">{{connection.description}}</p>--> | ||
<!--–>--> | ||
<!--</div>--> | ||
<!--</div>--> | ||
<!--</div>--> | ||
|
||
<!--</div>--> | ||
<!--</div>--> |
Oops, something went wrong.