You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

40 lines
878 B
JavaScript

class Controller {
constructor(model, view) {
this.model = model;
this.view = view;
4 years ago
this.redrawDirTree(view);
4 years ago
var cloneBtn = document.getElementsByClassName("clone")[0];
var purgeBtn = document.getElementsByClassName("purge")[0];
cloneBtn.addEventListener("click", this.cloneRep.bind(this));
4 years ago
purgeBtn.addEventListener("click", this.purgeFS.bind(this));
}
4 years ago
purgeFS() {
this.model.purgeFS();
//window.location.reload();
4 years ago
this.redrawDirTree(this.view);
}
cloneRep(repurl) {
var that = this;
this.model.cloneRep().then(
function (value) {
that.redrawDirTree(that.view);
},
function (error) {}
);
}
4 years ago
redrawDirTree(view) {
this.model.dirTree().then(
function (value) {
4 years ago
view.removeDirTree();
view.drawDirTree(value);
},
function (error) {}
4 years ago
);
}
}