@@ -24,7 +24,8 @@ export type ButtonMapping = {
24
24
}
25
25
26
26
interface WorkspaceAbilities {
27
- actions : ButtonTypesEnum [ ]
27
+ primaryActions : ButtonTypesEnum [ ]
28
+ secondaryActions ?: ButtonTypesEnum [ ]
28
29
canCancel : boolean
29
30
canAcceptJobs : boolean
30
31
}
@@ -35,80 +36,68 @@ export const buttonAbilities = (
35
36
return statusToAbilities [ status ]
36
37
}
37
38
39
+ const defaultSecondaryActions = [
40
+ ButtonTypesEnum . settings ,
41
+ ButtonTypesEnum . changeVersion ,
42
+ ButtonTypesEnum . delete ,
43
+ ]
44
+
38
45
const statusToAbilities : Record < WorkspaceStatus , WorkspaceAbilities > = {
39
46
starting : {
40
- actions : [ ButtonTypesEnum . starting ] ,
47
+ primaryActions : [ ButtonTypesEnum . starting ] ,
41
48
canCancel : true ,
42
49
canAcceptJobs : false ,
43
50
} ,
44
51
running : {
45
- actions : [
46
- ButtonTypesEnum . stop ,
47
- ButtonTypesEnum . settings ,
48
- ButtonTypesEnum . changeVersion ,
49
- ButtonTypesEnum . delete ,
50
- ] ,
52
+ primaryActions : [ ButtonTypesEnum . stop ] ,
53
+ secondaryActions : defaultSecondaryActions ,
51
54
canCancel : false ,
52
55
canAcceptJobs : true ,
53
56
} ,
54
57
stopping : {
55
- actions : [ ButtonTypesEnum . stopping ] ,
58
+ primaryActions : [ ButtonTypesEnum . stopping ] ,
56
59
canCancel : true ,
57
60
canAcceptJobs : false ,
58
61
} ,
59
62
stopped : {
60
- actions : [
61
- ButtonTypesEnum . start ,
62
- ButtonTypesEnum . settings ,
63
- ButtonTypesEnum . changeVersion ,
64
- ButtonTypesEnum . delete ,
65
- ] ,
63
+ primaryActions : [ ButtonTypesEnum . start ] ,
64
+ secondaryActions : defaultSecondaryActions ,
66
65
canCancel : false ,
67
66
canAcceptJobs : true ,
68
67
} ,
69
68
canceled : {
70
- actions : [
71
- ButtonTypesEnum . start ,
72
- ButtonTypesEnum . stop ,
73
- ButtonTypesEnum . settings ,
74
- ButtonTypesEnum . changeVersion ,
75
- ButtonTypesEnum . delete ,
76
- ] ,
69
+ primaryActions : [ ButtonTypesEnum . start , ButtonTypesEnum . stop ] ,
70
+ secondaryActions : defaultSecondaryActions ,
77
71
canCancel : false ,
78
72
canAcceptJobs : true ,
79
73
} ,
80
74
// in the case of an error
81
75
failed : {
82
- actions : [
83
- ButtonTypesEnum . start ,
84
- ButtonTypesEnum . stop ,
85
- ButtonTypesEnum . settings ,
86
- ButtonTypesEnum . changeVersion ,
87
- ButtonTypesEnum . delete ,
88
- ] ,
76
+ primaryActions : [ ButtonTypesEnum . start , ButtonTypesEnum . stop ] ,
77
+ secondaryActions : defaultSecondaryActions ,
89
78
canCancel : false ,
90
79
canAcceptJobs : true ,
91
80
} ,
92
81
/**
93
82
* disabled states
94
83
*/
95
84
canceling : {
96
- actions : [ ButtonTypesEnum . canceling ] ,
85
+ primaryActions : [ ButtonTypesEnum . canceling ] ,
97
86
canCancel : false ,
98
87
canAcceptJobs : false ,
99
88
} ,
100
89
deleting : {
101
- actions : [ ButtonTypesEnum . deleting ] ,
90
+ primaryActions : [ ButtonTypesEnum . deleting ] ,
102
91
canCancel : true ,
103
92
canAcceptJobs : false ,
104
93
} ,
105
94
deleted : {
106
- actions : [ ButtonTypesEnum . deleted ] ,
95
+ primaryActions : [ ButtonTypesEnum . deleted ] ,
107
96
canCancel : false ,
108
97
canAcceptJobs : true ,
109
98
} ,
110
99
pending : {
111
- actions : [ ButtonTypesEnum . pending ] ,
100
+ primaryActions : [ ButtonTypesEnum . pending ] ,
112
101
canCancel : false ,
113
102
canAcceptJobs : false ,
114
103
} ,
0 commit comments