summaryrefslogtreecommitdiffstats
path: root/module/web/static/js/views
diff options
context:
space:
mode:
Diffstat (limited to 'module/web/static/js/views')
-rw-r--r--module/web/static/js/views/dashboardView.js19
-rw-r--r--module/web/static/js/views/headerView.js19
-rw-r--r--module/web/static/js/views/linkGrabberModal.js3
3 files changed, 32 insertions, 9 deletions
diff --git a/module/web/static/js/views/dashboardView.js b/module/web/static/js/views/dashboardView.js
index d9ff1c5fc..58a50777c 100644
--- a/module/web/static/js/views/dashboardView.js
+++ b/module/web/static/js/views/dashboardView.js
@@ -35,7 +35,11 @@ define(['jquery', 'backbone', 'underscore', 'app', 'models/TreeCollection',
self.tree.fetch();
});
- // TODO file:added
+ App.vent.on('file:updated', _.bind(this.fileUpdated, this));
+
+ // TODO: file:added
+ // TODO: package:deleted
+ // TODO: package:updated
},
init: function() {
@@ -48,7 +52,7 @@ define(['jquery', 'backbone', 'underscore', 'app', 'models/TreeCollection',
self.tree.get('packages').on('add', function(pack) {
console.log('Package ' + pack.get('pid') + ' added to tree');
self.appendPackage(pack, 0, true);
-
+ self.openPackage(pack);
});
}});
@@ -144,6 +148,17 @@ define(['jquery', 'backbone', 'underscore', 'app', 'models/TreeCollection',
//TODO: show placeholder when nothing is displayed (filtered content empty)
this.fileUL.fadeIn();
App.vent.trigger('dashboard:updated');
+ },
+
+ // Refresh the file if it is currently shown
+ fileUpdated: function(data) {
+ // this works with ids and object
+ var file = this.files.get(data);
+ if (file)
+ if (_.isObject(data)) // update directly
+ file.set(data);
+ else // fetch from server
+ file.fetch();
}
});
}); \ No newline at end of file
diff --git a/module/web/static/js/views/headerView.js b/module/web/static/js/views/headerView.js
index c22f173c4..35df06003 100644
--- a/module/web/static/js/views/headerView.js
+++ b/module/web/static/js/views/headerView.js
@@ -12,6 +12,7 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/ServerStatus', 'flot'
},
templateStatus: _.compile($('#template-header-status').html()),
+ templateProgress: _.compile($('#template-header-progress').html()),
// Will hold the link grabber
grabber: null,
@@ -100,11 +101,15 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/ServerStatus', 'flot'
},
render: function() {
-// console.log('Render header');
+ // TODO: what should be displayed in the header
+ // queue/processing size?
this.$('.status-block').html(
this.templateStatus(this.status.toJSON())
);
+
+ // TODO: render progress
+ this.$('.progress-list');
},
toggle_taskList: function() {
@@ -132,10 +137,10 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/ServerStatus', 'flot'
if (data['@class'] === "ServerStatus") {
this.status.set(data);
}
- else if (data['@class'] === 'progress')
+ else if (_.isArray(data))
this.onProgressUpdate(data);
- else if (data['@class'] === 'event')
- this.onEvent(data);
+ else if (data['@class'] === 'EventInfo')
+ this.onEvent(data.eventname, data.event_args);
else
console.log('Unknown Async input');
@@ -145,8 +150,10 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/ServerStatus', 'flot'
},
- onEvent: function(event) {
-
+ onEvent: function(event, args) {
+ args.unshift(event);
+ console.log('Core send event', args);
+ App.vent.trigger.apply(App.vent, args);
}
});
diff --git a/module/web/static/js/views/linkGrabberModal.js b/module/web/static/js/views/linkGrabberModal.js
index ea11aa339..9f7a5882d 100644
--- a/module/web/static/js/views/linkGrabberModal.js
+++ b/module/web/static/js/views/linkGrabberModal.js
@@ -30,7 +30,8 @@ define(['jquery', 'underscore', 'app', 'views/abstract/modalView', 'text!tpl/def
type: 'POST',
data: {
name: JSON.stringify($('#inputPackageName').val()),
- links: JSON.stringify(['http://download.pyload.org/random.bin', 'invalid link', 'invalid link 2', 'invalid link 3', 'inavlid link 4',
+ links: JSON.stringify(['http://download.pyload.org/random.bin', 'http://download.pyload.org/random100.bin',
+ 'invalid link', 'invalid link 2', 'invalid link 3', 'inavlid link 4',
'http://download.pyload.org/random.bin', 'http://download.pyload.org/random.bin', 'http://download.pyload.org/random.bin',
'A really really long invalid url that should exceed length of most of the urls by far and split into two lines'])
},