Skip to content

Commit b2aac50

Browse files
committed
fix policy dashboard
Signed-off-by: Frank Jogeleit <[email protected]>
1 parent 3c3fe7b commit b2aac50

File tree

3 files changed

+21
-18
lines changed

3 files changed

+21
-18
lines changed

backend/pkg/service/service.go

+9-7
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,15 @@ func (s *Service) PolicyDetails(ctx context.Context, cluster, source, policy str
8282
if plugin, ok := s.plugin(cluster, source); ok {
8383
g.Go(func() error {
8484
details, err = plugin.GetPolicy(ctx, policy)
85-
zap.L().Error(
86-
"failed to load policy details from plugin",
87-
zap.String("cluster", cluster),
88-
zap.String("source", source),
89-
zap.String("policy", policy),
90-
zap.Error(err),
91-
)
85+
if err != nil {
86+
zap.L().Error(
87+
"failed to load policy details from plugin",
88+
zap.String("cluster", cluster),
89+
zap.String("source", source),
90+
zap.String("policy", policy),
91+
zap.Error(err),
92+
)
93+
}
9294

9395
return nil
9496
})

frontend/modules/core/components/policy/Details.vue

+9-8
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@
5959
<template v-if="policy.additional && policy.additional.length">
6060
<v-col v-for="details in policy.additional" :cols="detailsCols">
6161
<v-card :title="details.title">
62-
<v-container>
62+
<v-container fluid>
6363
<template v-for="item in details.items" :key="item.value">
6464
<v-row class="top-border" v-if="item.value">
65-
<v-col cols="6" class="font-weight-bold" v-if="item.title">{{ item.title }}</v-col>
66-
<v-col cols="6">{{ item.value }}</v-col>
65+
<v-col :cols="detailsLabelCols.label" class="font-weight-bold" v-if="item.title">{{ item.title }}</v-col>
66+
<v-col :cols="detailsLabelCols.value">{{ item.value }}</v-col>
6767
</v-row>
6868
</template>
6969
</v-container>
@@ -134,12 +134,13 @@ const expand = ref(false)
134134
const descriptionHeight = computed(() => expand.value ? undefined : '200px')
135135
136136
const detailsCols = computed(() => {
137-
const cols = Math.ceil(12 / props.policy.additional.length)
138-
if (cols === 12) {
139-
return 5
140-
}
137+
return Math.ceil(12 / props.policy.additional.length)
138+
})
139+
140+
const detailsLabelCols = computed(() => {
141+
if (detailsCols.value === 12) return ({ label: 2, value: 10 })
141142
142-
return cols
143+
return { label: 6, value: 6 }
143144
})
144145
</script>
145146

frontend/modules/core/components/policy/StatusCharts.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
<v-col cols="12" md="4">
44
<v-card>
55
<v-card-text>
6-
<GraphStatusDistribution :data="data.charts.findings" />
6+
<GraphCountDistribution :data="data.charts.findings" />
77
</v-card-text>
88
</v-card>
99
</v-col>
1010
<v-col cols="12" md="8">
1111
<v-card style="height: 100%">
1212
<v-card-text style="height: 100%; position: relative;">
13-
<GraphStatusPerNamespace v-if="showExpanded" :data="data.charts.namespaceScope.complete" />
14-
<GraphStatusPerNamespace v-else :data="data.charts.namespaceScope.preview" />
13+
<GraphCountPerNamespace v-if="showExpanded" :data="data.charts.namespaceScope.complete" />
14+
<GraphCountPerNamespace v-else :data="data.charts.namespaceScope.preview" />
1515
<v-btn v-if="hasPreview" variant="outlined" size="small" @click="expand = !expand" style="position: absolute; bottom: 10px; right: 10px;" rounded="0">
1616
<span v-if="showExpanded">Show preview</span>
1717
<span v-else>Show Complete List</span>

0 commit comments

Comments
 (0)