Fleet Add source field in Dashboard Resource detail panel; Add no target clusters warning in Dashboard cards

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
This commit is contained in:
Francesco Torchia 2025-05-06 10:59:46 +02:00
parent 7653f1b42d
commit 61c31a61b4
No known key found for this signature in database
GPG Key ID: E6D011B7415D4393
6 changed files with 121 additions and 47 deletions

View File

@ -2512,8 +2512,9 @@ fleet:
=1 { cluster }
other { clusters }
}
noClusters: The { type } is not targeting any clusters
resources: Resources
source: Source
cluster:
summary: Resource Summary
nonReady: Non-Ready Bundles

View File

@ -1,7 +1,5 @@
<script>
import ResourceTable from '@shell/components/ResourceTable';
import Link from '@shell/components/formatter/Link';
import Shortened from '@shell/components/formatter/Shortened';
import FleetIntro from '@shell/components/fleet/FleetIntro';
import {
@ -22,7 +20,8 @@ export default {
name: 'FleetRepos',
components: {
ResourceTable, Link, Shortened, FleetIntro
FleetIntro,
ResourceTable,
},
props: {
clusterId: {
@ -117,26 +116,6 @@ export default {
:use-query-params-for-simple-filtering="useQueryParamsForSimpleFiltering"
key-field="_key"
>
<template #cell:repo="{ row }">
<Link
:row="row"
:value="row.spec.repo || ''"
label-key="repoDisplay"
before-icon-key="repoIcon"
url-key="spec.repo"
/>
{{ row.cluster }}
<template v-if="row.commitDisplay">
<div class="text-muted">
<Shortened
long-value-key="status.commit"
:row="row"
:value="row.commitDisplay"
/>
</div>
</template>
</template>
<template
v-if="!isClusterView"
#cell:clustersReady="{ row }"

View File

@ -21,6 +21,10 @@ export default {
},
},
data() {
return { typeLabel: this.t(`typeLabel."${ this.value.type }"`, { count: 1 }) };
},
computed: {
counts() {
return this.value.status?.resourceCounts || {};
@ -60,6 +64,13 @@ export default {
return sortBy(out, 'sort:desc');
},
noClustersWarning() {
if (!this.value.status?.desiredReadyClusters) {
return this.t('fleet.dashboard.cards.noClusters', { type: this.typeLabel });
}
return null;
},
},
};
</script>
@ -86,6 +97,11 @@ export default {
v-else
class="description"
>
<template v-if="noClustersWarning">
<i class="icon icon-lg icon-warning text-warning" />
<span>{{ noClustersWarning }}</span>
</template>
<template v-else>
<i
v-if="statePanel.id !== 'success'"
class="icon-lg"
@ -100,6 +116,7 @@ export default {
<span class="large">{{ summary.clusters }}</span>
<span>{{ t('fleet.dashboard.cards.resourceSummary.part2', { count: summary.clusters }) }}</span>
</div>
</template>
</div>
</div>
</div>

View File

@ -1,13 +1,16 @@
<script>
import { FLEET } from '@shell/config/types';
import LabeledSelect from '@shell/components/form/LabeledSelect.vue';
import FleetResources from '@shell/components/fleet/FleetResources';
import FleetRepo from '@shell/components/formatter/FleetRepo.vue';
export default {
name: 'FleetDashboardResourceDetails',
components: {
FleetResources,
LabeledSelect
LabeledSelect,
FleetRepo,
FleetResources
},
props: {
@ -28,7 +31,10 @@ export default {
},
data() {
return { cluster: null };
return {
FLEET,
cluster: null
};
},
mounted() {
@ -64,7 +70,7 @@ export default {
<router-link
:to="value.detailLocation"
>
{{ value.nameDisplay }}
{{ value.id }}
</router-link>
<i
v-if="statePanel.id !== 'success'"
@ -81,6 +87,16 @@ export default {
@click="closePanel"
/>
</div>
<template v-if="value.type === FLEET.GIT_REPO">
<h3>
{{ t('fleet.dashboard.source') }}
</h3>
<div class="mb-15">
<FleetRepo :row="value" />
</div>
</template>
<h3>
{{ t('fleet.dashboard.resources') }}
</h3>

View File

@ -0,0 +1,60 @@
<script>
import Link from '@shell/components/formatter/Link';
import Shortened from '@shell/components/formatter/Shortened';
export default {
name: 'FleetRepo',
components: {
Link,
Shortened,
},
props: {
value: {
type: String,
default: ''
},
row: {
type: Object,
required: true
},
col: {
type: Object,
default: () => {}
},
rowKey: {
type: String,
default: '',
},
getCustomDetailLink: {
type: Function,
default: null
}
},
};
</script>
<template>
<Link
:row="row"
:value="row.spec.repo || ''"
label-key="repoDisplay"
before-icon-key="repoIcon"
url-key="spec.repo"
/>
{{ row.cluster }}
<template v-if="row.commitDisplay">
<div class="text-muted">
<Shortened
long-value-key="status.commit"
:row="row"
:value="row.commitDisplay"
/>
</div>
</template>
</template>

View File

@ -1080,6 +1080,7 @@ export const FLEET_REPO = {
name: 'repo',
labelKey: 'tableHeaders.repo',
value: 'repoDisplay',
formatter: 'FleetRepo',
sort: 'repoDisplay',
search: ['spec.repo', 'status.commit'],
};