diff --git a/ngapp/src/app/connections/shared/connection.service.ts b/ngapp/src/app/connections/shared/connection.service.ts index 8d17c769..eb556449 100644 --- a/ngapp/src/app/connections/shared/connection.service.ts +++ b/ngapp/src/app/connections/shared/connection.service.ts @@ -183,16 +183,16 @@ export class ConnectionService extends ApiService { const connType2: ConnectionType = new ConnectionType(); connType2.setName(ConnectionsConstants.connectionType_mysql); connType2.setDescription(ConnectionsConstants.connectionTypeDescription_mysql); - // const connType3: ConnectionType = new ConnectionType(); - // connType3.setName(ConnectionsConstants.connectionType_mongodb); - // connType3.setDescription(ConnectionsConstants.connectionTypeDescription_mongodb); + const connType3: ConnectionType = new ConnectionType(); + connType3.setName(ConnectionsConstants.connectionType_mongodb); + connType3.setDescription(ConnectionsConstants.connectionTypeDescription_mongodb); // const connType4: ConnectionType = new ConnectionType(); // connType4.setName(ConnectionsConstants.connectionType_mariadb); // connType4.setDescription(ConnectionsConstants.connectionTypeDescription_mariadb); connectionTypes.push(connType1); connectionTypes.push(connType2); - // connectionTypes.push(connType3); + connectionTypes.push(connType3); // connectionTypes.push(connType4); return connectionTypes; 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 93faa448..82b98ba6 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 @@ -432,6 +432,8 @@ export class AddDataserviceWizardComponent implements OnInit, OnDestroy { // Dataservice basic properties from step 1 const dataservice: NewDataservice = this.dataserviceService.newDataserviceInstance(this.dataserviceName, this.dataserviceDescription); + // designate with wizard service that this dataservice is newly created. + this.wizardService.setNewlyAddedDataservice(this.dataserviceName); const self = this; this.dataserviceService .createDataserviceForSingleSourceTables(dataservice, this.tableSelector.getSelectedTables()) diff --git a/ngapp/src/app/dataservices/dataservices.component.ts b/ngapp/src/app/dataservices/dataservices.component.ts index d65f18e6..a474ffbb 100644 --- a/ngapp/src/app/dataservices/dataservices.component.ts +++ b/ngapp/src/app/dataservices/dataservices.component.ts @@ -64,7 +64,6 @@ export class DataservicesComponent extends AbstractPageComponent implements OnIn public readonly exportFailedHeader: string = "Publishing Failed: "; public readonly connectionsLoadedTag = "connections"; - public readonly downloadInProgressHeader: string = "Downloading: "; public readonly downloadSuccessHeader: string = "Download Succeeded: "; public readonly downloadFailedHeader: string = "Download Failed: "; @@ -702,6 +701,10 @@ export class DataservicesComponent extends AbstractPageComponent implements OnIn // For displayed dataservices, update the Deployment State using supplied services for ( const dService of this.filteredDataservices ) { const serviceId = dService.getId(); + // For newly added services, leave state alone until wait expires + if (serviceId === this.wizardService.getNewlyAddedDataservice()) { + continue; + } if (stateMap && stateMap.has(serviceId)) { dService.setServiceDeploymentState(stateMap.get(serviceId)); } diff --git a/ngapp/src/app/dataservices/shared/wizard.service.ts b/ngapp/src/app/dataservices/shared/wizard.service.ts index 075df3a6..e3c6c1bd 100644 --- a/ngapp/src/app/dataservices/shared/wizard.service.ts +++ b/ngapp/src/app/dataservices/shared/wizard.service.ts @@ -6,12 +6,16 @@ import { Dataservice } from "@dataservices/shared/dataservice.model"; @Injectable() export class WizardService { + private static newlyAddedServiceWaitMillis = 5000; // Wait of 5 sec + private selectedConnectionTables: ConnectionTable[] = []; private edit = false; private currentConnections: Connection[] = []; private selectedDataservice: Dataservice; private selectedConnection: Connection; private connectionForSchemaRegen = ""; + private newlyAddedDataservice = ""; + private newlyAddedDataserviceCreateTime = 0; constructor() { // Nothing to do @@ -172,6 +176,39 @@ export class WizardService { this.connectionForSchemaRegen = connectionName !== null ? connectionName : ""; } + /** + * Get name of a newly added dataservice. If the wait time after create has been exceeded, + * it is no longer considered a new service. + * @returns {string} the name of the newly added dataservice + */ + public getNewlyAddedDataservice(): string { + // New service not set - just return + if (this.newlyAddedDataservice.length === 0) { + return this.newlyAddedDataservice; + } + + // New service set - check wait time. If wait time expired, reset name. + const waitSinceCreate = Date.now() - this.newlyAddedDataserviceCreateTime; + if (waitSinceCreate > WizardService.newlyAddedServiceWaitMillis) { + this.newlyAddedDataservice = ""; + } + return this.newlyAddedDataservice; + } + + /** + * Set the name of a newly added service. + * @param {string} dataserviceName the name of the newly added dataservice + */ + public setNewlyAddedDataservice(dataserviceName: string): void { + // If non-empty name, set it the name and the creation time. + if (dataserviceName !== null && dataserviceName.length > 0) { + this.newlyAddedDataservice = dataserviceName; + this.newlyAddedDataserviceCreateTime = Date.now(); + } else { + this.newlyAddedDataservice = ""; + } + } + /** * Find index of the connection table in the wizard selected tables list. -1 if not found * @param {ConnectionTable} table connection table diff --git a/ngapp/src/app/shared/test-data.service.ts b/ngapp/src/app/shared/test-data.service.ts index 5495d51e..3e741c3a 100644 --- a/ngapp/src/app/shared/test-data.service.ts +++ b/ngapp/src/app/shared/test-data.service.ts @@ -40,6 +40,8 @@ export class TestDataService { private static readonly catalogSourceId1 = "postgresql-persistent-j9vqv"; private static readonly catalogSourceId2 = "postgresql-persistent-a8xrt"; private static readonly catalogSourceId3 = "mysql-persistent-t3irv"; + private static readonly catalogSourceId4 = "mongodb-persistent-x9prt"; + private static readonly catalogSourceId5 = "mongodb-persistent-z8amy"; // ================================================================= // VDBs @@ -191,6 +193,16 @@ export class TestDataService { TestDataService.catalogSourceId3, "mysql", true ); + private static catalogSourceMongo1 = TestDataService.createServiceCatalogSource( + TestDataService.catalogSourceId4, + TestDataService.catalogSourceId4, + "mongodb", + true ); + private static catalogSourceMongo2 = TestDataService.createServiceCatalogSource( + TestDataService.catalogSourceId5, + TestDataService.catalogSourceId5, + "mongodb", + true ); // ================================================================= // Connections @@ -906,7 +918,9 @@ export class TestDataService { TestDataService.pgConnCatalogSource, TestDataService.catalogSource1, TestDataService.catalogSource2, - TestDataService.catalogSource3]; + TestDataService.catalogSource3, + TestDataService.catalogSourceMongo1, + TestDataService.catalogSourceMongo2]; private connections: Connection[] = [ TestDataService.pgConn,