2021-06-25 21:55:40 +02:00
|
|
|
import { Component } from '@angular/core'
|
|
|
|
|
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
|
|
|
|
|
import { AppConnectorService } from '../services/appConnector.service'
|
|
|
|
|
import { ConfigService } from '../services/config.service'
|
2021-07-11 16:13:18 +02:00
|
|
|
import { faCopy, faFile, faPlus, faTrash } from '@fortawesome/free-solid-svg-icons'
|
|
|
|
|
import { Config, Version } from '../api'
|
2021-06-25 21:55:40 +02:00
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'config-modal',
|
|
|
|
|
templateUrl: './configModal.component.pug',
|
|
|
|
|
// styleUrls: ['./settingsModal.component.scss'],
|
|
|
|
|
})
|
|
|
|
|
export class ConfigModalComponent {
|
|
|
|
|
_addIcon = faPlus
|
2021-07-11 16:13:18 +02:00
|
|
|
_copyIcon = faCopy
|
|
|
|
|
_deleteIcon = faTrash
|
|
|
|
|
_configIcon = faFile
|
2021-06-25 21:55:40 +02:00
|
|
|
|
|
|
|
|
constructor (
|
|
|
|
|
private modalInstance: NgbActiveModal,
|
|
|
|
|
public appConnector: AppConnectorService,
|
|
|
|
|
public configService: ConfigService,
|
|
|
|
|
) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async ngOnInit () {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cancel () {
|
|
|
|
|
this.modalInstance.dismiss()
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-11 16:13:18 +02:00
|
|
|
async createNewConfig () {
|
|
|
|
|
const config = await this.configService.createNewConfig()
|
|
|
|
|
await this.configService.selectConfig(config)
|
|
|
|
|
this.modalInstance.dismiss()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async selectConfig (config: Config) {
|
|
|
|
|
await this.configService.selectConfig(config)
|
|
|
|
|
this.modalInstance.dismiss()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async selectVersion (version: Version) {
|
|
|
|
|
await this.configService.selectVersion(version)
|
|
|
|
|
this.modalInstance.dismiss()
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-25 21:55:40 +02:00
|
|
|
}
|