dialog.service.ts 929 Bytes
Newer Older
1 2 3 4 5
import { Injectable } from '@angular/core';
import { MatDialog, MatDialogRef } from '@angular/material/dialog';

import { ProfileComponent } from './profile/profile.component';
import { SshKeysComponent } from './ssh-keys/ssh-keys.component';
Lukas Burgey's avatar
Lukas Burgey committed
6
import { AccountComponent } from './account/account.component';
7 8 9 10 11

@Injectable()
export class DialogService {
  profileDialog: MatDialogRef<any>;
  sshKeysDialog: MatDialogRef<any>;
Lukas Burgey's avatar
Lukas Burgey committed
12 13 14 15 16
  accountDialog: MatDialogRef<any>;

  settings = {
    width: '80%',
  };
17 18 19 20 21 22 23 24

  constructor(
    public dialog: MatDialog,
  ) { }

  public openProfile() {
    this.profileDialog = this.dialog.open(
      ProfileComponent,
Lukas Burgey's avatar
Lukas Burgey committed
25
      this.settings,
26 27 28 29 30 31
    );
  }

  public openSshKeys() {
    this.sshKeysDialog = this.dialog.open(
      SshKeysComponent,
Lukas Burgey's avatar
Lukas Burgey committed
32
      this.settings,
33 34 35
    );
  }

Lukas Burgey's avatar
Lukas Burgey committed
36 37 38 39 40 41
  public openAccount() {
    this.accountDialog = this.dialog.open(
      AccountComponent,
      this.settings,
    );
  }
42
}