@rancher/shell 3.0.8 → 3.0.9-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. package/apis/intf/modal.ts +38 -0
  2. package/apis/intf/slide-in.ts +3 -1
  3. package/apis/shell/__tests__/slide-in.test.ts +36 -0
  4. package/apis/shell/slide-in.ts +5 -1
  5. package/assets/styles/base/_color.scss +1 -0
  6. package/assets/styles/base/_typography.scss +14 -5
  7. package/assets/styles/themes/_light.scss +1 -1
  8. package/assets/styles/themes/_modern.scss +1 -1
  9. package/assets/translations/en-us.yaml +94 -33
  10. package/assets/translations/zh-hans.yaml +0 -2
  11. package/components/ActionMenuShell.vue +4 -4
  12. package/components/CodeMirror.vue +4 -3
  13. package/components/DetailText.vue +54 -7
  14. package/components/Drawer/Chrome.vue +11 -4
  15. package/components/Drawer/DrawerCard.vue +19 -0
  16. package/components/Drawer/ResourceDetailDrawer/ConfigTab.vue +3 -11
  17. package/components/Drawer/ResourceDetailDrawer/__tests__/ConfigTab.test.ts +2 -2
  18. package/components/Drawer/ResourceDetailDrawer/index.vue +3 -20
  19. package/components/Drawer/types.ts +1 -0
  20. package/components/DynamicContent/DynamicContentCloseButton.vue +2 -2
  21. package/components/LocaleSelector.vue +1 -1
  22. package/components/Markdown.vue +1 -1
  23. package/components/PopoverCard.vue +3 -3
  24. package/components/Resource/Detail/Card/ExtrasCard.vue +39 -0
  25. package/components/Resource/Detail/Card/StateCard/__tests__/composables.test.ts +142 -0
  26. package/components/Resource/Detail/Card/StateCard/composables.ts +41 -11
  27. package/components/Resource/Detail/Card/StateCard/index.vue +3 -9
  28. package/components/Resource/Detail/Card/StateCard/types.ts +6 -0
  29. package/components/Resource/Detail/Card/{PodsCard → StatusCard}/index.vue +11 -10
  30. package/components/Resource/Detail/Card/__tests__/PodsCard.test.ts +24 -25
  31. package/components/Resource/Detail/Cards.vue +27 -0
  32. package/components/Resource/Detail/Masthead/__tests__/index.test.ts +70 -0
  33. package/components/Resource/Detail/Masthead/index.vue +5 -0
  34. package/components/Resource/Detail/Metadata/KeyValueRow.vue +4 -2
  35. package/components/Resource/Detail/ResourcePopover/ResourcePopoverCard.vue +2 -2
  36. package/components/Resource/Detail/ResourceRow.types.ts +14 -0
  37. package/components/Resource/Detail/ResourceRow.vue +23 -35
  38. package/components/Resource/Detail/StatusRow.vue +5 -2
  39. package/components/Resource/Detail/TitleBar/__tests__/composables.test.ts +38 -7
  40. package/components/Resource/Detail/TitleBar/__tests__/index.test.ts +106 -2
  41. package/components/Resource/Detail/TitleBar/composables.ts +2 -1
  42. package/components/Resource/Detail/TitleBar/index.vue +41 -6
  43. package/components/ResourceDetail/Masthead/__tests__/index.test.ts +49 -1
  44. package/components/ResourceDetail/Masthead/__tests__/latest.test.ts +85 -0
  45. package/components/ResourceDetail/Masthead/index.vue +1 -0
  46. package/components/ResourceDetail/Masthead/latest.vue +8 -1
  47. package/components/ResourceDetail/Masthead/legacy.vue +1 -1
  48. package/components/Setting.vue +1 -1
  49. package/components/SortableTable/index.vue +25 -0
  50. package/components/SortableTable/selection.js +25 -12
  51. package/components/SortableTable/sorting.js +1 -1
  52. package/components/Tabbed/Tab.vue +1 -0
  53. package/components/Tabbed/index.vue +29 -6
  54. package/components/Window/ContainerShell.vue +10 -13
  55. package/components/fleet/FleetClusterTargets/TargetsList.vue +47 -29
  56. package/components/fleet/FleetClusterTargets/index.vue +82 -29
  57. package/components/fleet/FleetClusters.vue +26 -12
  58. package/components/fleet/FleetGitRepoPaths.vue +2 -2
  59. package/components/fleet/FleetResources.vue +14 -0
  60. package/components/fleet/FleetValuesFrom.vue +2 -2
  61. package/components/fleet/__tests__/FleetClusterTargets.test.ts +531 -0
  62. package/components/fleet/__tests__/FleetClusters.test.ts +576 -0
  63. package/components/fleet/dashboard/ResourceDetails.vue +96 -123
  64. package/components/form/Conditions.vue +1 -15
  65. package/components/form/HookOption.vue +5 -0
  66. package/components/form/LabeledSelect.vue +1 -1
  67. package/components/form/LifecycleHooks.vue +2 -6
  68. package/components/form/ResourceLabeledSelect.vue +12 -1
  69. package/components/form/SeccompProfile.vue +113 -0
  70. package/components/form/Security.vue +244 -133
  71. package/components/form/__tests__/LabeledSelect.test.ts +1 -1
  72. package/components/form/__tests__/SeccompProfile.test.js +124 -0
  73. package/components/form/__tests__/Security.test.ts +125 -37
  74. package/components/formatter/Autoscaler.vue +2 -2
  75. package/components/formatter/FleetSummaryGraph.vue +4 -1
  76. package/components/nav/Group.vue +5 -0
  77. package/components/nav/Header.vue +3 -3
  78. package/components/nav/HeaderPageActionMenu.vue +1 -1
  79. package/components/nav/NamespaceFilter.vue +6 -6
  80. package/components/nav/NotificationCenter/index.vue +1 -1
  81. package/components/nav/TopLevelMenu.helper.ts +41 -16
  82. package/components/nav/TopLevelMenu.vue +45 -25
  83. package/components/nav/WorkspaceSwitcher.vue +1 -1
  84. package/components/nav/__tests__/TopLevelMenu.helper.test.ts +277 -0
  85. package/components/nav/__tests__/TopLevelMenu.test.ts +160 -4
  86. package/components/templates/default.vue +0 -3
  87. package/components/templates/home.vue +0 -3
  88. package/components/templates/plain.vue +0 -3
  89. package/composables/useClickOutside.ts +1 -1
  90. package/config/product/explorer.js +1 -2
  91. package/config/types.js +41 -8
  92. package/detail/__tests__/workload.test.ts +8 -16
  93. package/detail/catalog.cattle.io.app.vue +6 -0
  94. package/detail/fleet.cattle.io.cluster.vue +6 -0
  95. package/detail/workload/index.vue +7 -109
  96. package/edit/__tests__/projectsecret.test.ts +42 -0
  97. package/edit/auth/__tests__/oidc.test.ts +50 -0
  98. package/edit/auth/oidc.vue +68 -44
  99. package/edit/autoscaling.horizontalpodautoscaler/index.vue +140 -59
  100. package/edit/autoscaling.horizontalpodautoscaler/metrics-row.vue +41 -5
  101. package/edit/projectsecret.vue +29 -0
  102. package/edit/provisioning.cattle.io.cluster/__tests__/Basics.test.ts +89 -200
  103. package/edit/provisioning.cattle.io.cluster/__tests__/Networking.test.ts +58 -17
  104. package/edit/provisioning.cattle.io.cluster/rke2.vue +11 -0
  105. package/edit/provisioning.cattle.io.cluster/tabs/Basics.vue +3 -63
  106. package/edit/provisioning.cattle.io.cluster/tabs/networking/index.vue +82 -14
  107. package/edit/workload/__tests__/index.test.ts +122 -85
  108. package/edit/workload/index.vue +48 -29
  109. package/edit/workload/mixins/workload.js +85 -32
  110. package/list/catalog.cattle.io.clusterrepo.vue +1 -1
  111. package/list/projectsecret.vue +2 -2
  112. package/machine-config/__tests__/vmwarevsphere.test.ts +64 -0
  113. package/machine-config/amazonec2.vue +2 -2
  114. package/machine-config/vmwarevsphere.vue +58 -4
  115. package/mixins/__tests__/brand.spec.ts +18 -13
  116. package/mixins/__tests__/chart.test.ts +63 -0
  117. package/mixins/chart.js +56 -51
  118. package/models/__tests__/catalog.cattle.io.app.test.ts +33 -0
  119. package/models/__tests__/workload.test.ts +333 -0
  120. package/models/catalog.cattle.io.app.js +8 -0
  121. package/models/pod.js +14 -0
  122. package/models/secret.js +1 -1
  123. package/models/workload.js +93 -27
  124. package/package.json +4 -4
  125. package/pages/c/_cluster/apps/charts/__tests__/install.test.ts +91 -0
  126. package/pages/c/_cluster/apps/charts/install.vue +4 -4
  127. package/pages/c/_cluster/explorer/EventsTable.vue +2 -2
  128. package/pages/c/_cluster/fleet/index.vue +18 -12
  129. package/pages/c/_cluster/manager/hostedprovider/index.vue +1 -19
  130. package/pages/c/_cluster/uiplugins/PluginInfoPanel.vue +1 -1
  131. package/pages/c/_cluster/uiplugins/index.vue +1 -1
  132. package/plugins/dashboard-store/__tests__/resource-class.test.ts +234 -0
  133. package/plugins/dashboard-store/actions.js +9 -8
  134. package/plugins/dashboard-store/resource-class.js +97 -1
  135. package/plugins/steve/__tests__/revision.test.ts +84 -0
  136. package/plugins/steve/__tests__/steve-pagination-utils.test.ts +30 -0
  137. package/plugins/steve/__tests__/subscribe.spec.ts +134 -0
  138. package/plugins/steve/mutations.js +9 -0
  139. package/plugins/steve/revision.ts +26 -0
  140. package/plugins/steve/steve-pagination-utils.ts +6 -5
  141. package/plugins/steve/subscribe.js +211 -51
  142. package/plugins/subscribe-events.ts +2 -2
  143. package/rancher-components/Form/Checkbox/Checkbox.vue +13 -0
  144. package/rancher-components/LabeledTooltip/LabeledTooltip.vue +1 -1
  145. package/rancher-components/Pill/RcCounterBadge/RcCounterBadge.vue +1 -1
  146. package/rancher-components/Pill/RcStatusBadge/RcStatusBadge.vue +3 -1
  147. package/rancher-components/Pill/RcStatusIndicator/RcStatusIndicator.vue +3 -1
  148. package/rancher-components/Pill/RcTag/RcTag.vue +1 -1
  149. package/rancher-components/Pill/index.ts +4 -0
  150. package/rancher-components/RcButton/RcButton.test.ts +53 -9
  151. package/rancher-components/RcButton/RcButton.vue +217 -25
  152. package/rancher-components/RcButton/types.ts +27 -1
  153. package/rancher-components/RcDropdown/RcDropdownMenu.vue +4 -4
  154. package/rancher-components/RcDropdown/types.ts +3 -3
  155. package/rancher-components/RcIcon/RcIcon.test.ts +42 -0
  156. package/rancher-components/RcIcon/RcIcon.vue +9 -6
  157. package/rancher-components/RcIcon/types.ts +13 -9
  158. package/rancher-components/utils/status.test.ts +10 -15
  159. package/rancher-components/utils/status.ts +5 -6
  160. package/store/aws.js +18 -12
  161. package/store/index.js +4 -8
  162. package/store/type-map.utils.ts +1 -1
  163. package/types/kube/kube-api.ts +29 -3
  164. package/types/rancher/steve.api.ts +40 -0
  165. package/types/shell/index.d.ts +99 -0
  166. package/types/store/dashboard-store.types.ts +29 -7
  167. package/types/store/pagination.types.ts +1 -0
  168. package/types/store/subscribe-events.types.ts +1 -0
  169. package/utils/__tests__/azure.test.ts +56 -0
  170. package/utils/__tests__/back-off.test.ts +364 -245
  171. package/utils/__tests__/error.test.ts +44 -0
  172. package/utils/__tests__/fleet.test.ts +8 -1
  173. package/utils/__tests__/pagination-wrapper.test.ts +167 -0
  174. package/utils/__tests__/version.test.ts +55 -1
  175. package/utils/azure.js +12 -0
  176. package/utils/back-off.ts +302 -69
  177. package/utils/cspAdaptor.ts +32 -14
  178. package/utils/dynamic-content/__tests__/index.test.ts +1 -1
  179. package/utils/dynamic-content/__tests__/new-release.test.ts +48 -7
  180. package/utils/dynamic-content/__tests__/support-notice.test.ts +1 -4
  181. package/utils/dynamic-content/index.ts +1 -6
  182. package/utils/dynamic-content/new-release.ts +5 -3
  183. package/utils/dynamic-content/types.d.ts +0 -1
  184. package/utils/error.js +9 -0
  185. package/utils/fleet.ts +2 -2
  186. package/utils/inactivity.ts +2 -3
  187. package/utils/pagination-wrapper.ts +101 -17
  188. package/utils/validators/formRules/index.ts +3 -0
  189. package/utils/version.js +38 -0
  190. package/components/auth/AzureWarning.vue +0 -77
  191. /package/components/Resource/Detail/{Card/PodsCard/Bubble.vue → Bubble.vue} +0 -0
  192. /package/components/Resource/Detail/Card/{PodsCard → StatusCard}/composable.ts +0 -0
@@ -1,20 +1,26 @@
1
1
  <script lang="ts">
2
2
  import { PropType } from 'vue';
3
3
  import { FLEET } from '@shell/config/types';
4
- import LabeledSelect from '@shell/components/form/LabeledSelect.vue';
5
4
  import FleetResources from '@shell/components/fleet/FleetResources.vue';
6
- import { RcButton } from '@components/RcButton';
7
5
  import { FleetDashboardState } from '@shell/types/fleet';
8
6
  import FleetApplicationSource from '@shell/components/formatter/FleetApplicationSource.vue';
7
+ import FleetClusters from '@shell/components/fleet/FleetClusters.vue';
8
+ import Tabbed from '@shell/components/Tabbed/index.vue';
9
+ import Tab from '@shell/components/Tabbed/Tab.vue';
10
+ import Drawer from '@shell/components/Drawer/Chrome.vue';
11
+ import DrawerCard from '@shell/components/Drawer/DrawerCard.vue';
9
12
 
10
13
  export default {
11
14
  name: 'FleetDashboardResourceDetails',
12
15
 
13
16
  components: {
14
- LabeledSelect,
15
17
  FleetResources,
16
18
  FleetApplicationSource,
17
- RcButton,
19
+ FleetClusters,
20
+ Tabbed,
21
+ Tab,
22
+ Drawer,
23
+ DrawerCard,
18
24
  },
19
25
 
20
26
  props: {
@@ -46,20 +52,18 @@ export default {
46
52
  },
47
53
 
48
54
  mounted() {
49
- this.clusterId = this.clusters[0]?.value || '';
55
+ this.clusterId = '';
50
56
  },
51
57
 
52
58
  computed: {
53
- clusters() {
54
- return this.value.targetClusters.map((cluster: { id: string, nameDisplay: string }) => ({
55
- label: cluster.nameDisplay,
56
- value: cluster.id
57
- }));
58
- },
59
-
60
59
  noResources() {
61
60
  return !this.value.resourcesStatuses?.length;
62
61
  },
62
+
63
+ clusterSchema() {
64
+ return this.$store.getters['management/schemaFor'](FLEET.CLUSTER);
65
+ }
66
+
63
67
  },
64
68
 
65
69
  methods: {
@@ -71,124 +75,93 @@ export default {
71
75
  </script>
72
76
 
73
77
  <template>
74
- <div class="details-panel">
75
- <div
76
- class="header"
78
+ <Drawer
79
+ :ariaTarget="value.id"
80
+ :removeFooter="true"
81
+ @close="closePanel"
82
+ >
83
+ <template
84
+ #title
77
85
  :data-testid="'fleet-dashboard-resource-details-header'"
78
86
  >
79
- <h3 class="title">
80
- <i :class="value.dashboardIcon" />
81
- <router-link
82
- class="label"
83
- :to="detailLocation"
84
- >
85
- {{ value.id }}
86
- </router-link>
87
- <i
88
- v-if="statePanel.id !== 'success'"
89
- class="ml-5 state-icon"
90
- :class="statePanel.icon"
91
- :style="{ color: statePanel.color }"
92
- />
93
- </h3>
94
- <RcButton
95
- small
96
- ghost
97
- data-testid="slide-in-close"
98
- :aria-label="'slide-in-close'"
99
- tabindex="0"
100
- @click="closePanel"
101
- @keydown.space.enter.stop.prevent="closePanel"
102
- >
103
- <i class="icon icon-close" />
104
- </RcButton>
105
- </div>
106
-
107
- <h4>
108
- {{ t('fleet.dashboard.source') }}
109
- </h4>
110
- <div class="mb-15">
111
- <FleetApplicationSource
112
- v-if="value.source.value"
113
- :row="value"
87
+ <i
88
+ class="icon-lg mmr-3"
89
+ :class="value.dashboardIcon"
114
90
  />
115
- <div
116
- v-else
117
- class="text-muted"
91
+ <router-link
92
+ class="label"
93
+ :to="detailLocation"
118
94
  >
119
- &mdash;
120
- </div>
121
- </div>
122
-
123
- <h4>
124
- {{ t('fleet.dashboard.resources') }}
125
- </h4>
126
- <FleetResources
127
- :rows="value.resourcesStatuses"
128
- :cluster-id="clusterId"
129
- :search="!noResources"
130
- >
131
- <template
132
- v-if="!noResources"
133
- #header-left
95
+ {{ value.id }}
96
+ </router-link>
97
+ <i
98
+ v-if="statePanel.id !== 'success'"
99
+ class="ml-5 state-icon icon-lg"
100
+ :class="statePanel.icon"
101
+ :style="{ color: statePanel.color }"
102
+ />
103
+ </template>
104
+ <template #body>
105
+ <Tabbed
106
+ v-bind="$attrs"
107
+ :default-tab="'clusters'"
108
+ :resource="value"
109
+ :use-hash="true"
110
+ :remove-borders="true"
134
111
  >
135
- <div class="row">
136
- <div class="col span-10">
137
- <LabeledSelect
138
- v-model:value="clusterId"
139
- :label="t('fleet.cluster.label')"
140
- :options="clusters"
141
- :mode="'edit'"
142
- :disabled="workspace.id === 'fleet-local'"
112
+ <Tab
113
+ :label="t('fleet.dashboard.resourceDetails.clusters')"
114
+ name="clusters"
115
+ >
116
+ <DrawerCard>
117
+ <FleetClusters
118
+ :schema="clusterSchema"
119
+ :rows="value.targetClusters"
120
+ :table-actions="false"
121
+ :row-actions="false"
122
+ :search="true"
123
+ :remove-sub-rows="true"
124
+ :ignore-filter="true"
125
+ paging-label="sortableTable.paging.resource"
143
126
  />
144
- </div>
145
- </div>
146
- </template>
147
- </FleetResources>
148
- </div>
127
+ </DrawerCard>
128
+ </Tab>
129
+ <Tab
130
+ :label="t('fleet.dashboard.resourceDetails.resources')"
131
+ name="resources"
132
+ >
133
+ <DrawerCard>
134
+ <FleetResources
135
+ :rows="value.resourcesStatuses"
136
+ :cluster-id="clusterId"
137
+ :search="true"
138
+ />
139
+ </DrawerCard>
140
+ </Tab>
141
+ <Tab
142
+ :label="t('fleet.dashboard.resourceDetails.source')"
143
+ name="source"
144
+ >
145
+ <DrawerCard class="mmb-4">
146
+ <FleetApplicationSource
147
+ v-if="value.source.value"
148
+ :row="value"
149
+ />
150
+ <div
151
+ v-else
152
+ class="text-muted"
153
+ >
154
+ &mdash;
155
+ </div>
156
+ </DrawerCard>
157
+ </Tab>
158
+ </Tabbed>
159
+ </template>
160
+ </Drawer>
149
161
  </template>
150
162
 
151
- <style lang="scss">
152
- .details-panel {
153
- padding: 10px;
154
-
155
- .sortable-table-header {
156
- .fixed-header-actions {
157
- align-items: center;
158
- }
159
- }
160
-
161
- .header {
162
- display: flex;
163
- align-items: center;
164
- padding: 0;
165
- margin: 0 0 20px 0;
166
-
167
- .title {
168
- display: flex;
169
- align-items: center;
170
- flex: 1;
171
- margin-bottom: 0;
172
-
173
- .icon {
174
- font-size: 2em;
175
- margin-right: 16px;
176
- }
177
-
178
- .label {
179
- margin-right: 8px;
180
- }
181
-
182
- .state-icon {
183
- font-size: 1.5em;
184
- }
185
- }
186
- }
187
- }
188
-
189
- .col {
190
- .labeled-select {
191
- min-width: 250px;
192
- }
163
+ <style lang="scss" scoped>
164
+ .icon-lg {
165
+ font-size: 24px;
193
166
  }
194
167
  </style>
@@ -52,21 +52,7 @@ export default {
52
52
  },
53
53
 
54
54
  rows() {
55
- return (this.value.status?.conditions || []).map((cond) => {
56
- let message = cond.message || '';
57
-
58
- if ( cond.reason ) {
59
- message = `[${ cond.reason }] ${ message }`.trim();
60
- }
61
-
62
- return {
63
- condition: cond.type || 'Unknown',
64
- status: cond.status || 'Unknown',
65
- error: cond.error,
66
- time: cond.lastProbeTime || cond.lastUpdateTime || cond.lastTransitionTime,
67
- message,
68
- };
69
- });
55
+ return this.value.resourceConditions;
70
56
  },
71
57
  }
72
58
  };
@@ -20,6 +20,10 @@ export default {
20
20
  default: () => {
21
21
  return {};
22
22
  }
23
+ },
24
+ label: {
25
+ type: String,
26
+ default: null
23
27
  }
24
28
  },
25
29
 
@@ -123,6 +127,7 @@ export default {
123
127
  t('workload.container.lifecycleHook.httpGet.add'),
124
128
  ]"
125
129
  :mode="mode"
130
+ :label="label"
126
131
  @update:value="update"
127
132
  />
128
133
  </div>
@@ -386,7 +386,7 @@ export default {
386
386
  :dropdown-should-open="dropdownShouldOpen"
387
387
  :tabindex="-1"
388
388
  :uid="generatedUid"
389
- :aria-label="'-'"
389
+ :aria-label="`- ${value}`"
390
390
  @update:modelValue="$emit('selecting', $event); $emit('update:value', $event)"
391
391
  @search:blur="onBlur"
392
392
  @search:focus="onFocus"
@@ -63,23 +63,19 @@ export default {
63
63
  <template>
64
64
  <div>
65
65
  <div class="mb-20">
66
- <h3 class="clearfix">
67
- {{ t('workload.container.lifecycleHook.postStart.label') }}
68
- </h3>
69
66
  <HookOption
70
67
  v-model:value="postStart"
71
68
  :mode="mode"
69
+ :label="t('workload.container.lifecycleHook.postStart.label')"
72
70
  @update:value="update"
73
71
  />
74
72
  </div>
75
73
 
76
74
  <div>
77
- <h3 class="clearfix">
78
- {{ t('workload.container.lifecycleHook.preStop.label') }}
79
- </h3>
80
75
  <HookOption
81
76
  v-model:value="preStop"
82
77
  :mode="mode"
78
+ :label="t('workload.container.lifecycleHook.preStop.label')"
83
79
  @update:value="update"
84
80
  />
85
81
  </div>
@@ -165,5 +165,16 @@ export default defineComponent({
165
165
  :paginate="paginateType"
166
166
  :multiple="$attrs.multiple || false"
167
167
  @update:value="$emit('update:value', $event)"
168
- />
168
+ >
169
+ <template
170
+ v-for="(_, slot) in $slots"
171
+ :key="slot"
172
+ #[slot]="scope"
173
+ >
174
+ <slot
175
+ :name="slot"
176
+ v-bind="scope"
177
+ />
178
+ </template>
179
+ </LabeledSelect>
169
180
  </template>
@@ -0,0 +1,113 @@
1
+ <script>
2
+ import { LabeledInput } from '@components/Form/LabeledInput';
3
+ import { mapGetters } from 'vuex';
4
+ import LabeledSelect from '@shell/components/form/LabeledSelect';
5
+
6
+ export default {
7
+ emits: ['update:value'],
8
+
9
+ components: {
10
+ LabeledInput,
11
+ LabeledSelect
12
+ },
13
+
14
+ props: {
15
+ value: {
16
+ type: Object,
17
+ default: () => ({})
18
+ },
19
+ mode: {
20
+ type: String,
21
+ default: 'mode'
22
+ },
23
+ seccompProfileTypes: {
24
+ type: Array,
25
+ default: () => []
26
+ },
27
+ title: {
28
+ type: String,
29
+ default: ''
30
+ }
31
+ },
32
+
33
+ data() {
34
+ const { type, localhostProfile } = this.value || {};
35
+
36
+ return {
37
+ type: type || 'None',
38
+ localhostProfile,
39
+ afterLocalhostProfileSelectedMessage: ''
40
+ };
41
+ },
42
+
43
+ computed: { ...mapGetters({ t: 'i18n/t' }) },
44
+
45
+ methods: {
46
+ update() {
47
+ if (this.type === 'None') {
48
+ this.$emit('update:value', undefined);
49
+
50
+ return;
51
+ }
52
+
53
+ const seccompProfile = { type: this.type };
54
+
55
+ if (this.type === 'Localhost') {
56
+ seccompProfile.localhostProfile = this.localhostProfile;
57
+ this.afterLocalhostProfileSelectedMessage = this.t('workload.container.security.seccompProfile.afterLocalhostProfile.selected');
58
+ } else {
59
+ this.afterLocalhostProfileSelectedMessage = this.t('workload.container.security.seccompProfile.afterLocalhostProfile.unselected');
60
+ }
61
+
62
+ this.$emit('update:value', seccompProfile);
63
+ }
64
+ }
65
+ };
66
+ </script>
67
+
68
+ <template>
69
+ <fieldset>
70
+ <legend class="h3-legend">
71
+ {{ title }}
72
+ </legend>
73
+ <div class="row">
74
+ <div
75
+ data-testid="input-security-seccompProfile-type"
76
+ class="col span-6"
77
+ >
78
+ <LabeledSelect
79
+ v-model:value="type"
80
+ :mode="mode"
81
+ :label="t('workload.container.security.seccompProfile.type')"
82
+ :options="seccompProfileTypes"
83
+ data-testid="seccomp-type-select"
84
+ @update:value="update"
85
+ />
86
+ </div>
87
+ <p
88
+ id="after-localhostprofile-selected"
89
+ role="status"
90
+ aria-live="polite"
91
+ class="sr-only"
92
+ >
93
+ {{ afterLocalhostProfileSelectedMessage }}
94
+ </p>
95
+ <div
96
+ data-testid="input-security-seccompProfile-localhostProfile"
97
+ class="col span-6"
98
+ >
99
+ <LabeledInput
100
+ v-if="type === 'Localhost'"
101
+ v-model:value="localhostProfile"
102
+ :mode="mode"
103
+ :label="t('workload.container.security.seccompProfile.localhostProfile.label')"
104
+ :required="true"
105
+ :tooltip="t('workload.container.security.seccompProfile.localhostProfile.tooltip')"
106
+ :placeholder="t('workload.container.security.seccompProfile.localhostProfile.placeholder')"
107
+ data-testid="seccomp-localhost-input"
108
+ @update:value="update"
109
+ />
110
+ </div>
111
+ </div>
112
+ </fieldset>
113
+ </template>