mirror of https://gitee.com/bigwinds/arangodb
Aardvark: allow (un-)mounting non-internal system apps, prohibit mounting reserved paths.
This commit is contained in:
parent
369485b129
commit
00a0b4513a
|
@ -31,5 +31,5 @@
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<%}%>
|
<%}%>
|
||||||
<h5 class="collectionName"><%= appInfos[1] %><%= attributes.isSystem ? " (system)" : "" %><%= appInfos[0] === "dev" ? " (dev)" : ""%></h5>
|
<h5 class="collectionName"><%= appInfos[1] %><%= attributes.isSystem && attributes.mount.charAt(0) === "/" && attributes.mount.charAt(1) === "_" ? " (system)" : "" %><%= appInfos[0] === "dev" ? " (dev)" : ""%></h5>
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -27,14 +27,24 @@
|
||||||
|
|
||||||
initialize: function(){
|
initialize: function(){
|
||||||
this._show = true;
|
this._show = true;
|
||||||
this.buttonConfig = [
|
var mount = this.model.get("mount");
|
||||||
window.modalView.createDeleteButton(
|
var isSystem = (
|
||||||
"Uninstall", this.uninstall.bind(this)
|
this.model.get("isSystem") &&
|
||||||
),
|
mount.charAt(0) === '/' &&
|
||||||
window.modalView.createSuccessButton(
|
mount.charAt(1) === '_'
|
||||||
"Save", this.changeFoxx.bind(this)
|
);
|
||||||
)
|
if (isSystem) {
|
||||||
];
|
this.buttonConfig = [];
|
||||||
|
} else {
|
||||||
|
this.buttonConfig = [
|
||||||
|
window.modalView.createDeleteButton(
|
||||||
|
"Uninstall", this.uninstall.bind(this)
|
||||||
|
),
|
||||||
|
window.modalView.createSuccessButton(
|
||||||
|
"Save", this.changeFoxx.bind(this)
|
||||||
|
)
|
||||||
|
];
|
||||||
|
}
|
||||||
this.showMod = window.modalView.show.bind(
|
this.showMod = window.modalView.show.bind(
|
||||||
window.modalView,
|
window.modalView,
|
||||||
"modalTable.ejs",
|
"modalTable.ejs",
|
||||||
|
@ -72,6 +82,12 @@
|
||||||
isSystem,
|
isSystem,
|
||||||
active,
|
active,
|
||||||
modView = window.modalView;
|
modView = window.modalView;
|
||||||
|
var mount = this.model.get("mount");
|
||||||
|
var editable = !(
|
||||||
|
this.model.get("isSystem") &&
|
||||||
|
mount.charAt(0) === '/' &&
|
||||||
|
mount.charAt(1) === '_'
|
||||||
|
);
|
||||||
if (this.model.get("isSystem")) {
|
if (this.model.get("isSystem")) {
|
||||||
isSystem = "Yes";
|
isSystem = "Yes";
|
||||||
} else {
|
} else {
|
||||||
|
@ -85,18 +101,24 @@
|
||||||
list.push(modView.createReadOnlyEntry(
|
list.push(modView.createReadOnlyEntry(
|
||||||
"id_name", "Name", name
|
"id_name", "Name", name
|
||||||
));
|
));
|
||||||
list.push(modView.createTextEntry(
|
if (editable) {
|
||||||
"change-mount-point", "Mount", this.model.get("mount"),
|
list.push(modView.createTextEntry(
|
||||||
"The path where the app can be reached.",
|
"change-mount-point", "Mount", this.model.get("mount"),
|
||||||
"mount-path",
|
"The path where the app can be reached.",
|
||||||
true,
|
"mount-path",
|
||||||
[
|
true,
|
||||||
{
|
[
|
||||||
rule: Joi.string().required(),
|
{
|
||||||
msg: "No mount-path given."
|
rule: Joi.string().required(),
|
||||||
}
|
msg: "No mount-path given."
|
||||||
]
|
}
|
||||||
));
|
]
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
list.push(modView.createReadOnlyEntry(
|
||||||
|
"change-mount-point", "Mount", this.model.get("mount")
|
||||||
|
));
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* For the future, update apps to available newer versions
|
* For the future, update apps to available newer versions
|
||||||
* versOptions.push(modView.createOptionEntry(appInfos[2]));
|
* versOptions.push(modView.createOptionEntry(appInfos[2]));
|
||||||
|
@ -116,9 +138,15 @@
|
||||||
|
|
||||||
editFoxxDialog: function(event) {
|
editFoxxDialog: function(event) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
if (this.model.get("isSystem") || this.model.get("development")) {
|
var mount = this.model.get("mount");
|
||||||
|
var isSystem = (
|
||||||
|
this.model.get("isSystem") &&
|
||||||
|
mount.charAt(0) === '/' &&
|
||||||
|
mount.charAt(1) === '_'
|
||||||
|
);
|
||||||
|
if (this.model.get("development")) {
|
||||||
this.buttonConfig[0].disabled = true;
|
this.buttonConfig[0].disabled = true;
|
||||||
} else {
|
} else if (!isSystem) {
|
||||||
delete this.buttonConfig[0].disabled;
|
delete this.buttonConfig[0].disabled;
|
||||||
}
|
}
|
||||||
this.showMod(this.buttonConfig, this.fillValues());
|
this.showMod(this.buttonConfig, this.fillValues());
|
||||||
|
@ -163,11 +191,9 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
uninstall: function () {
|
uninstall: function () {
|
||||||
if (!this.model.get("isSystem")) {
|
this.model.destroy({ async: false });
|
||||||
this.model.destroy({ async: false });
|
window.modalView.hide();
|
||||||
window.modalView.hide();
|
this.appsView.reload();
|
||||||
this.appsView.reload();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
showDocu: function(event) {
|
showDocu: function(event) {
|
||||||
|
|
|
@ -91,8 +91,6 @@
|
||||||
"Install", this.installDialog.bind(this)
|
"Install", this.installDialog.bind(this)
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
var buttonSystemInfoConfig = [
|
|
||||||
];
|
|
||||||
this.showMod = window.modalView.show.bind(
|
this.showMod = window.modalView.show.bind(
|
||||||
window.modalView,
|
window.modalView,
|
||||||
"modalTable.ejs",
|
"modalTable.ejs",
|
||||||
|
@ -123,12 +121,6 @@
|
||||||
"Application Settings",
|
"Application Settings",
|
||||||
buttonInfoMultipleVersionsConfigUpdate
|
buttonInfoMultipleVersionsConfigUpdate
|
||||||
);
|
);
|
||||||
this.showSystemInfoMod = window.modalView.show.bind(
|
|
||||||
window.modalView,
|
|
||||||
"modalTable.ejs",
|
|
||||||
"Application Settings",
|
|
||||||
buttonSystemInfoConfig
|
|
||||||
);
|
|
||||||
this.showPurgeMod = window.modalView.show.bind(
|
this.showPurgeMod = window.modalView.show.bind(
|
||||||
window.modalView,
|
window.modalView,
|
||||||
"modalTable.ejs",
|
"modalTable.ejs",
|
||||||
|
@ -334,38 +326,23 @@
|
||||||
infoDialog: function(event) {
|
infoDialog: function(event) {
|
||||||
var name = this.model.get("name"),
|
var name = this.model.get("name"),
|
||||||
mountinfo = this.model.collection.gitInfo(name),
|
mountinfo = this.model.collection.gitInfo(name),
|
||||||
versions, isSystem = false, isGit;
|
isGit;
|
||||||
|
|
||||||
if (mountinfo.git === true) {
|
if (mountinfo.git === true) {
|
||||||
this.model.set("isGit", mountinfo.git);
|
this.model.set("isGit", mountinfo.git);
|
||||||
this.model.set("gitUrl", mountinfo.url);
|
this.model.set("gitUrl", mountinfo.url);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.model.get("isSystem")) {
|
|
||||||
isSystem = true;
|
|
||||||
} else {
|
|
||||||
isSystem = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
versions = this.model.get("versions");
|
|
||||||
isGit = this.model.get("isGit");
|
isGit = this.model.get("isGit");
|
||||||
|
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
if (isSystem === false && !versions && !isGit) {
|
|
||||||
this.showInfoMod(this.fillInfoValues());
|
this[
|
||||||
}
|
this.model.get("versions")
|
||||||
else if (isSystem === false && !versions && isGit) {
|
? (isGit ? 'showInfoMultipleVersionsModUpdate' : 'showInfoMultipleVersionsMod')
|
||||||
this.showInfoModUpdate(this.fillInfoValues());
|
: (isGit ? 'showInfoModUpdate' : 'showInfoMod')
|
||||||
}
|
](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());
|
|
||||||
}
|
|
||||||
this.selectHighestVersion();
|
this.selectHighestVersion();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -401,9 +378,12 @@
|
||||||
install: function() {
|
install: function() {
|
||||||
var mountPoint = $("#mount-point").val(),
|
var mountPoint = $("#mount-point").val(),
|
||||||
version = "",
|
version = "",
|
||||||
regex = /^(\/[^\/\s]+)+$/,
|
|
||||||
self = this;
|
self = this;
|
||||||
if (!regex.test(mountPoint)){
|
if (/^\/_.+$/.test(mountPoint)) {
|
||||||
|
alert("Sorry, mount paths starting with an underscore are reserved for internal use.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!/^(\/[^\/\s]+)+$/.test(mountPoint)){
|
||||||
alert("Sorry, you have to give a valid mount point, e.g.: /myPath");
|
alert("Sorry, you have to give a valid mount point, e.g.: /myPath");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue