@rancher/shell 3.0.2-rc.5 → 3.0.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.
- package/assets/images/providers/nutanix.svg +12 -1
- package/assets/styles/base/_basic.scss +2 -1
- package/assets/styles/base/_helpers.scss +4 -0
- package/assets/styles/base/_variables.scss +2 -0
- package/assets/styles/global/_labeled-input.scss +5 -13
- package/assets/styles/global/_layout.scss +4 -1
- package/assets/styles/global/_select.scss +5 -0
- package/assets/styles/themes/_dark.scss +1 -3
- package/assets/styles/themes/_light.scss +5 -1
- package/assets/translations/en-us.yaml +130 -23
- package/assets/translations/zh-hans.yaml +0 -3
- package/cloud-credential/azure.vue +1 -1
- package/components/ActionMenuShell.vue +105 -0
- package/components/AppModal.vue +2 -2
- package/components/AsyncButton.vue +2 -0
- package/components/ButtonGroup.vue +9 -2
- package/components/ClusterBadge.vue +1 -0
- package/components/ClusterIconMenu.vue +3 -0
- package/components/ClusterProviderIcon.vue +14 -1
- package/components/CodeMirror.vue +96 -5
- package/components/Collapse.vue +16 -3
- package/components/CruResource.vue +9 -0
- package/components/CruResourceFooter.vue +1 -1
- package/components/ExplorerMembers.vue +2 -1
- package/components/FixedBanner.vue +19 -12
- package/components/Import.vue +14 -1
- package/components/LandingPagePreference.vue +4 -2
- package/components/PodSecurityAdmission.vue +8 -6
- package/components/PromptChangePassword.vue +1 -0
- package/components/PromptRemove.vue +23 -21
- package/components/ResourceDetail/Masthead.vue +30 -11
- package/components/ResourceDetail/__tests__/Masthead.test.ts +61 -0
- package/components/ResourceDetail/index.vue +6 -0
- package/components/ResourceTable.vue +6 -1
- package/components/ResourceYaml.vue +1 -0
- package/components/Setting.vue +115 -0
- package/components/SortableTable/THead.vue +2 -0
- package/components/SortableTable/index.vue +7 -12
- package/components/StatusBadge.vue +71 -0
- package/components/Tabbed/index.vue +16 -15
- package/components/Wizard.vue +108 -104
- package/components/YamlEditor.vue +12 -2
- package/components/__tests__/Collapse.test.ts +2 -2
- package/components/__tests__/FixedBanner.test.ts +3 -3
- package/components/auth/Principal.vue +29 -17
- package/components/auth/__tests__/Principal.test.ts +40 -0
- package/components/auth/login/ldap.vue +7 -0
- package/components/fleet/FleetBundles.vue +1 -1
- package/components/fleet/FleetRepos.vue +1 -1
- package/components/fleet/FleetResources.vue +0 -2
- package/components/fleet/FleetSummary.vue +60 -65
- package/components/fleet/ForceDirectedTreeChart/index.vue +5 -1
- package/components/fleet/__tests__/FleetSummary.test.ts +49 -9
- package/components/form/ArrayList.vue +6 -2
- package/components/form/ColorInput.vue +1 -0
- package/components/form/KeyValue.vue +11 -12
- package/components/form/LabeledSelect.vue +15 -3
- package/components/form/Labels.vue +8 -1
- package/components/form/Members/MembershipEditor.vue +230 -222
- package/components/form/Members/__tests__/MembershipEditor.test.ts +62 -0
- package/components/form/Password.vue +3 -0
- package/components/form/ProjectMemberEditor.vue +6 -3
- package/components/form/ResourceTabs/index.vue +15 -13
- package/components/form/SSHKnownHosts/KnownHostsEditDialog.vue +5 -4
- package/components/form/SchedulingCustomization.vue +85 -0
- package/components/form/Select.vue +3 -2
- package/components/form/SelectOrCreateAuthSecret.vue +2 -1
- package/components/form/UnitInput.vue +3 -4
- package/components/form/__tests__/ArrayList.test.ts +9 -6
- package/components/form/__tests__/LabeledSelect.test.ts +37 -0
- package/components/form/__tests__/SelectOrCreateAuthSecret.test.ts +34 -0
- package/components/form/__tests__/UnitInput.test.ts +4 -5
- package/components/formatter/LiveDate.vue +3 -1
- package/components/formatter/ServiceType.vue +12 -4
- package/components/formatter/WorkloadHealthScale.vue +2 -1
- package/components/nav/Header.vue +35 -2
- package/components/nav/HeaderPageActionMenu.vue +11 -40
- package/components/nav/Jump.vue +8 -2
- package/components/nav/NamespaceFilter.vue +5 -4
- package/components/nav/Pinned.vue +1 -1
- package/components/nav/TopLevelMenu.helper.ts +5 -5
- package/components/nav/TopLevelMenu.vue +1 -12
- package/components/nav/WindowManager/ContainerLogs.vue +96 -58
- package/components/nav/WindowManager/ContainerShell.vue +99 -18
- package/components/nav/WindowManager/index.vue +74 -6
- package/components/nav/__tests__/TopLevelMenu.test.ts +0 -40
- package/components/templates/default.vue +2 -47
- package/config/features.js +1 -0
- package/config/labels-annotations.js +11 -1
- package/config/router/navigation-guards/index.js +2 -1
- package/config/router/navigation-guards/record-last-route.js +24 -0
- package/config/settings.ts +66 -98
- package/config/version.js +1 -1
- package/core/types-provisioning.ts +7 -0
- package/detail/fleet.cattle.io.bundle.vue +7 -0
- package/detail/fleet.cattle.io.cluster.vue +0 -3
- package/detail/fleet.cattle.io.gitrepo.vue +8 -15
- package/detail/provisioning.cattle.io.cluster.vue +8 -2
- package/dialog/DeactivateDriverDialog.vue +5 -5
- package/dialog/GitRepoForceUpdateDialog.vue +132 -0
- package/directives/strip-html-aria-label.js +19 -0
- package/edit/__tests__/cis.cattle.io.clusterscan.test.ts +87 -0
- package/edit/__tests__/fleet.cattle.io.gitrepo.test.ts +217 -37
- package/edit/auth/__tests__/oidc.test.ts +60 -12
- package/edit/auth/ldap/__tests__/config.test.ts +40 -0
- package/edit/auth/ldap/config.vue +67 -89
- package/edit/auth/oidc.vue +16 -2
- package/edit/catalog.cattle.io.clusterrepo.vue +12 -8
- package/edit/cis.cattle.io.clusterscan.vue +13 -1
- package/edit/fleet.cattle.io.gitrepo.vue +198 -72
- package/edit/logging-flow/Match.vue +0 -21
- package/edit/management.cattle.io.project.vue +1 -1
- package/edit/monitoring.coreos.com.prometheusrule/AlertingRule.vue +10 -3
- package/edit/monitoring.coreos.com.prometheusrule/RecordingRule.vue +5 -1
- package/edit/monitoring.coreos.com.prometheusrule/index.vue +5 -2
- package/edit/provisioning.cattle.io.cluster/CustomCommand.vue +8 -1
- package/edit/provisioning.cattle.io.cluster/SelectCredential.vue +2 -0
- package/edit/provisioning.cattle.io.cluster/__tests__/Advanced.test.ts +0 -2
- package/edit/provisioning.cattle.io.cluster/__tests__/CustomCommand.test.ts +55 -15
- package/edit/provisioning.cattle.io.cluster/index.vue +28 -30
- package/edit/provisioning.cattle.io.cluster/rke2.vue +64 -13
- package/edit/provisioning.cattle.io.cluster/tabs/AgentConfiguration.vue +37 -2
- package/edit/provisioning.cattle.io.cluster/tabs/etcd/index.vue +3 -2
- package/edit/resources.cattle.io.backup.vue +150 -15
- package/edit/secret/__tests__/ssh.test.ts +79 -0
- package/edit/secret/ssh.vue +7 -1
- package/edit/service.vue +0 -3
- package/edit/workload/Job.vue +8 -8
- package/edit/workload/__tests__/Job.test.ts +0 -1
- package/edit/workload/index.vue +3 -1
- package/initialize/install-directives.js +2 -0
- package/initialize/install-plugins.js +6 -1
- package/list/catalog.cattle.io.app.vue +21 -4
- package/list/fleet.cattle.io.bundle.vue +1 -1
- package/list/management.cattle.io.setting.vue +34 -132
- package/list/provisioning.cattle.io.cluster.vue +11 -3
- package/machine-config/vmwarevsphere.vue +15 -8
- package/mixins/__tests__/auth-config.test.ts +74 -0
- package/mixins/__tests__/chart.test.ts +5 -4
- package/mixins/__tests__/create-edit-view.test.ts +38 -0
- package/mixins/auth-config.js +8 -0
- package/mixins/chart.js +2 -2
- package/mixins/create-edit-view/impl.js +4 -1
- package/mixins/vue-select-overrides.js +10 -0
- package/models/__tests__/catalog.cattle.io.app.test.ts +148 -0
- package/models/__tests__/fleet.cattle.io.gitrepo.test.ts +157 -0
- package/models/__tests__/secret.test.ts +56 -13
- package/models/catalog.cattle.io.app.js +112 -37
- package/models/cluster.js +11 -0
- package/models/fleet.cattle.io.bundle.js +40 -2
- package/models/fleet.cattle.io.gitrepo.js +169 -109
- package/models/management.cattle.io.fleetworkspace.js +4 -0
- package/models/management.cattle.io.kontainerdriver.js +7 -0
- package/models/nodedriver.js +4 -1
- package/models/provisioning.cattle.io.cluster.js +24 -0
- package/models/secret.js +1 -1
- package/package.json +5 -5
- package/pages/auth/login.vue +5 -11
- package/pages/auth/verify.vue +11 -1
- package/pages/c/_cluster/apps/charts/index.vue +6 -4
- package/pages/c/_cluster/apps/charts/install.vue +1 -1
- package/pages/c/_cluster/explorer/ConfigBadge.vue +3 -5
- package/pages/c/_cluster/explorer/EventsTable.vue +3 -2
- package/pages/c/_cluster/explorer/__tests__/index.test.ts +9 -9
- package/pages/c/_cluster/explorer/index.vue +33 -35
- package/pages/c/_cluster/explorer/tools/index.vue +3 -3
- package/pages/c/_cluster/fleet/index.vue +0 -5
- package/pages/c/_cluster/legacy/project/index.vue +1 -1
- package/pages/c/_cluster/settings/performance.vue +52 -53
- package/pages/c/_cluster/uiplugins/index.vue +19 -22
- package/pages/home.vue +17 -12
- package/pages/prefs.vue +5 -1
- package/plugins/shortkey.js +10 -1
- package/plugins/steve/steve-pagination-utils.ts +58 -8
- package/promptRemove/management.cattle.io.fleetworkspace.vue +98 -0
- package/promptRemove/management.cattle.io.globalrole.vue +1 -1
- package/promptRemove/management.cattle.io.project.vue +2 -8
- package/promptRemove/management.cattle.io.roletemplate.vue +1 -1
- package/promptRemove/mixin/roleDeletionCheck.js +1 -7
- package/promptRemove/pod.vue +7 -28
- package/rancher-components/Card/Card.vue +9 -1
- package/rancher-components/Form/Checkbox/Checkbox.vue +42 -6
- package/rancher-components/Form/LabeledInput/LabeledInput.vue +30 -3
- package/rancher-components/Form/Radio/RadioButton.vue +18 -3
- package/rancher-components/Form/Radio/RadioGroup.vue +39 -5
- package/rancher-components/LabeledTooltip/LabeledTooltip.vue +13 -1
- package/rancher-components/RcButton/RcButton.test.ts +97 -0
- package/rancher-components/RcButton/RcButton.vue +14 -9
- package/rancher-components/RcDropdown/RcDropdown.vue +3 -1
- package/rancher-components/RcDropdown/RcDropdownItem.vue +8 -2
- package/rancher-components/RcDropdown/RcDropdownMenu.vue +66 -0
- package/rancher-components/RcDropdown/index.ts +1 -0
- package/rancher-components/RcDropdown/types.ts +27 -0
- package/rancher-components/RcDropdown/useDropdownContext.ts +5 -2
- package/scripts/extension/helm/charts/ui-plugin-server/templates/_helpers.tpl +2 -2
- package/scripts/typegen.sh +1 -0
- package/store/__tests__/auth.test.ts +120 -0
- package/store/action-menu.js +13 -3
- package/store/auth.js +14 -9
- package/store/aws.js +9 -2
- package/store/catalog.js +14 -7
- package/store/features.js +1 -0
- package/store/prefs.js +9 -28
- package/store/type-map.utils.ts +4 -0
- package/types/resources/settings.d.ts +27 -20
- package/types/shell/index.d.ts +18 -12
- package/utils/__tests__/array.test.ts +13 -1
- package/utils/__tests__/string.test.ts +80 -1
- package/utils/array.ts +13 -0
- package/utils/auth.js +4 -0
- package/utils/banners.js +0 -45
- package/utils/cluster.js +1 -1
- package/{edit/monitoring.coreos.com.prometheusrule → utils}/duration.js +5 -3
- package/utils/object.js +0 -3
- package/utils/pagination-utils.ts +15 -2
- package/utils/string.js +31 -7
- package/utils/validators/formRules/__tests__/index.test.ts +27 -0
- package/utils/validators/formRules/index.ts +16 -0
- package/edit/provisioning.cattle.io.cluster/import.vue +0 -198
|
@@ -71,7 +71,7 @@ describe('page: cluster dashboard', () => {
|
|
|
71
71
|
});
|
|
72
72
|
|
|
73
73
|
describe.each([
|
|
74
|
-
['local', 'fleet', true, ['
|
|
74
|
+
['local', 'fleet', true, ['fleetControllerResource', 'fleetAgentResource'], [
|
|
75
75
|
[STATES_ENUM.IN_PROGRESS, 'icon-spinner', false, false, false, '', 0, 0],
|
|
76
76
|
[STATES_ENUM.UNHEALTHY, 'icon-warning', true, false, false, [{ status: 'False' }], 0, 0],
|
|
77
77
|
[STATES_ENUM.UNHEALTHY, 'icon-warning', true, false, true, [{ status: 'True' }], 0, 0],
|
|
@@ -80,7 +80,7 @@ describe('page: cluster dashboard', () => {
|
|
|
80
80
|
[STATES_ENUM.WARNING, 'icon-warning', true, false, false, [{ status: 'True' }], 0, 1],
|
|
81
81
|
[STATES_ENUM.HEALTHY, 'icon-checkmark', true, false, false, [{ status: 'True' }], 1, 0],
|
|
82
82
|
]],
|
|
83
|
-
['downstream RKE2', 'fleet', false, ['
|
|
83
|
+
['downstream RKE2', 'fleet', false, ['fleetAgentResource'], [
|
|
84
84
|
[STATES_ENUM.IN_PROGRESS, 'icon-spinner', false, false, false, '', 0, 0],
|
|
85
85
|
[STATES_ENUM.UNHEALTHY, 'icon-warning', true, false, false, [{ status: 'False' }], 0, 0],
|
|
86
86
|
[STATES_ENUM.UNHEALTHY, 'icon-warning', true, false, true, [{ status: 'True' }], 0, 0],
|
|
@@ -89,7 +89,7 @@ describe('page: cluster dashboard', () => {
|
|
|
89
89
|
[STATES_ENUM.WARNING, 'icon-warning', true, false, false, [{ status: 'True' }], 0, 1],
|
|
90
90
|
[STATES_ENUM.HEALTHY, 'icon-checkmark', true, false, false, [{ status: 'True' }], 1, 0],
|
|
91
91
|
]],
|
|
92
|
-
['downstream RKE2', 'cattle', false, ['
|
|
92
|
+
['downstream RKE2', 'cattle', false, ['cattleAgentResource'], [
|
|
93
93
|
[STATES_ENUM.IN_PROGRESS, 'icon-spinner', false, false, false, '', 0, 0],
|
|
94
94
|
[STATES_ENUM.UNHEALTHY, 'icon-warning', true, false, false, [{ status: 'False' }], 0, 0],
|
|
95
95
|
[STATES_ENUM.UNHEALTHY, 'icon-warning', true, true, false, [{ status: 'True' }], 0, 0],
|
|
@@ -137,7 +137,7 @@ describe('page: cluster dashboard', () => {
|
|
|
137
137
|
});
|
|
138
138
|
|
|
139
139
|
describe.each([
|
|
140
|
-
['local', 'fleet', true, ['
|
|
140
|
+
['local', 'fleet', true, ['fleetControllerResource', 'fleetAgentResource'], [
|
|
141
141
|
[STATES_ENUM.IN_PROGRESS, 'icon-spinner', false, false, false, false, '', 0, 0],
|
|
142
142
|
[STATES_ENUM.UNHEALTHY, 'icon-warning', true, true, false, false, [{ status: 'False' }], 0, 0],
|
|
143
143
|
[STATES_ENUM.UNHEALTHY, 'icon-warning', true, true, false, true, [{ status: 'True' }], 0, 0],
|
|
@@ -146,7 +146,7 @@ describe('page: cluster dashboard', () => {
|
|
|
146
146
|
[STATES_ENUM.WARNING, 'icon-warning', true, true, false, false, [{ status: 'True' }], 0, 1],
|
|
147
147
|
[STATES_ENUM.HEALTHY, 'icon-checkmark', false, true, false, false, [{ status: 'True' }], 1, 0],
|
|
148
148
|
]],
|
|
149
|
-
['downstream RKE2', 'fleet', false, ['
|
|
149
|
+
['downstream RKE2', 'fleet', false, ['fleetAgentResource'], [
|
|
150
150
|
[STATES_ENUM.IN_PROGRESS, 'icon-spinner', false, false, false, false, '', 0, 0],
|
|
151
151
|
[STATES_ENUM.UNHEALTHY, 'icon-warning', true, true, false, false, [{ status: 'False' }], 0, 0],
|
|
152
152
|
[STATES_ENUM.UNHEALTHY, 'icon-warning', true, true, false, true, [{ status: 'True' }], 0, 0],
|
|
@@ -155,7 +155,7 @@ describe('page: cluster dashboard', () => {
|
|
|
155
155
|
[STATES_ENUM.WARNING, 'icon-warning', true, true, false, false, [{ status: 'True' }], 0, 1],
|
|
156
156
|
[STATES_ENUM.HEALTHY, 'icon-checkmark', false, true, false, false, [{ status: 'True' }], 1, 0],
|
|
157
157
|
]],
|
|
158
|
-
['downstream RKE2', 'cattle', false, ['
|
|
158
|
+
['downstream RKE2', 'cattle', false, ['cattleAgentResource'], [
|
|
159
159
|
[STATES_ENUM.IN_PROGRESS, 'icon-spinner', false, false, false, false, '', 0, 0],
|
|
160
160
|
[STATES_ENUM.UNHEALTHY, 'icon-warning', true, true, false, false, [{ status: 'False' }], 0, 0],
|
|
161
161
|
[STATES_ENUM.UNHEALTHY, 'icon-warning', true, true, true, false, [{ status: 'True' }], 0, 0],
|
|
@@ -228,9 +228,9 @@ describe('page: cluster dashboard', () => {
|
|
|
228
228
|
const wrapper = shallowMount(Dashboard, {
|
|
229
229
|
...options,
|
|
230
230
|
data: () => ({
|
|
231
|
-
|
|
232
|
-
disconnected:
|
|
233
|
-
canViewAgents:
|
|
231
|
+
cattleAgentResource: 'loading',
|
|
232
|
+
disconnected: false,
|
|
233
|
+
canViewAgents: true
|
|
234
234
|
})
|
|
235
235
|
});
|
|
236
236
|
|
|
@@ -134,17 +134,17 @@ export default {
|
|
|
134
134
|
|
|
135
135
|
return {
|
|
136
136
|
nodeHeaders,
|
|
137
|
-
constraints:
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
disconnected:
|
|
142
|
-
events:
|
|
143
|
-
nodeMetrics:
|
|
144
|
-
showClusterMetrics:
|
|
145
|
-
showK8sMetrics:
|
|
146
|
-
showEtcdMetrics:
|
|
147
|
-
canViewMetrics:
|
|
137
|
+
constraints: [],
|
|
138
|
+
cattleAgentResource: 'loading',
|
|
139
|
+
fleetControllerResource: 'loading',
|
|
140
|
+
fleetAgentResource: 'loading',
|
|
141
|
+
disconnected: false,
|
|
142
|
+
events: [],
|
|
143
|
+
nodeMetrics: [],
|
|
144
|
+
showClusterMetrics: false,
|
|
145
|
+
showK8sMetrics: false,
|
|
146
|
+
showEtcdMetrics: false,
|
|
147
|
+
canViewMetrics: false,
|
|
148
148
|
CLUSTER_METRICS_DETAIL_URL,
|
|
149
149
|
CLUSTER_METRICS_SUMMARY_URL,
|
|
150
150
|
K8S_METRICS_DETAIL_URL,
|
|
@@ -153,9 +153,9 @@ export default {
|
|
|
153
153
|
ETCD_METRICS_SUMMARY_URL,
|
|
154
154
|
STATES_ENUM,
|
|
155
155
|
clusterCounts,
|
|
156
|
-
selectedTab:
|
|
157
|
-
extensionCards:
|
|
158
|
-
canViewEvents:
|
|
156
|
+
selectedTab: 'cluster-events',
|
|
157
|
+
extensionCards: getApplicableExtensionEnhancements(this, ExtensionPoint.CARD, CardLocation.CLUSTER_DASHBOARD_CARD, this.$route),
|
|
158
|
+
canViewEvents: !!this.$store.getters['cluster/schemaFor'](EVENT),
|
|
159
159
|
clusterServiceIcons,
|
|
160
160
|
};
|
|
161
161
|
},
|
|
@@ -197,11 +197,7 @@ export default {
|
|
|
197
197
|
},
|
|
198
198
|
|
|
199
199
|
fleetAgentNamespace() {
|
|
200
|
-
|
|
201
|
-
return this.$store.getters['cluster/canList'](WORKLOAD_TYPES.DEPLOYMENT) && this.$store.getters['cluster/canList'](WORKLOAD_TYPES.STATEFUL_SET) && this.$store.getters['cluster/byId'](NAMESPACE, 'cattle-fleet-system');
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
return this.$store.getters['cluster/canList'](WORKLOAD_TYPES.STATEFUL_SET) && this.$store.getters['cluster/byId'](NAMESPACE, 'cattle-fleet-system');
|
|
200
|
+
return this.$store.getters['cluster/canList'](WORKLOAD_TYPES.DEPLOYMENT) && this.$store.getters['cluster/byId'](NAMESPACE, 'cattle-fleet-system');
|
|
205
201
|
},
|
|
206
202
|
|
|
207
203
|
cattleAgentNamespace() {
|
|
@@ -331,7 +327,7 @@ export default {
|
|
|
331
327
|
},
|
|
332
328
|
|
|
333
329
|
cattleAgent() {
|
|
334
|
-
const resources = [this.
|
|
330
|
+
const resources = [this.cattleAgentResource];
|
|
335
331
|
|
|
336
332
|
return this.getAgentStatus(resources, { checkDisconnected: true });
|
|
337
333
|
},
|
|
@@ -339,12 +335,12 @@ export default {
|
|
|
339
335
|
fleetAgent() {
|
|
340
336
|
const resources = this.currentCluster.isLocal ? [
|
|
341
337
|
/**
|
|
342
|
-
* '
|
|
343
|
-
* During that startup period, only '
|
|
338
|
+
* 'fleetAgentResource' could take a while to be created by rancher.
|
|
339
|
+
* During that startup period, only 'fleetControllerResource' will be used to calculate the fleet agent status.
|
|
344
340
|
*/
|
|
345
|
-
...(this.
|
|
341
|
+
...(this.fleetAgentResource ? [this.fleetAgentResource, this.fleetControllerResource] : [this.fleetControllerResource]),
|
|
346
342
|
] : [
|
|
347
|
-
this.
|
|
343
|
+
this.fleetAgentResource
|
|
348
344
|
];
|
|
349
345
|
|
|
350
346
|
return this.getAgentStatus(resources);
|
|
@@ -492,23 +488,23 @@ export default {
|
|
|
492
488
|
loadAgents() {
|
|
493
489
|
if (this.fleetAgentNamespace) {
|
|
494
490
|
if (this.currentCluster.isLocal) {
|
|
495
|
-
this.setAgentResource('
|
|
496
|
-
this.setAgentResource('
|
|
491
|
+
this.setAgentResource('fleetControllerResource', 'cattle-fleet-system/fleet-controller');
|
|
492
|
+
this.setAgentResource('fleetAgentResource', 'cattle-fleet-local-system/fleet-agent');
|
|
497
493
|
} else {
|
|
498
|
-
this.setAgentResource('
|
|
494
|
+
this.setAgentResource('fleetAgentResource', 'cattle-fleet-system/fleet-agent');
|
|
499
495
|
}
|
|
500
496
|
}
|
|
501
497
|
if (this.cattleAgentNamespace) {
|
|
502
|
-
this.setAgentResource('
|
|
498
|
+
this.setAgentResource('cattleAgentResource', 'cattle-system/cattle-cluster-agent');
|
|
503
499
|
this.interval = setInterval(() => {
|
|
504
500
|
this.disconnected = !!this.$store.getters['cluster/inError']({ type: NODE });
|
|
505
501
|
}, 1000);
|
|
506
502
|
}
|
|
507
503
|
},
|
|
508
504
|
|
|
509
|
-
async setAgentResource(agent,
|
|
505
|
+
async setAgentResource(agent, id) {
|
|
510
506
|
try {
|
|
511
|
-
this[agent] = await this.$store.dispatch('cluster/find', { type, id });
|
|
507
|
+
this[agent] = await this.$store.dispatch('cluster/find', { type: WORKLOAD_TYPES.DEPLOYMENT, id });
|
|
512
508
|
} catch (err) {
|
|
513
509
|
this[agent] = null;
|
|
514
510
|
}
|
|
@@ -673,11 +669,13 @@ export default {
|
|
|
673
669
|
</div>
|
|
674
670
|
<div data-testid="created__label">
|
|
675
671
|
<label>{{ t('glance.created') }}: </label>
|
|
676
|
-
<span
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
672
|
+
<span>
|
|
673
|
+
<LiveDate
|
|
674
|
+
:value="currentCluster.metadata.creationTimestamp"
|
|
675
|
+
:add-suffix="true"
|
|
676
|
+
:show-tooltip="true"
|
|
677
|
+
/>
|
|
678
|
+
</span>
|
|
681
679
|
</div>
|
|
682
680
|
<div :style="{'flex':1}" />
|
|
683
681
|
<div v-if="showClusterTools">
|
|
@@ -60,7 +60,7 @@ export default {
|
|
|
60
60
|
const out = {};
|
|
61
61
|
|
|
62
62
|
for (const app of (this.installedApps || [])) {
|
|
63
|
-
const matching = app.
|
|
63
|
+
const matching = app.matchingCharts()[0];
|
|
64
64
|
|
|
65
65
|
if ( !matching ) {
|
|
66
66
|
continue;
|
|
@@ -328,8 +328,8 @@ export default {
|
|
|
328
328
|
>{{ t('catalog.charts.deploysOnWindows') }}</label>
|
|
329
329
|
</div>
|
|
330
330
|
<div class="version">
|
|
331
|
-
<template v-if="opt.app && opt.app.
|
|
332
|
-
v{{ opt.app.currentVersion }} <b><i class="icon icon-chevron-right" /> v{{ opt.app.
|
|
331
|
+
<template v-if="opt.app && opt.app.upgradeAvailableVersion">
|
|
332
|
+
v{{ opt.app.currentVersion }} <b><i class="icon icon-chevron-right" /> v{{ opt.app.upgradeAvailableVersion }}</b>
|
|
333
333
|
</template>
|
|
334
334
|
<template v-else-if="opt.app">
|
|
335
335
|
v{{ opt.app.currentVersion }}
|
|
@@ -42,15 +42,10 @@ export default {
|
|
|
42
42
|
inStoreType: 'management',
|
|
43
43
|
type: FLEET.CLUSTER_GROUP
|
|
44
44
|
},
|
|
45
|
-
allBundleDeployments: {
|
|
46
|
-
inStoreType: 'management',
|
|
47
|
-
type: FLEET.BUNDLE_DEPLOYMENT,
|
|
48
|
-
},
|
|
49
45
|
allBundles: {
|
|
50
46
|
inStoreType: 'management',
|
|
51
47
|
type: FLEET.BUNDLE,
|
|
52
48
|
opt: { excludeFields: ['metadata.managedFields', 'spec.resources'] },
|
|
53
|
-
skipWait: true,
|
|
54
49
|
},
|
|
55
50
|
gitRepos: {
|
|
56
51
|
inStoreType: 'management',
|
|
@@ -17,7 +17,7 @@ export default {
|
|
|
17
17
|
project(nue, old) {
|
|
18
18
|
if (nue && !old) {
|
|
19
19
|
// User selected a project while on this page, so redirect to the projects view now that we have a project
|
|
20
|
-
this.$router.replace({ name: 'c-cluster-legacy-project-page', params: { page: '
|
|
20
|
+
this.$router.replace({ name: 'c-cluster-legacy-project-page', params: { page: 'config-maps' } });
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -10,6 +10,8 @@ import { _EDIT, _VIEW } from '@shell/config/query-params';
|
|
|
10
10
|
import UnitInput from '@shell/components/form/UnitInput';
|
|
11
11
|
import { STEVE_CACHE } from '@shell/store/features';
|
|
12
12
|
import { NAME as SETTING_PRODUCT } from '@shell/config/product/settings';
|
|
13
|
+
import paginationUtils from '@shell/utils/pagination-utils';
|
|
14
|
+
import Collapse from '@shell/components/Collapse';
|
|
13
15
|
|
|
14
16
|
const incompatible = {
|
|
15
17
|
incrementalLoading: ['forceNsFilterV2', 'serverPagination'],
|
|
@@ -32,7 +34,8 @@ export default {
|
|
|
32
34
|
AsyncButton,
|
|
33
35
|
Banner,
|
|
34
36
|
LabeledInput,
|
|
35
|
-
UnitInput
|
|
37
|
+
UnitInput,
|
|
38
|
+
Collapse,
|
|
36
39
|
},
|
|
37
40
|
|
|
38
41
|
async fetch() {
|
|
@@ -74,7 +77,8 @@ export default {
|
|
|
74
77
|
product: SETTING_PRODUCT,
|
|
75
78
|
resource: MANAGEMENT.FEATURE
|
|
76
79
|
}
|
|
77
|
-
}).href
|
|
80
|
+
}).href,
|
|
81
|
+
ssPApplicableTypesOpen: false,
|
|
78
82
|
};
|
|
79
83
|
},
|
|
80
84
|
|
|
@@ -93,10 +97,15 @@ export default {
|
|
|
93
97
|
return this.$store.getters['features/get'](STEVE_CACHE);
|
|
94
98
|
},
|
|
95
99
|
|
|
96
|
-
|
|
100
|
+
steveCacheAndSSPEnabled() {
|
|
101
|
+
return this.steveCacheEnabled && this.value.serverPagination.enabled;
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
sspApplicableResources() {
|
|
97
105
|
const storeResources = [];
|
|
106
|
+
const stores = paginationUtils.getStoreSettings(this.value.serverPagination);
|
|
98
107
|
|
|
99
|
-
Object.entries(
|
|
108
|
+
Object.entries(stores).forEach(([store, settings]) => {
|
|
100
109
|
const resources = [];
|
|
101
110
|
|
|
102
111
|
if (settings.resources.enableAll) {
|
|
@@ -173,7 +182,7 @@ export default {
|
|
|
173
182
|
this.$store.dispatch('cluster/promptModal', {
|
|
174
183
|
component: 'GenericPrompt',
|
|
175
184
|
componentProps: {
|
|
176
|
-
applyMode: '
|
|
185
|
+
applyMode: 'continue',
|
|
177
186
|
confirm: (confirmed) => {
|
|
178
187
|
this.value[property].enabled = confirmed;
|
|
179
188
|
},
|
|
@@ -188,13 +197,6 @@ export default {
|
|
|
188
197
|
},
|
|
189
198
|
});
|
|
190
199
|
},
|
|
191
|
-
|
|
192
|
-
setPaginationDefaults() {
|
|
193
|
-
this.value = {
|
|
194
|
-
...this.value,
|
|
195
|
-
serverPagination: { ...DEFAULT_PERF_SETTING.serverPagination }
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
200
|
},
|
|
199
201
|
};
|
|
200
202
|
</script>
|
|
@@ -207,45 +209,6 @@ export default {
|
|
|
207
209
|
</h1>
|
|
208
210
|
<div>
|
|
209
211
|
<div class="ui-perf-setting">
|
|
210
|
-
<!-- Server Side Pagination -->
|
|
211
|
-
<div class="mt-40">
|
|
212
|
-
<h2 id="ssp-setting">
|
|
213
|
-
{{ t('performance.serverPagination.label') }}
|
|
214
|
-
</h2>
|
|
215
|
-
<p>{{ t('performance.serverPagination.description') }}</p>
|
|
216
|
-
<Banner
|
|
217
|
-
color="error"
|
|
218
|
-
label-key="performance.experimental"
|
|
219
|
-
/>
|
|
220
|
-
<Banner
|
|
221
|
-
v-if="!steveCacheEnabled"
|
|
222
|
-
v-clean-html="t(`performance.serverPagination.featureFlag`, { ffUrl }, true)"
|
|
223
|
-
color="warning"
|
|
224
|
-
/>
|
|
225
|
-
<Checkbox
|
|
226
|
-
v-model:value="value.serverPagination.enabled"
|
|
227
|
-
:mode="mode"
|
|
228
|
-
:label="t('performance.serverPagination.checkboxLabel')"
|
|
229
|
-
class="mt-10 mb-20"
|
|
230
|
-
:primary="true"
|
|
231
|
-
:disabled="(!steveCacheEnabled && !value.serverPagination.enabled)"
|
|
232
|
-
@update:value="compatibleWarning('serverPagination', $event)"
|
|
233
|
-
/>
|
|
234
|
-
<p :class="{ 'text-muted': !value.serverPagination.enabled }">
|
|
235
|
-
{{ t('performance.serverPagination.applicable') }}
|
|
236
|
-
</p>
|
|
237
|
-
<p
|
|
238
|
-
v-clean-html="steveCacheApplicableResources"
|
|
239
|
-
:class="{ 'text-muted': !value.serverPagination.enabled }"
|
|
240
|
-
/>
|
|
241
|
-
<button
|
|
242
|
-
class="btn btn-sm role-primary"
|
|
243
|
-
style="width: fit-content;"
|
|
244
|
-
@click.prevent="setPaginationDefaults()"
|
|
245
|
-
>
|
|
246
|
-
{{ t('performance.serverPagination.populateDefaults') }}
|
|
247
|
-
</button>
|
|
248
|
-
</div>
|
|
249
212
|
<!-- Inactivity -->
|
|
250
213
|
<div class="mt-20">
|
|
251
214
|
<h2>{{ t('performance.inactivity.title') }}</h2>
|
|
@@ -287,8 +250,44 @@ export default {
|
|
|
287
250
|
:primary="true"
|
|
288
251
|
/>
|
|
289
252
|
</div>
|
|
253
|
+
<!-- Server Side Pagination -->
|
|
254
|
+
<div class="mt-20">
|
|
255
|
+
<h2 id="ssp-setting">
|
|
256
|
+
{{ t('performance.serverPagination.label') }}
|
|
257
|
+
</h2>
|
|
258
|
+
<p>{{ t('performance.serverPagination.description') }}</p>
|
|
259
|
+
<Banner
|
|
260
|
+
v-if="!steveCacheEnabled"
|
|
261
|
+
v-clean-html="t(`performance.serverPagination.featureFlag`, { ffUrl }, true)"
|
|
262
|
+
color="warning"
|
|
263
|
+
/>
|
|
264
|
+
<Banner
|
|
265
|
+
color="error"
|
|
266
|
+
label-key="performance.serverPagination.experimental"
|
|
267
|
+
/>
|
|
268
|
+
<Checkbox
|
|
269
|
+
v-model:value="value.serverPagination.enabled"
|
|
270
|
+
:mode="mode"
|
|
271
|
+
:label="t('performance.serverPagination.checkboxLabel')"
|
|
272
|
+
class="mt-10 mb-10"
|
|
273
|
+
:primary="true"
|
|
274
|
+
:disabled="!steveCacheEnabled"
|
|
275
|
+
@update:value="compatibleWarning('serverPagination', $event)"
|
|
276
|
+
/>
|
|
277
|
+
<Collapse
|
|
278
|
+
:title="t('performance.serverPagination.applicable')"
|
|
279
|
+
:open="steveCacheAndSSPEnabled && ssPApplicableTypesOpen"
|
|
280
|
+
:isDisabled="!steveCacheAndSSPEnabled"
|
|
281
|
+
@update:open="ssPApplicableTypesOpen = !ssPApplicableTypesOpen"
|
|
282
|
+
>
|
|
283
|
+
<p
|
|
284
|
+
v-clean-html="sspApplicableResources"
|
|
285
|
+
:class="{ 'text-muted': !value.serverPagination.enabled }"
|
|
286
|
+
/>
|
|
287
|
+
</Collapse>
|
|
288
|
+
</div>
|
|
290
289
|
<!-- Incremental Loading -->
|
|
291
|
-
<div class="mt-
|
|
290
|
+
<div class="mt-20">
|
|
292
291
|
<h2>{{ t('performance.incrementalLoad.label') }}</h2>
|
|
293
292
|
<Banner
|
|
294
293
|
color="warning"
|
|
@@ -451,7 +450,7 @@ export default {
|
|
|
451
450
|
/>
|
|
452
451
|
</div>
|
|
453
452
|
<!-- Advanced Websocket Worker -->
|
|
454
|
-
<div class="mt-
|
|
453
|
+
<div class="mt-20">
|
|
455
454
|
<h2>{{ t('performance.advancedWorker.label') }}</h2>
|
|
456
455
|
<Banner
|
|
457
456
|
color="warning"
|
|
@@ -9,7 +9,7 @@ import { fetchOrCreateSetting } from '@shell/utils/settings';
|
|
|
9
9
|
import { getVersionData, isRancherPrime } from '@shell/config/version';
|
|
10
10
|
import { CATALOG as CATALOG_ANNOTATIONS } from '@shell/config/labels-annotations';
|
|
11
11
|
import { NAME as APP_PRODUCT } from '@shell/config/product/apps';
|
|
12
|
-
import ActionMenu from '@shell/components/
|
|
12
|
+
import ActionMenu from '@shell/components/ActionMenuShell';
|
|
13
13
|
import Tabbed from '@shell/components/Tabbed/index.vue';
|
|
14
14
|
import Tab from '@shell/components/Tabbed/Tab.vue';
|
|
15
15
|
import IconMessage from '@shell/components/IconMessage.vue';
|
|
@@ -45,7 +45,8 @@ const TABS_VALUES = {
|
|
|
45
45
|
INSTALLED: 'installed',
|
|
46
46
|
UPDATES: 'updates',
|
|
47
47
|
AVAILABLE: 'available',
|
|
48
|
-
|
|
48
|
+
BUILTIN: 'builtin',
|
|
49
|
+
ALL: 'all',
|
|
49
50
|
};
|
|
50
51
|
|
|
51
52
|
export default {
|
|
@@ -210,15 +211,19 @@ export default {
|
|
|
210
211
|
},
|
|
211
212
|
|
|
212
213
|
list() {
|
|
213
|
-
|
|
214
|
+
// If not an extension developer, then don't include built-in extensions
|
|
215
|
+
const all = this.pluginDeveloper ? this.available : this.available.filter((p) => !p.builtin);
|
|
214
216
|
|
|
215
217
|
switch (this.view) {
|
|
216
218
|
case TABS_VALUES.INSTALLED:
|
|
217
|
-
|
|
219
|
+
// We never show built-in extensions as installed - installed are just the ones the user has installed
|
|
220
|
+
return all.filter((p) => !p.builtin && (!!p.installed || !!p.installing));
|
|
218
221
|
case TABS_VALUES.UPDATES:
|
|
219
222
|
return this.updates;
|
|
220
223
|
case TABS_VALUES.AVAILABLE:
|
|
221
224
|
return all.filter((p) => !p.installed);
|
|
225
|
+
case TABS_VALUES.BUILTIN:
|
|
226
|
+
return all.filter((p) => p.builtin);
|
|
222
227
|
default:
|
|
223
228
|
return all;
|
|
224
229
|
}
|
|
@@ -688,25 +693,11 @@ export default {
|
|
|
688
693
|
</div>
|
|
689
694
|
<!-- extensions menu -->
|
|
690
695
|
<div v-if="hasFeatureFlag && hasMenuActions">
|
|
691
|
-
<button
|
|
692
|
-
ref="actions"
|
|
693
|
-
aria-haspopup="true"
|
|
694
|
-
type="button"
|
|
695
|
-
class="btn role-multi-action actions"
|
|
696
|
-
data-testid="extensions-page-menu"
|
|
697
|
-
role="button"
|
|
698
|
-
:aria-label="t('plugins.labels.menu')"
|
|
699
|
-
@click="setMenu"
|
|
700
|
-
>
|
|
701
|
-
<i class="icon icon-actions" />
|
|
702
|
-
</button>
|
|
703
696
|
<ActionMenu
|
|
697
|
+
data-testid="extensions-page-menu"
|
|
698
|
+
button-role="tertiary"
|
|
699
|
+
:button-aria-label="t('plugins.labels.menu')"
|
|
704
700
|
:custom-actions="menuActions"
|
|
705
|
-
:open="menuOpen"
|
|
706
|
-
:use-custom-target-element="true"
|
|
707
|
-
:custom-target-element="menuTargetElement"
|
|
708
|
-
:custom-target-event="menuTargetEvent"
|
|
709
|
-
@close="setMenu(false)"
|
|
710
701
|
@devLoad="showDeveloperLoadDialog"
|
|
711
702
|
@manageRepos="manageRepos"
|
|
712
703
|
@addRancherRepos="showAddExtensionReposDialog"
|
|
@@ -790,10 +781,16 @@ export default {
|
|
|
790
781
|
:weight="18"
|
|
791
782
|
:badge="updates.length"
|
|
792
783
|
/>
|
|
784
|
+
<Tab
|
|
785
|
+
v-if="pluginDeveloper"
|
|
786
|
+
:name="TABS_VALUES.BUILTIN"
|
|
787
|
+
label-key="plugins.tabs.builtin"
|
|
788
|
+
:weight="17"
|
|
789
|
+
/>
|
|
793
790
|
<Tab
|
|
794
791
|
:name="TABS_VALUES.ALL"
|
|
795
792
|
label-key="plugins.tabs.all"
|
|
796
|
-
:weight="
|
|
793
|
+
:weight="16"
|
|
797
794
|
/>
|
|
798
795
|
</Tabbed>
|
|
799
796
|
<div
|
package/pages/home.vue
CHANGED
|
@@ -29,6 +29,8 @@ import { PaginationParamFilter, FilterArgs, PaginationFilterField, PaginationArg
|
|
|
29
29
|
import ProvCluster from '@shell/models/provisioning.cattle.io.cluster';
|
|
30
30
|
import { sameContents } from '@shell/utils/array';
|
|
31
31
|
import { PagTableFetchPageSecondaryResourcesOpts, PagTableFetchSecondaryResourcesOpts, PagTableFetchSecondaryResourcesReturns } from '@shell/types/components/paginatedResourceTable';
|
|
32
|
+
import { CURRENT_RANCHER_VERSION } from '@shell/config/version';
|
|
33
|
+
import { CAPI as CAPI_LAB_AND_ANO } from '@shell/config/labels-annotations';
|
|
32
34
|
|
|
33
35
|
export default defineComponent({
|
|
34
36
|
name: 'Home',
|
|
@@ -53,17 +55,17 @@ export default defineComponent({
|
|
|
53
55
|
// Page actions don't change on the Home Page
|
|
54
56
|
pageActions: [
|
|
55
57
|
{
|
|
56
|
-
|
|
57
|
-
action:
|
|
58
|
+
label: this.t('nav.header.setLoginPage'),
|
|
59
|
+
action: SET_LOGIN_ACTION
|
|
58
60
|
},
|
|
59
|
-
{
|
|
61
|
+
{ divider: true },
|
|
60
62
|
{
|
|
61
|
-
|
|
62
|
-
action:
|
|
63
|
+
label: this.t('nav.header.showHideBanner'),
|
|
64
|
+
action: SHOW_HIDE_BANNER_ACTION
|
|
63
65
|
},
|
|
64
66
|
{
|
|
65
|
-
|
|
66
|
-
action:
|
|
67
|
+
label: this.t('nav.header.restoreCards'),
|
|
68
|
+
action: RESET_CARDS_ACTION
|
|
67
69
|
},
|
|
68
70
|
],
|
|
69
71
|
vendor: getVendor(),
|
|
@@ -155,11 +157,12 @@ export default defineComponent({
|
|
|
155
157
|
|
|
156
158
|
paginationHeaders: [
|
|
157
159
|
STEVE_STATE_COL,
|
|
158
|
-
// https://github.com/rancher/dashboard/issues/12890 BUG - rke1 cluster's prov cluster metadata.name is the mgmt cluster id rather than true name
|
|
159
160
|
{
|
|
160
161
|
...STEVE_NAME_COL,
|
|
161
162
|
canBeVariable: true,
|
|
162
|
-
|
|
163
|
+
value: `metadata.annotations[${ CAPI_LAB_AND_ANO.HUMAN_NAME }]`,
|
|
164
|
+
sort: [`metadata.annotations[${ CAPI_LAB_AND_ANO.HUMAN_NAME }]`],
|
|
165
|
+
search: `metadata.annotations[${ CAPI_LAB_AND_ANO.HUMAN_NAME }]`,
|
|
163
166
|
},
|
|
164
167
|
{
|
|
165
168
|
label: this.t('landing.clusters.provider'),
|
|
@@ -203,6 +206,8 @@ export default defineComponent({
|
|
|
203
206
|
],
|
|
204
207
|
|
|
205
208
|
clusterCount: 0,
|
|
209
|
+
|
|
210
|
+
CURRENT_RANCHER_VERSION
|
|
206
211
|
};
|
|
207
212
|
},
|
|
208
213
|
|
|
@@ -527,7 +532,7 @@ export default defineComponent({
|
|
|
527
532
|
color="info whats-new"
|
|
528
533
|
>
|
|
529
534
|
<div>
|
|
530
|
-
{{ t('landing.seeWhatsNew') }}
|
|
535
|
+
{{ t('landing.seeWhatsNew', { version: CURRENT_RANCHER_VERSION }) }}
|
|
531
536
|
</div>
|
|
532
537
|
<a
|
|
533
538
|
class="hand banner-link"
|
|
@@ -535,10 +540,10 @@ export default defineComponent({
|
|
|
535
540
|
role="link"
|
|
536
541
|
target="_blank"
|
|
537
542
|
rel="noopener noreferrer nofollow"
|
|
538
|
-
:aria-label="t('landing.whatsNewLink')"
|
|
543
|
+
:aria-label="t('landing.whatsNewLink', { version: CURRENT_RANCHER_VERSION })"
|
|
539
544
|
@click.stop="showWhatsNew"
|
|
540
545
|
@keyup.stop.enter="showWhatsNew"
|
|
541
|
-
><span v-clean-html="t('landing.whatsNewLink')" /></a>
|
|
546
|
+
><span v-clean-html="t('landing.whatsNewLink', { version: CURRENT_RANCHER_VERSION })" /></a>
|
|
542
547
|
</Banner>
|
|
543
548
|
</div>
|
|
544
549
|
</div>
|
package/pages/prefs.vue
CHANGED
|
@@ -191,11 +191,15 @@ export default {
|
|
|
191
191
|
v-if="hasMultipleLocales && !isHarvester"
|
|
192
192
|
class="mt-10 mb-10"
|
|
193
193
|
>
|
|
194
|
-
<h4
|
|
194
|
+
<h4
|
|
195
|
+
id="prefs-language"
|
|
196
|
+
v-t="'prefs.language'"
|
|
197
|
+
/>
|
|
195
198
|
<div class="row">
|
|
196
199
|
<div class="col span-4">
|
|
197
200
|
<LocaleSelector
|
|
198
201
|
data-testid="prefs__languageSelector"
|
|
202
|
+
aria-labelledby="prefs-language"
|
|
199
203
|
/>
|
|
200
204
|
</div>
|
|
201
205
|
</div>
|
package/plugins/shortkey.js
CHANGED
|
@@ -10,6 +10,7 @@ const ShortKey = {};
|
|
|
10
10
|
const mapFunctions = {};
|
|
11
11
|
let objAvoided = [];
|
|
12
12
|
let elementAvoided = [];
|
|
13
|
+
let containerAvoided = [];
|
|
13
14
|
let keyPressed = false;
|
|
14
15
|
|
|
15
16
|
const parseValue = (value) => {
|
|
@@ -55,6 +56,7 @@ const unbindValue = (value, el) => {
|
|
|
55
56
|
|
|
56
57
|
ShortKey.install = (Vue, options) => {
|
|
57
58
|
elementAvoided = [...(options && options.prevent ? options.prevent : [])];
|
|
59
|
+
containerAvoided = [...(options && options.preventContainer ? options.preventContainer : [])];
|
|
58
60
|
Vue.directive('shortkey', {
|
|
59
61
|
beforeMount: (el, binding, vnode) => {
|
|
60
62
|
// Mapping the commands
|
|
@@ -266,8 +268,15 @@ const mappingFunctions = ({
|
|
|
266
268
|
const availableElement = (decodedKey) => {
|
|
267
269
|
const objectIsAvoided = !!objAvoided.find((r) => r === document.activeElement);
|
|
268
270
|
const filterAvoided = !!(elementAvoided.find((selector) => document.activeElement && document.activeElement.matches(selector)));
|
|
271
|
+
const filterAvoidedContainer = !!(containerAvoided.find((selector) => isActiveElementChildOf(selector)));
|
|
269
272
|
|
|
270
|
-
return !!mapFunctions[decodedKey] && !(objectIsAvoided || filterAvoided);
|
|
273
|
+
return !!mapFunctions[decodedKey] && !(objectIsAvoided || filterAvoided) && !filterAvoidedContainer;
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
const isActiveElementChildOf = (container) => {
|
|
277
|
+
const activeElement = document.activeElement;
|
|
278
|
+
|
|
279
|
+
return activeElement && activeElement.closest(container) !== null;
|
|
271
280
|
};
|
|
272
281
|
|
|
273
282
|
export default ShortKey;
|