Skip to content
Open
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
2 changes: 1 addition & 1 deletion client/src/components/apps/appstats.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<th>{{ $t('app.domains') }}</th>
<td>
<ul style="list-style-type: none; padding: 0;">
<li v-for="host in appData.spec.ingress.hosts" :key="host.host">
<li v-for="host in appData.spec.ingress?.hosts" :key="host.host">
<a :href="'https://' + host.host" target="_blank">{{ host.host }}</a>
<v-icon size="x-small" style="color: rgba(var(--v-theme-kubero), var(--v-high-emphasis-opacity));">mdi-open-in-new</v-icon>
</li>
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/apps/detail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<Builds :pipeline="pipeline" :phase="phase" :app="app" :appData="appData" :pipelineData="pipelineData"/>
</v-window-item>
<v-window-item transition="false" reverse-transition="false" class="background">
<Metrics :pipeline="pipeline" :phase="phase" :app="app" :host="appData.spec.ingress.hosts[0].host"/>
<Metrics :pipeline="pipeline" :phase="phase" :app="app" :host="appData.spec.ingress?.hosts?.[0]?.host"/>
</v-window-item>
<v-window-item transition="false" reverse-transition="false" class="background">
<LogsTab :pipeline="pipeline" :phase="phase" :app="app" :deploymentstrategy="appData.spec.deploymentstrategy" :buildstrategy="appData.spec.buildstrategy"/>
Expand Down Expand Up @@ -177,7 +177,7 @@ export default defineComponent({
});
},
ActionOpenApp() {
window.open(`https://${this.appData.spec.ingress.hosts[0].host}`, '_blank');
window.open(`https://${this.appData.spec.ingress?.hosts?.[0]?.host}`, '_blank');
},
ActionEditApp() {
this.$router.push(`/pipeline/${this.pipeline}/${this.phase}/apps/${this.app}`);
Expand Down
34 changes: 20 additions & 14 deletions client/src/components/pipelines/appcard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
</v-card-text>
<v-divider></v-divider>

<span v-if="app.addons.length > 0">
<span v-if="app.addons?.length > 0">
<v-card-text>
<v-avatar
rounded
Expand Down Expand Up @@ -134,7 +134,7 @@
</v-btn>
<v-btn
title="Open App"
v-if="app.ingress.hosts.length > 0"
v-if="app.ingress?.hosts?.length > 0"
color="deep-purple lighten-2"
variant="text"
:href="'//'+app.ingress?.hosts[0].host" target="_blank"
Expand Down Expand Up @@ -296,18 +296,24 @@ export default defineComponent({
loadMetrics() {
axios.get(`/api/metrics/resources/${this.pipeline}/${this.phase}/${this.app.name}`)
.then(response => {
for (var i = 0; i < response.data.length; i++) {
if (response.data[i].cpu.percentage != null && response.data[i].memory.percentage != null) {
this.metricsDisplay = "bars";
}
if (
(response.data[i].cpu.percentage == null && response.data[i].memory.percentage == null) &&
(response.data[i].cpu.usage != null && response.data[i].memory.usage != null)
){
this.metricsDisplay = "table";
}
}
this.metrics = response.data;
const metrics = Array.isArray(response.data) ? response.data : [];
const allMetricsHavePercentages = metrics.length > 0 && metrics.every(
(metric: Metric) =>
metric.cpu.percentage != null &&
metric.memory.percentage != null
);
const hasUsageMetrics = metrics.some(
(metric: Metric) =>
metric.cpu.usage != null &&
metric.memory.usage != null
);

this.metricsDisplay = allMetricsHavePercentages
? "bars"
: hasUsageMetrics
? "table"
: "dots";
this.metrics = metrics;
})
.catch(error => {
console.log(error);
Expand Down