|
8 | 8 | <RouterLink to="../">{{ t('imageScanner.registries.title') }}:</RouterLink>
|
9 | 9 | {{ $route.params.id }}
|
10 | 10 | </span>
|
11 |
| - <RegisterStatusBadge status="failed" /> |
| 11 | + <RegisterStatusBadge :status="registryStatus" /> |
12 | 12 | </div>
|
13 | 13 | <span class="resource-header-description">
|
14 | 14 | Registry configuration description
|
|
25 | 25 | </button>
|
26 | 26 | </div>
|
27 | 27 | </div>
|
28 |
| - <RancherMeta :properties="registryMetaProperties" /> |
| 28 | + <RancherMeta :properties="registryMetadata" /> |
29 | 29 | </div>
|
30 | 30 | Recent scans
|
31 | 31 | <ResourceTable
|
|
57 | 57 | },
|
58 | 58 | data() {
|
59 | 59 | return {
|
60 |
| - scanHistory: [ |
61 |
| - { |
62 |
| - status: 'completed', |
63 |
| - timestamp: '2023-10-01T12:00:00Z', |
64 |
| - progress: '100', |
65 |
| - imagesScanned: 50, |
66 |
| - imagesFound: 45, |
67 |
| - errors: [], |
68 |
| - }, |
69 |
| - { |
70 |
| - status: 'failed', |
71 |
| - timestamp: '2023-10-02T12:00:00Z', |
72 |
| - progress: '35', |
73 |
| - imagesScanned: 1339, |
74 |
| - imagesFound: 3826, |
75 |
| - errors: [ |
76 |
| - { |
77 |
| - message: "Not enough resources to complete the scan. Could not connect to proxyu", |
78 |
| - } |
79 |
| - ], |
80 |
| - }, |
81 |
| - ], |
| 60 | + registryStatus: null, |
| 61 | + registryMetadata: [], |
| 62 | + scanHistory: [], |
82 | 63 | headers: REGISTRY_SCAN_HISTORY_TABLE
|
83 | 64 | }
|
84 | 65 | },
|
85 | 66 | async fetch() {
|
86 |
| - await this.$store.dispatch('cluster/find', { type: RESOURCE.REGISTRY, id: `${this.$route.params.ns}/${this.$route.params.id}` }); |
| 67 | + await this.$store.dispatch('cluster/find', { type: RESOURCE.SCAN_JOB, id: `${this.$route.params.ns}/${this.$route.params.id}` }); |
| 68 | + let scanJob = this.$store.getters['cluster/byId'](RESOURCE.SCAN_JOB, `${this.$route.params.ns}/${this.$route.params.id}`); |
| 69 | +
|
| 70 | + await this.$store.dispatch('cluster/find', { type: RESOURCE.REGISTRY, id: `${this.$route.params.ns}/${scanJob.spec.registry}` }); |
| 71 | + let registry = this.$store.getters['cluster/byId'](RESOURCE.REGISTRY, `${this.$route.params.ns}/${scanJob.spec.registry}`); |
| 72 | +
|
| 73 | + this.registryStatus = (registry.status.conditions[0].type.toLowerCase() === "discovering" ? "InProgress" : registry.status.conditions[0].type).toLowerCase(); |
| 74 | + this.registryMetadata = [ |
| 75 | + { |
| 76 | + type: 'text', |
| 77 | + label: this.t('imageScanner.registries.configuration.meta.registry'), |
| 78 | + value: registry.spec.uri |
| 79 | + }, |
| 80 | + { |
| 81 | + type: 'text', |
| 82 | + label: this.t('imageScanner.registries.configuration.meta.repositories'), |
| 83 | + value: registry.spec.repositories.length |
| 84 | + }, |
| 85 | + { |
| 86 | + type: 'text', |
| 87 | + label: this.t('imageScanner.registries.configuration.meta.schedule') |
| 88 | + }, |
| 89 | + { |
| 90 | + type: 'text', |
| 91 | + label: this.t('imageScanner.registries.configuration.meta.namespace'), |
| 92 | + value: registry.metadata.namespace |
| 93 | + }, |
| 94 | + { |
| 95 | + type: 'tags', |
| 96 | + tags: registry.spec.repositories || [] |
| 97 | + }, |
| 98 | + { |
| 99 | + type: 'text', |
| 100 | + value: registry.metadata.schedule || '', |
| 101 | + } |
| 102 | + ]; |
| 103 | + |
| 104 | + this.scanHistory = scanJob.status.conditions.map((rec) => { |
| 105 | + return { |
| 106 | + status: rec.type.toLowerCase(), |
| 107 | + timestamp: rec.lastUpdateTime, |
| 108 | + progress: rec.progress || 0, |
| 109 | + imagesScanned: rec.imagesScanned || 0, |
| 110 | + imagesFound: rec.imagesFound || 0, |
| 111 | + errors: rec.errors || [] |
| 112 | + }; |
| 113 | + }); |
87 | 114 | },
|
88 |
| - computed: { |
89 |
| - registry() { |
90 |
| - return this.$store.getters['cluster/byId'](RESOURCE.REGISTRY, `${this.$route.params.ns}/${this.$route.params.id}`); |
91 |
| - }, |
92 |
| - registryMetaProperties() { |
93 |
| - return [ |
94 |
| - { |
95 |
| - type: 'text', |
96 |
| - label: this.t('imageScanner.registries.configuration.meta.registry'), |
97 |
| - value: this.registry.spec.uri |
98 |
| - }, |
99 |
| - { |
100 |
| - type: 'text', |
101 |
| - label: this.t('imageScanner.registries.configuration.meta.repositories'), |
102 |
| - value: this.registry.spec.repositories.length |
103 |
| - }, |
104 |
| - { |
105 |
| - type: 'text', |
106 |
| - label: this.t('imageScanner.registries.configuration.meta.schedule') |
107 |
| - }, |
108 |
| - { |
109 |
| - type: 'text', |
110 |
| - label: this.t('imageScanner.registries.configuration.meta.namespace'), |
111 |
| - value: this.registry.metadata.namespace |
112 |
| - }, |
113 |
| - { |
114 |
| - type: 'tags', |
115 |
| - tags: this.registry.spec.repositories || [] |
116 |
| - }, |
117 |
| - { |
118 |
| - type: 'text', |
119 |
| - value: this.registry.metadata.schedule || '', |
120 |
| - } |
121 |
| - ]; |
122 |
| - } |
123 |
| - } |
124 | 115 | }
|
125 | 116 | </script>
|
126 | 117 |
|
|
0 commit comments