You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by se...@apache.org on 2013/07/29 19:33:11 UTC
[11/11] git commit: updated refs/heads/master to ba83cd7
[GSOC] Angular based UI
Signed-off-by: Sebastien Goasguen <ru...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ba83cd70
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ba83cd70
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ba83cd70
Branch: refs/heads/master
Commit: ba83cd7092f9a96db1099d9c685e09957c704fb9
Parents: 79419d4
Author: Shiva Teja <sh...@gmail.com>
Authored: Mon Jul 29 13:32:45 2013 -0400
Committer: Sebastien Goasguen <ru...@gmail.com>
Committed: Mon Jul 29 13:32:45 2013 -0400
----------------------------------------------------------------------
tools/ngui/README.md | 2 +
tools/ngui/api.py | 22 +
tools/ngui/app.py | 23 +
tools/ngui/config.py | 6 +
tools/ngui/precache.py | 19 +
tools/ngui/requester.py | 153 +
.../bootstrap/css/bootstrap-responsive.css | 1109 ++
.../bootstrap/css/bootstrap-responsive.min.css | 9 +
tools/ngui/static/bootstrap/css/bootstrap.css | 6315 +++++++
.../ngui/static/bootstrap/css/bootstrap.min.css | 874 +
.../img/glyphicons-halflings-white.png | Bin 0 -> 8777 bytes
.../bootstrap/img/glyphicons-halflings.png | Bin 0 -> 12799 bytes
tools/ngui/static/bootstrap/js/bootstrap.js | 2291 +++
tools/ngui/static/bootstrap/js/bootstrap.min.js | 7 +
tools/ngui/static/css/app.css | 27 +
tools/ngui/static/images/ajax-inverse.gif | Bin 0 -> 6488 bytes
tools/ngui/static/images/ajax-loader.gif | Bin 0 -> 3208 bytes
tools/ngui/static/js/app/accounts/accounts.js | 85 +
.../static/js/app/accounts/accounts.tpl.html | 18 +
tools/ngui/static/js/app/app.js | 60 +
tools/ngui/static/js/app/dashboard/dashboard.js | 0
tools/ngui/static/js/app/domains/domains.js | 20 +
tools/ngui/static/js/app/events/events.js | 20 +
.../js/app/globalsettings/globalsettings.js | 21 +
.../app/globalsettings/globalsettings.tpl.html | 19 +
.../js/app/infrastructure/infrastructure.js | 0
.../js/app/instances/instance-details.tpl.html | 6 +
tools/ngui/static/js/app/instances/instances.js | 37 +
.../static/js/app/instances/instances.tpl.html | 36 +
tools/ngui/static/js/app/networks/networks.js | 20 +
tools/ngui/static/js/app/projects/projects.js | 20 +
.../js/app/serviceofferings/serviceofferings.js | 20 +
tools/ngui/static/js/app/storage/storage.js | 136 +
.../ngui/static/js/app/storage/storage.tpl.html | 33 +
.../js/app/storage/upload-volume.tpl.html | 0
tools/ngui/static/js/app/templates/templates.js | 20 +
tools/ngui/static/js/common/dictionary.js | 51 +
.../ngui/static/js/common/directives/confirm.js | 26 +
.../js/common/directives/edit-in-place.js | 32 +
.../js/common/directives/edit-in-place.tpl.html | 8 +
tools/ngui/static/js/common/directives/label.js | 25 +
.../static/js/common/directives/modal-form.js | 53 +
.../js/common/directives/modal-form.tpl.html | 24 +
.../ngui/static/js/common/resources/accounts.js | 24 +
.../js/common/resources/configurations.js | 27 +
.../static/js/common/resources/diskofferings.js | 16 +
.../ngui/static/js/common/resources/domains.js | 16 +
tools/ngui/static/js/common/resources/events.js | 16 +
.../ngui/static/js/common/resources/networks.js | 16 +
.../ngui/static/js/common/resources/projects.js | 16 +
.../js/common/resources/serviceofferings.js | 16 +
.../static/js/common/resources/snapshots.js | 16 +
.../static/js/common/resources/templates.js | 16 +
tools/ngui/static/js/common/resources/users.js | 23 +
.../js/common/resources/virtualmachines.js | 58 +
.../ngui/static/js/common/resources/volumes.js | 16 +
tools/ngui/static/js/common/resources/zones.js | 16 +
.../static/js/common/services/breadcrumbs.js | 15 +
.../js/common/services/helperfunctions.js | 22 +
.../static/js/common/services/notifications.js | 17 +
.../ngui/static/js/common/services/requester.js | 30 +
tools/ngui/static/js/lib/angular-ui.min.js | 2 +
tools/ngui/static/js/lib/angular.js | 14847 +++++++++++++++++
tools/ngui/static/js/lib/jquery-1.7.2.js | 9404 +++++++++++
tools/ngui/templates/index.html | 127 +
65 files changed, 36403 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ba83cd70/tools/ngui/README.md
----------------------------------------------------------------------
diff --git a/tools/ngui/README.md b/tools/ngui/README.md
new file mode 100644
index 0000000..e4033e2
--- /dev/null
+++ b/tools/ngui/README.md
@@ -0,0 +1,2 @@
+#UI for CloudStack using Angular.js
+And a flask wrapper on top CloudStack API to make things easy on the client side.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ba83cd70/tools/ngui/api.py
----------------------------------------------------------------------
diff --git a/tools/ngui/api.py b/tools/ngui/api.py
new file mode 100644
index 0000000..55fecac
--- /dev/null
+++ b/tools/ngui/api.py
@@ -0,0 +1,22 @@
+from requester import make_request
+from precache import apicache
+from config import *
+import re
+
+def get_error_code(error):
+ return int(re.findall("\d{3}",error)[0]) #Find the error code by regular expression
+ # return int(error[11:14]) #Ugly
+
+def get_command(verb, subject):
+ commandlist = apicache.get(verb, None)
+ if commandlist is not None:
+ command = commandlist.get(subject, None)
+ if command is not None:
+ return command["name"]
+ return None
+
+def apicall(command, data ):
+ response, error = make_request(command, data, None, host, port, apikey, secretkey, protocol, path)
+ if error is not None:
+ return error, get_error_code(error)
+ return response
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ba83cd70/tools/ngui/app.py
----------------------------------------------------------------------
diff --git a/tools/ngui/app.py b/tools/ngui/app.py
new file mode 100644
index 0000000..8fe0b1a
--- /dev/null
+++ b/tools/ngui/app.py
@@ -0,0 +1,23 @@
+from flask import Flask, url_for, render_template, request, json, abort, send_from_directory
+from api import apicall
+
+app = Flask(__name__)
+
+def get_args(multidict):
+ """Default type of request.args or request.json is multidict. Converts it to dict so that can be passed to make_request"""
+ data = {}
+ for key in multidict.keys():
+ data[key] = multidict.get(key)
+ return data
+
+@app.route('/api/<command>', methods=['GET'])
+def rawapi(command):
+ if request.method == 'GET':
+ return apicall(command, get_args(request.args))
+
+@app.route('/')
+def index():
+ return send_from_directory("templates", "index.html")
+
+if __name__ == '__main__':
+ app.run(debug=True)
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ba83cd70/tools/ngui/config.py
----------------------------------------------------------------------
diff --git a/tools/ngui/config.py b/tools/ngui/config.py
new file mode 100644
index 0000000..27a5525
--- /dev/null
+++ b/tools/ngui/config.py
@@ -0,0 +1,6 @@
+apikey='DNi_vTVLPNfTEFuqu5F9MrPI3iecf8iRQ3QtGUH1IM2Nd96wNwNlf7BzmF1W8aw6cE2ejZCgyE53wT5VpzauuA'
+secretkey='x4jM12uE4LNho3ZNJa8J-Ve6WsgEXd8df1mGGfeuJHMtolkaSBkD5pLX0tvj8YrWhBgtZbKgYsTB00kb7z_3BA'
+path='/client/api'
+host='localhost'
+port='8080'
+protocol='http'