]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/components/back-button/back-button.component.ts
a578f03940273e2f679b0f199b2b82cabe58818a
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / components / back-button / back-button.component.ts
1 import { Location } from '@angular/common';
2 import { Component, EventEmitter, Input, Output } from '@angular/core';
3
4 import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
5
6 @Component({
7 selector: 'cd-back-button',
8 templateUrl: './back-button.component.html',
9 styleUrls: ['./back-button.component.scss']
10 })
11 export class BackButtonComponent {
12 @Output() backAction = new EventEmitter();
13 @Input() name: string = this.actionLabels.CANCEL;
14
15 constructor(private location: Location, private actionLabels: ActionLabelsI18n) {}
16
17 back() {
18 if (this.backAction.observers.length === 0) {
19 this.location.back();
20 } else {
21 this.backAction.emit();
22 }
23 }
24 }