cpee-model-management 1.0.11 → 1.0.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4c7144bdbca2c93817e6acdbac14bc06df366017a3ba5546c50d39ff6d42d6b9
4
- data.tar.gz: 287318a851e666f4442d88b75b87bc13cfd5983a2aa2bdb2fe1c8a980d24cacc
3
+ metadata.gz: 3f01249cf02b86d83022b913a2b81ebcfd06e48f19eb307bcf8645c619260da7
4
+ data.tar.gz: '08805c52f1143242b9e2f675886ab894d33fe28f5a05cc4408e0563eac592937'
5
5
  SHA512:
6
- metadata.gz: db79d873a4ba7466a855b9271d0f08089d691ad5486d682ce852bbca7454d2d494c5d11cd2c9567295acffc90b2fb8cbabbbd31f97e80a55ec8bc232ee54f8aa
7
- data.tar.gz: 2a7317f8fd20c26558b515937a42f4770c8d0d6c2be19e5e798865bec455ff1e3adcf3df9525690e6be50b4a0d9a628f1109be4c0a630483fbe1cd5fcb2dfa01
6
+ metadata.gz: 4ea1643623a79c0ad75814965d0ed339591767f7c7d423c4d5f0a15dd88eb4f2626c0246b3f4e72a24989aff9dc8eb6cca2f5f72bea0751f6f0831ee437e5db7
7
+ data.tar.gz: a36b6d9995c293f6ed8c2eca53ed0231c74cf1a44b07a3e53bd50e6c958349612fd71ce586e1cba65989a334148e35ae7752ca0eaddcd615bfc812ddf9d8084f
@@ -1,13 +1,13 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cpee-model-management"
3
- s.version = "1.0.11"
3
+ s.version = "1.0.12"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3.0"
6
6
  s.summary = "(Lifecycle) manage your process models in a directory or git repo."
7
7
 
8
8
  s.description = "see http://cpee.org"
9
9
 
10
- s.files = Dir['{server/*,tools/**/*,lib/**/*}'] + %w(LICENSE Rakefile cpee-model-management.gemspec README.md AUTHORS)
10
+ s.files = Dir['{server/*,tools/**/*,lib/**/*,ui/**/*}'] + %w(LICENSE Rakefile cpee-model-management.gemspec README.md AUTHORS)
11
11
  s.require_path = 'lib'
12
12
  s.extra_rdoc_files = ['README.md']
13
13
  s.bindir = 'tools'
data/ui/css/design.css ADDED
@@ -0,0 +1,50 @@
1
+ td {
2
+ padding-right: 1em;
3
+ }
4
+
5
+ td[data-class=model] {
6
+ font-size: 1.7em;
7
+ }
8
+ td[data-class=folder] {
9
+ font-size: 1.7em;
10
+ }
11
+ td[data-class=ops] {
12
+ cursor: pointer;
13
+ }
14
+
15
+ td[draggable] {
16
+ cursor: move;
17
+ }
18
+
19
+ form input {
20
+ width: 45em !important;
21
+ }
22
+
23
+ ui-behind {
24
+ text-transform: capitalize;
25
+ }
26
+
27
+ [is="x-ui-"] table.ui-table {
28
+ border-collapse: collapse;
29
+ }
30
+ [is="x-ui-"] table.ui-table thead th {
31
+ font-weight: bold;
32
+ text-align: left;
33
+ padding: 0.3em 0.5em;
34
+ }
35
+ [is="x-ui-"] table.ui-table tbody td {
36
+ padding: 0.1em 0.5em;
37
+ }
38
+ [is="x-ui-"] table.ui-table tbody tr:nth-child(odd) td {
39
+ background-color: var(--x-ui-content-light-background);
40
+ }
41
+ [is="x-ui-"] table.ui-table tbody tr:hover td {
42
+ background-color: var(--x-ui-content-hover-background);
43
+ }
44
+
45
+ [is="x-ui-"] table.ui-table tbody tr:nth-child(odd) td[data-class=ops] {
46
+ background-color: #d0d0d0;
47
+ }
48
+ [is="x-ui-"] table.ui-table tbody tr:hover td[data-class=ops] {
49
+ background-color: #99cee6b0;
50
+ }
data/ui/index.html ADDED
@@ -0,0 +1,151 @@
1
+ <!--
2
+ This file is part of CPEE-MODEL-MANAGEMENT.
3
+
4
+ CPEE-MODEL-MANAGEMENT is free software: you can redistribute it and/or
5
+ modify it under the terms of the GNU General Public License as published by
6
+ the Free Software Foundation, either version 3 of the License, or (at your
7
+ option) any later version.
8
+
9
+ CPEE-MODEL-MANAGEMENT is distributed in the hope that it will be useful, but
10
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
+ more details.
13
+
14
+ You should have received a copy of the GNU General Public License along with
15
+ CPEE-MODEL-MANAGEMENT (file LICENSE in the main directory). If not, see
16
+ <http://www.gnu.org/licenses/>.
17
+ -->
18
+
19
+ <!DOCTYPE html>
20
+ <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
21
+ <head>
22
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
23
+ <title>Design</title>
24
+
25
+ <!-- libs, do not modify. When local than load local libs. -->
26
+ <script type="text/javascript" src="/js_libs/jquery.min.js"></script>
27
+ <script type="text/javascript" src="/js_libs/jquery.browser.js"></script>
28
+ <script type="text/javascript" src="/js_libs/jquery.svg.min.js"></script>
29
+ <script type="text/javascript" src="/js_libs/jquery.svgdom.min.js"></script>
30
+ <script type="text/javascript" src="/js_libs/vkbeautify.js"></script>
31
+ <script type="text/javascript" src="/js_libs/util.js"></script>
32
+ <script type="text/javascript" src="/js_libs/printf.js"></script>
33
+ <script type="text/javascript" src="/js_libs/strftime.min.js"></script>
34
+ <script type="text/javascript" src="/js_libs/parsequery.js"></script>
35
+ <script type="text/javascript" src="/js_libs/underscore.min.js"></script>
36
+ <script type="text/javascript" src="/js_libs/jquery.caret.min.js"></script>
37
+ <script type="text/javascript" src="/js_libs/jquery.cookie.js"></script>
38
+
39
+ <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
40
+
41
+ <script type="text/javascript" src="/js_libs/relaxngui.js"></script>
42
+
43
+ <script type="text/javascript" src="/js_libs/uidash.js"></script>
44
+ <script type="text/javascript" src="/js_libs/custommenu.js"></script>
45
+
46
+ <link rel="stylesheet" href="/js_libs/custommenu.css" type="text/css"/>
47
+ <link rel="stylesheet" href="/js_libs/uidash.css" type="text/css"/>
48
+
49
+ <link rel="stylesheet" href="/global_ui/ui.css" type="text/css"/>
50
+
51
+ <link rel="stylesheet" href="/js_libs/relaxngui.css" type="text/css"/>
52
+
53
+ <!-- custom stuff, play arround -->
54
+ <link rel="stylesheet" href="css/design.css" type="text/css"/>
55
+ <script type="text/javascript" src="js/design.js"></script>
56
+ </head>
57
+ <body is="x-ui-">
58
+ <ui-rest id="main">
59
+ <ui-tabbar>
60
+ <ui-before ></ui-before>
61
+ <ui-tab class="" data-tab="models" >Models</ui-tab>
62
+ <ui-tab class="inactive" data-tab="newmodel">New Model</ui-tab>
63
+ <ui-tab class="inactive" data-tab="newdir" >New Dir</ui-tab>
64
+ <ui-behind ></ui-behind>
65
+ <ui-last ><a class="logo" href=".."></a></ui-last>
66
+ </ui-tabbar>
67
+ <ui-content class="noselect">
68
+ <ui-area data-belongs-to-tab="models">
69
+ <p>Your Models are saved/versioned in <a target='_blank' href='https://git-scm.com/'>GIT</a>. So fret not. Just send an email to <a href="mail:helpdesk@acdp.at">helpdesk@acdp.at</a> if you are lost. And as always: <a target='_blank' href='https://www.youtube.com/watch?v=kkxj5xVLyj0&feature=youtu.be&t=56'>get dressed for success</a>.</p>
70
+ <table id="models" class='ui-table'>
71
+ <template id="up">
72
+ <tr>
73
+ <td data-class='folder' class="noselect">📁</td>
74
+ <td data-class='name' data-full-name=''><a href=''></a></td>
75
+ <td></td>
76
+ <td></td>
77
+ <td data-class='creator'></td>
78
+ <td></td>
79
+ <td data-class='date'></td>
80
+ <td data-class=''></td>
81
+ </tr>
82
+ </template>
83
+ <template id="folder">
84
+ <tr>
85
+ <td data-class='folder' class="noselect">📁</td>
86
+ <td data-class='name' data-full-name=''><a href=''></a></td>
87
+ <td></td>
88
+ <td></td>
89
+ <td data-class='creator'></td>
90
+ <td></td>
91
+ <td data-class='date'></td>
92
+ <td data-class='ops' class="noselect"><span>…</span></td>
93
+ </tr>
94
+ </template>
95
+ <template id="model">
96
+ <tr>
97
+ <td data-class='model' class="noselect" draggable="true" title='drag to folders to move'>𝌭</td>
98
+ <td data-class='name' data-full-name=''><a target='_blank' href=''></a></td>
99
+ <td data-class='force'>[<a target='_blank' href='' title='force new instance'>F</a>]</td>
100
+ <td data-class='raw'>[<a target='_blank' href='' title='link to model source'>M</a>]</td>
101
+ <td data-class='creator'></td>
102
+ <td data-class='author'></td>
103
+ <td data-class='date'></td>
104
+ <td data-class='ops' class="noselect"><span>…</span></td>
105
+ </tr>
106
+ </template>
107
+ <tbody>
108
+ </tbody>
109
+ </table>
110
+ </ui-area>
111
+ <ui-area data-belongs-to-tab="newmodel" class="inactive">
112
+ <p>
113
+ Create an empty model. Beware, if a model of the same name already
114
+ exists in one of the categories (e.g. draft, development,
115
+ production, archive) it can not be created. To protect you from
116
+ getting confused and shooting yourself in the foot in your little
117
+ modelling world we allow only unique names. Better safe than sorry.
118
+ </p>
119
+ <form id="newmod">
120
+ <input type="hidden" name="stage" value=""/>
121
+ <input type="hidden" name="dir" value=""/>
122
+ <p>
123
+ <input type="text" name="new" required pattern="^[a-zA-Z0-9öäüÖÄÜ _-]+" placeholder="Filename (no extension necessary). Only use characters, spaces, underlines and dashes."/>
124
+ </p>
125
+ <p>
126
+ <button>New Model</button>
127
+ </p>
128
+ </form>
129
+ </ui-area>
130
+ <ui-area data-belongs-to-tab="newdir" class="inactive">
131
+ <p>
132
+ Create an empty directory. Beware, if a directory of the same name
133
+ already exists in one of the categories (e.g. draft, development,
134
+ production, archive) it can not be created. To protect you from
135
+ getting confused and shooting yourself in the foot in your little
136
+ modelling world we allow only unique names. Better safe than sorry.
137
+ </p>
138
+ <form id="newdir">
139
+ <input type="hidden" name="stage" value=""/>
140
+ <p>
141
+ <input type="text" name="newdir" required pattern="^[a-zA-Z0-9öäüÖÄÜ _-]+" placeholder="Directory name. Only use characters, spaces, underlines and dashes."/>
142
+ </p>
143
+ <p>
144
+ <button>New Directory</button>
145
+ </p>
146
+ </id>
147
+ </ui-area>
148
+ </ui-content>
149
+ </ui-rest>
150
+ </body>
151
+ </html>
data/ui/js/design.js ADDED
@@ -0,0 +1,214 @@
1
+ var gstage;
2
+ var gdir;
3
+
4
+ function move_it(name,todir) {
5
+ $.ajax({
6
+ type: "PUT",
7
+ url: "server/" + gdir + name,
8
+ data: { dir: todir }
9
+ });
10
+ }
11
+ function shift_it(name,to) {
12
+ $.ajax({
13
+ type: "PUT",
14
+ url: "server/" + gdir + name,
15
+ data: { stage: to }
16
+ });
17
+ }
18
+ function rename_it(name) {
19
+ var newname;
20
+ if (newname = prompt('New name please!',name.replace(/\.xml$/,'').replace(/\.dir$/,''))) {
21
+ $.ajax({
22
+ type: "PUT",
23
+ url: "server/" + gdir + name,
24
+ data: { new: newname }
25
+ });
26
+ }
27
+ }
28
+ function duplicate_it(name) {
29
+ var newname;
30
+ if (newname = prompt('New name please!',name.replace(/\.xml$/,'').replace(/\.dir$/,''))) {
31
+ $.ajax({
32
+ type: "POST",
33
+ url: "server/" + gdir,
34
+ data: { new: newname, old: name }
35
+ });
36
+ }
37
+ }
38
+ function delete_it(name) {
39
+ if (confirm('Are you really, really, REALLY sure!')) {
40
+ $.ajax({
41
+ type: "DELETE",
42
+ url: "server/" + gdir + name
43
+ });
44
+ }
45
+ }
46
+
47
+ function es_init(gdir,gstage) {
48
+ var es = new EventSource('server/');
49
+ es.onopen = function() {
50
+ console.log('es open');
51
+ };
52
+ es.onmessage = function(e) {
53
+ paint(gdir,gstage);
54
+ };
55
+ es.onerror = function() {
56
+ console.log('es error');
57
+ // es_init();
58
+ };
59
+ }
60
+
61
+ function paint(gdir,gstage) {
62
+ $('#models tbody').empty();
63
+ if (gdir && gdir != '') {
64
+ var clone = document.importNode(document.querySelector('#up').content,true);
65
+ $('[data-class=name] a',clone).text('..');
66
+ $('[data-class=name] a',clone).attr('href',window.location.pathname + '?stage=' + gstage + '&dir=');
67
+ $('#models tbody').append(clone);
68
+ }
69
+ $.ajax({
70
+ type: "GET",
71
+ url: "server/" + gdir,
72
+ data: { stage: gstage },
73
+ success: function(res) {
74
+ $(res).each(function(k,data) {
75
+ if (data.type == 'dir') {
76
+ var clone = document.importNode(document.querySelector('#folder').content,true);
77
+ $('[data-class=name] a',clone).text(data['name'].replace(/\.dir$/,''));
78
+ $('[data-class=name]',clone).attr('data-full-name',data['name']);
79
+ $('[data-class=name] a',clone).attr('href',window.location.pathname + '?stage=' + gstage + '&dir=' + data['name']);
80
+ } else {
81
+ var clone = document.importNode(document.querySelector('#model').content,true);
82
+ $('[data-class=name] a',clone).text(data['name']);
83
+ $('[data-class=name]',clone).attr('data-full-name',data['name']);
84
+ $('[data-class=name] a',clone).attr('href','server/' + gdir + data['name'] + '/open?stage=' + gstage);
85
+ $('[data-class=force] a',clone).attr('href','server/' + gdir + data['name'] + '/open-new?stage=' + gstage);
86
+ $('[data-class=raw] a',clone).attr('href','server/' + gdir + data['name']);
87
+ }
88
+ $('[data-class=creator]',clone).text(data['creator']);
89
+ $('[data-class=author]',clone).text(data['author']);
90
+ $('[data-class=date]',clone).text(new Date(data['date']).strftime('%Y-%m-%d, %H:%M:%S'));
91
+ $('#models tbody').append(clone);
92
+ });
93
+ }
94
+ });
95
+ }
96
+
97
+ $(document).ready(function() {
98
+ const queryString = window.location.search;
99
+ const urlParams = new URLSearchParams(queryString);
100
+
101
+ gstage = urlParams.get('stage') || 'draft';
102
+ gdir = urlParams.get('dir') ? (urlParams.get('dir') + '/').replace(/\/+/,'/') : '';
103
+
104
+ es_init(gdir,gstage);
105
+
106
+ $('input[name=stage]').val(gstage);
107
+ $('input[name=dir]').val(gdir);
108
+ $('ui-behind').text(gstage);
109
+
110
+ var dragged;
111
+ $('#models').on('drag','td[data-class=model]',false);
112
+ $('#models').on('dragstart','td[data-class=model]',(e) => {
113
+ dragged = $(e.currentTarget).parents('tr').find('td[data-class=name]').text();
114
+ });
115
+ $('#models').on('dragover','td[data-class=folder]',false);
116
+ $('#models').on('drop','td[data-class=folder]',(e) => {
117
+ e.preventDefault();
118
+ e.stopPropagation();
119
+ if (dragged) {
120
+ console.log(dragged);
121
+ var todir = $(e.currentTarget).parents('tr').find('td[data-class=name]').text();
122
+ todir = todir.replace(/\./g,'');
123
+ if (todir != '') {
124
+ todir += '.dir';
125
+ }
126
+ move_it(dragged,todir);
127
+ dragged = undefined;
128
+ }
129
+ });
130
+ var shifts = []
131
+ $.ajax({
132
+ type: "GET",
133
+ url: "server/",
134
+ data: { stages: 'stages' },
135
+ success: (r) => {
136
+ shifts = shifts.concat(r);
137
+ shifts = shifts.filter(item => item !== gstage);
138
+ }
139
+ });
140
+ $('#models').on('click','td[data-class=ops]',(e) => {
141
+ var menu = {};
142
+ var name = $(e.currentTarget).parents('tr').find('td[data-class=name]').attr('data-full-name');
143
+ menu['Operations'] = [
144
+ {
145
+ 'label': 'Delete',
146
+ 'function_call': delete_it,
147
+ 'text_icon': '❌',
148
+ 'type': undefined,
149
+ 'params': [name]
150
+ },
151
+ {
152
+ 'label': 'Rename',
153
+ 'function_call': rename_it,
154
+ 'type': undefined,
155
+ 'text_icon': '📛',
156
+ 'params': [name]
157
+ }
158
+ ];
159
+ if (name.match(/\.xml$/)) {
160
+ menu['Operations'].unshift(
161
+ {
162
+ 'label': 'Duplicate',
163
+ 'function_call': duplicate_it,
164
+ 'text_icon': '➕',
165
+ 'type': undefined,
166
+ 'params': [name]
167
+ }
168
+ );
169
+ }
170
+ if (shifts.length > 0) {
171
+ menu['Shifting'] = [];
172
+ shifts.forEach(ele => {
173
+ menu['Shifting'].push(
174
+ {
175
+ 'label': 'Shift to ' + ele,
176
+ 'function_call': shift_it,
177
+ 'text_icon': '➔',
178
+ 'type': undefined,
179
+ 'params': [name,ele]
180
+ }
181
+ );
182
+ });
183
+ }
184
+ console.log(shifts);
185
+ new CustomMenu(e).contextmenu(menu);
186
+ });
187
+
188
+ history.pushState({}, document.title, window.location.pathname + '?stage=' + gstage + '&dir=' + gdir);
189
+ paint(gdir,gstage);
190
+
191
+ $('#newmod').on('submit',(e) => {
192
+ $.ajax({
193
+ type: "POST",
194
+ url: "server/" + gdir,
195
+ data: { stage: gstage, new: $("#newmod input[name=new]").val() },
196
+ success: (r) => {
197
+ uidash_activate_tab($('ui-tab').first());
198
+ }
199
+ });
200
+ return false;
201
+ });
202
+
203
+ $('#newdir').on('submit',(e) => {
204
+ $.ajax({
205
+ type: "POST",
206
+ url: "server/",
207
+ data: { dir: $("#newdir input[name=newdir]").val() },
208
+ success: (r) => {
209
+ uidash_activate_tab($('ui-tab').first());
210
+ }
211
+ });
212
+ return false;
213
+ });
214
+ });
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.0.11
4
+ version: 1.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler
@@ -60,6 +60,9 @@ files:
60
60
  - server/moma.conf
61
61
  - server/testset.xml
62
62
  - tools/cpee-moma
63
+ - ui/css/design.css
64
+ - ui/index.html
65
+ - ui/js/design.js
63
66
  homepage: http://cpee.org/
64
67
  licenses:
65
68
  - LGPL-3.0