toast errors and some styling

This commit is contained in:
Matt Hill
2021-07-13 23:43:39 -06:00
committed by Aiden McClelland
parent c2313b4eb3
commit 6bbe19aed7
43 changed files with 463 additions and 403 deletions

View File

@@ -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)

View 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
}
}
}