@things-factory/board-ui 8.0.0-beta.9 → 8.0.2
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/apptools/favorite-tool.ts +124 -0
- package/client/board-list/board-tile-list.ts +272 -0
- package/client/board-list/group-bar-styles.ts +63 -0
- package/client/board-list/group-bar.ts +99 -0
- package/client/board-list/play-group-bar.ts +88 -0
- package/client/board-provider.ts +92 -0
- package/client/bootstrap.ts +39 -0
- package/client/data-grist/board-editor.ts +113 -0
- package/client/data-grist/board-renderer.ts +134 -0
- package/client/data-grist/color-map-editor.ts +17 -0
- package/client/data-grist/color-ranges-editor.ts +17 -0
- package/client/graphql/board-template.ts +141 -0
- package/client/graphql/board.ts +273 -0
- package/client/graphql/favorite-board.ts +25 -0
- package/client/graphql/group.ts +138 -0
- package/client/graphql/index.ts +6 -0
- package/client/graphql/my-board.ts +25 -0
- package/client/graphql/play-group.ts +189 -0
- package/client/index.ts +10 -0
- package/client/pages/attachment-list-page.ts +142 -0
- package/client/pages/board-list-page.ts +603 -0
- package/client/pages/board-modeller-page.ts +288 -0
- package/client/pages/board-player-by-name-page.ts +29 -0
- package/client/pages/board-player-page.ts +241 -0
- package/client/pages/board-template/board-template-list-page.ts +248 -0
- package/client/pages/board-viewer-by-name-page.ts +24 -0
- package/client/pages/board-viewer-page.ts +271 -0
- package/client/pages/font-list-page.ts +31 -0
- package/client/pages/play-list-page.ts +400 -0
- package/client/pages/printable-board-viewer-page.ts +54 -0
- package/client/pages/theme/theme-editors.ts +56 -0
- package/client/pages/theme/theme-list-page.ts +313 -0
- package/client/pages/things-scene-components-with-tools.import +0 -0
- package/client/pages/things-scene-components.import +0 -0
- package/client/route.ts +51 -0
- package/client/setting-let/board-view-setting-let.ts +68 -0
- package/client/themes/board-theme.css +77 -0
- package/client/things-scene-import.d.ts +4 -0
- package/client/viewparts/board-basic-info.ts +646 -0
- package/client/viewparts/board-info-link.ts +56 -0
- package/client/viewparts/board-info.ts +85 -0
- package/client/viewparts/board-template-builder.ts +134 -0
- package/client/viewparts/board-versions.ts +172 -0
- package/client/viewparts/group-info-basic.ts +267 -0
- package/client/viewparts/group-info-import.ts +132 -0
- package/client/viewparts/group-info.ts +87 -0
- package/client/viewparts/index.ts +3 -0
- package/client/viewparts/link-builder.ts +210 -0
- package/client/viewparts/play-group-info-basic.ts +268 -0
- package/client/viewparts/play-group-info-link.ts +46 -0
- package/client/viewparts/play-group-info.ts +81 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +19 -19
- package/server/index.ts +0 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import gql from 'graphql-tag'
|
|
2
|
+
|
|
3
|
+
import { create, error, ReferenceMap, Scene } from '@hatiolab/things-scene'
|
|
4
|
+
import { BoardDataStorage } from '@operato/board'
|
|
5
|
+
import { client, gqlContext, subscribe } from '@operato/graphql'
|
|
6
|
+
|
|
7
|
+
export function createBoardProvider() {
|
|
8
|
+
var _provider = new ReferenceMap<Scene>(
|
|
9
|
+
async (boardId, resolve, reject): Promise<any> => {
|
|
10
|
+
try {
|
|
11
|
+
const response = await client.query({
|
|
12
|
+
query: gql`
|
|
13
|
+
query FetchBoardById($id: String!) {
|
|
14
|
+
board(id: $id) {
|
|
15
|
+
model
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
`,
|
|
19
|
+
variables: { id: boardId },
|
|
20
|
+
context: gqlContext()
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
const board = response.data?.board
|
|
24
|
+
|
|
25
|
+
if (!board) {
|
|
26
|
+
reject(new Error('Failed to get the requested board.'))
|
|
27
|
+
return
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
var model = JSON.parse(board.model)
|
|
31
|
+
|
|
32
|
+
var scene: Scene
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
scene = await provider.get(boardId)
|
|
36
|
+
console.warn('Board fetched more than twice.', boardId)
|
|
37
|
+
} catch (e) {
|
|
38
|
+
scene = create({
|
|
39
|
+
model,
|
|
40
|
+
mode: 0,
|
|
41
|
+
refProvider: provider as any,
|
|
42
|
+
dataStorage: new BoardDataStorage(boardId),
|
|
43
|
+
dataSubscriptionProvider: {
|
|
44
|
+
subscribe: async (tag, component) => {
|
|
45
|
+
return await subscribe(
|
|
46
|
+
{
|
|
47
|
+
query: gql`
|
|
48
|
+
subscription {
|
|
49
|
+
data(tag: "${tag}") {
|
|
50
|
+
tag
|
|
51
|
+
data
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
`
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
next: async ({ data }) => {
|
|
58
|
+
if (data) {
|
|
59
|
+
component.data = data.data.data
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
dispose() {}
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
// s.app.baseUrl = undefined;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
resolve(scene)
|
|
74
|
+
|
|
75
|
+
// resolve(scene, {
|
|
76
|
+
// ...board,
|
|
77
|
+
// model
|
|
78
|
+
// })
|
|
79
|
+
} catch (e) {
|
|
80
|
+
error(e)
|
|
81
|
+
reject(e)
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
async (id, ref) => {
|
|
85
|
+
ref.dispose()
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
return _provider
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export const provider = createBoardProvider()
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import '@operato/board/ox-property-editor-board-selector.js'
|
|
2
|
+
|
|
3
|
+
import { OxPropertyEditor } from '@operato/property-editor'
|
|
4
|
+
import { OxGristRendererJson5, registerEditor, registerRenderer } from '@operato/data-grist'
|
|
5
|
+
import { appendViewpart, VIEWPART_POSITION } from '@operato/layout'
|
|
6
|
+
import { OxGristEditorHashtags } from '@operato/grist-editor/ox-grist-editor-hashtags.js'
|
|
7
|
+
import { OxGristRendererHashtags } from '@operato/grist-editor/ox-grist-renderer-hashtags.js'
|
|
8
|
+
|
|
9
|
+
import { BoardEditor } from './data-grist/board-editor'
|
|
10
|
+
import { BoardRenderer } from './data-grist/board-renderer'
|
|
11
|
+
import { ColorMapEditor } from './data-grist/color-map-editor'
|
|
12
|
+
import { ColorRangesEditor } from './data-grist/color-ranges-editor'
|
|
13
|
+
|
|
14
|
+
export default function bootstrap() {
|
|
15
|
+
registerRenderer('board', BoardRenderer)
|
|
16
|
+
registerRenderer('color-map', OxGristRendererJson5)
|
|
17
|
+
registerRenderer('color-ranges', OxGristRendererJson5)
|
|
18
|
+
registerRenderer('hashtags', OxGristRendererHashtags)
|
|
19
|
+
|
|
20
|
+
registerEditor('board', BoardEditor)
|
|
21
|
+
registerEditor('color-map', ColorMapEditor)
|
|
22
|
+
registerEditor('color-ranges', ColorRangesEditor)
|
|
23
|
+
registerEditor('hashtags', OxGristEditorHashtags)
|
|
24
|
+
|
|
25
|
+
OxPropertyEditor.register({
|
|
26
|
+
'board-selector': 'ox-property-editor-board-selector'
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
/* append viewpart anchor to asidebar */
|
|
30
|
+
appendViewpart({
|
|
31
|
+
name: 'viewpart-info',
|
|
32
|
+
viewpart: {
|
|
33
|
+
show: false,
|
|
34
|
+
hovering: 'edge',
|
|
35
|
+
backdrop: true
|
|
36
|
+
},
|
|
37
|
+
position: VIEWPART_POSITION.ASIDEBAR
|
|
38
|
+
})
|
|
39
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import '@operato/board/ox-board-selector.js'
|
|
2
|
+
import './board-renderer'
|
|
3
|
+
|
|
4
|
+
import { css, html } from 'lit'
|
|
5
|
+
import { customElement, property, query } from 'lit/decorators.js'
|
|
6
|
+
|
|
7
|
+
import { OxGristEditor } from '@operato/data-grist'
|
|
8
|
+
import { i18next } from '@operato/i18n'
|
|
9
|
+
import { openPopup } from '@operato/layout'
|
|
10
|
+
|
|
11
|
+
@customElement('board-editor')
|
|
12
|
+
export class BoardEditor extends OxGristEditor {
|
|
13
|
+
static styles = [
|
|
14
|
+
css`
|
|
15
|
+
:host {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-flow: row nowrap;
|
|
18
|
+
align-items: center;
|
|
19
|
+
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: 100%;
|
|
24
|
+
|
|
25
|
+
border: 0;
|
|
26
|
+
background-color: transparent;
|
|
27
|
+
|
|
28
|
+
font: var(--grist-object-editor-font);
|
|
29
|
+
color: var(--grist-object-editor-color);
|
|
30
|
+
|
|
31
|
+
justify-content: inherit;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
board-renderer {
|
|
35
|
+
display: flex;
|
|
36
|
+
flex: auto;
|
|
37
|
+
|
|
38
|
+
justify-content: inherit;
|
|
39
|
+
}
|
|
40
|
+
`
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
@property({ type: Object }) value: any
|
|
44
|
+
@property({ type: Object }) column: any
|
|
45
|
+
@property({ type: Object }) record: any
|
|
46
|
+
@property({ type: Number }) row?: number
|
|
47
|
+
|
|
48
|
+
popup
|
|
49
|
+
|
|
50
|
+
render() {
|
|
51
|
+
var { boardViewerPage } = this.column.record.options || {}
|
|
52
|
+
return html` <board-renderer .value=${this.value} .boardViewerPage=${boardViewerPage}></board-renderer> `
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async firstUpdated() {
|
|
56
|
+
this.value = this.record[this.column.name]
|
|
57
|
+
|
|
58
|
+
await this.updateComplete
|
|
59
|
+
|
|
60
|
+
this.renderRoot.addEventListener('click', e => {
|
|
61
|
+
e.stopPropagation()
|
|
62
|
+
|
|
63
|
+
this.openSelector()
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
this.openSelector()
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
openSelector() {
|
|
70
|
+
if (this.popup) {
|
|
71
|
+
delete this.popup
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/*
|
|
75
|
+
* 기존 설정된 보드가 선택된 상태가 되게 하기 위해서는 selector에 value를 전달해줄 필요가 있음.
|
|
76
|
+
* 주의. value는 object일 수도 있고, string일 수도 있다.
|
|
77
|
+
* string인 경우에는 해당 보드의 id로 해석한다.
|
|
78
|
+
*/
|
|
79
|
+
var value = this.value || {}
|
|
80
|
+
|
|
81
|
+
var template = html`
|
|
82
|
+
<ox-board-selector
|
|
83
|
+
.creatable=${true}
|
|
84
|
+
.value=${this.value}
|
|
85
|
+
@board-selected=${async e => {
|
|
86
|
+
var board = e.detail.board
|
|
87
|
+
|
|
88
|
+
this.dispatchEvent(
|
|
89
|
+
new CustomEvent('field-change', {
|
|
90
|
+
bubbles: true,
|
|
91
|
+
composed: true,
|
|
92
|
+
detail: {
|
|
93
|
+
before: this.value,
|
|
94
|
+
after: this.column.type == 'board' ? board : board.id || '',
|
|
95
|
+
record: this.record,
|
|
96
|
+
column: this.column,
|
|
97
|
+
row: this.row
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
this.popup && this.popup.close()
|
|
103
|
+
}}
|
|
104
|
+
></ox-board-selector>
|
|
105
|
+
`
|
|
106
|
+
|
|
107
|
+
this.popup = openPopup(template, {
|
|
108
|
+
backdrop: true,
|
|
109
|
+
size: 'large',
|
|
110
|
+
title: i18next.t('title.select board')
|
|
111
|
+
})
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import '@material/web/icon/icon.js'
|
|
2
|
+
|
|
3
|
+
import gql from 'graphql-tag'
|
|
4
|
+
import { css, html, LitElement } from 'lit'
|
|
5
|
+
import { customElement, property, query } from 'lit/decorators.js'
|
|
6
|
+
|
|
7
|
+
import { navigate } from '@operato/shell'
|
|
8
|
+
import { client, gqlContext } from '@operato/graphql'
|
|
9
|
+
|
|
10
|
+
const FETCH_BOARD_GQL = id => {
|
|
11
|
+
return gql`
|
|
12
|
+
{
|
|
13
|
+
board(id:"${id}") {
|
|
14
|
+
id
|
|
15
|
+
name
|
|
16
|
+
description
|
|
17
|
+
thumbnail
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
`
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@customElement('board-renderer')
|
|
24
|
+
class BoardRendererElement extends LitElement {
|
|
25
|
+
static styles = [
|
|
26
|
+
css`
|
|
27
|
+
:host {
|
|
28
|
+
display: flex;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
position: relative;
|
|
31
|
+
|
|
32
|
+
max-width: var(--board-renderer-max-width);
|
|
33
|
+
border: var(--board-renderer-border);
|
|
34
|
+
|
|
35
|
+
width: 100%;
|
|
36
|
+
}
|
|
37
|
+
span {
|
|
38
|
+
position: absolute;
|
|
39
|
+
bottom: 0;
|
|
40
|
+
width: 100%;
|
|
41
|
+
text-indent: 5px;
|
|
42
|
+
|
|
43
|
+
font: var(--board-renderer-name-font);
|
|
44
|
+
color: var(--md-sys-color-on-primary);
|
|
45
|
+
background-color: var(--md-sys-color-primary);
|
|
46
|
+
}
|
|
47
|
+
img {
|
|
48
|
+
object-fit: contain;
|
|
49
|
+
max-width: 100%;
|
|
50
|
+
max-height: 100%;
|
|
51
|
+
}
|
|
52
|
+
md-icon {
|
|
53
|
+
position: absolute;
|
|
54
|
+
top: 0;
|
|
55
|
+
text-align: center;
|
|
56
|
+
color: var(--md-sys-color-on-primary);
|
|
57
|
+
background-color: var(--md-sys-color-primary);
|
|
58
|
+
|
|
59
|
+
width: var(--board-renderer-icon-size);
|
|
60
|
+
height: var(--board-renderer-icon-size);
|
|
61
|
+
font: var(--board-renderer-font);
|
|
62
|
+
}
|
|
63
|
+
md-icon[edit] {
|
|
64
|
+
right: 0;
|
|
65
|
+
|
|
66
|
+
border-bottom-left-radius: var(--board-renderer-icon-border-radius);
|
|
67
|
+
}
|
|
68
|
+
md-icon[view] {
|
|
69
|
+
left: 0;
|
|
70
|
+
|
|
71
|
+
border-bottom-right-radius: var(--board-renderer-icon-border-radius);
|
|
72
|
+
}
|
|
73
|
+
`
|
|
74
|
+
]
|
|
75
|
+
|
|
76
|
+
@property({ type: Object }) value: any
|
|
77
|
+
@property({ type: String }) boardViewerPage?: string
|
|
78
|
+
@property({ type: Object }) _value: any
|
|
79
|
+
|
|
80
|
+
async updated(changes) {
|
|
81
|
+
if (changes.has('value')) {
|
|
82
|
+
if (typeof this.value == 'string' && this.value) {
|
|
83
|
+
/* fetchBoard..., */
|
|
84
|
+
try {
|
|
85
|
+
var response = await client.query({
|
|
86
|
+
query: FETCH_BOARD_GQL(this.value),
|
|
87
|
+
context: gqlContext()
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
this._value = (response && response.data && response.data.board) || {}
|
|
91
|
+
} catch (e) {
|
|
92
|
+
console.error(e)
|
|
93
|
+
}
|
|
94
|
+
} else {
|
|
95
|
+
this._value = this.value || {}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
render() {
|
|
101
|
+
var { id, name = '', thumbnail = 'image/gif' } = this._value || {}
|
|
102
|
+
|
|
103
|
+
return id
|
|
104
|
+
? html`
|
|
105
|
+
<span>${name}</span>
|
|
106
|
+
<img src=${thumbnail} alt="no thumbnail!" />
|
|
107
|
+
<md-icon view @mousedown=${e => this.onClickViewer(e, id)}>search</md-icon>
|
|
108
|
+
<md-icon edit @mousedown=${e => this.onClickModeler(e, id)}>edit</md-icon>
|
|
109
|
+
`
|
|
110
|
+
: html` choose board.. `
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
onClickViewer(e, id) {
|
|
114
|
+
e.preventDefault()
|
|
115
|
+
e.stopPropagation()
|
|
116
|
+
|
|
117
|
+
var boardViewerPage = this.boardViewerPage || 'board-viewer'
|
|
118
|
+
|
|
119
|
+
navigate(`${boardViewerPage}/${id}${window.location.search}`)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
onClickModeler(e, id) {
|
|
123
|
+
e.preventDefault()
|
|
124
|
+
e.stopPropagation()
|
|
125
|
+
|
|
126
|
+
navigate(`board-modeller/${id}${window.location.search}`)
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export const BoardRenderer = (value, column, record) => {
|
|
131
|
+
var { boardViewerPage = '' } = column.record.options || {}
|
|
132
|
+
|
|
133
|
+
return html` <board-renderer .value=${value} .boardViewerPage=${boardViewerPage}></board-renderer> `
|
|
134
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { customElement } from 'lit/decorators.js'
|
|
2
|
+
|
|
3
|
+
import { OxGristEditorValueMap } from '@operato/grist-editor/ox-grist-editor-value-map.js'
|
|
4
|
+
|
|
5
|
+
@customElement('color-map-editor')
|
|
6
|
+
export class ColorMapEditor extends OxGristEditorValueMap {
|
|
7
|
+
get options() {
|
|
8
|
+
const overidable = this.column.record?.options || {}
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
name: `Color Map : ${this.record.name}`,
|
|
12
|
+
valuetype: 'color',
|
|
13
|
+
objectified: true,
|
|
14
|
+
...overidable
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { customElement } from 'lit/decorators.js'
|
|
2
|
+
|
|
3
|
+
import { OxGristEditorValueRanges } from '@operato/grist-editor/ox-grist-editor-value-ranges.js'
|
|
4
|
+
|
|
5
|
+
@customElement('color-ranges-editor')
|
|
6
|
+
export class ColorRangesEditor extends OxGristEditorValueRanges {
|
|
7
|
+
get options() {
|
|
8
|
+
const overidable = this.column.record?.options || {}
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
name: `Color Ranges : ${this.record.name}`,
|
|
12
|
+
valuetype: 'color',
|
|
13
|
+
objectified: true,
|
|
14
|
+
...overidable
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import gql from 'graphql-tag'
|
|
2
|
+
|
|
3
|
+
import { client } from '@operato/graphql'
|
|
4
|
+
import { gqlBuilder } from '@things-factory/utils'
|
|
5
|
+
|
|
6
|
+
export async function fetchBoardTemplateList(listParam = {}) {
|
|
7
|
+
const response = await client.query({
|
|
8
|
+
query: gql`
|
|
9
|
+
{
|
|
10
|
+
boardTemplates(${gqlBuilder.buildArgs(listParam)}) {
|
|
11
|
+
items {
|
|
12
|
+
id
|
|
13
|
+
name
|
|
14
|
+
description
|
|
15
|
+
thumbnail
|
|
16
|
+
visibility
|
|
17
|
+
createdAt
|
|
18
|
+
updatedAt
|
|
19
|
+
}
|
|
20
|
+
total
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
`
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
return response.data
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export async function fetchBoardTemplate(id) {
|
|
30
|
+
const response = await client.query({
|
|
31
|
+
query: gql`
|
|
32
|
+
query FetchBoardTemplate($id: String!) {
|
|
33
|
+
boardTemplate(id: $id) {
|
|
34
|
+
id
|
|
35
|
+
name
|
|
36
|
+
description
|
|
37
|
+
thumbnail
|
|
38
|
+
model
|
|
39
|
+
visibility
|
|
40
|
+
createdAt
|
|
41
|
+
creator {
|
|
42
|
+
id
|
|
43
|
+
name
|
|
44
|
+
}
|
|
45
|
+
updatedAt
|
|
46
|
+
updater {
|
|
47
|
+
id
|
|
48
|
+
name
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
`,
|
|
53
|
+
variables: { id }
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
return response.data
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export async function createBoardTemplate(boardTemplate) {
|
|
60
|
+
/*
|
|
61
|
+
input NewBoard {
|
|
62
|
+
name : String!
|
|
63
|
+
description : String
|
|
64
|
+
model : String!
|
|
65
|
+
visibility : String!
|
|
66
|
+
}
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
boardTemplate.model = JSON.stringify(boardTemplate.model)
|
|
70
|
+
|
|
71
|
+
const response = await client.mutate({
|
|
72
|
+
mutation: gql`
|
|
73
|
+
mutation CreateBoardTemplate($boardTemplate: NewBoardTemplate!) {
|
|
74
|
+
createBoardTemplate(boardTemplate: $boardTemplate) {
|
|
75
|
+
id
|
|
76
|
+
name
|
|
77
|
+
description
|
|
78
|
+
model
|
|
79
|
+
visibility
|
|
80
|
+
createdAt
|
|
81
|
+
updatedAt
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
`,
|
|
85
|
+
variables: {
|
|
86
|
+
boardTemplate
|
|
87
|
+
}
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
return response.data
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export async function updateBoardTemplate(boardTemplate) {
|
|
94
|
+
/*
|
|
95
|
+
input BoardPatch {
|
|
96
|
+
name : String
|
|
97
|
+
description : String
|
|
98
|
+
model : String
|
|
99
|
+
visibility : String
|
|
100
|
+
}
|
|
101
|
+
*/
|
|
102
|
+
var { id, name, description, model, visibility } = boardTemplate
|
|
103
|
+
model = JSON.stringify(model)
|
|
104
|
+
|
|
105
|
+
const response = await client.mutate({
|
|
106
|
+
mutation: gql`
|
|
107
|
+
mutation UpdateBoard($id: String!, $patch: BoardTemplatePatch!) {
|
|
108
|
+
updateBoard(id: $id, patch: $patch) {
|
|
109
|
+
id
|
|
110
|
+
name
|
|
111
|
+
description
|
|
112
|
+
model
|
|
113
|
+
visibility
|
|
114
|
+
createdAt
|
|
115
|
+
updatedAt
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
`,
|
|
119
|
+
variables: {
|
|
120
|
+
id,
|
|
121
|
+
patch: { name, description, model, visibility }
|
|
122
|
+
}
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
return response.data
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export async function deleteBoardTemplate(id) {
|
|
129
|
+
const response = await client.mutate({
|
|
130
|
+
mutation: gql`
|
|
131
|
+
mutation ($id: String!) {
|
|
132
|
+
deleteBoardTemplate(id: $id)
|
|
133
|
+
}
|
|
134
|
+
`,
|
|
135
|
+
variables: {
|
|
136
|
+
id
|
|
137
|
+
}
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
return response.data
|
|
141
|
+
}
|