@things-factory/kpi 9.0.17 → 9.0.19
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/client/bootstrap.ts +8 -0
- package/client/pages/kpi/kpi-list-page.ts +99 -11
- package/client/pages/kpi/kpi-viz-editor.ts +214 -14
- package/client/pages/kpi-category/kpi-category-list-page.ts +80 -8
- package/client/pages/kpi-history/kpi-history-list-page.ts +1 -1
- package/client/pages/kpi-metric/kpi-metric-list-page.ts +31 -7
- package/client/pages/kpi-metric-value/kpi-metric-value-importer.ts +65 -0
- package/client/pages/kpi-metric-value/kpi-metric-value-list-page.ts +299 -0
- package/client/pages/{kpi-value/kpi-value-manual-entry-form.ts → kpi-metric-value/kpi-metric-value-manual-entry-form.ts} +18 -44
- package/client/pages/{kpi-value/kpi-value-manual-entry-page.ts → kpi-metric-value/kpi-metric-value-manual-entry-page.ts} +21 -21
- package/client/pages/kpi-value/kpi-value-list-page.ts +4 -6
- package/client/route.ts +6 -2
- package/dist-client/bootstrap.d.ts +2 -0
- package/dist-client/bootstrap.js +7 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/pages/kpi/kpi-list-page.d.ts +6 -0
- package/dist-client/pages/kpi/kpi-list-page.js +100 -11
- package/dist-client/pages/kpi/kpi-list-page.js.map +1 -1
- package/dist-client/pages/kpi/kpi-viz-editor.js +208 -14
- package/dist-client/pages/kpi/kpi-viz-editor.js.map +1 -1
- package/dist-client/pages/kpi-category/kpi-category-list-page.d.ts +5 -0
- package/dist-client/pages/kpi-category/kpi-category-list-page.js +83 -8
- package/dist-client/pages/kpi-category/kpi-category-list-page.js.map +1 -1
- package/dist-client/pages/kpi-history/kpi-history-list-page.js +1 -1
- package/dist-client/pages/kpi-history/kpi-history-list-page.js.map +1 -1
- package/dist-client/pages/kpi-metric/kpi-metric-list-page.js +29 -5
- package/dist-client/pages/kpi-metric/kpi-metric-list-page.js.map +1 -1
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-importer.d.ts +23 -0
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-importer.js +75 -0
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-importer.js.map +1 -0
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.d.ts +61 -0
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.js +301 -0
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.js.map +1 -0
- package/dist-client/pages/{kpi-value/kpi-value-manual-entry-form.d.ts → kpi-metric-value/kpi-metric-value-manual-entry-form.d.ts} +3 -5
- package/dist-client/pages/{kpi-value/kpi-value-manual-entry-form.js → kpi-metric-value/kpi-metric-value-manual-entry-form.js} +27 -56
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-form.js.map +1 -0
- package/dist-client/pages/{kpi-value/kpi-value-manual-entry-page.d.ts → kpi-metric-value/kpi-metric-value-manual-entry-page.d.ts} +5 -5
- package/dist-client/pages/{kpi-value/kpi-value-manual-entry-page.js → kpi-metric-value/kpi-metric-value-manual-entry-page.js} +28 -28
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-page.js.map +1 -0
- package/dist-client/pages/kpi-value/kpi-value-list-page.js +4 -6
- package/dist-client/pages/kpi-value/kpi-value-list-page.js.map +1 -1
- package/dist-client/route.d.ts +1 -1
- package/dist-client/route.js +5 -2
- package/dist-client/route.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/service/index.d.ts +4 -2
- package/dist-server/service/index.js +6 -1
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/kpi/aggregate-kpi.js +5 -7
- package/dist-server/service/kpi/aggregate-kpi.js.map +1 -1
- package/dist-server/service/kpi/kpi-history.d.ts +3 -1
- package/dist-server/service/kpi/kpi-history.js +10 -0
- package/dist-server/service/kpi/kpi-history.js.map +1 -1
- package/dist-server/service/kpi/kpi-mutation.js +1 -1
- package/dist-server/service/kpi/kpi-mutation.js.map +1 -1
- package/dist-server/service/kpi/kpi-type.d.ts +2 -0
- package/dist-server/service/kpi/kpi-type.js +8 -0
- package/dist-server/service/kpi/kpi-type.js.map +1 -1
- package/dist-server/service/kpi/kpi.d.ts +9 -0
- package/dist-server/service/kpi/kpi.js +23 -1
- package/dist-server/service/kpi/kpi.js.map +1 -1
- package/dist-server/service/kpi-category/kpi-category-mutation.js +0 -8
- package/dist-server/service/kpi-category/kpi-category-mutation.js.map +1 -1
- package/dist-server/service/kpi-category/kpi-category-type.d.ts +4 -2
- package/dist-server/service/kpi-category/kpi-category-type.js +16 -8
- package/dist-server/service/kpi-category/kpi-category-type.js.map +1 -1
- package/dist-server/service/kpi-category/kpi-category.d.ts +2 -2
- package/dist-server/service/kpi-category/kpi-category.js +8 -8
- package/dist-server/service/kpi-category/kpi-category.js.map +1 -1
- package/dist-server/service/kpi-metric/aggregate-kpi-metric.js +31 -74
- package/dist-server/service/kpi-metric/aggregate-kpi-metric.js.map +1 -1
- package/dist-server/service/kpi-metric/kpi-metric-mutation.d.ts +1 -1
- package/dist-server/service/kpi-metric/kpi-metric-mutation.js +15 -28
- package/dist-server/service/kpi-metric/kpi-metric-mutation.js.map +1 -1
- package/dist-server/service/kpi-metric/kpi-metric-type.d.ts +6 -4
- package/dist-server/service/kpi-metric/kpi-metric-type.js +20 -12
- package/dist-server/service/kpi-metric/kpi-metric-type.js.map +1 -1
- package/dist-server/service/kpi-metric/kpi-metric.d.ts +15 -2
- package/dist-server/service/kpi-metric/kpi-metric.js +34 -14
- package/dist-server/service/kpi-metric/kpi-metric.js.map +1 -1
- package/dist-server/service/kpi-metric-value/index.d.ts +6 -0
- package/dist-server/service/kpi-metric-value/index.js +10 -0
- package/dist-server/service/kpi-metric-value/index.js.map +1 -0
- package/dist-server/service/kpi-metric-value/kpi-metric-value-mutation.d.ts +11 -0
- package/dist-server/service/kpi-metric-value/kpi-metric-value-mutation.js +229 -0
- package/dist-server/service/kpi-metric-value/kpi-metric-value-mutation.js.map +1 -0
- package/dist-server/service/kpi-metric-value/kpi-metric-value-query.d.ts +13 -0
- package/dist-server/service/kpi-metric-value/kpi-metric-value-query.js +95 -0
- package/dist-server/service/kpi-metric-value/kpi-metric-value-query.js.map +1 -0
- package/dist-server/service/kpi-metric-value/kpi-metric-value-type.d.ts +26 -0
- package/dist-server/service/kpi-metric-value/kpi-metric-value-type.js +112 -0
- package/dist-server/service/kpi-metric-value/kpi-metric-value-type.js.map +1 -0
- package/dist-server/service/kpi-metric-value/kpi-metric-value.d.ts +23 -0
- package/dist-server/service/kpi-metric-value/kpi-metric-value.js +106 -0
- package/dist-server/service/kpi-metric-value/kpi-metric-value.js.map +1 -0
- package/dist-server/service/kpi-value/kpi-value-mutation.js +1 -2
- package/dist-server/service/kpi-value/kpi-value-mutation.js.map +1 -1
- package/dist-server/service/kpi-value/kpi-value-query.js +1 -1
- package/dist-server/service/kpi-value/kpi-value-query.js.map +1 -1
- package/dist-server/service/kpi-value/kpi-value-type.d.ts +2 -4
- package/dist-server/service/kpi-value/kpi-value-type.js +4 -18
- package/dist-server/service/kpi-value/kpi-value-type.js.map +1 -1
- package/dist-server/service/kpi-value/kpi-value.d.ts +3 -3
- package/dist-server/service/kpi-value/kpi-value.js +13 -14
- package/dist-server/service/kpi-value/kpi-value.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/server/service/index.ts +6 -1
- package/server/service/kpi/aggregate-kpi.ts +5 -8
- package/server/service/kpi/kpi-history.ts +9 -1
- package/server/service/kpi/kpi-mutation.ts +1 -1
- package/server/service/kpi/kpi-type.ts +6 -0
- package/server/service/kpi/kpi.ts +21 -0
- package/server/service/kpi-category/kpi-category-mutation.ts +0 -10
- package/server/service/kpi-category/kpi-category-type.ts +12 -6
- package/server/service/kpi-category/kpi-category.ts +6 -6
- package/server/service/kpi-metric/aggregate-kpi-metric.ts +29 -69
- package/server/service/kpi-metric/kpi-metric-mutation.ts +15 -26
- package/server/service/kpi-metric/kpi-metric-type.ts +17 -12
- package/server/service/kpi-metric/kpi-metric.ts +32 -11
- package/server/service/kpi-metric-value/index.ts +7 -0
- package/server/service/kpi-metric-value/kpi-metric-value-mutation.ts +215 -0
- package/server/service/kpi-metric-value/kpi-metric-value-query.ts +60 -0
- package/server/service/kpi-metric-value/kpi-metric-value-type.ts +82 -0
- package/server/service/kpi-metric-value/kpi-metric-value.ts +91 -0
- package/server/service/kpi-value/kpi-value-mutation.ts +1 -2
- package/server/service/kpi-value/kpi-value-query.ts +1 -1
- package/server/service/kpi-value/kpi-value-type.ts +4 -16
- package/server/service/kpi-value/kpi-value.ts +14 -14
- package/things-factory.config.js +5 -3
- package/translations/en.json +8 -1
- package/translations/ja.json +8 -1
- package/translations/ko.json +9 -2
- package/translations/ms.json +9 -2
- package/translations/zh.json +8 -1
- package/dist-client/pages/kpi-value/kpi-value-manual-entry-form.js.map +0 -1
- package/dist-client/pages/kpi-value/kpi-value-manual-entry-page.js.map +0 -1
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import '@material/web/icon/icon.js';
|
|
3
|
+
import '@material/web/button/elevated-button.js';
|
|
4
|
+
import '@operato/data-grist/ox-grist.js';
|
|
5
|
+
import '@operato/data-grist/ox-filters-form.js';
|
|
6
|
+
import '@operato/data-grist/ox-record-creator.js';
|
|
7
|
+
import { CommonButtonStyles, CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles';
|
|
8
|
+
import { PageView, store } from '@operato/shell';
|
|
9
|
+
import { css, html } from 'lit';
|
|
10
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
11
|
+
import { ScopedElementsMixin } from '@open-wc/scoped-elements';
|
|
12
|
+
import { DataGrist } from '@operato/data-grist';
|
|
13
|
+
import { client } from '@operato/graphql';
|
|
14
|
+
import { i18next, localize } from '@operato/i18n';
|
|
15
|
+
import { notify } from '@operato/layout';
|
|
16
|
+
import { OxPrompt } from '@operato/popup';
|
|
17
|
+
import { isMobileDevice } from '@operato/utils';
|
|
18
|
+
import { connect } from 'pwa-helpers/connect-mixin';
|
|
19
|
+
import gql from 'graphql-tag';
|
|
20
|
+
let KpiMetricValueListPage = class KpiMetricValueListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {
|
|
21
|
+
constructor() {
|
|
22
|
+
super(...arguments);
|
|
23
|
+
this.mode = isMobileDevice() ? 'CARD' : 'GRID';
|
|
24
|
+
}
|
|
25
|
+
static { this.styles = [
|
|
26
|
+
ScrollbarStyles,
|
|
27
|
+
CommonGristStyles,
|
|
28
|
+
CommonHeaderStyles,
|
|
29
|
+
css `
|
|
30
|
+
:host {
|
|
31
|
+
display: flex;
|
|
32
|
+
width: 100%;
|
|
33
|
+
}
|
|
34
|
+
ox-grist {
|
|
35
|
+
overflow-y: auto;
|
|
36
|
+
flex: 1;
|
|
37
|
+
}
|
|
38
|
+
ox-filters-form {
|
|
39
|
+
flex: 1;
|
|
40
|
+
}
|
|
41
|
+
`
|
|
42
|
+
]; }
|
|
43
|
+
get context() {
|
|
44
|
+
return {
|
|
45
|
+
title: i18next.t('title.kpi metric value list'),
|
|
46
|
+
search: {
|
|
47
|
+
handler: (search) => {
|
|
48
|
+
this.grist.searchText = search;
|
|
49
|
+
},
|
|
50
|
+
value: this.grist.searchText
|
|
51
|
+
},
|
|
52
|
+
filter: {
|
|
53
|
+
handler: () => {
|
|
54
|
+
this.grist.toggleHeadroom();
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
help: 'kpi/kpi-metric-value',
|
|
58
|
+
actions: [
|
|
59
|
+
{
|
|
60
|
+
title: i18next.t('button.save'),
|
|
61
|
+
action: this._updateKpiMetricValue.bind(this),
|
|
62
|
+
...CommonButtonStyles.save
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
title: i18next.t('button.delete'),
|
|
66
|
+
action: this._deleteKpiMetricValue.bind(this),
|
|
67
|
+
...CommonButtonStyles.delete
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
exportable: {
|
|
71
|
+
name: i18next.t('title.kpi metric value list'),
|
|
72
|
+
data: this.exportHandler.bind(this)
|
|
73
|
+
},
|
|
74
|
+
importable: {
|
|
75
|
+
handler: this.importHandler.bind(this)
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
render() {
|
|
80
|
+
const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID');
|
|
81
|
+
return html `
|
|
82
|
+
<ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
|
|
83
|
+
<div slot="headroom" class="header">
|
|
84
|
+
<div class="filters">
|
|
85
|
+
<ox-filters-form autofocus without-search></ox-filters-form>
|
|
86
|
+
<div id="modes">
|
|
87
|
+
<md-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</md-icon>
|
|
88
|
+
<md-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</md-icon>
|
|
89
|
+
<md-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-icon>
|
|
90
|
+
</div>
|
|
91
|
+
<ox-record-creator id="add" .callback=${this.creationCallback.bind(this)}>
|
|
92
|
+
<button>
|
|
93
|
+
<md-icon>add</md-icon>
|
|
94
|
+
</button>
|
|
95
|
+
</ox-record-creator>
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
</ox-grist>
|
|
99
|
+
`;
|
|
100
|
+
}
|
|
101
|
+
async pageInitialized() {
|
|
102
|
+
this.gristConfig = {
|
|
103
|
+
list: {
|
|
104
|
+
fields: ['metric', 'valueDate', 'value', 'group', 'meta', 'createdAt', 'updatedAt', 'creator', 'updater'],
|
|
105
|
+
details: ['metric', 'valueDate', 'value', 'group', 'meta', 'createdAt', 'updatedAt', 'creator', 'updater']
|
|
106
|
+
},
|
|
107
|
+
columns: [
|
|
108
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
109
|
+
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
|
110
|
+
{
|
|
111
|
+
type: 'string',
|
|
112
|
+
name: 'metric',
|
|
113
|
+
header: 'Metric',
|
|
114
|
+
record: { editable: false, renderer: (v, c, r) => r.metric?.name },
|
|
115
|
+
width: 150
|
|
116
|
+
},
|
|
117
|
+
{ type: 'date', name: 'valueDate', header: '날짜', record: { editable: true }, width: 120 },
|
|
118
|
+
{ type: 'number', name: 'value', header: '값', record: { editable: true }, width: 120 },
|
|
119
|
+
{ type: 'string', name: 'group', header: '그룹', record: { editable: false }, width: 120 },
|
|
120
|
+
{ type: 'object', name: 'meta', header: '메타', record: { editable: false }, width: 120 },
|
|
121
|
+
{ type: 'datetime', name: 'createdAt', header: '생성일', record: { editable: false }, width: 180 },
|
|
122
|
+
{ type: 'datetime', name: 'updatedAt', header: '수정일', record: { editable: false }, width: 180 },
|
|
123
|
+
{
|
|
124
|
+
type: 'resource-object',
|
|
125
|
+
name: 'creator',
|
|
126
|
+
header: '생성자',
|
|
127
|
+
record: { editable: false, renderer: (v, c, r) => r.creator?.name },
|
|
128
|
+
width: 120
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
type: 'resource-object',
|
|
132
|
+
name: 'updater',
|
|
133
|
+
header: '수정자',
|
|
134
|
+
record: { editable: false, renderer: (v, c, r) => r.updater?.name },
|
|
135
|
+
width: 120
|
|
136
|
+
}
|
|
137
|
+
],
|
|
138
|
+
rows: {
|
|
139
|
+
appendable: false,
|
|
140
|
+
selectable: {
|
|
141
|
+
multiple: true
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
sorters: [{ name: 'valueDate' }]
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }) {
|
|
148
|
+
const response = await client.query({
|
|
149
|
+
query: gql `
|
|
150
|
+
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
151
|
+
responses: kpiMetricValues(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
152
|
+
items {
|
|
153
|
+
id
|
|
154
|
+
metric {
|
|
155
|
+
id
|
|
156
|
+
name
|
|
157
|
+
}
|
|
158
|
+
valueDate
|
|
159
|
+
value
|
|
160
|
+
meta
|
|
161
|
+
group
|
|
162
|
+
updater {
|
|
163
|
+
id
|
|
164
|
+
name
|
|
165
|
+
}
|
|
166
|
+
updatedAt
|
|
167
|
+
creator {
|
|
168
|
+
id
|
|
169
|
+
name
|
|
170
|
+
}
|
|
171
|
+
createdAt
|
|
172
|
+
}
|
|
173
|
+
total
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
`,
|
|
177
|
+
variables: {
|
|
178
|
+
filters,
|
|
179
|
+
pagination: { page, limit },
|
|
180
|
+
sortings
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
return {
|
|
184
|
+
total: response.data.responses.total || 0,
|
|
185
|
+
records: response.data.responses.items || []
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
async _deleteKpiMetricValue() {
|
|
189
|
+
if (await OxPrompt.open({
|
|
190
|
+
title: i18next.t('text.are_you_sure'),
|
|
191
|
+
text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),
|
|
192
|
+
confirmButton: { text: i18next.t('button.confirm') },
|
|
193
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
194
|
+
})) {
|
|
195
|
+
const ids = this.grist.selected.map(record => record.id);
|
|
196
|
+
if (ids && ids.length > 0) {
|
|
197
|
+
const response = await client.mutate({
|
|
198
|
+
mutation: gql `
|
|
199
|
+
mutation ($ids: [String!]!) {
|
|
200
|
+
deleteKpiMetricValues(ids: $ids)
|
|
201
|
+
}
|
|
202
|
+
`,
|
|
203
|
+
variables: { ids }
|
|
204
|
+
});
|
|
205
|
+
if (!response.errors) {
|
|
206
|
+
this.grist.fetch();
|
|
207
|
+
notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') }) });
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
async _updateKpiMetricValue() {
|
|
213
|
+
let patches = this.grist.dirtyRecords;
|
|
214
|
+
if (patches && patches.length) {
|
|
215
|
+
patches = patches.map(patch => {
|
|
216
|
+
let patchField = patch.id ? { id: patch.id } : {};
|
|
217
|
+
const dirtyFields = patch.__dirtyfields__;
|
|
218
|
+
for (let key in dirtyFields) {
|
|
219
|
+
patchField[key] = dirtyFields[key].after;
|
|
220
|
+
}
|
|
221
|
+
patchField.cuFlag = patch.__dirty__;
|
|
222
|
+
return patchField;
|
|
223
|
+
});
|
|
224
|
+
const response = await client.mutate({
|
|
225
|
+
mutation: gql `
|
|
226
|
+
mutation ($patches: [KpiMetricValuePatch!]!) {
|
|
227
|
+
updateMultipleKpiMetricValue(patches: $patches) {
|
|
228
|
+
id
|
|
229
|
+
metric {
|
|
230
|
+
id
|
|
231
|
+
name
|
|
232
|
+
}
|
|
233
|
+
valueDate
|
|
234
|
+
value
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
`,
|
|
238
|
+
variables: { patches }
|
|
239
|
+
});
|
|
240
|
+
if (!response.errors) {
|
|
241
|
+
this.grist.fetch();
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
async creationCallback(metricValue) {
|
|
246
|
+
try {
|
|
247
|
+
const response = await client.mutate({
|
|
248
|
+
mutation: gql `
|
|
249
|
+
mutation ($metricValue: NewKpiMetricValue!) {
|
|
250
|
+
createKpiMetricValue(metricValue: $metricValue) {
|
|
251
|
+
id
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
`,
|
|
255
|
+
variables: { metricValue },
|
|
256
|
+
context: { hasUpload: true }
|
|
257
|
+
});
|
|
258
|
+
if (!response.errors) {
|
|
259
|
+
this.grist.fetch();
|
|
260
|
+
document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.data_created_successfully') } }));
|
|
261
|
+
}
|
|
262
|
+
return true;
|
|
263
|
+
}
|
|
264
|
+
catch (ex) {
|
|
265
|
+
console.error(ex);
|
|
266
|
+
document.dispatchEvent(new CustomEvent('notify', { detail: { type: 'error', message: i18next.t('text.error') } }));
|
|
267
|
+
return false;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
async exportHandler() {
|
|
271
|
+
const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records;
|
|
272
|
+
const targetFieldSet = new Set(['id', 'metric', 'valueDate', 'value', 'group', 'meta']);
|
|
273
|
+
return exportTargets.map(metricValue => {
|
|
274
|
+
let tempObj = {};
|
|
275
|
+
for (const field of targetFieldSet) {
|
|
276
|
+
tempObj[field] = metricValue[field];
|
|
277
|
+
}
|
|
278
|
+
return tempObj;
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
async importHandler(records) {
|
|
282
|
+
// 임포트 팝업 등은 추후 구현
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
__decorate([
|
|
286
|
+
property({ type: Object }),
|
|
287
|
+
__metadata("design:type", Object)
|
|
288
|
+
], KpiMetricValueListPage.prototype, "gristConfig", void 0);
|
|
289
|
+
__decorate([
|
|
290
|
+
property({ type: String }),
|
|
291
|
+
__metadata("design:type", String)
|
|
292
|
+
], KpiMetricValueListPage.prototype, "mode", void 0);
|
|
293
|
+
__decorate([
|
|
294
|
+
query('ox-grist'),
|
|
295
|
+
__metadata("design:type", DataGrist)
|
|
296
|
+
], KpiMetricValueListPage.prototype, "grist", void 0);
|
|
297
|
+
KpiMetricValueListPage = __decorate([
|
|
298
|
+
customElement('kpi-metric-value-list-page')
|
|
299
|
+
], KpiMetricValueListPage);
|
|
300
|
+
export { KpiMetricValueListPage };
|
|
301
|
+
//# sourceMappingURL=kpi-metric-value-list-page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kpi-metric-value-list-page.js","sourceRoot":"","sources":["../../../client/pages/kpi-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web/icon/icon.js'\nimport '@material/web/button/elevated-button.js'\nimport '@operato/data-grist/ox-grist.js'\nimport '@operato/data-grist/ox-filters-form.js'\nimport '@operato/data-grist/ox-record-creator.js'\n\nimport { CommonButtonStyles, CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { PageView, store } from '@operato/shell'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { ColumnConfig, DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { OxPopup, OxPrompt } from '@operato/popup'\nimport { isMobileDevice } from '@operato/utils'\n\nimport { connect } from 'pwa-helpers/connect-mixin'\nimport gql from 'graphql-tag'\n\n@customElement('kpi-metric-value-list-page')\nexport class KpiMetricValueListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {\n static styles = [\n ScrollbarStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n css`\n :host {\n display: flex;\n width: 100%;\n }\n ox-grist {\n overflow-y: auto;\n flex: 1;\n }\n ox-filters-form {\n flex: 1;\n }\n `\n ]\n\n @property({ type: Object }) gristConfig: any\n @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('title.kpi metric value list'),\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist.searchText\n },\n filter: {\n handler: () => {\n this.grist.toggleHeadroom()\n }\n },\n help: 'kpi/kpi-metric-value',\n actions: [\n {\n title: i18next.t('button.save'),\n action: this._updateKpiMetricValue.bind(this),\n ...CommonButtonStyles.save\n },\n {\n title: i18next.t('button.delete'),\n action: this._deleteKpiMetricValue.bind(this),\n ...CommonButtonStyles.delete\n }\n ],\n exportable: {\n name: i18next.t('title.kpi metric value list'),\n data: this.exportHandler.bind(this)\n },\n importable: {\n handler: this.importHandler.bind(this)\n }\n }\n }\n\n render() {\n const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')\n return html`\n <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\">\n <ox-filters-form autofocus without-search></ox-filters-form>\n <div id=\"modes\">\n <md-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</md-icon>\n <md-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</md-icon>\n <md-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-icon>\n </div>\n <ox-record-creator id=\"add\" .callback=${this.creationCallback.bind(this)}>\n <button>\n <md-icon>add</md-icon>\n </button>\n </ox-record-creator>\n </div>\n </div>\n </ox-grist>\n `\n }\n\n async pageInitialized() {\n this.gristConfig = {\n list: {\n fields: ['metric', 'valueDate', 'value', 'group', 'meta', 'createdAt', 'updatedAt', 'creator', 'updater'],\n details: ['metric', 'valueDate', 'value', 'group', 'meta', 'createdAt', 'updatedAt', 'creator', 'updater']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n {\n type: 'string',\n name: 'metric',\n header: 'Metric',\n record: { editable: false, renderer: (v, c, r) => r.metric?.name },\n width: 150\n },\n { type: 'date', name: 'valueDate', header: '날짜', record: { editable: true }, width: 120 },\n { type: 'number', name: 'value', header: '값', record: { editable: true }, width: 120 },\n { type: 'string', name: 'group', header: '그룹', record: { editable: false }, width: 120 },\n { type: 'object', name: 'meta', header: '메타', record: { editable: false }, width: 120 },\n { type: 'datetime', name: 'createdAt', header: '생성일', record: { editable: false }, width: 180 },\n { type: 'datetime', name: 'updatedAt', header: '수정일', record: { editable: false }, width: 180 },\n {\n type: 'resource-object',\n name: 'creator',\n header: '생성자',\n record: { editable: false, renderer: (v, c, r) => r.creator?.name },\n width: 120\n },\n {\n type: 'resource-object',\n name: 'updater',\n header: '수정자',\n record: { editable: false, renderer: (v, c, r) => r.updater?.name },\n width: 120\n }\n ],\n rows: {\n appendable: false,\n selectable: {\n multiple: true\n }\n },\n sorters: [{ name: 'valueDate' }]\n }\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n responses: kpiMetricValues(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n metric {\n id\n name\n }\n valueDate\n value\n meta\n group\n updater {\n id\n name\n }\n updatedAt\n creator {\n id\n name\n }\n createdAt\n }\n total\n }\n }\n `,\n variables: {\n filters,\n pagination: { page, limit },\n sortings\n }\n })\n return {\n total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n\n async _deleteKpiMetricValue() {\n if (\n await OxPrompt.open({\n title: i18next.t('text.are_you_sure'),\n text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),\n confirmButton: { text: i18next.t('button.confirm') },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n ) {\n const ids = this.grist.selected.map(record => record.id)\n if (ids && ids.length > 0) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($ids: [String!]!) {\n deleteKpiMetricValues(ids: $ids)\n }\n `,\n variables: { ids }\n })\n if (!response.errors) {\n this.grist.fetch()\n notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') }) })\n }\n }\n }\n }\n\n async _updateKpiMetricValue() {\n let patches = this.grist.dirtyRecords\n if (patches && patches.length) {\n patches = patches.map(patch => {\n let patchField: any = patch.id ? { id: patch.id } : {}\n const dirtyFields = patch.__dirtyfields__\n for (let key in dirtyFields) {\n patchField[key] = dirtyFields[key].after\n }\n patchField.cuFlag = patch.__dirty__\n return patchField\n })\n const response = await client.mutate({\n mutation: gql`\n mutation ($patches: [KpiMetricValuePatch!]!) {\n updateMultipleKpiMetricValue(patches: $patches) {\n id\n metric {\n id\n name\n }\n valueDate\n value\n }\n }\n `,\n variables: { patches }\n })\n if (!response.errors) {\n this.grist.fetch()\n }\n }\n }\n\n async creationCallback(metricValue) {\n try {\n const response = await client.mutate({\n mutation: gql`\n mutation ($metricValue: NewKpiMetricValue!) {\n createKpiMetricValue(metricValue: $metricValue) {\n id\n }\n }\n `,\n variables: { metricValue },\n context: { hasUpload: true }\n })\n if (!response.errors) {\n this.grist.fetch()\n document.dispatchEvent(\n new CustomEvent('notify', { detail: { message: i18next.t('text.data_created_successfully') } })\n )\n }\n return true\n } catch (ex) {\n console.error(ex)\n document.dispatchEvent(new CustomEvent('notify', { detail: { type: 'error', message: i18next.t('text.error') } }))\n return false\n }\n }\n\n async exportHandler() {\n const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records\n const targetFieldSet = new Set(['id', 'metric', 'valueDate', 'value', 'group', 'meta'])\n return exportTargets.map(metricValue => {\n let tempObj = {}\n for (const field of targetFieldSet) {\n tempObj[field] = metricValue[field]\n }\n return tempObj\n })\n }\n\n async importHandler(records) {\n // 임포트 팝업 등은 추후 구현\n }\n}\n"]}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import '@material/web/icon/icon.js';
|
|
2
1
|
import { LitElement } from 'lit';
|
|
3
|
-
export declare class
|
|
2
|
+
export declare class KpiMetricValueManualEntryForm extends LitElement {
|
|
4
3
|
static styles: import("lit").CSSResult[];
|
|
5
|
-
|
|
4
|
+
metric: any;
|
|
6
5
|
valueDate: string;
|
|
7
6
|
value: string;
|
|
8
|
-
|
|
9
|
-
groupType: string;
|
|
7
|
+
group: string;
|
|
10
8
|
meta: string;
|
|
11
9
|
loading: boolean;
|
|
12
10
|
render(): import("lit-html").TemplateResult<1>;
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
|
-
import '@material/web/icon/icon.js';
|
|
3
2
|
import { html, LitElement, css } from 'lit';
|
|
4
3
|
import { customElement, property, state } from 'lit/decorators.js';
|
|
5
4
|
import { client } from '@operato/graphql';
|
|
6
5
|
import { notify } from '@operato/layout';
|
|
7
6
|
import gql from 'graphql-tag';
|
|
8
7
|
import { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles';
|
|
9
|
-
let
|
|
8
|
+
let KpiMetricValueManualEntryForm = class KpiMetricValueManualEntryForm extends LitElement {
|
|
10
9
|
constructor() {
|
|
11
10
|
super(...arguments);
|
|
12
11
|
this.valueDate = new Date().toISOString().slice(0, 10);
|
|
13
12
|
this.value = '';
|
|
14
|
-
this.
|
|
15
|
-
this.groupType = '';
|
|
13
|
+
this.group = '';
|
|
16
14
|
this.meta = '';
|
|
17
15
|
this.loading = false;
|
|
18
16
|
}
|
|
@@ -25,14 +23,12 @@ let KpiValueManualEntryForm = class KpiValueManualEntryForm extends LitElement {
|
|
|
25
23
|
flex-direction: column;
|
|
26
24
|
background-color: var(--md-sys-color-surface, #f4f6fa);
|
|
27
25
|
}
|
|
28
|
-
|
|
29
26
|
form {
|
|
30
27
|
flex: 1;
|
|
31
28
|
display: flex;
|
|
32
29
|
flex-direction: column;
|
|
33
30
|
overflow-y: auto;
|
|
34
31
|
}
|
|
35
|
-
|
|
36
32
|
.form-card {
|
|
37
33
|
flex: 1;
|
|
38
34
|
display: flex;
|
|
@@ -40,7 +36,6 @@ let KpiValueManualEntryForm = class KpiValueManualEntryForm extends LitElement {
|
|
|
40
36
|
padding: 32px 32px 0 32px;
|
|
41
37
|
background: #fff;
|
|
42
38
|
}
|
|
43
|
-
|
|
44
39
|
label {
|
|
45
40
|
font-weight: 500;
|
|
46
41
|
margin-bottom: 4px;
|
|
@@ -48,7 +43,6 @@ let KpiValueManualEntryForm = class KpiValueManualEntryForm extends LitElement {
|
|
|
48
43
|
flex-direction: column;
|
|
49
44
|
gap: 2px;
|
|
50
45
|
}
|
|
51
|
-
|
|
52
46
|
input,
|
|
53
47
|
textarea {
|
|
54
48
|
font-size: 1em;
|
|
@@ -57,13 +51,11 @@ let KpiValueManualEntryForm = class KpiValueManualEntryForm extends LitElement {
|
|
|
57
51
|
margin-top: 2px;
|
|
58
52
|
resize: none;
|
|
59
53
|
}
|
|
60
|
-
|
|
61
54
|
.desc {
|
|
62
55
|
font-size: 0.95em;
|
|
63
56
|
color: #888;
|
|
64
57
|
margin-top: 8px;
|
|
65
58
|
}
|
|
66
|
-
|
|
67
59
|
.footer span {
|
|
68
60
|
font-size: 0.8em;
|
|
69
61
|
color: var(--md-sys-color-on-surface);
|
|
@@ -76,22 +68,18 @@ let KpiValueManualEntryForm = class KpiValueManualEntryForm extends LitElement {
|
|
|
76
68
|
return html `
|
|
77
69
|
<form style="display:flex;flex-direction:column;height:100%;">
|
|
78
70
|
<div class="form-card">
|
|
79
|
-
<div style="font-size:1.1em;font-weight:bold;margin-bottom:16px;"><b>
|
|
71
|
+
<div style="font-size:1.1em;font-weight:bold;margin-bottom:16px;"><b>Metric:</b> ${this.metric?.name}</div>
|
|
80
72
|
<label>
|
|
81
|
-
|
|
73
|
+
날짜
|
|
82
74
|
<input type="date" .value=${this.valueDate} @input=${e => (this.valueDate = e.target.value)} required />
|
|
83
75
|
</label>
|
|
84
76
|
<label>
|
|
85
|
-
|
|
77
|
+
값
|
|
86
78
|
<input type="number" .value=${this.value} @input=${e => (this.value = e.target.value)} required />
|
|
87
79
|
</label>
|
|
88
80
|
<label>
|
|
89
|
-
그룹
|
|
90
|
-
<input type="text" .value=${this.
|
|
91
|
-
</label>
|
|
92
|
-
<label>
|
|
93
|
-
그룹유형 (선택)
|
|
94
|
-
<input type="text" .value=${this.groupType} @input=${e => (this.groupType = e.target.value)} />
|
|
81
|
+
그룹 (선택)
|
|
82
|
+
<input type="text" .value=${this.group} @input=${e => (this.group = e.target.value)} />
|
|
95
83
|
</label>
|
|
96
84
|
<label>
|
|
97
85
|
메타정보 (선택, JSON)
|
|
@@ -100,7 +88,6 @@ let KpiValueManualEntryForm = class KpiValueManualEntryForm extends LitElement {
|
|
|
100
88
|
<div class="desc">입력방식: MANUAL, Source: MANUAL (자동 지정)</div>
|
|
101
89
|
</div>
|
|
102
90
|
</form>
|
|
103
|
-
|
|
104
91
|
<div class="footer">
|
|
105
92
|
<div filler></div>
|
|
106
93
|
<button type="button" ?disabled=${this.loading} done @click=${this.save}><md-icon>save</md-icon>저장</button>
|
|
@@ -123,25 +110,15 @@ let KpiValueManualEntryForm = class KpiValueManualEntryForm extends LitElement {
|
|
|
123
110
|
try {
|
|
124
111
|
await client.mutate({
|
|
125
112
|
mutation: gql `
|
|
126
|
-
mutation (
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
$groupId: String
|
|
131
|
-
$groupType: String
|
|
132
|
-
$meta: Object
|
|
133
|
-
) {
|
|
134
|
-
createKpiValue(
|
|
135
|
-
kpiValue: {
|
|
136
|
-
kpiId: $kpiId
|
|
113
|
+
mutation ($metricId: ID!, $valueDate: String!, $value: Float!, $group: String, $meta: Object) {
|
|
114
|
+
createKpiMetricValue(
|
|
115
|
+
metricValue: {
|
|
116
|
+
metricId: $metricId
|
|
137
117
|
valueDate: $valueDate
|
|
138
118
|
value: $value
|
|
139
|
-
|
|
140
|
-
groupId: $groupId
|
|
141
|
-
groupType: $groupType
|
|
142
|
-
inputType: MANUAL
|
|
143
|
-
source: "MANUAL"
|
|
119
|
+
group: $group
|
|
144
120
|
meta: $meta
|
|
121
|
+
periodType: DAY
|
|
145
122
|
}
|
|
146
123
|
) {
|
|
147
124
|
id
|
|
@@ -149,17 +126,15 @@ let KpiValueManualEntryForm = class KpiValueManualEntryForm extends LitElement {
|
|
|
149
126
|
}
|
|
150
127
|
`,
|
|
151
128
|
variables: {
|
|
152
|
-
|
|
129
|
+
metricId: this.metric.id,
|
|
153
130
|
valueDate: this.valueDate,
|
|
154
131
|
value: parseFloat(this.value),
|
|
155
|
-
|
|
156
|
-
groupType: this.groupType || undefined,
|
|
132
|
+
group: this.group || undefined,
|
|
157
133
|
meta: parsedMeta
|
|
158
134
|
}
|
|
159
135
|
});
|
|
160
|
-
notify({ message: '
|
|
136
|
+
notify({ message: 'Metric 값이 저장되었습니다.' });
|
|
161
137
|
this.dispatchEvent(new CustomEvent('saved', { bubbles: true, composed: true }));
|
|
162
|
-
// 팝업 닫기 로직
|
|
163
138
|
let el = this.parentElement;
|
|
164
139
|
while (el) {
|
|
165
140
|
if (typeof el.close === 'function') {
|
|
@@ -180,33 +155,29 @@ let KpiValueManualEntryForm = class KpiValueManualEntryForm extends LitElement {
|
|
|
180
155
|
__decorate([
|
|
181
156
|
property({ type: Object }),
|
|
182
157
|
__metadata("design:type", Object)
|
|
183
|
-
],
|
|
184
|
-
__decorate([
|
|
185
|
-
state(),
|
|
186
|
-
__metadata("design:type", Object)
|
|
187
|
-
], KpiValueManualEntryForm.prototype, "valueDate", void 0);
|
|
158
|
+
], KpiMetricValueManualEntryForm.prototype, "metric", void 0);
|
|
188
159
|
__decorate([
|
|
189
160
|
state(),
|
|
190
161
|
__metadata("design:type", Object)
|
|
191
|
-
],
|
|
162
|
+
], KpiMetricValueManualEntryForm.prototype, "valueDate", void 0);
|
|
192
163
|
__decorate([
|
|
193
164
|
state(),
|
|
194
165
|
__metadata("design:type", Object)
|
|
195
|
-
],
|
|
166
|
+
], KpiMetricValueManualEntryForm.prototype, "value", void 0);
|
|
196
167
|
__decorate([
|
|
197
168
|
state(),
|
|
198
169
|
__metadata("design:type", Object)
|
|
199
|
-
],
|
|
170
|
+
], KpiMetricValueManualEntryForm.prototype, "group", void 0);
|
|
200
171
|
__decorate([
|
|
201
172
|
state(),
|
|
202
173
|
__metadata("design:type", Object)
|
|
203
|
-
],
|
|
174
|
+
], KpiMetricValueManualEntryForm.prototype, "meta", void 0);
|
|
204
175
|
__decorate([
|
|
205
176
|
state(),
|
|
206
177
|
__metadata("design:type", Object)
|
|
207
|
-
],
|
|
208
|
-
|
|
209
|
-
customElement('kpi-value-manual-entry-form')
|
|
210
|
-
],
|
|
211
|
-
export {
|
|
212
|
-
//# sourceMappingURL=kpi-value-manual-entry-form.js.map
|
|
178
|
+
], KpiMetricValueManualEntryForm.prototype, "loading", void 0);
|
|
179
|
+
KpiMetricValueManualEntryForm = __decorate([
|
|
180
|
+
customElement('kpi-metric-value-manual-entry-form')
|
|
181
|
+
], KpiMetricValueManualEntryForm);
|
|
182
|
+
export { KpiMetricValueManualEntryForm };
|
|
183
|
+
//# sourceMappingURL=kpi-metric-value-manual-entry-form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kpi-metric-value-manual-entry-form.js","sourceRoot":"","sources":["../../../client/pages/kpi-metric-value/kpi-metric-value-manual-entry-form.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAG9D,IAAM,6BAA6B,GAAnC,MAAM,6BAA8B,SAAQ,UAAU;IAAtD;;QAqDI,cAAS,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;QACjD,UAAK,GAAG,EAAE,CAAA;QACV,UAAK,GAAG,EAAE,CAAA;QACV,SAAI,GAAG,EAAE,CAAA;QACT,YAAO,GAAG,KAAK,CAAA;IAuF1B,CAAC;aA/IQ,WAAM,GAAG;QACd,kBAAkB;QAClB,eAAe;QACf,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AA6B;IADzC,aAAa,CAAC,oCAAoC,CAAC;GACvC,6BAA6B,CAgJzC","sourcesContent":["import { html, LitElement, css } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { client } from '@operato/graphql'\nimport { notify } from '@operato/layout'\nimport gql from 'graphql-tag'\nimport { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'\n\n@customElement('kpi-metric-value-manual-entry-form')\nexport class KpiMetricValueManualEntryForm extends LitElement {\n static styles = [\n CommonHeaderStyles,\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n background-color: var(--md-sys-color-surface, #f4f6fa);\n }\n form {\n flex: 1;\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n }\n .form-card {\n flex: 1;\n display: flex;\n flex-direction: column;\n padding: 32px 32px 0 32px;\n background: #fff;\n }\n label {\n font-weight: 500;\n margin-bottom: 4px;\n display: flex;\n flex-direction: column;\n gap: 2px;\n }\n input,\n textarea {\n font-size: 1em;\n padding: 6px 8px;\n border: 1px solid #ccc;\n margin-top: 2px;\n resize: none;\n }\n .desc {\n font-size: 0.95em;\n color: #888;\n margin-top: 8px;\n }\n .footer span {\n font-size: 0.8em;\n color: var(--md-sys-color-on-surface);\n line-height: 1.5;\n padding: 10px;\n }\n `\n ]\n\n @property({ type: Object }) metric: any\n @state() valueDate = new Date().toISOString().slice(0, 10)\n @state() value = ''\n @state() group = ''\n @state() meta = ''\n @state() loading = false\n\n render() {\n return html`\n <form style=\"display:flex;flex-direction:column;height:100%;\">\n <div class=\"form-card\">\n <div style=\"font-size:1.1em;font-weight:bold;margin-bottom:16px;\"><b>Metric:</b> ${this.metric?.name}</div>\n <label>\n 날짜\n <input type=\"date\" .value=${this.valueDate} @input=${e => (this.valueDate = e.target.value)} required />\n </label>\n <label>\n 값\n <input type=\"number\" .value=${this.value} @input=${e => (this.value = e.target.value)} required />\n </label>\n <label>\n 그룹 (선택)\n <input type=\"text\" .value=${this.group} @input=${e => (this.group = e.target.value)} />\n </label>\n <label>\n 메타정보 (선택, JSON)\n <textarea .value=${this.meta} @input=${e => (this.meta = e.target.value)}></textarea>\n </label>\n <div class=\"desc\">입력방식: MANUAL, Source: MANUAL (자동 지정)</div>\n </div>\n </form>\n <div class=\"footer\">\n <div filler></div>\n <button type=\"button\" ?disabled=${this.loading} done @click=${this.save}><md-icon>save</md-icon>저장</button>\n </div>\n `\n }\n\n async save() {\n this.loading = true\n let parsedMeta = undefined\n if (this.meta) {\n try {\n parsedMeta = JSON.parse(this.meta)\n } catch (err) {\n notify({ message: '메타정보는 올바른 JSON이어야 합니다.', level: 'error' })\n this.loading = false\n return\n }\n }\n try {\n await client.mutate({\n mutation: gql`\n mutation ($metricId: ID!, $valueDate: String!, $value: Float!, $group: String, $meta: Object) {\n createKpiMetricValue(\n metricValue: {\n metricId: $metricId\n valueDate: $valueDate\n value: $value\n group: $group\n meta: $meta\n periodType: DAY\n }\n ) {\n id\n }\n }\n `,\n variables: {\n metricId: this.metric.id,\n valueDate: this.valueDate,\n value: parseFloat(this.value),\n group: this.group || undefined,\n meta: parsedMeta\n }\n })\n notify({ message: 'Metric 값이 저장되었습니다.' })\n this.dispatchEvent(new CustomEvent('saved', { bubbles: true, composed: true }))\n let el: any = this.parentElement\n while (el) {\n if (typeof el.close === 'function') {\n el.close()\n break\n }\n el = el.parentElement\n }\n } catch (err: any) {\n notify({ message: '저장 실패: ' + (err?.message || err), level: 'error' })\n } finally {\n this.loading = false\n }\n }\n}\n"]}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import '@material/web/icon/icon.js';
|
|
2
2
|
import '@operato/data-grist';
|
|
3
|
-
import './kpi-value-manual-entry-form.js';
|
|
3
|
+
import './kpi-metric-value-manual-entry-form.js';
|
|
4
4
|
import { PageView } from '@operato/shell';
|
|
5
|
-
declare const
|
|
5
|
+
declare const KpiMetricValueManualEntryPage_base: (new (...args: any[]) => {
|
|
6
6
|
_storeUnsubscribe: import("redux").Unsubscribe;
|
|
7
7
|
connectedCallback(): void;
|
|
8
8
|
disconnectedCallback(): void;
|
|
9
9
|
stateChanged(_state: unknown): void;
|
|
10
10
|
readonly isConnected: boolean;
|
|
11
11
|
}) & (new (...args: any[]) => import("lit").LitElement) & typeof PageView;
|
|
12
|
-
export declare class
|
|
12
|
+
export declare class KpiMetricValueManualEntryPage extends KpiMetricValueManualEntryPage_base {
|
|
13
13
|
static styles: import("lit").CSSResult[];
|
|
14
14
|
get context(): {
|
|
15
15
|
title: string;
|
|
@@ -23,7 +23,7 @@ export declare class KpiValueManualEntryPage extends KpiValueManualEntryPage_bas
|
|
|
23
23
|
help: string;
|
|
24
24
|
};
|
|
25
25
|
private gristConfig;
|
|
26
|
-
private
|
|
26
|
+
private metrics;
|
|
27
27
|
private grist;
|
|
28
28
|
render(): import("lit-html").TemplateResult<1>;
|
|
29
29
|
pageInitialized(): Promise<void>;
|
|
@@ -36,6 +36,6 @@ export declare class KpiValueManualEntryPage extends KpiValueManualEntryPage_bas
|
|
|
36
36
|
total: any;
|
|
37
37
|
records: any;
|
|
38
38
|
}>;
|
|
39
|
-
openManualEntryForm(
|
|
39
|
+
openManualEntryForm(metric: any): void;
|
|
40
40
|
}
|
|
41
41
|
export {};
|