1
0
Fork 0

added github update for foxx applications via frontend

This commit is contained in:
Heiko Kernbach 2014-06-20 16:09:13 +02:00
parent 5ef874f8f3
commit 7aaaa88f85
2 changed files with 72 additions and 6 deletions

View File

@ -27,6 +27,7 @@
result = true;
},
error: function(data) {
console.log(data);
result = false;
}
});
@ -53,6 +54,26 @@
return result;
},
gitInfo: function (key) {
var result;
$.ajax({
cache: false,
type: "GET",
async: false, // sequential calls!
url: "/_admin/aardvark/foxxes/gitinfo/"+key,
contentType: "application/json",
processData: false,
success: function(data) {
result = data;
},
error: function(data) {
result = data;
}
});
return result;
},
purgeFoxx: function (key) {
var msg, url = "/_admin/aardvark/foxxes/purge/"+key;
$.ajax({

View File

@ -40,6 +40,14 @@
)
];
var buttonInfoConfig = [
window.modalView.createDeleteButton(
"Remove", this.confirmRemovalSingle.bind(this)
),
window.modalView.createSuccessButton(
"Install", this.installDialog.bind(this)
)
];
var buttonInfoConfigUpdate = [
window.modalView.createDeleteButton(
"Remove", this.confirmRemovalSingle.bind(this)
),
@ -51,6 +59,17 @@
)
];
var buttonInfoMultipleVersionsConfig = [
window.modalView.createDeleteButton(
"Remove All", this.confirmRemovalAll.bind(this)
),
window.modalView.createDeleteButton(
"Remove", this.confirmRemovalSingle.bind(this)
),
window.modalView.createSuccessButton(
"Install", this.installDialog.bind(this)
)
];
var buttonInfoMultipleVersionsConfigUpdate = [
window.modalView.createDeleteButton(
"Remove All", this.confirmRemovalAll.bind(this)
),
@ -78,12 +97,24 @@
"Application Settings",
buttonInfoConfig
);
this.showInfoModUpdate = window.modalView.show.bind(
window.modalView,
"modalTable.ejs",
"Application Settings",
buttonInfoConfigUpdate
);
this.showInfoMultipleVersionsMod = window.modalView.show.bind(
window.modalView,
"modalTable.ejs",
"Application Settings",
buttonInfoMultipleVersionsConfig
);
this.showInfoMultipleVersionsModUpdate = window.modalView.show.bind(
window.modalView,
"modalTable.ejs",
"Application Settings",
buttonInfoMultipleVersionsConfigUpdate
);
this.showSystemInfoMod = window.modalView.show.bind(
window.modalView,
"modalTable.ejs",
@ -267,7 +298,15 @@
},
infoDialog: function(event) {
var versions, isSystem = false;
var name = this.model.get("name"),
mountinfo = this.model.collection.gitInfo(name),
versions, isSystem = false, isGit;
if (mountinfo.git === true) {
this.model.set("isGit", mountinfo.git);
this.model.set("gitUrl", mountinfo.url);
}
if (this.model.get("isSystem")) {
isSystem = true;
} else {
@ -275,14 +314,21 @@
}
versions = this.model.get("versions");
isGit = this.model.get("isGit");
event.stopPropagation();
if (isSystem === false && !versions) {
if (isSystem === false && !versions && !isGit) {
this.showInfoMod(this.fillInfoValues());
}
else if (isSystem === false && versions) {
else if (isSystem === false && !versions && isGit) {
this.showInfoModUpdate(this.fillInfoValues());
}
else if (isSystem === false && versions && !isGit) {
this.showInfoMultipleVersionsMod(this.fillInfoValues());
}
else if (isSystem === false && versions && isGit) {
this.showInfoMultipleVersionsModUpdate(this.fillInfoValues());
}
else {
this.showSystemInfoMod(this.fillInfoValues());
}
@ -301,8 +347,7 @@
},
update: function() {
var url = this.model.get("git"),
name = '',
var url = this.model.get("gitUrl"),
version = 'master',
result;
@ -311,7 +356,7 @@
return;
}
result = this.collection.installFoxxFromGithub(url, name, version);
result = this.model.collection.installFoxxFromGithub(url, name, version);
if (result === true) {
window.modalView.hide();
window.App.applicationsView.reload();