mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-04 22:39:46 +00:00
* accordion works * cleanup * styling * more styling * App show change (#387) * show page change * no marketplace * app show changes * update marketplace list * icon * top left icon * toolbar * right size * out of toolbar * no service details * fix skeleton text and server metrics page * stuck * add session management * complete sessions feature * app show page * remove unnecessary icons * add cli to list of possible sessions * Modal global (#383) * modal checkpoint * global modal * black looks good now * black looks good now * not smaller Co-authored-by: Drew Ansbacher <drew.ansbacher@spiredigital.com> Co-authored-by: Drew Ansbacher <drew.ansbacher@spiredigital.com> Co-authored-by: Drew Ansbacher <drew.ansbacher@gmail.com> Co-authored-by: Drew Ansbacher <drew.ansbacher@spiredigital.com> Co-authored-by: Matt Hill <matthewonthemoon@gmail.com> Co-authored-by: Matt Hill <MattDHill@users.noreply.github.com>
90 lines
2.1 KiB
TypeScript
90 lines
2.1 KiB
TypeScript
import { Component } from '@angular/core'
|
|
import { ServerConfigService } from 'src/app/services/server-config.service'
|
|
import { AlertController, LoadingController } from '@ionic/angular'
|
|
import { SSHService } from './ssh.service'
|
|
import { Subscription } from 'rxjs'
|
|
import { SSHKeys } from 'src/app/services/api/api.types'
|
|
import { ErrorToastService } from 'src/app/services/error-toast.service'
|
|
|
|
@Component({
|
|
selector: 'ssh-keys',
|
|
templateUrl: 'ssh-keys.page.html',
|
|
styleUrls: ['ssh-keys.page.scss'],
|
|
})
|
|
export class SSHKeysPage {
|
|
loading = true
|
|
sshKeys: SSHKeys
|
|
subs: Subscription[] = []
|
|
|
|
constructor (
|
|
private readonly loadingCtrl: LoadingController,
|
|
private readonly errToast: ErrorToastService,
|
|
private readonly serverConfigService: ServerConfigService,
|
|
private readonly alertCtrl: AlertController,
|
|
private readonly sshService: SSHService,
|
|
) { }
|
|
|
|
async ngOnInit () {
|
|
this.subs = [
|
|
this.sshService.watch$()
|
|
.subscribe(keys => {
|
|
this.sshKeys = keys
|
|
}),
|
|
]
|
|
|
|
await this.sshService.getKeys()
|
|
|
|
this.loading = false
|
|
}
|
|
|
|
ngOnDestroy () {
|
|
this.subs.forEach(sub => sub.unsubscribe())
|
|
}
|
|
|
|
async presentModalAdd () {
|
|
await this.serverConfigService.presentModalValueEdit('ssh')
|
|
}
|
|
|
|
async presentAlertDelete (hash: string) {
|
|
const alert = await this.alertCtrl.create({
|
|
backdropDismiss: false,
|
|
header: 'Caution',
|
|
message: `Are you sure you want to delete this key?`,
|
|
buttons: [
|
|
{
|
|
text: 'Cancel',
|
|
role: 'cancel',
|
|
},
|
|
{
|
|
text: 'Delete',
|
|
handler: () => {
|
|
this.delete(hash)
|
|
},
|
|
},
|
|
],
|
|
})
|
|
await alert.present()
|
|
}
|
|
|
|
async delete (hash: string): Promise<void> {
|
|
const loader = await this.loadingCtrl.create({
|
|
spinner: 'lines',
|
|
message: 'Deleting...',
|
|
cssClass: 'loader',
|
|
})
|
|
await loader.present()
|
|
|
|
try {
|
|
await this.sshService.delete(hash)
|
|
} catch (e) {
|
|
this.errToast.present(e)
|
|
} finally {
|
|
loader.dismiss()
|
|
}
|
|
}
|
|
|
|
asIsOrder (a: any, b: any) {
|
|
return 0
|
|
}
|
|
}
|