cpee-model-management 1.0.14 → 1.0.18
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/cpee-model-management.gemspec +2 -1
- data/lib/cpee-model-management/commit.rb +1 -3
- data/lib/cpee-model-management/implementation.rb +79 -46
- data/server/model.xml +2 -2
- data/server/moma.conf +1 -0
- data/server/testset.xml +2 -2
- data/tools/cpee-moma +21 -4
- data/ui/css/design.css +10 -0
- data/ui/index.html +21 -4
- data/ui/js/design.js +45 -14
- metadata +23 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0f20ba70c3f8b275794d93cc37318ea2c9a2f6cac142b97955b7df37bf19c78
|
4
|
+
data.tar.gz: 727d1d7684b81ce572a09fb6afa63365e74c7f9d40d231fb8495d7797f3f2057
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d765472f0d8e08bbc6a43e2e6fb779065ee86606cd5030ff82a9e69134f29a01afcad618c81d089a66d06b893f6f64133555ef578ed2a9e9c1504faedd8f65f
|
7
|
+
data.tar.gz: 522152b30e278e976ae047cd4a355f40f73e19d8abf7ddb809e1385bd39007e9f6b1904b3f98d8334dd031f1d1fb30af4952581978128219f521741c401669f4
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "cpee-model-management"
|
3
|
-
s.version = "1.0.
|
3
|
+
s.version = "1.0.18"
|
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."
|
@@ -22,4 +22,5 @@ Gem::Specification.new do |s|
|
|
22
22
|
|
23
23
|
s.add_runtime_dependency 'riddl', '~> 0.99'
|
24
24
|
s.add_runtime_dependency 'json', '~> 2.1'
|
25
|
+
s.add_runtime_dependency 'cpee', '~> 2.1', '>= 2.1.7'
|
25
26
|
end
|
@@ -7,8 +7,6 @@ new = File.basename(new)
|
|
7
7
|
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple add "#{new}" 2>/dev/null`
|
8
8
|
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple add "#{new}.active" 2>/dev/null`
|
9
9
|
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple add "#{new}.active-uuid" 2>/dev/null`
|
10
|
-
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple add "#{new}.
|
11
|
-
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple add "#{new}.creator" 2>/dev/null`
|
12
|
-
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple add "#{new}.stage" 2>/dev/null`
|
10
|
+
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple add "#{new}.attrs" 2>/dev/null`
|
13
11
|
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple commit -m "#{author.gsub(/"/,"'")}"`
|
14
12
|
`GIT_TERMINAL_PROMPT=0 git push` rescue nil
|
@@ -38,12 +38,10 @@ module CPEE
|
|
38
38
|
p2 = Pathname.new(File.dirname(new))
|
39
39
|
told = File.basename(old)
|
40
40
|
tnew = File.join(p1.relative_path_from(p1).to_s,File.basename(new))
|
41
|
-
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple mv "#{told}" "#{tnew}"
|
42
|
-
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{told + '.active'}"
|
43
|
-
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{told + '.active-uuid'}"
|
44
|
-
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple mv "#{told + '.
|
45
|
-
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple mv "#{told + '.creator'}" "#{tnew + '.creator'}" 2>/dev/null`
|
46
|
-
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple mv "#{told + '.stage'}" "#{tnew + '.stage'}" 2>/dev/null`
|
41
|
+
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple mv "#{told}" "#{tnew}" 2>/dev/null`
|
42
|
+
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{told + '.active'}" 2>/dev/null`
|
43
|
+
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{told + '.active-uuid'}" 2>/dev/null`
|
44
|
+
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple mv "#{told + '.attrs'}" "#{tnew + '.attrs'}" 2>/dev/null`
|
47
45
|
Dir.chdir(cdir)
|
48
46
|
CPEE::ModelManagement::fs_mv(models,old,new) # fallback
|
49
47
|
end
|
@@ -55,9 +53,7 @@ module CPEE
|
|
55
53
|
FileUtils.rm_rf(tnew)
|
56
54
|
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{tnew}.active" 2>/dev/null`
|
57
55
|
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{tnew}.active-uuid" 2>/dev/null`
|
58
|
-
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{tnew}.
|
59
|
-
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{tnew}.creator" 2>/dev/null`
|
60
|
-
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{tnew}.stage" 2>/dev/null`
|
56
|
+
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{tnew}.attrs" 2>/dev/null`
|
61
57
|
Dir.chdir(cdir)
|
62
58
|
CPEE::ModelManagement::fs_rm(models,new) # fallback
|
63
59
|
end
|
@@ -81,9 +77,7 @@ module CPEE
|
|
81
77
|
FileUtils.mv(fname,fnname) rescue nil
|
82
78
|
File.delete(fname + '.active',fnname + '.active') rescue nil
|
83
79
|
File.delete(fname + '.active-uuid',fnname + '.active-uuid') rescue nil
|
84
|
-
FileUtils.mv(fname + '.
|
85
|
-
FileUtils.mv(fname + '.creator',fnname + '.creator') rescue nil
|
86
|
-
FileUtils.mv(fname + '.stage',fnname + '.stage') rescue nil
|
80
|
+
FileUtils.mv(fname + '.attrs',fnname + '.attrs') rescue nil
|
87
81
|
end
|
88
82
|
def self::fs_cp(models,old,new)
|
89
83
|
fname = File.join(models,old)
|
@@ -91,18 +85,14 @@ module CPEE
|
|
91
85
|
FileUtils.cp(fname,fnname)
|
92
86
|
File.delete(fname + '.active',fnname + '.active') rescue nil
|
93
87
|
File.delete(fname + '.active-uuid',fnname + '.active-uuid') rescue nil
|
94
|
-
FileUtils.cp(fname + '.
|
95
|
-
FileUtils.cp(fname + '.creator',fnname + '.creator') rescue nil
|
96
|
-
FileUtils.cp(fname + '.stage',fnname + '.stage') rescue nil
|
88
|
+
FileUtils.cp(fname + '.attrs',fnname + '.attrs') rescue nil
|
97
89
|
end
|
98
90
|
def self::fs_rm(models,new)
|
99
91
|
fname = File.join(models,new)
|
100
92
|
FileUtils.rm_rf(fname)
|
101
93
|
File.delete(fname + '.active') rescue nil
|
102
94
|
File.delete(fname + '.active-uuid') rescue nil
|
103
|
-
File.delete(fname + '.
|
104
|
-
File.delete(fname + '.creator') rescue nil
|
105
|
-
File.delete(fname + '.stage') rescue nil
|
95
|
+
File.delete(fname + '.attrs') rescue nil
|
106
96
|
end
|
107
97
|
def self::fs_shift(models,new)
|
108
98
|
fname = File.join(models,new)
|
@@ -169,14 +159,16 @@ module CPEE
|
|
169
159
|
if op == 'delete'
|
170
160
|
{ :op => op, :type => :dir, :name => File.basename(f) }
|
171
161
|
else
|
172
|
-
|
162
|
+
attrs = JSON::load File.open(f + '.attrs')
|
163
|
+
{ :op => op, :type => :dir, :name => File.basename(f), :creator => attrs['creator'], :date => File.mtime(f).xmlschema }
|
173
164
|
end
|
174
165
|
else
|
175
166
|
if op == 'delete'
|
176
167
|
{ :op => op, :type => :file, :name => f.sub(Regexp.compile(File.join(models,'/')),'') }
|
177
168
|
else
|
178
|
-
|
179
|
-
|
169
|
+
attrs = JSON::load File.open(f + '.attrs')
|
170
|
+
fstage = attrs['design_stage'] rescue 'draft'
|
171
|
+
{ :op => op, :type => :file, :name => f.sub(Regexp.compile(File.join(models,'/')),''), :creator => attrs['creator'], :author => attrs['author'], :stage => fstage, :date => File.mtime(f).xmlschema }
|
180
172
|
end
|
181
173
|
end
|
182
174
|
what[:source] = s.sub(/models\//,'') unless s.nil?
|
@@ -193,12 +185,13 @@ module CPEE
|
|
193
185
|
stage = [@p[0]&.value] || ['draft']
|
194
186
|
stage << views[stage[0]] if views && views[stage[0]]
|
195
187
|
|
196
|
-
|
197
188
|
names = Dir.glob(File.join(models,where,'*.dir')).map do |f|
|
198
|
-
|
189
|
+
attrs = JSON::load File.open(f + '.attrs')
|
190
|
+
{ :type => :dir, :name => File.basename(f), :creator => attrs['creator'], :date => File.mtime(f).xmlschema }
|
199
191
|
end.compact.uniq.sort_by{ |e| e[:name] } + Dir.glob(File.join(models,where,'*.xml')).map do |f|
|
200
|
-
|
201
|
-
|
192
|
+
attrs = JSON::load File.open(f + '.attrs')
|
193
|
+
fstage = attrs['design_stage'] rescue 'draft'
|
194
|
+
{ :type => :file, :name => File.basename(f), :creator => attrs['creator'], :author => attrs['author'], :guarded => attrs['guarded'], :guarded_id => attrs['guarded_id'], :stage => fstage, :date => File.mtime(f).xmlschema } if stage.include?(fstage)
|
202
195
|
end.compact.uniq.sort_by{ |e| e[:name] }
|
203
196
|
|
204
197
|
Riddl::Parameter::Complex.new('list','application/json',JSON::pretty_generate(names))
|
@@ -212,10 +205,12 @@ module CPEE
|
|
212
205
|
stage << views[stage[0]] if views && views[stage[0]]
|
213
206
|
|
214
207
|
names = Dir.glob(File.join(models,'*.dir/*.xml')).map do |f|
|
215
|
-
|
208
|
+
attrs = JSON::load File.open(f + '.attrs')
|
209
|
+
{ :type => :file, :name => File.join(File.basename(File.dirname(f)),File.basename(f)), :creator => attrs['creator'], :date => File.mtime(f).xmlschema }
|
216
210
|
end.compact.uniq.sort_by{ |e| e[:name] } + Dir.glob(File.join(models,'*.xml')).map do |f|
|
217
|
-
|
218
|
-
|
211
|
+
attrs = JSON::load File.open(f + '.attrs')
|
212
|
+
fstage = attrs['design_stage'] rescue 'draft'
|
213
|
+
{ :type => :file, :name => File.basename(f), :creator => attrs['creator'], :author => attrs['author'], :guarded => attrs['guarded'], :guarded_id => attrs['guarded_id'], :stage => fstage, :date => File.mtime(f).xmlschema } if stage.include?(fstage)
|
219
214
|
end.compact.uniq.sort_by{ |e| e[:name] }
|
220
215
|
|
221
216
|
Riddl::Parameter::Complex.new('list','application/json',JSON::pretty_generate(names))
|
@@ -241,6 +236,7 @@ module CPEE
|
|
241
236
|
dn = CPEE::ModelManagement::get_dn @h['DN']
|
242
237
|
author = dn['GN'] + ' ' + dn['SN']
|
243
238
|
|
239
|
+
attrs = {}
|
244
240
|
XML::Smart::modify(fname) do |doc|
|
245
241
|
doc.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
|
246
242
|
doc.find('/p:testset/p:attributes/p:author').each do |ele|
|
@@ -252,9 +248,11 @@ module CPEE
|
|
252
248
|
doc.find('/p:testset/p:attributes/p:theme').each do |ele|
|
253
249
|
ele.text = themes[nstage] || 'model'
|
254
250
|
end
|
251
|
+
attrs = doc.find('/p:testset/p:attributes/*').map do |e|
|
252
|
+
[e.qname.name,e.text]
|
253
|
+
end.to_h
|
255
254
|
end
|
256
|
-
File.write(fname + '.
|
257
|
-
File.write(fname + '.stage',nstage)
|
255
|
+
File.write(fname + '.attrs',JSON::pretty_generate(attrs))
|
258
256
|
|
259
257
|
CPEE::ModelManagement::op author, 'shift', models, File.join('.', where, name + '.xml'), File.join('.', where, name + '.xml')
|
260
258
|
CPEE::ModelManagement::notify conns, 'shift', models, fname, fname
|
@@ -281,6 +279,7 @@ module CPEE
|
|
281
279
|
dn = CPEE::ModelManagement::get_dn @h['DN']
|
282
280
|
author = dn['GN'] + ' ' + dn['SN']
|
283
281
|
|
282
|
+
attrs = {}
|
284
283
|
XML::Smart::modify(fname) do |doc|
|
285
284
|
doc.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
|
286
285
|
doc.find('/p:testset/p:attributes/p:info').each do |ele|
|
@@ -289,8 +288,11 @@ module CPEE
|
|
289
288
|
doc.find('/p:testset/p:attributes/p:author').each do |ele|
|
290
289
|
ele.text = author
|
291
290
|
end
|
291
|
+
attrs = doc.find('/p:testset/p:attributes/*').map do |e|
|
292
|
+
[e.qname.name,e.text]
|
293
|
+
end.to_h
|
292
294
|
end
|
293
|
-
File.write(fname + '.
|
295
|
+
File.write(fname + '.attrs',JSON::pretty_generate(attrs))
|
294
296
|
|
295
297
|
CPEE::ModelManagement::op author, 'mv', models, File.join('.', where, nname + '.xml'), File.join('.', where, name + '.xml')
|
296
298
|
CPEE::ModelManagement::notify conns, 'rename', models, fnname, fname
|
@@ -313,7 +315,23 @@ module CPEE
|
|
313
315
|
|
314
316
|
dn = CPEE::ModelManagement::get_dn @h['DN']
|
315
317
|
author = dn['GN'] + ' ' + dn['SN']
|
316
|
-
|
318
|
+
|
319
|
+
attrs = JSON::load File.open(fname + '.attrs')
|
320
|
+
attrs['author'] = author
|
321
|
+
File.write(fname + '.attrs',JSON::pretty_generate(attrs))
|
322
|
+
|
323
|
+
Dir.glob(File.join(fname + '/*.xml')).each do |f|
|
324
|
+
XML::Smart::modify(f) do |doc|
|
325
|
+
doc.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
|
326
|
+
doc.find('/p:testset/p:attributes/p:design_dir').each do |ele|
|
327
|
+
ele.text = nname + '.dir'
|
328
|
+
end
|
329
|
+
attrs = doc.find('/p:testset/p:attributes/*').map do |e|
|
330
|
+
[e.qname.name,e.text]
|
331
|
+
end.to_h
|
332
|
+
end
|
333
|
+
File.write(f + '.attrs',JSON::pretty_generate(attrs))
|
334
|
+
end
|
317
335
|
|
318
336
|
CPEE::ModelManagement::op author, 'mv', models, File.join(nname + '.dir'), File.join(name + '.dir')
|
319
337
|
CPEE::ModelManagement::notify conns, 'rename', models, fnname, fname
|
@@ -339,8 +357,11 @@ module CPEE
|
|
339
357
|
|
340
358
|
Dir.mkdir(fname)
|
341
359
|
FileUtils.touch(File.join(fname,'.gitignore'))
|
342
|
-
|
343
|
-
|
360
|
+
|
361
|
+
attrs = {}
|
362
|
+
attrs['creator'] = creator
|
363
|
+
attrs['author'] = creator
|
364
|
+
File.write(fname + '.attrs',JSON::pretty_generate(attrs))
|
344
365
|
|
345
366
|
CPEE::ModelManagement::op creator, 'add', models, name + '.dir'
|
346
367
|
CPEE::ModelManagement::notify conns, 'create', models, fname
|
@@ -364,7 +385,8 @@ module CPEE
|
|
364
385
|
source = @p[1] ? File.join(models,where,@p[1].value) : (templates[stage] ? templates[stage] : 'testset.xml')
|
365
386
|
fname = File.join(models,where,name + '.xml')
|
366
387
|
|
367
|
-
|
388
|
+
attrs = JSON::load File.open(fname + '.attrs') rescue {}
|
389
|
+
stage = attrs['design_stage'] if stage.nil? && attrs['design_stage']
|
368
390
|
stage = views[stage] if views && views[stage]
|
369
391
|
|
370
392
|
counter = 0
|
@@ -376,6 +398,7 @@ module CPEE
|
|
376
398
|
dn = CPEE::ModelManagement::get_dn @h['DN']
|
377
399
|
creator = dn['GN'] + ' ' + dn['SN']
|
378
400
|
FileUtils.cp(source,fname)
|
401
|
+
attrs = {}
|
379
402
|
XML::Smart::modify(fname) do |doc|
|
380
403
|
doc.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
|
381
404
|
doc.find('/p:testset/p:attributes/p:info').each do |ele|
|
@@ -398,10 +421,11 @@ module CPEE
|
|
398
421
|
ele.text = stage
|
399
422
|
end
|
400
423
|
end
|
424
|
+
attrs = doc.find('/p:testset/p:attributes/*').map do |e|
|
425
|
+
[e.qname.name,e.text]
|
426
|
+
end.to_h
|
401
427
|
end
|
402
|
-
File.write(fname + '.
|
403
|
-
File.write(fname + '.author',creator)
|
404
|
-
File.write(fname + '.stage',stage)
|
428
|
+
File.write(fname + '.attrs',JSON::pretty_generate(attrs))
|
405
429
|
|
406
430
|
CPEE::ModelManagement::op creator, 'add', models, File.join('.', where, name + '.xml')
|
407
431
|
CPEE::ModelManagement::notify conns, 'create', models, fname
|
@@ -496,13 +520,17 @@ module CPEE
|
|
496
520
|
dn = CPEE::ModelManagement::get_dn @h['DN']
|
497
521
|
author = dn['GN'] + ' ' + dn['SN']
|
498
522
|
if !File.exist?(File.join(models,to,name + '.xml'))
|
523
|
+
attrs = {}
|
499
524
|
XML::Smart::modify(fname) do |doc|
|
500
525
|
doc.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
|
501
526
|
doc.find('/p:testset/p:attributes/p:design_dir').each do |ele|
|
502
527
|
ele.text = to
|
503
528
|
end
|
529
|
+
attrs = doc.find('/p:testset/p:attributes/*').map do |e|
|
530
|
+
[e.qname.name,e.text]
|
531
|
+
end.to_h
|
504
532
|
end
|
505
|
-
File.write(fname + '.
|
533
|
+
File.write(fname + '.attrs',JSON::pretty_generate(attrs))
|
506
534
|
|
507
535
|
CPEE::ModelManagement::op author, 'mv', models, File.join('.', to, name + '.xml'), File.join('.', where, name + '.xml')
|
508
536
|
CPEE::ModelManagement::notify conns, 'move', models, File.join(models,to,name + '.xml'), fname
|
@@ -522,20 +550,25 @@ module CPEE
|
|
522
550
|
|
523
551
|
if File.exists?(fname)
|
524
552
|
author = dn['GN'] + ' ' + dn['SN']
|
553
|
+
attrs = {}
|
525
554
|
XML::Smart.string(cont) do |doc|
|
526
555
|
doc.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
|
527
|
-
unless File.exists?(File.join(models,where,name + '.xml.creator'))
|
528
|
-
doc.find('/p:testset/p:attributes/p:author').each do |ele|
|
529
|
-
File.write(File.join(models,where,name + '.xml.creator'),ele.text)
|
530
|
-
end
|
531
|
-
end
|
532
556
|
doc.find('/p:testset/p:attributes/p:author').each do |ele|
|
533
557
|
ele.text = dn['GN'] + ' ' + dn['SN']
|
534
558
|
end
|
559
|
+
if doc.find('/p:testset/p:attributes/p:design_stage').empty?
|
560
|
+
doc.find('/p:testset/p:attributes').first.add('p:design_stage','draft')
|
561
|
+
else
|
562
|
+
doc.find('/p:testset/p:attributes/p:design_stage').each do |ele|
|
563
|
+
ele.text = 'draft' if ele.text.strip == ''
|
564
|
+
end
|
565
|
+
end
|
566
|
+
attrs = doc.find('/p:testset/p:attributes/*').map do |e|
|
567
|
+
[e.qname.name,e.text]
|
568
|
+
end.to_h
|
535
569
|
File.write(fname,doc.to_s)
|
536
|
-
File.write(fname + '.author',author)
|
537
|
-
File.write(fname + '.stage',doc.find('string(/p:testset/p:attributes/p:design_stage)').sub(/^$/,'draft'))
|
538
570
|
end
|
571
|
+
File.write(fname + '.attrs',JSON::pretty_generate(attrs))
|
539
572
|
CPEE::ModelManagement::op author, 'add', models, File.join('.', where, name + '.xml')
|
540
573
|
CPEE::ModelManagement::notify conns, 'put', models, fname
|
541
574
|
else
|
data/server/model.xml
CHANGED
@@ -25,8 +25,8 @@
|
|
25
25
|
<info>none</info>
|
26
26
|
<creator>Juergen Mangler</creator>
|
27
27
|
<author>Juergen Mangler</author>
|
28
|
-
<
|
29
|
-
<
|
28
|
+
<guarded>none</guarded>
|
29
|
+
<guarded_id></guarded_id>
|
30
30
|
<model_uuid></model_uuid>
|
31
31
|
<model_version></model_version>
|
32
32
|
<modeltype>CPEE</modeltype>
|
data/server/moma.conf
CHANGED
data/server/testset.xml
CHANGED
@@ -18,8 +18,8 @@
|
|
18
18
|
<creator>Juergen Mangler</creator>
|
19
19
|
<author>Juergen Mangler</author>
|
20
20
|
<modeltype>CPEE</modeltype>
|
21
|
-
<
|
22
|
-
<
|
21
|
+
<guarded>none</guarded>
|
22
|
+
<guarded_id></guarded_id>
|
23
23
|
<model_uuid></model_uuid>
|
24
24
|
<model_version></model_version>
|
25
25
|
<theme>extended</theme>
|
data/tools/cpee-moma
CHANGED
@@ -6,6 +6,7 @@ require 'fileutils'
|
|
6
6
|
require 'xml/smart'
|
7
7
|
require 'zip'
|
8
8
|
require 'typhoeus'
|
9
|
+
require 'json'
|
9
10
|
require 'securerandom'
|
10
11
|
|
11
12
|
def wrap(s, width=78, indent=18)
|
@@ -85,7 +86,7 @@ if command == 'cpui'
|
|
85
86
|
js_libs(p1)
|
86
87
|
elsif command == 'convert'
|
87
88
|
Dir['*.xml'].each do |f|
|
88
|
-
XML::Smart.
|
89
|
+
XML::Smart.open(f) do |doc|
|
89
90
|
doc.register_namespace 'x', 'http://cpee.org/ns/properties/2.0'
|
90
91
|
if doc.root.qname.name == 'testset'
|
91
92
|
name = File.basename(f,'.xml')
|
@@ -118,7 +119,6 @@ elsif command == 'convert'
|
|
118
119
|
e.add('x:creator',creator)
|
119
120
|
end
|
120
121
|
end
|
121
|
-
File.write(f + '.creator',creator)
|
122
122
|
|
123
123
|
if (dt = doc.find('/x:testset/x:attributes/x:author')).length > 0
|
124
124
|
dt.each do |e|
|
@@ -130,7 +130,6 @@ elsif command == 'convert'
|
|
130
130
|
e.add('x:author',author)
|
131
131
|
end
|
132
132
|
end
|
133
|
-
File.write(f + '.author',author)
|
134
133
|
|
135
134
|
if (dt = doc.find('/x:testset/x:attributes/x:design_stage')).length > 0
|
136
135
|
dt.each do |e|
|
@@ -142,7 +141,6 @@ elsif command == 'convert'
|
|
142
141
|
e.add('x:design_stage',design_stage)
|
143
142
|
end
|
144
143
|
end
|
145
|
-
File.write(f + '.stage',design_stage)
|
146
144
|
|
147
145
|
dd = ENV['PWD'] || Dir.pwd
|
148
146
|
ma = dd.scan(/\/([^\/]+\.dir)/)
|
@@ -162,9 +160,28 @@ elsif command == 'convert'
|
|
162
160
|
e.text = name
|
163
161
|
end
|
164
162
|
end
|
163
|
+
|
164
|
+
|
165
|
+
attrs = doc.find('/x:testset/x:attributes/*').map do |e|
|
166
|
+
[e.qname.name,e.text]
|
167
|
+
end.to_h
|
168
|
+
File.write(f + '.attrs',JSON::pretty_generate(attrs))
|
169
|
+
|
170
|
+
File.unlink(f + '.creator') rescue nil
|
171
|
+
File.unlink(f + '.author') rescue nil
|
172
|
+
File.unlink(f + '.stage') rescue nil
|
165
173
|
end
|
166
174
|
end
|
167
175
|
end
|
176
|
+
Dir['*.dir'].each do |f|
|
177
|
+
attrs = JSON::load File.open(f + '.attrs') rescue {}
|
178
|
+
attrs['creator'] = File.read(f + '.creator') if File.exists?(f + '.creator')
|
179
|
+
attrs['author'] = File.read(f + '.author') if File.exists?(f + '.author')
|
180
|
+
File.write(f + '.attrs',JSON::pretty_generate(attrs))
|
181
|
+
|
182
|
+
File.unlink(f + '.creator') rescue nil
|
183
|
+
File.unlink(f + '.author') rescue nil
|
184
|
+
end
|
168
185
|
elsif command == 'new'
|
169
186
|
if !File.exists?(p1)
|
170
187
|
FileUtils.mkdir(File.join(p1)) rescue nil
|
data/ui/css/design.css
CHANGED
@@ -22,6 +22,12 @@ form input {
|
|
22
22
|
|
23
23
|
ui-behind {
|
24
24
|
text-transform: capitalize;
|
25
|
+
font-weight: bold;
|
26
|
+
color: #d0d0d0;
|
27
|
+
}
|
28
|
+
|
29
|
+
ui-behind span {
|
30
|
+
cursor: pointer;
|
25
31
|
}
|
26
32
|
|
27
33
|
[is="x-ui-"] table.ui-table {
|
@@ -50,3 +56,7 @@ ui-behind {
|
|
50
56
|
}
|
51
57
|
|
52
58
|
[is="x-ui-"] ui-rest > ui-content > ui-area { padding: 1em; }
|
59
|
+
|
60
|
+
tr.contextmenuitem .capitalized {
|
61
|
+
text-transform: capitalize;
|
62
|
+
}
|
data/ui/index.html
CHANGED
@@ -61,20 +61,35 @@
|
|
61
61
|
<ui-tab class="" data-tab="models" >Models</ui-tab>
|
62
62
|
<ui-tab class="inactive" data-tab="newmodel">New Model</ui-tab>
|
63
63
|
<ui-tab class="inactive" data-tab="newdir" >New Dir</ui-tab>
|
64
|
-
<ui-
|
64
|
+
<ui-space ></ui-space>
|
65
|
+
<ui-tab class="inactive" data-tab="running" >Running</ui-tab>
|
66
|
+
<ui-tab class="inactive" data-tab="stopped" >Stopped</ui-tab>
|
67
|
+
<ui-behind ><span></span></ui-behind>
|
65
68
|
<ui-last ><a class="logo" href=".."></a></ui-last>
|
66
69
|
</ui-tabbar>
|
67
70
|
<ui-content class="noselect">
|
68
71
|
<ui-area data-belongs-to-tab="models">
|
69
72
|
<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
73
|
<table id="models" class='ui-table'>
|
74
|
+
<thead>
|
75
|
+
<th></th>
|
76
|
+
<th>Name</th>
|
77
|
+
<th><abbr title='force new instance'>F</abbr></th>
|
78
|
+
<th><abbr title='link to model source'>M</abbr></th>
|
79
|
+
<th>Changed By</th>
|
80
|
+
<th><abbr title='Guarded'>G</abbr></th>
|
81
|
+
<th><abbr title='Resource'>R</abbr></th>
|
82
|
+
<th>Changed At</th>
|
83
|
+
<th><abbr title='Operations'>Op</abbr></th>
|
84
|
+
</thead>
|
71
85
|
<template id="up">
|
72
86
|
<tr>
|
73
87
|
<td data-class='folder' class="noselect">📁</td>
|
74
88
|
<td data-class='name' data-full-name=''><a href=''></a></td>
|
75
89
|
<td></td>
|
76
90
|
<td></td>
|
77
|
-
<td
|
91
|
+
<td></td>
|
92
|
+
<td></td>
|
78
93
|
<td></td>
|
79
94
|
<td data-class='date'></td>
|
80
95
|
<td data-class=''></td>
|
@@ -86,7 +101,8 @@
|
|
86
101
|
<td data-class='name' data-full-name=''><a href=''></a></td>
|
87
102
|
<td></td>
|
88
103
|
<td></td>
|
89
|
-
<td
|
104
|
+
<td></td>
|
105
|
+
<td></td>
|
90
106
|
<td></td>
|
91
107
|
<td data-class='date'></td>
|
92
108
|
<td data-class='ops' class="noselect"><span>…</span></td>
|
@@ -98,8 +114,9 @@
|
|
98
114
|
<td data-class='name' data-full-name=''><a target='_blank' href=''></a></td>
|
99
115
|
<td data-class='force'>[<a target='_blank' href='' title='force new instance'>F</a>]</td>
|
100
116
|
<td data-class='raw'>[<a target='_blank' href='' title='link to model source'>M</a>]</td>
|
101
|
-
<td data-class='creator'></td>
|
102
117
|
<td data-class='author'></td>
|
118
|
+
<td data-class='guarded'><abbr title=''></abbr></td>
|
119
|
+
<td data-class='resource'></td>
|
103
120
|
<td data-class='date'></td>
|
104
121
|
<td data-class='ops' class="noselect"><span>…</span></td>
|
105
122
|
</tr>
|
data/ui/js/design.js
CHANGED
@@ -84,8 +84,17 @@ function paint(gdir,gstage) {
|
|
84
84
|
$('[data-class=name] a',clone).attr('href','server/' + gdir + data['name'] + '/open?stage=' + gstage);
|
85
85
|
$('[data-class=force] a',clone).attr('href','server/' + gdir + data['name'] + '/open-new?stage=' + gstage);
|
86
86
|
$('[data-class=raw] a',clone).attr('href','server/' + gdir + data['name']);
|
87
|
+
|
88
|
+
$('[data-class=guarded] abbr',clone).attr('title',data['guarded'] || '');
|
89
|
+
$('[data-class=guarded] abbr',clone).text((data['guarded'] || '').match(/none/i) ? '' : (data['guarded'] || '').charAt(0).toUpperCase());
|
90
|
+
$('[data-class=resource]',clone).text(data['guarded_id'] || '');
|
91
|
+
|
92
|
+
if (data['guarded']) {
|
93
|
+
$('[data-class=guarded] abbr',clone).attr('title',data['guarded']);
|
94
|
+
$('[data-class=guarded] abbr',clone).text(data['guarded'].match(/none/i) ? '' : data['guarded'].charAt(0).toUpperCase());
|
95
|
+
$('[data-class=resource]',clone).text(data['guarded_what']);
|
96
|
+
}
|
87
97
|
}
|
88
|
-
$('[data-class=creator]',clone).text(data['creator']);
|
89
98
|
$('[data-class=author]',clone).text(data['author']);
|
90
99
|
$('[data-class=date]',clone).text(new Date(data['date']).strftime('%Y-%m-%d, %H:%M:%S'));
|
91
100
|
$('#models tbody').append(clone);
|
@@ -94,6 +103,10 @@ function paint(gdir,gstage) {
|
|
94
103
|
});
|
95
104
|
}
|
96
105
|
|
106
|
+
function change_it(gdir,gstage) {
|
107
|
+
window.location.href = window.location.pathname + '?stage=' + gstage + '&dir=' + gdir;
|
108
|
+
}
|
109
|
+
|
97
110
|
$(document).ready(function() {
|
98
111
|
const queryString = window.location.search;
|
99
112
|
const urlParams = new URLSearchParams(queryString);
|
@@ -103,9 +116,39 @@ $(document).ready(function() {
|
|
103
116
|
|
104
117
|
es_init(gdir,gstage);
|
105
118
|
|
119
|
+
var shifts = []
|
120
|
+
$.ajax({
|
121
|
+
type: "GET",
|
122
|
+
url: "server/",
|
123
|
+
data: { stages: 'stages' },
|
124
|
+
success: (r) => {
|
125
|
+
shifts = shifts.concat(r);
|
126
|
+
shifts = shifts.filter(item => item !== gstage);
|
127
|
+
}
|
128
|
+
});
|
129
|
+
|
106
130
|
$('input[name=stage]').val(gstage);
|
107
131
|
$('input[name=dir]').val(gdir);
|
108
|
-
$('ui-behind').text(gstage);
|
132
|
+
$('ui-behind span').text(gstage);
|
133
|
+
$('ui-behind span').click((e) => {
|
134
|
+
if (shifts.length > 0) {
|
135
|
+
var menu = {};
|
136
|
+
menu['Change to'] = [];
|
137
|
+
shifts.forEach(ele => {
|
138
|
+
menu['Change to'].push(
|
139
|
+
{
|
140
|
+
'label': ele,
|
141
|
+
'function_call': change_it,
|
142
|
+
'text_icon': '➔',
|
143
|
+
'type': undefined,
|
144
|
+
'class': 'capitalized',
|
145
|
+
'params': [gdir,ele]
|
146
|
+
}
|
147
|
+
);
|
148
|
+
});
|
149
|
+
new CustomMenu(e).contextmenu(menu);
|
150
|
+
}
|
151
|
+
});
|
109
152
|
|
110
153
|
var dragged;
|
111
154
|
$('#models').on('drag','td[data-class=model]',false);
|
@@ -117,7 +160,6 @@ $(document).ready(function() {
|
|
117
160
|
e.preventDefault();
|
118
161
|
e.stopPropagation();
|
119
162
|
if (dragged) {
|
120
|
-
console.log(dragged);
|
121
163
|
var todir = $(e.currentTarget).parents('tr').find('td[data-class=name]').text();
|
122
164
|
todir = todir.replace(/\./g,'');
|
123
165
|
if (todir != '') {
|
@@ -127,16 +169,6 @@ $(document).ready(function() {
|
|
127
169
|
dragged = undefined;
|
128
170
|
}
|
129
171
|
});
|
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
172
|
$('#models').on('click','td[data-class=ops]',(e) => {
|
141
173
|
var menu = {};
|
142
174
|
var name = $(e.currentTarget).parents('tr').find('td[data-class=name]').attr('data-full-name');
|
@@ -181,7 +213,6 @@ $(document).ready(function() {
|
|
181
213
|
);
|
182
214
|
});
|
183
215
|
}
|
184
|
-
console.log(shifts);
|
185
216
|
new CustomMenu(e).contextmenu(menu);
|
186
217
|
});
|
187
218
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cpee-model-management
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juergen eTM Mangler
|
8
8
|
autorequire:
|
9
9
|
bindir: tools
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: riddl
|
@@ -38,6 +38,26 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: cpee
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.1'
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 2.1.7
|
51
|
+
type: :runtime
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - "~>"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '2.1'
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 2.1.7
|
41
61
|
description: see http://cpee.org
|
42
62
|
email: juergen.mangler@gmail.com
|
43
63
|
executables:
|
@@ -82,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
102
|
- !ruby/object:Gem::Version
|
83
103
|
version: '0'
|
84
104
|
requirements: []
|
85
|
-
rubygems_version: 3.
|
105
|
+
rubygems_version: 3.2.22
|
86
106
|
signing_key:
|
87
107
|
specification_version: 4
|
88
108
|
summary: "(Lifecycle) manage your process models in a directory or git repo."
|