summaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
authorVitalii Lysak <v.lysak@dunice.net>2022-08-26 14:50:55 +0300
committerVitalii Lysak <v.lysak@dunice.net>2022-08-26 14:50:55 +0300
commit5463c8aec08dfa07a01f95646e44a3b4bee070fe (patch)
treedc862824cffa5284db6c57308b0445071fbd2c5e /src/components
parent81e43ed3e15e2857faafc56edaf15ea1e1f63ec0 (diff)
downloadwebui-vue-5463c8aec08dfa07a01f95646e44a3b4bee070fe.tar.xz
optimization for dynamic
Diffstat (limited to 'src/components')
-rw-r--r--src/components/_sila/Global/Chart.vue7
-rw-r--r--src/components/_sila/Global/Collapse.vue19
2 files changed, 17 insertions, 9 deletions
diff --git a/src/components/_sila/Global/Chart.vue b/src/components/_sila/Global/Chart.vue
index 6b070a42..f6c389f8 100644
--- a/src/components/_sila/Global/Chart.vue
+++ b/src/components/_sila/Global/Chart.vue
@@ -46,8 +46,11 @@ export default {
},
computed: {
readyData() {
- let filteredData = this.data.filter((metric) => {
- return metric.Value !== 'nan';
+ let filteredData = this.data.map((metric) => {
+ return {
+ ...metric,
+ Value: metric.Value === 'nan' ? 0 : metric.Value,
+ };
});
filteredData.sort((a, b) => {
diff --git a/src/components/_sila/Global/Collapse.vue b/src/components/_sila/Global/Collapse.vue
index 36778571..280e769b 100644
--- a/src/components/_sila/Global/Collapse.vue
+++ b/src/components/_sila/Global/Collapse.vue
@@ -4,13 +4,12 @@
v-b-toggle="id"
variant="collapse"
class="d-flex flex-nowrap justify-content-start"
- @click="onClick"
>
<slot name="image"></slot>
{{ title }}
<component :is="iconChevronUp" class="icon-expand" />
</b-button>
- <b-collapse :id="id" visible>
+ <b-collapse :id="id" v-model="visible">
<slot></slot>
</b-collapse>
</div>
@@ -29,18 +28,24 @@ export default {
type: String,
default: null,
},
+ opened: {
+ type: Boolean,
+ default: false,
+ },
},
data() {
return {
- opened: true,
+ visible: false,
iconChevronUp: iconChevronUp,
};
},
- methods: {
- onClick() {
- this.opened = !this.opened;
- this.$emit('opened', this.opened);
+ watch: {
+ visible() {
+ this.$emit('opened', this.visible);
},
},
+ created() {
+ this.visible = this.opened;
+ },
};
</script>