]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/components/back-button/back-button.component.ts
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / components / back-button / back-button.component.ts
index 374099ea4043ee48e9bfa2ef68965f43566f7060..a578f03940273e2f679b0f199b2b82cabe58818a 100644 (file)
@@ -1,7 +1,7 @@
 import { Location } from '@angular/common';
-import { Component, Input } from '@angular/core';
+import { Component, EventEmitter, Input, Output } from '@angular/core';
 
-import { ActionLabelsI18n } from '../../constants/app.constants';
+import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
 
 @Component({
   selector: 'cd-back-button',
@@ -9,8 +9,16 @@ import { ActionLabelsI18n } from '../../constants/app.constants';
   styleUrls: ['./back-button.component.scss']
 })
 export class BackButtonComponent {
+  @Output() backAction = new EventEmitter();
+  @Input() name: string = this.actionLabels.CANCEL;
+
   constructor(private location: Location, private actionLabels: ActionLabelsI18n) {}
 
-  @Input() name: string = this.actionLabels.CANCEL;
-  @Input() back: Function = () => this.location.back();
+  back() {
+    if (this.backAction.observers.length === 0) {
+      this.location.back();
+    } else {
+      this.backAction.emit();
+    }
+  }
 }