ID search
This commit is contained in:
parent
cedc384ba1
commit
40730cbbae
@ -32,23 +32,26 @@ class SearchBar: Reactor.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function render() {
|
function render() {
|
||||||
return <div #search-id><input|text @{this.search_id} novalue={translate("Search ID")} />
|
return <div .search-id>
|
||||||
|
<span .search-icon>{search_icon}</span>
|
||||||
|
<input|text @{this.search_id} novalue={translate("Search ID")} />
|
||||||
{this.value && <span .clear-input>{clear_icon}</span>}
|
{this.value && <span .clear-input>{clear_icon}</span>}
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
event click $(span.clear-input svg) {
|
event click $(span.clear-input) {
|
||||||
this.search_id.value = '';
|
this.search_id.value = '';
|
||||||
this.onChange();
|
this.onChange('');
|
||||||
}
|
}
|
||||||
|
|
||||||
event change $(input) (_, el) {
|
event change $(input) (_, el) {
|
||||||
this.value = el.value;
|
this.onChange(el.value.trim());
|
||||||
this.onChange();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onChange() {
|
function onChange(v) {
|
||||||
this.parent.onChange();
|
this.value = v;
|
||||||
|
this.update();
|
||||||
|
this.parent.filter(v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +64,7 @@ class SessionStyle: Reactor.Component {
|
|||||||
|
|
||||||
function render() {
|
function render() {
|
||||||
var sessionsStyle = getSessionsStyle(this.type);
|
var sessionsStyle = getSessionsStyle(this.type);
|
||||||
return <div #sessions-style>
|
return <div .sessions-style>
|
||||||
<span class={sessionsStyle == "tile" ? "active" : "inactive"}>{svg_tile}</span>
|
<span class={sessionsStyle == "tile" ? "active" : "inactive"}>{svg_tile}</span>
|
||||||
<span class={sessionsStyle != "tile" ? "active" : "inactive"}>{svg_list}</span>
|
<span class={sessionsStyle != "tile" ? "active" : "inactive"}>{svg_list}</span>
|
||||||
</div>;
|
</div>;
|
||||||
@ -71,7 +74,8 @@ class SessionStyle: Reactor.Component {
|
|||||||
var option = getSessionsStyleOption(this.type);
|
var option = getSessionsStyleOption(this.type);
|
||||||
var sessionsStyle = getSessionsStyle(this.type);
|
var sessionsStyle = getSessionsStyle(this.type);
|
||||||
handler.set_option(option, sessionsStyle == "tile" ? "list" : "tile");
|
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 sessions = [];
|
||||||
this var type = "";
|
this var type = "";
|
||||||
this var style;
|
this var style;
|
||||||
|
this var filterPattern = "";
|
||||||
|
|
||||||
function this(params) {
|
function this(params) {
|
||||||
this.sessions = params.sessions;
|
this.sessions = params.sessions;
|
||||||
@ -86,8 +91,24 @@ class SessionList: Reactor.Component {
|
|||||||
this.style = getSessionsStyle(params.type);
|
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() {
|
function render() {
|
||||||
var sessions = this.sessions;
|
var sessions = this.getSessions();
|
||||||
if (sessions.length == 0) return <span />;
|
if (sessions.length == 0) return <span />;
|
||||||
var me = this;
|
var me = this;
|
||||||
sessions = sessions.map(function(x) { return me.getSession(x); });
|
sessions = sessions.map(function(x) { return me.getSession(x); });
|
||||||
|
104
src/ui/index.css
104
src/ui/index.css
@ -39,25 +39,75 @@ body {
|
|||||||
padding: 20px;
|
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;
|
padding: 0;
|
||||||
position: relative;
|
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;
|
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;
|
color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,32 +204,6 @@ div.recent-sessions-content {
|
|||||||
flow: horizontal-flow;
|
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 {
|
div.remote-session {
|
||||||
border-radius: 1em;
|
border-radius: 1em;
|
||||||
height: 140px;
|
height: 140px;
|
||||||
|
@ -55,15 +55,20 @@ class RecentSessions: Reactor.Component {
|
|||||||
var sessions = handler.get_recent_sessions();
|
var sessions = handler.get_recent_sessions();
|
||||||
if (sessions.length == 0) return <span />;
|
if (sessions.length == 0) return <span />;
|
||||||
return <div style="width: *">
|
return <div style="width: *">
|
||||||
<div #sessions-bar>
|
<div .sessions-bar>
|
||||||
<div style="width:*">
|
<div style="width:*">
|
||||||
{translate("Recent Sessions")}
|
{translate("Recent Sessions")}
|
||||||
|
</div>
|
||||||
|
<SearchBar parent={this} />
|
||||||
|
{!app.hidden && <SessionStyle />}
|
||||||
</div>
|
</div>
|
||||||
{!app.hidden && <SessionStyle />}
|
{!app.hidden && <SessionList @{this.sessionList} style={sessionsStyle} sessions={sessions} />}
|
||||||
</div>
|
|
||||||
{!app.hidden && <SessionList style={sessionsStyle} sessions={sessions} />}
|
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function filter(v) {
|
||||||
|
this.sessionList.filter(v);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function createNewConnect(id, type) {
|
function createNewConnect(id, type) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user