1
0
Fork 0

hide system applications by default

This commit is contained in:
Jan Steemann 2014-11-13 11:31:12 +01:00
parent bb86006926
commit 0390ea34e6
4 changed files with 65 additions and 44 deletions

View File

@ -1,6 +1,11 @@
v2.3.0 (XXXX-XX-XX) v2.3.0 (XXXX-XX-XX)
------------------- -------------------
* hide system applications in **Applications** tab by default
Display of system applications can be toggled by using the *system applications*
toggle in the UI.
* added HTTP REST API for managing tasks (`/_api/tasks`) * added HTTP REST API for managing tasks (`/_api/tasks`)
* allow passing character lists as optional parameter to AQL functions `TRIM`, * allow passing character lists as optional parameter to AQL functions `TRIM`,

View File

@ -39,12 +39,12 @@
</label> </label>
</a></li> </a></li>
<!--li><a href="#"> <li><a href="#">
<label class="checkbox checkboxLabel"> <label class="checkbox checkboxLabel">
<input class="css-checkbox" type="checkbox" id="checkInactive"> <input class="css-checkbox" type="checkbox" id="checkSystem">
<label class="css-label"></label>Inactive <label class="css-label"></label>System applications
</label> </label>
</a></li>--> </a></li>
</ul> </ul>
<!-- <!--

View File

@ -4,7 +4,6 @@
<span class="icon_arangodb_settings2" alt="Edit application properties" title="Edit application properties"></span> <span class="icon_arangodb_settings2" alt="Edit application properties" title="Edit application properties"></span>
<span class="icon_arangodb_info" title="Show API documentation"></span> <span class="icon_arangodb_info" title="Show API documentation"></span>
</div> </div>
<img src="foxxes/thumbnail/<%=attributes.app %>" height="50" width="50" alt="" class="icon"> <img src="foxxes/thumbnail/<%=attributes.app %>" height="50" width="50" alt="" class="icon">
<%if (attributes.development) {%> <%if (attributes.development) {%>
<div class="tileBadge"> <div class="tileBadge">

View File

@ -10,7 +10,7 @@ window.ApplicationsView = Backbone.View.extend({
events: { events: {
"click #checkDevel" : "toggleDevel", "click #checkDevel" : "toggleDevel",
"click #checkActive" : "toggleActive", "click #checkActive" : "toggleActive",
"click #checkInactive" : "toggleInactive", "click #checkSystem" : "toggleSystem",
"click #foxxToggle" : "slideToggle", "click #foxxToggle" : "slideToggle",
"click #importFoxxToggle" : "slideToggleImport", "click #importFoxxToggle" : "slideToggleImport",
"change #importFoxx" : "uploadSetup", "change #importFoxx" : "uploadSetup",
@ -188,12 +188,14 @@ window.ApplicationsView = Backbone.View.extend({
}); });
}, },
toggleInactive: function() { toggleSystem: function() {
this._showSystem = !this._showSystem;
var self = this; var self = this;
this._showInactive = !this._showInactive;
_.each(this._installedSubViews, function(v) { _.each(this._installedSubViews, function(v) {
v.toggle("inactive", self._showInactive); v.toggle("system", self._showSystem);
}); });
this.createSubViews();
this.renderSubViews();
}, },
hideImportModal: function() { hideImportModal: function() {
@ -232,28 +234,36 @@ window.ApplicationsView = Backbone.View.extend({
v.undelegateEvents(); v.undelegateEvents();
}); });
this.collection.fetch({
success: function() {
self.createSubViews();
self.render();
}
});
},
createSubViews: function() {
var self = this;
this._installedSubViews = { }; this._installedSubViews = { };
this._availableSubViews = { }; this._availableSubViews = { };
this.collection.fetch({ self.collection.each(function (foxx) {
success: function() { if (foxx.get('isSystem') && ! self._showSystem) {
self.collection.each(function (foxx) { return;
var subView; }
if (foxx.get("type") === "app") { var subView;
subView = new window.FoxxInstalledView({ if (foxx.get("type") === "app") {
model: foxx, subView = new window.FoxxInstalledView({
appsView: self model: foxx,
}); appsView: self
self._availableSubViews[foxx.get('_id')] = subView;
} else if (foxx.get("type") === "mount") {
subView = new window.FoxxActiveView({
model: foxx,
appsView: self
});
self._installedSubViews[foxx.get('_id')] = subView;
}
}); });
self.render(); self._availableSubViews[foxx.get('_id')] = subView;
} else if (foxx.get("type") === "mount") {
subView = new window.FoxxActiveView({
model: foxx,
appsView: self
});
self._installedSubViews[foxx.get('_id')] = subView;
} }
}); });
}, },
@ -263,23 +273,41 @@ window.ApplicationsView = Backbone.View.extend({
this._availableSubViews = {}; this._availableSubViews = {};
this._showDevel = true; this._showDevel = true;
this._showActive = true; this._showActive = true;
this._showInactive = true; this._showSystem = false;
this.reload(); this.reload();
}, },
render: function() { render: function() {
this.collection.sort(); this.collection.sort();
$(this.el).html(this.template.render({})); $(this.el).html(this.template.render({}));
var self = this, name; this.renderSubViews();
var versions = {}; this.delegateEvents();
$('#checkActive').attr('checked', this._showActive);
$('#checkDevel').attr('checked', this._showDevel);
$('#checkSystem').attr('checked', this._showSystem);
var self = this;
_.each(this._installedSubViews, function(v) {
v.toggle("devel", self._showDevel);
v.toggle("active", self._showActive);
v.toggle("system", self._showSystem);
});
arangoHelper.fixTooltips("icon_arangodb", "left");
return this;
},
renderSubViews: function () {
$("#availableList").empty();
$("#installedList").empty();
_.each(this._installedSubViews, function (v) { _.each(this._installedSubViews, function (v) {
$("#installedList").append(v.render()); $("#installedList").append(v.render());
}); });
var versions = { };
_.each(this._availableSubViews, function (v) { _.each(this._availableSubViews, function (v) {
name = v.model.get("name"); var name = v.model.get("name");
//look which installed apps have multiple versions //look which installed apps have multiple versions
if (versions[name]) { if (versions[name]) {
@ -293,6 +321,7 @@ window.ApplicationsView = Backbone.View.extend({
}; };
} }
}); });
_.each(this._availableSubViews, function (v) { _.each(this._availableSubViews, function (v) {
var name = v.model.get("name"), var name = v.model.get("name"),
version = v.model.get("version"); version = v.model.get("version");
@ -324,17 +353,5 @@ window.ApplicationsView = Backbone.View.extend({
$("#availableList").append(v.render()); $("#availableList").append(v.render());
} }
}); });
this.delegateEvents();
$('#checkActive').attr('checked', this._showActive);
$('#checkInactive').attr('checked', this._showInactive);
$('#checkDevel').attr('checked', this._showDevel);
_.each(this._installedSubViews, function(v) {
v.toggle("devel", self._showDevel);
v.toggle("active", self._showActive);
v.toggle("inactive", self._showInactive);
});
arangoHelper.fixTooltips("icon_arangodb", "left");
return this;
} }
}); });