@things-factory/integration-ui 6.1.66 → 6.1.69
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/editors/{entity-editor.js → entity-editor.ts} +2 -2
- package/client/editors/{entity-selector.js → entity-selector.ts} +45 -57
- package/client/editors/{property-editor.js → property-editor.ts} +1 -0
- package/client/editors/{things-editor-entity-selector.js → things-editor-entity-selector.ts} +27 -31
- package/client/editors/{things-editor-http-body.js → things-editor-http-body.ts} +43 -48
- package/client/editors/{things-editor-http-headers.js → things-editor-http-headers.ts} +48 -58
- package/client/editors/{things-editor-http-parameters.js → things-editor-http-parameters.ts} +48 -58
- package/client/grist/{connection-selector.js → connection-selector.ts} +2 -2
- package/client/grist/{connector-selector.js → connector-selector.ts} +2 -2
- package/client/grist/{dynamic-selector.js → dynamic-selector.ts} +9 -7
- package/client/grist/{task-type-selector.js → task-type-selector.ts} +4 -2
- package/client/index.ts +2 -0
- package/client/pages/{connection.js → connection.ts} +38 -44
- package/client/pages/{integration-monitor.js → integration-monitor.ts} +54 -56
- package/client/pages/{scenario-detail.js → scenario-detail.ts} +41 -47
- package/client/pages/scenario-importer.ts +107 -0
- package/client/pages/{scenario.js → scenario.ts} +14 -20
- package/client/viewparts/{connections-monitor.js → connections-monitor.ts} +76 -82
- package/client/viewparts/{monitoring-summary.js → monitoring-summary.ts} +55 -61
- package/client/viewparts/{pending-q-monitor.js → pending-q-monitor.ts} +110 -114
- package/client/viewparts/{scenario-instance-log-view.js → scenario-instance-log-view.ts} +31 -35
- package/client/viewparts/{scenario-instance-monitor.js → scenario-instance-monitor.ts} +67 -73
- package/client/viewparts/{scenario-instance-view.js → scenario-instance-view.ts} +100 -104
- package/client/viewparts/{scenario-monitor.js → scenario-monitor.ts} +143 -149
- package/client/viewparts/scenarios-monitor.ts +147 -0
- package/dist-client/bootstrap.d.ts +4 -0
- package/dist-client/bootstrap.js +29 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/editors/entity-editor.d.ts +10 -0
- package/dist-client/editors/entity-editor.js +47 -0
- package/dist-client/editors/entity-editor.js.map +1 -0
- package/dist-client/editors/entity-selector.d.ts +34 -0
- package/dist-client/editors/entity-selector.js +305 -0
- package/dist-client/editors/entity-selector.js.map +1 -0
- package/dist-client/editors/property-editor.d.ts +20 -0
- package/dist-client/editors/property-editor.js +61 -0
- package/dist-client/editors/property-editor.js.map +1 -0
- package/dist-client/editors/things-editor-entity-selector.d.ts +15 -0
- package/dist-client/editors/things-editor-entity-selector.js +87 -0
- package/dist-client/editors/things-editor-entity-selector.js.map +1 -0
- package/dist-client/editors/things-editor-http-body.d.ts +22 -0
- package/dist-client/editors/things-editor-http-body.js +130 -0
- package/dist-client/editors/things-editor-http-body.js.map +1 -0
- package/dist-client/editors/things-editor-http-headers.d.ts +29 -0
- package/dist-client/editors/things-editor-http-headers.js +160 -0
- package/dist-client/editors/things-editor-http-headers.js.map +1 -0
- package/dist-client/editors/things-editor-http-parameters.d.ts +29 -0
- package/dist-client/editors/things-editor-http-parameters.js +160 -0
- package/dist-client/editors/things-editor-http-parameters.js.map +1 -0
- package/dist-client/grist/connection-selector.d.ts +5 -0
- package/dist-client/grist/connection-selector.js +31 -0
- package/dist-client/grist/connection-selector.js.map +1 -0
- package/dist-client/grist/connector-selector.d.ts +5 -0
- package/dist-client/grist/connector-selector.js +31 -0
- package/dist-client/grist/connector-selector.js.map +1 -0
- package/dist-client/grist/dynamic-selector.d.ts +8 -0
- package/dist-client/grist/dynamic-selector.js +33 -0
- package/dist-client/grist/dynamic-selector.js.map +1 -0
- package/dist-client/grist/task-type-selector.d.ts +7 -0
- package/dist-client/grist/task-type-selector.js +58 -0
- package/dist-client/grist/task-type-selector.js.map +1 -0
- package/dist-client/index.d.ts +2 -0
- package/dist-client/index.js +3 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/pages/connection.d.ts +53 -0
- package/dist-client/pages/connection.js +428 -0
- package/dist-client/pages/connection.js.map +1 -0
- package/dist-client/pages/integration-monitor.d.ts +28 -0
- package/dist-client/pages/integration-monitor.js +340 -0
- package/dist-client/pages/integration-monitor.js.map +1 -0
- package/dist-client/pages/scenario-detail.d.ts +1 -0
- package/dist-client/pages/scenario-detail.js +303 -0
- package/dist-client/pages/scenario-detail.js.map +1 -0
- package/dist-client/pages/scenario-importer.d.ts +9 -0
- package/dist-client/pages/scenario-importer.js +116 -0
- package/dist-client/pages/scenario-importer.js.map +1 -0
- package/dist-client/pages/scenario.d.ts +68 -0
- package/dist-client/pages/scenario.js +581 -0
- package/dist-client/pages/scenario.js.map +1 -0
- package/dist-client/route.d.ts +1 -0
- package/dist-client/route.js +14 -0
- package/dist-client/route.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-client/viewparts/connections-monitor.d.ts +10 -0
- package/dist-client/viewparts/connections-monitor.js +169 -0
- package/dist-client/viewparts/connections-monitor.js.map +1 -0
- package/dist-client/viewparts/monitoring-summary.d.ts +12 -0
- package/dist-client/viewparts/monitoring-summary.js +135 -0
- package/dist-client/viewparts/monitoring-summary.js.map +1 -0
- package/dist-client/viewparts/pending-q-monitor.d.ts +17 -0
- package/dist-client/viewparts/pending-q-monitor.js +247 -0
- package/dist-client/viewparts/pending-q-monitor.js.map +1 -0
- package/dist-client/viewparts/scenario-instance-log-view.d.ts +21 -0
- package/dist-client/viewparts/scenario-instance-log-view.js +105 -0
- package/dist-client/viewparts/scenario-instance-log-view.js.map +1 -0
- package/dist-client/viewparts/scenario-instance-monitor.d.ts +15 -0
- package/dist-client/viewparts/scenario-instance-monitor.js +171 -0
- package/dist-client/viewparts/scenario-instance-monitor.js.map +1 -0
- package/dist-client/viewparts/scenario-instance-view.d.ts +29 -0
- package/dist-client/viewparts/scenario-instance-view.js +263 -0
- package/dist-client/viewparts/scenario-instance-view.js.map +1 -0
- package/dist-client/viewparts/scenario-monitor.d.ts +16 -0
- package/dist-client/viewparts/scenario-monitor.js +288 -0
- package/dist-client/viewparts/scenario-monitor.js.map +1 -0
- package/dist-client/viewparts/scenarios-monitor.d.ts +16 -0
- package/dist-client/viewparts/scenarios-monitor.js +167 -0
- package/dist-client/viewparts/scenarios-monitor.js.map +1 -0
- package/package.json +10 -7
- package/client/index.js +0 -0
- package/client/pages/scenario-importer.js +0 -118
- package/client/viewparts/scenarios-monitor.js +0 -153
- /package/client/{bootstrap.js → bootstrap.ts} +0 -0
- /package/client/{route.js → route.ts} +0 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import '@operato/data-grist'
|
|
2
|
+
import '@material/mwc-icon-button'
|
|
3
|
+
import './scenario-monitor'
|
|
4
|
+
|
|
5
|
+
import { css, html, LitElement } from 'lit'
|
|
6
|
+
import { customElement, property, query } from 'lit/decorators.js'
|
|
7
|
+
|
|
8
|
+
import { i18next, localize } from '@operato/i18n'
|
|
9
|
+
import { ScrollbarStyles } from '@operato/styles'
|
|
10
|
+
|
|
11
|
+
function IS_SCENARIO_RUNNING(state) {
|
|
12
|
+
return state && state !== 'UNLOADED'
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@customElement('scenarios-monitor')
|
|
16
|
+
export class ScenariosMonitor extends localize(i18next)(LitElement) {
|
|
17
|
+
static styles = [
|
|
18
|
+
ScrollbarStyles,
|
|
19
|
+
css`
|
|
20
|
+
:host {
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
|
|
24
|
+
overflow: hidden;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
[info] {
|
|
28
|
+
display: flex;
|
|
29
|
+
margin-bottom: var(--margin-default);
|
|
30
|
+
padding: var(--padding-narrow) 0;
|
|
31
|
+
flex-direction: row;
|
|
32
|
+
align-items: center;
|
|
33
|
+
border-bottom: 2px solid var(--secondary-color);
|
|
34
|
+
}
|
|
35
|
+
[info] h2 {
|
|
36
|
+
margin: 0;
|
|
37
|
+
font: var(--subtitle-font);
|
|
38
|
+
color: var(--secondary-color);
|
|
39
|
+
text-transform: capitalize;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
[info] > span {
|
|
43
|
+
display: flex;
|
|
44
|
+
margin-left: auto;
|
|
45
|
+
}
|
|
46
|
+
[info] input {
|
|
47
|
+
margin: var(--input-margin);
|
|
48
|
+
padding: var(--padding-narrow);
|
|
49
|
+
border: var(--border-dark-color);
|
|
50
|
+
border-radius: var(--border-radius);
|
|
51
|
+
font: var(--input-font);
|
|
52
|
+
}
|
|
53
|
+
[info] mwc-icon {
|
|
54
|
+
margin-left: var(--margin-narrow);
|
|
55
|
+
color: rgba(var(--secondary-color-rgb), 0.6);
|
|
56
|
+
line-height: 34px;
|
|
57
|
+
cursor: pointer;
|
|
58
|
+
}
|
|
59
|
+
[info] mwc-icon[active] {
|
|
60
|
+
color: var(--primary-color);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
[content] {
|
|
64
|
+
flex: 1;
|
|
65
|
+
|
|
66
|
+
display: flex;
|
|
67
|
+
flex-direction: row;
|
|
68
|
+
|
|
69
|
+
overflow: hidden;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
pending-q-monitor {
|
|
73
|
+
width: 100px;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
[scenarios] {
|
|
77
|
+
flex: 1;
|
|
78
|
+
|
|
79
|
+
overflow: auto;
|
|
80
|
+
display: flex;
|
|
81
|
+
flex-direction: column;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
[scenarios] [flowbox] {
|
|
85
|
+
display: flex;
|
|
86
|
+
flex-direction: column;
|
|
87
|
+
min-height: min-content;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
[scenarios][mode='brief'] [flowbox] {
|
|
91
|
+
flex-flow: row wrap;
|
|
92
|
+
align-self: start;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
scenario-monitor {
|
|
96
|
+
flex: none;
|
|
97
|
+
height: fit-content;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@media screen and (max-width: 480px) {
|
|
101
|
+
pending-q-monitor {
|
|
102
|
+
width: 80px;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
`
|
|
106
|
+
]
|
|
107
|
+
|
|
108
|
+
@property({ type: Array }) scenarios: any
|
|
109
|
+
@property({ type: String }) mode?: string
|
|
110
|
+
@property({ type: String }) filter?: string
|
|
111
|
+
@property({ type: Array }) pendings: any
|
|
112
|
+
@property({ type: Object }) colorIndex: any
|
|
113
|
+
@property({ type: Boolean }) running: boolean = false
|
|
114
|
+
|
|
115
|
+
render() {
|
|
116
|
+
var scenarios = this.scenarios || []
|
|
117
|
+
const mode = this.mode || 'brief'
|
|
118
|
+
const filter = this.filter || ''
|
|
119
|
+
|
|
120
|
+
return html`
|
|
121
|
+
<div info>
|
|
122
|
+
<h2>scenarios</h2>
|
|
123
|
+
<span>
|
|
124
|
+
<input .value=${filter} @change=${e => (this.filter = e.target.value)} placeholder="search" />
|
|
125
|
+
<mwc-icon @click=${e => (this.mode = 'brief')} ?active=${mode == 'brief'}>view_comfy</mwc-icon>
|
|
126
|
+
<mwc-icon @click=${e => (this.mode = 'detail')} ?active=${mode == 'detail'}>dehaze</mwc-icon>
|
|
127
|
+
</span>
|
|
128
|
+
</div>
|
|
129
|
+
|
|
130
|
+
<div content>
|
|
131
|
+
<pending-q-monitor
|
|
132
|
+
.pendings=${this.pendings}
|
|
133
|
+
.colorIndex=${this.colorIndex || {}}
|
|
134
|
+
.running=${this.running}
|
|
135
|
+
></pending-q-monitor>
|
|
136
|
+
|
|
137
|
+
<div scenarios mode=${mode}>
|
|
138
|
+
<div flowbox>
|
|
139
|
+
${scenarios
|
|
140
|
+
.filter(scenario => scenario.name.indexOf(filter) == 0)
|
|
141
|
+
.map(scenario => html`<scenario-monitor .scenario=${scenario} mode=${mode}></scenario-monitor>`)}
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
`
|
|
146
|
+
}
|
|
147
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import '@material/mwc-icon';
|
|
2
|
+
import './editors/entity-editor';
|
|
3
|
+
import './editors/property-editor';
|
|
4
|
+
import { OxGristEditorJson } from '@operato/app/grist-editor/ox-grist-editor-json.js';
|
|
5
|
+
import { OxGristRendererCrontab } from '@operato/app/grist-editor/ox-grist-renderer-crontab.js';
|
|
6
|
+
import { registerEditor as registerGristEditor, registerRenderer as registerGristRenderer } from '@operato/data-grist';
|
|
7
|
+
import { OxGristEditorCrontab } from '@operato/grist-editor/ox-grist-editor-crontab.js';
|
|
8
|
+
import { OxGristEditorParameters } from '@operato/grist-editor/ox-grist-editor-parameters.js';
|
|
9
|
+
import { OxPropertyEditor } from '@operato/property-editor';
|
|
10
|
+
import { ConnectionSelector } from './grist/connection-selector';
|
|
11
|
+
import { ConnectorSelector } from './grist/connector-selector';
|
|
12
|
+
import { TaskTypeSelector } from './grist/task-type-selector';
|
|
13
|
+
export default function bootstrap() {
|
|
14
|
+
registerGristEditor('task-type', TaskTypeSelector);
|
|
15
|
+
registerGristEditor('connector', ConnectorSelector);
|
|
16
|
+
registerGristEditor('connection', ConnectionSelector);
|
|
17
|
+
registerGristEditor('json', OxGristEditorJson);
|
|
18
|
+
registerGristEditor('parameters', OxGristEditorParameters);
|
|
19
|
+
registerGristEditor('crontab', OxGristEditorCrontab);
|
|
20
|
+
registerGristRenderer('crontab', OxGristRendererCrontab);
|
|
21
|
+
OxPropertyEditor.register({
|
|
22
|
+
'http-headers': 'property-editor-http-headers',
|
|
23
|
+
'http-parameters': 'property-editor-http-parameters',
|
|
24
|
+
'http-body': 'property-editor-http-body',
|
|
25
|
+
'entity-selector': 'property-editor-entity-selector',
|
|
26
|
+
'scenario-step-input': 'property-editor-scenario-step-input'
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=bootstrap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../client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AA;AACJ,CAAC","sourcesContent":["import '@material/mwc-icon'\nimport './editors/entity-editor'\nimport './editors/property-editor'\n\nimport { OxGristEditorJson } from '@operato/app/grist-editor/ox-grist-editor-json.js'\nimport { OxGristRendererCrontab } from '@operato/app/grist-editor/ox-grist-renderer-crontab.js'\nimport { registerEditor as registerGristEditor, registerRenderer as registerGristRenderer } from '@operato/data-grist'\nimport { OxGristEditorCrontab } from '@operato/grist-editor/ox-grist-editor-crontab.js'\nimport { OxGristEditorParameters } from '@operato/grist-editor/ox-grist-editor-parameters.js'\nimport { OxPropertyEditor } from '@operato/property-editor'\n\nimport { ConnectionSelector } from './grist/connection-selector'\nimport { ConnectorSelector } from './grist/connector-selector'\nimport { TaskTypeSelector } from './grist/task-type-selector'\n\nexport default function bootstrap() {\n registerGristEditor('task-type', TaskTypeSelector)\n registerGristEditor('connector', ConnectorSelector)\n registerGristEditor('connection', ConnectionSelector)\n registerGristEditor('json', OxGristEditorJson)\n registerGristEditor('parameters', OxGristEditorParameters)\n registerGristEditor('crontab', OxGristEditorCrontab)\n\n registerGristRenderer('crontab', OxGristRendererCrontab)\n\n OxPropertyEditor.register({\n 'http-headers': 'property-editor-http-headers',\n 'http-parameters': 'property-editor-http-parameters',\n 'http-body': 'property-editor-http-body',\n 'entity-selector': 'property-editor-entity-selector',\n 'scenario-step-input': 'property-editor-scenario-step-input'\n })\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import './things-editor-entity-selector';
|
|
2
|
+
import { OxPropertyEditor } from '@operato/property-editor';
|
|
3
|
+
export declare class PropertyEditorEntitySelector extends OxPropertyEditor {
|
|
4
|
+
static get styles(): import("lit").CSSResult[];
|
|
5
|
+
editorTemplate(value: any, spec: any): import("lit-html").TemplateResult<1>;
|
|
6
|
+
shouldUpdate(changedProperties: any): boolean;
|
|
7
|
+
get valueProperty(): string;
|
|
8
|
+
_computeLabelId(label: any): any;
|
|
9
|
+
_valueChanged(e: any): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { __decorate } from "tslib";
|
|
5
|
+
import './things-editor-entity-selector';
|
|
6
|
+
import { html } from 'lit';
|
|
7
|
+
import { customElement } from 'lit/decorators.js';
|
|
8
|
+
import cloneDeep from 'lodash-es/cloneDeep';
|
|
9
|
+
import { OxPropertyEditor } from '@operato/property-editor';
|
|
10
|
+
let PropertyEditorEntitySelector = class PropertyEditorEntitySelector extends OxPropertyEditor {
|
|
11
|
+
static get styles() {
|
|
12
|
+
return [...OxPropertyEditor.styles];
|
|
13
|
+
}
|
|
14
|
+
editorTemplate(value, spec) {
|
|
15
|
+
return html `
|
|
16
|
+
<things-editor-entity-selector
|
|
17
|
+
id="editor"
|
|
18
|
+
.value=${value}
|
|
19
|
+
.properties=${spec.property}
|
|
20
|
+
></things-editor-entity-selector>
|
|
21
|
+
`;
|
|
22
|
+
}
|
|
23
|
+
shouldUpdate(changedProperties) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
get valueProperty() {
|
|
27
|
+
return 'value';
|
|
28
|
+
}
|
|
29
|
+
_computeLabelId(label) {
|
|
30
|
+
if (label.indexOf('label.') >= 0)
|
|
31
|
+
return label;
|
|
32
|
+
return 'label.' + label;
|
|
33
|
+
}
|
|
34
|
+
_valueChanged(e) {
|
|
35
|
+
e.stopPropagation();
|
|
36
|
+
this.value = cloneDeep(e.target[this.valueProperty]);
|
|
37
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
|
|
38
|
+
if (!this.observe)
|
|
39
|
+
return;
|
|
40
|
+
this.observe.call(this, this.value);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
PropertyEditorEntitySelector = __decorate([
|
|
44
|
+
customElement('property-editor-entity-selector')
|
|
45
|
+
], PropertyEditorEntitySelector);
|
|
46
|
+
export { PropertyEditorEntitySelector };
|
|
47
|
+
//# sourceMappingURL=entity-editor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-editor.js","sourceRoot":"","sources":["../../client/editors/entity-editor.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,iCAAiC,CAAA;AAExC,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,SAAS,MAAM,qBAAqB,CAAA;AAE3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAGpD,IAAM,4BAA4B,GAAlC,MAAM,4BAA6B,SAAQ,gBAAgB;IAChE,MAAM,KAAK,MAAM;QACf,OAAO,CAAC,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAA;IACrC,CAAC;IAED,cAAc,CAAC,KAAK,EAAE,IAAI;QACxB,OAAO,IAAI,CAAA;;;iBAGE,KAAK;sBACA,IAAI,CAAC,QAAQ;;KAE9B,CAAA;IACH,CAAC;IAED,YAAY,CAAC,iBAAiB;QAC5B,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAI,aAAa;QACf,OAAO,OAAO,CAAA;IAChB,CAAC;IAED,eAAe,CAAC,KAAK;QACnB,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;YAAE,OAAO,KAAK,CAAA;QAE9C,OAAO,QAAQ,GAAG,KAAK,CAAA;IACzB,CAAC;IAED,aAAa,CAAC,CAAC;QACb,CAAC,CAAC,eAAe,EAAE,CAAA;QAEnB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAA;QAEpD,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;QAEhF,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAM;QACzB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;IACrC,CAAC;CACF,CAAA;AAvCY,4BAA4B;IADxC,aAAa,CAAC,iCAAiC,CAAC;GACpC,4BAA4B,CAuCxC;SAvCY,4BAA4B","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport './things-editor-entity-selector'\n\nimport { html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\nimport cloneDeep from 'lodash-es/cloneDeep'\n\nimport { OxPropertyEditor } from '@operato/property-editor'\n\n@customElement('property-editor-entity-selector')\nexport class PropertyEditorEntitySelector extends OxPropertyEditor {\n static get styles() {\n return [...OxPropertyEditor.styles]\n }\n\n editorTemplate(value, spec) {\n return html`\n <things-editor-entity-selector\n id=\"editor\"\n .value=${value}\n .properties=${spec.property}\n ></things-editor-entity-selector>\n `\n }\n\n shouldUpdate(changedProperties) {\n return true\n }\n\n get valueProperty() {\n return 'value'\n }\n\n _computeLabelId(label) {\n if (label.indexOf('label.') >= 0) return label\n\n return 'label.' + label\n }\n\n _valueChanged(e) {\n e.stopPropagation()\n\n this.value = cloneDeep(e.target[this.valueProperty])\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n\n if (!this.observe) return\n this.observe.call(this, this.value)\n }\n}\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import '@operato/data-grist';
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
import { DataGrist } from '@operato/data-grist/ox-grist.js';
|
|
4
|
+
export declare class EntitySelector extends LitElement {
|
|
5
|
+
static styles: any[];
|
|
6
|
+
value?: string;
|
|
7
|
+
searchFields: any;
|
|
8
|
+
config: any;
|
|
9
|
+
data: any;
|
|
10
|
+
queryName: string;
|
|
11
|
+
select: any;
|
|
12
|
+
list: any;
|
|
13
|
+
basicArgs: any;
|
|
14
|
+
selectedRecords: any;
|
|
15
|
+
grist: DataGrist;
|
|
16
|
+
searchForm: HTMLFormElement;
|
|
17
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
18
|
+
onCancel(): void;
|
|
19
|
+
onConfirm(): void;
|
|
20
|
+
fetchHandler({ page, limit, sorters }: {
|
|
21
|
+
page: any;
|
|
22
|
+
limit: any;
|
|
23
|
+
sorters?: never[] | undefined;
|
|
24
|
+
}): Promise<{
|
|
25
|
+
records: any;
|
|
26
|
+
total: any;
|
|
27
|
+
limit: any;
|
|
28
|
+
page: any;
|
|
29
|
+
} | undefined>;
|
|
30
|
+
firstUpdated(): Promise<void>;
|
|
31
|
+
getSelectFields(): string;
|
|
32
|
+
_buildConditions(page: any, limit: any, sorters: any): Promise<any>;
|
|
33
|
+
get selected(): import("@operato/data-grist").GristRecord | undefined;
|
|
34
|
+
}
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import '@operato/data-grist';
|
|
3
|
+
import gql from 'graphql-tag';
|
|
4
|
+
import { css, html, LitElement } from 'lit';
|
|
5
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
6
|
+
import { DataGrist } from '@operato/data-grist/ox-grist.js';
|
|
7
|
+
import { buildArgs, client } from '@operato/graphql';
|
|
8
|
+
import { i18next } from '@operato/i18n';
|
|
9
|
+
import { isMobileDevice } from '@operato/utils';
|
|
10
|
+
import { MultiColumnFormStyles } from '@things-factory/form-ui';
|
|
11
|
+
let EntitySelector = class EntitySelector extends LitElement {
|
|
12
|
+
render() {
|
|
13
|
+
return html `
|
|
14
|
+
<search-form
|
|
15
|
+
id="search-form"
|
|
16
|
+
@keypress="${async (e) => {
|
|
17
|
+
if (e.keyCode === 13) {
|
|
18
|
+
this.data = await this.grist.fetch();
|
|
19
|
+
}
|
|
20
|
+
}}"
|
|
21
|
+
@submit="${async (e) => (this.data = await this.grist.fetch())}"
|
|
22
|
+
.fields="${this.searchFields}"
|
|
23
|
+
></search-form>
|
|
24
|
+
|
|
25
|
+
<ox-grist
|
|
26
|
+
.mode=${isMobileDevice() ? 'LIST' : 'GRID'}
|
|
27
|
+
.config=${this.config}
|
|
28
|
+
.data=${this.data}
|
|
29
|
+
.fetchHandler="${this.fetchHandler.bind(this)}"
|
|
30
|
+
></ox-grist>
|
|
31
|
+
|
|
32
|
+
<div class="button-container">
|
|
33
|
+
<mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>
|
|
34
|
+
<mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
|
|
35
|
+
</div>
|
|
36
|
+
`;
|
|
37
|
+
}
|
|
38
|
+
onCancel() {
|
|
39
|
+
history.back();
|
|
40
|
+
}
|
|
41
|
+
onConfirm() {
|
|
42
|
+
this.dispatchEvent(new CustomEvent('entity-selected', {
|
|
43
|
+
detail: {
|
|
44
|
+
entity: this.selected
|
|
45
|
+
}
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
async fetchHandler({ page, limit, sorters = [] }) {
|
|
49
|
+
const response = await client.query({
|
|
50
|
+
query: gql `
|
|
51
|
+
query {
|
|
52
|
+
${this.queryName} (${buildArgs(await this._buildConditions(page, limit, sorters))}) {
|
|
53
|
+
${this.getSelectFields()}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
`
|
|
57
|
+
});
|
|
58
|
+
if (!response.errors) {
|
|
59
|
+
const records = response.data[this.queryName].items.map(item => {
|
|
60
|
+
if (this.value === item.id) {
|
|
61
|
+
this.selectedRecords = [item];
|
|
62
|
+
item['__selected__'] = true;
|
|
63
|
+
}
|
|
64
|
+
return item;
|
|
65
|
+
});
|
|
66
|
+
const total = response.data[this.queryName].total;
|
|
67
|
+
return {
|
|
68
|
+
records,
|
|
69
|
+
total,
|
|
70
|
+
limit,
|
|
71
|
+
page
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
async firstUpdated() {
|
|
76
|
+
this.config = {
|
|
77
|
+
columns: [
|
|
78
|
+
{
|
|
79
|
+
type: 'gutter',
|
|
80
|
+
gutterName: 'sequence'
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
type: 'gutter',
|
|
84
|
+
gutterName: 'row-selector',
|
|
85
|
+
multiple: false
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
rows: {
|
|
89
|
+
selectable: {
|
|
90
|
+
multiple: false
|
|
91
|
+
},
|
|
92
|
+
handlers: {
|
|
93
|
+
click: 'select-row',
|
|
94
|
+
dblclick: (columns, data, column, record, rowIndex, field) => {
|
|
95
|
+
this.onConfirm();
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
appendable: false
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
if (this.select && this.select.length > 0) {
|
|
102
|
+
let _searchFields = this.select.filter(selectField => !selectField.hidden);
|
|
103
|
+
if (this.list && this.list.fields && this.list.fields.length > 0) {
|
|
104
|
+
_searchFields = _searchFields.filter(searchField => this.list.fields.indexOf(searchField.name) >= 0);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
_searchFields = _searchFields.slice(0, 4);
|
|
108
|
+
}
|
|
109
|
+
this.searchFields = _searchFields.map(selectField => {
|
|
110
|
+
const fieldType = (selectField.type && selectField.type.toLowerCase()) || 'string';
|
|
111
|
+
const numberTypes = ['integer', 'float'];
|
|
112
|
+
return {
|
|
113
|
+
label: selectField.header || i18next.t(`field.${selectField.name}`),
|
|
114
|
+
name: selectField.name,
|
|
115
|
+
type: fieldType === 'string'
|
|
116
|
+
? 'text'
|
|
117
|
+
: numberTypes.indexOf(fieldType) >= 0
|
|
118
|
+
? 'number'
|
|
119
|
+
: fieldType === 'boolean'
|
|
120
|
+
? 'checkbox'
|
|
121
|
+
: fieldType,
|
|
122
|
+
queryName: selectField.queryName,
|
|
123
|
+
props: fieldType === 'string'
|
|
124
|
+
? { searchOper: 'i_like' }
|
|
125
|
+
: fieldType === 'object'
|
|
126
|
+
? { searchOper: 'in' }
|
|
127
|
+
: { searchOper: 'eq' },
|
|
128
|
+
attrs: fieldType === 'boolean' ? ['indeterminated'] : []
|
|
129
|
+
};
|
|
130
|
+
});
|
|
131
|
+
this.config = Object.assign(Object.assign({}, this.config), { columns: [
|
|
132
|
+
...this.config.columns,
|
|
133
|
+
...this.select.map(selectField => {
|
|
134
|
+
return Object.assign(Object.assign({}, selectField), { type: selectField.type || 'string', width: selectField.width || 160, header: selectField.header || i18next.t(`field.${selectField.name}`) });
|
|
135
|
+
})
|
|
136
|
+
] });
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
this.searchFields = [
|
|
140
|
+
{
|
|
141
|
+
label: i18next.t('field.name'),
|
|
142
|
+
name: 'name',
|
|
143
|
+
type: 'text',
|
|
144
|
+
props: { searchOper: 'i_like' }
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
label: i18next.t('field.description'),
|
|
148
|
+
name: 'description',
|
|
149
|
+
type: 'text',
|
|
150
|
+
props: { searchOper: 'i_like' }
|
|
151
|
+
}
|
|
152
|
+
];
|
|
153
|
+
this.config = Object.assign(Object.assign({}, this.config), { columns: [
|
|
154
|
+
...this.config.columns,
|
|
155
|
+
{
|
|
156
|
+
type: 'string',
|
|
157
|
+
name: 'id',
|
|
158
|
+
header: i18next.t('field.id'),
|
|
159
|
+
hidden: true
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
type: 'string',
|
|
163
|
+
name: 'name',
|
|
164
|
+
header: i18next.t('field.name'),
|
|
165
|
+
record: {
|
|
166
|
+
align: 'left'
|
|
167
|
+
},
|
|
168
|
+
sortable: true,
|
|
169
|
+
width: 160
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
type: 'string',
|
|
173
|
+
name: 'description',
|
|
174
|
+
header: i18next.t('field.description'),
|
|
175
|
+
record: {
|
|
176
|
+
align: 'left'
|
|
177
|
+
},
|
|
178
|
+
sortable: true,
|
|
179
|
+
width: 300
|
|
180
|
+
}
|
|
181
|
+
] });
|
|
182
|
+
}
|
|
183
|
+
this.config = Object.assign(Object.assign({}, this.config), { list: Object.assign(Object.assign({}, this.list), { fields: this.list && this.list.fields && this.list.fields.length > 0
|
|
184
|
+
? this.list.fields
|
|
185
|
+
: this.config.columns
|
|
186
|
+
.filter(column => column.type !== 'gutter')
|
|
187
|
+
.slice(0, 3)
|
|
188
|
+
.map(column => column.name) }) });
|
|
189
|
+
await this.updateComplete;
|
|
190
|
+
this.grist && this.grist.focus();
|
|
191
|
+
}
|
|
192
|
+
getSelectFields() {
|
|
193
|
+
if (this.select && this.select.length > 0) {
|
|
194
|
+
return `items {
|
|
195
|
+
${this.select.map(selectField => {
|
|
196
|
+
return selectField.type === 'object'
|
|
197
|
+
? `${selectField.name} { ${selectField.subFields && selectField.subFields.length > 0
|
|
198
|
+
? selectField.subFields.join(' ')
|
|
199
|
+
: `id name description`} }`
|
|
200
|
+
: `${selectField.name}`;
|
|
201
|
+
})}
|
|
202
|
+
}
|
|
203
|
+
total`;
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
return `
|
|
207
|
+
items {
|
|
208
|
+
id
|
|
209
|
+
name
|
|
210
|
+
description
|
|
211
|
+
}
|
|
212
|
+
total
|
|
213
|
+
`;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
async _buildConditions(page, limit, sorters) {
|
|
217
|
+
const queryConditions = Object.assign({ filters: [] }, this.basicArgs);
|
|
218
|
+
queryConditions.filters = [...queryConditions.filters, ...(await this.searchForm.getQueryFilters())];
|
|
219
|
+
queryConditions.pagination = { page, limit };
|
|
220
|
+
queryConditions.sortings = sorters;
|
|
221
|
+
return queryConditions;
|
|
222
|
+
}
|
|
223
|
+
get selected() {
|
|
224
|
+
var selected = this.grist.selected;
|
|
225
|
+
return selected && selected.length > 0 ? selected[0] : undefined;
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
EntitySelector.styles = [
|
|
229
|
+
MultiColumnFormStyles,
|
|
230
|
+
css `
|
|
231
|
+
:host {
|
|
232
|
+
display: flex;
|
|
233
|
+
flex-direction: column;
|
|
234
|
+
|
|
235
|
+
background-color: #fff;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
ox-grist {
|
|
239
|
+
flex: 1;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.button-container {
|
|
243
|
+
display: flex;
|
|
244
|
+
margin-left: auto;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
form {
|
|
248
|
+
position: relative;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
[search] {
|
|
252
|
+
position: absolute;
|
|
253
|
+
right: 0;
|
|
254
|
+
}
|
|
255
|
+
`
|
|
256
|
+
];
|
|
257
|
+
__decorate([
|
|
258
|
+
property({ type: String }),
|
|
259
|
+
__metadata("design:type", String)
|
|
260
|
+
], EntitySelector.prototype, "value", void 0);
|
|
261
|
+
__decorate([
|
|
262
|
+
property({ type: Array }),
|
|
263
|
+
__metadata("design:type", Object)
|
|
264
|
+
], EntitySelector.prototype, "searchFields", void 0);
|
|
265
|
+
__decorate([
|
|
266
|
+
property({ type: Object }),
|
|
267
|
+
__metadata("design:type", Object)
|
|
268
|
+
], EntitySelector.prototype, "config", void 0);
|
|
269
|
+
__decorate([
|
|
270
|
+
property({ type: Object }),
|
|
271
|
+
__metadata("design:type", Object)
|
|
272
|
+
], EntitySelector.prototype, "data", void 0);
|
|
273
|
+
__decorate([
|
|
274
|
+
property({ type: String }),
|
|
275
|
+
__metadata("design:type", String)
|
|
276
|
+
], EntitySelector.prototype, "queryName", void 0);
|
|
277
|
+
__decorate([
|
|
278
|
+
property({ type: Array }),
|
|
279
|
+
__metadata("design:type", Object)
|
|
280
|
+
], EntitySelector.prototype, "select", void 0);
|
|
281
|
+
__decorate([
|
|
282
|
+
property({ type: Object }),
|
|
283
|
+
__metadata("design:type", Object)
|
|
284
|
+
], EntitySelector.prototype, "list", void 0);
|
|
285
|
+
__decorate([
|
|
286
|
+
property({ type: Object }),
|
|
287
|
+
__metadata("design:type", Object)
|
|
288
|
+
], EntitySelector.prototype, "basicArgs", void 0);
|
|
289
|
+
__decorate([
|
|
290
|
+
property({ type: Array }),
|
|
291
|
+
__metadata("design:type", Object)
|
|
292
|
+
], EntitySelector.prototype, "selectedRecords", void 0);
|
|
293
|
+
__decorate([
|
|
294
|
+
query('ox-grist'),
|
|
295
|
+
__metadata("design:type", DataGrist)
|
|
296
|
+
], EntitySelector.prototype, "grist", void 0);
|
|
297
|
+
__decorate([
|
|
298
|
+
query('search-form'),
|
|
299
|
+
__metadata("design:type", HTMLFormElement)
|
|
300
|
+
], EntitySelector.prototype, "searchForm", void 0);
|
|
301
|
+
EntitySelector = __decorate([
|
|
302
|
+
customElement('entity-selector')
|
|
303
|
+
], EntitySelector);
|
|
304
|
+
export { EntitySelector };
|
|
305
|
+
//# sourceMappingURL=entity-selector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-selector.js","sourceRoot":"","sources":["../../client/editors/entity-selector.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAE5B,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,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAA;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAGxD,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,UAAU;IA4C5C,MAAM;QACJ,OAA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AC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAClE,CAAC;;AA1SM,qBAAM,GAAG;IACd,qBAAqB;IACrB,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;KAyBF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6CAAe;AAC1C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;oDAAkB;AAC5C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CAAY;AACvC;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CAAU;AACrC;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDAAmB;AAC9C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;8CAAY;AACtC;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CAAU;AACrC;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDAAe;AAC1C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;uDAAqB;AAE/C;IAAC,KAAK,CAAC,UAAU,CAAC;8BAAS,SAAS;6CAAA;AACpC;IAAC,KAAK,CAAC,aAAa,CAAC;8BAAc,eAAe;kDAAA;AA1CvC,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CA4S1B;SA5SY,cAAc","sourcesContent":["import '@operato/data-grist'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { DataGrist } from '@operato/data-grist/ox-grist.js'\nimport { buildArgs, client } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { isMobileDevice } from '@operato/utils'\nimport { MultiColumnFormStyles } from '@things-factory/form-ui'\n\n@customElement('entity-selector')\nexport class EntitySelector extends LitElement {\n static styles = [\n MultiColumnFormStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: #fff;\n }\n\n ox-grist {\n flex: 1;\n }\n\n .button-container {\n display: flex;\n margin-left: auto;\n }\n\n form {\n position: relative;\n }\n\n [search] {\n position: absolute;\n right: 0;\n }\n `\n ]\n\n @property({ type: String }) value?: string\n @property({ type: Array }) searchFields: any\n @property({ type: Object }) config: any\n @property({ type: Object }) data: any\n @property({ type: String }) queryName!: string\n @property({ type: Array }) select: any\n @property({ type: Object }) list: any\n @property({ type: Object }) basicArgs: any\n @property({ type: Array }) selectedRecords: any\n\n @query('ox-grist') grist!: DataGrist\n @query('search-form') searchForm!: HTMLFormElement\n\n render() {\n return html`\n <search-form\n id=\"search-form\"\n @keypress=\"${async e => {\n if (e.keyCode === 13) {\n this.data = await this.grist.fetch()\n }\n }}\"\n @submit=\"${async e => (this.data = await this.grist.fetch())}\"\n .fields=\"${this.searchFields}\"\n ></search-form>\n\n <ox-grist\n .mode=${isMobileDevice() ? 'LIST' : 'GRID'}\n .config=${this.config}\n .data=${this.data}\n .fetchHandler=\"${this.fetchHandler.bind(this)}\"\n ></ox-grist>\n\n <div class=\"button-container\">\n <mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>\n <mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>\n </div>\n `\n }\n\n onCancel() {\n history.back()\n }\n\n onConfirm() {\n this.dispatchEvent(\n new CustomEvent('entity-selected', {\n detail: {\n entity: this.selected\n }\n })\n )\n }\n\n async fetchHandler({ page, limit, sorters = [] }) {\n const response = await client.query({\n query: gql`\n query {\n ${this.queryName} (${buildArgs(await this._buildConditions(page, limit, sorters))}) {\n ${this.getSelectFields()}\n }\n }\n `\n })\n\n if (!response.errors) {\n const records = response.data[this.queryName].items.map(item => {\n if (this.value === item.id) {\n this.selectedRecords = [item]\n item['__selected__'] = true\n }\n\n return item\n })\n const total = response.data[this.queryName].total\n\n return {\n records,\n total,\n limit,\n page\n }\n }\n }\n\n async firstUpdated() {\n this.config = {\n columns: [\n {\n type: 'gutter',\n gutterName: 'sequence'\n },\n {\n type: 'gutter',\n gutterName: 'row-selector',\n multiple: false\n }\n ],\n rows: {\n selectable: {\n multiple: false\n },\n handlers: {\n click: 'select-row',\n dblclick: (columns, data, column, record, rowIndex, field) => {\n this.onConfirm()\n }\n },\n appendable: false\n }\n }\n\n if (this.select && this.select.length > 0) {\n let _searchFields = this.select.filter(selectField => !selectField.hidden)\n if (this.list && this.list.fields && this.list.fields.length > 0) {\n _searchFields = _searchFields.filter(searchField => this.list.fields.indexOf(searchField.name) >= 0)\n } else {\n _searchFields = _searchFields.slice(0, 4)\n }\n\n this.searchFields = _searchFields.map(selectField => {\n const fieldType = (selectField.type && selectField.type.toLowerCase()) || 'string'\n const numberTypes = ['integer', 'float']\n return {\n label: selectField.header || i18next.t(`field.${selectField.name}`),\n name: selectField.name,\n type:\n fieldType === 'string'\n ? 'text'\n : numberTypes.indexOf(fieldType) >= 0\n ? 'number'\n : fieldType === 'boolean'\n ? 'checkbox'\n : fieldType,\n queryName: selectField.queryName,\n props:\n fieldType === 'string'\n ? { searchOper: 'i_like' }\n : fieldType === 'object'\n ? { searchOper: 'in' }\n : { searchOper: 'eq' },\n attrs: fieldType === 'boolean' ? ['indeterminated'] : []\n }\n })\n this.config = {\n ...this.config,\n columns: [\n ...this.config.columns,\n ...this.select.map(selectField => {\n return {\n ...selectField,\n type: selectField.type || 'string',\n width: selectField.width || 160,\n header: selectField.header || i18next.t(`field.${selectField.name}`)\n }\n })\n ]\n }\n } else {\n this.searchFields = [\n {\n label: i18next.t('field.name'),\n name: 'name',\n type: 'text',\n props: { searchOper: 'i_like' }\n },\n {\n label: i18next.t('field.description'),\n name: 'description',\n type: 'text',\n props: { searchOper: 'i_like' }\n }\n ]\n\n this.config = {\n ...this.config,\n columns: [\n ...this.config.columns,\n {\n type: 'string',\n name: 'id',\n header: i18next.t('field.id'),\n hidden: true\n },\n {\n type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: {\n align: 'left'\n },\n sortable: true,\n width: 160\n },\n {\n type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: {\n align: 'left'\n },\n sortable: true,\n width: 300\n }\n ]\n }\n }\n\n this.config = {\n ...this.config,\n list: {\n ...this.list,\n fields:\n this.list && this.list.fields && this.list.fields.length > 0\n ? this.list.fields\n : this.config.columns\n .filter(column => column.type !== 'gutter')\n .slice(0, 3)\n .map(column => column.name)\n }\n }\n\n await this.updateComplete\n this.grist && this.grist.focus()\n }\n\n getSelectFields() {\n if (this.select && this.select.length > 0) {\n return `items {\n ${this.select.map(selectField => {\n return selectField.type === 'object'\n ? `${selectField.name} { ${\n selectField.subFields && selectField.subFields.length > 0\n ? selectField.subFields.join(' ')\n : `id name description`\n } }`\n : `${selectField.name}`\n })}\n }\n total`\n } else {\n return `\n items {\n id\n name\n description\n }\n total\n `\n }\n }\n\n async _buildConditions(page, limit, sorters) {\n const queryConditions = {\n filters: [],\n ...this.basicArgs\n }\n\n queryConditions.filters = [...queryConditions.filters, ...(await this.searchForm.getQueryFilters())]\n queryConditions.pagination = { page, limit }\n queryConditions.sortings = sorters\n return queryConditions\n }\n\n get selected() {\n var selected = this.grist.selected\n\n return selected && selected.length > 0 ? selected[0] : undefined\n }\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import './things-editor-http-headers';
|
|
2
|
+
import './things-editor-http-parameters';
|
|
3
|
+
import './things-editor-http-body';
|
|
4
|
+
import { OxPropertyEditor } from '@operato/property-editor';
|
|
5
|
+
export declare class PropertyEditorScenarioStepInput extends OxPropertyEditor {
|
|
6
|
+
static get styles(): import("lit").CSSResult[];
|
|
7
|
+
editorTemplate(value: any, spec: any): import("lit-html").TemplateResult<1>;
|
|
8
|
+
}
|
|
9
|
+
export declare class PropertyEditorHttpHeaders extends OxPropertyEditor {
|
|
10
|
+
static get styles(): import("lit").CSSResult[];
|
|
11
|
+
editorTemplate(value: any, spec: any): import("lit-html").TemplateResult<1>;
|
|
12
|
+
}
|
|
13
|
+
export declare class PropertyEditorHttpParameters extends OxPropertyEditor {
|
|
14
|
+
static get styles(): import("lit").CSSResult[];
|
|
15
|
+
editorTemplate(value: any, spec: any): import("lit-html").TemplateResult<1>;
|
|
16
|
+
}
|
|
17
|
+
export declare class PropertyEditorHttpBody extends OxPropertyEditor {
|
|
18
|
+
static get styles(): import("lit").CSSResult[];
|
|
19
|
+
editorTemplate(value: any, spec: any): import("lit-html").TemplateResult<1>;
|
|
20
|
+
}
|