;
}
- event click $(span.clear-input svg) {
+ event click $(span.clear-input) {
this.search_id.value = '';
- this.onChange();
+ this.onChange('');
}
event change $(input) (_, el) {
- this.value = el.value;
- this.onChange();
+ this.onChange(el.value.trim());
}
- function onChange() {
- this.parent.onChange();
+ function onChange(v) {
+ this.value = v;
+ this.update();
+ this.parent.filter(v);
}
}
@@ -61,7 +64,7 @@ class SessionStyle: Reactor.Component {
function render() {
var sessionsStyle = getSessionsStyle(this.type);
- return
+ return
{svg_tile}
{svg_list}
;
@@ -71,7 +74,8 @@ class SessionStyle: Reactor.Component {
var option = getSessionsStyleOption(this.type);
var sessionsStyle = getSessionsStyle(this.type);
handler.set_option(option, sessionsStyle == "tile" ? "list" : "tile");
- stupidUpdate(app);
+ //stupidUpdate(app); // seems fixed in new sciter
+ app.update();
}
}
@@ -79,6 +83,7 @@ class SessionList: Reactor.Component {
this var sessions = [];
this var type = "";
this var style;
+ this var filterPattern = "";
function this(params) {
this.sessions = params.sessions;
@@ -86,8 +91,24 @@ class SessionList: Reactor.Component {
this.style = getSessionsStyle(params.type);
}
+ function filter(v) {
+ this.filterPattern = v;
+ this.update();
+ }
+
+ function getSessions() {
+ var p = this.filterPattern;
+ if (!p) return this.sessions;
+ var tmp = [];
+ this.sessions.map(function(s) {
+ var name = s[4] || s.alias || s[0] || s.id || "";
+ if (name.indexOf(p) >= 0) tmp.push(s);
+ });
+ return tmp;
+ }
+
function render() {
- var sessions = this.sessions;
+ var sessions = this.getSessions();
if (sessions.length == 0) return
;
var me = this;
sessions = sessions.map(function(x) { return me.getSession(x); });
diff --git a/src/ui/index.css b/src/ui/index.css
index 5ab163f83..ccc14edd1 100644
--- a/src/ui/index.css
+++ b/src/ui/index.css
@@ -39,25 +39,75 @@ body {
padding: 20px;
}
-div#search-id {
+div.sessions-bar {
+ color: color(light-text);
+ padding-top: 0.5em;
+ border-top: color(border) solid 1px;
+ margin-bottom: 1em;
+ position: relative;
+ flow: horizontal;
+}
+
+div.sessions-style {
+ margin-left: 0.5em;
+}
+
+div.sessions-style span {
+ display: inline-block;
+ padding: 6px 12px;
+ cursor: pointer;
+}
+
+div.sessions-style svg {
+ size: 14px;
+}
+
+div.sessions-style span.active {
+ cursor: default;
+ border-radius: 3px;
+ background: white;
+ color: black;
+}
+
+div.search-id {
+ width: 200px;
padding: 0;
position: relative;
-}
-
-span.clear-input svg {
- display: none;
- position: absolute;
- right: 6px;
- top: 10px;
- size: 1.4em;
- color: color(border);
-}
-
-div#search-id:hover span.clear-input svg {
display: inline-block;
}
-span.clear-input svg:hover {
+div.search-id input {
+ font-size: 1em;
+ height: 20px;
+ border: none;
+ padding-left: 26px;
+}
+
+div.search-id span {
+ position: absolute;
+ top: 0px;
+ padding: 6px;
+ color: color(border);
+}
+
+div.search-id svg {
+ size: 14px;
+}
+
+span.search-icon {
+ left: 0px;
+}
+
+span.clear-input {
+ display: none;
+ right: 0px;
+}
+
+div.search-id:hover span.clear-input {
+ display: inline-block;
+}
+
+span.clear-input:hover {
color: black;
}
@@ -154,32 +204,6 @@ div.recent-sessions-content {
flow: horizontal-flow;
}
-div#sessions-bar {
- color: color(light-text);
- padding-top: 0.5em;
- border-top: color(border) solid 1px;
- margin-bottom: 1em;
- position: relative;
- flow: horizontal;
-}
-
-div#sessions-bar span {
- display: inline-block;
- padding: 0.5em 1em;
- cursor: pointer;
-}
-
-div#sessions-bar svg {
- size: 14px;
-}
-
-div#sessions-bar span.active {
- cursor: default;
- border-radius: 3px;
- background: white;
- color: black;
-}
-
div.remote-session {
border-radius: 1em;
height: 140px;
diff --git a/src/ui/index.tis b/src/ui/index.tis
index 777c73b1d..0980f2fe9 100644
--- a/src/ui/index.tis
+++ b/src/ui/index.tis
@@ -55,15 +55,20 @@ class RecentSessions: Reactor.Component {
var sessions = handler.get_recent_sessions();
if (sessions.length == 0) return
;
return
-
-
- {translate("Recent Sessions")}
+
+
+ {translate("Recent Sessions")}
+
+
+ {!app.hidden &&
}
- {!app.hidden &&
}
-
- {!app.hidden &&
}
+ {!app.hidden &&
}
;
}
+
+ function filter(v) {
+ this.sessionList.filter(v);
+ }
}
function createNewConnect(id, type) {