mutx 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 59c6ec4325709306828982280037d2b948a596d6
4
- data.tar.gz: 142bbcdf1c0f8153f909235e5b5e750cb0681bf5
3
+ metadata.gz: cdd1c0a2fb4f63c702cbe7b48a1af13eaeb1701e
4
+ data.tar.gz: 85182685d9d2e7d09d1d630f8bf9a42ffc33c52a
5
5
  SHA512:
6
- metadata.gz: 4ef36addee27851f1b8fb2fb6c85beba0cfe3326486cb0f256bcdc83ab0a30fe372752344286ca123bf33c015b5cfccd97c8750c53e082d559c9e1741a46a827
7
- data.tar.gz: e11d4425d9b651ee628cec0b52c823e907b61fdc5bbc5192326e0b4a36f6e36beea99e9a347c1e3e79de49921fdb88847ce4bdd1596f7bc4b3e19b9ffe3fadb5
6
+ metadata.gz: b1a2ca775eea60c56bfd60cf78e03d912ffcc6cef40fb7f967102abe3b28a31be374c4bb573c9d5c43697af5d9c0d05c0c1593e0b6445b331a676d6ed5a9cba8
7
+ data.tar.gz: 1de9e41d68850a10d6b1cb4a2b0d596cacc8e6e9ec67d6a30f825e2b5282b6372b62451b861eddb30085654c5cd60f6f403ffab5b32ec953c95449ac52bd1111
@@ -79,6 +79,13 @@ module Mutx
79
79
  end
80
80
  end
81
81
 
82
+ def self.update_repo_name id, name
83
+ Mutx::Database::MongoConnector.update_repo_name(id, name)
84
+ success = true
85
+ message = "Repo name updated!"
86
+ {success:success, message:message}
87
+ end
88
+
82
89
  def self.delete_repo repo_id
83
90
  Mutx::Database::MongoConnector.delete_repo repo_id
84
91
  success = true
@@ -424,6 +424,11 @@ module Mutx
424
424
  $repos.update_one({"repo_name" => repo_data["repo_name"]}, {"$set" => {"value" => repo_data["value"], "last_update" => repo_data["last_update"]} }) ) if ( (!res.to_a.empty?) && (res.to_a[0]["repo_token"].eql? repo_data["repo_token"]) )
425
425
  end
426
426
 
427
+ def self.update_repo_name id, name
428
+ res = $repos.find({"_id" => id})
429
+ ($repos.update_one({"_id" => id}, {"$set" => {"repo_name" => name} }) ) if !res.to_a.empty?
430
+ end
431
+
427
432
  def self.repo_data_for_name(name)
428
433
  res = $repos.find({"repo_name" => name})
429
434
  res = res.to_a.first if res.respond_to? :to_a
@@ -32,6 +32,8 @@ module Mutx
32
32
  admin_repositories_new: '/admin/repositories/new',
33
33
  admin_repositories_create: '/admin/repositories',
34
34
  admin_repositories_delete: '/admin/repositories/:repository_id/delete',
35
+ admin_repositories_edit: '/admin/repositories/:repository_id/edit',
36
+ admin_repositories_update: '/admin/repositories/:repository_id',
35
37
 
36
38
 
37
39
  logs_index: '/logs',
@@ -15,6 +15,12 @@ module Mutx
15
15
  Mutx::Support::Log.debug "#{response}"
16
16
  res.redirect path_for(:admin_repositories_index)
17
17
  end
18
+
19
+ on ':repository_id' do
20
+ result = Mutx::API::Repo.update_repo_name(post_data["_id"], post_data["name"])
21
+ flash[:info] = result[:message]
22
+ res.redirect path_for(:admin_repositories_index)
23
+ end
18
24
  end
19
25
 
20
26
  on get do
@@ -28,6 +34,11 @@ module Mutx
28
34
  res.redirect path_for(:admin_repositories_index)
29
35
  end
30
36
 
37
+ on ':repository_id/edit' do |repository_id|
38
+ repo = Mutx::API::Repo.get_data(repository_id)
39
+ res.write view('Admin Repositories Edit', repo: repo)
40
+ end
41
+
31
42
  on root do
32
43
  repositories = Mutx::Database::MongoConnector.all_repos
33
44
  res.write view('Admin Repositories', repositories: repositories)
@@ -1,3 +1,3 @@
1
1
  module Mutx
2
- VERSION = "0.2.3"
3
- end
2
+ VERSION = "0.2.4"
3
+ end
@@ -0,0 +1,53 @@
1
+ <?
2
+ if action.eql? "edit"
3
+ name_to_update = repo["repo_name"]
4
+ id = repo["_id"]
5
+ path = :admin_repositories_update
6
+ else
7
+ path = :admin_repositories_create
8
+ end
9
+ ?>
10
+
11
+ <nav class="navbar navbar-default">
12
+ <form name="create-repo" id="create-repo" action="{{ path_for(path) }}" method="POST">
13
+ <div class='form-group'>
14
+ <br>
15
+ <label class='col-sm-2 control-label' for='formGroupInputSmall'>
16
+ Name of repo
17
+ </label>
18
+ % if action=="edit"
19
+ <input class='customParam' {{"required title='This value is Required!'"}} type='text' name='name' id='name' placeholder='{{"Enter value here"}}' value="{{name_to_update}}" />
20
+ <input type="hidden" name="_id" id="_id" value="{{id}}" />
21
+ % else
22
+ <input class='customParam' {{"required title='This value is Required!'"}} type='text' name='name' id='name' placeholder='{{"Enter value here"}}' value="{{name}}" />
23
+ % end
24
+ </div>
25
+ <div class='form-group'>
26
+ <label class='col-sm-2 control-label' for='formGroupInputSmall'></label>
27
+ <input type="submit" class="btn btn-success" value="Save">&nbsp;<a class="btn btn-danger" href="{{ path_for(:admin_repositories_index) }}">Cancel</a>
28
+ </div>
29
+ <br>
30
+ </form>
31
+ </nav>
32
+
33
+ <style>
34
+ #text {
35
+ display:none
36
+ }
37
+ #json {
38
+ display:none
39
+ }
40
+ #select_list {
41
+ display:none
42
+ }
43
+ % if action=="edit"
44
+ .form-group:hover + #text {
45
+ display: block;
46
+ }
47
+ % end
48
+ .panel-heading {
49
+ color: #3c763d;
50
+ background-color: #dff0d8;
51
+ border-color: #d6e9c6;
52
+ }
53
+ </style>
@@ -0,0 +1,10 @@
1
+ <div class="panel panel-info">
2
+ <!-- Default panel contents -->
3
+ <div class="panel-heading"><h2>Edit Repo</h2></div>
4
+
5
+ <div class="panel-warning">
6
+ <div class="panel-body">
7
+ {{ partial('admin/repositories/_form', action: 'edit', repo: repo) }}
8
+ </div>
9
+ </div>
10
+ </div>
@@ -22,6 +22,7 @@
22
22
  <td>{{repo[:repo_name]}}</td>
23
23
  <td>{{repo[:repo_token]}}</td>
24
24
  <td>{{Mutx::Support::TimeHelper.formatted_time_for(repo["last_update"])}}</td>
25
+ <td><a href="{{ path_for(:admin_repositories_edit, repository_id: repo['_id']) }}">Edit</a></td>
25
26
  <td><a href="{{ path_for(:admin_repositories_delete, repository_id: repo[:_id]) }}">Delete</a></<td>
26
27
  </tr>
27
28
  % end
@@ -1,69 +1,10 @@
1
- <?
2
- if action=="edit"
3
- custom_param = Mutx::Tasks::Custom::Param.get(args[:custom_param_id]).structure
4
- name = custom_param["name"]
5
- type = custom_param["type"]
6
- value = custom_param["value"]
7
- options = custom_param["options"]
8
- required = custom_param["required"]
1
+ <div class="panel panel-info">
2
+ <!-- Default panel contents -->
3
+ <div class="panel-heading"><h2>New Repo</h2></div>
9
4
 
10
- value = if value.is_a? Hash
11
- value.to_json
12
- else
13
- value.gsub('"=>"','":"') if type=="json"
14
- end
15
-
16
-
17
- end
18
-
19
-
20
- name = query_string.name if query_string.name
21
- options = query_string.options if query_string.options
22
- value = query_string.value if query_string.value
23
- type = query_string.type if query_string.type
24
- required = query_string.required if query_string.required
25
-
26
- types = Mutx::Tasks::Custom::Param.types
27
- types.unshift("Select...") unless types.include? "Select..."
28
-
29
-
30
- ?>
31
- <div class="panel-heading"><h2>New Repo</h2></div>
32
- <nav class="navbar navbar-default">
33
- <form name="create-repo" id="create-repo" action="{{ path_for(:admin_repositories_create) }}" method="POST">
34
- <div class='form-group'>
35
- <br>
36
- <label class='col-sm-2 control-label' for='formGroupInputSmall'>
37
- Name of repo
38
- </label>
39
- <input class='customParam' {{"required title='This value is Required!'"}} type='text' name='name' id='name' placeholder='{{"Enter value here"}}' value="{{name}}" />
5
+ <div class="panel-success">
6
+ <div class="panel-body">
7
+ {{ partial('admin/repositories/_form', action: 'new', repo: nil) }}
40
8
  </div>
41
- <div class='form-group'>
42
- <label class='col-sm-2 control-label' for='formGroupInputSmall'></label>
43
- <input type="submit" class="btn btn-success" value="Save">&nbsp;<a class="btn btn-danger" href="{{ path_for(:admin_repositories_index) }}">Cancel</a>
44
- </div>
45
- <br>
46
- </form>
47
- </nav>
48
-
49
- <style>
50
- #text {
51
- display:none
52
- }
53
- #json {
54
- display:none
55
- }
56
- #select_list {
57
- display:none
58
- }
59
- % if action=="edit"
60
- .form-group:hover + #text {
61
- display: block;
62
- }
63
- % end
64
- .panel-heading {
65
- color: #3c763d;
66
- background-color: #dff0d8;
67
- border-color: #d6e9c6;
68
- }
69
- </style>
9
+ </div>
10
+ </div>
@@ -58,7 +58,7 @@
58
58
  <table>
59
59
  <tr>
60
60
  <td>
61
- {{ partial('admin/custom-params/task_deleting_box', custom_params: task["custom_params"]) }}
61
+ {{ partial('admin/custom-params/_task_deleting_box', custom_params: task["custom_params"]) }}
62
62
  </td>
63
63
  </tr>
64
64
  </table>
@@ -69,7 +69,7 @@ end
69
69
  </div>
70
70
  <br>
71
71
  <div>
72
- <a onclick="window.history.go(-1);" style="cursor:pointer;" class='label label-default' >Return to task</a>
72
+ <a onclick="goClean('{{ path_for(:tasks_show, task_name: result.task['name']) }}');" style="cursor:pointer;" class='label label-default' >Return to task</a>
73
73
  </div>
74
74
  <br>
75
75
  <br>
@@ -78,5 +78,5 @@ end
78
78
  <h3>There is no result with id: <b>{{result_id}}</b></h3>
79
79
  </div>
80
80
  <br>
81
- <a onclick="window.history.go(-1);" style="cursor:pointer;" class='label label-default' >Back</a>
81
+ <a onclick="goClean('{{ path_for(:tasks_show, task_name: result.task['name']) }}');" style="cursor:pointer;" class='label label-default' >Back</a>
82
82
  % end
@@ -18,6 +18,7 @@ module Mutx
18
18
 
19
19
  "Admin Repositories New" => "admin/repositories/new",
20
20
  "Admin Repositories" => "admin/repositories/index",
21
+ "Admin Repositories Edit" => "admin/repositories/edit",
21
22
 
22
23
  'Tests' => "tests/index",
23
24
  'Test' => "tests/show",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mutx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Rodriguez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-10 00:00:00.000000000 Z
11
+ date: 2017-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -533,6 +533,8 @@ files:
533
533
  - lib/mutx/view/admin/custom-params/index.mote
534
534
  - lib/mutx/view/admin/custom-params/new.mote
535
535
  - lib/mutx/view/admin/custom-params/selection_box.mote
536
+ - lib/mutx/view/admin/repositories/_form.mote
537
+ - lib/mutx/view/admin/repositories/edit.mote
536
538
  - lib/mutx/view/admin/repositories/index.mote
537
539
  - lib/mutx/view/admin/repositories/new.mote
538
540
  - lib/mutx/view/admin/tasks/_delete_form.mote