mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
toast errors and some styling
This commit is contained in:
committed by
Aiden McClelland
parent
c2313b4eb3
commit
6bbe19aed7
@@ -494,8 +494,6 @@ export class MockApiService extends ApiService {
|
||||
const url = `${registryURL}/sys/version/eos`
|
||||
let eos = await this.http.simpleGet(url)
|
||||
return (eos as any)
|
||||
await pauseFor(2000)
|
||||
return Mock.MarketplaceEos
|
||||
}
|
||||
|
||||
async getAvailableList (params: RR.GetAvailableListReq): Promise<RR.GetAvailableListRes> {
|
||||
@@ -515,7 +513,7 @@ export class MockApiService extends ApiService {
|
||||
await pauseFor(2000)
|
||||
return Mock.AvailableShow[params.id][params.version || 'latest']
|
||||
}
|
||||
const url = `${registryURL}/marketplace/available?id=${params.id}&version=${params.version || '1.3.0'}`
|
||||
const url = `${registryURL}/marketplace/available?id=${params.id}`
|
||||
let res = await this.http.simpleGet(url)
|
||||
console.log('res RES RES', res)
|
||||
return (res as any)
|
||||
|
||||
47
ui/src/app/services/error-toast.service.ts
Normal file
47
ui/src/app/services/error-toast.service.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { IonicSafeString, ToastController } from '@ionic/angular'
|
||||
import { ToastButton } from '@ionic/core'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ErrorToastService {
|
||||
private toast: HTMLIonToastElement
|
||||
|
||||
constructor (
|
||||
private readonly toastCtrl: ToastController,
|
||||
) { }
|
||||
|
||||
async present (message: string | IonicSafeString, link?: string): Promise<void> {
|
||||
if (this.toast) return
|
||||
|
||||
if (link) {
|
||||
message = new IonicSafeString(message + `<br /><br /><a href=${link} target="_blank" style="color: white;">Get Help</a>`)
|
||||
}
|
||||
|
||||
this.toast = await this.toastCtrl.create({
|
||||
header: 'Error',
|
||||
message,
|
||||
duration: 0,
|
||||
position: 'top',
|
||||
cssClass: 'error-toast',
|
||||
buttons: [
|
||||
{
|
||||
side: 'end',
|
||||
icon: 'close',
|
||||
handler: () => {
|
||||
this.dismiss()
|
||||
},
|
||||
},
|
||||
],
|
||||
})
|
||||
await this.toast.present()
|
||||
}
|
||||
|
||||
async dismiss (): Promise<void> {
|
||||
if (this.toast) {
|
||||
await this.toast.dismiss()
|
||||
this.toast = undefined
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user