@@ -10,10 +10,10 @@ import LabeledSelect from '@shell/components/form/LabeledSelect';
10
10
import Banner from ' @components/Banner/Banner.vue' ;
11
11
import { Checkbox } from ' @components/Form/Checkbox' ;
12
12
import { MANAGEMENT , NAMESPACE } from ' @shell/config/types' ;
13
- import UnitInput from ' @shell/components/form/UnitInput.vue' ;
14
13
import {
14
+ REGISTRY_DEFAULT_URI ,
15
15
REGISTRY_TYPE_OPTIONS ,
16
- SCAN_INTERVAL_OPTIONS
16
+ SCAN_INTERVAL_OPTIONS , SCAN_INTERVALS
17
17
} from " @sbombastic-image-vulnerability-scanner/constants/scan-interval-options" ;
18
18
19
19
export default {
@@ -28,7 +28,6 @@ export default {
28
28
SelectOrCreateAuthSecret,
29
29
Banner,
30
30
Checkbox,
31
- UnitInput,
32
31
LabeledSelect
33
32
},
34
33
@@ -37,10 +36,7 @@ export default {
37
36
data () {
38
37
if (! this .value .spec ) {
39
38
this .value .spec = {
40
- insecure: true ,
41
39
authSecret: ' ' ,
42
- caBundle: ' ' ,
43
- type: {},
44
40
uri: ' ' ,
45
41
repositories: [],
46
42
};
@@ -52,8 +48,6 @@ export default {
52
48
}
53
49
54
50
return {
55
- selectedRegistryType: this .value .type || ' ecr' ,
56
- secretNamespace: this .$store .getters [' defaultNamespace' ],
57
51
inStore: this .$store .getters [' currentProduct' ].inStore ,
58
52
errors: null ,
59
53
};
@@ -69,7 +63,8 @@ export default {
69
63
return this .$store .getters [' currentProduct' ]? .inStore || MANAGEMENT ;
70
64
},
71
65
secretNamespace () {
72
- const tryNames = [' cattle-system' , ' default' ];
66
+ const currentNamespace = this .value .metadata ? .namespace ? this .value .metadata .namespace : this .$store .getters [' defaultNamespace' ];
67
+ const tryNames = [ currentNamespace, ' default' ];
73
68
74
69
for ( const name of tryNames ) {
75
70
if ( this .$store .getters [' cluster/byId' ](NAMESPACE , name) ) {
@@ -87,19 +82,19 @@ export default {
87
82
REGISTRY_TYPE_OPTIONS : function () {
88
83
return REGISTRY_TYPE_OPTIONS ;
89
84
},
90
-
91
- useProxy: {
92
- get () {
93
- return ! this .value .spec .insecure ;
94
- },
95
- set (val ) {
96
- this .value .spec .insecure = ! val;
97
- }
98
- }
99
85
},
100
- }
101
86
87
+ // Set default values for creating a new registry configuration
88
+ created () {
89
+ const spec = this .value .spec ;
90
+
91
+ spec .scanInterval ?? = SCAN_INTERVALS .THREE_HOURS ;
92
+ spec .uri ?? = REGISTRY_DEFAULT_URI .DOCKERHUB ;
93
+ spec .uri = spec .uri || REGISTRY_DEFAULT_URI .DOCKERHUB ;
94
+ }
95
+ }
102
96
< / script>
97
+
103
98
< template>
104
99
< div class = " filled-height" >
105
100
< Banner color= " info" >
@@ -142,63 +137,49 @@ export default {
142
137
< LabeledInput
143
138
: label= " t('imageScanner.registries.configuration.cru.registry.uri.label')"
144
139
v- model: value= " value.spec.uri"
145
- : placeholderKey = " t('imageScanner.registries.configuration.cru.registry.uri.placeholder')"
140
+ : placeholder = " t('imageScanner.registries.configuration.cru.registry.uri.placeholder')"
146
141
/ >
147
142
< / div>
148
143
< / div>
149
-
150
- < Checkbox
151
- v- model: value= " useProxy"
152
- class = " mt-20 mb-10"
144
+ < div class = " registry-input-label mt-24 mb-0" >
145
+ {{ t (' imageScanner.registries.configuration.cru.authentication.label' ) }}
146
+ < / div>
147
+ < SelectOrCreateAuthSecret
148
+ v- model: value= " value.spec.authSecret"
153
149
: mode= " mode"
154
- : label= " t('imageScanner.registries.configuration.cru.proxy.enable')"
155
- : tooltipKey= " t('imageScanner.registries.configuration.cru.proxy.tooltip')"
156
- data- testid= " registry-use-proxy"
150
+ data- testid= " registry-auth-secret"
151
+ : register- before- hook= " registerBeforeHook"
152
+ : namespace= " secretNamespace"
153
+ : limit- to- namespace= " true"
154
+ : in - store= " inStore"
155
+ : allow- ssh= false
156
+ generate- name= " registry-auth-"
157
+ : cache- secrets= " true"
157
158
/ >
159
+ < div class = " registry-input-label mt-24" >
160
+ {{ t (' imageScanner.registries.configuration.cru.scan.label' ) }}
161
+ < / div>
158
162
159
- < div v- if = " useProxy" >
160
- < div class = " registry-input-label mb-0" >
161
- {{ t (' imageScanner.registries.configuration.cru.authLabel' ) }}
162
- < / div>
163
- < SelectOrCreateAuthSecret
164
- : value= " value.spec.authSecret"
165
- : mode= " mode"
166
- data- testid= " registry-auth-secret"
167
- : register- before- hook= " registerBeforeHook"
168
- : namespace= " secretNamespace"
169
- : limit- to- namespace= " true"
170
- : in - store= " inStore"
171
- : allow- ssh= false
172
- generate- name= " registry-auth-"
173
- : cache- secrets= " true"
174
- @input= " val => value.spec.authSecret = val"
175
- / >
176
-
177
- < div class = " registry-input-label mt-24" >
178
- {{ t (' imageScanner.registries.configuration.cru.scan.label' ) }}
163
+ < div class = " row" >
164
+ < div class = " col span-6" >
165
+ < LabeledSelect
166
+ v- model: value= " value.spec.repositories"
167
+ : options= " value.spec.repositories"
168
+ : placeholder= " t('imageScanner.registries.configuration.cru.scan.placeholder')"
169
+ : label= " t('imageScanner.registries.configuration.cru.scan.type')"
170
+ / >
179
171
< / div>
180
-
181
- < div class = " row" >
182
- < div class = " col span-6" >
183
- < LabeledSelect
184
- v- model: value= " value.spec.repositories"
185
- : label= " t('imageScanner.registries.configuration.cru.scan.type')"
186
- >
187
- < / LabeledSelect>
188
- < / div>
189
- < div class = " col span-3" >
190
- < LabeledSelect
191
- v- model: value= " value.spec.scanInterval"
192
- data- testid= " registry-scan-interval-select"
193
- : options = " SCAN_INTERVAL_OPTIONS"
194
- option- key= " value"
195
- option- label= " label"
196
- value= " 0s"
197
- : label= " t('imageScanner.registries.configuration.cru.scan.schedule.label')"
198
- / >
199
- < / div>
172
+ < div class = " col span-3" >
173
+ < LabeledSelect
174
+ v- model: value= " value.spec.scanInterval"
175
+ data- testid= " registry-scan-interval-select"
176
+ : options = " SCAN_INTERVAL_OPTIONS"
177
+ option- key= " value"
178
+ option- label= " label"
179
+ : label= " t('imageScanner.registries.configuration.cru.scan.schedule.label')"
180
+ required
181
+ / >
200
182
< / div>
201
-
202
183
< / div>
203
184
204
185
< / CruResource>
0 commit comments