@things-factory/dataset 7.0.1-alpha.24 → 7.0.1-alpha.29
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/components/data-entry-form.ts +6 -13
- package/client/pages/data-archive/data-archive-list-page.ts +1 -4
- package/client/pages/data-archive/data-archive-request-popup.ts +6 -9
- package/client/pages/data-entry/data-entry-list-page.ts +1 -4
- package/client/pages/data-key-set/data-key-item-list.ts +8 -22
- package/client/pages/data-key-set/data-key-set-importer.ts +4 -11
- package/client/pages/data-key-set/data-key-set-list-page.ts +1 -4
- package/client/pages/data-ooc/data-ooc-list-page.ts +1 -4
- package/client/pages/data-report/data-report-list-page.ts +1 -4
- package/client/pages/data-sample/data-sample-list-page.ts +1 -4
- package/client/pages/data-sample/data-sample-search-page.ts +1 -4
- package/client/pages/data-sensor/data-sensor-list-page.ts +1 -4
- package/client/pages/data-set/data-item-list.ts +7 -15
- package/client/pages/data-set/data-set-importer.ts +5 -17
- package/client/pages/data-set/data-set-list-page.ts +1 -4
- package/client/pages/data-summary/data-summary-list-page.ts +1 -4
- package/client/pages/data-summary/data-summary-period-page.ts +1 -4
- package/client/pages/data-summary/data-summary-search-page.ts +1 -4
- package/dist-client/components/data-entry-form.d.ts +1 -0
- package/dist-client/components/data-entry-form.js +5 -10
- package/dist-client/components/data-entry-form.js.map +1 -1
- package/dist-client/pages/data-archive/data-archive-list-page.js +1 -4
- package/dist-client/pages/data-archive/data-archive-list-page.js.map +1 -1
- package/dist-client/pages/data-archive/data-archive-request-popup.d.ts +1 -1
- package/dist-client/pages/data-archive/data-archive-request-popup.js +5 -9
- package/dist-client/pages/data-archive/data-archive-request-popup.js.map +1 -1
- package/dist-client/pages/data-entry/data-entry-list-page.js +1 -4
- package/dist-client/pages/data-entry/data-entry-list-page.js.map +1 -1
- package/dist-client/pages/data-key-set/data-key-item-list.d.ts +1 -0
- package/dist-client/pages/data-key-set/data-key-item-list.js +7 -22
- package/dist-client/pages/data-key-set/data-key-item-list.js.map +1 -1
- package/dist-client/pages/data-key-set/data-key-set-importer.d.ts +1 -0
- package/dist-client/pages/data-key-set/data-key-set-importer.js +4 -11
- package/dist-client/pages/data-key-set/data-key-set-importer.js.map +1 -1
- package/dist-client/pages/data-key-set/data-key-set-list-page.js +1 -4
- package/dist-client/pages/data-key-set/data-key-set-list-page.js.map +1 -1
- package/dist-client/pages/data-ooc/data-ooc-list-page.js +1 -4
- package/dist-client/pages/data-ooc/data-ooc-list-page.js.map +1 -1
- package/dist-client/pages/data-report/data-report-list-page.js +1 -4
- package/dist-client/pages/data-report/data-report-list-page.js.map +1 -1
- package/dist-client/pages/data-sample/data-sample-list-page.js +1 -4
- package/dist-client/pages/data-sample/data-sample-list-page.js.map +1 -1
- package/dist-client/pages/data-sample/data-sample-search-page.js +1 -4
- package/dist-client/pages/data-sample/data-sample-search-page.js.map +1 -1
- package/dist-client/pages/data-sensor/data-sensor-list-page.js +1 -4
- package/dist-client/pages/data-sensor/data-sensor-list-page.js.map +1 -1
- package/dist-client/pages/data-set/data-item-list.d.ts +1 -1
- package/dist-client/pages/data-set/data-item-list.js +6 -15
- package/dist-client/pages/data-set/data-item-list.js.map +1 -1
- package/dist-client/pages/data-set/data-set-importer.d.ts +1 -0
- package/dist-client/pages/data-set/data-set-importer.js +5 -16
- package/dist-client/pages/data-set/data-set-importer.js.map +1 -1
- package/dist-client/pages/data-set/data-set-list-page.js +1 -4
- package/dist-client/pages/data-set/data-set-list-page.js.map +1 -1
- package/dist-client/pages/data-summary/data-summary-list-page.js +1 -4
- package/dist-client/pages/data-summary/data-summary-list-page.js.map +1 -1
- package/dist-client/pages/data-summary/data-summary-period-page.js +1 -4
- package/dist-client/pages/data-summary/data-summary-period-page.js.map +1 -1
- package/dist-client/pages/data-summary/data-summary-search-page.js +1 -4
- package/dist-client/pages/data-summary/data-summary-search-page.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -12
@@ -1,3 +1,4 @@
|
|
1
|
+
import '@material/web/icon/icon.js'
|
1
2
|
import '@operato/dataset/ox-data-entry-form.js'
|
2
3
|
|
3
4
|
import gql from 'graphql-tag'
|
@@ -6,13 +7,14 @@ import { customElement, property, query, state } from 'lit/decorators.js'
|
|
6
7
|
|
7
8
|
import { client } from '@operato/graphql'
|
8
9
|
import { i18next, localize } from '@operato/i18n'
|
9
|
-
import { ScrollbarStyles } from '@operato/styles'
|
10
|
+
import { ButtonContainerStyles, ScrollbarStyles } from '@operato/styles'
|
10
11
|
import { OxDataEntryForm } from '@operato/dataset/ox-data-entry-form.js'
|
11
12
|
import { DataSet } from '@operato/dataset'
|
12
13
|
|
13
14
|
@customElement('data-entry-form')
|
14
15
|
export class DataEntryForm extends localize(i18next)(LitElement) {
|
15
16
|
static styles = [
|
17
|
+
ButtonContainerStyles,
|
16
18
|
ScrollbarStyles,
|
17
19
|
css`
|
18
20
|
:host {
|
@@ -28,12 +30,6 @@ export class DataEntryForm extends localize(i18next)(LitElement) {
|
|
28
30
|
overflow: auto;
|
29
31
|
}
|
30
32
|
|
31
|
-
.button-container {
|
32
|
-
display: flex;
|
33
|
-
margin-left: auto;
|
34
|
-
padding: var(--padding-default);
|
35
|
-
}
|
36
|
-
|
37
33
|
.button-container span {
|
38
34
|
font-size: 14px;
|
39
35
|
color: #333;
|
@@ -52,11 +48,10 @@ export class DataEntryForm extends localize(i18next)(LitElement) {
|
|
52
48
|
render() {
|
53
49
|
return html`
|
54
50
|
<ox-data-entry-form .dataSet=${this.dataSet}></ox-data-entry-form>
|
51
|
+
|
55
52
|
<div class="button-container">
|
56
53
|
${!this.dataSample
|
57
|
-
? html`
|
58
|
-
<mwc-button raised @click=${this.updateDataItems.bind(this)}>${i18next.t('button.save')}</mwc-button>
|
59
|
-
`
|
54
|
+
? html` <button @click=${this.updateDataItems.bind(this)}><md-icon>save</md-icon>${i18next.t('button.save')}</button> `
|
60
55
|
: html` <span>${i18next.t('field.collected-at')}: ${this.dataSample.collectedAt.toLocaleString()}</span> `}
|
61
56
|
</div>
|
62
57
|
`
|
@@ -101,9 +96,7 @@ export class DataEntryForm extends localize(i18next)(LitElement) {
|
|
101
96
|
collectedAt: new Date(collectedAt)
|
102
97
|
}
|
103
98
|
|
104
|
-
document.dispatchEvent(
|
105
|
-
new CustomEvent('notify', { detail: { message: i18next.t('text.data sample created successfully') } })
|
106
|
-
)
|
99
|
+
document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.data sample created successfully') } }))
|
107
100
|
}
|
108
101
|
}
|
109
102
|
}
|
@@ -80,10 +80,7 @@ export class DataArchiveListPage extends connect(store)(localize(i18next)(PageVi
|
|
80
80
|
return html`
|
81
81
|
<ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)} ?url-params-sensitive=${false /* this.active */}>
|
82
82
|
<div slot="headroom" class="header">
|
83
|
-
<div class="title">
|
84
|
-
<md-icon>apps</md-icon>
|
85
|
-
${i18next.t('title.data-archive list')}
|
86
|
-
</div>
|
83
|
+
<div class="title">${i18next.t('title.data-archive list')}</div>
|
87
84
|
|
88
85
|
<!-- <div class="filters">
|
89
86
|
<ox-filters-form class="filter" autofocus without-search></ox-filters-form>
|
@@ -1,10 +1,13 @@
|
|
1
|
+
import '@material/web/icon/icon.js'
|
2
|
+
|
1
3
|
import gql from 'graphql-tag'
|
2
4
|
import { css, html, LitElement } from 'lit'
|
3
5
|
import { customElement, property, query, state } from 'lit/decorators.js'
|
4
6
|
|
5
7
|
import { i18next, localize } from '@operato/i18n'
|
6
8
|
import { client } from '@operato/graphql'
|
7
|
-
import { SingleColumnFormStyles } from '@
|
9
|
+
import { SingleColumnFormStyles } from '@operato/form'
|
10
|
+
import { ButtonContainerStyles } from '@operato/styles'
|
8
11
|
|
9
12
|
import moment from 'moment-timezone'
|
10
13
|
import { CustomAlert } from '@operato/shell'
|
@@ -12,6 +15,7 @@ import { CustomAlert } from '@operato/shell'
|
|
12
15
|
@customElement('data-archive-request-popup')
|
13
16
|
class DataArchiveRequestPopup extends localize(i18next)(LitElement) {
|
14
17
|
static styles = [
|
18
|
+
ButtonContainerStyles,
|
15
19
|
SingleColumnFormStyles,
|
16
20
|
css`
|
17
21
|
:host {
|
@@ -25,13 +29,6 @@ class DataArchiveRequestPopup extends localize(i18next)(LitElement) {
|
|
25
29
|
form {
|
26
30
|
overflow: auto;
|
27
31
|
}
|
28
|
-
|
29
|
-
.button-container {
|
30
|
-
display: flex;
|
31
|
-
margin-top: auto;
|
32
|
-
margin-left: auto;
|
33
|
-
padding: var(--padding-default);
|
34
|
-
}
|
35
32
|
`
|
36
33
|
]
|
37
34
|
|
@@ -53,7 +50,7 @@ class DataArchiveRequestPopup extends localize(i18next)(LitElement) {
|
|
53
50
|
</form>
|
54
51
|
|
55
52
|
<div class="button-container">
|
56
|
-
<
|
53
|
+
<button @click=${this.requestArchive}><md-icon>archive</md-icon>${String(i18next.t('button.submit'))}</button>
|
57
54
|
</div>
|
58
55
|
`
|
59
56
|
}
|
@@ -121,10 +121,7 @@ export class DataEntryListPage extends connect(store)(localize(i18next)(PageView
|
|
121
121
|
return html`
|
122
122
|
<ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)} ?url-params-sensitive=${this.active}>
|
123
123
|
<div slot="headroom" class="header">
|
124
|
-
<div class="title">
|
125
|
-
<md-icon>apps</md-icon>
|
126
|
-
${i18next.t('title.data-entry list')}
|
127
|
-
</div>
|
124
|
+
<div class="title">${i18next.t('title.data-entry list')}</div>
|
128
125
|
|
129
126
|
<div class="filters">
|
130
127
|
<ox-filters-form autofocus without-search></ox-filters-form>
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import '@material/web/icon/icon.js'
|
2
|
+
|
1
3
|
import gql from 'graphql-tag'
|
2
4
|
import { css, html, LitElement } from 'lit'
|
3
5
|
import { customElement, property, query, state } from 'lit/decorators.js'
|
@@ -6,10 +8,12 @@ import { client } from '@operato/graphql'
|
|
6
8
|
import { i18next, localize } from '@operato/i18n'
|
7
9
|
import { isMobileDevice } from '@operato/utils'
|
8
10
|
import { DataGrist, FetchOption } from '@operato/data-grist'
|
11
|
+
import { ButtonContainerStyles } from '@operato/styles'
|
9
12
|
|
10
13
|
@customElement('data-key-item-list')
|
11
14
|
export class DataKeyItemList extends localize(i18next)(LitElement) {
|
12
15
|
static styles = [
|
16
|
+
ButtonContainerStyles,
|
13
17
|
css`
|
14
18
|
:host {
|
15
19
|
display: flex;
|
@@ -21,19 +25,6 @@ export class DataKeyItemList extends localize(i18next)(LitElement) {
|
|
21
25
|
ox-grist {
|
22
26
|
flex: 1;
|
23
27
|
}
|
24
|
-
|
25
|
-
.button-container {
|
26
|
-
display: flex;
|
27
|
-
margin-left: auto;
|
28
|
-
padding: var(--padding-default);
|
29
|
-
}
|
30
|
-
|
31
|
-
[danger] {
|
32
|
-
--mdc-theme-primary: var(--mdc-danger-button-primary-color);
|
33
|
-
}
|
34
|
-
mwc-button {
|
35
|
-
margin-left: var(--margin-default);
|
36
|
-
}
|
37
28
|
`
|
38
29
|
]
|
39
30
|
|
@@ -43,16 +34,11 @@ export class DataKeyItemList extends localize(i18next)(LitElement) {
|
|
43
34
|
|
44
35
|
render() {
|
45
36
|
return html`
|
46
|
-
<ox-grist
|
47
|
-
|
48
|
-
.config=${this.gristConfig}
|
49
|
-
.fetchHandler=${this.fetchHandler.bind(this)}
|
50
|
-
></ox-grist>
|
37
|
+
<ox-grist .mode=${isMobileDevice() ? 'LIST' : 'GRID'} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}></ox-grist>
|
38
|
+
|
51
39
|
<div class="button-container">
|
52
|
-
<
|
53
|
-
|
54
|
-
>
|
55
|
-
<mwc-button raised @click=${this._updateDataKeyItems.bind(this)}>${i18next.t('button.save')}</mwc-button>
|
40
|
+
<button danger @click=${this._deleteDataKeyItems.bind(this)}><md-icon>delete_forever</md-icon>${i18next.t('button.delete')}</button>
|
41
|
+
<button @click=${this._updateDataKeyItems.bind(this)}><md-icon>save</md-icon>${i18next.t('button.save')}</button>
|
56
42
|
</div>
|
57
43
|
`
|
58
44
|
}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import '@material/web/icon/icon.js'
|
1
2
|
import '@operato/data-grist'
|
2
3
|
|
3
4
|
import gql from 'graphql-tag'
|
@@ -7,10 +8,12 @@ import { customElement, property, query, state } from 'lit/decorators.js'
|
|
7
8
|
import { client } from '@operato/graphql'
|
8
9
|
import { i18next } from '@operato/i18n'
|
9
10
|
import { isMobileDevice } from '@operato/utils'
|
11
|
+
import { ButtonContainerStyles } from '@operato/styles'
|
10
12
|
|
11
13
|
@customElement('data-key-set-importer')
|
12
14
|
export class DataKeySetImporter extends LitElement {
|
13
15
|
static styles = [
|
16
|
+
ButtonContainerStyles,
|
14
17
|
css`
|
15
18
|
:host {
|
16
19
|
display: flex;
|
@@ -22,16 +25,6 @@ export class DataKeySetImporter extends LitElement {
|
|
22
25
|
ox-grist {
|
23
26
|
flex: 1;
|
24
27
|
}
|
25
|
-
|
26
|
-
.button-container {
|
27
|
-
display: flex;
|
28
|
-
margin-left: auto;
|
29
|
-
padding: var(--padding-default);
|
30
|
-
}
|
31
|
-
|
32
|
-
mwc-button {
|
33
|
-
margin-left: var(--margin-default);
|
34
|
-
}
|
35
28
|
`
|
36
29
|
]
|
37
30
|
|
@@ -73,7 +66,7 @@ export class DataKeySetImporter extends LitElement {
|
|
73
66
|
></ox-grist>
|
74
67
|
|
75
68
|
<div class="button-container">
|
76
|
-
<
|
69
|
+
<button @click="${this.save.bind(this)}"><md-icon>save</md-icon>${i18next.t('button.save')}</button>
|
77
70
|
</div>
|
78
71
|
`
|
79
72
|
}
|
@@ -123,10 +123,7 @@ export class DataKeySetListPage extends connect(store)(localize(i18next)(PageVie
|
|
123
123
|
return html`
|
124
124
|
<ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
|
125
125
|
<div slot="headroom" class="header">
|
126
|
-
<div class="title">
|
127
|
-
<md-icon>apps</md-icon>
|
128
|
-
${i18next.t('title.data-key-set list')}
|
129
|
-
</div>
|
126
|
+
<div class="title">${i18next.t('title.data-key-set list')}</div>
|
130
127
|
|
131
128
|
<div class="filters">
|
132
129
|
<ox-filters-form autofocus without-search></ox-filters-form>
|
@@ -101,10 +101,7 @@ export class DataOocListPage extends connect(store)(localize(i18next)(PageView))
|
|
101
101
|
return html`
|
102
102
|
<ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
|
103
103
|
<div slot="headroom" class="header">
|
104
|
-
<div class="title">
|
105
|
-
<md-icon>apps</md-icon>
|
106
|
-
${i18next.t('title.data-ooc list')}
|
107
|
-
</div>
|
104
|
+
<div class="title">${i18next.t('title.data-ooc list')}</div>
|
108
105
|
|
109
106
|
<div class="filters">
|
110
107
|
<ox-input-select-buttons
|
@@ -158,10 +158,7 @@ export class DataReportListPage extends connect(store)(localize(i18next)(PageVie
|
|
158
158
|
return html`
|
159
159
|
<ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)} ?url-params-sensitive=${this.active}>
|
160
160
|
<div slot="headroom" class="header">
|
161
|
-
<div class="title">
|
162
|
-
<md-icon>apps</md-icon>
|
163
|
-
${i18next.t('title.data-report list')}
|
164
|
-
</div>
|
161
|
+
<div class="title">${i18next.t('title.data-report list')}</div>
|
165
162
|
|
166
163
|
<div class="filters">
|
167
164
|
<ox-filters-form class="filter" autofocus without-search></ox-filters-form>
|
@@ -81,10 +81,7 @@ export class DataSampleListPage extends connect(store)(localize(i18next)(PageVie
|
|
81
81
|
return html`
|
82
82
|
<ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)} ?url-params-sensitive=${false /* this.active */}>
|
83
83
|
<div slot="headroom" class="header">
|
84
|
-
<div class="title">
|
85
|
-
<md-icon>apps</md-icon>
|
86
|
-
${i18next.t('title.data-sample list')}
|
87
|
-
</div>
|
84
|
+
<div class="title">${i18next.t('title.data-sample list')}</div>
|
88
85
|
|
89
86
|
<div class="filters">
|
90
87
|
<ox-filters-form class="filter" autofocus without-search></ox-filters-form>
|
@@ -83,10 +83,7 @@ export class DataSampleSearchPage extends connect(store)(localize(i18next)(PageV
|
|
83
83
|
return html`
|
84
84
|
<ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
|
85
85
|
<div slot="headroom" class="header">
|
86
|
-
<div class="title">
|
87
|
-
<md-icon>apps</md-icon>
|
88
|
-
${i18next.t('title.data-sample search')}
|
89
|
-
</div>
|
86
|
+
<div class="title">${i18next.t('title.data-sample search')}</div>
|
90
87
|
|
91
88
|
<div class="filters">
|
92
89
|
<ox-filters-form class="filter" autofocus without-search></ox-filters-form>
|
@@ -93,10 +93,7 @@ export class DataSensorListPage extends connect(store)(localize(i18next)(PageVie
|
|
93
93
|
return html`
|
94
94
|
<ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)} ?url-params-sensitive=${this.active}>
|
95
95
|
<div slot="headroom" class="header">
|
96
|
-
<div class="title">
|
97
|
-
<md-icon>apps</md-icon>
|
98
|
-
${i18next.t('title.data-sensor list')}
|
99
|
-
</div>
|
96
|
+
<div class="title">${i18next.t('title.data-sensor list')}</div>
|
100
97
|
|
101
98
|
<div class="filters">
|
102
99
|
<ox-filters-form class="filter" autofocus without-search></ox-filters-form>
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import '@material/web/icon/icon.js'
|
2
|
+
|
1
3
|
import gql from 'graphql-tag'
|
2
4
|
|
3
5
|
import { css, html, LitElement } from 'lit'
|
@@ -7,6 +9,7 @@ import { client } from '@operato/graphql'
|
|
7
9
|
import { i18next, localize } from '@operato/i18n'
|
8
10
|
import { isMobileDevice } from '@operato/utils'
|
9
11
|
import { DataGrist, FetchOption } from '@operato/data-grist'
|
12
|
+
import { ButtonContainerStyles } from '@operato/styles'
|
10
13
|
|
11
14
|
const DataItemStats = ['sum', 'mean', 'stddev', 'variance', 'min', 'max', 'range', 'median', 'mode']
|
12
15
|
|
@@ -17,6 +20,7 @@ class DataItemList extends localize(i18next)(LitElement) {
|
|
17
20
|
@state() gristConfig: any
|
18
21
|
|
19
22
|
static styles = [
|
23
|
+
ButtonContainerStyles,
|
20
24
|
css`
|
21
25
|
:host {
|
22
26
|
display: flex;
|
@@ -28,19 +32,6 @@ class DataItemList extends localize(i18next)(LitElement) {
|
|
28
32
|
ox-grist {
|
29
33
|
flex: 1;
|
30
34
|
}
|
31
|
-
|
32
|
-
.button-container {
|
33
|
-
display: flex;
|
34
|
-
margin-left: auto;
|
35
|
-
padding: var(--padding-default);
|
36
|
-
}
|
37
|
-
|
38
|
-
[danger] {
|
39
|
-
--mdc-theme-primary: var(--mdc-danger-button-primary-color);
|
40
|
-
}
|
41
|
-
mwc-button {
|
42
|
-
margin-left: var(--margin-default);
|
43
|
-
}
|
44
35
|
`
|
45
36
|
]
|
46
37
|
|
@@ -49,9 +40,10 @@ class DataItemList extends localize(i18next)(LitElement) {
|
|
49
40
|
render() {
|
50
41
|
return html`
|
51
42
|
<ox-grist .mode=${isMobileDevice() ? 'LIST' : 'GRID'} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}></ox-grist>
|
43
|
+
|
52
44
|
<div class="button-container">
|
53
|
-
<
|
54
|
-
<
|
45
|
+
<button danger @click=${this._deleteDataItems.bind(this)}><md-icon>delete_forever</md-icon>${i18next.t('button.delete')}</button>
|
46
|
+
<button @click=${this._updateDataItems.bind(this)}><md-icon>save</md-icon>${i18next.t('button.save')}</button>
|
55
47
|
</div>
|
56
48
|
`
|
57
49
|
}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import '@material/web/icon/icon.js'
|
1
2
|
import '@operato/data-grist'
|
2
3
|
|
3
4
|
import gql from 'graphql-tag'
|
@@ -8,10 +9,11 @@ import { client } from '@operato/graphql'
|
|
8
9
|
import { i18next } from '@operato/i18n'
|
9
10
|
import { isMobileDevice } from '@operato/utils'
|
10
11
|
import { DataSet } from '@operato/dataset'
|
11
|
-
|
12
|
+
import { ButtonContainerStyles } from '@operato/styles'
|
12
13
|
@customElement('data-set-importer')
|
13
14
|
export class DataSetImporter extends LitElement {
|
14
15
|
static styles = [
|
16
|
+
ButtonContainerStyles,
|
15
17
|
css`
|
16
18
|
:host {
|
17
19
|
display: flex;
|
@@ -23,16 +25,6 @@ export class DataSetImporter extends LitElement {
|
|
23
25
|
ox-grist {
|
24
26
|
flex: 1;
|
25
27
|
}
|
26
|
-
|
27
|
-
.button-container {
|
28
|
-
display: flex;
|
29
|
-
margin-left: auto;
|
30
|
-
padding: var(--padding-default);
|
31
|
-
}
|
32
|
-
|
33
|
-
mwc-button {
|
34
|
-
margin-left: var(--margin-default);
|
35
|
-
}
|
36
28
|
`
|
37
29
|
]
|
38
30
|
|
@@ -65,14 +57,10 @@ export class DataSetImporter extends LitElement {
|
|
65
57
|
|
66
58
|
render() {
|
67
59
|
return html`
|
68
|
-
<ox-grist
|
69
|
-
.mode=${isMobileDevice() ? 'LIST' : 'GRID'}
|
70
|
-
.config=${this.columns}
|
71
|
-
.data=${{ records: this.dataSets }}
|
72
|
-
></ox-grist>
|
60
|
+
<ox-grist .mode=${isMobileDevice() ? 'LIST' : 'GRID'} .config=${this.columns} .data=${{ records: this.dataSets }}></ox-grist>
|
73
61
|
|
74
62
|
<div class="button-container">
|
75
|
-
<
|
63
|
+
<button @click=${this.save.bind(this)}><md-icon>save</md-icon>${i18next.t('button.save')}</button>
|
76
64
|
</div>
|
77
65
|
`
|
78
66
|
}
|
@@ -152,10 +152,7 @@ export class DataSetListPage extends connect(store)(localize(i18next)(PageView))
|
|
152
152
|
return html`
|
153
153
|
<ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)} ?url-params-sensitive=${this.active}>
|
154
154
|
<div slot="headroom" class="header">
|
155
|
-
<div class="title">
|
156
|
-
<md-icon>apps</md-icon>
|
157
|
-
${i18next.t('title.data-set list')}
|
158
|
-
</div>
|
155
|
+
<div class="title">${i18next.t('title.data-set list')}</div>
|
159
156
|
|
160
157
|
<div class="filters">
|
161
158
|
<ox-filters-form autofocus without-search></ox-filters-form>
|
@@ -70,10 +70,7 @@ export class DataSummaryListPage extends connect(store)(localize(i18next)(PageVi
|
|
70
70
|
return html`
|
71
71
|
<ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)} ?url-params-sensitive=${false /* this.active */}>
|
72
72
|
<div slot="headroom" class="header">
|
73
|
-
<div class="title">
|
74
|
-
<md-icon>apps</md-icon>
|
75
|
-
${i18next.t('title.data-summary list')}
|
76
|
-
</div>
|
73
|
+
<div class="title">${i18next.t('title.data-summary list')}</div>
|
77
74
|
|
78
75
|
<div class="filters">
|
79
76
|
<ox-filters-form autofocus without-search></ox-filters-form>
|
@@ -84,10 +84,7 @@ export class DataSummaryGroupPage extends connect(store)(localize(i18next)(PageV
|
|
84
84
|
return html`
|
85
85
|
<ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
|
86
86
|
<div slot="headroom" class="header">
|
87
|
-
<div class="title">
|
88
|
-
<md-icon>apps</md-icon>
|
89
|
-
${i18next.t('title.data-summary period')}
|
90
|
-
</div>
|
87
|
+
<div class="title">${i18next.t('title.data-summary period')}</div>
|
91
88
|
|
92
89
|
<div
|
93
90
|
class="filters"
|
@@ -87,10 +87,7 @@ export class DataSummarySearchPage extends connect(store)(localize(i18next)(Page
|
|
87
87
|
return html`
|
88
88
|
<ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
|
89
89
|
<div slot="headroom" class="header">
|
90
|
-
<div class="title">
|
91
|
-
<md-icon>apps</md-icon>
|
92
|
-
${i18next.t('title.data-summary search')}
|
93
|
-
</div>
|
90
|
+
<div class="title">${i18next.t('title.data-summary search')}</div>
|
94
91
|
|
95
92
|
<div class="filters">
|
96
93
|
<ox-filters-form autofocus without-search></ox-filters-form>
|
@@ -1,21 +1,21 @@
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
2
|
+
import '@material/web/icon/icon.js';
|
2
3
|
import '@operato/dataset/ox-data-entry-form.js';
|
3
4
|
import gql from 'graphql-tag';
|
4
5
|
import { css, html, LitElement } from 'lit';
|
5
6
|
import { customElement, property, query, state } from 'lit/decorators.js';
|
6
7
|
import { client } from '@operato/graphql';
|
7
8
|
import { i18next, localize } from '@operato/i18n';
|
8
|
-
import { ScrollbarStyles } from '@operato/styles';
|
9
|
+
import { ButtonContainerStyles, ScrollbarStyles } from '@operato/styles';
|
9
10
|
import { OxDataEntryForm } from '@operato/dataset/ox-data-entry-form.js';
|
10
11
|
let DataEntryForm = class DataEntryForm extends localize(i18next)(LitElement) {
|
11
12
|
render() {
|
12
13
|
return html `
|
13
14
|
<ox-data-entry-form .dataSet=${this.dataSet}></ox-data-entry-form>
|
15
|
+
|
14
16
|
<div class="button-container">
|
15
17
|
${!this.dataSample
|
16
|
-
? html `
|
17
|
-
<mwc-button raised @click=${this.updateDataItems.bind(this)}>${i18next.t('button.save')}</mwc-button>
|
18
|
-
`
|
18
|
+
? html ` <button @click=${this.updateDataItems.bind(this)}><md-icon>save</md-icon>${i18next.t('button.save')}</button> `
|
19
19
|
: html ` <span>${i18next.t('field.collected-at')}: ${this.dataSample.collectedAt.toLocaleString()}</span> `}
|
20
20
|
</div>
|
21
21
|
`;
|
@@ -60,6 +60,7 @@ let DataEntryForm = class DataEntryForm extends localize(i18next)(LitElement) {
|
|
60
60
|
}
|
61
61
|
};
|
62
62
|
DataEntryForm.styles = [
|
63
|
+
ButtonContainerStyles,
|
63
64
|
ScrollbarStyles,
|
64
65
|
css `
|
65
66
|
:host {
|
@@ -75,12 +76,6 @@ DataEntryForm.styles = [
|
|
75
76
|
overflow: auto;
|
76
77
|
}
|
77
78
|
|
78
|
-
.button-container {
|
79
|
-
display: flex;
|
80
|
-
margin-left: auto;
|
81
|
-
padding: var(--padding-default);
|
82
|
-
}
|
83
|
-
|
84
79
|
.button-container span {
|
85
80
|
font-size: 14px;
|
86
81
|
color: #333;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"data-entry-form.js","sourceRoot":"","sources":["../../client/components/data-entry-form.ts"],"names":[],"mappings":";AAAA,OAAO,wCAAwC,CAAA;AAE/C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEzE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;
|
1
|
+
{"version":3,"file":"data-entry-form.js","sourceRoot":"","sources":["../../client/components/data-entry-form.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,wCAAwC,CAAA;AAE/C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEzE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AAIjE,IAAM,aAAa,GAAnB,MAAM,aAAc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CAAA;YAED,QAAQ,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,uCAAuC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;SAC/H;IACH,CAAC;;AArFM,oBAAM,GAAG;IACd,qBAAqB;IACrB,eAAe;IACf,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;KAoBF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CAAmC;AAE9D;IAAC,KAAK,EAAE;;iDAA+C;AAEvD;IAAC,KAAK,CAAC,oBAAoB,CAAC;8BAAa,eAAe;gDAAA;AA/B7C,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CAuFzB;SAvFY,aAAa","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@operato/dataset/ox-data-entry-form.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { ButtonContainerStyles, ScrollbarStyles } from '@operato/styles'\nimport { OxDataEntryForm } from '@operato/dataset/ox-data-entry-form.js'\nimport { DataSet } from '@operato/dataset'\n\n@customElement('data-entry-form')\nexport class DataEntryForm extends localize(i18next)(LitElement) {\n static styles = [\n ButtonContainerStyles,\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: #fff;\n }\n\n ox-data-entry-form {\n flex: 1;\n padding: 10px;\n overflow: auto;\n }\n\n .button-container span {\n font-size: 14px;\n color: #333;\n line-height: 1.5;\n padding: 10px;\n }\n `\n ]\n\n @property({ type: Object }) dataSet?: DataSet & { id: string }\n\n @state() dataSample?: { id: string; collectedAt: Date }\n\n @query('ox-data-entry-form') entryForm!: OxDataEntryForm\n\n render() {\n return html`\n <ox-data-entry-form .dataSet=${this.dataSet}></ox-data-entry-form>\n\n <div class=\"button-container\">\n ${!this.dataSample\n ? html` <button @click=${this.updateDataItems.bind(this)}><md-icon>save</md-icon>${i18next.t('button.save')}</button> `\n : html` <span>${i18next.t('field.collected-at')}: ${this.dataSample.collectedAt.toLocaleString()}</span> `}\n </div>\n `\n }\n\n private async updateDataItems() {\n //@ts-ignore TODO replace with following line and confirm\n const data = this.entryForm.buildValue()\n\n const dataSample = {\n dataSet: {\n id: this.dataSet?.id\n },\n data\n } as any\n\n if (this.dataSample?.collectedAt) {\n dataSample.collectedAt = this.dataSample.collectedAt\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($dataSample: NewDataSample!) {\n createDataSample(dataSample: $dataSample) {\n id\n collectedAt\n }\n }\n `,\n variables: {\n dataSample\n },\n context: {\n hasUpload: true\n }\n })\n\n if (!response.errors) {\n const { id, collectedAt } = response.data.createDataSample\n this.dataSample = {\n id,\n collectedAt: new Date(collectedAt)\n }\n\n document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.data sample created successfully') } }))\n }\n }\n}\n"]}
|
@@ -54,10 +54,7 @@ let DataArchiveListPage = class DataArchiveListPage extends connect(store)(local
|
|
54
54
|
return html `
|
55
55
|
<ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)} ?url-params-sensitive=${false /* this.active */}>
|
56
56
|
<div slot="headroom" class="header">
|
57
|
-
<div class="title">
|
58
|
-
<md-icon>apps</md-icon>
|
59
|
-
${i18next.t('title.data-archive list')}
|
60
|
-
</div>
|
57
|
+
<div class="title">${i18next.t('title.data-archive list')}</div>
|
61
58
|
|
62
59
|
<!-- <div class="filters">
|
63
60
|
<ox-filters-form class="filter" autofocus without-search></ox-filters-form>
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"data-archive-list-page.js","sourceRoot":"","sources":["../../../client/pages/data-archive/data-archive-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CA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AAI,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAA;gBAChE,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,CAAA;gBACjH,OAAO,MAAM,CAAA;YACf,CAAC,EAAE,EAAE,CAAC,EACT;QACH,CAAC,CAAC,CAAA;QAEF,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;IAC9C,CAAC;;AArPM,0BAAM,GAAG;IACd,eAAe;IACf,kBAAkB;IAClB,GAAG,CAAA;;;;;;;;;;;;KAYF;CACF,CAAA;AAED;IAAC,KAAK,EAAE;;wDAAiB;AACzB;IAAC,KAAK,EAAE;;iDAAoE;AAE5E;IAAC,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;kDAAA;AAtBjC,mBAAmB;IAD/B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,mBAAmB,CAuP/B;SAvPY,mBAAmB","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@operato/data-grist'\nimport '@operato/context/ox-context-page-toolbar.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin'\n\nimport { DataGrist, FetchOption, GristRecord } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { PopupHandle, openPopup } from '@operato/layout'\nimport { PageView, store } from '@operato/shell'\nimport { CommonButtonStyles, CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\n\nimport './data-archive-request-popup'\n\n@customElement('data-archive-list-page')\nexport class DataArchiveListPage extends connect(store)(localize(i18next)(PageView)) {\n static styles = [\n ScrollbarStyles,\n CommonHeaderStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n overflow: hidden;\n }\n\n ox-grist {\n overflow-y: auto;\n flex: 1;\n }\n `\n ]\n\n @state() gristConfig: any\n @state() mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n\n @query('ox-grist') private grist!: DataGrist\n\n private popup?: PopupHandle\n\n get context() {\n return {\n title: i18next.t('title.data-archive 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: 'dataset/data-archive',\n actions: [\n {\n title: i18next.t('button.request-archive'),\n action: this.openArchivePopup.bind(this),\n icon: 'archive'\n }\n ],\n exportable: {\n name: i18next.t('title.data-archive list'),\n data: this._exportableData.bind(this)\n },\n toolbar: false\n }\n }\n\n render() {\n const mode = this.mode || (isMobileDevice() ? 'LIST' : 'GRID')\n\n return html`\n <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)} ?url-params-sensitive=${false /* this.active */}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"title\">\n <md-icon>apps</md-icon>\n ${i18next.t('title.data-archive list')}\n </div>\n\n <!-- <div class=\"filters\">\n <ox-filters-form class=\"filter\" autofocus without-search></ox-filters-form>\n </div> -->\n\n <ox-context-page-toolbar class=\"actions\" .context=${this.context}></ox-context-page-toolbar>\n </div>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle) {\n this.gristConfig = {\n list: { fields: ['updater', 'updatedAt'] },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n // { type: 'gutter', gutterName: 'row-selector', multiple: true },\n {\n type: 'resource-object',\n name: 'creator',\n header: i18next.t('field.creator'),\n sortable: true,\n width: 120,\n imex: true\n },\n {\n type: 'datetime',\n name: 'createdAt',\n header: i18next.t('field.created_at'),\n sortable: true,\n width: 180,\n imex: true\n },\n {\n type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n sortable: true,\n width: 180,\n imex: true\n },\n {\n type: 'json5',\n name: 'requestParams',\n header: i18next.t('field.request-params'),\n record: {\n editable: false\n },\n width: 200,\n imex: true\n },\n {\n type: 'string',\n name: 'downloadUrl',\n label: true,\n header: i18next.t('field.download-url'),\n record: {\n editable: false\n },\n width: 240,\n imex: true\n },\n {\n type: 'string',\n name: 'status',\n label: true,\n header: i18next.t('field.status'),\n record: {\n editable: false\n },\n sortable: true,\n width: 120,\n imex: true\n }\n ],\n rows: {\n appendable: false,\n selectable: {\n multiple: true\n }\n },\n sorters: [\n {\n name: 'createdAt',\n desc: true\n }\n ]\n }\n }\n\n closePopupAndRefesh() {\n this.popup?.close()\n this.grist.fetch()\n }\n\n async openArchivePopup() {\n this.popup = openPopup(\n html` <data-archive-request-popup @requested=${this.closePopupAndRefesh.bind(this)} @created=${this.closePopupAndRefesh.bind(this)}></data-archive-request-popup>`,\n {\n backdrop: true,\n size: 'small',\n title: i18next.t('title.data-archive request popup')\n }\n )\n }\n\n async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n responses: dataArchives(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n type\n requestParams\n downloadUrl\n status\n creator {\n id\n name\n }\n updater {\n id\n name\n }\n updatedAt\n createdAt\n }\n total\n }\n }\n `,\n variables: {\n filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return {\n total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n\n _exportableData() {\n let records = [] as GristRecord[]\n if (this.grist.selected && this.grist.selected.length > 0) {\n records = this.grist.selected\n } else {\n records = this.grist.data.records\n }\n\n var headerSetting = this.grist.compiledConfig.columns\n .filter(column => column.type !== 'gutter' && column.record !== undefined && column.imex !== undefined)\n .map(column => {\n return column.imex === true\n ? {\n header: column.header.renderer(column),\n key: column.name,\n width: column.width,\n type: column.type\n }\n : column.imex\n })\n\n var data = records.map(item => {\n return {\n id: item.id,\n ...this.gristConfig.columns\n .filter(column => column.type !== 'gutter' && column.record !== undefined && column.imex !== undefined)\n .reduce((record, column) => {\n const key = column.imex === true ? column.name : column.imex.key\n record[key] = key.split('.').reduce((obj, key) => (obj && obj[key] !== 'undefined' ? obj[key] : undefined), item)\n return record\n }, {})\n }\n })\n\n return { header: headerSetting, data: data }\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"data-archive-list-page.js","sourceRoot":"","sources":["../../../client/pages/data-archive/data-archive-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,qBAAqB,CAAA;AAC5B,OAAO,6CAA6C,CAAA;AAEpD,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAY,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AAEnD,OAAO,EAAE,SAAS,EAA4B,MAAM,qBAAqB,CAAA;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAe,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAsB,kBAAkB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACzF,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,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DAAiB;AACzB;IAAC,KAAK,EAAE;;iDAAoE;AAE5E;IAAC,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;kDAAA;AAtBjC,mBAAmB;IAD/B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,mBAAmB,CAoP/B;SApPY,mBAAmB","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@operato/data-grist'\nimport '@operato/context/ox-context-page-toolbar.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin'\n\nimport { DataGrist, FetchOption, GristRecord } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { PopupHandle, openPopup } from '@operato/layout'\nimport { PageView, store } from '@operato/shell'\nimport { CommonButtonStyles, CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\n\nimport './data-archive-request-popup'\n\n@customElement('data-archive-list-page')\nexport class DataArchiveListPage extends connect(store)(localize(i18next)(PageView)) {\n static styles = [\n ScrollbarStyles,\n CommonHeaderStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n overflow: hidden;\n }\n\n ox-grist {\n overflow-y: auto;\n flex: 1;\n }\n `\n ]\n\n @state() gristConfig: any\n @state() mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n\n @query('ox-grist') private grist!: DataGrist\n\n private popup?: PopupHandle\n\n get context() {\n return {\n title: i18next.t('title.data-archive 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: 'dataset/data-archive',\n actions: [\n {\n title: i18next.t('button.request-archive'),\n action: this.openArchivePopup.bind(this),\n icon: 'archive'\n }\n ],\n exportable: {\n name: i18next.t('title.data-archive list'),\n data: this._exportableData.bind(this)\n },\n toolbar: false\n }\n }\n\n render() {\n const mode = this.mode || (isMobileDevice() ? 'LIST' : 'GRID')\n\n return html`\n <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)} ?url-params-sensitive=${false /* this.active */}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"title\">${i18next.t('title.data-archive list')}</div>\n\n <!-- <div class=\"filters\">\n <ox-filters-form class=\"filter\" autofocus without-search></ox-filters-form>\n </div> -->\n\n <ox-context-page-toolbar class=\"actions\" .context=${this.context}></ox-context-page-toolbar>\n </div>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle) {\n this.gristConfig = {\n list: { fields: ['updater', 'updatedAt'] },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n // { type: 'gutter', gutterName: 'row-selector', multiple: true },\n {\n type: 'resource-object',\n name: 'creator',\n header: i18next.t('field.creator'),\n sortable: true,\n width: 120,\n imex: true\n },\n {\n type: 'datetime',\n name: 'createdAt',\n header: i18next.t('field.created_at'),\n sortable: true,\n width: 180,\n imex: true\n },\n {\n type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n sortable: true,\n width: 180,\n imex: true\n },\n {\n type: 'json5',\n name: 'requestParams',\n header: i18next.t('field.request-params'),\n record: {\n editable: false\n },\n width: 200,\n imex: true\n },\n {\n type: 'string',\n name: 'downloadUrl',\n label: true,\n header: i18next.t('field.download-url'),\n record: {\n editable: false\n },\n width: 240,\n imex: true\n },\n {\n type: 'string',\n name: 'status',\n label: true,\n header: i18next.t('field.status'),\n record: {\n editable: false\n },\n sortable: true,\n width: 120,\n imex: true\n }\n ],\n rows: {\n appendable: false,\n selectable: {\n multiple: true\n }\n },\n sorters: [\n {\n name: 'createdAt',\n desc: true\n }\n ]\n }\n }\n\n closePopupAndRefesh() {\n this.popup?.close()\n this.grist.fetch()\n }\n\n async openArchivePopup() {\n this.popup = openPopup(\n html` <data-archive-request-popup @requested=${this.closePopupAndRefesh.bind(this)} @created=${this.closePopupAndRefesh.bind(this)}></data-archive-request-popup>`,\n {\n backdrop: true,\n size: 'small',\n title: i18next.t('title.data-archive request popup')\n }\n )\n }\n\n async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n responses: dataArchives(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n type\n requestParams\n downloadUrl\n status\n creator {\n id\n name\n }\n updater {\n id\n name\n }\n updatedAt\n createdAt\n }\n total\n }\n }\n `,\n variables: {\n filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return {\n total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n\n _exportableData() {\n let records = [] as GristRecord[]\n if (this.grist.selected && this.grist.selected.length > 0) {\n records = this.grist.selected\n } else {\n records = this.grist.data.records\n }\n\n var headerSetting = this.grist.compiledConfig.columns\n .filter(column => column.type !== 'gutter' && column.record !== undefined && column.imex !== undefined)\n .map(column => {\n return column.imex === true\n ? {\n header: column.header.renderer(column),\n key: column.name,\n width: column.width,\n type: column.type\n }\n : column.imex\n })\n\n var data = records.map(item => {\n return {\n id: item.id,\n ...this.gristConfig.columns\n .filter(column => column.type !== 'gutter' && column.record !== undefined && column.imex !== undefined)\n .reduce((record, column) => {\n const key = column.imex === true ? column.name : column.imex.key\n record[key] = key.split('.').reduce((obj, key) => (obj && obj[key] !== 'undefined' ? obj[key] : undefined), item)\n return record\n }, {})\n }\n })\n\n return { header: headerSetting, data: data }\n }\n}\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
import '@material/web/icon/icon.js';
|