diff --git a/js/apps/system/aardvark/frontend/js/templates/foxxActiveView.ejs b/js/apps/system/aardvark/frontend/js/templates/foxxActiveView.ejs index 8668442166..14cb4a6ac9 100644 --- a/js/apps/system/aardvark/frontend/js/templates/foxxActiveView.ejs +++ b/js/apps/system/aardvark/frontend/js/templates/foxxActiveView.ejs @@ -31,5 +31,5 @@ <%}%> -
<%= appInfos[1] %><%= attributes.isSystem ? " (system)" : "" %><%= appInfos[0] === "dev" ? " (dev)" : ""%>
+
<%= appInfos[1] %><%= attributes.isSystem && attributes.mount.charAt(0) === "/" && attributes.mount.charAt(1) === "_" ? " (system)" : "" %><%= appInfos[0] === "dev" ? " (dev)" : ""%>
diff --git a/js/apps/system/aardvark/frontend/js/views/foxxActiveView.js b/js/apps/system/aardvark/frontend/js/views/foxxActiveView.js index b8fdfc4866..6f7b53150a 100644 --- a/js/apps/system/aardvark/frontend/js/views/foxxActiveView.js +++ b/js/apps/system/aardvark/frontend/js/views/foxxActiveView.js @@ -27,14 +27,24 @@ initialize: function(){ this._show = true; - this.buttonConfig = [ - window.modalView.createDeleteButton( - "Uninstall", this.uninstall.bind(this) - ), - window.modalView.createSuccessButton( - "Save", this.changeFoxx.bind(this) - ) - ]; + var mount = this.model.get("mount"); + var isSystem = ( + this.model.get("isSystem") && + mount.charAt(0) === '/' && + mount.charAt(1) === '_' + ); + 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( window.modalView, "modalTable.ejs", @@ -72,6 +82,12 @@ isSystem, active, 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")) { isSystem = "Yes"; } else { @@ -85,18 +101,24 @@ list.push(modView.createReadOnlyEntry( "id_name", "Name", name )); - list.push(modView.createTextEntry( - "change-mount-point", "Mount", this.model.get("mount"), - "The path where the app can be reached.", - "mount-path", - true, - [ - { - rule: Joi.string().required(), - msg: "No mount-path given." - } - ] - )); + if (editable) { + list.push(modView.createTextEntry( + "change-mount-point", "Mount", this.model.get("mount"), + "The path where the app can be reached.", + "mount-path", + true, + [ + { + 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 * versOptions.push(modView.createOptionEntry(appInfos[2])); @@ -116,9 +138,15 @@ editFoxxDialog: function(event) { 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; - } else { + } else if (!isSystem) { delete this.buttonConfig[0].disabled; } this.showMod(this.buttonConfig, this.fillValues()); @@ -163,11 +191,9 @@ }, uninstall: function () { - if (!this.model.get("isSystem")) { - this.model.destroy({ async: false }); - window.modalView.hide(); - this.appsView.reload(); - } + this.model.destroy({ async: false }); + window.modalView.hide(); + this.appsView.reload(); }, showDocu: function(event) { diff --git a/js/apps/system/aardvark/frontend/js/views/foxxInstalledView.js b/js/apps/system/aardvark/frontend/js/views/foxxInstalledView.js index 5991c6eed1..aaf0884927 100644 --- a/js/apps/system/aardvark/frontend/js/views/foxxInstalledView.js +++ b/js/apps/system/aardvark/frontend/js/views/foxxInstalledView.js @@ -91,8 +91,6 @@ "Install", this.installDialog.bind(this) ) ]; - var buttonSystemInfoConfig = [ - ]; this.showMod = window.modalView.show.bind( window.modalView, "modalTable.ejs", @@ -123,12 +121,6 @@ "Application Settings", buttonInfoMultipleVersionsConfigUpdate ); - this.showSystemInfoMod = window.modalView.show.bind( - window.modalView, - "modalTable.ejs", - "Application Settings", - buttonSystemInfoConfig - ); this.showPurgeMod = window.modalView.show.bind( window.modalView, "modalTable.ejs", @@ -334,38 +326,23 @@ infoDialog: function(event) { var name = this.model.get("name"), mountinfo = this.model.collection.gitInfo(name), - versions, isSystem = false, isGit; + 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 { - isSystem = false; - } - - versions = this.model.get("versions"); isGit = this.model.get("isGit"); event.stopPropagation(); - if (isSystem === false && !versions && !isGit) { - this.showInfoMod(this.fillInfoValues()); - } - 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()); - } + + this[ + this.model.get("versions") + ? (isGit ? 'showInfoMultipleVersionsModUpdate' : 'showInfoMultipleVersionsMod') + : (isGit ? 'showInfoModUpdate' : 'showInfoMod') + ](this.fillInfoValues()); + this.selectHighestVersion(); }, @@ -401,9 +378,12 @@ install: function() { var mountPoint = $("#mount-point").val(), version = "", - regex = /^(\/[^\/\s]+)+$/, 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"); return false; }