Add open in chart builder button to chart page block configurator

This commit is contained in:
Jože Fortun
2022-12-01 16:25:15 +01:00
parent 438160ce25
commit 3cdce2f7b1
2 changed files with 20 additions and 2 deletions
@@ -5,11 +5,20 @@
>
<b-form-select
v-model="block.options.chartID"
:options="options"
:options="chartOptions"
text-field="name"
value-field="chartID"
/>
</b-form-group>
<b-button
v-if="selectedChart"
:disabled="!selectedChart.canUpdateChart && !selectedChart.canDeleteChart"
variant="light"
:to="{ name: 'admin.charts.edit', params: { chartID: selectedChart.chartID }, query: null }"
>
{{ $t('chart.openInBuilder') }}
</b-button>
</b-tab>
</template>
<script>
@@ -31,12 +40,20 @@ export default {
charts: 'chart/set',
}),
options () {
chartOptions () {
return [
{ chartID: NoID, name: this.$t('chart.pick') },
...this.charts,
]
},
selectedChart () {
if (!this.options.chartID || this.options.chartID === NoID) {
return
}
return this.chartOptions.find(({ chartID }) => chartID === this.options.chartID)
},
},
}
</script>
@@ -97,6 +97,7 @@ chart:
preview:
chartId: Chart preview (ID {{0}})
searchPlaceholder: Type here to search all charts in this namespace
openInBuilder: Open in chart builder
content:
ok: Ok
label: Content