From 1c1cec5886705229547b18c8a0cd53017b13ab7f Mon Sep 17 00:00:00 2001 From: Hugo Bollon Date: Tue, 31 Aug 2021 10:15:19 +0200 Subject: [PATCH] feat(frontend): add link to go back to lineage on plan/state views --- .../src/components/PlanContent.vue | 82 ++++++++++--------- static/terraboard-vuejs/src/views/Plan.vue | 3 +- static/terraboard-vuejs/src/views/State.vue | 3 +- 3 files changed, 47 insertions(+), 41 deletions(-) diff --git a/static/terraboard-vuejs/src/components/PlanContent.vue b/static/terraboard-vuejs/src/components/PlanContent.vue index ad01fd3b..e3c6f573 100644 --- a/static/terraboard-vuejs/src/components/PlanContent.vue +++ b/static/terraboard-vuejs/src/components/PlanContent.vue @@ -58,7 +58,7 @@ Lineage: - {{ plan.lineage_data.lineage }} + {{ plan.lineage_data.lineage }} TF Version: @@ -308,45 +308,49 @@ Chart.register( PieController, ArcElement, Tooltip ) this.checkPlannedChanges(); }, mounted() { - const ctxResources = document.getElementById('chart-pie-resource-changes') as ChartItem; - const resourceChangesChart = new Chart(ctxResources, { - type: 'pie', - data: { - labels: ["No changes", "Added", "Updated", "Deleted"], - datasets: [{ - label: 'Resource Changes', - data: [this.changes.resources.none, this.changes.resources.added, this.changes.resources.changed, this.changes.resources.deleted], - backgroundColor: [ - '#0d6efd', - '#198754', - '#fd7e14', - '#dc3545', - ], - hoverOffset: 4 - }] - }, - options: this.chartOptions - }); + if (this.plan.parsed_plan.resource_changes != undefined) { + const ctxResources = document.getElementById('chart-pie-resource-changes') as ChartItem; + const resourceChangesChart = new Chart(ctxResources, { + type: 'pie', + data: { + labels: ["No changes", "Added", "Updated", "Deleted"], + datasets: [{ + label: 'Resource Changes', + data: [this.changes.resources.none, this.changes.resources.added, this.changes.resources.changed, this.changes.resources.deleted], + backgroundColor: [ + '#0d6efd', + '#198754', + '#fd7e14', + '#dc3545', + ], + hoverOffset: 4 + }] + }, + options: this.chartOptions + }); + } - const ctxOutputs = document.getElementById('chart-pie-output-changes') as ChartItem; - const outputChangesChart = new Chart(ctxOutputs, { - type: 'pie', - data: { - labels: ["No changes", "Added", "Updated", "Deleted"], - datasets: [{ - label: 'Output Changes', - data: [this.changes.outputs.none, this.changes.outputs.added, this.changes.outputs.changed, this.changes.outputs.deleted], - backgroundColor: [ - '#0d6efd', - '#198754', - '#fd7e14', - '#dc3545', - ], - hoverOffset: 4 - }] - }, - options: this.chartOptions - }); + if (this.plan.parsed_plan.output_changes != undefined) { + const ctxOutputs = document.getElementById('chart-pie-output-changes') as ChartItem; + const outputChangesChart = new Chart(ctxOutputs, { + type: 'pie', + data: { + labels: ["No changes", "Added", "Updated", "Deleted"], + datasets: [{ + label: 'Output Changes', + data: [this.changes.outputs.none, this.changes.outputs.added, this.changes.outputs.changed, this.changes.outputs.deleted], + backgroundColor: [ + '#0d6efd', + '#198754', + '#fd7e14', + '#dc3545', + ], + hoverOffset: 4 + }] + }, + options: this.chartOptions + }); + } }, }) export default class PlanContent extends Vue {} diff --git a/static/terraboard-vuejs/src/views/Plan.vue b/static/terraboard-vuejs/src/views/Plan.vue index 97551455..aa669cdf 100644 --- a/static/terraboard-vuejs/src/views/Plan.vue +++ b/static/terraboard-vuejs/src/views/Plan.vue @@ -2,7 +2,8 @@
-
+ Back to workspace +
Plans
  • -
    + Back to workspace +
    General Information