|
79 | 79 | <os-based-image-radio-group |
80 | 80 | :imagesList="imagesList" |
81 | 81 | :categoryIcon="selectedCategoryIcon" |
82 | | - :itemCount="imageItems[filterType] ? imageItems[filterType].count || 0 : 0" |
| 82 | + :itemCount="imagesCount" |
83 | 83 | :input-decorator="localSelectedImageType" |
84 | 84 | :selected="selectedImageId" |
85 | 85 | :preFillContent="preFillContent" |
@@ -214,7 +214,7 @@ export default { |
214 | 214 | }, |
215 | 215 | data () { |
216 | 216 | return { |
217 | | - filterType: 'all', |
| 217 | + filterType: this.defaultImageFilter, |
218 | 218 | selectedImageId: '', |
219 | 219 | imageSearchFilters: {}, |
220 | 220 | showRootDiskSizeChanger: false, |
@@ -244,13 +244,19 @@ export default { |
244 | 244 | } |
245 | 245 | }, |
246 | 246 | computed: { |
| 247 | + defaultImageFilter () { |
| 248 | + return ['DomainAdmin', 'User'].includes(this.$store.getters.userInfo.roletype) ? 'executable' : 'all' |
| 249 | + }, |
247 | 250 | imagesList () { |
248 | 251 | if (!this.localSelectedImageType || !this.imageItems || !this.imageItems[this.filterType]) { |
249 | 252 | return [] |
250 | 253 | } |
251 | 254 | const imageTypeKey = this.localSelectedImageType.slice(0, -2) |
252 | 255 | return this.imageItems[this.filterType][imageTypeKey] || [] |
253 | 256 | }, |
| 257 | + imagesCount () { |
| 258 | + return this.imageItems[this.filterType] ? this.imageItems[this.filterType].count || 0 : 0 |
| 259 | + }, |
254 | 260 | selectedCategory () { |
255 | 261 | if (this.localSelectedGuestOsCategoryId && this.guestOsCategories) { |
256 | 262 | return this.guestOsCategories.find(option => option.id === this.localSelectedGuestOsCategoryId) |
@@ -286,7 +292,7 @@ export default { |
286 | 292 | this.emitSearchFilter() |
287 | 293 | }, |
288 | 294 | updateImageFilterType () { |
289 | | - this.filterType = 'all' |
| 295 | + this.filterType = this.defaultImageFilter |
290 | 296 | if (this.localSelectedGuestOsCategoryId === '0') { |
291 | 297 | this.filterType = 'self' |
292 | 298 | } else { |
|
0 commit comments