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
@@ -1,141 +0,0 @@
1
-
2
- <div class="bordered optDialog">
3
- <legend>Review Project Request</legend>
4
-
5
- <%=erb :show, :locals => {:data=>data, :readonly=>true} %>
6
-
7
- <div class="optAction" id="optAction">
8
- <button id="optAccept" type="button" class="btn btn-success toRight"
9
- data-loading-text="Loading ...">
10
- Accept
11
- </button>
12
- <button id="optReject" type="button" class="btn btn-warning toRight"
13
- data-loading-text="Loading ...">
14
- Reject
15
- </button>
16
- <img class="loadingIcon toRight" id="optActionLoadingIcon" src="/images/loading.gif" alt="" />
17
- <button id="optBack" type="button" class="btn toRight">Back</button>
18
- <div class="clear"></div>
19
- </div>
20
-
21
- </div>
22
-
23
- <div id="rejectCommentDialog" class="bordered rejectCommentDialog modal hide" tabindex="-1" role="dialog" aria-labelledby="Rejection Comment" aria-hidden="true">
24
- <legend>Comment</legend>
25
-
26
- <textarea name="rejectCommentText" placeholder="Put your comment for rejection here ..."></textarea>
27
-
28
- <div class="rejectCommentAction">
29
- <button id="rejectCommentConfirm" type="button" class="btn btn-primary toRight">Confirm</button>
30
- <button id="rejectCommentBack" type="button" class="btn toRight">Back</button>
31
- <div class="clear"></div>
32
- </div>
33
- </div>
34
-
35
- <script type="text/javascript">
36
-
37
- $(document).ready(init);
38
-
39
- function init(){
40
- initOptActions();
41
- initRejectCommentDialogActions();
42
- }
43
-
44
- function initOptActions(){
45
- $('#optBack').hide();
46
- $('#optBack').click(function(){
47
- window.location='/v1/applications';
48
- });
49
-
50
- $('#optAccept').click(function(){
51
- $.noty.closeAll();
52
- handleActionClick('accept', null);
53
- });
54
- $('#optReject').click(function(){
55
- $.noty.closeAll();
56
- $('#rejectCommentDialog').modal();
57
- });
58
- }
59
-
60
- function initRejectCommentDialogActions(){
61
-
62
- $('#rejectCommentBack').click(function(){
63
- $('#rejectCommentDialog').modal('hide');
64
- });
65
-
66
- $('#rejectCommentConfirm').click(function(){
67
- $('#rejectCommentDialog').modal('hide');
68
-
69
- var data={
70
- comments: $('textarea[name=rejectCommentText]').val()
71
- };
72
- data=$.toJSON( data );
73
-
74
- handleActionClick('reject', data);
75
-
76
- });
77
-
78
- }
79
-
80
- function handleActionClick(which, dataToSend){
81
- actionBtnToLoading(which);
82
- var url='/v1/applications/'+'<%=data[:id]%>'+'/'+((which=="accept")?"approve":"refuse");
83
- $.post(url, dataToSend, 'json').done(function(data){
84
- data = $.evalJSON(data);
85
- if(data.status&&data.status=='error'){
86
- //server returned error
87
- noty({text: 'Failed to Submit Your Decision: '+(data.message?data.message:'Unknown Error'), type:'error'});
88
- actionBtnToReady();
89
- }else{
90
- noty({text: 'Successfully Submitted Your Decision!', type:'success'});
91
- actionBtnToComplete(which);
92
- }
93
- }).fail(function(){
94
- noty({text: 'Failed to Submit Your Decision: Connection Error. You May Retry Later.', type:'error'});
95
- actionBtnToReady();
96
- });
97
-
98
- }
99
-
100
- function actionBtnToLoading(which){
101
- if(which=="accept"){
102
- $('#optAccept').button("loading");
103
- }else if(which=="reject"){
104
- $('#optReject').button("loading");
105
- }else{
106
- throw "This statement should never be reached!"
107
- }
108
-
109
- $('#optAccept').attr('disabled', 'true');
110
- $('#optReject').attr('disabled', 'true');
111
-
112
- $('#optActionLoadingIcon').show();
113
- }
114
-
115
- function actionBtnToReady(){
116
- $('#optAccept').button('reset');
117
- $('#optReject').button('reset');
118
-
119
- $('#optReject').removeAttr('disabled');
120
- $('#optAccept').removeAttr('disabled');
121
-
122
- $('#optActionLoadingIcon').hide();
123
- }
124
-
125
- function actionBtnToComplete(which){
126
- $('#optAccept').attr('disabled', 'true');
127
- $('#optReject').attr('disabled', 'true');
128
- $('#optActionLoadingIcon').hide();
129
-
130
- if(which=="accept"){
131
- $('#optAccept').text("Completed");
132
- }else if(which=="reject"){
133
- $('#optReject').text("Complete");
134
- }else{
135
- throw "This statement should never be reached!"
136
- }
137
-
138
- $('#optBack').show();
139
- }
140
-
141
- </script>
@@ -1,96 +0,0 @@
1
- <%
2
- settings=Yajl::load(data[:settings])
3
- %>
4
-
5
- <div class="tenantOpt">
6
- <ul id="optTab" class="nav nav-tabs">
7
- <li><a href="#tenantInfo" data-toggle="tab">Project Info</a></li>
8
- <li><a href="#quota" data-toggle="tab">Quota</a></li>
9
- </ul>
10
-
11
- <div class="tab-content">
12
- <div class="tab-pane" id="tenantInfo">
13
- <label>Project Name</label>
14
- <input type="text" name="project" value="<%=data[:project]%>" placeholder="Put the project name here.">
15
-
16
- <label>Description</label>
17
- <input type="text" name="description" value="<%=data[:description]%>" placeholder="Put the project description here.">
18
-
19
- <label>Email</label>
20
- <input type="text" name="email" value="<%=data[:email]%>" placeholder="Put your valid email address here.">
21
- </div>
22
- <div class="tab-pane" id="quota">
23
- <label>Metadata Items</label>
24
- <input type="text" name="metadata_items" value="<%=settings["metadata_items"]%>">
25
-
26
- <label>VCPUs</label>
27
- <input type="text" name="cores" value="<%=settings["cores"]%>">
28
-
29
- <label>Instances</label>
30
- <input type="text" name="instances" value="<%=settings["instances"]%>">
31
-
32
- <label>Injected Files</label>
33
- <input type="text" name="injected_files" value="<%=settings["injected_files"]%>">
34
-
35
- <label>Injected Files Content Bytes</label>
36
- <input type="text" name="injected_file_content_bytes" value="<%=settings["injected_file_content_bytes"]%>">
37
-
38
- <label>Volumes</label>
39
- <input type="text" name="volumes" value="<%=settings["volumes"]%>">
40
-
41
- <label>Gigabytes</label>
42
- <input type="text" name="gigabytes" value="<%=settings["gigabytes"]%>">
43
-
44
- <label>RAM(MB)</label>
45
- <input type="text" name="ram" value="<%=settings["ram"]%>">
46
-
47
- <label>Floating IPs</label>
48
- <input type="text" name="floating_ips" value="<%=settings["floating_ips"]%>">
49
-
50
- <label>Fixed IPs</label>
51
- <input type="text" name="fixed_ips" value="<%=settings["fixed_ips"]%>">
52
-
53
- <label>Security Groups</label>
54
- <input type="text" name="security_groups" value="<%=settings["security_groups"]%>">
55
-
56
- <label>Security Group Rules</label>
57
- <input type="text" name="security_group_rules" value="<%=settings["security_group_rules"]%>">
58
- </div>
59
- </div>
60
-
61
- <div class="optExplaination" id="optExplaination">
62
- Details of your project
63
- </div>
64
-
65
- <div class="clear"></div>
66
-
67
- </div>
68
-
69
- <script type="text/javascript">
70
-
71
- (function(){
72
-
73
- $(document).ready(init);
74
-
75
- function init(){
76
- initFields();
77
- initOptTab();
78
- }
79
-
80
- function initFields(){
81
- var readonly=<%= readonly==true ? 1:0%>;
82
- if(readonly){
83
- $('.tab-content input').attr('readonly', true);
84
- $('.tab-content textarea').attr('readonly', true);
85
- $('.tab-content select').attr('disabled', true);
86
- }else{
87
- //do nothing
88
- }
89
- }
90
-
91
- function initOptTab(){
92
- $('#optTab a:first').tab('show');
93
- }
94
-
95
- })();
96
- </script>