mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
ui: fix allowed statuses message
This commit is contained in:
committed by
Keagan McClelland
parent
9036c3ffed
commit
c440f637f3
@@ -59,20 +59,23 @@ export class AppActionsPage extends Cleanup {
|
|||||||
})
|
})
|
||||||
await alert.present()
|
await alert.present()
|
||||||
} else {
|
} else {
|
||||||
const joinStatuses = (statuses: AppStatus[]) => {
|
const statuses = [...action.allowedStatuses]
|
||||||
const last = statuses.pop()
|
const last = statuses.pop()
|
||||||
let s = statuses.join(', ')
|
let statusesStr = statuses.join(', ')
|
||||||
if (last) {
|
let error = null
|
||||||
if (statuses.length > 1) { // oxford comma
|
if (statuses.length) {
|
||||||
s += ','
|
if (statuses.length > 1) { // oxford comma
|
||||||
}
|
statusesStr += ','
|
||||||
s += ` or ${last}`
|
|
||||||
}
|
}
|
||||||
return s
|
statusesStr += ` or ${last}`
|
||||||
|
} else if (last) {
|
||||||
|
statusesStr = `${last}`
|
||||||
|
} else {
|
||||||
|
error = `There is state for which this action may be run. This is a bug. Please file an issue with the service maintainer.`
|
||||||
}
|
}
|
||||||
const alert = await this.alertCtrl.create({
|
const alert = await this.alertCtrl.create({
|
||||||
header: 'Forbidden',
|
header: 'Forbidden',
|
||||||
message: `Action "${action.name}" can only be executed when service is ${joinStatuses(action.allowedStatuses)}`,
|
message: error || `Action "${action.name}" can only be executed when service is ${statusesStr}`,
|
||||||
buttons: ['OK'],
|
buttons: ['OK'],
|
||||||
cssClass: 'alert-error-message',
|
cssClass: 'alert-error-message',
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user