@things-factory/dashboard 7.0.1-alpha.9 → 7.0.1-alpha.92
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/actions/{board-settings.js → board-settings.ts} +3 -2
- package/client/{bootstrap.js → bootstrap.ts} +2 -2
- package/client/{const.js → const.ts} +1 -1
- package/client/index.ts +1 -0
- package/client/pages/{dashboard.js → dashboard.ts} +25 -22
- package/client/tsconfig.json +11 -0
- package/client/viewparts/{dashboard-setting-let.js → dashboard-setting-let.ts} +104 -115
- package/dist-client/actions/board-settings.d.ts +3 -0
- package/dist-client/actions/board-settings.js +29 -0
- package/dist-client/actions/board-settings.js.map +1 -0
- package/dist-client/actions/index.d.ts +1 -0
- package/dist-client/actions/index.js +2 -0
- package/dist-client/actions/index.js.map +1 -0
- package/dist-client/bootstrap.d.ts +2 -0
- package/dist-client/bootstrap.js +31 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/const.d.ts +5 -0
- package/dist-client/const.js +6 -0
- package/dist-client/const.js.map +1 -0
- package/dist-client/index.d.ts +1 -0
- package/dist-client/index.js +2 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/pages/dashboard.d.ts +21 -0
- package/dist-client/pages/dashboard.js +97 -0
- package/dist-client/pages/dashboard.js.map +1 -0
- package/dist-client/reducers/board-settings.d.ts +2 -0
- package/dist-client/reducers/board-settings.js +14 -0
- package/dist-client/reducers/board-settings.js.map +1 -0
- package/dist-client/route.d.ts +1 -0
- package/dist-client/route.js +10 -0
- package/dist-client/route.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-client/viewparts/dashboard-setting-let.d.ts +26 -0
- package/dist-client/viewparts/dashboard-setting-let.js +219 -0
- package/dist-client/viewparts/dashboard-setting-let.js.map +1 -0
- package/dist-server/index.js +0 -1
- package/dist-server/index.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -12
- package/server/index.ts +0 -1
- package/server/tsconfig.json +10 -0
- package/things-factory.config.js +2 -2
- package/client/index.js +0 -1
- package/dist-server/migrations/index.js +0 -12
- package/dist-server/migrations/index.js.map +0 -1
- package/server/migrations/index.ts +0 -9
- package/tsconfig.json +0 -9
- /package/client/actions/{index.js → index.ts} +0 -0
- /package/client/reducers/{board-settings.js → board-settings.ts} +0 -0
- /package/client/{route.js → route.ts} +0 -0
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { client } from '@things-factory/shell'
|
|
2
1
|
import gql from 'graphql-tag'
|
|
3
2
|
|
|
3
|
+
import { client } from '@operato/graphql'
|
|
4
|
+
|
|
4
5
|
export const UPDATE_BOARD_SETTINGS = 'UPDATE_BOARD_SETTINGS'
|
|
5
6
|
export const CLEAR_BOARD_SETTINGS = 'CLEAR_BOARD_SETTINGS'
|
|
6
7
|
|
|
7
8
|
export async function fetchBoardSettings(names) {
|
|
8
9
|
var response = await client.query({
|
|
9
10
|
query: gql`
|
|
10
|
-
query($names: [String!]) {
|
|
11
|
+
query ($names: [String!]) {
|
|
11
12
|
boardSettings(names: $names) {
|
|
12
13
|
name
|
|
13
14
|
value
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { html } from 'lit'
|
|
2
|
-
import { store } from '@
|
|
2
|
+
import { store } from '@operato/shell'
|
|
3
3
|
import { auth, hasPrivilege } from '@things-factory/auth-base/dist-client'
|
|
4
|
-
import { ADD_SETTING } from '@things-factory/setting-base'
|
|
4
|
+
import { ADD_SETTING } from '@things-factory/setting-base/dist-client'
|
|
5
5
|
|
|
6
6
|
import { UPDATE_BOARD_SETTINGS, fetchBoardSettings } from './actions/board-settings'
|
|
7
7
|
import boardSetting from './reducers/board-settings'
|
|
@@ -2,4 +2,4 @@ export const FALLBACK_HOME_BOARD = 'home' /* for backward compatibility */
|
|
|
2
2
|
export const DASHBOARD = 'dashboard'
|
|
3
3
|
export const DASHBOARD_MOBILE = 'dashboard-mobile'
|
|
4
4
|
export const DASHBOARD_DESCRIPTION = 'dashboard'
|
|
5
|
-
export const DASHBOARD_MOBILE_DESCRIPTION = 'dashboard mobile'
|
|
5
|
+
export const DASHBOARD_MOBILE_DESCRIPTION = 'dashboard mobile'
|
package/client/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './actions'
|
|
@@ -2,29 +2,30 @@ import '@operato/board/ox-board-selector.js'
|
|
|
2
2
|
|
|
3
3
|
import gql from 'graphql-tag'
|
|
4
4
|
import { html } from 'lit'
|
|
5
|
+
import { customElement } from 'lit/decorators.js'
|
|
5
6
|
|
|
7
|
+
import { store } from '@operato/shell'
|
|
8
|
+
import { client } from '@operato/graphql'
|
|
9
|
+
import { i18next } from '@operato/i18n'
|
|
6
10
|
import { openPopup } from '@operato/layout'
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { client, store } from '@things-factory/shell'
|
|
10
|
-
import { gqlBuilder, isMobileDevice } from '@things-factory/utils'
|
|
11
|
+
import { isMobileDevice } from '@operato/utils'
|
|
12
|
+
import { BoardViewerPage } from '@things-factory/board-ui/dist-client'
|
|
11
13
|
|
|
12
14
|
import { fetchBoardSettings, UPDATE_BOARD_SETTINGS } from '../actions/board-settings'
|
|
13
15
|
import { DASHBOARD, DASHBOARD_MOBILE, FALLBACK_HOME_BOARD } from '../const'
|
|
14
16
|
|
|
15
17
|
const HOME_DESCRIPTION = 'home dashboard'
|
|
16
18
|
|
|
17
|
-
const FALLBACK_ORDER = isMobileDevice()
|
|
18
|
-
? [DASHBOARD_MOBILE, DASHBOARD, FALLBACK_HOME_BOARD]
|
|
19
|
-
: [DASHBOARD, FALLBACK_HOME_BOARD]
|
|
19
|
+
const FALLBACK_ORDER = isMobileDevice() ? [DASHBOARD_MOBILE, DASHBOARD, FALLBACK_HOME_BOARD] : [DASHBOARD, FALLBACK_HOME_BOARD]
|
|
20
20
|
const HOME_BOARD = isMobileDevice() ? DASHBOARD_MOBILE : DASHBOARD
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
@customElement('dashboard-home')
|
|
23
|
+
export class DashboardHome extends BoardViewerPage {
|
|
23
24
|
stateChanged(state) {
|
|
24
25
|
super.stateChanged(state)
|
|
25
26
|
|
|
26
27
|
const dashboard = state?.boardSetting
|
|
27
|
-
const homeBoard = dashboard && dashboard[FALLBACK_ORDER.find(name => dashboard[name])]
|
|
28
|
+
const homeBoard = dashboard && dashboard[FALLBACK_ORDER.find(name => dashboard[name]) || 'maybe notfound']
|
|
28
29
|
this._boardId = homeBoard?.value
|
|
29
30
|
}
|
|
30
31
|
|
|
@@ -82,26 +83,28 @@ class DashboardHome extends BoardViewerPage {
|
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
async saveSettings({ name, value, category, description }) {
|
|
85
|
-
if (!(name && value))
|
|
86
|
+
if (!(name && value)) {
|
|
87
|
+
return
|
|
88
|
+
}
|
|
86
89
|
|
|
87
90
|
await client.query({
|
|
88
91
|
query: gql`
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
patch: {
|
|
93
|
-
name,
|
|
94
|
-
description,
|
|
95
|
-
category,
|
|
92
|
+
mutation UpdateSetting($patch: SettingPatch!, $name: String!) {
|
|
93
|
+
updateSetting(patch: $patch, name: $name) {
|
|
94
|
+
name
|
|
96
95
|
value
|
|
97
96
|
}
|
|
98
|
-
}
|
|
99
|
-
|
|
97
|
+
}
|
|
98
|
+
`,
|
|
99
|
+
variables: {
|
|
100
|
+
name,
|
|
101
|
+
patch: {
|
|
102
|
+
name,
|
|
103
|
+
description,
|
|
104
|
+
category,
|
|
100
105
|
value
|
|
101
106
|
}
|
|
102
|
-
}
|
|
107
|
+
}
|
|
103
108
|
})
|
|
104
109
|
}
|
|
105
110
|
}
|
|
106
|
-
|
|
107
|
-
customElements.define('dashboard-home', DashboardHome)
|
|
@@ -1,128 +1,118 @@
|
|
|
1
|
+
import '@material/web/icon/icon.js'
|
|
1
2
|
import '@operato/board/ox-board-selector.js'
|
|
2
3
|
import '@operato/i18n/ox-i18n.js'
|
|
3
4
|
|
|
4
5
|
import gql from 'graphql-tag'
|
|
5
6
|
import { css, html, LitElement } from 'lit'
|
|
7
|
+
import { customElement, state } from 'lit/decorators.js'
|
|
6
8
|
import { connect } from 'pwa-helpers'
|
|
7
9
|
|
|
8
10
|
import { openPopup } from '@operato/layout'
|
|
9
|
-
import { i18next, localize } from '@
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
11
|
+
import { i18next, localize } from '@operato/i18n'
|
|
12
|
+
import { store } from '@operato/shell'
|
|
13
|
+
import { client } from '@operato/graphql'
|
|
12
14
|
|
|
13
15
|
import { fetchBoardSettings, UPDATE_BOARD_SETTINGS } from '../actions/board-settings'
|
|
14
|
-
import {
|
|
15
|
-
DASHBOARD,
|
|
16
|
-
DASHBOARD_DESCRIPTION,
|
|
17
|
-
DASHBOARD_MOBILE,
|
|
18
|
-
DASHBOARD_MOBILE_DESCRIPTION,
|
|
19
|
-
FALLBACK_HOME_BOARD
|
|
20
|
-
} from '../const'
|
|
16
|
+
import { DASHBOARD, DASHBOARD_DESCRIPTION, DASHBOARD_MOBILE, DASHBOARD_MOBILE_DESCRIPTION, FALLBACK_HOME_BOARD } from '../const'
|
|
21
17
|
|
|
18
|
+
@customElement('dashboard-setting-let')
|
|
22
19
|
export class DashboardSettingLet extends connect(store)(localize(i18next)(LitElement)) {
|
|
23
|
-
static
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
20
|
+
static styles = [
|
|
21
|
+
css`
|
|
22
|
+
div.field {
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: row;
|
|
25
|
+
align-items: flex-start;
|
|
26
|
+
max-width: 100%;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
}
|
|
33
29
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
div.field > * {
|
|
31
|
+
flex: none;
|
|
32
|
+
}
|
|
37
33
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
div.field > div {
|
|
35
|
+
flex: 1;
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
align-items: flex-start;
|
|
39
|
+
}
|
|
44
40
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
41
|
+
div.field a {
|
|
42
|
+
overflow: hidden;
|
|
43
|
+
border: var(--border-dark-color);
|
|
44
|
+
border-radius: var(--border-radius);
|
|
45
|
+
background-color: rgba(0, 0, 0, 0.1);
|
|
46
|
+
min-width: 50px;
|
|
47
|
+
min-height: 50px;
|
|
48
|
+
}
|
|
53
49
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
50
|
+
div.field img {
|
|
51
|
+
max-height: 250px;
|
|
52
|
+
max-width: 100%;
|
|
53
|
+
}
|
|
58
54
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
.name {
|
|
56
|
+
color: var(--secondary-color, #394e64);
|
|
57
|
+
}
|
|
62
58
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
59
|
+
.description {
|
|
60
|
+
font-size: 0.7rem;
|
|
61
|
+
opacity: 0.7;
|
|
62
|
+
color: var(--secondary-text-color);
|
|
63
|
+
}
|
|
68
64
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
65
|
+
label {
|
|
66
|
+
width: 80px;
|
|
67
|
+
padding-right: var(--padding-default);
|
|
68
|
+
font: bold 0.9em var(--theme-font);
|
|
69
|
+
}
|
|
74
70
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
71
|
+
setting-let > form {
|
|
72
|
+
display: grid;
|
|
73
|
+
grid-template-columns: 1fr 1fr;
|
|
74
|
+
}
|
|
79
75
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
76
|
+
md-icon {
|
|
77
|
+
--md-icon-size: 18px;
|
|
78
|
+
margin: 2px 2px 5px 2px;
|
|
79
|
+
padding: 0 var(--padding-default);
|
|
80
|
+
color: var(--theme-white-color, #fff);
|
|
81
|
+
background-color: var(--secondary-color, #394e64);
|
|
82
|
+
border-radius: var(--border-radius, 5px);
|
|
83
|
+
border: var(--button-border, 1px solid transparent);
|
|
84
|
+
}
|
|
89
85
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
86
|
+
md-icon:hover,
|
|
87
|
+
md-icon:active {
|
|
88
|
+
background-color: var(--button-active-background-color, #22a6a7);
|
|
89
|
+
}
|
|
95
90
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
div.field {
|
|
102
|
-
border-bottom: var(--border-dark-color);
|
|
103
|
-
padding: var(--padding-default);
|
|
104
|
-
}
|
|
105
|
-
mwc-icon {
|
|
106
|
-
padding: var(--padding-narrow) var(--padding-default);
|
|
107
|
-
}
|
|
91
|
+
@media screen and (max-width: 460px) {
|
|
92
|
+
setting-let > form {
|
|
93
|
+
display: flex;
|
|
94
|
+
flex-direction: column;
|
|
108
95
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
96
|
+
div.field {
|
|
97
|
+
border-bottom: var(--border-dark-color);
|
|
98
|
+
padding: var(--padding-default);
|
|
99
|
+
}
|
|
100
|
+
md-icon {
|
|
101
|
+
padding: var(--padding-narrow) var(--padding-default);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
`
|
|
105
|
+
]
|
|
112
106
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
dashboard: Object,
|
|
116
|
-
dashboardMobile: Object
|
|
117
|
-
}
|
|
118
|
-
}
|
|
107
|
+
@state() private dashboard: any
|
|
108
|
+
@state() private dashboardMobile: any
|
|
119
109
|
|
|
120
110
|
render() {
|
|
121
111
|
return html`
|
|
122
112
|
<setting-let>
|
|
123
113
|
<ox-i18n slot="title" msgid="title.dashboard setting"></ox-i18n>
|
|
124
114
|
|
|
125
|
-
<form slot="content"
|
|
115
|
+
<form slot="content">
|
|
126
116
|
${[
|
|
127
117
|
{
|
|
128
118
|
title: i18next.t('label.dashboard for desktop'),
|
|
@@ -143,17 +133,14 @@ export class DashboardSettingLet extends connect(store)(localize(i18next)(LitEle
|
|
|
143
133
|
<div>
|
|
144
134
|
<div class="name">${field.board.name}</div>
|
|
145
135
|
<span class="description">${field.board.description}</span>
|
|
146
|
-
<
|
|
136
|
+
<md-icon @click=${e => this.onClickBoardSelector(field.key, field.description)}>
|
|
147
137
|
more_horiz
|
|
148
|
-
</
|
|
138
|
+
</md-icon>
|
|
149
139
|
${
|
|
150
140
|
field.board.id
|
|
151
141
|
? html`
|
|
152
142
|
<a href=${`board-modeller/${field.board.id}`}>
|
|
153
|
-
<img
|
|
154
|
-
src=${field.board.thumbnail ||
|
|
155
|
-
'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'}
|
|
156
|
-
/>
|
|
143
|
+
<img src=${field.board.thumbnail || 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'} />
|
|
157
144
|
</a>
|
|
158
145
|
`
|
|
159
146
|
: html``
|
|
@@ -167,7 +154,7 @@ export class DashboardSettingLet extends connect(store)(localize(i18next)(LitEle
|
|
|
167
154
|
`
|
|
168
155
|
}
|
|
169
156
|
|
|
170
|
-
stateChanged(state) {
|
|
157
|
+
stateChanged(state: any) {
|
|
171
158
|
var dashboard = state.boardSetting[DASHBOARD] || state.boardSetting[FALLBACK_HOME_BOARD]
|
|
172
159
|
var dashboardMobile = state.boardSetting[DASHBOARD_MOBILE] || dashboard
|
|
173
160
|
|
|
@@ -175,7 +162,7 @@ export class DashboardSettingLet extends connect(store)(localize(i18next)(LitEle
|
|
|
175
162
|
this.dashboardMobile = (dashboardMobile ? dashboardMobile.board : {}) || {}
|
|
176
163
|
}
|
|
177
164
|
|
|
178
|
-
onClickBoardSelector(name, description) {
|
|
165
|
+
onClickBoardSelector(name: string, description: string) {
|
|
179
166
|
var popup = openPopup(
|
|
180
167
|
html`
|
|
181
168
|
<ox-board-selector
|
|
@@ -214,26 +201,28 @@ export class DashboardSettingLet extends connect(store)(localize(i18next)(LitEle
|
|
|
214
201
|
}
|
|
215
202
|
|
|
216
203
|
async saveSettings({ name, value, category, description }) {
|
|
217
|
-
if (!(name && value))
|
|
204
|
+
if (!(name && value)) {
|
|
205
|
+
return
|
|
206
|
+
}
|
|
218
207
|
|
|
219
208
|
await client.query({
|
|
220
209
|
query: gql`
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
patch: {
|
|
225
|
-
name,
|
|
226
|
-
description,
|
|
227
|
-
category,
|
|
210
|
+
mutation UpdateSetting($patch: SettingPatch!, $name: String!) {
|
|
211
|
+
updateSetting(patch: $patch, name: $name) {
|
|
212
|
+
name
|
|
228
213
|
value
|
|
229
214
|
}
|
|
230
|
-
}
|
|
231
|
-
|
|
215
|
+
}
|
|
216
|
+
`,
|
|
217
|
+
variables: {
|
|
218
|
+
name,
|
|
219
|
+
patch: {
|
|
220
|
+
name,
|
|
221
|
+
description,
|
|
222
|
+
category,
|
|
232
223
|
value
|
|
233
224
|
}
|
|
234
|
-
}
|
|
225
|
+
}
|
|
235
226
|
})
|
|
236
227
|
}
|
|
237
228
|
}
|
|
238
|
-
|
|
239
|
-
customElements.define('dashboard-setting-let', DashboardSettingLet)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import gql from 'graphql-tag';
|
|
2
|
+
import { client } from '@operato/graphql';
|
|
3
|
+
export const UPDATE_BOARD_SETTINGS = 'UPDATE_BOARD_SETTINGS';
|
|
4
|
+
export const CLEAR_BOARD_SETTINGS = 'CLEAR_BOARD_SETTINGS';
|
|
5
|
+
export async function fetchBoardSettings(names) {
|
|
6
|
+
var response = await client.query({
|
|
7
|
+
query: gql `
|
|
8
|
+
query ($names: [String!]) {
|
|
9
|
+
boardSettings(names: $names) {
|
|
10
|
+
name
|
|
11
|
+
value
|
|
12
|
+
board {
|
|
13
|
+
id
|
|
14
|
+
name
|
|
15
|
+
description
|
|
16
|
+
thumbnail
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
`,
|
|
21
|
+
variables: {
|
|
22
|
+
names
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
if (!response || !response.data)
|
|
26
|
+
return;
|
|
27
|
+
return response.data.boardSettings;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=board-settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"board-settings.js","sourceRoot":"","sources":["../../client/actions/board-settings.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAEzC,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAuB,CAAA;AAC5D,MAAM,CAAC,MAAM,oBAAoB,GAAG,sBAAsB,CAAA;AAE1D,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,KAAK;IAC5C,IAAI,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;QAChC,KAAK,EAAE,GAAG,CAAA;;;;;;;;;;;;;KAaT;QACD,SAAS,EAAE;YACT,KAAK;SACN;KACF,CAAC,CAAA;IAEF,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,IAAI;QAAE,OAAM;IACvC,OAAO,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAA;AACpC,CAAC","sourcesContent":["import gql from 'graphql-tag'\n\nimport { client } from '@operato/graphql'\n\nexport const UPDATE_BOARD_SETTINGS = 'UPDATE_BOARD_SETTINGS'\nexport const CLEAR_BOARD_SETTINGS = 'CLEAR_BOARD_SETTINGS'\n\nexport async function fetchBoardSettings(names) {\n var response = await client.query({\n query: gql`\n query ($names: [String!]) {\n boardSettings(names: $names) {\n name\n value\n board {\n id\n name\n description\n thumbnail\n }\n }\n }\n `,\n variables: {\n names\n }\n })\n\n if (!response || !response.data) return\n return response.data.boardSettings\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './board-settings';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../client/actions/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA","sourcesContent":["export * from './board-settings'\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { store } from '@operato/shell';
|
|
3
|
+
import { auth, hasPrivilege } from '@things-factory/auth-base/dist-client';
|
|
4
|
+
import { ADD_SETTING } from '@things-factory/setting-base/dist-client';
|
|
5
|
+
import { UPDATE_BOARD_SETTINGS, fetchBoardSettings } from './actions/board-settings';
|
|
6
|
+
import boardSetting from './reducers/board-settings';
|
|
7
|
+
import './viewparts/dashboard-setting-let';
|
|
8
|
+
import { FALLBACK_HOME_BOARD, DASHBOARD, DASHBOARD_MOBILE } from './const';
|
|
9
|
+
export default function bootstrap() {
|
|
10
|
+
store.addReducers({ boardSetting });
|
|
11
|
+
auth.on('profile', async () => {
|
|
12
|
+
var settings = await fetchBoardSettings([FALLBACK_HOME_BOARD, DASHBOARD, DASHBOARD_MOBILE]);
|
|
13
|
+
store.dispatch({
|
|
14
|
+
type: UPDATE_BOARD_SETTINGS,
|
|
15
|
+
settings: settings.reduce((settings, setting) => {
|
|
16
|
+
settings[setting.name] = setting;
|
|
17
|
+
return settings;
|
|
18
|
+
}, {})
|
|
19
|
+
});
|
|
20
|
+
if (await hasPrivilege({ privilege: 'mutation', category: 'setting' })) {
|
|
21
|
+
store.dispatch({
|
|
22
|
+
type: ADD_SETTING,
|
|
23
|
+
setting: {
|
|
24
|
+
seq: 20,
|
|
25
|
+
template: html ` <dashboard-setting-let></dashboard-setting-let> `
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=bootstrap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../client/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAA;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAA;AAEtE,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AACpF,OAAO,YAAY,MAAM,2BAA2B,CAAA;AAEpD,OAAO,mCAAmC,CAAA;AAE1C,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE1E,MAAM,CAAC,OAAO,UAAU,SAAS;IAC/B,KAAK,CAAC,WAAW,CAAC,EAAE,YAAY,EAAE,CAAC,CAAA;IAEnC,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;QAC5B,IAAI,QAAQ,GAAG,MAAM,kBAAkB,CAAC,CAAC,mBAAmB,EAAE,SAAS,EAAE,gBAAgB,CAAC,CAAC,CAAA;QAE3F,KAAK,CAAC,QAAQ,CAAC;YACb,IAAI,EAAE,qBAAqB;YAC3B,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE;gBAC9C,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAA;gBAChC,OAAO,QAAQ,CAAA;YACjB,CAAC,EAAE,EAAE,CAAC;SACP,CAAC,CAAA;QAEF,IAAI,MAAM,YAAY,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE;YACtE,KAAK,CAAC,QAAQ,CAAC;gBACb,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE;oBACP,GAAG,EAAE,EAAE;oBACP,QAAQ,EAAE,IAAI,CAAA,mDAAmD;iBAClE;aACF,CAAC,CAAA;SACH;IACH,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import { html } from 'lit'\nimport { store } from '@operato/shell'\nimport { auth, hasPrivilege } from '@things-factory/auth-base/dist-client'\nimport { ADD_SETTING } from '@things-factory/setting-base/dist-client'\n\nimport { UPDATE_BOARD_SETTINGS, fetchBoardSettings } from './actions/board-settings'\nimport boardSetting from './reducers/board-settings'\n\nimport './viewparts/dashboard-setting-let'\n\nimport { FALLBACK_HOME_BOARD, DASHBOARD, DASHBOARD_MOBILE } from './const'\n\nexport default function bootstrap() {\n store.addReducers({ boardSetting })\n\n auth.on('profile', async () => {\n var settings = await fetchBoardSettings([FALLBACK_HOME_BOARD, DASHBOARD, DASHBOARD_MOBILE])\n\n store.dispatch({\n type: UPDATE_BOARD_SETTINGS,\n settings: settings.reduce((settings, setting) => {\n settings[setting.name] = setting\n return settings\n }, {})\n })\n\n if (await hasPrivilege({ privilege: 'mutation', category: 'setting' })) {\n store.dispatch({\n type: ADD_SETTING,\n setting: {\n seq: 20,\n template: html` <dashboard-setting-let></dashboard-setting-let> `\n }\n })\n }\n })\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const FALLBACK_HOME_BOARD = "home";
|
|
2
|
+
export declare const DASHBOARD = "dashboard";
|
|
3
|
+
export declare const DASHBOARD_MOBILE = "dashboard-mobile";
|
|
4
|
+
export declare const DASHBOARD_DESCRIPTION = "dashboard";
|
|
5
|
+
export declare const DASHBOARD_MOBILE_DESCRIPTION = "dashboard mobile";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const FALLBACK_HOME_BOARD = 'home'; /* for backward compatibility */
|
|
2
|
+
export const DASHBOARD = 'dashboard';
|
|
3
|
+
export const DASHBOARD_MOBILE = 'dashboard-mobile';
|
|
4
|
+
export const DASHBOARD_DESCRIPTION = 'dashboard';
|
|
5
|
+
export const DASHBOARD_MOBILE_DESCRIPTION = 'dashboard mobile';
|
|
6
|
+
//# sourceMappingURL=const.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"const.js","sourceRoot":"","sources":["../client/const.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAA,CAAC,gCAAgC;AAC1E,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAA;AACpC,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,CAAA;AAClD,MAAM,CAAC,MAAM,qBAAqB,GAAG,WAAW,CAAA;AAChD,MAAM,CAAC,MAAM,4BAA4B,GAAG,kBAAkB,CAAA","sourcesContent":["export const FALLBACK_HOME_BOARD = 'home' /* for backward compatibility */\nexport const DASHBOARD = 'dashboard'\nexport const DASHBOARD_MOBILE = 'dashboard-mobile'\nexport const DASHBOARD_DESCRIPTION = 'dashboard'\nexport const DASHBOARD_MOBILE_DESCRIPTION = 'dashboard mobile'\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './actions';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../client/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA","sourcesContent":["export * from './actions'\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import '@operato/board/ox-board-selector.js';
|
|
2
|
+
import { BoardViewerPage } from '@things-factory/board-ui/dist-client';
|
|
3
|
+
export declare class DashboardHome extends BoardViewerPage {
|
|
4
|
+
stateChanged(state: any): void;
|
|
5
|
+
get oopsNote(): {
|
|
6
|
+
icon: string;
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
click: (e: any) => void;
|
|
10
|
+
};
|
|
11
|
+
get context(): {
|
|
12
|
+
title: string;
|
|
13
|
+
};
|
|
14
|
+
onClickDashboardSetting(name: any, description: any): void;
|
|
15
|
+
saveSettings({ name, value, category, description }: {
|
|
16
|
+
name: any;
|
|
17
|
+
value: any;
|
|
18
|
+
category: any;
|
|
19
|
+
description: any;
|
|
20
|
+
}): Promise<void>;
|
|
21
|
+
}
|