Skip to content
This repository has been archived by the owner on Nov 22, 2019. It is now read-only.

Commit

Permalink
sprint 3 work
Browse files Browse the repository at this point in the history
  • Loading branch information
mdrillin committed Apr 4, 2018
1 parent e0ffbd7 commit aeb7ac8
Show file tree
Hide file tree
Showing 39 changed files with 922 additions and 174 deletions.
Expand Up @@ -9,6 +9,9 @@ import { MockConnectionService } from "@connections/shared/mock-connection.servi
import { AppSettingsService } from "@core/app-settings.service";
import { CoreModule } from "@core/core.module";
import { MockAppSettingsService } from "@core/mock-app-settings.service";
import { MockVdbService } from "@dataservices/shared/mock-vdb.service";
import { NotifierService } from "@dataservices/shared/notifier.service";
import { VdbService } from "@dataservices/shared/vdb.service";
import { PropertyFormPropertyComponent } from "@shared/property-form/property-form-property/property-form-property.component";
import { PropertyFormComponent } from "@shared/property-form/property-form.component";
import { PatternFlyNgModule } from "patternfly-ng";
Expand All @@ -23,9 +26,11 @@ describe("AddActivityWizardComponent", () => {
imports: [ CoreModule, FormsModule, PatternFlyNgModule, ReactiveFormsModule, RouterTestingModule ],
declarations: [ AddActivityWizardComponent, PropertyFormComponent, PropertyFormPropertyComponent ],
providers: [
NotifierService,
{ provide: AppSettingsService, useClass: MockAppSettingsService },
{ provide: ActivityService, useClass: MockActivityService },
{ provide: ConnectionService, useClass: MockConnectionService }
{ provide: ConnectionService, useClass: MockConnectionService },
{ provide: VdbService, useClass: MockVdbService }
]
})
.compileComponents().then(() => {
Expand Down
Expand Up @@ -127,9 +127,13 @@ export class AddActivityWizardComponent implements OnInit {
this.connectionsLoadSuccess = false;
const self = this;
this.connectionService
.getAllConnections()
.getConnections(true, false)
.subscribe(
(conns) => {
(connectionSummaries) => {
const conns = [];
for ( const connectionSummary of connectionSummaries ) {
conns.push(connectionSummary.getConnection());
}
self.allConnections = conns;
self.connectionsLoading = false;
self.connectionsLoadSuccess = true;
Expand Down
Expand Up @@ -10,6 +10,9 @@ import { MockConnectionService } from "@connections/shared/mock-connection.servi
import { AppSettingsService } from "@core/app-settings.service";
import { CoreModule } from "@core/core.module";
import { MockAppSettingsService } from "@core/mock-app-settings.service";
import { MockVdbService } from "@dataservices/shared/mock-vdb.service";
import { NotifierService } from "@dataservices/shared/notifier.service";
import { VdbService } from "@dataservices/shared/vdb.service";
import { SharedModule } from "@shared/shared.module";
import { PatternFlyNgModule } from "patternfly-ng";
import { AddActivityComponent } from "./add-activity.component";
Expand All @@ -23,9 +26,11 @@ describe("AddActivityComponent", () => {
imports: [ CoreModule, PatternFlyNgModule, FormsModule, ReactiveFormsModule, RouterTestingModule, SharedModule ],
declarations: [ AddActivityComponent, AddActivityWizardComponent ],
providers: [
NotifierService,
{ provide: ActivityService, useClass: MockActivityService },
{ provide: AppSettingsService, useClass: MockAppSettingsService },
{ provide: ConnectionService, useClass: MockConnectionService }
{ provide: ConnectionService, useClass: MockConnectionService },
{ provide: VdbService, useClass: MockVdbService }
]
})
.compileComponents().then(() => {
Expand Down
Expand Up @@ -9,6 +9,9 @@ import { MockConnectionService } from "@connections/shared/mock-connection.servi
import { AppSettingsService } from "@core/app-settings.service";
import { CoreModule } from "@core/core.module";
import { MockAppSettingsService } from "@core/mock-app-settings.service";
import { MockVdbService } from "@dataservices/shared/mock-vdb.service";
import { NotifierService } from "@dataservices/shared/notifier.service";
import { VdbService } from "@dataservices/shared/vdb.service";
import { WizardService } from "@dataservices/shared/wizard.service";
import { PropertyFormPropertyComponent } from "@shared/property-form/property-form-property/property-form-property.component";
import { PropertyFormComponent } from "@shared/property-form/property-form.component";
Expand All @@ -28,6 +31,8 @@ describe("AddConnectionWizardComponent", () => {
WizardService,
{ provide: AppSettingsService, useClass: MockAppSettingsService },
{ provide: ConnectionService, useClass: MockConnectionService },
NotifierService,
{ provide: VdbService, useClass: MockVdbService }
]
})
.compileComponents().then(() => {
Expand Down
Expand Up @@ -367,9 +367,9 @@ export class AddConnectionWizardComponent implements OnInit {

const self = this;
if (this.wizardService.isEdit()) {
this.updateAndBindConnection(connection);
this.updateDeployConnection(connection);
} else {
this.createAndBindConnection(connection);
this.createDeployConnection(connection);
}
}

Expand Down Expand Up @@ -508,13 +508,14 @@ export class AddConnectionWizardComponent implements OnInit {
}

/**
* Creates the connection ensuring it is bound
* Creates the workspace connection, binds to serviceCatalogSource,
* and deploys a corresponding connection VDB to teiid.
* @param {Connection} connection the new connection
*/
private createAndBindConnection(connection: NewConnection): void {
private createDeployConnection(connection: NewConnection): void {
const self = this;
this.connectionService
.createAndBindConnection(connection)
.createDeployConnection(connection)
.subscribe(
(wasSuccess) => {
self.setFinalPageComplete(wasSuccess);
Expand All @@ -528,13 +529,14 @@ export class AddConnectionWizardComponent implements OnInit {
}

/**
* Updates the connection ensuring it is bound
* Updates the workspace connection, binds to serviceCatalogSource,
* and re-deploys the corresponding connection VDB to teiid.
* @param {Connection} connection the new connection
*/
private updateAndBindConnection(connection: NewConnection): void {
private updateDeployConnection(connection: NewConnection): void {
const self = this;
this.connectionService
.updateAndBindConnection(connection)
.updateDeployConnection(connection)
.subscribe(
(wasSuccess) => {
self.setFinalPageComplete(wasSuccess);
Expand Down
Expand Up @@ -10,6 +10,9 @@ import { MockConnectionService } from "@connections/shared/mock-connection.servi
import { AppSettingsService } from "@core/app-settings.service";
import { CoreModule } from "@core/core.module";
import { MockAppSettingsService } from "@core/mock-app-settings.service";
import { MockVdbService } from "@dataservices/shared/mock-vdb.service";
import { NotifierService } from "@dataservices/shared/notifier.service";
import { VdbService } from "@dataservices/shared/vdb.service";
import { WizardService } from "@dataservices/shared/wizard.service";
import { SharedModule } from "@shared/shared.module";
import { PatternFlyNgModule } from "patternfly-ng";
Expand All @@ -25,9 +28,11 @@ describe("AddConnectionComponent", () => {
declarations: [ AddConnectionComponent, AddConnectionWizardComponent,
ConnectionTypeCardComponent, ConnectionTypeCardsComponent ],
providers: [
NotifierService,
WizardService,
{ provide: AppSettingsService, useClass: MockAppSettingsService },
{ provide: ConnectionService, useClass: MockConnectionService },
{ provide: VdbService, useClass: MockVdbService }
]
})
.compileComponents().then(() => {
Expand Down
@@ -0,0 +1,23 @@
.card-toolbar .secondary-action[title="Activate"]:before {
color: var(--card-action-icon-color);
content: "\f1eb";
font-family: "FontAwesome";
}

.object-card .list-pf,
.object-card-selected .list-pf {
border: none;
}

.object-card .list-pf-item,
.object-card-selected .list-pf-item {
border: none;
}

.object-card .list-pf-item:hover {
background-color: transparent;
}

.object-card-selected .list-pf-item:hover {
background-color: transparent;
}
Expand Up @@ -11,17 +11,49 @@
(onActionSelect)="handleAction($event)">
</pfng-action>
</div>
<span class="pull-right fa pficon-connected card-action-icon"
(click)="onClick(pingEvent)"
<span class="pull-left fa fa-check-circle-o fa-2x card-action-icon"
style="color:green;"
*ngIf="connection.schemaActive"
data-toggle="tooltip"
data-placement="right"
title="Determine if accessible">
title="Active">
</span>
<span class="pull-right fa fa-edit card-action-icon"
<span class="pull-left fa fa-times-circle-o fa-2x card-action-icon"
style="color:red;"
*ngIf="connection.schemaFailed"
data-toggle="tooltip"
data-placement="right"
title="Failed to activate">
</span>
<span class="pull-left fa fa-exclamation-triangle fa-2x card-action-icon"
style="color:orange;"
*ngIf="connection.schemaInactive"
data-toggle="tooltip"
data-placement="right"
title="Inactive">
</span>
<span class="pull-left fa fa-times-circle-o fa-2x card-action-icon"
style="color:red;"
*ngIf="connection.schemaNotDeployed"
data-toggle="tooltip"
data-placement="right"
title="Inactive">
</span>
<span class="pull-left fa fa-spinner fa-pulse fa-2x card-action-icon"
*ngIf="connection.schemaLoading">
</span>
<span *ngIf="!connection.schemaLoading"
class="pull-right fa fa-edit card-action-icon"
(click)="onClick(editEvent)"
data-toggle="tooltip"
data-placement="right"
title="Edit properties">
title="Edit">
</span>
<span *ngIf="connection.schemaLoading"
class="pull-right fa fa-edit card-action-icon-disabled"
data-toggle="tooltip"
data-placement="right"
title="Edit">
</span>
</div>
<div class="row card-pf-title text-center object-card-title">
Expand Down
Expand Up @@ -29,12 +29,11 @@ import { Action, ActionConfig, CardAction, CardConfig, ListConfig } from "patter
})
export class ConnectionCardComponent implements DoCheck, OnInit {

public static readonly activateConnectionEvent = "activate";
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[];
Expand All @@ -46,7 +45,12 @@ export class ConnectionCardComponent implements DoCheck, OnInit {
public listConfig: ListConfig;
public showDetails = false;

private readonly activateActionId = "activate";
private readonly activateActionIndex = 0; // index in moreActions
private readonly deleteActionId = "delete";
private readonly deleteActionIndex = 1; // index in moreActions

private isLoading = false;
private logger: LoggerService;

constructor( logger: LoggerService ) {
Expand All @@ -62,7 +66,9 @@ export class ConnectionCardComponent implements DoCheck, OnInit {
* @param {Action} action the action that was selected.
*/
public handleAction( action: Action ): void {
if ( action.id === this.deleteActionId ) {
if ( action.id === this.activateActionId ) {
this.onClick( ConnectionCardComponent.activateConnectionEvent);
} else if ( action.id === this.deleteActionId ) {
this.onClick( ConnectionCardComponent.deleteConnectionEvent );
} else {
this.logger.error( "Action '" + action.id + "' not handled." );
Expand All @@ -77,6 +83,13 @@ export class ConnectionCardComponent implements DoCheck, OnInit {
}

public ngDoCheck(): void {
if ( this.isLoading !== this.connection.schemaLoading ) {
this.isLoading = this.connection.schemaLoading;

this.actionConfig.moreActions[ this.activateActionIndex ].disabled = this.isLoading;
this.actionConfig.moreActions[ this.deleteActionIndex ].disabled = this.isLoading;
}

this.cardConfig.action.iconStyleClass = this.detailsIconStyle;
}

Expand All @@ -88,11 +101,16 @@ export class ConnectionCardComponent implements DoCheck, OnInit {
primaryActions: [
],
moreActions: [
{
id: this.deleteActionId,
title: "Delete",
tooltip: "Delete the connection"
}
{
id: this.activateActionId,
title: "Activate",
tooltip: "Activate"
},
{
id: this.deleteActionId,
title: "Delete",
tooltip: "Delete"
}
]
} as ActionConfig;

Expand Down
Expand Up @@ -2,6 +2,7 @@ import { async, ComponentFixture, TestBed } from "@angular/core/testing";
import { RouterTestingModule } from "@angular/router/testing";
import { ConnectionCardComponent } from "@connections/connections-cards/connection-card/connection-card.component";
import { ConnectionsCardsComponent } from "@connections/connections-cards/connections-cards.component";
import { LoggerService } from "@core/logger.service";
import { PatternFlyNgModule } from "patternfly-ng";

describe("ConnectionsCardsComponent", () => {
Expand All @@ -11,7 +12,8 @@ describe("ConnectionsCardsComponent", () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [ PatternFlyNgModule, RouterTestingModule ],
declarations: [ ConnectionCardComponent, ConnectionsCardsComponent ]
declarations: [ ConnectionCardComponent, ConnectionsCardsComponent ],
providers: [ LoggerService ]
})
.compileComponents().then(() => {
// nothing to do
Expand Down
Expand Up @@ -18,6 +18,7 @@
import { Component, EventEmitter, Input, Output } from "@angular/core";
import { ConnectionCardComponent } from "@connections/connections-cards/connection-card/connection-card.component";
import { Connection } from "@connections/shared/connection.model";
import { LoggerService } from "@core/logger.service";

@Component({
moduleId: module.id,
Expand All @@ -32,15 +33,17 @@ export class ConnectionsCardsComponent {

@Output() public connectionSelected: EventEmitter<Connection> = new EventEmitter<Connection>();
@Output() public connectionDeselected: EventEmitter<Connection> = new EventEmitter<Connection>();
@Output() public activateConnection: EventEmitter<string> = new EventEmitter<string>();
@Output() public deleteConnection: EventEmitter<string> = new EventEmitter<string>();
@Output() public editConnection: EventEmitter<string> = new EventEmitter<string>();
@Output() public pingConnection: EventEmitter<string> = new EventEmitter<string>();

public logger: LoggerService;

/**
* Constructor.
* @param {LoggerService} logger the logging service
*/
constructor() {
// nothing to do
constructor( logger: LoggerService ) {
this.logger = logger;
}

public isSelected( connection: Connection ): boolean {
Expand All @@ -53,15 +56,14 @@ export class ConnectionsCardsComponent {
case ConnectionCardComponent.deleteConnectionEvent:
this.deleteConnection.emit( event.connectionName );
break;
case ConnectionCardComponent.activateConnectionEvent:
this.activateConnection.emit( event.connectionName );
break;
case ConnectionCardComponent.editConnectionEvent:
this.editConnection.emit( event.connectionName );
break;
case ConnectionCardComponent.pingConnectionEvent:
this.pingConnection.emit( event.connectionName );
break;
default:
// TODO log this
// this.logger.error( "Unhandled event type of '" + event.eventType + "'" );
this.logger.error( "Unhandled event type of '" + event.eventType + "'" );
break;
}
}
Expand Down
@@ -1,3 +1,10 @@
/* Adds an icon to the left of the activate action item in dropdown of kebab. */
.object-list .secondary-action[title*="Activate"]:before {
color: var(--card-action-icon-color);
content: "\f1eb";
font-family: "FontAwesome";
}

.connection-details-properties {
padding-left: 40px;
}

0 comments on commit aeb7ac8

Please sign in to comment.