@mixd-id/web-scaffold 0.1.240411058 → 0.1.240411059
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/components/Carousel.vue +1 -1
- package/src/components/Dashboard2.vue +118 -0
- package/src/components/Grid.vue +6 -6
- package/src/index.js +1 -0
- package/src/utils/list.mjs +1 -1
- package/src/widgets/Dashboard/Metric.vue +19 -44
- package/src/widgets/Dashboard/MetricSetting.vue +1 -1
- package/src/widgets/Dashboard.vue +3 -5
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mixd-id/web-scaffold",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.240411059",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite serve",
|
|
7
7
|
"build": "vite build",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"pinia": "^2.0.2",
|
|
70
70
|
"prismjs": "1.30.0",
|
|
71
71
|
"redis": "^4.6.13",
|
|
72
|
-
"sequelize": "^6.37.
|
|
72
|
+
"sequelize": "^6.37.7",
|
|
73
73
|
"tailwindcss": "^3.2.4",
|
|
74
74
|
"tinycolor2": "^1.6.0",
|
|
75
75
|
"vue": "^3.2.25",
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="$style.comp">
|
|
3
|
+
|
|
4
|
+
<div class="w-[480px] border-r-[1px] border-text-50">
|
|
5
|
+
<MetricSetting :value="preset.views[0]"/>
|
|
6
|
+
|
|
7
|
+
<pre class="text-xs break-all">
|
|
8
|
+
{{ preset.views[0] }}
|
|
9
|
+
</pre>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
<div class="flex-1 p-8">
|
|
13
|
+
|
|
14
|
+
<component v-for="view in preset.views"
|
|
15
|
+
:is="view.type"
|
|
16
|
+
:="view.props" />
|
|
17
|
+
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
|
|
25
|
+
import {defineAsyncComponent} from "vue";
|
|
26
|
+
|
|
27
|
+
export default{
|
|
28
|
+
|
|
29
|
+
components: {
|
|
30
|
+
MetricSetting: defineAsyncComponent(() => import('../widgets/Dashboard/MetricSetting.vue')),
|
|
31
|
+
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
props: {
|
|
35
|
+
|
|
36
|
+
controller: String,
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
computed: {
|
|
42
|
+
|
|
43
|
+
preset(){
|
|
44
|
+
return this.config.presets[this.config.presetIdx]
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
data(){
|
|
51
|
+
return {
|
|
52
|
+
|
|
53
|
+
config: {
|
|
54
|
+
presets: [
|
|
55
|
+
{
|
|
56
|
+
name: "Sample 1",
|
|
57
|
+
datasource: [
|
|
58
|
+
{
|
|
59
|
+
uid: "1",
|
|
60
|
+
name: "AffiliateShareReport",
|
|
61
|
+
filters: [],
|
|
62
|
+
sorts: []
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
views: [
|
|
66
|
+
{
|
|
67
|
+
type: "Metric",
|
|
68
|
+
props: {
|
|
69
|
+
datasourceUid: "1",
|
|
70
|
+
columns: [
|
|
71
|
+
{
|
|
72
|
+
key: "id",
|
|
73
|
+
modifier: "count"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
key: "id",
|
|
77
|
+
modifier: "sum"
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
presetIdx: 0
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
metric1: {
|
|
89
|
+
props: {}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
methods: {
|
|
95
|
+
|
|
96
|
+
getController(){
|
|
97
|
+
return this.controller
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
provide(){
|
|
103
|
+
return {
|
|
104
|
+
getController: this.getController
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
</script>
|
|
111
|
+
|
|
112
|
+
<style module>
|
|
113
|
+
|
|
114
|
+
.comp{
|
|
115
|
+
@apply flex flex-row;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
</style>
|
package/src/components/Grid.vue
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="$style.comp" :style="computedStyle">
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
<slot>
|
|
4
|
+
<component v-for="item in items"
|
|
5
|
+
:is="item.type"
|
|
6
|
+
:key="item.key"
|
|
7
|
+
:="item" />
|
|
8
|
+
</slot>
|
|
9
9
|
</div>
|
|
10
10
|
</template>
|
|
11
11
|
|
package/src/index.js
CHANGED
|
@@ -603,6 +603,7 @@ export default{
|
|
|
603
603
|
app.component('FiltersSetting', defineAsyncComponent(() => import("./widgets/FiltersSetting.vue")))
|
|
604
604
|
app.component('MenuEditor', defineAsyncComponent(() => import("./widgets/MenuEditor.vue")))
|
|
605
605
|
app.component('Dashboard', defineAsyncComponent(() => import("./widgets/Dashboard.vue")))
|
|
606
|
+
app.component('Dashboard2', defineAsyncComponent(() => import("./components/Dashboard2.vue")))
|
|
606
607
|
app.component('Text', defineAsyncComponent(() => import("./components/Text.vue")))
|
|
607
608
|
app.component('MenuItem1', defineAsyncComponent(() => import("./components/MenuItem1.vue")))
|
|
608
609
|
app.component('MenuItem1Setting', defineAsyncComponent(() => import("./widgets/MenuItem1Setting.vue")))
|
package/src/utils/list.mjs
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="$style.comp">
|
|
2
|
+
<div :class="$style.comp" v-if="metric">
|
|
3
3
|
<label class="text-text-400 text-ellipsis overflow-hidden whitespace-nowrap">{{ label }}</label>
|
|
4
4
|
<div class="flex flex-row items-end gap-2">
|
|
5
|
-
<h1 v-if="readyState === 1" class="text-ellipsis overflow-hidden whitespace-nowrap" :class="column2Enabled ? '' : 'text-green-600'">
|
|
6
|
-
{{
|
|
5
|
+
<h1 v-if="readyState === 1" class="text-5xl text-ellipsis overflow-hidden whitespace-nowrap" :class="column2Enabled ? '' : 'text-green-600'">
|
|
6
|
+
{{ metric.value }}
|
|
7
7
|
</h1>
|
|
8
8
|
<h1 v-else class="text-ellipsis overflow-hidden whitespace-nowrap text-text-300">
|
|
9
9
|
Loading...
|
|
10
10
|
</h1>
|
|
11
11
|
|
|
12
|
-
<div class="flex flex-col"
|
|
13
|
-
<div class="
|
|
12
|
+
<div class="flex flex-col">
|
|
13
|
+
<div class=" text-ellipsis whitespace-nowrap overflow-hidden"
|
|
14
14
|
:class="showPercentage ? '' : 'text-green-600'">
|
|
15
|
-
{{
|
|
15
|
+
{{ metric.comparedValue }}
|
|
16
16
|
</div>
|
|
17
17
|
|
|
18
|
-
<div
|
|
19
|
-
class="text-
|
|
20
|
-
|
|
21
|
-
{{ value?.comparedPercent }}
|
|
18
|
+
<div class="text-sm text-ellipsis whitespace-nowrap overflow-hidden"
|
|
19
|
+
:class="metric.comparedPercent <= 50 ? 'text-red-600' : 'text-green-600'">
|
|
20
|
+
{{ metric.comparedPercent }}%
|
|
22
21
|
</div>
|
|
23
22
|
</div>
|
|
24
23
|
</div>
|
|
@@ -59,15 +58,17 @@ export default{
|
|
|
59
58
|
|
|
60
59
|
data(){
|
|
61
60
|
return {
|
|
62
|
-
|
|
61
|
+
metric: null,
|
|
63
62
|
readyState: 1,
|
|
64
63
|
}
|
|
65
64
|
},
|
|
66
65
|
|
|
67
|
-
inject: [ '
|
|
66
|
+
inject: [ 'getController', 'getViewedPreset', 'getQueryFilters', 'socket' ],
|
|
68
67
|
|
|
69
68
|
props: {
|
|
70
69
|
|
|
70
|
+
label: String,
|
|
71
|
+
|
|
71
72
|
column: String,
|
|
72
73
|
columnModifier: String,
|
|
73
74
|
|
|
@@ -79,8 +80,6 @@ export default{
|
|
|
79
80
|
|
|
80
81
|
showPercentage: [ Number, Boolean ],
|
|
81
82
|
|
|
82
|
-
label: String,
|
|
83
|
-
|
|
84
83
|
uid: String
|
|
85
84
|
|
|
86
85
|
},
|
|
@@ -107,44 +106,20 @@ export default{
|
|
|
107
106
|
},
|
|
108
107
|
|
|
109
108
|
load(){
|
|
110
|
-
const preset = this.getViewedPreset()
|
|
111
|
-
const {name, datasource} = preset
|
|
112
109
|
|
|
113
110
|
this.readyState = 2
|
|
114
|
-
this.socket.send(this.
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
datasource: datasource.map(_datasource => {
|
|
121
|
-
return {
|
|
122
|
-
..._datasource,
|
|
123
|
-
filters: [
|
|
124
|
-
...(_datasource.filters ?? []),
|
|
125
|
-
...(this.getQueryFilters()[_datasource.uid] ?? [])
|
|
126
|
-
]
|
|
127
|
-
}
|
|
128
|
-
})
|
|
129
|
-
})
|
|
130
|
-
.then(_ => {
|
|
131
|
-
this.value = _[this.uid]
|
|
132
|
-
})
|
|
133
|
-
.finally(_ => this.readyState = 1)
|
|
111
|
+
this.socket.send(`${this.getController()}.load-metric`, {})
|
|
112
|
+
.then(metric => {
|
|
113
|
+
this.metric = metric
|
|
114
|
+
})
|
|
115
|
+
.finally(_ => this.readyState = 1)
|
|
116
|
+
|
|
134
117
|
},
|
|
135
118
|
|
|
136
119
|
},
|
|
137
120
|
|
|
138
121
|
mounted() {
|
|
139
122
|
this.load()
|
|
140
|
-
|
|
141
|
-
this.emitter = useEmitter()
|
|
142
|
-
this.emitter.on(`${this.uid}.load`, () => {
|
|
143
|
-
this.load()
|
|
144
|
-
})
|
|
145
|
-
this.emitter.on(`dashboard.load`, () => {
|
|
146
|
-
this.load()
|
|
147
|
-
})
|
|
148
123
|
}
|
|
149
124
|
|
|
150
125
|
}
|
|
@@ -142,7 +142,7 @@ export default{
|
|
|
142
142
|
},
|
|
143
143
|
|
|
144
144
|
selectedDatasource(){
|
|
145
|
-
return this.datasource.find(d => d.uid === this.value.props.datasourceUid)
|
|
145
|
+
//return this.datasource.find(d => d.uid === this.value.props.datasourceUid)
|
|
146
146
|
},
|
|
147
147
|
|
|
148
148
|
showPercentageOptValues(){
|
|
@@ -1737,17 +1737,15 @@ export default {
|
|
|
1737
1737
|
|
|
1738
1738
|
props: {
|
|
1739
1739
|
|
|
1740
|
-
config:
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
},
|
|
1740
|
+
config: Object,
|
|
1741
|
+
defaultConfig: Function,
|
|
1742
|
+
presetKey: String,
|
|
1744
1743
|
|
|
1745
1744
|
controller: {
|
|
1746
1745
|
type: String,
|
|
1747
1746
|
required: true
|
|
1748
1747
|
},
|
|
1749
1748
|
|
|
1750
|
-
presetKey: String,
|
|
1751
1749
|
|
|
1752
1750
|
title: String,
|
|
1753
1751
|
|