cpee-model-management 1.0.8 → 1.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/cpee-model-management.gemspec +2 -2
- data/lib/cpee-model-management/implementation.rb +27 -21
- data/server/model.xml +4 -0
- data/server/testset.xml +4 -0
- data/tools/cpee-moma +46 -2
- data/ui/css/design.css +52 -0
- data/ui/index.html +151 -0
- data/ui/js/design.js +214 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9db0f107cad7e45a47d7d197523ebfcc9f493512f614777573c3d567c3270b6c
|
4
|
+
data.tar.gz: fed6d38fc3a757e2dd074bad56f579a5a0b7d3863bb14a2ef325a5df28ca2526
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30d3c26a3b7a13afacf601ae8fa99178610ec37296be9ae4de888770a07245df77f031b5368f95dbd338cef03752d0c34c3e2ee7c62e79b05775dfc89bd53123
|
7
|
+
data.tar.gz: e958d85ebbdf708c35accd0fcaed6fdd79f34702042c00f67aee5d3d39f6dcbfdd0fd81b8a64c0bce9728bbd1b55161a8fe85d8832bb98de55b4015153867f3e
|
@@ -1,13 +1,13 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "cpee-model-management"
|
3
|
-
s.version = "1.0.
|
3
|
+
s.version = "1.0.14"
|
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'
|
@@ -24,6 +24,7 @@ require 'riddl/protocols/utils'
|
|
24
24
|
require 'fileutils'
|
25
25
|
require 'pathname'
|
26
26
|
require 'shellwords'
|
27
|
+
require 'securerandom'
|
27
28
|
|
28
29
|
module CPEE
|
29
30
|
module ModelManagement
|
@@ -35,36 +36,39 @@ module CPEE
|
|
35
36
|
Dir.chdir(File.join(models,File.dirname(old)))
|
36
37
|
p1 = Pathname.new(File.dirname(old))
|
37
38
|
p2 = Pathname.new(File.dirname(new))
|
38
|
-
|
39
|
-
|
40
|
-
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple mv "#{
|
41
|
-
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{
|
42
|
-
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{
|
43
|
-
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple mv "#{
|
44
|
-
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple mv "#{
|
45
|
-
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple mv "#{
|
39
|
+
told = File.basename(old)
|
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}" 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 + '.author'}" "#{tnew + '.author'}" 2>/dev/null`
|
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`
|
46
47
|
Dir.chdir(cdir)
|
48
|
+
CPEE::ModelManagement::fs_mv(models,old,new) # fallback
|
47
49
|
end
|
48
50
|
def self::git_rm(models,new)
|
49
51
|
cdir = Dir.pwd
|
50
52
|
Dir.chdir(File.join(models,File.dirname(new)))
|
51
|
-
|
52
|
-
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{
|
53
|
-
FileUtils.rm_rf(
|
54
|
-
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{
|
55
|
-
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{
|
56
|
-
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{
|
57
|
-
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{
|
58
|
-
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{
|
53
|
+
tnew = File.basename(new)
|
54
|
+
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{tnew}" 2>/dev/null`
|
55
|
+
FileUtils.rm_rf(tnew)
|
56
|
+
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{tnew}.active" 2>/dev/null`
|
57
|
+
`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}.author" 2>/dev/null`
|
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`
|
59
61
|
Dir.chdir(cdir)
|
62
|
+
CPEE::ModelManagement::fs_rm(models,new) # fallback
|
60
63
|
end
|
61
64
|
def self::git_shift(models,new)
|
62
65
|
cdir = Dir.pwd
|
63
66
|
Dir.chdir(File.join(models,File.dirname(new)))
|
64
|
-
|
65
|
-
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{
|
66
|
-
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{
|
67
|
+
nnew = File.basename(new)
|
68
|
+
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{nnew}.active" 2>/dev/null`
|
69
|
+
`git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{nnew}.active-uuid" 2>/dev/null`
|
67
70
|
Dir.chdir(cdir)
|
71
|
+
CPEE::ModelManagement::fs_shift(models,new) # fallback
|
68
72
|
end
|
69
73
|
def self::git_commit(models,new,author)
|
70
74
|
rp = File.realpath(models)
|
@@ -74,7 +78,7 @@ module CPEE
|
|
74
78
|
def self::fs_mv(models,old,new)
|
75
79
|
fname = File.join(models,old)
|
76
80
|
fnname = File.join(models,new)
|
77
|
-
FileUtils.mv(fname,fnname)
|
81
|
+
FileUtils.mv(fname,fnname) rescue nil
|
78
82
|
File.delete(fname + '.active',fnname + '.active') rescue nil
|
79
83
|
File.delete(fname + '.active-uuid',fnname + '.active-uuid') rescue nil
|
80
84
|
FileUtils.mv(fname + '.author',fnname + '.author') rescue nil
|
@@ -104,7 +108,6 @@ module CPEE
|
|
104
108
|
fname = File.join(models,new)
|
105
109
|
File.delete(fname + '.active') rescue nil
|
106
110
|
File.delete(fname + '.active-uuid') rescue nil
|
107
|
-
Dir.chdir(cdir)
|
108
111
|
end
|
109
112
|
|
110
113
|
def self::git_dir(models,file)
|
@@ -387,6 +390,9 @@ module CPEE
|
|
387
390
|
doc.find('/p:testset/p:attributes/p:design_dir').each do |ele|
|
388
391
|
ele.text = where
|
389
392
|
end
|
393
|
+
doc.find('/p:testset/p:attributes/p:model_uuid').each do |ele|
|
394
|
+
ele.text = SecureRandom.uuid
|
395
|
+
end
|
390
396
|
if stage
|
391
397
|
doc.find('/p:testset/p:attributes/p:design_stage').each do |ele|
|
392
398
|
ele.text = stage
|
data/server/model.xml
CHANGED
@@ -25,6 +25,10 @@
|
|
25
25
|
<info>none</info>
|
26
26
|
<creator>Juergen Mangler</creator>
|
27
27
|
<author>Juergen Mangler</author>
|
28
|
+
<resource_restriction>none</resource_restriction>
|
29
|
+
<resource_id></resource_id>
|
30
|
+
<model_uuid></model_uuid>
|
31
|
+
<model_version></model_version>
|
28
32
|
<modeltype>CPEE</modeltype>
|
29
33
|
<theme>model</theme>
|
30
34
|
<design_dir></design_dir>
|
data/server/testset.xml
CHANGED
@@ -18,6 +18,10 @@
|
|
18
18
|
<creator>Juergen Mangler</creator>
|
19
19
|
<author>Juergen Mangler</author>
|
20
20
|
<modeltype>CPEE</modeltype>
|
21
|
+
<resource_restriction>none</resource_restriction>
|
22
|
+
<resource_id></resource_id>
|
23
|
+
<model_uuid></model_uuid>
|
24
|
+
<model_version></model_version>
|
21
25
|
<theme>extended</theme>
|
22
26
|
<design_dir></design_dir>
|
23
27
|
<design_stage>draft</design_stage>
|
data/tools/cpee-moma
CHANGED
@@ -5,6 +5,8 @@ require 'optparse'
|
|
5
5
|
require 'fileutils'
|
6
6
|
require 'xml/smart'
|
7
7
|
require 'zip'
|
8
|
+
require 'typhoeus'
|
9
|
+
require 'securerandom'
|
8
10
|
|
9
11
|
def wrap(s, width=78, indent=18)
|
10
12
|
lines = []
|
@@ -24,6 +26,29 @@ def wrap(s, width=78, indent=18)
|
|
24
26
|
return lines.join "\n"
|
25
27
|
end
|
26
28
|
|
29
|
+
def js_libs(cockpit)
|
30
|
+
res = Typhoeus.get('https://cpee.org/js_libs/js_libs.zip')
|
31
|
+
if res.success?
|
32
|
+
File.write(File.join(cockpit,'js_libs.zip'),res.response_body)
|
33
|
+
Zip::File.open(File.join(cockpit,'js_libs.zip')) do |zip_file|
|
34
|
+
zip_file.each do |entry|
|
35
|
+
case entry.ftype
|
36
|
+
when :directory
|
37
|
+
Dir.mkdir(File.join(cockpit,entry.name)) rescue nil
|
38
|
+
when :file
|
39
|
+
File.write(File.join(cockpit,entry.name),entry.get_input_stream.read)
|
40
|
+
when :symlink
|
41
|
+
FileUtils.ln_s(File.join('.',entry.get_input_stream.read),File.join(cockpit,entry.name), force: true)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
true
|
46
|
+
else
|
47
|
+
puts 'Internet access required to download javascript libs from "http://cpee.org/js_libs/js_libs.zip".'
|
48
|
+
false
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
27
52
|
ARGV.options { |opt|
|
28
53
|
opt.summary_indent = ' ' * 2
|
29
54
|
opt.summary_width = 15
|
@@ -66,6 +91,23 @@ elsif command == 'convert'
|
|
66
91
|
name = File.basename(f,'.xml')
|
67
92
|
creator = author = design_dir = design_stage = nil
|
68
93
|
|
94
|
+
if doc.find('/x:testset/x:attributes').length == 0
|
95
|
+
n = doc.root.add('x:attributes')
|
96
|
+
end
|
97
|
+
|
98
|
+
if doc.find('/x:testset/x:attributes/x:model_uuid').length == 0
|
99
|
+
n = doc.find('/x:testset/x:attributes').first
|
100
|
+
n.add('x:model_uuid',SecureRandom.uuid)
|
101
|
+
end
|
102
|
+
if doc.find('/x:testset/x:attributes/x:theme').length == 0
|
103
|
+
n = doc.find('/x:testset/x:attributes').first
|
104
|
+
n.add('x:theme','extended')
|
105
|
+
end
|
106
|
+
if doc.find('/x:testset/x:attributes/x:info').length == 0
|
107
|
+
n = doc.find('/x:testset/x:attributes').first
|
108
|
+
n.add('x:info',name)
|
109
|
+
end
|
110
|
+
|
69
111
|
if (dt = doc.find('/x:testset/x:attributes/x:creator')).length > 0
|
70
112
|
dt.each do |e|
|
71
113
|
creator = e.text
|
@@ -102,12 +144,14 @@ elsif command == 'convert'
|
|
102
144
|
end
|
103
145
|
File.write(f + '.stage',design_stage)
|
104
146
|
|
147
|
+
dd = ENV['PWD'] || Dir.pwd
|
148
|
+
ma = dd.scan(/\/([^\/]+\.dir)/)
|
149
|
+
design_dir = ma.join('/')
|
105
150
|
if (dt = doc.find('/x:testset/x:attributes/x:design_dir')).length > 0
|
106
151
|
dt.each do |e|
|
107
|
-
|
152
|
+
e.text = design_dir
|
108
153
|
end
|
109
154
|
else
|
110
|
-
design_dir = Dir.pwd.sub(/^.*?models\/?/,'')
|
111
155
|
doc.find('/x:testset/x:attributes').each do |e|
|
112
156
|
e.add('x:design_dir',design_dir)
|
113
157
|
end
|
data/ui/css/design.css
ADDED
@@ -0,0 +1,52 @@
|
|
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
|
+
}
|
51
|
+
|
52
|
+
[is="x-ui-"] ui-rest > ui-content > ui-area { padding: 1em; }
|
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,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.14
|
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-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: riddl
|
@@ -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
|
@@ -79,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
82
|
- !ruby/object:Gem::Version
|
80
83
|
version: '0'
|
81
84
|
requirements: []
|
82
|
-
rubygems_version: 3.1.
|
85
|
+
rubygems_version: 3.1.6
|
83
86
|
signing_key:
|
84
87
|
specification_version: 4
|
85
88
|
summary: "(Lifecycle) manage your process models in a directory or git repo."
|