-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtiaSOAStructure.html
373 lines (314 loc) · 12 KB
/
tiaSOAStructure.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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="shortcut icon" href="/favicon.ico?v=1" />
<title>nutshell</title>
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<script src="https://cdn.firebase.com/js/client/2.1.2/firebase.js"></script>
<script src="../../assets/nutshell.js?v=1"></script>
<script src="../../assets/navbar.js?v=1"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css" />
<link rel="stylesheet" href="../../assets/nutshell.css" />
</head>
<body>
<div class="container" id="nsView">
<div class="row clearfix">
<div class="col-md-12 column">
<div class="jumbotron">
<h1>
<strong>nut</strong>shell
</h1>
<p>
<strong>nut</strong>shell puts you in control... <p>building applications to expose business services is time-consuming and expensive. it requires implementing standard connectivity and security on top of business logic, and designing for scalability.</p>
</p>
<p>
<a class="btn btn-primary btn-large readMore" href="#">hide this</a>
</p>
</div>
<div class="row clearfix">
<div class="col-md-6 column">
<div class="tabbable" id="tabs-979518">
<a class="disabled btn btn-primary btn-small pull-right" href="#">request a service</a>
<ul class="nav nav-tabs">
<li class="active">
<a id="compound-services-tab" href="#panel-compound" data-toggle="tab">compound</a>
</li>
<li>
<a href="#panel-enterprise" data-toggle="tab">enterprise</a>
</li>
<li>
<a href="#panel-application" data-toggle="tab">application</a>
</li>
<li>
<a href="#panel-soaif" data-toggle="tab">soaif</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="panel-compound">
<br>
<div id="compoundServices"></div>
</div>
<div class="tab-pane" id="panel-enterprise">
<br>
<div id="enterpriseServices"></div>
</div>
<div class="tab-pane" id="panel-application">
<br>
<div id="applicationServices"></div>
</div>
<div class="tab-pane" id="panel-soaif">
<br>
<div id="soaifServices"></div>
</div>
</div>
</div>
</div>
<div class="col-md-6 column">
<div class="tabbable" id="tabs-97951800000">
<!-- <a class="btn btn-primary btn-small pull-right" href="#">help</a> -->
<ul class="nav nav-tabs">
<li class="active">
<a id="resources-tab" href="#panel-resources" data-toggle="tab">resources</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="panel-resources">
<div class="col-md-2 column">
<h2>
<span class="glyphicon glyphicon-menu-right"></span>
</h2>
</div>
<div class="col-md-10 column">
<br>
<div class="resourceList">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-md-12 column">
<div class="page-header">
<h1><small>what the professionals say...</small></h1>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-md-6 column">
<blockquote>
<p>
<strong>nut</strong>shell saved my life on numerous ocasions.<br>2000 thumbs up!
</p> <small>Stevie Wonder</small>
</blockquote>
<blockquote>
<p>
this <strong>nut</strong>shell thing is grrrrreat hey...
</p> <small>Bakkies Botha</small>
</blockquote>
<blockquote>
<p>
i use <strong>nut</strong>shell to run ALL my companies
</p> <small>Bill Gates</small>
</blockquote>
</div>
<div class="col-md-6 column">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
convenient web search
</h3>
<div class="pull-right">
<input type="text" id="websearchquery" placeholder="search query" value="how to demo">
<a id="websearchbutton" class="btn btn-primary btn-xs" href="#">search</a>
</div>
</div>
<div id="searchResults" class="panel-body">
<span>enter a query and click search</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
/** #nsData */
var nsCache = { serviceType: {} };
var currentPath = nsData.request.path.split('/').splice(0, 2).join(' > ');
var url = 'http://localhost:8080/nutshell/'; //FIX! get this from nsData.request!
function populateEducation(education) {
var educationHtml = $('<form></form>');
var ctr = 0;
for(var key in education) {
var input = education[key];
var inputHtml = '<div class="form-group">';
inputHtml += '<label for="input' + key + ctr + '" class="control-label">' + key + '</label>';
inputHtml += '<input type="text" data-name="' + key + '" placeholder="' + input.description + '" class="nsInput form-control" id="input' + key + ctr + '" />';
inputHtml += '</div>';
educationHtml.append(inputHtml);
}
return educationHtml.html();
}
function populateResources(data, serviceName) {
var ul = $('<ul class="noBullets"></ul>');
$('.resourceList').html(ul);
if (!data || !data.resource) {
console.log('satan dwells on this page...');
}
data.resource.forEach(function(resource) {
var resourceUrl = url + serviceName + '/' + resource.name;
console.log('kwagga', serviceName);
// if (serviceName === 'soaif') {
// resourceUrl = url + 'soaif_' + serviceName + '/' + resource.name;
// }
var resourceLink = $('<li class="nsResource"><a href="#">' + resource.name + '</a></li>');
// resourceLink.find('a').hover(
// function() {
// $('#searchBar').val(serviceName + ' > ' + resource.name);
// },
// function() {
// $('#searchBar').val(currentPath);
// }
resourceLink.find('a').click(function() {
function invokeService() {
//var $form = $('nsModal > .modal-dialog > .modal-content > .modal-body');
var queryString = '';
$('.nsInput').each(function(ctr, item) {
var $item = $(item);
queryString += $item.data('name') + '=' + $item.val() + '&';
});
window.open(resourceUrl + '.view?' + queryString);
}
var path = serviceName + ' > ' + resource.name;
if (!resource.education) {
console.log('loading the education');
$.get(resourceUrl + '?educateme=1', function(data) {
resource.education = data.education;
resource.educationHtml = populateEducation(resource.education);
delete resource.education.request;
nsModal({
titleHtml: '<span><strong>nut</strong>shell > ' + path + '</span>',
messageHtml: resource.educationHtml,
buttons: [
$('<button type="button" class="btn btn-default" data-dismiss="modal">cancel</button>'),
$('<button type="button" data-dismiss="modal" class="btn btn-primary">invoke</button>').click(function() {
invokeService();
})
]
});
});
} else {
nsModal({
titleHtml: '<span><strong>nut</strong>shell > ' + path + '</span>',
messageHtml: resource.educationHtml,
buttons: [
$('<button type="button" class="btn btn-default" data-dismiss="modal">cancel</button>'),
$('<button type="button" data-dismiss="modal" class="btn btn-primary">invoke</button>').click(function() {
invokeService();
})
]
});
}
});
ul.append(resourceLink);
});
//$('.resourceList').html(JSON.stringify(data));
}
function listServices(serviceType, parent) {
$.get(url + 'soaif/service?type=' + serviceType, function(data) {
nsCache.serviceType[serviceType] = data;
delete nsCache.serviceType[serviceType].request;
var ul = $('<ul class="noBullets"></ul>');
$('#' + serviceType + 'Services').append(ul);
data.services.service.forEach(function(service) {
var resourceUrl = url + service.name + '/resources';
var imageSize = serviceType === 'compound' ? 25 : 15;
var serviceLink = $('<li class="nsService"><a href="#"><img style="width: ' + imageSize + 'px;" src="../../assets/' + service.type + '.png" />' + service.name.replace(/.js/gi, '') + '</a></li>');
if (serviceType === 'soaif') {
//serviceLink.data('soaif');
resourceUrl = url + 'soaif/resources';
}
// serviceLink.find('a').hover(
// function() {
// $('#searchBar').val($(this).text() + ' > ');
// },
// function() {
// $('#searchBar').val(currentPath);
// }
serviceLink.find('a').click(function() {
if (!service.resources) {
console.log('kyk man', resourceUrl);
$.get(resourceUrl, function(data) {
if (!data || !data.resources) {
console.log('die vark gebeur hier!!');
}
service.resources = data.resources;
populateResources(service.resources, service.name);
});
} else {
console.log('reasources in cache');
populateResources(service.resources, service.name);
}
});
ul.append(serviceLink);
});
});
}
$('document').ready(nutshell({ navbar : true }, function() {
listServices('compound');
listServices('enterprise');
listServices('application');
listServices('soaif');
}));
$('.readMore').click(function() {
$('.jumbotron').hide();
});
$('#websearchbutton').click(function(evt) {
evt.preventDefault();
var url = 'http://localhost:8080/nutshell/websearch/results?query=' + $('#websearchquery').val();
$.get(url, function(data) {
if (data) {
$('#searchResults').empty();
searchResults = '';
var ctr = 0;
data.results.result.forEach(function(item) {
ctr++;
var url = (item.url || 'http://www.sunfork.com/#news');
var parts = url.replace('http://', '').replace('https://', '').split('.');
// console.log('url', url);
// console.log('parts...', parts[0], parts[1], parts[2], parts.lenght + ' in total');
//parts[0] = parts[0].replace('www.', '');
if (parts[0] === 'www') {
parts.splice(0, 1);
// console.log('REVISED parts...', parts[0], parts[1], parts[2]);
}
// console.log('klaar'); //wont work for www22.xxx
var friendlyUrl = (parts[0] + '.' + parts[1]);
var searchResults = $('<div><a alt="' + item.description + '" target="_blank" href="' + url + '">' + ctr + ') ' + item.name.substring(0, 55) + '</a> <span class="pull-right">' + friendlyUrl.substring(0, 30) + '</span><div>');
searchResults.find('>a').click(function(evt) {
evt.preventDefault();
console.log($(this).attr('href'));
var external = $('<div class="container"><iframe style="width: ' + searchResults.parent().css('width') + '" /></div>');
external.find('>iframe').attr('src', item.url);
nsModal({
titleHtml: friendlyUrl,
messageHtml: external.get(),
buttons: [
$('<button type="button" class="btn btn-default" data-dismiss="modal">close</button>')
]
});
});
$('#searchResults').append(searchResults);
});
}
});
});
</script>
</body>
</html>