From 0768d82f1633e2d7903d678f4254b9242f94365c Mon Sep 17 00:00:00 2001 From: Giuseppe Leo Date: Wed, 25 Jan 2023 14:02:26 +0100 Subject: [PATCH] PSA minor changes (#8022) * Add missing and correct i18n PSA labels * Correct description size by removing helper * Add title to Namespace list tooltip if any PSA * Allow to disable use of checkbox for PSA form * Change timeout for growl to 5s on Pod warning due PSA * Add type label for PSA * Move PSA menu under Advanced * Replace toggling system label with extending the value within the same * Emit initial PSA form values con creation if no checkboxes due lack of interactions --- shell/assets/translations/en-us.yaml | 17 ++- shell/components/DetailTop.vue | 3 +- .../components/ExplorerProjectsNamespaces.vue | 10 +- shell/components/PodSecurityAdmission.vue | 50 +++++-- .../__tests__/PodSecurityAdmission.test.ts | 136 ++++++++++++++++-- shell/components/form/Labels.vue | 2 +- shell/config/product/manager.js | 6 +- ...securityadmissionconfigurationtemplate.vue | 1 + shell/edit/namespace.vue | 4 +- shell/models/pod.js | 1 + 10 files changed, 202 insertions(+), 28 deletions(-) diff --git a/shell/assets/translations/en-us.yaml b/shell/assets/translations/en-us.yaml index 0638626131..608b9ee1a3 100644 --- a/shell/assets/translations/en-us.yaml +++ b/shell/assets/translations/en-us.yaml @@ -3942,10 +3942,20 @@ plugins: title: Remove the Rancher Extensions Custom Resource Definition prompt: There are one or more extensions installed - removing the CRD will require you to manually reinstall these extensions if you subsequently re-enable extensions support. podSecurityAdmission: - label: Pod Security Admission + name: Pod Security Admission description: Define the admission control mode you want to use for the pod security banner: modifications: 'Note: Modifying a Pod Security Admission Configuration Template will not affect any downstream cluster that references it until there is a cluster update' + labels: + enforce: Enforce + audit: Audit + warn: Warn + usernames: Usernames + runtimeClasses: RuntimeClasses + namespaces: Namespaces + privileged: privileged + baseline: baseline + restricted: restricted version: placeholder: 'Version (default: latest)' exemptions: @@ -6213,6 +6223,11 @@ typeLabel: one { Workspace } other { Workspaces } } + management.cattle.io.podsecurityadmissionconfigurationtemplate: |- + {count, plural, + one { Pod Security Admission } + other { Pod Security Admissions } + } policy.poddisruptionbudget: |- {count, plural, one { Pod Disruption Budget } diff --git a/shell/components/DetailTop.vue b/shell/components/DetailTop.vue index 780f780efb..907e71000f 100644 --- a/shell/components/DetailTop.vue +++ b/shell/components/DetailTop.vue @@ -90,7 +90,7 @@ export default { }, labels() { - if (this.showAllLabels || !this.showFilteredSystemLabels) { + if (!this.showFilteredSystemLabels) { return this.value?.labels || {}; } @@ -249,6 +249,7 @@ export default { v-tooltip="prop ? `${key} : ${prop}` : key" > {{ internalTooltips[key] ? internalTooltips[key] : key }} + : {{ key }} {{ prop ? `${key} : ${prop}` : key }} diff --git a/shell/components/ExplorerProjectsNamespaces.vue b/shell/components/ExplorerProjectsNamespaces.vue index 06c23843c6..56c2933490 100644 --- a/shell/components/ExplorerProjectsNamespaces.vue +++ b/shell/components/ExplorerProjectsNamespaces.vue @@ -235,13 +235,17 @@ export default { } }, methods: { - getPSA(row) { + /** + * Get PSA HTML to be displayed in the tooltips + */ + getPsaTooltip(row) { const dictionary = row.psaTooltipsDescription; const list = Object.values(dictionary) .sort() .map(text => `
  • ${ text }
  • `).join(''); + const title = `

    ${ this.t('podSecurityAdmission.name') }:

    `; - return ``; + return `${ title }`; }, userIsFilteringForSpecificNamespaceOrProject() { @@ -409,7 +413,7 @@ export default { diff --git a/shell/components/PodSecurityAdmission.vue b/shell/components/PodSecurityAdmission.vue index 8e3fc5ad0c..993d95c85f 100644 --- a/shell/components/PodSecurityAdmission.vue +++ b/shell/components/PodSecurityAdmission.vue @@ -1,6 +1,6 @@