-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
290 lines (277 loc) · 9.64 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Manifest editor</title>
<link rel="stylesheet" href="./assets/style.css"></link>
<script src="src/scopes.js" defer></script>
<script src="src/fields.js" defer></script>
<script src="src/validator.js" defer></script>
<script src="src/main.js" defer></script>
<script src="./src/alpine.js" defer></script>
</head>
<body
x-cloak
x-data="model"
>
<header>
<h1 @click="home()">Workspace Integrations</h1>
<h2 @click="home()">Manifest Editor</h2>
</header>
<main x-show="!config" class="start-page" style="align-items: center">
<div>
Create new manifest or import existing from file.
</div>
<img class="logo" src="./assets/rocket.svg" />
<div>
You can drag and drop a manifest file here too.
</div>
<div class="buttons">
<button
@click="createNew()"
class="action"
>Create new</button>
<input
class="manifest-file"
accept=".json"
type="file"
@change="loadFromFile($event.target.files)"
/>
<button
class="action"
@click="document.querySelector('.manifest-file').click()"
>Load file...</button>
<button
@click="loadSample()"
x-show="devMode"
class="action"
>Load sample</button>
</div>
</main>
<div x-show="!!config">
<div class="tabs">
<template x-for="tab in tabs">
<button
x-text="tab"
@click="currentTab = tab"
:class="currentTab === tab ? 'selected' : ''"
></button>
</template>
</div>
<main x-show="currentTab === 'General'">
<div>
For detailed help, see the <a href="https://developer.webex.com/docs/workspace-integrations" target="_blank">Workspace Integrations Guide</a>.
<br/>See also <a href="https://github.com/cisco-ce/workspace-integrations" target="_blank">SDK for Node.js</a>.
</div>
<div>
<template x-for="input in form">
<section>
<label
:for="input.id"
x-text="input.name"
:class="input.required ? 'required' : ''"
></label>
<template x-if="input.type === 'string'">
<input
:id="input.id"
@change="input.onChange($event.target.value)"
:value="config[input.id]"
:type="input.valuespace || 'text'"
:placeholder="input.placeholder || ''"
:disabled="!!input.readOnly"
/>
</template>
<template x-if="input.type === 'text'">
<textarea
:id="input.id"
@change="input.onChange($event.target.value)"
:value="config[input.id]"
:type="input.valuespace || 'text'"
:placeholder="input.placeholder || ''"
></textarea>
</template>
<template x-if="input.type === 'select'">
<select
@change="input.onChange($event.target.value)"
:value="config[input.id]"
>
<template x-for="value in Object.keys(input.values)">
<!-- :selected is also needed because x-model is run before :value -->
<option
:value="value"
:selected="value === config[input.id]"
x-text="input.values[value]"
></option>
</template>
</select>
</template>
<div class="help-text" x-show="input.helpText" x-text="input.helpText"></div>
</div>
</template>
</section>
<!-- This one needs to be handled by hand: -->
<section>
<label>Provisioning type</label>
<select
@change="config.provisioning.type = $event.target.value"
:value="config?.provisioning?.type"
>
<option value="manual">Manual</option>
<option value="https">https</option>
</select>
<div class="help-text">Manual: Admin must copy activation code (JWT) from Control Hub.
<br/>https: activation code will be sent to an external web page.
</div>
<div x-show="config?.provisioning?.type === 'https'">
<label
:class="config?.provisioning?.type === 'https' ? 'required' : ''"
>Provisioning URL</label>
<input
:value="config?.provisioning?.url"
@input="config.provisioning.url = $event.target.value"
/>
<div class="help-text">Where the JWT will be POSTed. Only required if type is https.</div>
</div>
<label>Activation guide url</label>
<input
:value="config?.provisioning?.activationGuideUrl"
@input="config.provisioning.activationGuideUrl = $event.target.value"
/>
<div class="help-text">Documentation page that describes how to continue with the activation process.</div>
</section>
</main>
<main x-show="currentTab === 'Scopes'">
Scope is a mechanism to let the integration request limited access to an organization's data.
<p/>
See all scopes on <a href="https://developer.webex.com/docs/integrations#scopes" target="_blank">developer.webex.com</a>.
<div class="list">
<template x-if="config?.apiAccess.length < 1">
<div>
<i>No scopes have been defined.</i>
</div>
</template>
<template x-for="item, i in config?.apiAccess">
<div>
<input
:value="item.scope"
list="scopes"
@input="updateScope(i, $event.target.value)"
/>
<input
type="checkbox"
:checked="item.access === 'required'"
@change="item.access = $event.target.checked ? 'required' : 'optional'"
/> Required
<button @click="removeScope(i)" class="simple">X</button>
<div
class="help-text"
x-show="getScopeHelp(item.scope)"
x-text="getScopeHelp(item.scope)"
></div>
</div>
</template>
<div>
<button @click="addScope()" class="simple add">+Add</button>
</div>
</div>
</main>
<main x-show="currentTab === 'xAPI'">
<p/>Explore the xAPI on <a href="https://roomos.cisco.com/xapi" target="_blank">roomos.cisco.com</a>.
<template x-for="type in xapiTypes">
<section class="list">
<label x-text="xapiInfo[type]"></label>
<!-- <i x-show="!config?.xapiAccess?.[type]?.length">List is empty</i> -->
<template x-for="xapi, pos in config?.xapiAccess?.[type]">
<div>
<input
:key="xapi.path"
:value="xapi.path"
:list="type"
:placeholder="xapiExample(type)"
@input="updateApi(type, pos, $event.target.value)"
/>
<input
type="checkbox"
:checked="xapi.access === 'required'"
@change="xapi.access = $event.target.checked ? 'required' : 'optional'"
/> Required
<button @click="removeApi(type, pos)" class="simple">X</button>
<div
class="help-text"
:title="xapiHelp(type, xapi.path)"
x-show="xapi.path"
>
<span class="limited" x-text="xapiHelp(type, xapi.path)"></span>
<a :href="apiLink(xapi.path, type)" target="_blank">More...</a>
</div>
</div>
</template>
<div>
<button @click="addApi(type)" class="simple add">+Add</button>
</div>
</section>
</template>
<div class="help-text">🔓 xConfigurations do not need to specify granular access.</div>
</main>
<main x-show="currentTab === 'JSON'">
You can manually edit the manifest JSON here.
<textarea
class="raw-json"
:class="jsonValid ? 'valid' : 'invalid'"
:value="JSON.stringify(config, null, 2)"
@input="onJSONEdited($event.target.value)"
></textarea>
<div x-show="!jsonValid" class="error">JSON is currently not valid. Remember " around all keys and strings, and no dangling commas.</div>
</main>
<main x-show="currentTab === 'export'" class="export">
<h2>Validation of manifest</h2>
<div x-show="!errors?.length && !warnings.length">👍 Configuration looks valid</div>
<div x-show="errors.length || warnings.length">Manifest contains <b x-text="errors.length"></b> errors and <b x-text="warnings.length"></b> warnings.
</div>
<template x-for="error in errors">
<div class="error">
<span x-text="error.text"></span>
<a
href=""
@click.prevent="showTab(error.tab)"
x-text="error.tab + ' > ' + error.field"></a>
</div>
</template>
<template x-for="warning in warnings">
<div class="warning">
<span x-text="warning.text"></span>
<a
href=""
@click.prevent="showTab(warning.tab)"
x-text="warning.tab + ' > ' warning.field"></a>
</div>
</template>
<div style="text-align: center">
<button @click="saveToFile()" class="primary">Save to file</button>
<button @click="toClipboard()" class="action">Copy to clipboard</button>
</div>
</main>
<div class="buttons">
<!-- <button @click="validateManifest()">Validate</button> -->
<button
class="primary"
@click="exportConfig()"
x-show="currentTab !== 'export'"
>Export</button>
<button
class="action"
@click="currentTab = 'General'"
x-show="currentTab === 'export'"
>Back</button>
</div>
<template x-for="datalist in datalists">
<datalist :id="datalist.id">
<template x-for="value in datalist.values">
<option :value="value">
</template>
</datalist>
</template>
</body>
</html>