Skip to content

Commit 9436af7

Browse files
committed
Merge pull request #7 from TranscendComputing/port-to-backbone
Port to backbone
2 parents 96a18ef + 964c9c2 commit 9436af7

File tree

17 files changed

+446
-248
lines changed

17 files changed

+446
-248
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public/docs/*.html
1313
public/docs/images/
1414
public/docs/js/
1515
public/docs/*
16+
public/vendor
1617
lib/bundler/man
1718
pkg
1819
rdoc

Rakefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ task :jslint do
1616
paths = paths.reject{|path| path =~ /public\/js\/console.*/}
1717
paths = paths.reject{|path| path =~ /public\/js\/enc-base64-min.*/}
1818
paths = paths.reject{|path| path =~ /public\/js\/hmac-sha256.*/}
19+
paths = paths.reject{|path| path =~ /public\/vendor\/.*/}
1920
paths.each do |fname|
2021
cmd = "jslint #{fname}"
2122
results = %x{#{cmd}}

app/editor.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class EditorApp < Sinatra::Base
88
end
99

1010
get '/' do
11-
@bottom_js = ["main","editor"]
11+
@require_main = "editor"
1212
@editor = true
1313
erb :editor
1414
end

app/views/editor.erb

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<div id="editor_all">
12
<div id="editor_frame">
23
<div id="editor"># Create some instances on AWS
34

@@ -125,31 +126,8 @@ end
125126
</div>
126127
</div>
127128
</div><%# /control_panel_frame %>
129+
</div><%# /editor_all %>
128130
<script src="//cdnjs.cloudflare.com/ajax/libs/ace/1.1.01/ace.js" type="text/javascript" charset="utf-8"></script>
129-
<script>
130-
var editor = ace.edit("editor");
131-
editor.setTheme("ace/theme/vibrant_ink");
132-
editor.getSession().setMode("ace/mode/ruby");
133-
editor.on("guttermousedown", function(e){
134-
var target = e.domEvent.target;
135-
if (target.className.indexOf("ace_gutter-cell") == -1) {
136-
var row = e.getDocumentPosition().row;
137-
e.editor.session.clearBreakpoint(row);
138-
return;
139-
}
140-
if (e.clientX > 25 + target.getBoundingClientRect().left) {
141-
return;
142-
}
143-
var row = e.getDocumentPosition().row;
144-
if (target.className.indexOf("breakpoint") == -1) {
145-
e.editor.session.setBreakpoint(row, " breakpoint");
146-
e.stop();
147-
} else {
148-
e.editor.session.clearBreakpoint(row);
149-
return;
150-
}
151-
});
152-
</script>
153131
<script src="/js/annyang.min.js" type="text/javascript"></script>
154132
<script>
155133
if (annyang) {
@@ -163,5 +141,5 @@ if (annyang) {
163141

164142
}</script>
165143
<script src="//cdnjs.cloudflare.com/ajax/libs/spin.js/1.2.7/spin.min.js"></script>
166-
<script src="//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.0/backbone-min.js"></script>
144+
167145

app/views/layout.erb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<!-- link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" -->
1717
<link href="/css/bootstrap.css" rel="stylesheet" media="screen">
1818
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/3.2.1/css/font-awesome.min.css">
19+
<link href="/css/opentip.css" rel="stylesheet" type="text/css" />
1920
<style>
2021
body {
2122
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
@@ -65,14 +66,22 @@
6566
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
6667
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
6768
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.0.0/lodash.min.js"></script>
69+
<script src="//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.0/backbone-min.js"></script>
6870
<script src="/js/console.js"></script>
6971
<script src="/js/hmac-sha256.js" type="text/javascript"></script>
7072
<script src="/js/enc-base64-min.js" type="text/javascript"></script>
7173
<script src="/js/auth.js" type="text/javascript"></script>
74+
<script src="//cdn.jsdelivr.net/opentip/2.4.6/opentip-jquery-excanvas.min.js"></script>
7275
<% if @bottom_js %>
7376
<% @bottom_js.each do |script| %>
7477
<%= "<script src=\"/js/#{script}.js\"></script>" %>
7578
<% end %>
7679
<% end %>
80+
<% if @require_main %>
81+
<script src="/vendor/require.js"></script>
82+
<script>
83+
require(['js/<%= "#{@require_main}" %>'], function (app) {});
84+
</script>
85+
<% end %>
7786
</body>
7887
</html>

bower.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

config.ru

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ map "/swagger-ui" do
7373
run Rack::Directory.new("./bower_components/swagger-ui/dist")
7474
end
7575

76+
# Serve swagger-ui from bower directory
77+
map "/bower_components" do
78+
run Rack::Directory.new("./bower_components")
79+
end
80+
7681
map '/' do
7782
run RootApp
7883
end

package.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "harp-runtime",
3+
"version": "0.1.0",
4+
"devDependencies": {
5+
},
6+
"readmeFilename": "README.md",
7+
"description": "Cloud orchestration platform",
8+
"main": "Gruntfile.js",
9+
"bugs": "https://github.com/TranscendComputing/harp-runtime/issues",
10+
"directories": {
11+
"js": "public/js"
12+
},
13+
"dependencies": {
14+
},
15+
"scripts": {
16+
"test": "rake spec"
17+
},
18+
"repository": {
19+
"type": "git",
20+
"url": "https://github.com/TranscendComputing/harp-runtime.git"
21+
},
22+
"keywords": [
23+
"cloud",
24+
"managment",
25+
"ec2",
26+
"openstack",
27+
"aws"
28+
],
29+
"author": "Transcend Computing",
30+
"license": "Apache2",
31+
"jam": {
32+
"packageDir": "public/vendor",
33+
"baseUrl": "public/js",
34+
"dependencies": {
35+
"jquery": "2.0.0",
36+
"backbone.babysitter": null,
37+
"backbone-relational-shim": null,
38+
"backbone.epoxy": null
39+
}
40+
}
41+
}

public/css/main.css

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ body {
44
body {
55
overflow: hidden;
66
}
7-
8-
#editor {
7+
8+
#editor {
99
margin: 0;
1010
position: absolute;
1111
top: 60px;
@@ -20,17 +20,17 @@ body {
2020
bottom: 0px;
2121
left: 20px;
2222
right: 0;
23-
height: 200px;
24-
border-top: 1px solid gray;
23+
height: 200px;
24+
border-top: 1px solid gray;
2525
}
2626
#control_panel_frame {
2727
margin: 0;
2828
position: absolute;
2929
bottom: 0px;
3030
left: 0;
3131
right: 0;
32-
height: 200px;
33-
border-top: 1px solid gray;
32+
height: 200px;
33+
border-top: 1px solid gray;
3434
}
3535

3636
.breakpoint:after {
@@ -58,3 +58,17 @@ body {
5858
height: 80%;
5959
z-index: 1000;
6060
}
61+
62+
.ace_snippet-buble {
63+
box-sizing: border-box;
64+
background: none repeat scroll 0 0 rgba(160, 193, 241, 0.26);
65+
border: 1px solid rgba(119, 116, 139, 0.08);
66+
border-radius: 3px 3px 3px 3px;
67+
position: absolute;
68+
pointer-events: auto;
69+
cursor: pointer;
70+
z-index:10
71+
}
72+
.ace_snippet-buble:hover {
73+
background: rgba(94, 136, 147, 0.21);
74+
}

public/js/collections/plays.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*global define*/
2+
define([
3+
'underscore',
4+
'backbone',
5+
'js/models/play'
6+
], function (_, Backbone, HarpPlay) {
7+
'use strict';
8+
9+
var HarpPlays = Backbone.Collection.extend({
10+
model: HarpPlay
11+
});
12+
13+
return HarpPlays;
14+
});

0 commit comments

Comments
 (0)