-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
executable file
·392 lines (338 loc) · 15.8 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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
<!DOCTYPE html>
<html>
<head>
<title>IO Doctor - The Doctor is in</title>
<link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/css/bootstrap.min.css" rel="stylesheet">
<link href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/3.2.1/css/font-awesome.min.css" rel="stylesheet">
<link href="css/default.css" rel="stylesheet">
<link href="css/ribbon.css" rel="stylesheet">
<link href="css/prettify.css" rel="stylesheet">
<script type='text/javascript' src='//cdnjs.cloudflare.com/ajax/libs/knockout/2.3.0/knockout-min.js'></script>
<script type='text/javascript' src='//cdnjs.cloudflare.com/ajax/libs/knockout.mapping/2.3.5/knockout.mapping.js'></script>
<script type='text/javascript' src='//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js'></script>
<script type='text/javascript' src='//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js'></script>
<script type='text/javascript' src='//cdnjs.cloudflare.com/ajax/libs/prettify/r298/prettify.js'></script>
<script type='text/javascript' src='//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/js/bootstrap.min.js'></script>
<script type='text/javascript' src='js/knockout-sortable.min.js'></script>
<script type='text/javascript' src='js/run.js'></script>
<script type='text/javascript' src='js/app.js'></script>
<script type='text/javascript' src='js/ZeroClipboard.min.js'></script>
</head>
<body>
<div class='navbar navbar-inverse navbar-fixed-top'>
<div class='navbar-inner'>
<div class='container-fluid'>
<span class='brand'>I/O Doctor</span>
</div>
</div>
</div>
<div class='container-fluid' role='main'>
<div class='row-fluid'>
<ul id="section-tabs" class='tabs nav nav-tabs'>
<li class='active'>
<a data-toggle='tab' href='#input' id="input-tab">
<i class='icon-upload'></i>
Load
</a>
</li>
<li>
<a data-toggle='tab' href='#editor' id="editor-tab">
<i class='icon-edit'></i>
Edit
</a>
</li>
<li>
<a data-toggle='tab' href='#output' id="output-tab">
<i class='icon-file'></i>
Output
</a>
</li>
</ul>
<div class='tab-content'>
<div class="tab-pane active" id="input">
<textarea id="service-definition" class="span12 service-input"></textarea>
<a class='btn btn-primary pull-right' id="load-definition">
<i class='icon-upload icon-white'></i>
Load Service Definition
</a>
</div>
<div class="tab-pane" id="output">
<a class='btn btn-primary pull-right' id="copy-output" data-clipboard-target="json-output">
<i class='icon-copy icon-white'></i>
Copy Output
</a>
<div id="json-output"></div>
</div>
<div class='tab-pane row-fluid' id='editor'>
<div class='span3'>
<div class='sidebar-nav well'>
<a class='btn btn-info addButton' id='addEndpoint' title='Add Endpoint'>
<i class='icon-plus icon-white'></i>
</a>
<br/>
<ul id='endpointList' data-bind="foreach: endpoints">
<strong><a href="#" data-bind="{text: name, attr: { 'href': '#'+id() } }"></a></strong>
<ul data-bind="foreach: methods">
<a data-bind="attr: { 'href': '#agp-'+id(), 'onClick': '$(\'#a-' + id() +'\').collapse(\'show\')' }">
<li data-bind="text: MethodName"></li>
</a>
</ul>
</ul>
</div>
</div>
<div class="content forms span9">
<form class="form-horizontal" id="config">
<div class="endpoints" data-bind="template: { name: 'endpointTemplate', foreach: endpoints, as: 'endpoint' }"></div>
</form>
</div>
</div>
</div>
</div>
</div>
<script type="text/html" id='endpointTemplate'>
<div class="endpoint" data-bind="attr: { 'id': id }">
<div class="header">
<div class='control-group span6'>
<label class='control-label'>
Endpoint:
</label>
<div class='controls'>
<div class='input'>
<input data-bind="value: name">
</div>
</div>
</div>
<div class='pull-right span6'>
<a data-bind="click: $parent.deleteEndpoint, attr: { 'array-loc': $index() }" class='btn btn-danger pull-right'>
<i class='icon-trash icon-white'></i>
Delete Endpoint
</a>
<a data-bind="click: addMethod" class='btn btn-info pull-right'>
<i class='icon-plus icon-white'></i>
Add Method
</a>
</div>
</div>
<div class="accordion span12" style="margin-left:0px" data-bind="attr: { id: 'ep-accordion-'+$index() }">
<div class="sortable-accordion" data-bind="sortable: { template: 'methodTemplate', data: methods, options: {'axis': 'y', handle: '.method-handle', containment: 'parent' } }">
</div>
</div>
</script>
<script type="text/html" id="methodTemplate">
<div class="accordion-group" data-bind="attr: { 'id': 'agp-'+id() }">
<div class='accordion-heading'>
<i class="icon-reorder accordion-handle method-handle"></i>
<a class="accordion-toggle" data-toggle="collapse" data-bind="attr: { 'data-parent': 'agp-'+id(), href: '#a-'+id() }" >
Method: <span class='methodNameSpan' data-bind="text: MethodName"></span>
</a>
<div class="accordion-buttons">
<div class="block-container">
<a data-bind="click: addParameter" class='btn btn-info'>
<i class='icon-plus icon-white'></i>
Param
</a>
<a data-bind="click: addContentSection" class='btn btn-info'>
<i class='icon-plus icon-white'></i>
Body
</a>
<a class='btn btn-info' data-bind="click: endpoint.duplicateMethod, attr: { 'array-loc': $index() }">
<i class='icon-copy icon-white'></i>
Duplicate
</a>
<a class='btn btn-danger' data-bind="click: endpoint.deleteMethod, attr: { 'array-loc': $index() }">
<i class='icon-trash icon-white'></i>
Delete
</a>
</div>
</div>
</div>
<div class="accordion-body collapse" data-bind="attr: { id: 'a-'+id() }">
<div class="accordion-inner">
<div class='control-group'>
<label class='control-label'> Method Name </label>
<div class='controls'>
<input class='methodName' data-bind="value: MethodName, valueUpdate: 'afterkeydown'" />
</div>
</div>
<div class='control-group'>
<label class='control-label'> Synopsis </label>
<div class='controls'>
<textarea class="span8" data-bind="value: Synopsis, valueUpdate: 'afterkeydown'"></textarea>
</div>
</div>
<div class='control-group'>
<label class='control-label'> HTTP Method (GET, POST, PUT, etc) </label>
<div class='controls'>
<select data-bind="{ 'options': endpoint.supportedHTTPMethods, 'value': HTTPMethod }"></select>
</div>
</div>
<div class='control-group'>
<label class='control-label'> URI </label>
<div class='controls'>
<input data-bind="value: URI" />
</div>
</div>
<div class='control-group'>
<label class='control-label'> Requires OAuth? </label>
<div class='controls'>
<label class='checkbox'>
<input data-bind="value: RequiresOAuth" type='checkbox' />
</label>
</div>
<!-- Then render all the parameters (not-nestable) -->
<div class="sortable-params" data-bind="sortable: { template: 'simple-schema', data: parameters, options: {'axis': 'y', handle: '.param-handle', containment: 'parent' } }" id='parameters'></div>
<!-- Finally render the content section (which may have infinately nested parameters) -->
<!-- ko if: typeof(content()) == 'object' && content() != null -->
<div data-bind="template: { name: 'content-section', data: content }"></div>
<!-- /ko -->
</div>
</div>
</div>
</div>
</script>
<script type="text/html" id='content-section'>
<div class="accordion content-section" data-bind="attr: { id: 'agp-'+id() }" >
<div class="accordion-group">
<div class='accordion-heading'>
<a class="accordion-toggle" data-toggle="collapse" data-bind="attr: { 'data-parent': 'agp-'+id(), href: '#a-'+id() }" >
Body Content
</a>
<div class="accordion-buttons">
<div>
<div class="block-container">
<a data-bind="click: addParameter" class='btn btn-info'>
<i class='icon-plus icon-white'></i>
Param
</a>
<a class='btn btn-danger' data-bind="click: $parent.deleteContentSection ">
<i class='icon-trash icon-white'></i>
Delete
</a>
</div>
</div>
</div>
</div>
<div class="accordion-body collapse in" data-bind="attr: { id: 'a-' +id() }">
<div class="accordion-inner">
<div class='control-group'>
<label class='control-label'> Content Type </label>
<div class='controls'>
<input data-bind="value: contentType" />
</div>
</div>
<!-- Finally render all parameters for this content section (parameters are infinately nestable) -->
<div class="sortable-content-params" data-bind="sortable: { data:parameters, options: {'axis': 'y', handle: '.param-handle', containment: 'parent' } }">
<div data-bind="template: { name: displayTemplate }"></div>
</div>
</div>
</div>
</div>
</div>
</script>
<script type="text/html" id='complex-schema'>
<div class="accordion parameter" data-bind="attr: { id: 'ac-' + id() }" >
<div class="accordion-group">
<div class='accordion-heading'>
<i class="icon-reorder accordion-handle param-handle"></i>
<a class="accordion-toggle" data-toggle="collapse" data-bind="attr: { 'data-parent': '#ac-'+id(), href: '#'+id() }" >
Parameter: <span data-bind="text: Name"></span>
</a>
<div class="accordion-buttons">
<div class="block-container">
<div>
<a data-bind="click: addParameter" class='btn btn-info'>
<i class='icon-plus icon-white'></i> Add
</a>
<a class='btn btn-danger' data-bind="click: $parent.deleteParameter, attr: { 'array-loc': $index() }">
<i class='icon-trash icon-white'></i> Delete
</a>
</div>
</div>
</div>
</div>
<div class="accordion-body collapse in" data-bind="attr: { id: id() }">
<div class="accordion-inner">
<!-- First we render this elements top-level attributes -->
<div data-bind="template: { name: 'data-node' }"></div>
<!-- Finally render all the elements parameters (infinately nestable) -->
<div data-bind="foreach: parameters">
<div data-bind="template: { name: displayTemplate }"></div>
</div>
</div>
</div>
</div>
</div>
</script>
<script type="text/html" id='simple-schema'>
<div class="accordion parameter" data-bind="attr: { id: 'ac-' + id() }" >
<div class="accordion-group">
<div class='accordion-heading'>
<i class="icon-reorder accordion-handle param-handle"></i>
<a class="accordion-toggle" data-toggle="collapse" data-bind="attr: { 'data-parent': '#ac-'+id(), href: '#'+id() }" >
Parameter: <span class='methodNameSpan' data-bind="text: Name"></span>
</a>
<div class="accordion-buttons">
<div class="block-container">
<span class="pull-right">
<a class='btn btn-danger' data-bind="click: $parent.deleteParameter, attr: { 'array-loc': $index() }">
<i class='icon-trash icon-white'></i>
Delete
</a>
</span>
</div>
</div>
</div>
<div class="accordion-body collapse" data-bind="attr: { id: id() }">
<div class="accordion-inner">
<div data-bind="template: { name: 'data-node' }"></div>
</div>
</div>
</div>
</div>
</script>
<script type="text/html" id='data-node'>
<div class='control-group'>
<label class='control-label'> Parameter Name </label>
<div class='controls'>
<input data-bind="value: Name" />
</div>
</div>
<div class='control-group'>
<label class='control-label'> Description </label>
<div class='controls'>
<textarea data-bind="value: Description" class="span8"></textarea>
</div>
</div>
<div class='control-group'>
<label class='control-label'> Required </label>
<div class='controls'>
<select data-bind="{ 'options': ['true', 'false'], 'value': Required }"></select>
</div>
</div>
<div class='control-group'>
<label class='control-label'> Default Value </label>
<div class='controls'>
<input data-bind="value: Default" />
</div>
</div>
<div class='control-group'>
<label class='control-label'> Data Type </label>
<div class='controls' data-bind="template: { name: typeInput }"></div>
</div>
<!-- ko if: $data instanceof Parameter -->
<div class='control-group'>
<label class='control-label'> Location </label>
<div class='controls'>
<select data-bind="{ 'options': availableLocations, 'value': Location }"></select>
</div>
</div>
<!-- /ko -->
</script>
<script type="text/html" id='list-parameter-type-input'>
<select data-bind="{ 'options': availableTypes, 'value': Type }"></select>
</script>
<script type="text/html" id='freeform-parameter-type-input'>
<input data-bind="value: Type" />
</script>
</div>
</body>