Merge branch 'master' of github.com-rustdesk:rustdesk/rustdesk

This commit is contained in:
rustdesk 2022-01-29 16:56:39 +08:00
commit 495cc9056e
2 changed files with 21 additions and 7 deletions

View File

@ -25,8 +25,8 @@ class SearchBar: Reactor.Component {
function render() { function render() {
var value = searchPatterns[this.type] || ""; var value = searchPatterns[this.type] || "";
var me = this; var me = this;
self.timer(1ms, function() { me.search_id.value = value; }); self.timer(1ms, function() { (me.search_id || {}).value = value; });
return <div .search-id> return <div .search-id style="margin-left: 12px">
<span .search-icon>{search_icon}</span> <span .search-icon>{search_icon}</span>
<input|text @{this.search_id} novalue={translate("Search ID")} /> <input|text @{this.search_id} novalue={translate("Search ID")} />
{value && <span .clear-input>{clear_icon}</span>} {value && <span .clear-input>{clear_icon}</span>}
@ -285,6 +285,7 @@ class MultipleSessions: Reactor.Component {
self.timer(60ms, function() { self.timer(60ms, function() {
me.hidden = false; me.hidden = false;
me.update(); me.update();
self.timer(30ms, function() { me.onSize(); });
}); });
} }
@ -297,12 +298,25 @@ class MultipleSessions: Reactor.Component {
} }
function onSize() { function onSize() {
var w = this.$(.sessions-bar).box(#width) - 220; var w = this.$(.sessions-bar .sessions-tab).box(#width);
this.$(#sessions-type span).style.set{ var len = translate('Recent Sessions').length;
"max-width": (w / (handler.is_installed() ? 2 : 3)) + "px", var totalChars = 0;
var nEle = 0;
for (var el in this.$$(#sessions-type span)) {
nEle += 1;
var n = el.text.length;
totalChars += n;
}
for (var el in this.$$(#sessions-type span)) {
var n = el.text.length;
var maxWidth = (w - nEle * 2 * 8) * n / totalChars;
if (maxWidth < 0) maxWidth = 36;
el.style.set{
"max-width": maxWidth + "px",
}; };
} }
} }
}
function discover() { function discover() {
handler.discover(); handler.discover();

View File

@ -50,7 +50,7 @@ div.sessions-bar {
div.sessions-tab span { div.sessions-tab span {
display: inline-block; display: inline-block;
padding: 6px 12px; padding: 6px 8px;
cursor: pointer; cursor: pointer;
@ELLIPSIS; @ELLIPSIS;
} }