diff --git a/ngapp/src/app/dataservices/add-dataservice-wizard/add-dataservice-wizard.component.html b/ngapp/src/app/dataservices/add-dataservice-wizard/add-dataservice-wizard.component.html
index ecc9b918..bd435d95 100644
--- a/ngapp/src/app/dataservices/add-dataservice-wizard/add-dataservice-wizard.component.html
+++ b/ngapp/src/app/dataservices/add-dataservice-wizard/add-dataservice-wizard.component.html
@@ -37,7 +37,7 @@
-
Creation failed
+
{{ finalPageTitle }}
- The dataservice creation failed!
+ {{ finalPageMessage }}
{{ errorDetails }}
diff --git a/ngapp/src/app/dataservices/add-dataservice-wizard/add-dataservice-wizard.component.ts b/ngapp/src/app/dataservices/add-dataservice-wizard/add-dataservice-wizard.component.ts
index c20c5b06..a54e1a9b 100644
--- a/ngapp/src/app/dataservices/add-dataservice-wizard/add-dataservice-wizard.component.ts
+++ b/ngapp/src/app/dataservices/add-dataservice-wizard/add-dataservice-wizard.component.ts
@@ -35,6 +35,7 @@ import { Table } from "@dataservices/shared/table.model";
import { VdbStatus } from "@dataservices/shared/vdb-status.model";
import { VdbService } from "@dataservices/shared/vdb.service";
import { VdbsConstants } from "@dataservices/shared/vdbs-constants";
+import { WizardService } from "@dataservices/shared/wizard.service";
import { LoadingState } from "@shared/loading-state.enum";
import { WizardComponent } from "patternfly-ng";
import { WizardEvent } from "patternfly-ng";
@@ -75,17 +76,21 @@ export class AddDataserviceWizardComponent implements OnInit, OnDestroy {
private dataserviceService: DataserviceService;
private notifierService: NotifierService;
private vdbService: VdbService;
+ private wizardService: WizardService;
private logger: LoggerService;
private router: Router;
private deploymentChangeSubscription: Subscription;
private sourceVdbUnderDeployment: string;
private errorDetailMessage: string;
+ private theFinalPageTitle = "";
+ private theFinalPageMessage = "";
- constructor(router: Router, dataserviceService: DataserviceService,
+ constructor(router: Router, dataserviceService: DataserviceService, wizardService: WizardService,
notifierService: NotifierService, logger: LoggerService, vdbService: VdbService ) {
this.dataserviceService = dataserviceService;
this.notifierService = notifierService;
this.vdbService = vdbService;
+ this.wizardService = wizardService;
this.router = router;
this.logger = logger;
@@ -113,7 +118,7 @@ export class AddDataserviceWizardComponent implements OnInit, OnDestroy {
this.step2Config = {
id: "step2",
priority: 0,
- title: "Review and Create",
+ title: this.step2Title,
allowClickNav: false
} as WizardStepConfig;
this.step2aConfig = {
@@ -125,20 +130,32 @@ export class AddDataserviceWizardComponent implements OnInit, OnDestroy {
this.step2bConfig = {
id: "step2b",
priority: 1,
- title: "Create",
+ title: this.step2bTitle,
allowClickNav: false
} as WizardStepConfig;
// Wizard Configuration
this.wizardConfig = {
embedInPage: true,
- loadingTitle: "Add Dataservice Wizard loading",
+ loadingTitle: "Dataservice Wizard loading",
loadingSecondaryInfo: "Please wait for the wizard to finish loading...",
- title: "Add Dataservice",
+ title: "Dataservice Wizard",
contentHeight: "500px",
done: false
} as WizardConfig;
+ if (this.wizardService.isEdit()) {
+ const selectedService = this.dataserviceService.getSelectedDataservice();
+ const dsName = selectedService.getId();
+ const dsDescr = selectedService.getDescription();
+ this.basicPropertyForm.controls["name"].setValue(dsName);
+ this.basicPropertyForm.controls["description"].setValue(dsDescr);
+ this.basicPropertyForm.get("name").disable();
+ this.basicPropertyForm.get("description").disable();
+ } else {
+ this.basicPropertyForm.controls["name"].setValue(null);
+ this.basicPropertyForm.controls["description"].setValue(null);
+ }
this.tableSelectorLoadingState = LoadingState.LOADING;
this.setNavAway(false);
}
@@ -151,6 +168,13 @@ export class AddDataserviceWizardComponent implements OnInit, OnDestroy {
// Public Methods
// ----------------
+ /**
+ * Determine if Dataservice is being edited.
+ */
+ public get isEdit( ): boolean {
+ return this.wizardService.isEdit();
+ }
+
/**
* Determine if table selector is loading
*/
@@ -185,6 +209,7 @@ export class AddDataserviceWizardComponent implements OnInit, OnDestroy {
} else { // name is valid
self.nameValidationError = "";
}
+ self.updatePage2aValidStatus();
},
( error ) => {
self.logger.error( "[handleNameChanged] Error: %o", error );
@@ -198,6 +223,22 @@ export class AddDataserviceWizardComponent implements OnInit, OnDestroy {
return this.nameValidationError == null || this.nameValidationError.length === 0;
}
+ /**
+ * Gets the Title to be displayed on the final wizard page
+ * @returns {string}
+ */
+ public get finalPageTitle(): string {
+ return this.theFinalPageTitle;
+ }
+
+ /**
+ * Gets the message to be displayed on the final wizard page
+ * @returns {string}
+ */
+ public get finalPageMessage(): string {
+ return this.theFinalPageMessage;
+ }
+
/*
* Step 1 instruction message
*/
@@ -210,9 +251,12 @@ export class AddDataserviceWizardComponent implements OnInit, OnDestroy {
}
/*
- * Step 3 instruction message
+ * Step 2 instruction message
*/
public get step2InstructionMessage(): string {
+ if (this.wizardService.isEdit()) {
+ return "Review selections. Click Update to update the Dataservice";
+ }
return "Review selections and enter a name. Click Create to create the Dataservice";
}
@@ -249,13 +293,10 @@ export class AddDataserviceWizardComponent implements OnInit, OnDestroy {
* using the currently entered properties
*/
public createDataservice(): void {
- this.createComplete = false;
- this.createSuccessful = false;
+ // Sets page in progress status
+ this.setFinalPageInProgress();
const sourceVdbName = this.tableSelector.getSelectedTables()[0].getConnection().getId() + VdbsConstants.SOURCE_VDB_SUFFIX;
-
- this.step2bConfig.nextEnabled = false;
- this.step2bConfig.previousEnabled = false;
this.sourceVdbUnderDeployment = sourceVdbName;
const self = this;
@@ -267,20 +308,14 @@ export class AddDataserviceWizardComponent implements OnInit, OnDestroy {
if (wasSuccess) {
self.vdbService.pollForActiveVdb(sourceVdbName, 30, 5);
} else {
- self.createComplete = true;
- self.createSuccessful = false;
- self.step2bConfig.nextEnabled = false;
- self.step2bConfig.previousEnabled = true;
+ self.setFinalPageComplete(false);
self.sourceVdbUnderDeployment = null;
}
},
(error) => {
self.logger.error("[AddDataserviceWizardComponent] Error: %o", error);
self.setErrorDetails(error);
- self.createComplete = true;
- self.createSuccessful = false;
- self.step2bConfig.nextEnabled = false;
- self.step2bConfig.previousEnabled = true;
+ self.setFinalPageComplete(false);
self.sourceVdbUnderDeployment = null;
}
);
@@ -326,12 +361,13 @@ export class AddDataserviceWizardComponent implements OnInit, OnDestroy {
const selectedVdbName = selectedConnectionName + VdbsConstants.SOURCE_VDB_SUFFIX;
if (selectedVdbName === status.getName()) {
if (status.isActive()) {
- this.createDataserviceForSingleTable();
+ if (this.wizardService.isEdit()) {
+ this.updateDataserviceForSingleTable();
+ } else {
+ this.createDataserviceForSingleTable();
+ }
} else if (status.isFailed()) {
- this.createComplete = true;
- this.createSuccessful = false;
- this.step2bConfig.nextEnabled = false;
- this.step2bConfig.previousEnabled = true;
+ this.setFinalPageComplete(false);
}
}
}
@@ -343,7 +379,11 @@ export class AddDataserviceWizardComponent implements OnInit, OnDestroy {
this.wizardConfig.nextTitle = "Next >";
} else if ($event.step.config.id === "step2a") {
this.updatePage2aValidStatus();
- this.wizardConfig.nextTitle = "Create";
+ if (this.wizardService.isEdit()) {
+ this.wizardConfig.nextTitle = "Update";
+ } else {
+ this.wizardConfig.nextTitle = "Create";
+ }
} else if ($event.step.config.id === "step2b") {
// Note: The next button is not disabled by default when wizard is done
this.step2Config.nextEnabled = false;
@@ -396,14 +436,21 @@ export class AddDataserviceWizardComponent implements OnInit, OnDestroy {
* Create the BasicProperty form (page 1)
*/
private createBasicPropertyForm(): void {
- this.basicPropertyForm = new FormGroup({
- name: new FormControl( "", this.handleNameChanged.bind( this ) ),
- description: new FormControl("")
- });
- // Responds to basic property changes - updates the page status
- this.basicPropertyForm.valueChanges.subscribe((val) => {
- this.updatePage2aValidStatus( );
- });
+ if (!this.wizardService.isEdit()) {
+ this.basicPropertyForm = new FormGroup({
+ name: new FormControl( "", this.handleNameChanged.bind( this ) ),
+ description: new FormControl("")
+ });
+ // Responds to basic property changes - updates the page status
+ this.basicPropertyForm.valueChanges.subscribe((val) => {
+ this.updatePage2aValidStatus( );
+ });
+ } else {
+ this.basicPropertyForm = new FormGroup({
+ name: new FormControl( "" ),
+ description: new FormControl("")
+ });
+ }
}
private setNavAway(allow: boolean): void {
@@ -411,7 +458,14 @@ export class AddDataserviceWizardComponent implements OnInit, OnDestroy {
}
private updatePage2aValidStatus( ): void {
- this.step2aConfig.nextEnabled = this.basicPropertyForm.valid;
+ if (!this.step2aConfig) {
+ return;
+ }
+ if (this.wizardService.isEdit()) {
+ this.step2aConfig.nextEnabled = true;
+ } else {
+ this.step2aConfig.nextEnabled = this.nameValid;
+ }
this.setNavAway(this.step2aConfig.nextEnabled);
}
@@ -431,30 +485,111 @@ export class AddDataserviceWizardComponent implements OnInit, OnDestroy {
.createDataserviceForSingleTable(dataservice, this.tableSelector.getSelectedTables()[0])
.subscribe(
(wasSuccess) => {
- // Deployment succeeded - wait for source vdb to become active
- if (wasSuccess) {
- self.createComplete = true;
- self.createSuccessful = true;
- self.step2bConfig.nextEnabled = false;
- this.step2bConfig.previousEnabled = true;
- } else {
- self.createComplete = true;
- self.createSuccessful = false;
- self.step2bConfig.nextEnabled = false;
- this.step2bConfig.previousEnabled = true;
- }
+ self.setFinalPageComplete(wasSuccess);
},
(error) => {
self.logger.error("[AddDataserviceWizardComponent] Error: %o", error);
self.setErrorDetails(error);
- self.createComplete = true;
- self.createSuccessful = false;
- self.step2bConfig.nextEnabled = false;
- this.step2bConfig.previousEnabled = true;
+ self.setFinalPageComplete(false);
}
);
}
+ /**
+ * Update the selected Dataservice for the selected source table. This is invoked
+ * only after the source VDB has successfully deployed.
+ */
+ private updateDataserviceForSingleTable(): void {
+ const dataservice: NewDataservice = new NewDataservice();
+
+ // Dataservice basic properties from step 1
+ dataservice.setId(this.dataserviceName);
+ dataservice.setDescription(this.dataserviceDescription);
+
+ const self = this;
+ this.dataserviceService
+ .updateDataserviceForSingleTable(dataservice, this.tableSelector.getSelectedTables()[0])
+ .subscribe(
+ (wasSuccess) => {
+ self.setFinalPageComplete(wasSuccess);
+ },
+ (error) => {
+ self.logger.error("[AddDataserviceWizardComponent] Error: %o", error);
+ self.setErrorDetails(error);
+ self.setFinalPageComplete(false);
+ }
+ );
+ }
+
+ /**
+ * Step 2 title - changes based on create or edit
+ * @returns {string} step 2 title
+ */
+ private get step2Title(): string {
+ if (this.wizardService.isEdit()) {
+ return "Review and Update";
+ } else {
+ return "Review and Create";
+ }
+ }
+
+ /**
+ * Step 2b title - changes based on create or edit
+ * @returns {string} step 2b title
+ */
+ private get step2bTitle(): string {
+ if (this.wizardService.isEdit()) {
+ return "Update";
+ } else {
+ return "Create";
+ }
+ }
+
+ /**
+ * Sets the final page in progress status
+ */
+ private setFinalPageInProgress(): void {
+ this.createComplete = false;
+ this.createSuccessful = false;
+ if (this.wizardService.isEdit()) {
+ this.theFinalPageTitle = "Update in progress";
+ this.theFinalPageMessage = "The dataservice is being updated.";
+ } else {
+ this.theFinalPageTitle = "Creation in progress";
+ this.theFinalPageMessage = "The dataservice is being created.";
+ }
+ this.step2bConfig.nextEnabled = false;
+ this.step2bConfig.previousEnabled = false;
+ }
+
+ /**
+ * Sets the final page completion status
+ * @param {boolean} wasSuccessful 'true' if the create or update was successful
+ */
+ private setFinalPageComplete(wasSuccessful: boolean): void {
+ this.createComplete = true;
+ this.createSuccessful = wasSuccessful;
+ this.step2bConfig.nextEnabled = false;
+ this.step2bConfig.previousEnabled = true;
+ if (wasSuccessful) {
+ if (this.wizardService.isEdit()) {
+ this.theFinalPageTitle = "Update was successful";
+ this.theFinalPageMessage = "The dataservice was updated successfully. Click on the button to see all dataservices.";
+ } else {
+ this.theFinalPageTitle = "Creation was successful";
+ this.theFinalPageMessage = "The dataservice was created successfully. Click on the button to see all dataservices.";
+ }
+ } else {
+ if (this.wizardService.isEdit()) {
+ this.theFinalPageTitle = "Update failed";
+ this.theFinalPageMessage = "The dataservice update failed!";
+ } else {
+ this.theFinalPageTitle = "Creation failed";
+ this.theFinalPageMessage = "The dataservice creation failed!";
+ }
+ }
+ }
+
/**
* Sets the error details for the response
* @param resp the rest call response
diff --git a/ngapp/src/app/dataservices/connection-table-selector/connection-table-selector.component.html b/ngapp/src/app/dataservices/connection-table-selector/connection-table-selector.component.html
index a7f6602d..cfd1d2db 100644
--- a/ngapp/src/app/dataservices/connection-table-selector/connection-table-selector.component.html
+++ b/ngapp/src/app/dataservices/connection-table-selector/connection-table-selector.component.html
@@ -1,8 +1,8 @@
-
+
-
+
Problem Loading Connections!
diff --git a/ngapp/src/app/dataservices/connection-table-selector/connection-table-selector.component.ts b/ngapp/src/app/dataservices/connection-table-selector/connection-table-selector.component.ts
index 7fec2393..ba8a4691 100644
--- a/ngapp/src/app/dataservices/connection-table-selector/connection-table-selector.component.ts
+++ b/ngapp/src/app/dataservices/connection-table-selector/connection-table-selector.component.ts
@@ -65,9 +65,6 @@ export class ConnectionTableSelectorComponent implements OnInit {
* Component initialization
*/
public ngOnInit(): void {
- // clears table selections
- this.wizardService.clearWizardSelectedTables();
-
// Load the connections
this.connectionLoadingState = LoadingState.LOADING;
const self = this;
@@ -215,6 +212,7 @@ export class ConnectionTableSelectorComponent implements OnInit {
const wasRemoved = this.wizardService.removeFromWizardSelectionTables(removedTable);
if (wasRemoved) {
this.selectedTableListUpdated.emit();
+ this.jdbcTableSelector.deselectTable(removedTable);
}
}
diff --git a/ngapp/src/app/dataservices/dataservices-cards/dataservices-cards.component.html b/ngapp/src/app/dataservices/dataservices-cards/dataservices-cards.component.html
index abbb8c05..ac4abb68 100644
--- a/ngapp/src/app/dataservices/dataservices-cards/dataservices-cards.component.html
+++ b/ngapp/src/app/dataservices/dataservices-cards/dataservices-cards.component.html
@@ -16,6 +16,8 @@
{{ dataservice.getId() }}
+
+
diff --git a/ngapp/src/app/dataservices/dataservices-cards/dataservices-cards.component.ts b/ngapp/src/app/dataservices/dataservices-cards/dataservices-cards.component.ts
index 95a7adcc..bc2a5876 100644
--- a/ngapp/src/app/dataservices/dataservices-cards/dataservices-cards.component.ts
+++ b/ngapp/src/app/dataservices/dataservices-cards/dataservices-cards.component.ts
@@ -35,6 +35,7 @@ export class DataservicesCardsComponent {
@Output() public testDataservice: EventEmitter = new EventEmitter();
@Output() public publishDataservice: EventEmitter = new EventEmitter();
@Output() public deleteDataservice: EventEmitter = new EventEmitter();
+ @Output() public editDataservice: EventEmitter = new EventEmitter();
@Output() public quickLookDataservice: EventEmitter = new EventEmitter();
/**
@@ -72,6 +73,10 @@ export class DataservicesCardsComponent {
this.deleteDataservice.emit(dataserviceName);
}
+ public onEditDataservice(dataserviceName: string): void {
+ this.editDataservice.emit(dataserviceName);
+ }
+
public onQuickLookDataservice(dataserviceName: string): void {
this.quickLookDataservice.emit(dataserviceName);
}
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 63c8249a..34ca4ea5 100644
--- a/ngapp/src/app/dataservices/dataservices-list/dataservices-list.component.html
+++ b/ngapp/src/app/dataservices/dataservices-list/dataservices-list.component.html
@@ -43,6 +43,8 @@
(click)="onTestDataservice(dataservice.getId())" [disabled]="!dataservice.serviceDeploymentActive">Test
+
diff --git a/ngapp/src/app/dataservices/dataservices-list/dataservices-list.component.ts b/ngapp/src/app/dataservices/dataservices-list/dataservices-list.component.ts
index 245b047e..a9cc3bd3 100644
--- a/ngapp/src/app/dataservices/dataservices-list/dataservices-list.component.ts
+++ b/ngapp/src/app/dataservices/dataservices-list/dataservices-list.component.ts
@@ -36,6 +36,7 @@ export class DataservicesListComponent {
@Output() public testDataservice: EventEmitter
= new EventEmitter();
@Output() public publishDataservice: EventEmitter = new EventEmitter();
@Output() public deleteDataservice: EventEmitter = new EventEmitter();
+ @Output() public editDataservice: EventEmitter = new EventEmitter();
@Output() public quickLookDataservice: EventEmitter = new EventEmitter();
private router: Router;
@@ -75,6 +76,10 @@ export class DataservicesListComponent {
this.deleteDataservice.emit(dataserviceName);
}
+ public onEditDataservice(dataserviceName: string): void {
+ this.editDataservice.emit(dataserviceName);
+ }
+
public onQuickLookDataservice(dataserviceName: string): void {
this.quickLookDataservice.emit(dataserviceName);
}
diff --git a/ngapp/src/app/dataservices/dataservices.component.html b/ngapp/src/app/dataservices/dataservices.component.html
index f03297e0..0dfc9be0 100644
--- a/ngapp/src/app/dataservices/dataservices.component.html
+++ b/ngapp/src/app/dataservices/dataservices.component.html
@@ -28,7 +28,7 @@ Dataservices
@@ -101,12 +101,12 @@
diff --git a/ngapp/src/app/dataservices/dataservices.component.spec.ts b/ngapp/src/app/dataservices/dataservices.component.spec.ts
index 82f42894..18e7dd36 100644
--- a/ngapp/src/app/dataservices/dataservices.component.spec.ts
+++ b/ngapp/src/app/dataservices/dataservices.component.spec.ts
@@ -13,6 +13,7 @@ import { MockDataserviceService } from "@dataservices/shared/mock-dataservice.se
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 { SqlControlComponent } from "@dataservices/sql-control/sql-control.component";
import { SharedModule } from "@shared/shared.module";
import { NgxDatatableModule } from "@swimlane/ngx-datatable";
@@ -32,6 +33,7 @@ describe("DataservicesComponent", () => {
providers: [
AppSettingsService,
NotifierService,
+ WizardService,
{ provide: VdbService, useClass: MockVdbService }
]
});
diff --git a/ngapp/src/app/dataservices/dataservices.component.ts b/ngapp/src/app/dataservices/dataservices.component.ts
index 08e3efe4..fa6acfe1 100644
--- a/ngapp/src/app/dataservices/dataservices.component.ts
+++ b/ngapp/src/app/dataservices/dataservices.component.ts
@@ -17,6 +17,7 @@
import { Component, ViewChild } from "@angular/core";
import { ActivatedRoute, Router } from "@angular/router";
+import { Connection } from "@connections/shared/connection.model";
import { AppSettingsService } from "@core/app-settings.service";
import { LoggerService } from "@core/logger.service";
import { ArrayUtils } from "@core/utils/array-utils";
@@ -25,7 +26,10 @@ import { DataserviceService } from "@dataservices/shared/dataservice.service";
import { DataservicesConstants } from "@dataservices/shared/dataservices-constants";
import { DeploymentState } from "@dataservices/shared/deployment-state.enum";
import { NotifierService } from "@dataservices/shared/notifier.service";
+import { Table } from "@dataservices/shared/table.model";
import { VdbService } from "@dataservices/shared/vdb.service";
+import { VdbsConstants } from "@dataservices/shared/vdbs-constants";
+import { WizardService } from "@dataservices/shared/wizard.service";
import { SqlControlComponent } from "@dataservices/sql-control/sql-control.component";
import { AbstractPageComponent } from "@shared/abstract-page.component";
import { ConfirmDeleteComponent } from "@shared/confirm-delete/confirm-delete.component";
@@ -43,7 +47,6 @@ import { Subscription } from "rxjs/Subscription";
})
export class DataservicesComponent extends AbstractPageComponent {
- public readonly addDataserviceLink: string = DataservicesConstants.addDataservicePath;
public readonly exportInProgressHeader: string = "Publishing: ";
public readonly exportSuccessHeader: string = "Publish Succeeded: ";
public readonly exportFailedHeader: string = "Publish Failed: ";
@@ -69,12 +72,13 @@ export class DataservicesComponent extends AbstractPageComponent {
private exportNotificationVisible = false;
private dataserviceStateSubscription: Subscription;
private notifierService: NotifierService;
+ private wizardService: WizardService;
@ViewChild(ConfirmDeleteComponent) private confirmDeleteDialog: ConfirmDeleteComponent;
@ViewChild(SqlControlComponent) private sqlControlComponent: SqlControlComponent;
constructor(router: Router, route: ActivatedRoute, dataserviceService: DataserviceService,
- logger: LoggerService, appSettingsService: AppSettingsService,
+ logger: LoggerService, appSettingsService: AppSettingsService, wizardService: WizardService,
notifierService: NotifierService, vdbService: VdbService ) {
super(route, logger);
this.router = router;
@@ -82,6 +86,7 @@ export class DataservicesComponent extends AbstractPageComponent {
this.dataserviceService = dataserviceService;
this.vdbService = vdbService;
this.notifierService = notifierService;
+ this.wizardService = wizardService;
// Register for dataservice state changes
this.dataserviceStateSubscription = this.notifierService.getDataserviceStateMap().subscribe((serviceStateMap) => {
this.onDataserviceStateChanged(serviceStateMap);
@@ -267,6 +272,10 @@ export class DataservicesComponent extends AbstractPageComponent {
);
}
+ /**
+ * Handle Delete of the specified Dataservice
+ * @param {string} svcName
+ */
public onDelete(svcName: string): void {
this.setQuickLookPanelOpenState(false);
@@ -274,6 +283,54 @@ export class DataservicesComponent extends AbstractPageComponent {
this.confirmDeleteDialog.open();
}
+ /**
+ * Handle request for new Dataservice
+ */
+ public onNew(): void {
+ this.wizardService.setEdit(false);
+ this.wizardService.clearWizardSelectedTables();
+
+ const link: string[] = [ DataservicesConstants.addDataservicePath ];
+ this.logger.log("[DataservicesPageComponent] Navigating to: %o", link);
+ this.router.navigate(link).then(() => {
+ // nothing to do
+ });
+ }
+
+ /**
+ * Handle Edit of the specified Dataservice
+ * @param {string} svcName
+ */
+ public onEdit(svcName: string): void {
+ const selectedService = this.filterDataservices().find((x) => x.getId() === svcName);
+ this.dataserviceService.setSelectedDataservice(selectedService);
+
+ this.setQuickLookPanelOpenState(false);
+
+ // Initialize the selected tables in the wizard service
+ this.wizardService.clearWizardSelectedTables();
+ const srcTables: string[] = selectedService.getServiceViewTables();
+ const selectedTables: Table[] = [];
+ for ( const tableStr of srcTables ) {
+ const subParts = tableStr.split(".");
+ const connectionName = subParts[0].replace(VdbsConstants.SOURCE_VDB_SUFFIX, "");
+ const tableName = subParts[1];
+ const conn: Connection = new Connection();
+ conn.setId(connectionName);
+ const table: Table = new Table();
+ table.setName(tableName);
+ table.setConnection(conn);
+ this.wizardService.addToWizardSelectionTables(table);
+ this.wizardService.setEdit(true);
+ }
+
+ const link: string[] = [ DataservicesConstants.addDataservicePath ];
+ this.logger.log("[DataservicesPageComponent] Navigating to: %o", link);
+ this.router.navigate(link).then(() => {
+ // nothing to do
+ });
+ }
+
/*
* Handle showing the QuickLook panel for the specified Dataservice
*/
diff --git a/ngapp/src/app/dataservices/jdbc-table-selector/jdbc-table-selector.component.ts b/ngapp/src/app/dataservices/jdbc-table-selector/jdbc-table-selector.component.ts
index f0ac6396..d11a0864 100644
--- a/ngapp/src/app/dataservices/jdbc-table-selector/jdbc-table-selector.component.ts
+++ b/ngapp/src/app/dataservices/jdbc-table-selector/jdbc-table-selector.component.ts
@@ -250,6 +250,23 @@ export class JdbcTableSelectorComponent implements OnInit, TableSelector {
}
}
+ /**
+ * Deselects the table if one with a matching name and connection is currently selected
+ * @param {Table} table
+ */
+ public deselectTable(table: Table): void {
+ const connName = table.getConnection().getId();
+ const tableName = table.getName();
+ for (const theTable of this.tables) {
+ const theConnName = theTable.getConnection().getId();
+ const theTableName = theTable.getName();
+ if (theConnName === connName && theTableName === tableName) {
+ theTable.selected = false;
+ break;
+ }
+ }
+ }
+
/*
* Builds the array of CatalogSchema items from the SchemaInfo coming from
* the Komodo rest call
@@ -319,15 +336,15 @@ export class JdbcTableSelectorComponent implements OnInit, TableSelector {
private setInitialTableSelections(): void {
for ( const table of this.tables ) {
// const catName = table.getCatalogName();
- const schemaName = table.getSchemaName();
+ // const schemaName = table.getSchemaName();
const tableName = table.getName();
const connName = table.getConnection().getId();
for ( const initialTable of this.wizardService.getWizardSelectedTables() ) {
// const iCatName = initialTable.getCatalogName();
- const iSchemaName = initialTable.getSchemaName();
+ // const iSchemaName = initialTable.getSchemaName();
const iTableName = initialTable.getName();
const iConnName = initialTable.getConnection().getId();
- if (iConnName === connName && iTableName === tableName && iSchemaName === schemaName ) {
+ if (iConnName === connName && iTableName === tableName ) {
table.selected = true;
break;
}
diff --git a/ngapp/src/app/dataservices/shared/dataservice.service.ts b/ngapp/src/app/dataservices/shared/dataservice.service.ts
index 4201f28c..35b396f2 100644
--- a/ngapp/src/app/dataservices/shared/dataservice.service.ts
+++ b/ngapp/src/app/dataservices/shared/dataservice.service.ts
@@ -274,6 +274,18 @@ export class DataserviceService extends ApiService {
.flatMap((res) => this.vdbService.deleteVdb(sourceVdbName));
}
+ /**
+ * Updates a dataservice with single table source. This is simply a create, with the added step of
+ * deleting the existing workspace dataservice first.
+ * @param {NewDataservice} dataservice
+ * @param {Table} sourceTable
+ * @returns {Observable
}
+ */
+ public updateDataserviceForSingleTable(dataservice: NewDataservice, sourceTable: Table): Observable {
+ return this.deleteDataservice(dataservice.getId())
+ .flatMap((res) => this.createDataserviceForSingleTable(dataservice, sourceTable));
+ }
+
/**
* Export a dataservice to a git repository
* @param {string} dataserviceName the dataservice name
diff --git a/ngapp/src/app/dataservices/shared/table-selector.ts b/ngapp/src/app/dataservices/shared/table-selector.ts
index 7be5a5cc..105cfea3 100644
--- a/ngapp/src/app/dataservices/shared/table-selector.ts
+++ b/ngapp/src/app/dataservices/shared/table-selector.ts
@@ -23,22 +23,28 @@ import { Table } from "@dataservices/shared/table.model";
*/
export interface TableSelector {
- /*
+ /**
* Set the connection for this jdbc table selector
* @param {Connection} conn the jdbc connection
*/
setConnection(conn: Connection): void;
- /*
+ /**
* Determine if any tables are currently selected
* @returns {boolean} true if one or more tables are selected
*/
hasSelectedTables( ): boolean;
- /*
+ /**
* Get the array of currently selected Tables
* @returns {Table[]} the array of selected Tables (never null, but may be empty)
*/
getSelectedTables(): Table[];
+ /**
+ * Deselect the table if a table with the same name and connection is currently selected.
+ * @param {Table} table the table to deselect
+ */
+ deselectTable(table: Table): void;
+
}
diff --git a/ngapp/src/app/dataservices/shared/wizard.service.ts b/ngapp/src/app/dataservices/shared/wizard.service.ts
index 474b938e..7520d058 100644
--- a/ngapp/src/app/dataservices/shared/wizard.service.ts
+++ b/ngapp/src/app/dataservices/shared/wizard.service.ts
@@ -5,11 +5,27 @@ import { Table } from "@dataservices/shared/table.model";
export class WizardService {
private wizardSelectedTablesArray: Table[] = [];
+ private edit = false;
constructor() {
// Nothing to do
}
+ /**
+ * Sets edit mode
+ * @param {boolean} isEdit 'true' if editing, 'false' if not.
+ */
+ public setEdit(isEdit: boolean): void {
+ this.edit = isEdit;
+ }
+
+ /**
+ * Gets the edit mode
+ * @returns {boolean} 'true' if editing, 'false' if not.
+ */
+ public isEdit(): boolean {
+ return this.edit;
+ }
/**
* Get the wizard table selections
* @returns {Table[]} the selections
diff --git a/ngapp/src/styles.css b/ngapp/src/styles.css
index 238cafe2..fb7f2e90 100644
--- a/ngapp/src/styles.css
+++ b/ngapp/src/styles.css
@@ -51,10 +51,7 @@
}
.datatable-body-cell {
- padding-bottom: 0.25em;
- padding-left: 1.0em;
- padding-right: 0.25em;
- padding-top: 0.25em;
+ padding: 0.25em 0.25em 0.25em 1.0em;
border-left: 1px solid #d8d8d8;
border-right: 1px solid #d8d8d8;
}