ocp_registry 0.0.1.alpha → 0.0.5.pre

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.
Files changed (53) hide show
  1. data/lib/ocp_registry.rb +1 -0
  2. data/lib/ocp_registry/api_controller.rb +106 -16
  3. data/lib/ocp_registry/application_manager.rb +185 -23
  4. data/lib/ocp_registry/cloud_manager/mock/mock.rb +7 -13
  5. data/lib/ocp_registry/common.rb +3 -1
  6. data/lib/ocp_registry/config.rb +5 -1
  7. data/lib/ocp_registry/db/002_create_settings_table.rb +13 -0
  8. data/lib/ocp_registry/db/003_alter_comments_column_in_applications_table.rb +13 -0
  9. data/lib/ocp_registry/db/004_add_from_field_for_settings.rb +13 -0
  10. data/lib/ocp_registry/mail_client.rb +2 -2
  11. data/lib/ocp_registry/models.rb +2 -1
  12. data/lib/ocp_registry/models/registry_application.rb +19 -0
  13. data/lib/ocp_registry/models/registry_setting.rb +7 -0
  14. data/lib/ocp_registry/version.rb +1 -1
  15. data/mail_template/approve_admin.erb +3 -2
  16. data/mail_template/approve_user.erb +3 -4
  17. data/mail_template/cancel_admin.erb +13 -0
  18. data/mail_template/cancel_user.erb +13 -0
  19. data/mail_template/modify.erb +25 -0
  20. data/mail_template/refuse_admin.erb +4 -3
  21. data/mail_template/refuse_user.erb +4 -4
  22. data/mail_template/request_admin.erb +3 -2
  23. data/mail_template/request_user.erb +3 -3
  24. data/public/comment_dialog.css +11 -0
  25. data/public/common.css +34 -71
  26. data/public/head_message.css +11 -0
  27. data/public/images/portrait_admin.png +0 -0
  28. data/public/images/portrait_applicant.png +0 -0
  29. data/public/{jquery-1.10.2.min.js → jquery/jquery-1.10.2.min.js} +0 -0
  30. data/public/{jquery-1.10.2.min.map → jquery/jquery-1.10.2.min.map} +0 -0
  31. data/public/{jquery.json-2.4.min.js → json/jquery.json-2.4.min.js} +0 -0
  32. data/public/page_specific.css +15 -0
  33. data/public/post.css +37 -0
  34. data/public/qTIp/jquery.qtip.min.css +2 -0
  35. data/public/qTIp/jquery.qtip.min.js +3 -0
  36. data/public/tenant_opt_dialog.css +3 -0
  37. data/public/tenant_options.css +18 -0
  38. data/public/util.js +14 -0
  39. data/spec/spec_common.rb +25 -0
  40. data/spec/unit/config_spec.rb +117 -0
  41. data/views/admin_review.erb +306 -0
  42. data/views/applicant_review.erb +223 -0
  43. data/views/apply.erb +84 -133
  44. data/views/base.erb +56 -6
  45. data/views/comment_list.erb +12 -0
  46. data/views/inform_comment_dialog.erb +10 -0
  47. data/views/post.erb +28 -0
  48. data/views/reject_comment_dialog.erb +10 -0
  49. data/views/tenant_options.erb +244 -0
  50. data/views/view.erb +44 -7
  51. metadata +35 -8
  52. data/views/review.erb +0 -141
  53. data/views/show.erb +0 -96
@@ -0,0 +1,12 @@
1
+ <%
2
+ #Expected Passed-in Parameters Below
3
+ comment_list=comment_list # an array of {'who'=>?, 'text'=>?, 'date'=>?, 'highlight'=>?}
4
+ %>
5
+
6
+ <div class="comment-list">
7
+ <% comment_list.each do |c| %>
8
+
9
+ <%=erb :post, :locals => {:who=>c[:who], :text=>c[:text], :date=>c[:date], :highlight=>c[:highlight]} %>
10
+
11
+ <% end %>
12
+ </div>
@@ -0,0 +1,10 @@
1
+ <div id="inform-dialog" class="dialog comment-dialog inform-dialog modal hide" tabindex="-1" role="dialog" aria-labelledby="Comment for Changing the Request" aria-hidden="true">
2
+ <legend>Comment</legend>
3
+ <textarea name="comment" placeholder="Put your comment for rejection here ..."></textarea>
4
+
5
+ <div class="action">
6
+ <button class="confirm btn btn-primary to-right">Confirm</button>
7
+ <button class="cancel btn to-left">Cancel</button>
8
+ <div class="clear"></div>
9
+ </div>
10
+ </div>
@@ -0,0 +1,28 @@
1
+ <%
2
+ #Expected Passed-in Parameters Below
3
+ text=text
4
+ date=date
5
+ who=(who=='admin') ? 'admin' : 'applicant'
6
+ highlight=highlight
7
+
8
+ #Calculate Useful Variables
9
+ who_name=(who=='admin') ? 'Admin' : 'Applicant'
10
+ portrait_path=(who=='admin') ? '/images/portrait_admin.png' : '/images/portrait_applicant.png'
11
+ highlight_class=highlight ? 'highlight' : ''
12
+
13
+ %>
14
+
15
+ <div class="post box <%=highlight_class%>">
16
+ <div class="user to-left">
17
+ <img class="portrait" src="<%=portrait_path%>" alt="No Portrait"></img>
18
+ <label class="name text-center"><%=who_name%></label>
19
+ </div>
20
+ <div class="content to-left">
21
+ <div class="text"><%=text%></div>
22
+ <div class="tool">
23
+ <div class="date to-right"><%=date%></div>
24
+ <div class="clear-float"></div>
25
+ </div>
26
+ </div>
27
+ <div class="clear-float"></div>
28
+ </div>
@@ -0,0 +1,10 @@
1
+ <div id="reject-dialog" class="dialog comment-dialog reject-dialog modal hide" tabindex="-1" role="dialog" aria-labelledby="Rejection Comment" aria-hidden="true">
2
+ <legend>Comment</legend>
3
+ <textarea name="comment" placeholder="Put your comment for rejection here ..."></textarea>
4
+
5
+ <div class="action">
6
+ <button class="confirm btn btn-primary to-right">Confirm</button>
7
+ <button class="cancel btn to-left">Cancel</button>
8
+ <div class="clear"></div>
9
+ </div>
10
+ </div>
@@ -0,0 +1,244 @@
1
+ <%
2
+ #Expected Passed-in Parameters Below
3
+ who=(who=='admin')? 'admin' : 'applicant' #who is using this page, admin or applier
4
+ review=review #is this page used for reviewing a request, or for filling a new request?
5
+
6
+ tenant_info=tenant_info
7
+ quotas_origin=quotas_origin
8
+ quotas_prev=quotas_prev #if don't have, set it to null
9
+
10
+ #Calculate useful variables
11
+ whoOppsite=(who=='admin')? 'applicant' : 'admin'
12
+ compare=(quotas_prev!=nil) #need to compare current and last version of quotas?
13
+ %>
14
+
15
+ <div id="tenant-options" class="tenant-opt">
16
+ <ul class="nav nav-tabs">
17
+ <li><a href="#tenant-options-tenant-info" data-toggle="tab">Project Info</a></li>
18
+ <li><a href="#tenant-options-quota" data-toggle="tab">Quota</a></li>
19
+ </ul>
20
+
21
+ <div class="tab-content to-left">
22
+ <div class="tab-pane tenant-info" id="tenant-options-tenant-info">
23
+ <label>Project Name</label>
24
+ <input type="text" name="project" value="<%=tenant_info[:project]%>" placeholder="Put the project name here.">
25
+
26
+ <label>Description</label>
27
+ <input type="text" name="description" value="<%=tenant_info[:description]%>" placeholder="Put the project description here.">
28
+
29
+ <label>Email</label>
30
+ <input type="text" name="email" value="<%=tenant_info[:email]%>" placeholder="Put your valid email address here.">
31
+ </div>
32
+ <div class="tab-pane quota" id="tenant-options-quota">
33
+ <label>Metadata Items</label>
34
+ <input type="text" name="metadata_items" value="<%=quotas_origin["metadata_items"]%>">
35
+
36
+ <label>VCPUs</label>
37
+ <input type="text" name="cores" value="<%=quotas_origin["cores"]%>">
38
+
39
+ <label>Instances</label>
40
+ <input type="text" name="instances" value="<%=quotas_origin["instances"]%>">
41
+
42
+ <label>Injected Files</label>
43
+ <input type="text" name="injected_files" value="<%=quotas_origin["injected_files"]%>">
44
+
45
+ <label>Injected Files Content Bytes</label>
46
+ <input type="text" name="injected_file_content_bytes" value="<%=quotas_origin["injected_file_content_bytes"]%>">
47
+
48
+ <label>Volumes</label>
49
+ <input type="text" name="volumes" value="<%=quotas_origin["volumes"]%>">
50
+
51
+ <label>Gigabytes</label>
52
+ <input type="text" name="gigabytes" value="<%=quotas_origin["gigabytes"]%>">
53
+
54
+ <label>RAM(MB)</label>
55
+ <input type="text" name="ram" value="<%=quotas_origin["ram"]%>">
56
+
57
+ <label>Floating IPs</label>
58
+ <input type="text" name="floating_ips" value="<%=quotas_origin["floating_ips"]%>">
59
+
60
+ <label>Fixed IPs</label>
61
+ <input type="text" name="fixed_ips" value="<%=quotas_origin["fixed_ips"]%>">
62
+
63
+ <label>Security Groups</label>
64
+ <input type="text" name="security_groups" value="<%=quotas_origin["security_groups"]%>">
65
+
66
+ <label>Security Group Rules</label>
67
+ <input type="text" name="security_group_rules" value="<%=quotas_origin["security_group_rules"]%>">
68
+ </div>
69
+ </div>
70
+
71
+ <div class="opt-explain to-left">
72
+ Details of your project
73
+ </div>
74
+
75
+ <div class="clear-float"></div>
76
+
77
+ </div>
78
+
79
+ <script type="text/javascript">
80
+
81
+ //The handle to tenant options element
82
+ var tenantOpts={
83
+ changed: false,
84
+ onChange: function(){},
85
+ onRestore: function(){},
86
+ restore: function(){},
87
+
88
+ getQuotasNow: function(){},
89
+ quotasOrigin: $.parseJSON('<%=JSON.generate(quotas_origin, quirks_mode: true)%>'),
90
+ quotasPrev: $.parseJSON('<%=JSON.generate(quotas_prev, quirks_mode: true)%>'),
91
+
92
+ getData: function(){},
93
+ };
94
+
95
+ (function(){
96
+
97
+ $(document).ready(init);
98
+
99
+ var review=$.parseJSON('<%=JSON.generate(review, quirks_mode: true)%>');
100
+ var compare=$.parseJSON('<%=JSON.generate(compare, quirks_mode: true)%>');
101
+
102
+ function init(){
103
+ initTab();
104
+ initReadonly();
105
+ initHighlight();
106
+ initTooltip();
107
+ initInputEvent();
108
+ initFunc();
109
+ }
110
+
111
+ function initTab(){
112
+ $('#tenant-options .nav-tabs a:first').tab('show');
113
+ }
114
+
115
+ function initReadonly(){
116
+ if(!review){
117
+ return;
118
+ }
119
+
120
+ $('#tenant-options .tenant-info input').attr('readonly', 'true');
121
+ }
122
+
123
+ function initHighlight(){
124
+ if(!compare){
125
+ return;
126
+ }
127
+
128
+ $.each(util.whoChanged(tenantOpts.quotasOrigin, tenantOpts.quotasPrev), function(i,v){
129
+ $('#tenant-options .quota input[name='+i+']').addClass('highlight');
130
+ });
131
+ }
132
+
133
+ function initTooltip(){
134
+ if(!compare){
135
+ return;
136
+ }
137
+
138
+ $.each(util.whoChanged(tenantOpts.quotasOrigin, tenantOpts.quotasPrev), function(i,v){
139
+ var $field=$('#tenant-optons .quota input[name='+i+']');
140
+ $field.after('<div class="hidden">'
141
+ +'<p>The <%=whoOppsite%> proposed a new value here. The original is \'<b>'
142
+ +((v[0]===undefined)?'':v[0])
143
+ +'</b>\'.</p>'
144
+ +'</div>'
145
+ );
146
+ $field.qtip({
147
+ content: {
148
+ text: $field.next('div')
149
+ },
150
+ show: {
151
+ effect: function() {
152
+ $field.fadeTo(200, 1);
153
+ }
154
+ },
155
+ hide: {
156
+ effect: function() {
157
+ $field.fadeTo(200, 0);
158
+ }
159
+ }
160
+ });
161
+
162
+ });
163
+ }
164
+
165
+ function initInputEvent(){
166
+
167
+ function onFieldModified(name){
168
+ addLabelMark(name);
169
+
170
+ if(!tenantOpts.changed){
171
+ tenantOpts.changed=true;
172
+ tenantOpts.onChange();
173
+ }
174
+ }
175
+
176
+ $('#tenant-options .quota input').keydown(function(){
177
+ var name=$(this).attr('name');
178
+ onFieldModified(name);
179
+ });
180
+ }
181
+
182
+ function initFunc(){
183
+ tenantOpts.restore=restore;
184
+ tenantOpts.getQuotasNow=getQuotasNow;
185
+ tenantOpts.getData=getData;
186
+ }
187
+
188
+ function addLabelMark(fieldName){
189
+ var $label=$('#tenant-options .quota input[name='+fieldName+']').prev('label');
190
+ if(!($label.text().match(/\*$/))){
191
+ $label.text($label.text()+' *');
192
+ $label.css({color: '#CC0000'});
193
+ }
194
+ }
195
+
196
+ function removeLabelMark(){
197
+ $('#tenant-options .quota input').each(function(i, v){
198
+ var $field=$(this);
199
+ var $label=$field.prev('label');
200
+
201
+ if($label.text().match(/\*$/)){
202
+ $label.text($label.text().slice(0, -2));
203
+ $label.css({color: 'black'});
204
+ }
205
+ });
206
+ }
207
+
208
+ function getQuotasNow(){
209
+ var ret={};
210
+ $('#tenant-options .quota input').each(function(){
211
+ var $field=$(this);
212
+ var name=$field.attr('name');
213
+
214
+ ret[name]=$field.val();
215
+ });
216
+
217
+ return ret;
218
+ }
219
+
220
+ function getData(){
221
+ var ret={};
222
+ $('#tenant-options .tenant-info input').each(function(){
223
+ var $field=$(this);
224
+ var name=$field.attr('name');
225
+
226
+ ret[name]=$field.val();
227
+ });
228
+
229
+ ret.settings=getQuotasNow();
230
+ return ret;
231
+ }
232
+
233
+ function restore(){
234
+ removeLabelMark();
235
+ $('#tenant-options .quota input').each(function(){
236
+ var $field=$(this);
237
+ $field.val(tenantOpts.quotasOrigin[$field.attr('name')]);
238
+ });
239
+ tenantOpts.changed=false;
240
+ tenantOpts.onRestore();
241
+ }
242
+
243
+ })();
244
+ </script>
@@ -1,7 +1,44 @@
1
-
2
- <div class="bordered optDialog">
3
- <legend>Browse Project Request</legend>
4
-
5
- <%=erb :show, :locals => {:data=>data, :readonly=>true} %>
6
-
7
- </div>
1
+ <%
2
+ #Expected Passed-in Parameters Below
3
+ data=data
4
+
5
+ #Calculate Useful Variables
6
+ first_version=(nil == data[:registry_settings][1])
7
+
8
+ tenant_info=data
9
+ quotas_origin=Yajl::load(data[:registry_settings][0][:settings])
10
+ quotas_prev= first_version ? nil : (Yajl::load(data[:registry_settings][1][:settings]))
11
+
12
+ comment_list=get_comment_list_from_data(data)
13
+ %>
14
+
15
+ <div id="tenant-opt-dialog" class="dialog tenant-opt-dialog">
16
+ <legend>View Project Request</legend>
17
+
18
+ <%=erb :tenant_options, :locals => {
19
+ :who=>'applicant',
20
+ :review=>true,
21
+ :tenant_info=>tenant_info,
22
+ :quotas_origin=>quotas_origin,
23
+ :quotas_prev=>quotas_prev
24
+ } %>
25
+ </div>
26
+
27
+ <%=erb :comment_list, :locals => {:comment_list=>comment_list} %>
28
+
29
+ <script type="text/javascript">
30
+
31
+ $(document).ready(init);
32
+
33
+ function init(){
34
+ initReadonly();
35
+ }
36
+
37
+ function initReadonly(){
38
+ $('#tenant-opt-dialog input').each(function(i,v){
39
+ var $field=$(this);
40
+ $field.attr('readonly', 'true');
41
+ });
42
+ }
43
+
44
+ </script>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ocp_registry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.alpha
4
+ version: 0.0.5.pre
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-12 00:00:00.000000000 Z
12
+ date: 2013-07-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -201,15 +201,22 @@ files:
201
201
  - lib/ocp_registry/common.rb
202
202
  - lib/ocp_registry/config.rb
203
203
  - lib/ocp_registry/db/001_db_initialize.rb
204
+ - lib/ocp_registry/db/002_create_settings_table.rb
205
+ - lib/ocp_registry/db/003_alter_comments_column_in_applications_table.rb
206
+ - lib/ocp_registry/db/004_add_from_field_for_settings.rb
204
207
  - lib/ocp_registry/error.rb
205
208
  - lib/ocp_registry/mail_client.rb
206
209
  - lib/ocp_registry/models.rb
207
210
  - lib/ocp_registry/models/registry_application.rb
211
+ - lib/ocp_registry/models/registry_setting.rb
208
212
  - lib/ocp_registry/runner.rb
209
213
  - lib/ocp_registry/version.rb
210
214
  - lib/ocp_registry/yaml_helper.rb
211
215
  - mail_template/approve_admin.erb
212
216
  - mail_template/approve_user.erb
217
+ - mail_template/cancel_admin.erb
218
+ - mail_template/cancel_user.erb
219
+ - mail_template/modify.erb
213
220
  - mail_template/refuse_admin.erb
214
221
  - mail_template/refuse_user.erb
215
222
  - mail_template/request_admin.erb
@@ -223,12 +230,16 @@ files:
223
230
  - public/bootstrap/img/glyphicons-halflings.png
224
231
  - public/bootstrap/js/bootstrap.js
225
232
  - public/bootstrap/js/bootstrap.min.js
233
+ - public/comment_dialog.css
226
234
  - public/common.css
227
235
  - public/favicon.ico
236
+ - public/head_message.css
228
237
  - public/images/loading.gif
229
- - public/jquery-1.10.2.min.js
230
- - public/jquery-1.10.2.min.map
231
- - public/jquery.json-2.4.min.js
238
+ - public/images/portrait_admin.png
239
+ - public/images/portrait_applicant.png
240
+ - public/jquery/jquery-1.10.2.min.js
241
+ - public/jquery/jquery-1.10.2.min.map
242
+ - public/json/jquery.json-2.4.min.js
232
243
  - public/noty/.gitignore
233
244
  - public/noty/LICENSE.txt
234
245
  - public/noty/README.markdown
@@ -260,11 +271,25 @@ files:
260
271
  - public/noty/js/layouts/topRight.js
261
272
  - public/noty/js/promise.js
262
273
  - public/noty/js/themes/default.js
274
+ - public/page_specific.css
275
+ - public/post.css
276
+ - public/qTIp/jquery.qtip.min.css
277
+ - public/qTIp/jquery.qtip.min.js
278
+ - public/tenant_opt_dialog.css
279
+ - public/tenant_options.css
280
+ - public/util.js
281
+ - spec/spec_common.rb
282
+ - spec/unit/config_spec.rb
283
+ - views/admin_review.erb
284
+ - views/applicant_review.erb
263
285
  - views/apply.erb
264
286
  - views/base.erb
287
+ - views/comment_list.erb
288
+ - views/inform_comment_dialog.erb
265
289
  - views/list.erb
266
- - views/review.erb
267
- - views/show.erb
290
+ - views/post.erb
291
+ - views/reject_comment_dialog.erb
292
+ - views/tenant_options.erb
268
293
  - views/view.erb
269
294
  homepage: ''
270
295
  licenses:
@@ -291,4 +316,6 @@ rubygems_version: 1.8.25
291
316
  signing_key:
292
317
  specification_version: 3
293
318
  summary: openstack self-registration app
294
- test_files: []
319
+ test_files:
320
+ - spec/spec_common.rb
321
+ - spec/unit/config_spec.rb