mirror of https://gitee.com/bigwinds/arangodb
foxxActiveView
This commit is contained in:
parent
027bda9ded
commit
111b89f1c6
|
@ -1,34 +1,6 @@
|
||||||
<script id="foxxActiveView.ejs" type="text/template">
|
<script id="foxxActiveView.ejs" type="text/template">
|
||||||
<% var appInfos = attributes.app.split(":"); %>
|
<img src="foxxes/thumbnail/<%=attributes.app %>" height="50" width="50" alt="Icon for App" class="icon">
|
||||||
<div class="iconSet">
|
<h5 class="collectionName">
|
||||||
<span class="icon_arangodb_settings2" alt="Edit application properties" title="Edit application properties"></span>
|
<%= attributes.mount %>
|
||||||
<span class="icon_arangodb_info" title="Show API documentation"></span>
|
</h5>
|
||||||
</div>
|
|
||||||
<img src="foxxes/thumbnail/<%=attributes.app %>" height="50" width="50" alt="" class="icon">
|
|
||||||
<%if (attributes.development) {%>
|
|
||||||
<div class="tileBadge">
|
|
||||||
<span>
|
|
||||||
<div class="corneredBadge loaded">
|
|
||||||
development
|
|
||||||
</div>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<%} else if (attributes.active) {%>
|
|
||||||
<div class="tileBadge">
|
|
||||||
<span>
|
|
||||||
<div class="corneredBadge loaded">
|
|
||||||
active
|
|
||||||
</div>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<%} else {%>
|
|
||||||
<div class="tileBadge">
|
|
||||||
<span>
|
|
||||||
<div class="corneredBadge unloaded">
|
|
||||||
inactive
|
|
||||||
</div>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<%}%>
|
|
||||||
<h5 class="collectionName"><%= appInfos[1] %><%= attributes.isSystem && attributes.mount.charAt(0) === "/" && attributes.mount.charAt(1) === "_" ? " (system)" : "" %><%= appInfos[0] === "dev" ? " (dev)" : ""%></h5>
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -19,9 +19,7 @@
|
||||||
template: templateEngine.createTemplate("foxxActiveView.ejs"),
|
template: templateEngine.createTemplate("foxxActiveView.ejs"),
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
'click .icon_arangodb_info' : 'showDocu',
|
'click' : 'openAppDetailView'
|
||||||
'click .icon_arangodb_settings2' : 'editFoxxDialog',
|
|
||||||
'click .icon' : 'openAppInNewTab'
|
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function(){
|
initialize: function(){
|
||||||
|
@ -53,112 +51,6 @@
|
||||||
_.bindAll(this, 'render');
|
_.bindAll(this, 'render');
|
||||||
},
|
},
|
||||||
|
|
||||||
toggle: function(type, shouldShow) {
|
|
||||||
if (this.model.get("development")) {
|
|
||||||
if ("devel" === type) {
|
|
||||||
this._show = shouldShow;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ("active" === type && true === this.model.get("active")) {
|
|
||||||
this._show = shouldShow;
|
|
||||||
}
|
|
||||||
if ("inactive" === type && false === this.model.get("active")) {
|
|
||||||
this._show = shouldShow;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this._show) {
|
|
||||||
$(this.el).show();
|
|
||||||
} else {
|
|
||||||
$(this.el).hide();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
fillValues: function() {
|
|
||||||
var list = [],
|
|
||||||
appInfos = this.model.get("app").split(":"),
|
|
||||||
name = appInfos[1],
|
|
||||||
// versOptions = [],
|
|
||||||
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 {
|
|
||||||
isSystem = "No";
|
|
||||||
}
|
|
||||||
if (this.model.get("active")) {
|
|
||||||
active = "Active";
|
|
||||||
} else {
|
|
||||||
active = "Inactive";
|
|
||||||
}
|
|
||||||
list.push(modView.createReadOnlyEntry(
|
|
||||||
"id_name", "Name", name
|
|
||||||
));
|
|
||||||
var link = window.location.origin +
|
|
||||||
"/_db/" + encodeURIComponent(arangoHelper.currentDatabase()) +
|
|
||||||
"/_admin/aardvark/swagger/" + encodeURIComponent(encodeURIComponent(this.model.get("mount")));
|
|
||||||
list.push(modView.createReadOnlyEntry(
|
|
||||||
"id_documentationJsonUrl",
|
|
||||||
"API docs",
|
|
||||||
"<a href=\"" + link + "\" target=\"_blank\">JSON-file for Swagger</a>"
|
|
||||||
));
|
|
||||||
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]));
|
|
||||||
* list.push(modView.createSelectEntry()
|
|
||||||
*/
|
|
||||||
list.push(modView.createReadOnlyEntry(
|
|
||||||
"id_version", "Version", appInfos[2]
|
|
||||||
));
|
|
||||||
list.push(modView.createReadOnlyEntry(
|
|
||||||
"id_system", "System", isSystem
|
|
||||||
));
|
|
||||||
list.push(modView.createReadOnlyEntry(
|
|
||||||
"id_status", "Status", active
|
|
||||||
));
|
|
||||||
return list;
|
|
||||||
},
|
|
||||||
|
|
||||||
editFoxxDialog: function(event) {
|
|
||||||
event.stopPropagation();
|
|
||||||
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 if (!isSystem) {
|
|
||||||
delete this.buttonConfig[0].disabled;
|
|
||||||
}
|
|
||||||
this.showMod(this.buttonConfig, this.fillValues());
|
|
||||||
},
|
|
||||||
|
|
||||||
changeFoxx: function() {
|
changeFoxx: function() {
|
||||||
var mount = $("#change-mount-point").val();
|
var mount = $("#change-mount-point").val();
|
||||||
var failed = false;
|
var failed = false;
|
||||||
|
@ -191,28 +83,12 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
openAppInNewTab: function() {
|
openAppDetailView: function() {
|
||||||
var url = window.location.origin + "/_db/" +
|
// var url = window.location.origin + "/_db/" +
|
||||||
encodeURIComponent(arangoHelper.currentDatabase()) +
|
// encodeURIComponent(arangoHelper.currentDatabase()) +
|
||||||
this.model.get("mount");
|
// this.model.get("mount");
|
||||||
var windowRef = window.open(url, this.model.get("title"));
|
// var windowRef = window.open(url, this.model.get("title"));
|
||||||
windowRef.focus();
|
alert('Michael will insert something here for ' + this.model.get('mount') + '. Stay tuned.');
|
||||||
},
|
|
||||||
|
|
||||||
uninstall: function () {
|
|
||||||
this.model.destroy({ async: false });
|
|
||||||
window.modalView.hide();
|
|
||||||
this.appsView.reload();
|
|
||||||
},
|
|
||||||
|
|
||||||
showDocu: function(event) {
|
|
||||||
event.stopPropagation();
|
|
||||||
window.App.navigate(
|
|
||||||
"application/documentation/" + encodeURIComponent(this.model.get("_key")),
|
|
||||||
{
|
|
||||||
trigger: true
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function(){
|
render: function(){
|
||||||
|
|
Loading…
Reference in New Issue