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">
|
||||
<% var appInfos = attributes.app.split(":"); %>
|
||||
<div class="iconSet">
|
||||
<span class="icon_arangodb_settings2" alt="Edit application properties" title="Edit application properties"></span>
|
||||
<span class="icon_arangodb_info" title="Show API documentation"></span>
|
||||
</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>
|
||||
<img src="foxxes/thumbnail/<%=attributes.app %>" height="50" width="50" alt="Icon for App" class="icon">
|
||||
<h5 class="collectionName">
|
||||
<%= attributes.mount %>
|
||||
</h5>
|
||||
</script>
|
||||
|
|
|
@ -19,9 +19,7 @@
|
|||
template: templateEngine.createTemplate("foxxActiveView.ejs"),
|
||||
|
||||
events: {
|
||||
'click .icon_arangodb_info' : 'showDocu',
|
||||
'click .icon_arangodb_settings2' : 'editFoxxDialog',
|
||||
'click .icon' : 'openAppInNewTab'
|
||||
'click' : 'openAppDetailView'
|
||||
},
|
||||
|
||||
initialize: function(){
|
||||
|
@ -53,112 +51,6 @@
|
|||
_.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() {
|
||||
var mount = $("#change-mount-point").val();
|
||||
var failed = false;
|
||||
|
@ -191,28 +83,12 @@
|
|||
}
|
||||
},
|
||||
|
||||
openAppInNewTab: function() {
|
||||
var url = window.location.origin + "/_db/" +
|
||||
encodeURIComponent(arangoHelper.currentDatabase()) +
|
||||
this.model.get("mount");
|
||||
var windowRef = window.open(url, this.model.get("title"));
|
||||
windowRef.focus();
|
||||
},
|
||||
|
||||
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
|
||||
}
|
||||
);
|
||||
openAppDetailView: function() {
|
||||
// var url = window.location.origin + "/_db/" +
|
||||
// encodeURIComponent(arangoHelper.currentDatabase()) +
|
||||
// this.model.get("mount");
|
||||
// var windowRef = window.open(url, this.model.get("title"));
|
||||
alert('Michael will insert something here for ' + this.model.get('mount') + '. Stay tuned.');
|
||||
},
|
||||
|
||||
render: function(){
|
||||
|
|
Loading…
Reference in New Issue