1 | /** |
||
2 | * Analytics |
||
3 | * |
||
4 | * SPDX-FileCopyrightText: 2019-2022 Marcel Scherello |
||
5 | * SPDX-License-Identifier: AGPL-3.0-or-later |
||
6 | */ |
||
7 | |||
8 | /** global: OC */ |
||
9 | (function () { |
||
10 | |||
11 | var Component = { |
||
12 | name: 'WorkflowScript', |
||
13 | items: [], |
||
14 | render: function (createElement) { |
||
15 | let self = this; |
||
16 | let items = []; |
||
17 | let selected; |
||
18 | for (let navigation of Component.items) { |
||
19 | if (parseInt(navigation.type) === 2) { |
||
20 | if (parseInt(self.value) === navigation.id) { |
||
21 | selected = 'selected'; |
||
22 | } else { |
||
23 | selected = ''; |
||
24 | } |
||
25 | items.push(createElement('option', { |
||
26 | domProps: { |
||
27 | value: navigation.id, |
||
28 | innerText: navigation.name, |
||
29 | selected |
||
30 | } |
||
31 | })) |
||
32 | } |
||
33 | } |
||
34 | return createElement('div', { |
||
35 | style: { |
||
36 | width: '100%' |
||
37 | }, |
||
38 | }, [ |
||
39 | createElement('select', { |
||
40 | attrs: { |
||
41 | id: 'report' |
||
42 | }, |
||
43 | domProps: { |
||
44 | value: self.value, |
||
45 | required: 'true' |
||
46 | }, |
||
47 | style: { |
||
48 | width: '100%' |
||
49 | }, |
||
50 | on: { |
||
51 | input: function (event) { |
||
52 | self.$emit('input', event.target.value) |
||
53 | } |
||
54 | } |
||
55 | }, items |
||
56 | ) |
||
57 | ]) |
||
58 | }, |
||
59 | props: { |
||
60 | value: '' |
||
61 | }, |
||
62 | beforeMount() { |
||
63 | this.fetchDatasets() |
||
64 | }, |
||
65 | methods: { |
||
66 | fetchDatasets() { |
||
67 | let requestUrl = OC.generateUrl('apps/analytics/dataset'); |
||
68 | let headers = new Headers(); |
||
0 ignored issues
–
show
|
|||
69 | headers.append('requesttoken', OC.requestToken); |
||
70 | headers.append('OCS-APIREQUEST', 'true'); |
||
71 | |||
72 | fetch(requestUrl, { |
||
73 | method: 'GET', |
||
74 | headers: headers |
||
75 | }) |
||
76 | .then(response => response.json()) |
||
77 | .then(data => { |
||
78 | Component.items = data; |
||
79 | }); |
||
80 | }, |
||
81 | }, |
||
82 | }; |
||
83 | |||
84 | window.OCA.WorkflowEngine.registerOperator({ |
||
85 | id: 'OCA\\Analytics\\Flow\\FlowOperation', |
||
86 | color: 'var(--color-primary-element)', |
||
87 | operation: '', |
||
88 | options: Component, |
||
89 | }); |
||
90 | })(); |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.