Skip to content

Commit ff50647

Browse files
lsongsusexingzhang-suse
authored andcommitted
Github #351 Bug: Scan Interval dropdown shows 'xh0m0s' instead of the label when editing
1 parent f4b910e commit ff50647

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

pkg/sbomscanner/constants/securityConstants.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
export const NVD_BASE_URL = 'https://nvd.nist.gov/vuln/detail/';
22
export const CVSS_VECTOR_BASE_URL = 'https://www.first.org/cvss/calculator/';
33
export const SCAN_INTERVALS = {
4-
ONE_HOUR: '1h',
5-
THREE_HOURS: '3h',
6-
SIX_HOURS: '6h',
7-
TWELVE_HOURS: '12h',
8-
TWENTY_FOUR_HOURS: '24h',
4+
ONE_HOUR: '1h0m0s',
5+
THREE_HOURS: '3h0m0s',
6+
SIX_HOURS: '6h0m0s',
7+
TWELVE_HOURS: '12h0m0s',
8+
TWENTY_FOUR_HOURS: '24h0m0s',
99
MANUAL: '0s'
1010
};
1111

pkg/sbomscanner/edit/sbomscanner.kubewarden.io.registry.vue

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,21 @@ export default {
112112
return SCAN_INTERVAL_OPTIONS;
113113
},
114114
115+
selectedScanInterval: {
116+
get() {
117+
const currentInterval = this.value.spec.scanInterval;
118+
119+
if (!currentInterval || currentInterval === SCAN_INTERVALS.MANUAL ) {
120+
return SCAN_INTERVALS.MANUAL;
121+
}
122+
123+
return currentInterval;
124+
},
125+
set(newValue) {
126+
this.value.spec.scanInterval = newValue;
127+
}
128+
},
129+
115130
REGISTRY_TYPE_OPTIONS() {
116131
return REGISTRY_TYPE_OPTIONS;
117132
},
@@ -302,7 +317,7 @@ export default {
302317
</div>
303318
<div class="col span-3">
304319
<LabeledSelect
305-
v-model:value="value.spec.scanInterval"
320+
v-model:value="selectedScanInterval"
306321
data-testid="registry-scanning-interval-select"
307322
:placeholder="t('imageScanner.registries.configuration.cru.scan.schedule.placeholder', { manualScan: t('imageScanner.registries.configuration.cru.scan.schedule.manualScan') })"
308323
:options="SCAN_INTERVAL_OPTIONS"

0 commit comments

Comments
 (0)