]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/dashboard-help/dashboard-help.component.ts
5d212d6cac43b1ca1f20c5615876db635a9db0bd
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / core / navigation / dashboard-help / dashboard-help.component.ts
1 import { Component, OnInit, ViewChild } from '@angular/core';
2
3 import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';
4
5 import { Icons } from '../../../shared/enum/icons.enum';
6 import { AuthStorageService } from '../../../shared/services/auth-storage.service';
7 import { DocService } from '../../../shared/services/doc.service';
8 import { AboutComponent } from '../about/about.component';
9
10 @Component({
11 selector: 'cd-dashboard-help',
12 templateUrl: './dashboard-help.component.html',
13 styleUrls: ['./dashboard-help.component.scss']
14 })
15 export class DashboardHelpComponent implements OnInit {
16 @ViewChild('docsForm', { static: true })
17 docsFormElement: any;
18 docsUrl: string;
19 modalRef: BsModalRef;
20 icons = Icons;
21
22 constructor(
23 private modalService: BsModalService,
24 private authStorageService: AuthStorageService,
25 private docService: DocService
26 ) {}
27
28 ngOnInit() {
29 this.docService.subscribeOnce('dashboard', (url: string) => {
30 this.docsUrl = url;
31 });
32 }
33
34 openAboutModal() {
35 this.modalRef = this.modalService.show(AboutComponent);
36 this.modalRef.setClass('modal-lg');
37 }
38
39 goToApiDocs() {
40 const tokenInput = this.docsFormElement.nativeElement.children[0];
41 tokenInput.value = this.authStorageService.getToken();
42 this.docsFormElement.nativeElement.submit();
43 }
44 }