cpee-model-management 1.2.9 → 1.2.11
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.
- checksums.yaml +4 -4
- data/LICENSE +668 -159
- data/README.md +1 -1
- data/cpee-model-management.gemspec +2 -2
- data/lib/cpee-model-management/implementation.rb +62 -8
- data/lib/cpee-model-management/implementation.xml +8 -0
- data/ui/css/moma.css +20 -2
- data/ui/css/stats.css +10 -1
- data/ui/index.html +49 -26
- data/ui/instances.html +1 -19
- data/ui/instances_view.html +1 -19
- data/ui/js/moma.js +96 -27
- data/ui/js/stats.js +4 -4
- data/ui/resources.html +1 -19
- metadata +2 -2
data/ui/js/moma.js
CHANGED
|
@@ -86,6 +86,19 @@ function duplicate_it(name) {
|
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
+
function mark_it(tar) {
|
|
90
|
+
tar.toggleClass('selected');
|
|
91
|
+
if (tar.hasClass('selected')) {
|
|
92
|
+
selections.push(tar.attr('data-path'));
|
|
93
|
+
} else {
|
|
94
|
+
selections = selections.filter(item => item !== tar.attr('data-path'));
|
|
95
|
+
}
|
|
96
|
+
if (selections.length > 0) {
|
|
97
|
+
$('[data-class=special]').attr('class','');
|
|
98
|
+
} else {
|
|
99
|
+
$('[data-class=special]').attr('class','invisible');
|
|
100
|
+
}
|
|
101
|
+
}
|
|
89
102
|
function delete_it(name) {
|
|
90
103
|
if (confirm('Are you really, really, REALLY sure!')) {
|
|
91
104
|
$.ajax({
|
|
@@ -187,6 +200,47 @@ function paint(pdir,gstage,statesave=true) {
|
|
|
187
200
|
});
|
|
188
201
|
}
|
|
189
202
|
|
|
203
|
+
function show_dir(dir) {
|
|
204
|
+
paint(dir,gstage);
|
|
205
|
+
uidash_activate_tab($('ui-tab').first());
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function search(term) {
|
|
209
|
+
$.ajax({
|
|
210
|
+
type: "GET",
|
|
211
|
+
url: "server/" + gdir,
|
|
212
|
+
data: { search: term, stage: gstage },
|
|
213
|
+
success: function(res) {
|
|
214
|
+
$('#searchresults tbody').empty();
|
|
215
|
+
const rank = (data) => data.type == 'dir' ? 0 : (data['name_match'] ? 1 : 2);
|
|
216
|
+
res.sort((a,b) => rank(a) - rank(b));
|
|
217
|
+
let tempcont = $();
|
|
218
|
+
$(res).each(function(k,data) {
|
|
219
|
+
let pdir = data['path'].replace(/[^\/]*$/,'');
|
|
220
|
+
var clone = document.importNode(document.querySelector('#searchresult').content,true);
|
|
221
|
+
if (data.type == 'dir') {
|
|
222
|
+
$('[data-class=name] a',clone).text(data['name'].replace(/\.dir$/,'') + '/');
|
|
223
|
+
$('[data-class=name] a',clone).attr('href','javascript:show_dir("' + data['path'] + '")');
|
|
224
|
+
} else {
|
|
225
|
+
$('[data-class=name] a',clone).text(data['name']);
|
|
226
|
+
$('[data-class=name] a',clone).attr('href','server/' + data['path'] + '/open?stage=' + gstage);
|
|
227
|
+
$('[data-class=name] a',clone).attr('target','_blank');
|
|
228
|
+
}
|
|
229
|
+
$('[data-class=dir] a',clone).text('/' + pdir.replace(/\.dir/g,''));
|
|
230
|
+
$('[data-class=dir] a',clone).attr('href','javascript:show_dir("' + pdir + '")');
|
|
231
|
+
let found = [];
|
|
232
|
+
if (data['name_match']) { found.push(data.type == 'dir' ? 'directory' : 'name'); }
|
|
233
|
+
if (data['content_matches'] > 0) { found.push('content (' + data['content_matches'] + (data['content_matches'] == 1 ? ' time)' : ' times)')); }
|
|
234
|
+
$('[data-class=found]',clone).text(found.join(', '));
|
|
235
|
+
$('[data-class=author]',clone).text(data['author'] || data['creator']);
|
|
236
|
+
$('[data-class=date]',clone).text(new Date(data['date']).strftime('%Y-%m-%d, %H:%M:%S'));
|
|
237
|
+
tempcont.push(clone);
|
|
238
|
+
});
|
|
239
|
+
$('#searchresults tbody').append(tempcont);
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
|
|
190
244
|
function change_it(gdir,gstage) {
|
|
191
245
|
window.location.href = window.location.pathname + '?stage=' + gstage + '&dir=' + gdir;
|
|
192
246
|
}
|
|
@@ -245,7 +299,7 @@ $(document).ready(function() {
|
|
|
245
299
|
{
|
|
246
300
|
'label': ele,
|
|
247
301
|
'function_call': change_it,
|
|
248
|
-
'text_icon': '
|
|
302
|
+
'text_icon': '<i class="uidash-icon uidash-icon-value"></i>',
|
|
249
303
|
'type': undefined,
|
|
250
304
|
'class': 'capitalized',
|
|
251
305
|
'params': [gdir,ele]
|
|
@@ -257,41 +311,32 @@ $(document).ready(function() {
|
|
|
257
311
|
});
|
|
258
312
|
|
|
259
313
|
$('#models').on('click','[data-class=model]',(e) => {
|
|
260
|
-
|
|
261
|
-
tar.toggleClass('selected');
|
|
262
|
-
if (tar.hasClass('selected')) {
|
|
263
|
-
selections.push(tar.attr('data-path'));
|
|
264
|
-
} else {
|
|
265
|
-
selections = selections.filter(item => item !== tar.attr('data-path'));
|
|
266
|
-
}
|
|
267
|
-
if (selections.length > 0) {
|
|
268
|
-
$('[data-class=special]').attr('class','');
|
|
269
|
-
} else {
|
|
270
|
-
$('[data-class=special]').attr('class','invisible');
|
|
271
|
-
}
|
|
314
|
+
mark_it($(e.currentTarget));
|
|
272
315
|
});
|
|
273
316
|
$('#models').on('click','th[data-class=special]',(e) => {
|
|
274
317
|
var menu = {};
|
|
275
318
|
var name = $(e.currentTarget).parents('tr').find('td[data-class=name]').attr('data-full-name');
|
|
276
|
-
|
|
319
|
+
var dirs = new Set(selections.map(item => item.replace(/[^\/]*$/,''))).size;
|
|
320
|
+
var head = 'Operations (' + selections.length + (selections.length == 1 ? ' entry' : ' entries') + ' in ' + dirs + (dirs == 1 ? ' dir' : ' dirs') + ' marked)';
|
|
321
|
+
menu[head] = [
|
|
277
322
|
{
|
|
278
323
|
'label': 'Move all marked entries to the current directory',
|
|
279
324
|
'function_call': move_all,
|
|
280
|
-
'text_icon': '
|
|
325
|
+
'text_icon': '<i class="uidash-icon uidash-icon-move"></i>',
|
|
281
326
|
'type': undefined,
|
|
282
327
|
'params': []
|
|
283
328
|
},
|
|
284
329
|
{
|
|
285
330
|
'label': 'Copy all marked entries to the current directory',
|
|
286
331
|
'function_call': copy_all,
|
|
287
|
-
'text_icon': '
|
|
332
|
+
'text_icon': '<i class="uidash-icon uidash-icon-copy"></i>',
|
|
288
333
|
'type': undefined,
|
|
289
334
|
'params': []
|
|
290
335
|
},
|
|
291
336
|
{
|
|
292
337
|
'label': 'Delete all marked entries',
|
|
293
338
|
'function_call': delete_all,
|
|
294
|
-
'text_icon': '
|
|
339
|
+
'text_icon': '<i class="uidash-icon uidash-icon-delete"></i>',
|
|
295
340
|
'type': undefined,
|
|
296
341
|
'params': []
|
|
297
342
|
},
|
|
@@ -299,7 +344,7 @@ $(document).ready(function() {
|
|
|
299
344
|
'label': 'Unmarked all marked entries',
|
|
300
345
|
'function_call': unmark_all,
|
|
301
346
|
'type': undefined,
|
|
302
|
-
'text_icon': '
|
|
347
|
+
'text_icon': '<i class="uidash-icon uidash-icon-checkox"></i>',
|
|
303
348
|
'params': []
|
|
304
349
|
}
|
|
305
350
|
];
|
|
@@ -310,7 +355,7 @@ $(document).ready(function() {
|
|
|
310
355
|
{
|
|
311
356
|
'label': 'Shift all marked entries to ' + ele,
|
|
312
357
|
'function_call': shift_all,
|
|
313
|
-
'text_icon': '
|
|
358
|
+
'text_icon': '<i class="uidash-icon uidash-icon-shift"></i>',
|
|
314
359
|
'type': undefined,
|
|
315
360
|
'params': [ele]
|
|
316
361
|
}
|
|
@@ -320,15 +365,22 @@ $(document).ready(function() {
|
|
|
320
365
|
new CustomMenu(e).contextmenu(menu);
|
|
321
366
|
});
|
|
322
367
|
|
|
323
|
-
$(
|
|
368
|
+
$(document).on('contextmenu',(e) => { e.preventDefault(); });
|
|
369
|
+
$(document).on('mousedown',(e) => { $('#models tr.active').removeClass('active'); }); // CustomMenu closes on mousedown
|
|
370
|
+
|
|
371
|
+
$('#models').on('click','td[data-class=ops]',ops_menu);
|
|
372
|
+
$('#models').on('contextmenu','tbody tr',ops_menu);
|
|
373
|
+
function ops_menu(e) {
|
|
374
|
+
e.preventDefault();
|
|
324
375
|
var menu = {};
|
|
325
|
-
var name = $(e.currentTarget).
|
|
326
|
-
var
|
|
376
|
+
var name = $(e.currentTarget).closest('tr').find('td[data-class=name]').attr('data-full-name');
|
|
377
|
+
var mark = $(e.currentTarget).closest('tr').find('td[data-class=model]');
|
|
378
|
+
var is_model = mark.length > 0 ? true : false;
|
|
327
379
|
menu['Operations'] = [
|
|
328
380
|
{
|
|
329
381
|
'label': 'Delete',
|
|
330
382
|
'function_call': delete_it,
|
|
331
|
-
'text_icon': '
|
|
383
|
+
'text_icon': '<i class="uidash-icon uidash-icon-delete"></i>',
|
|
332
384
|
'type': undefined,
|
|
333
385
|
'params': [name]
|
|
334
386
|
},
|
|
@@ -336,7 +388,7 @@ $(document).ready(function() {
|
|
|
336
388
|
'label': 'Rename',
|
|
337
389
|
'function_call': rename_it,
|
|
338
390
|
'type': undefined,
|
|
339
|
-
'text_icon': '
|
|
391
|
+
'text_icon': '<i class="uidash-icon uidash-icon-rename"></i>',
|
|
340
392
|
'params': [name]
|
|
341
393
|
}
|
|
342
394
|
];
|
|
@@ -345,12 +397,23 @@ $(document).ready(function() {
|
|
|
345
397
|
{
|
|
346
398
|
'label': 'Duplicate',
|
|
347
399
|
'function_call': duplicate_it,
|
|
348
|
-
'text_icon': '
|
|
400
|
+
'text_icon': '<i class="uidash-icon uidash-icon-copy"></i>',
|
|
349
401
|
'type': undefined,
|
|
350
402
|
'params': [name]
|
|
351
403
|
}
|
|
352
404
|
);
|
|
353
405
|
}
|
|
406
|
+
if (is_model) {
|
|
407
|
+
menu['Marking'] = [
|
|
408
|
+
{
|
|
409
|
+
'label': mark.hasClass('selected') ? 'Unmark' : 'Mark',
|
|
410
|
+
'function_call': mark_it,
|
|
411
|
+
'text_icon': '<i class="uidash-icon uidash-icon-' + (mark.hasClass('selected') ? 'checkox' : 'checkox-checked') + '"></i>',
|
|
412
|
+
'type': undefined,
|
|
413
|
+
'params': [mark]
|
|
414
|
+
}
|
|
415
|
+
];
|
|
416
|
+
}
|
|
354
417
|
if (shifts.length > 0 && is_model) {
|
|
355
418
|
menu['Shifting'] = [];
|
|
356
419
|
shifts.forEach(ele => {
|
|
@@ -358,15 +421,16 @@ $(document).ready(function() {
|
|
|
358
421
|
{
|
|
359
422
|
'label': 'Shift to ' + ele,
|
|
360
423
|
'function_call': shift_it,
|
|
361
|
-
'text_icon': '
|
|
424
|
+
'text_icon': '<i class="uidash-icon uidash-icon-shift"></i>',
|
|
362
425
|
'type': undefined,
|
|
363
426
|
'params': [name,ele]
|
|
364
427
|
}
|
|
365
428
|
);
|
|
366
429
|
});
|
|
367
430
|
}
|
|
431
|
+
$(e.currentTarget).closest('tr').addClass('active');
|
|
368
432
|
new CustomMenu(e).contextmenu(menu);
|
|
369
|
-
}
|
|
433
|
+
}
|
|
370
434
|
|
|
371
435
|
$('#newmod').on('submit',(e) => {
|
|
372
436
|
$.ajax({
|
|
@@ -391,4 +455,9 @@ $(document).ready(function() {
|
|
|
391
455
|
});
|
|
392
456
|
return false;
|
|
393
457
|
});
|
|
458
|
+
|
|
459
|
+
$('#search').on('submit',(e) => {
|
|
460
|
+
search($("#search input[name=search]").val());
|
|
461
|
+
return false;
|
|
462
|
+
});
|
|
394
463
|
});
|
data/ui/js/stats.js
CHANGED
|
@@ -98,8 +98,8 @@ function instance_upd(uuid,name,state,author,cpu,mem,time,parent) {
|
|
|
98
98
|
instance_res(uuid,cpu,mem)
|
|
99
99
|
}
|
|
100
100
|
function instance_res(uuid,cpu,mem) {
|
|
101
|
-
$('[data-id=' + uuid + '] > .cpu').text(
|
|
102
|
-
$('[data-id=' + uuid + '] > .mem').text(
|
|
101
|
+
$('[data-id=' + uuid + '] > .cpu').text(cpu.sprintf('%05.2f'))
|
|
102
|
+
$('[data-id=' + uuid + '] > .mem').text(mem.sprintf('%05.2f'))
|
|
103
103
|
}
|
|
104
104
|
function instance_add(iname,uuid,url,name,state,author,cpu,mem,time,parent) {
|
|
105
105
|
let inode = document.importNode($("#stats_instance")[0].content,true);
|
|
@@ -119,8 +119,8 @@ function instance_add(iname,uuid,url,name,state,author,cpu,mem,time,parent) {
|
|
|
119
119
|
if (author != "") {
|
|
120
120
|
$('.author',inode).text(author)
|
|
121
121
|
}
|
|
122
|
-
$('.cpu',inode).text(
|
|
123
|
-
$('.mem',inode).text(
|
|
122
|
+
$('.cpu',inode).text(cpu.sprintf('%05.2f'))
|
|
123
|
+
$('.mem',inode).text(mem.sprintf('%05.2f'))
|
|
124
124
|
$('.time',inode).text((new Date(time * 1000)).strftime("%H:%M:%S (%b-%d)"))
|
|
125
125
|
if (parent == "") {
|
|
126
126
|
$('#instances_' + iname).append(inode)
|
data/ui/resources.html
CHANGED
|
@@ -25,33 +25,15 @@
|
|
|
25
25
|
|
|
26
26
|
<!-- libs, do not modify. When local than load local libs. -->
|
|
27
27
|
<script type="text/javascript" src="/js_libs/jquery.min.js"></script>
|
|
28
|
-
<script type="text/javascript" src="/js_libs/
|
|
29
|
-
<script type="text/javascript" src="/js_libs/jquery.svg.min.js"></script>
|
|
30
|
-
<script type="text/javascript" src="/js_libs/jquery.svgdom.min.js"></script>
|
|
31
|
-
<script type="text/javascript" src="/js_libs/vkbeautify.js"></script>
|
|
32
|
-
<script type="text/javascript" src="/js_libs/util.js"></script>
|
|
33
|
-
<script type="text/javascript" src="/js_libs/printf.js"></script>
|
|
34
|
-
<script type="text/javascript" src="/js_libs/strftime.min.js"></script>
|
|
35
|
-
<script type="text/javascript" src="/js_libs/parsequery.js"></script>
|
|
36
|
-
<script type="text/javascript" src="/js_libs/underscore.min.js"></script>
|
|
37
|
-
<script type="text/javascript" src="/js_libs/jquery.caret.min.js"></script>
|
|
38
|
-
<script type="text/javascript" src="/js_libs/jquery.cookie.js"></script>
|
|
28
|
+
<script type="text/javascript" src="/js_libs/uidash_util.js"></script>
|
|
39
29
|
<script type="text/javascript" src="/js_libs/plotly.min.js"></script>
|
|
40
30
|
|
|
41
|
-
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
|
|
42
|
-
|
|
43
|
-
<script type="text/javascript" src="/js_libs/relaxngui.js"></script>
|
|
44
|
-
|
|
45
31
|
<script type="text/javascript" src="/js_libs/uidash.js"></script>
|
|
46
|
-
<script type="text/javascript" src="/js_libs/custommenu.js"></script>
|
|
47
32
|
|
|
48
|
-
<link rel="stylesheet" href="/js_libs/custommenu.css" type="text/css"/>
|
|
49
33
|
<link rel="stylesheet" href="/js_libs/uidash.css" type="text/css"/>
|
|
50
34
|
|
|
51
35
|
<link rel="stylesheet" href="/global_ui/ui.css" type="text/css"/>
|
|
52
36
|
|
|
53
|
-
<link rel="stylesheet" href="/js_libs/relaxngui.css" type="text/css"/>
|
|
54
|
-
|
|
55
37
|
<!-- custom stuff, play arround -->
|
|
56
38
|
<link rel="stylesheet" href="css/stats.css" type="text/css"/>
|
|
57
39
|
<link rel="stylesheet" href="css/stats_standalone.css" type="text/css"/>
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cpee-model-management
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.11
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Juergen eTM Mangler
|
|
@@ -99,7 +99,7 @@ files:
|
|
|
99
99
|
- ui/resources.html
|
|
100
100
|
homepage: http://cpee.org/
|
|
101
101
|
licenses:
|
|
102
|
-
-
|
|
102
|
+
- GPL-3.0-or-later
|
|
103
103
|
metadata: {}
|
|
104
104
|
rdoc_options: []
|
|
105
105
|
require_paths:
|