]> git.proxmox.com Git - ceph.git/blame - ceph/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/dashboard-help/dashboard-help.component.ts
bump version to 15.2.4-pve1
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / core / navigation / dashboard-help / dashboard-help.component.ts
CommitLineData
11fdf7f2
TL
1import { Component, OnInit, ViewChild } from '@angular/core';
2
3import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';
4
9f95a23c 5import { Icons } from '../../../shared/enum/icons.enum';
11fdf7f2
TL
6import { CephReleaseNamePipe } from '../../../shared/pipes/ceph-release-name.pipe';
7import { AuthStorageService } from '../../../shared/services/auth-storage.service';
8import { SummaryService } from '../../../shared/services/summary.service';
9import { AboutComponent } from '../about/about.component';
10
11@Component({
12 selector: 'cd-dashboard-help',
13 templateUrl: './dashboard-help.component.html',
14 styleUrls: ['./dashboard-help.component.scss']
15})
16export class DashboardHelpComponent implements OnInit {
9f95a23c
TL
17 @ViewChild('docsForm', { static: true })
18 docsFormElement: any;
11fdf7f2
TL
19 docsUrl: string;
20 modalRef: BsModalRef;
9f95a23c 21 icons = Icons;
11fdf7f2
TL
22
23 constructor(
24 private summaryService: SummaryService,
25 private cephReleaseNamePipe: CephReleaseNamePipe,
26 private modalService: BsModalService,
27 private authStorageService: AuthStorageService
28 ) {}
29
30 ngOnInit() {
31 const subs = this.summaryService.subscribe((summary: any) => {
32 if (!summary) {
33 return;
34 }
35
36 const releaseName = this.cephReleaseNamePipe.transform(summary.version);
37 this.docsUrl = `http://docs.ceph.com/docs/${releaseName}/mgr/dashboard/`;
38
39 setTimeout(() => {
40 subs.unsubscribe();
41 }, 0);
42 });
43 }
44
45 openAboutModal() {
46 this.modalRef = this.modalService.show(AboutComponent);
9f95a23c 47 this.modalRef.setClass('modal-lg');
11fdf7f2
TL
48 }
49
50 goToApiDocs() {
51 const tokenInput = this.docsFormElement.nativeElement.children[0];
52 tokenInput.value = this.authStorageService.getToken();
53 this.docsFormElement.nativeElement.submit();
54 }
55}