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

Commit

Permalink
Work on getting dataservice wizard working with local UI dev mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
elvisisking committed Mar 21, 2018
1 parent bea404d commit a104a6f
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 20 deletions.
Expand Up @@ -460,7 +460,6 @@ export class JdbcTableSelectorComponent implements OnInit, TableSelector {
* Handler for changes in table selection
*/
public selectedTableChanged( $event: TableEvent ): void {
console.error( $event );
const table: Table = $event.row;

if ( table ) {
Expand Down
6 changes: 5 additions & 1 deletion ngapp/src/app/dataservices/shared/dataservice.model.ts
Expand Up @@ -112,9 +112,13 @@ export class Dataservice implements Identifiable< string > {
}

/**
* @returns {string[]} the dataservice view names (can be null)
* @returns {string[]} the dataservice view names (never null or undefined)
*/
public getServiceViewNames(): string[] {
if ( this.serviceViews ) {
this.serviceViews = [];
}

return this.serviceViews;
}

Expand Down
57 changes: 42 additions & 15 deletions ngapp/src/app/dataservices/shared/mock-dataservice.service.ts
Expand Up @@ -73,6 +73,11 @@ export class MockDataserviceService extends DataserviceService {
* @returns {Observable<boolean>}
*/
public createDataservice(dataservice: NewDataservice): Observable<boolean> {
const ds = new Dataservice();
ds.setId( dataservice.getId() );
ds.setDescription( dataservice.getDescription() );

this.services.push( ds );
return Observable.of(true);
}

Expand Down Expand Up @@ -106,21 +111,6 @@ export class MockDataserviceService extends DataserviceService {
return tables;
}

// /**
// * Updates the current Dataservice states - triggers update to be broadcast to interested components
// */
// public updateDataserviceStates(): void {
// // Nothing to do
// }

// /**
// * Polls the server and sends Dataservice state updates at the specified interval
// * @param {number} pollIntervalSec the interval (sec) between polling attempts
// */
// public pollDataserviceStatus(pollIntervalSec: number): void {
// // Nothing to do
// }

/**
* Query a Dataservice via the komodo rest interface
* @param {string} query the SQL query
Expand All @@ -137,4 +127,41 @@ export class MockDataserviceService extends DataserviceService {
return Observable.throw(error);
}

public createReadonlyDataRole( dataserviceName: string,
model1Name: string ): Observable< boolean > {
return Observable.of( true );
}

public isValidName( name: string ): Observable<string> {
if ( !name || name.length === 0 ) {
return Observable.of( "Dataservice name cannot be empty" );
}

// make sure no dataservice exists with that name
for ( const ds of this.services ) {
if ( ds.getId() === name ) {
return Observable.of( "Dataservice with that name already exists" );
}
}

// just implement a case where no special characters allowed
for ( let i = 0; i < name.length; i++ ) {
const c = name.charAt( i );

// special characters have the same upper and lower case values
if ( c.toUpperCase() === c.toLowerCase() ) {
return Observable.of( "No special characters allowed" );
}
}

// valid
return Observable.of( "" );
}

public setServiceVdbForSingleSourceTables( dataserviceName: string,
tablePaths: string[],
modelSourcePath: string ): Observable< boolean > {
return Observable.of( true );
}

}
14 changes: 13 additions & 1 deletion ngapp/src/app/dataservices/shared/mock-vdb.service.ts
Expand Up @@ -160,7 +160,19 @@ export class MockVdbService extends VdbService {
* @param {number} pollIntervalSec the interval (sec) between polling attempts
*/
public pollForActiveVdb(vdbName: string, pollDurationSec: number, pollIntervalSec: number): void {
return;
const pollIntervalMillis = pollIntervalSec * 1000;
const timer = Observable.timer(1000, pollIntervalMillis);
this.deploymentSubscription = timer.subscribe(( t: any ) => {
const vdbStatus = new VdbStatus();
vdbStatus.setName( vdbName );
vdbStatus.setActive( true );
vdbStatus.setLoading( false );
vdbStatus.setFailed( false );

this.notifierService.sendVdbDeploymentStatus( vdbStatus );
this.deploymentSubscription.unsubscribe();
} );

}

/**
Expand Down
4 changes: 2 additions & 2 deletions ngapp/src/app/dataservices/shared/vdb.service.ts
Expand Up @@ -39,9 +39,9 @@ import { Subscription } from "rxjs/Subscription";
*/
export class VdbService extends ApiService {

protected deploymentSubscription: Subscription;
protected notifierService: NotifierService;
private http: Http;
private deploymentSubscription: Subscription;
private notifierService: NotifierService;

constructor(http: Http, appSettings: AppSettingsService,
notifierService: NotifierService, logger: LoggerService ) {
Expand Down

0 comments on commit a104a6f

Please sign in to comment.