summaryrefslogtreecommitdiffstats
path: root/module/web/static/js/models
diff options
context:
space:
mode:
Diffstat (limited to 'module/web/static/js/models')
-rw-r--r--module/web/static/js/models/File.js13
-rw-r--r--module/web/static/js/models/Package.js15
2 files changed, 22 insertions, 6 deletions
diff --git a/module/web/static/js/models/File.js b/module/web/static/js/models/File.js
index 66d9ef050..efea23254 100644
--- a/module/web/static/js/models/File.js
+++ b/module/web/static/js/models/File.js
@@ -23,13 +23,24 @@ define(['jquery', 'backbone', 'underscore'], function($, Backbone, _) {
},
+ destroy: function() {
+
+ },
+
+ restart: function(options) {
+ options || (options = {});
+ options.url = 'api/restartFile/' + this.get('fid');
+
+ return $.ajax(options);
+ },
+
// Any time a model attribute is set, this method is called
validate: function(attrs) {
},
isDownload : function() {
- return this.has('download')
+ return this.has('download');
}
});
diff --git a/module/web/static/js/models/Package.js b/module/web/static/js/models/Package.js
index 24f04519e..c5eb3eaac 100644
--- a/module/web/static/js/models/Package.js
+++ b/module/web/static/js/models/Package.js
@@ -54,6 +54,16 @@ define(['jquery', 'backbone', 'underscore', 'collections/FileList', 'require'],
return Backbone.Model.prototype.destroy.call(this, options);
},
+ restart: function(options) {
+ options || (options = {});
+ var self = this;
+ options.url = 'api/restartPackage/' + this.get('pid');
+ options.success = function() {
+ self.fetch();
+ };
+ return $.ajax(options);
+ },
+
parse: function(resp) {
// Package is loaded from tree collection
if (_.has(resp, 'root')) {
@@ -75,11 +85,6 @@ define(['jquery', 'backbone', 'underscore', 'collections/FileList', 'require'],
return Backbone.model.prototype.parse.call(this, resp);
},
- // Package data is complete when it contains collection for containing files or packs
- isLoaded: function() {
- return this.has('files');
- },
-
// Any time a model attribute is set, this method is called
validate: function(attrs) {