summaryrefslogtreecommitdiffstats
path: root/usecaseui-portal/src/app/views/management/management.component.ts
diff options
context:
space:
mode:
authorcyuamber <xuranyjy@chinamobile.com>2020-04-28 11:01:42 +0800
committercyuamber <xuranyjy@chinamobile.com>2020-04-28 11:02:01 +0800
commit9f2baeca378ab8f465e07a1a09be2dba8f2a15aa (patch)
tree812d629afeafcceef366db57b85cd3dc9befa979 /usecaseui-portal/src/app/views/management/management.component.ts
parent46c4844ebb561c9f879c8fe74ce4d8a688eef486 (diff)
fix: Fix bugs reported after deleting all customers of management page
Change-Id: I6182cab33998860e4b53ace8b394655457f82170 Issue-ID: USECASEUI-305 Signed-off-by: cyuamber <xuranyjy@chinamobile.com>
Diffstat (limited to 'usecaseui-portal/src/app/views/management/management.component.ts')
-rw-r--r--usecaseui-portal/src/app/views/management/management.component.ts28
1 files changed, 18 insertions, 10 deletions
diff --git a/usecaseui-portal/src/app/views/management/management.component.ts b/usecaseui-portal/src/app/views/management/management.component.ts
index 727de636..75ce4de7 100644
--- a/usecaseui-portal/src/app/views/management/management.component.ts
+++ b/usecaseui-portal/src/app/views/management/management.component.ts
@@ -13,9 +13,10 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
-import { Component, OnInit, HostBinding } from '@angular/core'
-import { showHideAnimate, slideToRight } from '../../shared/utils/animates'
-import { ManagemencsService } from '../../core/services/managemencs.service'
+import { Component, OnInit, HostBinding } from '@angular/core';
+import { showHideAnimate, slideToRight } from '../../shared/utils/animates';
+import { ManagemencsService } from '../../core/services/managemencs.service';
+import {NzMessageService} from "ng-zorro-antd";
@Component({
selector: 'app-management',
@@ -26,10 +27,13 @@ import { ManagemencsService } from '../../core/services/managemencs.service'
export class ManagementComponent implements OnInit {
@HostBinding('@routerAnimate') routerAnimateState //Routing animation
- nocuster: boolean
- firstCustomer: string
+ nocuster: boolean = true;
+ firstCustomer: string = "";
- constructor (private managemencs: ManagemencsService) {}
+ constructor(
+ private managemencs: ManagemencsService,
+ private message: NzMessageService,
+ ) { }
ngOnInit () {
this.getAllCustomers()
@@ -38,7 +42,7 @@ export class ManagementComponent implements OnInit {
// Get all customers
getAllCustomers () {
this.managemencs.getAllCustomers().subscribe(data => {
- this.nocuster = data.length > 0 ? false : true
+ this.nocuster = data.length !== 0 ? false : true;
})
}
createNewCustomer (customer) {
@@ -51,13 +55,17 @@ export class ManagementComponent implements OnInit {
this.managemencs.createCustomer(customer, createParams).subscribe(data => {
if (data['status'] == 'SUCCESS') {
this.nocuster = false
- } else {
- this.nocuster = true
- console.log(data, 'Interface returned error')
+ } else {
+ this.nocuster = true;
+ this.clearCustomerInput();
+ this.message.error(data["errorMessage"]);
}
})
}
clearCustomerInput () {
this.firstCustomer = ''
}
+ closeCustomer(isClose){
+ this.nocuster = isClose;
+ }
}