From c4c391b68ed1a30b3b398c56efadf28b2f33388d Mon Sep 17 00:00:00 2001 From: cyuamber Date: Fri, 12 Jul 2019 18:17:09 +0800 Subject: feat: new changes for design module Change-Id: I0456755e02ce0e1e803b2e6508e943ae86ed4576 Signed-off-by: cyuamber Issue-ID: DCAEGEN2-1663 --- .../src/src/app/core/models/template.model.ts | 45 ++---- .../src/app/core/services/dashboard-api.service.ts | 35 ++-- .../edit-template-modal.component.html | 177 +++++++++++---------- .../edit-template-modal.component.ts | 69 +++++--- .../new-template-modal.component.html | 43 ++--- .../new-template-modal.component.ts | 60 ++++--- .../template-list/template-list.component.html | 26 +-- .../template-list/template-list.component.ts | 45 ++---- 8 files changed, 249 insertions(+), 251 deletions(-) diff --git a/components/datalake-handler/admin/src/src/app/core/models/template.model.ts b/components/datalake-handler/admin/src/src/app/core/models/template.model.ts index 0586cd85..af9ef3d9 100644 --- a/components/datalake-handler/admin/src/src/app/core/models/template.model.ts +++ b/components/datalake-handler/admin/src/src/app/core/models/template.model.ts @@ -13,41 +13,24 @@ See the License for the specific language governing permissions and limitations under the License. */ -// export class TemplateList { -// id:number; -// name:string; -// submitted:true; -// body: string; -// note:string; -// portalDesignConfig:{ -// id:number; -// name:string; -// submitted:true; -// body: string; -// note:string; -// topic: string; -// designType: string; -// } -// -// } export class Template { - id:number; - name:string; - submitted:boolean; - body: string; - note:string; - topic: string; - designType: string; - display:string; - } + id: number; + name: string; + submitted: boolean; + body: string; + note: string; + topicName: string; + designType: string; + designTypeName: string; +} export class newTemplate { - name:string; - submitted:boolean; + name: string; + submitted: boolean; body: string; - note:string; - topic: string; + note: string; + topicName: string; designType: string; - display:string; + designTypeName: string; } diff --git a/components/datalake-handler/admin/src/src/app/core/services/dashboard-api.service.ts b/components/datalake-handler/admin/src/src/app/core/services/dashboard-api.service.ts index 42b0ffdd..67bfb75e 100644 --- a/components/datalake-handler/admin/src/src/app/core/services/dashboard-api.service.ts +++ b/components/datalake-handler/admin/src/src/app/core/services/dashboard-api.service.ts @@ -13,13 +13,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -import {Injectable} from "@angular/core"; -import {HttpClient, HttpHeaders} from "@angular/common/http"; -import {Observable, of} from "rxjs"; -import {map, catchError, tap, retry} from "rxjs/operators"; -import {throwError} from "rxjs"; +import { Injectable } from "@angular/core"; +import { HttpClient, HttpHeaders } from "@angular/common/http"; +import { Observable, of } from "rxjs"; +import { map, catchError, tap, retry } from "rxjs/operators"; +import { throwError } from "rxjs"; -import {Template,newTemplate} from "src/app/core/models/template.model"; +import { Template, newTemplate } from "src/app/core/models/template.model"; import { Dashboard } from "src/app/core/models/dashboard.model"; const prefix = "/datalake/v1/"; @@ -54,7 +54,7 @@ export class DashboardApiService { } private extractData2(res: Response) { - console.log(res,"detele/deploy template"); + // console.log(res, "detele/deploy template"); let body = res; return body || {}; } @@ -73,7 +73,6 @@ export class DashboardApiService { } createUpadteDashboard(d: Dashboard): Observable { - console.log(d,"add or update dashboard body"); // let url = prefix +"/dashboard-list/successCreteOrEditDemo.json"; //local let url = prefix + "portals";//onilne return this.http @@ -86,10 +85,9 @@ export class DashboardApiService { } deleteDashboard(d: Dashboard): Observable { - console.log(d,"add dashboard body"); let url = prefix + "portals"; //onilne return this.http - .put(url,d) + .put(url, d) .pipe( retry(1), tap(_ => console.log(`deleted db name=${d.name}`)), @@ -111,7 +109,7 @@ export class DashboardApiService { Template */ getTemplateAll(): Observable { - return this.http.get(prefix + "portalDesigns/").pipe( //onlin + return this.http.get(prefix + "designs/").pipe( //onlin retry(1), map(this.extractData), catchError(this.handleError) @@ -119,9 +117,8 @@ export class DashboardApiService { } createNewTemplate(t: newTemplate): Observable { - console.log(t,"createNewTemplate"); return this.http - .post(prefix + "portalDesigns", t) + .post(prefix + "designs", t) .pipe( retry(1), tap(_ => this.extractData), @@ -131,9 +128,8 @@ export class DashboardApiService { updateNewTemplate(t: Template): Observable { let id = t.id; - console.log(id,t,"updateNewTemplate"); return this.http - .put(prefix + "portalDesigns/"+id, t) + .put(prefix + "designs/" + id, t) .pipe( retry(1), tap(_ => this.extractData), @@ -142,7 +138,7 @@ export class DashboardApiService { } getTopicName(): Observable { - return this.http.get(prefix + "topics").pipe( //onlin + return this.http.get(prefix + "topics").pipe( //onlin retry(1), map(this.extractData), catchError(this.handleError) @@ -150,7 +146,7 @@ export class DashboardApiService { } getTemplateTypeName(): Observable { - return this.http.get(prefix + "designTypes").pipe( //onlin + return this.http.get(prefix + "designTypes").pipe( //onlin retry(1), map(this.extractData), catchError(this.handleError) @@ -158,7 +154,7 @@ export class DashboardApiService { } DeleteTemplate(id): Observable { - return this.http.delete(prefix + "portalDesigns/" + id ).pipe( //online + return this.http.delete(prefix + "designs/" + id).pipe( //online retry(1), map(this.extractData2), catchError(this.handleError) @@ -166,8 +162,7 @@ export class DashboardApiService { } deployTemplateKibana(id, body): Observable { body.submitted = true; - console.log(id,body,'this.deployTemplateKibana()'); - return this.http.post(prefix+"portalDesigns/deploy/" + id, body).pipe( //online + return this.http.post(prefix + "designs/deploy/" + id, body).pipe( //online retry(1), map(this.extractData2), catchError(this.handleError) diff --git a/components/datalake-handler/admin/src/src/app/dashboard-setting/template/template-list/edit-template-modal/edit-template-modal.component.html b/components/datalake-handler/admin/src/src/app/dashboard-setting/template/template-list/edit-template-modal/edit-template-modal.component.html index a7657cf4..48cbc127 100644 --- a/components/datalake-handler/admin/src/src/app/dashboard-setting/template/template-list/edit-template-modal/edit-template-modal.component.html +++ b/components/datalake-handler/admin/src/src/app/dashboard-setting/template/template-list/edit-template-modal/edit-template-modal.component.html @@ -14,114 +14,117 @@ limitations under the License. -->
-