From 1c0db513e73c85ac48462fb96efbc95c8ce33912 Mon Sep 17 00:00:00 2001 From: cyuamber Date: Wed, 19 Jun 2019 10:43:56 +0800 Subject: DataLake DB module interface Function modification Change-Id: I79dd646cd760e2799a0dd2b03aaeab6de92c5cd3 Issue-ID: DCAEGEN2-1622 Signed-off-by: cyuamber --- .../src/src/app/core/services/rest-api.service.ts | 22 +-------- .../database-list/database-list.component.html | 54 ++-------------------- .../database-list/database-list.component.ts | 54 ++++++++-------------- .../dbs-modal/couchbase/couchbase.component.html | 30 ++++++++---- .../dbs-modal/couchbase/couchbase.component.ts | 2 +- .../dbs-modal/druid/druid.component.html | 48 ++++++++++++------- .../dbs-modal/druid/druid.component.ts | 2 +- .../elasticsearch/elasticsearch.component.html | 30 ++++++++---- .../elasticsearch/elasticsearch.component.ts | 2 +- .../dbs-modal/hdfs/hdfs.component.html | 30 ++++++++---- .../database-list/dbs-modal/hdfs/hdfs.component.ts | 2 +- .../dbs-modal/mongodb/mongodb.component.html | 30 ++++++++---- .../dbs-modal/mongodb/mongodb.component.ts | 2 +- .../datalake-handler/admin/src/src/styles.css | 12 +++-- 14 files changed, 158 insertions(+), 162 deletions(-) (limited to 'components/datalake-handler/admin') 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 b9134109..7eb5cf0c 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 @@ -162,20 +162,10 @@ export class RestApiService { catchError(this.handleError) ); } - - addDb(d: Db): Observable { - return this.http - .post(prefix + "dbs", JSON.stringify(d), httpOptions) - .pipe( - retry(1), - tap(_ => console.log(`add db name=${d.name}`)), - catchError(this.handleError) - ); - } - + upadteDb(d: Db): Observable { return this.http - .put(prefix + "dbs/" + d.name, JSON.stringify(d), httpOptions) + .put(prefix + "dbs", d) .pipe( retry(1), tap(_ => this.extractData), @@ -183,14 +173,6 @@ export class RestApiService { ); } - deleteDb(name: string): Observable { - return this.http.delete(prefix + "dbs/" + name, httpOptions).pipe( - retry(1), - tap(_ => console.log(`deleted db name=${name}`)), - catchError(this.handleError) - ); - } - /* Feeder */ diff --git a/components/datalake-handler/admin/src/src/app/database/database-list/database-list.component.html b/components/datalake-handler/admin/src/src/app/database/database-list/database-list.component.html index 8b71f529..829d6c62 100644 --- a/components/datalake-handler/admin/src/src/app/database/database-list/database-list.component.html +++ b/components/datalake-handler/admin/src/src/app/database/database-list/database-list.component.html @@ -21,21 +21,9 @@ limitations under the License.
-
+
- - -
- -
- -
-
-
- - -
-
-
- - -
-
-
diff --git a/components/datalake-handler/admin/src/src/app/database/database-list/database-list.component.ts b/components/datalake-handler/admin/src/src/app/database/database-list/database-list.component.ts index 13a6274a..556e9f97 100644 --- a/components/datalake-handler/admin/src/src/app/database/database-list/database-list.component.ts +++ b/components/datalake-handler/admin/src/src/app/database/database-list/database-list.component.ts @@ -134,31 +134,6 @@ export class DatabaseListComponent implements OnInit { }); } - deleteDb(name: string) { - const index = this.dbs.findIndex(d => d.name === name); - const modalRef = this.modalService.open(AlertComponent, { - size: "sm", - centered: true - }); - - modalRef.componentInstance.message = - 'Are you sure you want to delete " ' + name + '" ?'; - modalRef.componentInstance.passEntry.subscribe(receivedEntry => { - // Delete database - this.restApiService.deleteDb(name).subscribe( - res => { - this.dbs.splice(index, 1); - this.notificationService.success("Success deleted."); - modalRef.close(); - }, - err => { - this.notificationService.error(err); - modalRef.close(); - } - ); - }); - } - openDetailModal(name: string) { var modalRef, index; @@ -210,15 +185,20 @@ export class DatabaseListComponent implements OnInit { } else { modalRef.componentInstance.db = this.tempDbDetail; } - modalRef.componentInstance.passEntry.subscribe(receiveEntry => { this.tempDbDetail = receiveEntry; - if (index != -1) { - // Db name found, to update db + let enabled = receiveEntry.enabled; + console.log(this.tempDbDetail,"this.tempDbDetail"); + if(enabled == true){ this.restApiService.upadteDb(this.tempDbDetail).subscribe( res => { - this.dbs[index] = this.tempDbDetail; - this.notificationService.success("Success updated."); + console.log(res); + if (res.statusCode == 200) { + this.dbs[index] = this.tempDbDetail; + this.notificationService.success("SUCCESSFULLY_UPDATED"); + }else { + this.notificationService.error("FAILED_UPDATED"); + } modalRef.close(); }, err => { @@ -226,12 +206,16 @@ export class DatabaseListComponent implements OnInit { modalRef.close(); } ); - } else { - // Db name not found, to insert db - this.restApiService.addDb(this.tempDbDetail).subscribe( + }else { + this.restApiService.upadteDb(this.dbs[index]).subscribe( res => { - this.dbs.push(this.tempDbDetail); - this.notificationService.success("Success inserted."); + console.log(res); + if (res.statusCode == 200) { + this.dbs[index] = this.tempDbDetail; + this.notificationService.success("SUCCESSFULLY_DELETED"); + }else { + this.dbs[index].encrypt = true; + } modalRef.close(); }, err => { diff --git a/components/datalake-handler/admin/src/src/app/database/database-list/dbs-modal/couchbase/couchbase.component.html b/components/datalake-handler/admin/src/src/app/database/database-list/dbs-modal/couchbase/couchbase.component.html index d11ffd95..c67ab85c 100644 --- a/components/datalake-handler/admin/src/src/app/database/database-list/dbs-modal/couchbase/couchbase.component.html +++ b/components/datalake-handler/admin/src/src/app/database/database-list/dbs-modal/couchbase/couchbase.component.html @@ -24,6 +24,7 @@ limitations under the License.
+
@@ -63,7 +64,7 @@ limitations under the License.
+ placeholder="Default" (input)="this.adminService.onKeyPressNumber($event)">
@@ -85,18 +86,31 @@ limitations under the License.
-
+
-
+
+
+
+
+ +
+
+
+
+
+
+
-
diff --git a/components/datalake-handler/admin/src/src/app/database/database-list/dbs-modal/couchbase/couchbase.component.ts b/components/datalake-handler/admin/src/src/app/database/database-list/dbs-modal/couchbase/couchbase.component.ts index deee9a0e..5e11900b 100644 --- a/components/datalake-handler/admin/src/src/app/database/database-list/dbs-modal/couchbase/couchbase.component.ts +++ b/components/datalake-handler/admin/src/src/app/database/database-list/dbs-modal/couchbase/couchbase.component.ts @@ -49,7 +49,7 @@ export class CouchbaseComponent { this.tempDb = new Db(); const feed = { name: "Couchbase", - enabled: true, // TODO: enable + enabled: this.db.enabled, host: this.db.host, port: this.db.port, database: this.db.database, diff --git a/components/datalake-handler/admin/src/src/app/database/database-list/dbs-modal/druid/druid.component.html b/components/datalake-handler/admin/src/src/app/database/database-list/dbs-modal/druid/druid.component.html index 0f0de21d..5d5a38cf 100644 --- a/components/datalake-handler/admin/src/src/app/database/database-list/dbs-modal/druid/druid.component.html +++ b/components/datalake-handler/admin/src/src/app/database/database-list/dbs-modal/druid/druid.component.html @@ -24,6 +24,7 @@ limitations under the License.
+
@@ -38,15 +39,15 @@ limitations under the License. @@ -75,18 +76,31 @@ limitations under the License.
-
+
-
+
+
+
+
+ +
+
+
+
+
+
+
-
diff --git a/components/datalake-handler/admin/src/src/app/database/database-list/dbs-modal/hdfs/hdfs.component.ts b/components/datalake-handler/admin/src/src/app/database/database-list/dbs-modal/hdfs/hdfs.component.ts index 0ada4117..034e2902 100644 --- a/components/datalake-handler/admin/src/src/app/database/database-list/dbs-modal/hdfs/hdfs.component.ts +++ b/components/datalake-handler/admin/src/src/app/database/database-list/dbs-modal/hdfs/hdfs.component.ts @@ -49,7 +49,7 @@ export class HdfsComponent { this.tempDb = new Db(); const feed = { name: "HDFS", - enabled: true, // TODO: enable + enabled: this.db.enabled, host: this.db.host, port: this.db.port, database: this.db.database, diff --git a/components/datalake-handler/admin/src/src/app/database/database-list/dbs-modal/mongodb/mongodb.component.html b/components/datalake-handler/admin/src/src/app/database/database-list/dbs-modal/mongodb/mongodb.component.html index bda2b3a2..48dc0516 100644 --- a/components/datalake-handler/admin/src/src/app/database/database-list/dbs-modal/mongodb/mongodb.component.html +++ b/components/datalake-handler/admin/src/src/app/database/database-list/dbs-modal/mongodb/mongodb.component.html @@ -24,6 +24,7 @@ limitations under the License.
+
@@ -63,7 +64,7 @@ limitations under the License.
+ placeholder="Default" (input)="this.adminService.onKeyPressNumber($event)">
@@ -85,18 +86,31 @@ limitations under the License.
-
+
-
+
+
+
+
+ +
+
+
+
+
+
+
-
diff --git a/components/datalake-handler/admin/src/src/app/database/database-list/dbs-modal/mongodb/mongodb.component.ts b/components/datalake-handler/admin/src/src/app/database/database-list/dbs-modal/mongodb/mongodb.component.ts index 6f37f6a0..05a1526a 100644 --- a/components/datalake-handler/admin/src/src/app/database/database-list/dbs-modal/mongodb/mongodb.component.ts +++ b/components/datalake-handler/admin/src/src/app/database/database-list/dbs-modal/mongodb/mongodb.component.ts @@ -49,7 +49,7 @@ export class MongodbComponent { this.tempDb = new Db(); const feed = { name: "MongoDB", - enabled: true, // TODO: enable + enabled: this.db.enabled, host: this.db.host, port: this.db.port, database: this.db.database, diff --git a/components/datalake-handler/admin/src/src/styles.css b/components/datalake-handler/admin/src/src/styles.css index 8dcf761e..33af86db 100644 --- a/components/datalake-handler/admin/src/src/styles.css +++ b/components/datalake-handler/admin/src/src/styles.css @@ -540,15 +540,15 @@ hr { transition: 0.4s; } -input#switch:checked+.dl-slider { +input#switch:checked+.dl-slider,input#switchs:checked+.dl-slider { background-color: #5dbebb; } -input#switch:focus+.dl-slider { +input#switch:focus+.dl-slider,input#switchs:checked+.dl-slider { box-shadow: 0 0 1px #5dbebb; } -input#switch:checked+.dl-slider:before { +input#switch:checked+.dl-slider:before,input#switchs:checked+.dl-slider:before { -webkit-transform: translateX(26px); -ms-transform: translateX(26px); transform: translateX(26px); @@ -612,3 +612,9 @@ ngb-modal-window.templatess .modal-dialog-centered { float: right; cursor: pointer; } +.truecheck{ + color:#5DBEBB +} +.falsecheck{ + color:#BDBEC0 +} -- cgit 1.2.3-korg