From: Ekko Chang Date: Thu, 6 Feb 2020 08:53:39 +0000 (+0000) Subject: Data exposure service management pages X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F20%2F101220%2F1;p=dcaegen2%2Fservices.git Data exposure service management pages Issue-ID: DCAEGEN2-1960 Signed-off-by: Ekko Chang Change-Id: I8f03f775210576cb3d8e9729b1154bc16149fae6 --- diff --git a/components/datalake-handler/admin/src/src/app/app-routing.module.ts b/components/datalake-handler/admin/src/src/app/app-routing.module.ts index e0484a4f..01e1ff4e 100644 --- a/components/datalake-handler/admin/src/src/app/app-routing.module.ts +++ b/components/datalake-handler/admin/src/src/app/app-routing.module.ts @@ -37,6 +37,7 @@ import { DatabaseComponent } from "./views/database/database.component"; import { AboutComponent } from "./views/about/about.component"; import { TemplateComponent } from "./views/dashboard-setting/template/template.component"; import { ToolsComponent } from "./views/tools/tools.component"; +import { DataExposureComponent } from "./views/data-exposure/data-exposure.component"; const routes: Routes = [ { path: "", redirectTo: "/feeder", pathMatch: "full" }, @@ -47,7 +48,8 @@ const routes: Routes = [ { path: "database", component: DatabaseComponent }, { path: "about", component: AboutComponent }, { path: "tools", component: ToolsComponent }, - { path: "dashboard-setting/template", component: TemplateComponent } + { path: "dashboard-setting/template", component: TemplateComponent }, + { path: "data-exposure", component: DataExposureComponent } ]; @NgModule({ diff --git a/components/datalake-handler/admin/src/src/app/app.module.ts b/components/datalake-handler/admin/src/src/app/app.module.ts index 94ce52e0..39db98cc 100644 --- a/components/datalake-handler/admin/src/src/app/app.module.ts +++ b/components/datalake-handler/admin/src/src/app/app.module.ts @@ -86,6 +86,8 @@ import { ModalComponent } from "./shared/modules/modal/modal.component"; import { ModalDirective } from "./shared/modules/modal/modal.directive"; import { ToastrNotificationComponent } from "./shared/components/toastr-notification/toastr-notification.component"; import { AlertComponent } from "./shared/components/alert/alert.component"; +import { DataExposureComponent } from "./views/data-exposure/data-exposure.component"; +import { DeModalComponent } from "./views/data-exposure/de-modal/de-modal.component"; // Others @@ -123,7 +125,9 @@ import { AlertComponent } from "./shared/components/alert/alert.component"; KafkaModalComponent, DbModalComponent, ToolModalComponent, - TemplateModalComponent + TemplateModalComponent, + DataExposureComponent, + DeModalComponent ], imports: [ BrowserModule, @@ -156,7 +160,8 @@ import { AlertComponent } from "./shared/components/alert/alert.component"; KafkaModalComponent, DbModalComponent, ToolModalComponent, - TemplateModalComponent + TemplateModalComponent, + DeModalComponent ] }) export class AppModule {} diff --git a/components/datalake-handler/admin/src/src/app/core/models/data-service.model.ts b/components/datalake-handler/admin/src/src/app/core/models/data-service.model.ts new file mode 100644 index 00000000..106a4226 --- /dev/null +++ b/components/datalake-handler/admin/src/src/app/core/models/data-service.model.ts @@ -0,0 +1,32 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : DataLake + * ================================================================================ + * Copyright 2020 QCT + *================================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + * + * @author Ekko Chang + * + */ + +export class DataService { + public id: string; + public note: string; + public sqlTemplate: string; + public dbId: number; +} diff --git a/components/datalake-handler/admin/src/src/app/core/services/rest-api.service.ts b/components/datalake-handler/admin/src/src/app/core/services/rest-api.service.ts index d1dcd63e..6548c07f 100644 --- a/components/datalake-handler/admin/src/src/app/core/services/rest-api.service.ts +++ b/components/datalake-handler/admin/src/src/app/core/services/rest-api.service.ts @@ -36,6 +36,7 @@ import { Db, DbType } from "src/app/core/models/db.model"; import { Template } from "src/app/core/models/template.model"; import { Dashboard } from "src/app/core/models/dashboard.model"; import { Kafka } from "../models/kafka.model"; +import { DataService } from "src/app/core/models/data-service.model"; const prefix = "/datalake/v1/"; const httpOptions = { @@ -366,4 +367,45 @@ export class RestApiService { catchError(this.handleError) ); } + + /* + Dataexposure service + */ + public getAllDataService(): Observable { + return this.http + .get(prefix + "exposure") + .pipe(retry(1), catchError(this.handleError)); + } + + public getDataService(id: string): Observable { + return this.http + .get(prefix + "exposure/" + id) + .pipe(retry(1), catchError(this.handleError)); + } + + public updateDataService(ds: DataService): Observable { + return this.http + .put(prefix + "exposure/" + ds.id, ds) + .pipe( + retry(1), + tap(_ => this.extractData), + catchError(this.handleError) + ); + } + + public addDataService(ds: DataService): Observable { + return this.http.post(prefix + "exposure", ds).pipe( + retry(1), + tap(_ => console.log(`add service =${ds.id}`)), + catchError(this.handleError) + ); + } + + public deleteDataService(id: string): Observable { + return this.http.delete(prefix + "exposure/" + id).pipe( + retry(1), + tap(_ => console.log(`deleted service=${id}`)), + catchError(this.handleError) + ); + } } diff --git a/components/datalake-handler/admin/src/src/app/shared/layout/sidebar/sidebar.component.html b/components/datalake-handler/admin/src/src/app/shared/layout/sidebar/sidebar.component.html index a0ed00c4..e4cf9620 100644 --- a/components/datalake-handler/admin/src/src/app/shared/layout/sidebar/sidebar.component.html +++ b/components/datalake-handler/admin/src/src/app/shared/layout/sidebar/sidebar.component.html @@ -36,7 +36,7 @@ limitations under the License. +