Commit 120a1cdb authored by Benjamin Fischer's avatar Benjamin Fischer
Browse files

MainMenu: icons in fron of workspaces are colored now

parent 7fabe2dc
<li :class="class">
<a @click.stop="clicked">
<i :class="iconClass | iconPrefix"></i>
<i :class="iconClass | iconPrefix" :style="{'color':color||'black'}"></i>
<span>{{data.serverConfig.name}}</span>
</a>
<partial v-if="hasSubmenu" name="menu-root"></partial>
......
......@@ -43,17 +43,8 @@ define([
closeIconFinal: function() {
return this.closeIcon || "fa-times";
},
numberWsConnected: function() {
var n = 0;
var ws = vispa.wsManager._vueData.workspaces;
for(var id in ws) {
if (ws[id].state !== "disconnected")
n++;
}
return n;
},
color: function() {
if (this.numberWsConnected<=1 && !vispa.wsManager.prefs.get("colorEvenSingle")) return "";
if (!vispa.wsManager.useColor) return "";
return this.instance.workspace ?
this.instance.workspace.color :
vispa.wsManager.prefs.get("color");
......
......@@ -4,6 +4,7 @@ define([
"vispa/vue/base",
"vispa/vue/menu",
"vispa/workspace",
"vispa/common/color",
"text!html/index/vue/menu-main.html",
"text!html/index/ws/menu-item.html",
], function(
......@@ -12,6 +13,7 @@ define([
VueBase,
Menu,
Workspace,
Color,
tMainMenu,
tWsItem
) {
......@@ -82,6 +84,15 @@ define([
// state reconstruction question
return ret;
},
color: function () {
if (!Workspace._members.useColor) return;
var c = this.workspace.color;
if (!c) return;
c = new Color(c);
if (!c.value.s) return;
// c.setSaturation(0.5 + 0.5 * c.value.s);
return c.toString();
},
class: function() {
return this.data.state +
(this.hasSubmenu ? " dropdown-submenu" : "");
......@@ -89,18 +100,21 @@ define([
iconClass: function() {
switch (this.data.state) {
case "connected":
return "fa-fw " + (this.current ? "fa-circle" : "fa-circle-thin");
return "fa-fw " + (this.current ? "fa-circle" : "fa-circle-o");
case "disconnected":
return "fa-fw";
default:
return "fa-fw fa-refresh fa-spin";
}
},
workspace: function () {
return Workspace._members.byId(this.data.id);
},
},
methods: {
clicked: function() {
if (this.data.state == "disconnected")
Workspace._members.byId(this.data.id).connect();
this.workspace.connect();
Workspace._members.current = this.data.id;
},
......
......@@ -653,6 +653,35 @@ define([
}
},
/** indent: 1
* .. js:attribute:: activeWorkspaceCount
* :type: Number
*
* The number of connected (more precisely: not disconnected) workspaces.
*/
activeWorkspaceCount: {
descriptor: true,
get: function() {
var n = 0, ws = this._vueData.workspaces;
for (var i in ws)
n += (ws[i].state === "disconnected") ? 0 : 1;
return n;
},
},
/** indent: 1
* .. js:attribute:: useColor
* :type: Bool
*
* Whether the workspaces should use the coloring.
*/
useColor: {
descriptor: true,
get: function() {
return !!this.prefs.get("colorEvenSingle") || this.activeWorkspaceCount>1;
},
},
disconnectAll: function(callback) {
callback = Utils.callback(callback);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment