Files
tabby-web/frontend/src/components/settingsModal.component.ts

44 lines
1.2 KiB
TypeScript
Raw Normal View History

2021-06-25 21:55:40 +02:00
import { Component } from '@angular/core'
import { LoginService } from '../services/login.service'
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
import { User } from '../api'
2021-07-11 16:13:18 +02:00
import { AppConnectorService } from '../services/appConnector.service'
2021-07-22 21:34:05 +02:00
import { faGithub } from '@fortawesome/free-brands-svg-icons'
2021-07-24 15:48:12 +02:00
import { faCheck, faCopy } from '@fortawesome/free-solid-svg-icons'
2021-06-25 21:55:40 +02:00
@Component({
selector: 'settings-modal',
templateUrl: './settingsModal.component.pug',
// styleUrls: ['./settingsModal.component.scss'],
})
export class SettingsModalComponent {
user: User
customGatewayEnabled = false
2021-07-22 21:34:05 +02:00
_githubIcon = faGithub
2021-07-24 15:48:12 +02:00
_copyIcon = faCopy
_okIcon = faCheck
2021-06-25 21:55:40 +02:00
constructor (
2021-07-11 16:13:18 +02:00
public appConnector: AppConnectorService,
2021-06-25 21:55:40 +02:00
private modalInstance: NgbActiveModal,
private loginService: LoginService,
) {
this.user = { ...loginService.user }
this.customGatewayEnabled = !!this.user.custom_connection_gateway
}
async ngOnInit () {
}
async apply () {
Object.assign(this.loginService.user, this.user)
this.modalInstance.close()
await this.loginService.updateUser()
}
cancel () {
this.modalInstance.dismiss()
}
}