mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 04:01:58 +00:00
Merge branch 'bugfix/misc' of github.com:Start9Labs/start-os into bugfix/misc
This commit is contained in:
@@ -20,6 +20,20 @@ import {
|
||||
import { getAllPackages, getManifest } from 'src/app/util/get-package-data'
|
||||
import { hasCurrentDeps } from 'src/app/util/has-deps'
|
||||
|
||||
const allowedStatuses = {
|
||||
onlyRunning: new Set(['running']),
|
||||
onlyStopped: new Set(['stopped']),
|
||||
any: new Set([
|
||||
'running',
|
||||
'stopped',
|
||||
'restarting',
|
||||
'restoring',
|
||||
'stopping',
|
||||
'starting',
|
||||
'backingUp',
|
||||
]),
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-actions',
|
||||
templateUrl: './app-actions.page.html',
|
||||
@@ -46,7 +60,10 @@ export class AppActionsPage {
|
||||
status: T.Status,
|
||||
action: { key: string; value: T.ActionMetadata },
|
||||
) {
|
||||
if (status && action.value.allowedStatuses.includes(status.main.status)) {
|
||||
if (
|
||||
status &&
|
||||
allowedStatuses[action.value.allowedStatuses].has(status.main.status)
|
||||
) {
|
||||
if (!isEmptyObject(action.value.input || {})) {
|
||||
this.formDialog.open(FormComponent, {
|
||||
label: action.value.name,
|
||||
@@ -84,7 +101,7 @@ export class AppActionsPage {
|
||||
await alert.present()
|
||||
}
|
||||
} else {
|
||||
const statuses = [...action.value.allowedStatuses]
|
||||
const statuses = [...allowedStatuses[action.value.allowedStatuses]]
|
||||
const last = statuses.pop()
|
||||
let statusesStr = statuses.join(', ')
|
||||
let error = ''
|
||||
|
||||
Reference in New Issue
Block a user