cpee-model-management 1.2.8 → 1.2.10

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.
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({
@@ -195,28 +208,47 @@ $(document).ready(function() {
195
208
  const queryString = window.location.search;
196
209
  const urlParams = new URLSearchParams(queryString);
197
210
 
198
- gstage = urlParams.get('stage') || 'draft';
199
- gdir = urlParams.get('dir') ? (urlParams.get('dir') + '/').replaceAll(/\/+/g,'/') : '';
200
-
201
- moma_init();
202
-
203
211
  var shifts = []
212
+ var default_view;
213
+
204
214
  $.ajax({
205
215
  type: "GET",
206
216
  url: "server/",
207
- data: { stages: 'stages' },
217
+ data: { stages: 'default' },
208
218
  success: (r) => {
209
- shifts = shifts.concat(r);
210
- shifts = shifts.filter(item => item !== gstage);
219
+ default_view = r[0];
220
+ console.log(default_view);
221
+
222
+ gstage = urlParams.get('stage') || default_view;
223
+ gdir = urlParams.get('dir') ? (urlParams.get('dir') + '/').replaceAll(/\/+/g,'/') : '';
224
+
225
+ moma_init();
226
+
227
+ $('ui-behind span').text(gstage);
228
+
229
+ paint(gdir,gstage);
230
+ setInterval(possibly_paint,1000);
231
+
232
+ $.ajax({
233
+ type: "GET",
234
+ url: "server/",
235
+ data: { stages: 'all' },
236
+ success: (r) => {
237
+ shifts = shifts.concat(r);
238
+ shifts = shifts.filter(item => item !== gstage);
239
+ if (shifts.length == 0) {
240
+ $('ui-behind span').hide();
241
+ }
242
+ }
243
+ });
211
244
  }
212
245
  });
213
246
 
214
247
  window.onpopstate = function(e){
215
- let d = e.state || { gstage: 'draft', 'gdir': '' };
248
+ let d = e.state || { gstage: default_view, 'gdir': '' };
216
249
  paint(d.gdir,d.gstage,false);
217
250
  };
218
251
 
219
- $('ui-behind span').text(gstage);
220
252
  $('ui-behind span').click((e) => {
221
253
  if (shifts.length > 0) {
222
254
  var menu = {};
@@ -226,7 +258,7 @@ $(document).ready(function() {
226
258
  {
227
259
  'label': ele,
228
260
  'function_call': change_it,
229
- 'text_icon': '➔',
261
+ 'text_icon': '<i class="uidash-icon uidash-icon-value"></i>',
230
262
  'type': undefined,
231
263
  'class': 'capitalized',
232
264
  'params': [gdir,ele]
@@ -238,41 +270,32 @@ $(document).ready(function() {
238
270
  });
239
271
 
240
272
  $('#models').on('click','[data-class=model]',(e) => {
241
- const tar = $(e.currentTarget);
242
- tar.toggleClass('selected');
243
- if (tar.hasClass('selected')) {
244
- selections.push(tar.attr('data-path'));
245
- } else {
246
- selections = selections.filter(item => item !== tar.attr('data-path'));
247
- }
248
- if (selections.length > 0) {
249
- $('[data-class=special]').attr('class','');
250
- } else {
251
- $('[data-class=special]').attr('class','invisible');
252
- }
273
+ mark_it($(e.currentTarget));
253
274
  });
254
275
  $('#models').on('click','th[data-class=special]',(e) => {
255
276
  var menu = {};
256
277
  var name = $(e.currentTarget).parents('tr').find('td[data-class=name]').attr('data-full-name');
257
- menu['Operations'] = [
278
+ var dirs = new Set(selections.map(item => item.replace(/[^\/]*$/,''))).size;
279
+ var head = 'Operations (' + selections.length + (selections.length == 1 ? ' entry' : ' entries') + ' in ' + dirs + (dirs == 1 ? ' dir' : ' dirs') + ' marked)';
280
+ menu[head] = [
258
281
  {
259
282
  'label': 'Move all marked entries to the current directory',
260
283
  'function_call': move_all,
261
- 'text_icon': '⨀',
284
+ 'text_icon': '<i class="uidash-icon uidash-icon-move"></i>',
262
285
  'type': undefined,
263
286
  'params': []
264
287
  },
265
288
  {
266
289
  'label': 'Copy all marked entries to the current directory',
267
290
  'function_call': copy_all,
268
- 'text_icon': '⨁',
291
+ 'text_icon': '<i class="uidash-icon uidash-icon-copy"></i>',
269
292
  'type': undefined,
270
293
  'params': []
271
294
  },
272
295
  {
273
296
  'label': 'Delete all marked entries',
274
297
  'function_call': delete_all,
275
- 'text_icon': '❌',
298
+ 'text_icon': '<i class="uidash-icon uidash-icon-delete"></i>',
276
299
  'type': undefined,
277
300
  'params': []
278
301
  },
@@ -280,7 +303,7 @@ $(document).ready(function() {
280
303
  'label': 'Unmarked all marked entries',
281
304
  'function_call': unmark_all,
282
305
  'type': undefined,
283
- 'text_icon': '🟥',
306
+ 'text_icon': '<i class="uidash-icon uidash-icon-checkox"></i>',
284
307
  'params': []
285
308
  }
286
309
  ];
@@ -291,7 +314,7 @@ $(document).ready(function() {
291
314
  {
292
315
  'label': 'Shift all marked entries to ' + ele,
293
316
  'function_call': shift_all,
294
- 'text_icon': '➔',
317
+ 'text_icon': '<i class="uidash-icon uidash-icon-shift"></i>',
295
318
  'type': undefined,
296
319
  'params': [ele]
297
320
  }
@@ -301,15 +324,22 @@ $(document).ready(function() {
301
324
  new CustomMenu(e).contextmenu(menu);
302
325
  });
303
326
 
304
- $('#models').on('click','td[data-class=ops]',(e) => {
327
+ $(document).on('contextmenu',(e) => { e.preventDefault(); });
328
+ $(document).on('mousedown',(e) => { $('#models tr.active').removeClass('active'); }); // CustomMenu closes on mousedown
329
+
330
+ $('#models').on('click','td[data-class=ops]',ops_menu);
331
+ $('#models').on('contextmenu','tbody tr',ops_menu);
332
+ function ops_menu(e) {
333
+ e.preventDefault();
305
334
  var menu = {};
306
- var name = $(e.currentTarget).parents('tr').find('td[data-class=name]').attr('data-full-name');
307
- var is_model = $(e.currentTarget).parents('tr').find('td[data-class=model]').length > 0 ? true : false;
335
+ var name = $(e.currentTarget).closest('tr').find('td[data-class=name]').attr('data-full-name');
336
+ var mark = $(e.currentTarget).closest('tr').find('td[data-class=model]');
337
+ var is_model = mark.length > 0 ? true : false;
308
338
  menu['Operations'] = [
309
339
  {
310
340
  'label': 'Delete',
311
341
  'function_call': delete_it,
312
- 'text_icon': '❌',
342
+ 'text_icon': '<i class="uidash-icon uidash-icon-delete"></i>',
313
343
  'type': undefined,
314
344
  'params': [name]
315
345
  },
@@ -317,7 +347,7 @@ $(document).ready(function() {
317
347
  'label': 'Rename',
318
348
  'function_call': rename_it,
319
349
  'type': undefined,
320
- 'text_icon': '📛',
350
+ 'text_icon': '<i class="uidash-icon uidash-icon-rename"></i>',
321
351
  'params': [name]
322
352
  }
323
353
  ];
@@ -326,12 +356,23 @@ $(document).ready(function() {
326
356
  {
327
357
  'label': 'Duplicate',
328
358
  'function_call': duplicate_it,
329
- 'text_icon': '➕',
359
+ 'text_icon': '<i class="uidash-icon uidash-icon-copy"></i>',
330
360
  'type': undefined,
331
361
  'params': [name]
332
362
  }
333
363
  );
334
364
  }
365
+ if (is_model) {
366
+ menu['Marking'] = [
367
+ {
368
+ 'label': mark.hasClass('selected') ? 'Unmark' : 'Mark',
369
+ 'function_call': mark_it,
370
+ 'text_icon': '<i class="uidash-icon uidash-icon-' + (mark.hasClass('selected') ? 'checkox' : 'checkox-checked') + '"></i>',
371
+ 'type': undefined,
372
+ 'params': [mark]
373
+ }
374
+ ];
375
+ }
335
376
  if (shifts.length > 0 && is_model) {
336
377
  menu['Shifting'] = [];
337
378
  shifts.forEach(ele => {
@@ -339,17 +380,16 @@ $(document).ready(function() {
339
380
  {
340
381
  'label': 'Shift to ' + ele,
341
382
  'function_call': shift_it,
342
- 'text_icon': '➔',
383
+ 'text_icon': '<i class="uidash-icon uidash-icon-shift"></i>',
343
384
  'type': undefined,
344
385
  'params': [name,ele]
345
386
  }
346
387
  );
347
388
  });
348
389
  }
390
+ $(e.currentTarget).closest('tr').addClass('active');
349
391
  new CustomMenu(e).contextmenu(menu);
350
- });
351
-
352
- paint(gdir,gstage);
392
+ }
353
393
 
354
394
  $('#newmod').on('submit',(e) => {
355
395
  $.ajax({
@@ -374,6 +414,4 @@ $(document).ready(function() {
374
414
  });
375
415
  return false;
376
416
  });
377
-
378
- setInterval(possibly_paint,1000);
379
417
  });
data/ui/resources.html CHANGED
@@ -26,32 +26,14 @@
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
28
  <script type="text/javascript" src="/js_libs/jquery.browser.js"></script>
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>
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.8
4
+ version: 1.2.10
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
- - LGPL-3.0
102
+ - GPL-3.0-or-later
103
103
  metadata: {}
104
104
  rdoc_options: []
105
105
  require_paths: