Skip to content

Commit d4a4281

Browse files
authored
Improve custom reports performance (#1676)
1 parent 00fa2a3 commit d4a4281

File tree

13 files changed

+403
-450
lines changed

13 files changed

+403
-450
lines changed

frontend/src/i18n/en.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@ const en = {
435435
cubejs: {
436436
tooltip: {
437437
Activities: 'Activity',
438+
Contacts: 'Contact',
438439
Members: 'Contact',
439440
Conversations: 'Conversation',
440441
Organizations: 'Organization',

frontend/src/modules/report/components/report-create-dialog.vue

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ import {
6161
} from 'vue';
6262
import { useRouter } from 'vue-router';
6363
import { ReportService } from '@/modules/report/report-service';
64-
import { ReportModel } from '@/modules/report/report-model';
65-
import { FormSchema } from '@/shared/form/form-schema';
6664
6765
const router = useRouter();
6866
const props = defineProps({
@@ -73,16 +71,6 @@ const props = defineProps({
7371
});
7472
const emit = defineEmits('update:modelValue');
7573
76-
const { fields } = ReportModel;
77-
const formSchema = new FormSchema([
78-
fields.name,
79-
fields.widgets,
80-
fields.settings,
81-
fields.public,
82-
]);
83-
84-
const rules = reactive(formSchema.rules());
85-
8674
const visible = computed({
8775
get() {
8876
return props.modelValue;

frontend/src/modules/report/components/report-form.vue

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44
v-if="record"
55
ref="form"
66
:model="model"
7-
:rules="rules"
87
class="report-form"
98
>
109
<el-input
1110
ref="focus"
12-
v-model="model[fields.name.name]"
13-
:placeholder="fields.name.placeholder"
11+
v-model="model.name"
1412
class="report-form-title"
13+
@input="onTitleUpdate"
1514
/>
1615
<ReportGridLayout
1716
v-model="model"
@@ -23,11 +22,9 @@
2322
</template>
2423

2524
<script setup>
26-
import { defineProps, reactive, watch } from 'vue';
25+
import { defineProps, reactive } from 'vue';
2726
import debounce from 'lodash/debounce';
2827
import { mapActions } from '@/shared/vuex/vuex.helpers';
29-
import { FormSchema } from '@/shared/form/form-schema';
30-
import { ReportModel } from '@/modules/report/report-model';
3128
import ReportGridLayout from './report-grid-layout.vue';
3229
3330
const props = defineProps({
@@ -37,31 +34,21 @@ const props = defineProps({
3734
},
3835
});
3936
40-
const { fields } = ReportModel;
41-
const formSchema = new FormSchema([
42-
fields.name,
43-
fields.widgets,
44-
fields.settings,
45-
fields.public,
46-
]);
37+
const { doUpdate } = mapActions('report');
4738
48-
const rules = formSchema.rules();
49-
const model = reactive(
50-
JSON.parse(JSON.stringify(props.record)),
51-
);
39+
const model = reactive(props.record);
5240
53-
const { doUpdate } = mapActions('report');
41+
const onTitleUpdate = debounce(async (value) => {
42+
model.name = value;
5443
55-
const debouncedChange = debounce(async () => {
5644
await doUpdate({
57-
id: props.record && props.record.id,
58-
values: formSchema.cast(model),
45+
id: props.record.id,
46+
values: {
47+
...model,
48+
widgets: model.widgets.map((w) => w.id),
49+
},
5950
});
60-
}, 1000);
61-
62-
watch(model, () => {
63-
debouncedChange();
64-
});
51+
}, 500);
6552
</script>
6653

6754
<script>

0 commit comments

Comments
 (0)