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

Commit

Permalink
Initial commit of export and test features
Browse files Browse the repository at this point in the history
  • Loading branch information
mdrillin committed Nov 27, 2017
1 parent e9e867d commit 3a39f38
Show file tree
Hide file tree
Showing 36 changed files with 921 additions and 30 deletions.
4 changes: 2 additions & 2 deletions ngapp/locale/messages.es.xlf
Expand Up @@ -375,8 +375,8 @@
</context-group>
</trans-unit>
<trans-unit id="navHeader.beetleStudio" datatype="html">
<source>BeETLe Studio</source>
<target>BeETLE Studio</target>
<source>Beetle Studio</source>
<target>BeetlE Studio</target>
<context-group purpose="location">
<context context-type="sourcefile">src/app/core/nav-header/nav-header.component.ts</context>
<context context-type="linenumber">4</context>
Expand Down
2 changes: 1 addition & 1 deletion ngapp/messages.xlf
Expand Up @@ -257,7 +257,7 @@
</context-group>
</trans-unit>
<trans-unit id="navHeader.beetleStudio" datatype="html">
<source>BeETLe Studio</source>
<source>Beetle Studio</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/core/nav-header/nav-header.component.ts</context>
<context context-type="linenumber">4</context>
Expand Down
2 changes: 1 addition & 1 deletion ngapp/src/app/activities/activities.component.html
Expand Up @@ -9,7 +9,7 @@
<app-page-error [error]="pageError" *ngIf="pageError"></app-page-error>

<div class="container-fluid activity-list-activities" *ngIf="!pageError">
<div class="row">
<div class="col-sm-12">
<h2 i18n="@@activities.Activities" >Activities</h2>
</div>
<div class="row toolbar-pf">
Expand Down
Expand Up @@ -6,7 +6,7 @@
</app-breadcrumbs>
</div>
<div class="container-fluid" *ngIf="!pageError">
<div class="row">
<div class="col-sm-12">
<h2></h2>
</div>
<!-- Add Activity Wizard -->
Expand Down
Expand Up @@ -6,7 +6,7 @@
</app-breadcrumbs>
</div>
<div class="container-fluid" *ngIf="!pageError">
<div class="row">
<div class="col-sm-12">
<h2></h2>
</div>
<!-- Add Connection Wizard -->
Expand Down
2 changes: 1 addition & 1 deletion ngapp/src/app/connections/connections.component.html
Expand Up @@ -9,7 +9,7 @@
<app-page-error [error]="pageError" *ngIf="pageError"></app-page-error>

<div class="container-fluid connection-list-connections" *ngIf="!pageError">
<div class="row">
<div class="col-sm-12">
<h2 i18n="@@connections.connections">Connections</h2>
</div>
<div class="row toolbar-pf">
Expand Down
29 changes: 28 additions & 1 deletion ngapp/src/app/core/app-settings.service.ts
Expand Up @@ -20,14 +20,33 @@ import { Injectable } from "@angular/core";
@Injectable()
export class AppSettingsService {

// ** Dont change git keys - must match Komodo rest call parameters **
public readonly GIT_REPO_BRANCH_KEY = "repo-branch-property";
public readonly GIT_REPO_AUTHOR_NAME_KEY = "author-name-property";
public readonly GIT_REPO_AUTHOR_EMAIL_KEY = "author-email-property";
public readonly GIT_REPO_USERNAME_KEY = "repo-username-property";
public readonly GIT_REPO_PASSWORD_KEY = "repo-password-property";
public readonly GIT_REPO_PATH_KEY = "repo-path-property";
public readonly GIT_REPO_FILE_PATH_KEY = "file-path-property";

private readonly komodoRoot = "tko:komodo/tko:workspace";

// TODO: temporary location for user and password
private readonly komodoUser = "dsbUser";
private readonly komodoUserPassword = "1demo-user1";

// Map to maintain the target git repository properties
private readonly gitRepoProperties: Map<string, string>;

constructor() {
// Nothing to do
// TODO: The git repository properties will be picked up based on the Openshift install location
this.gitRepoProperties = new Map<string, string>();
this.gitRepoProperties.set(this.GIT_REPO_PATH_KEY, "https://github.com/GIT_USER/GIT_REPO");
this.gitRepoProperties.set(this.GIT_REPO_BRANCH_KEY, "master");
this.gitRepoProperties.set(this.GIT_REPO_USERNAME_KEY, "MY_USER");
this.gitRepoProperties.set(this.GIT_REPO_PASSWORD_KEY, "MY_PASS");
this.gitRepoProperties.set(this.GIT_REPO_AUTHOR_NAME_KEY, "MY_USER");
this.gitRepoProperties.set(this.GIT_REPO_AUTHOR_EMAIL_KEY, "USER@SOMEWHERE.COM");
}

/*
Expand All @@ -54,4 +73,12 @@ export class AppSettingsService {
return this.komodoUserPassword;
}

/*
* Get the git repository property for the supplied property key
* @returns {string} the git repository property
*/
public getGitRepoProperty(propertyKey: string): string {
return this.gitRepoProperties.get(propertyKey);
}

}
4 changes: 2 additions & 2 deletions ngapp/src/app/core/nav-header/nav-header.component.html
@@ -1,7 +1,7 @@
<nav class="navbar navbar-default navbar-pf" role="navigation">
<div class="navbar-header">
<a class="navbar-brand" href="" style="">
<div i18n="@@navHeader.beetleStudio" id="navbar-logo" class="navbar-brand-logo">BeETLe Studio</div>
<div i18n="@@navHeader.beetleStudio" id="navbar-logo" class="navbar-brand-logo">Beetle Studio</div>
</a>
</div>
<div class="collapse navbar-collapse navbar-collapse-1">
Expand Down Expand Up @@ -29,7 +29,7 @@
</button>
</div>
<div class="modal-body">
<h1 i18n="@@navHeader.beetleStudio">BeETLe Studio</h1>
<h1 i18n="@@navHeader.beetleStudio">Beetle Studio</h1>
<div class="product-versions-pf">
<table>
<tr>
Expand Down
Expand Up @@ -44,12 +44,14 @@ <h4>Dataservice Properties:</h4>
<label class="col-sm-2 control-label">Name:</label>
<label class="col-sm-10">{{ dataserviceName }}</label>
</div>
<!--
<div class="form-group">
<label class="col-sm-2 control-label">Connection:</label>
<label class="col-sm-5">{{ connectionName }}</label>
<label class="col-sm-2 control-label">Description:</label>
<label class="col-sm-10">{{ dataserviceDescription }}</label>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Source Tables:</label>
<label class="col-sm-5">{{ dataserviceSourceTables }}</label>
</div>
-->
</form>
</pfng-wizard-substep>
<!-- Step 3B: Create -->
Expand Down
Expand Up @@ -332,6 +332,21 @@ export class AddDataserviceWizardComponent implements OnInit {
return this.basicPropertyForm.controls["description"].value;
}

/**
* @returns {string} the selected source table names in string form
*/
public get dataserviceSourceTables(): string {
let tableStr = "None";
const tables = this.tableSelector.getSelectedTables();
if (tables.length > 0) {
tableStr = tables[0].getConnection().getId() + " [" + tables[0].getName() + "]";
}
if (tables.length === 2) {
tableStr = tableStr + ", " + tables[1].getConnection().getId() + " [" + tables[1].getName() + "]";
}
return tableStr;
}

public updatePage2ValidStatus( ): void {
this.step2Config.nextEnabled = this.tableSelector.valid();
this.setNavAway(this.step2Config.nextEnabled);
Expand Down
Expand Up @@ -6,7 +6,7 @@
</app-breadcrumbs>
</div>
<div class="container-fluid" *ngIf="!pageError">
<div class="row">
<div class="col-sm-12">
<h2></h2>
</div>
<!-- Add Dataservice Wizard -->
Expand Down
Expand Up @@ -16,10 +16,12 @@ <h2 class="dataservice-card-title">
<div>
<span>{{ dataservice.getDescription() }}</span>
</div>
<!--
<div>
<span><b i18n="@@dataservicesCards.Connection" >Connection:</b>&nbsp;&nbsp;{{ dataservice.getConnection().getName() }}</span>
<span class="fa fa-database"></span>
<span *ngIf="dataservice.getServiceViewTables().length==1">{{dataservice.getServiceViewTables()[0]}}</span>
<span *ngIf="dataservice.getServiceViewTables().length==2">{{dataservice.getServiceViewTables()[0]}}, {{dataservice.getServiceViewTables()[1]}}</span>
</div>
<!--
<div class="dataservice-tags" *ngIf="dataservice.tags && dataservice.tags.length > 0">
<span class="dataservice-tags-label">Tags:</span>
<span class="dataservice-tag" *ngFor="let tag of dataservice.tags" (click)="selectTag(tag, $event)">{{ tag }}</span>
Expand Down
Expand Up @@ -9,13 +9,15 @@
<div class="list-group-item-heading">
<a [routerLink]="[dataservice.getId()]">{{ dataservice.getId() }}</a>
</div>
<!--
<div class="list-group-item-text">{{ dataservice.description }}</div>
-->
<div class="list-group-item-text">
{{ dataservice.getDescription() }}
</div>
</div>
<div class="list-view-pf-additional-info">
<div>
<span>{{ dataservice.getDescription() }}</span>
<span class="fa fa-database"></span>
<span *ngIf="dataservice.getServiceViewTables().length==1">{{dataservice.getServiceViewTables()[0]}}</span>
<span *ngIf="dataservice.getServiceViewTables().length==2">{{dataservice.getServiceViewTables()[0]}}, {{dataservice.getServiceViewTables()[1]}}</span>
</div>
<!--
<div class="dataservice-tags" *ngIf="dataservice.tags && dataservice.tags.length > 0">
Expand Down
4 changes: 3 additions & 1 deletion ngapp/src/app/dataservices/dataservices-routing.module.ts
Expand Up @@ -21,10 +21,12 @@ import { Routes } from "@angular/router";
import { AddDataserviceComponent } from "@dataservices/add-dataservice/add-dataservice.component";
import { DataservicesComponent } from "@dataservices/dataservices.component";
import { DataservicesConstants } from "@dataservices/shared/dataservices-constants";
import { TestDataserviceComponent } from "@dataservices/test-dataservice/test-dataservice.component";

const dataservicesRoutes: Routes = [
{ path: DataservicesConstants.dataservicesRootRoute, component: DataservicesComponent },
{ path: DataservicesConstants.addDataserviceRoute, component: AddDataserviceComponent }
{ path: DataservicesConstants.addDataserviceRoute, component: AddDataserviceComponent },
{ path: DataservicesConstants.testDataserviceRoute, component: TestDataserviceComponent }
];

@NgModule({
Expand Down
11 changes: 10 additions & 1 deletion ngapp/src/app/dataservices/dataservices.component.html
Expand Up @@ -9,7 +9,7 @@
<app-page-error [error]="pageError" *ngIf="pageError"></app-page-error>

<div class="container-fluid dataservice-list-dataservices" *ngIf="!pageError">
<div class="row">
<div class="col-sm-12">
<h2 i18n="@@dataservices.dataservices">Dataservices</h2>
</div>
<div class="row toolbar-pf">
Expand Down Expand Up @@ -89,6 +89,14 @@ <h1 class="card-pf-title">

<!-- The list or card view -->
<div class="col-md-12" *ngIf="isLoaded('dataservices')">
<!-- Notification for Dataservice Export -->
<pfng-inline-notification [header]="exportNotificationHeader"
[message]="exportNotificationMessage"
[dismissable]="true"
[type]="exportNotificationType"
[hidden]="exportNotificationHidden">
</pfng-inline-notification>

<app-dataservices-list *ngIf="isListLayout" [dataservices]="filteredDataservices" [selectedDataservices]="selectedDataservices"
(testDataservice)="onTest($event)" (publishDataservice)="onPublish($event)" (deleteDataservice)="onDelete($event)"
(dataserviceSelected)="onSelected($event)" (dataserviceDeselected)="onDeselected($event)"></app-dataservices-list>
Expand All @@ -105,3 +113,4 @@ <h1 class="card-pf-title">
<app-confirm-delete (deleteSelected)="onDeleteDataservice()">
<p i18n="@@dataservices.doYouReallyWantToDeleteSelectedDataservice" >Do you really want to delete the selected Dataservice?</p>
</app-confirm-delete>

3 changes: 2 additions & 1 deletion ngapp/src/app/dataservices/dataservices.component.spec.ts
Expand Up @@ -13,14 +13,15 @@ import { MockVdbService } from "@dataservices/shared/mock-vdb.service";
import { VdbService } from "@dataservices/shared/vdb.service";
import { SharedModule } from "@shared/shared.module";
import { ModalModule } from "ngx-bootstrap";
import { PatternFlyNgModule } from "patternfly-ng";

describe("DataservicesComponent", () => {
let component: DataservicesComponent;
let fixture: ComponentFixture<DataservicesComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [ CoreModule, FormsModule, HttpModule, ModalModule.forRoot(), RouterTestingModule, SharedModule ],
imports: [ CoreModule, FormsModule, HttpModule, ModalModule.forRoot(), PatternFlyNgModule, RouterTestingModule, SharedModule ],
declarations: [ DataservicesComponent, DataservicesListComponent, DataservicesCardsComponent ],
providers: [
{ provide: VdbService, useClass: MockVdbService },
Expand Down
39 changes: 36 additions & 3 deletions ngapp/src/app/dataservices/dataservices.component.ts
Expand Up @@ -27,6 +27,7 @@ import { ConfirmDeleteComponent } from "@shared/confirm-delete/confirm-delete.co
import { IdFilter } from "@shared/id-filter";
import { LayoutType } from "@shared/layout-type.enum";
import { SortDirection } from "@shared/sort-direction.enum";
import { NotificationType } from "patternfly-ng";

@Component({
moduleId: module.id,
Expand All @@ -47,6 +48,10 @@ export class DataservicesComponent extends AbstractPageComponent {
private filter: IdFilter = new IdFilter();
private layout: LayoutType = LayoutType.CARD;
private sortDirection: SortDirection = SortDirection.ASC;
private exportNotificationHeader: string;
private exportNotificationMessage: string;
private exportNotificationType = NotificationType.SUCCESS;
private exportNotificationHidden = true;

@ViewChild(ConfirmDeleteComponent) private confirmDeleteDialog: ConfirmDeleteComponent;

Expand Down Expand Up @@ -134,11 +139,39 @@ export class DataservicesComponent extends AbstractPageComponent {
}

public onTest(svcName: string): void {
alert("Test Dataservice " + svcName);
const selectedService = this.filterDataservices().find((x) => x.getId() === svcName);
this.dataserviceService.setSelectedDataservice(selectedService);

const link: string[] = [ DataservicesConstants.testDataservicePath ];
this.logger.log("[DataservicesPageComponent] Navigating to: %o", link);
this.router.navigate(link).then(() => {
// nothing to do
});
}

public onPublish(svcName: string): void {
alert("Publish Dataservice " + svcName);
this.exportNotificationHeader = "Publishing: ";
this.exportNotificationMessage = "Publishing " + svcName + "...";
this.exportNotificationType = NotificationType.INFO;
this.exportNotificationHidden = false;
this.logger.log("[DataservicesPageComponent] Publishing Dataservice: " + svcName);
const self = this;
this.dataserviceService
.exportDataservice(svcName)
.subscribe(
(wasSuccess) => {
self.exportNotificationHeader = "Publish Succeeded: ";
self.exportNotificationMessage = " " + svcName + " was published successfully!";
self.exportNotificationType = NotificationType.SUCCESS;
this.logger.log("[DataservicesPageComponent] Publish Dataservice was successful");
},
(error) => {
self.exportNotificationHeader = "Publish Failed: ";
self.exportNotificationMessage = " Failed to publish dataservice " + svcName + "!";
self.exportNotificationType = NotificationType.DANGER;
this.logger.log("[DataservicesPageComponent] Publish Dataservice failed.");
}
);
}

public onDelete(svcName: string): void {
Expand Down Expand Up @@ -202,7 +235,7 @@ export class DataservicesComponent extends AbstractPageComponent {
(wasSuccess) => {
self.removeDataserviceFromList(selectedService);
const link: string[] = [ DataservicesConstants.dataservicesRootPath ];
self.logger.log("[CreateApiPageComponent] Navigating to: %o", link);
self.logger.log("[DataservicesPageComponent] Navigating to: %o", link);
self.router.navigate(link).then(() => {
// nothing to do
});
Expand Down
6 changes: 5 additions & 1 deletion ngapp/src/app/dataservices/dataservices.module.ts
Expand Up @@ -33,6 +33,8 @@ import { AddDataserviceWizardComponent } from "./add-dataservice-wizard/add-data
import { AddDataserviceComponent } from "./add-dataservice/add-dataservice.component";
import { ConnectionTableSelectorComponent } from "./connection-table-selector/connection-table-selector.component";
import { JdbcTableSelectorComponent } from "./jdbc-table-selector/jdbc-table-selector.component";
import { SqlControlComponent } from "./sql-control/sql-control.component";
import { TestDataserviceComponent } from "./test-dataservice/test-dataservice.component";

@NgModule({
imports: [
Expand All @@ -52,7 +54,9 @@ import { JdbcTableSelectorComponent } from "./jdbc-table-selector/jdbc-table-sel
AddDataserviceWizardComponent,
AddDataserviceComponent,
ConnectionTableSelectorComponent,
JdbcTableSelectorComponent
JdbcTableSelectorComponent,
TestDataserviceComponent,
SqlControlComponent
],
providers: [
DataserviceService,
Expand Down

0 comments on commit 3a39f38

Please sign in to comment.