@@ -9,9 +9,12 @@ import SelectOrCreateAuthSecret from '@shell/components/form/SelectOrCreateAuthS
9
9
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
- import { MANAGEMENT , NAMESPACE , CLUSTER_REPO_TYPES } from ' @shell/config/types' ;
12
+ import { MANAGEMENT , NAMESPACE } from ' @shell/config/types' ;
13
13
import UnitInput from ' @shell/components/form/UnitInput.vue' ;
14
- import {ref } from " vue" ;
14
+ import {
15
+ REGISTRY_TYPE_OPTIONS ,
16
+ SCAN_INTERVAL_OPTIONS
17
+ } from " @sbombastic-image-vulnerability-scanner/constants/scan-interval-options" ;
15
18
16
19
export default {
17
20
name: ' CruRegistry' ,
@@ -32,7 +35,6 @@ export default {
32
35
mixins: [CreateEditView],
33
36
34
37
data () {
35
-
36
38
if (! this .value .spec ) {
37
39
this .value .spec = {
38
40
insecure: true ,
@@ -49,8 +51,6 @@ export default {
49
51
};
50
52
}
51
53
52
- console .log (' this.value after:' ,this .value );
53
-
54
54
return {
55
55
selectedRegistryType: this .value .type || ' ecr' ,
56
56
secretNamespace: this .$store .getters [' defaultNamespace' ],
@@ -60,19 +60,6 @@ export default {
60
60
},
61
61
62
62
computed: {
63
- registryTypeOptions (){
64
- return [
65
- {
66
- label: this .t (' imageScanner.registries.configuration.cru.registry.type.ecr' ),
67
- value: ' ecr' ,
68
- },
69
- {
70
- label: this .t (' imageScanner.registries.configuration.cru.registry.type.azure' ),
71
- value: ' azure' ,
72
- },
73
- ];
74
- },
75
-
76
63
namespace (){
77
64
console .log (' this.value.spec.type:' ,this .value .spec .type );
78
65
return this .value .spec .type === ' ecr' ? " kube-system" : " "
@@ -93,6 +80,14 @@ export default {
93
80
return this .$store .getters [` ${ this .inStore } /all` ](NAMESPACE )[0 ]? .id ;
94
81
},
95
82
83
+ SCAN_INTERVAL_OPTIONS : function () {
84
+ return SCAN_INTERVAL_OPTIONS ;
85
+ },
86
+
87
+ REGISTRY_TYPE_OPTIONS : function () {
88
+ return REGISTRY_TYPE_OPTIONS ;
89
+ },
90
+
96
91
useProxy: {
97
92
get () {
98
93
return ! this .value .spec .insecure ;
@@ -111,103 +106,102 @@ export default {
111
106
{{t (' imageScanner.registries.configuration.cru.description' )}}
112
107
< / Banner>
113
108
< CruResource
114
- : done- route= " doneRoute"
115
- : mode= " mode"
116
- : resource= " value"
117
- : subtypes= " []"
118
- : validation- passed= " true"
119
- : errors= " errors"
120
- @error= " (e) => (errors = e)"
121
- @finish= " save"
122
- @cancel= " done"
123
- >
124
- < NameNsDescription
125
- : value= " value"
126
- : mode= " mode"
127
- : namespaced= " isNamespaced"
128
- @update: value= " $emit('input', $event)"
129
- / >
130
-
131
- < div class = " registry-input-label" >
132
- {{ t (' imageScanner.registries.configuration.cru.registry.label' ) }}
133
- < / div>
134
-
135
- < div class = " row" >
136
- < div class = " col span-6" >
137
- < LabeledSelect
138
- v- model: value= " value.spec.type"
139
- data- testid= " registry-type-select"
140
- : label= " t('imageScanner.registries.configuration.cru.registry.type.label')"
141
- : options= " registryTypeOptions"
142
- : placeholder= " t('imageScanner.registry.configuration.cru.registry.type.placeholder')"
143
- required
144
- / >
145
- < / div>
146
- < div class = " col span-3" >
147
- < LabeledInput
148
- : label= " t('imageScanner.registries.configuration.cru.registry.namespace.label')"
149
- : value= " namespace"
150
- : placeholderKey= " t('imageScanner.registries.configuration.cru.registry.namespace.placeholder')"
151
- disabled= true
152
- / >
153
- < / div>
154
- < / div>
155
-
156
- < Checkbox
157
- v- model: value= " useProxy"
158
- class = " mt-20 mb-10"
109
+ : done- route= " doneRoute"
159
110
: mode= " mode"
160
- : label= " t('imageScanner.registries.configuration.cru.proxy.enable')"
161
- : tooltipKey= " t('imageScanner.registries.configuration.cru.proxy.tooltip')"
162
- data- testid= " registry-use-proxy"
163
- / >
164
-
165
- < div v- if = " useProxy" >
166
- < div class = " registry-input-label mb-0" >
167
- {{ t (' imageScanner.registries.configuration.cru.authLabel' ) }}
168
- < / div>
169
- < SelectOrCreateAuthSecret
170
- : value= " value.spec.authSecret"
111
+ : resource= " value"
112
+ : subtypes= " []"
113
+ : validation- passed= " true"
114
+ : errors= " errors"
115
+ @error= " (e) => (errors = e)"
116
+ @finish= " save"
117
+ @cancel= " done"
118
+ >
119
+ < NameNsDescription
120
+ : value= " value"
171
121
: mode= " mode"
172
- data- testid= " registry-auth-secret"
173
- : register- before- hook= " registerBeforeHook"
174
- : namespace= " secretNamespace"
175
- : limit- to- namespace= " false"
176
- : in - store= " inStore"
177
- : allow- ssh= false
178
- generate- name= " registry-auth-"
179
- : cache- secrets= " true"
180
- @input= " val => value.spec.authSecret = val"
122
+ @update: value= " $emit('input', $event)"
181
123
/ >
182
124
183
- < div class = " registry-input-label mt-24 " >
184
- {{ t (' imageScanner.registries.configuration.cru.scan .label' ) }}
125
+ < div class = " registry-input-label" >
126
+ {{ t (' imageScanner.registries.configuration.cru.registry .label' ) }}
185
127
< / div>
186
128
187
129
< div class = " row" >
188
130
< div class = " col span-6" >
189
131
< LabeledSelect
190
- v- model: value= " value.spec.repositories"
191
- : label= " t('imageScanner.registries.configuration.cru.scan.type')"
192
- >
193
- < / LabeledSelect>
132
+ data- testid= " registry-type-select"
133
+ : label= " t('imageScanner.registries.configuration.cru.registry.type.label')"
134
+ : options= " REGISTRY_TYPE_OPTIONS"
135
+ option- key= " value"
136
+ option- label= " label"
137
+ value= " dockerhub"
138
+ required
139
+ / >
194
140
< / div>
195
- < div class = " col span-3" >
196
- < UnitInput
197
- v- model: value= " unitInput"
198
- : label= " t('imageScanner.registries.configuration.cru.scan.schedule.label')"
199
- : mode= " mode"
200
- min= " 0"
201
- : suffix= " t('unit.hour', { count: 3 })"
202
- : placeholder= " t('imageScanner.registries.configuration.cru.scan.schedule.placeholder', { hours: 3 })"
203
- @update: value= " updateRefreshInterval($event)"
141
+ < div class = " col span-6" >
142
+ < LabeledInput
143
+ : label= " t('imageScanner.registries.configuration.cru.registry.uri.label')"
144
+ v- model: value= " value.spec.uri"
145
+ : placeholderKey= " t('imageScanner.registries.configuration.cru.registry.uri.placeholder')"
204
146
/ >
205
147
< / div>
206
148
< / div>
207
149
208
- < / div>
150
+ < Checkbox
151
+ v- model: value= " useProxy"
152
+ class = " mt-20 mb-10"
153
+ : 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"
157
+ / >
158
+
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' ) }}
179
+ < / 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>
200
+ < / div>
201
+
202
+ < / div>
209
203
210
- < / CruResource>
204
+ < / CruResource>
211
205
< / div>
212
206
< / template>
213
207
0 commit comments