From 468f210d59bb4684e8045ef6b0990039f5b3720d Mon Sep 17 00:00:00 2001 From: garrettmills Date: Tue, 13 Oct 2020 10:09:38 -0500 Subject: [PATCH] Add ability to name databases (#16) --- .../editor/database/database.component.html | 6 ++++++ .../components/editor/database/database.component.ts | 12 ++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/app/components/editor/database/database.component.html b/src/app/components/editor/database/database.component.html index b91edfe..e4e90b4 100644 --- a/src/app/components/editor/database/database.component.html +++ b/src/app/components/editor/database/database.component.html @@ -1,4 +1,10 @@
+  Manage Columns diff --git a/src/app/components/editor/database/database.component.ts b/src/app/components/editor/database/database.component.ts index 6b753ff..7afbe31 100644 --- a/src/app/components/editor/database/database.component.ts +++ b/src/app/components/editor/database/database.component.ts @@ -32,6 +32,7 @@ export class DatabaseComponent implements OnInit { public pendingSetup = true; public dirty = false; public lastClickRow = -1; + public dbName = ''; constructor( protected api: ApiService, @@ -182,8 +183,13 @@ export class DatabaseComponent implements OnInit { .subscribe(res => { this.rowData = res.data.map(x => x.RowData); this.agGridElement.api.setRowData(this.rowData); - this.dirty = false; - loader.dismiss(); + + this.api.post(`/db/${this.hostRecord.PageId}/${this.hostRecord.UUID}/set/${this.hostRecord.Value.Value}/name`, + { Name: this.dbName }) + .subscribe(resp => { + this.dirty = false; + loader.dismiss(); + }); }); }); }); @@ -249,6 +255,7 @@ export class DatabaseComponent implements OnInit { if ( !this.hostRecord.Value.Value && !this.readonly ) { this.api.post(`/db/${this.hostRecord.PageId}/${this.hostRecord.UUID}/create`).subscribe(res => { this.dbRecord = res.data; + this.dbName = res.data.Name; this.hostRecord.Value.Mode = 'database'; this.hostRecord.Value.Value = res.data.UUID; this.hostRecord.value = res.data.UUID; @@ -260,6 +267,7 @@ export class DatabaseComponent implements OnInit { } else { this.api.get(`/db/${this.hostRecord.PageId}/${this.hostRecord.UUID}/get/${this.hostRecord.Value.Value}`).subscribe(res => { this.dbRecord = res.data; + this.dbName = res.data.Name; this.pendingSetup = false; sub.next(true); sub.complete();