From 47626412af44960de72c0df88a5ce57296ad6abd Mon Sep 17 00:00:00 2001 From: Vikalp Rusia Date: Thu, 26 Sep 2024 09:19:58 +0530 Subject: [PATCH 1/2] escaped-html-notifcation Signed-off-by: Vikalp Rusia --- pkg/rancher-desktop/components/Snapshots.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/rancher-desktop/components/Snapshots.vue b/pkg/rancher-desktop/components/Snapshots.vue index 63a969cd43e..db801e43f72 100644 --- a/pkg/rancher-desktop/components/Snapshots.vue +++ b/pkg/rancher-desktop/components/Snapshots.vue @@ -5,6 +5,8 @@ import isEmpty from 'lodash/isEmpty'; import Vue from 'vue'; import { mapGetters } from 'vuex'; +import { escapeHtml } from '../utils/string'; + import EmptyState from '@pkg/components/EmptyState.vue'; import SnapshotCard from '@pkg/components/SnapshotCard.vue'; import { Snapshot, SnapshotEvent } from '@pkg/main/snapshots/types'; @@ -19,6 +21,7 @@ interface Data { interface Methods { pollingStart: () => void, currentTime: () => string, + escapeSnapshotName: (name: string|undefined) => string, } interface Computed { @@ -85,6 +88,9 @@ export default Vue.extend({ return date.format('YYYY-MM-DD HH:mm'); }, + escapeSnapshotName(value: string|undefined) { + return escapeHtml(value); + }, }, }); @@ -102,7 +108,8 @@ export default Vue.extend({ @close="snapshotEvent=null" > Date: Thu, 26 Sep 2024 23:02:46 +0530 Subject: [PATCH 2/2] refactored-code Signed-off-by: Vikalp Rusia --- pkg/rancher-desktop/components/Snapshots.vue | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/pkg/rancher-desktop/components/Snapshots.vue b/pkg/rancher-desktop/components/Snapshots.vue index db801e43f72..e1efb4c1362 100644 --- a/pkg/rancher-desktop/components/Snapshots.vue +++ b/pkg/rancher-desktop/components/Snapshots.vue @@ -5,12 +5,11 @@ import isEmpty from 'lodash/isEmpty'; import Vue from 'vue'; import { mapGetters } from 'vuex'; -import { escapeHtml } from '../utils/string'; - import EmptyState from '@pkg/components/EmptyState.vue'; import SnapshotCard from '@pkg/components/SnapshotCard.vue'; import { Snapshot, SnapshotEvent } from '@pkg/main/snapshots/types'; import { ipcRenderer } from '@pkg/utils/ipcRenderer'; +import { escapeHtml } from '@pkg/utils/string'; interface Data { snapshotEvent: SnapshotEvent | null; @@ -21,7 +20,7 @@ interface Data { interface Methods { pollingStart: () => void, currentTime: () => string, - escapeSnapshotName: (name: string|undefined) => string, + escapeHtml: (name: string|undefined) => string, } interface Computed { @@ -88,9 +87,7 @@ export default Vue.extend({ return date.format('YYYY-MM-DD HH:mm'); }, - escapeSnapshotName(value: string|undefined) { - return escapeHtml(value); - }, + escapeHtml, }, }); @@ -109,7 +106,7 @@ export default Vue.extend({ >