Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div class="resource-header">
<div class="resource-header-name-state">
<span class="resource-header-name">
<RouterLink :to="`/c/${this.$route.params.cluster}/${ this.PRODUCT_NAME }/${ this.RESOURCE.REGISTRY }/`">{{ t('imageScanner.registries.title') }}:</RouterLink>
<RouterLink :to="`/c/${this.$route.params.cluster}/${ this.PRODUCT_NAME }/${this.PAGE.REGISTRIES}`">{{ t('imageScanner.registries.title') }}:</RouterLink>
{{ $route.params.id }}
</span>
<RegisterStatusBadge :status="registryStatus" />
Expand Down Expand Up @@ -33,7 +33,7 @@

<script>
import { BadgeState } from '@rancher/components';
import { PRODUCT_NAME, RESOURCE } from '@sbombastic-image-vulnerability-scanner/types';
import { PRODUCT_NAME, RESOURCE, PAGE } from '@sbombastic-image-vulnerability-scanner/types';
import ResourceTable from "@shell/components/ResourceTable";
import RancherMeta from './common/RancherMeta.vue';
import RegisterStatusBadge from './common/RegisterStatusBadge.vue';
Expand All @@ -53,6 +53,7 @@
return {
PRODUCT_NAME,
RESOURCE,
PAGE,
registry: null,
registryStatus: null,
registryMetadata: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@ export function init($plugin: IPlugin, store: any) {
icon: "pod_security",
inStore: "cluster",
});

virtualType({
labelKey: 'imageScanner.registries.title',
name: PAGE.REGISTRIES,
namespaced: false,
route: {
name: `c-cluster-${PRODUCT_NAME}-${PAGE.REGISTRIES}`,
params: {
product: PRODUCT_NAME
},
meta: { pkg: PRODUCT_NAME, product: PRODUCT_NAME }
}
});

virtualType({
labelKey: 'imageScanner.images.title',
Expand Down Expand Up @@ -72,6 +85,6 @@ export function init($plugin: IPlugin, store: any) {
//"demo"
]);

basicType([RESOURCE.REGISTRY, PAGE.VEX_MANAGEMENT], 'Advanced');
basicType([PAGE.REGISTRIES, PAGE.VEX_MANAGEMENT], 'Advanced');

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
REGISTRY_TYPE_OPTIONS,
SCAN_INTERVAL_OPTIONS, SCAN_INTERVALS
} from "@sbombastic-image-vulnerability-scanner/constants/scan-interval-options";
import { PRODUCT_NAME, PAGE } from "@sbombastic-image-vulnerability-scanner/types";

export default {
name: 'CruRegistry',
Expand Down Expand Up @@ -77,6 +78,44 @@ export default {
},
},

methods: {
apply(event) {
console.log('finish apply');
this.save(event)
.then(() => {
this.$emit('done');
})
.catch((e) => {
this.errors = e;
})
.finally(() => {
this.$router.push({
name: `c-cluster-${PRODUCT_NAME}-${PAGE.REGISTRIES}`,
params: {
cluster: this.$route.params.cluster,
product: PRODUCT_NAME
}
});
});
},

cancel() {
console.log('cancel done');
this.done();
this.$router.push({
name: `c-cluster-${PRODUCT_NAME}-${PAGE.REGISTRIES}`,
params: {
cluster: this.$route.params.cluster,
product: PRODUCT_NAME
}
});
},
doneRoute() {
console.log('doneRoute');
return `c-cluster-${PRODUCT_NAME}-${PAGE.REGISTRIES}`;
},
},

// Set default values for creating a new registry configuration
created() {
const spec = this.value.spec;
Expand All @@ -100,9 +139,10 @@ export default {
:subtypes="[]"
:validation-passed="true"
:errors="errors"
:cancel-event="true"
@error="(e) => (errors = e)"
@finish="save"
@cancel="done"
@finish="apply"
@cancel="cancel"
>
<NameNsDescription
:value="value"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ export default {
},
methods: {
getStatusText(row) {
return this.t(`imageScanner.enum.status.${row.prevScanStatus.toLowerCase()}`);
return this.t(`imageScanner.enum.status.${row.prevScanStatus?.toLowerCase()}`);
},
getStatusLabelClass(row) {
return row.prevScanStatus.toLowerCase();
return row.prevScanStatus?.toLowerCase();
},
getStatusDotClass(row) {
return `dot ${row.prevScanStatus.toLowerCase()}`;
return `dot ${row.prevScanStatus?.toLowerCase()}`;
}
}
};
Expand All @@ -32,6 +32,9 @@ export default {
<div v-if="row.prevProgress">
<ProgressCell :status="{ progress: row.prevProgress, error: row.error }" />
</div>
<div v-if="row.prevScanStatus.toLowerCase() === 'failed' && row.error">
<span class="error-message">|<span style="margin-left: 10px;">{{ t("imageScanner.general.error") }}</span></span>
</div>
</div>
</template>

Expand Down
1 change: 1 addition & 0 deletions pkg/sbombastic-image-vulnerability-scanner/l10n/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ imageScanner:
ago: ago
justNow: Just now
none: none
error: Error

typeLabel:
sbombastic.rancher.io.registry: Registries configuration
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<template>
<div>
<div>
<button
class="btn role-secondary"
style="position: absolute; top: 80px; right: 120px;"
@click="refresh()"
>
<i class="icon icon-refresh"></i>
{{ t('imageScanner.registries.button.refresh') || 'Refresh data' }}
</button>
<!-- <button
class="btn role-secondary"
style="position: absolute; top: 80px; right: 120px;"
@click="refresh()"
>
<i class="icon icon-refresh"></i>
{{ t('imageScanner.registries.button.refresh') || 'Refresh data' }}
</button> -->
</div>
<div class="state">State as of <span class="state-date-time">{{ latestUpdateTimeText }}</span></div>
<div class="summary-section">
Expand Down
Loading