frontend for session archiving

This commit is contained in:
sawka 2022-12-26 18:50:22 -08:00
parent 5882897e3e
commit 7f9b347562
2 changed files with 18 additions and 4 deletions

View File

@ -2450,6 +2450,12 @@ class MainSideBar extends React.Component<{}, {}> {
let remote : RemoteType = null; let remote : RemoteType = null;
let idx : number = 0; let idx : number = 0;
remotes = sortAndFilterRemotes(remotes); remotes = sortAndFilterRemotes(remotes);
let sessionList = [];
for (let session of model.sessionList) {
if (!session.archived.get() || session.sessionId == activeSessionId) {
sessionList.push(session);
}
}
return ( return (
<div className={cn("main-sidebar", {"collapsed": this.collapsed.get()})}> <div className={cn("main-sidebar", {"collapsed": this.collapsed.get()})}>
<div className="collapse-container"> <div className="collapse-container">
@ -2467,9 +2473,14 @@ class MainSideBar extends React.Component<{}, {}> {
<li className="menu-loading-message"><a>(loading)</a></li> <li className="menu-loading-message"><a>(loading)</a></li>
</If> </If>
<If condition={model.sessionListLoaded.get()}> <If condition={model.sessionListLoaded.get()}>
<For each="session" index="idx" of={model.sessionList}> <For each="session" index="idx" of={sessionList}>
<li key={session.sessionId}><a className={cn({"is-active": activeSessionId == session.sessionId})} onClick={() => this.handleSessionClick(session.sessionId)}> <li key={session.sessionId}><a className={cn({"is-active": activeSessionId == session.sessionId})} onClick={() => this.handleSessionClick(session.sessionId)}>
<If condition={!session.archived.get()}>
<span className="session-num">{idx+1}&nbsp;</span> <span className="session-num">{idx+1}&nbsp;</span>
</If>
<If condition={session.archived.get()}>
<i title="archived" className="fa fa-archive"/>&nbsp;
</If>
{session.name.get()} {session.name.get()}
</a></li> </a></li>
</For> </For>

View File

@ -742,11 +742,13 @@ class Session {
screens : OArr<Screen>; screens : OArr<Screen>;
notifyNum : OV<number> = mobx.observable.box(0); notifyNum : OV<number> = mobx.observable.box(0);
remoteInstances : OArr<RemoteInstanceType>; remoteInstances : OArr<RemoteInstanceType>;
archived : OV<boolean>;
constructor(sdata : SessionDataType) { constructor(sdata : SessionDataType) {
this.sessionId = sdata.sessionid; this.sessionId = sdata.sessionid;
this.name = mobx.observable.box(sdata.name); this.name = mobx.observable.box(sdata.name);
this.sessionIdx = mobx.observable.box(sdata.sessionidx); this.sessionIdx = mobx.observable.box(sdata.sessionidx);
this.archived = mobx.observable.box(!!sdata.archived);
let screenData = sdata.screens || []; let screenData = sdata.screens || [];
let screens : Screen[] = []; let screens : Screen[] = [];
for (let i=0; i<screenData.length; i++) { for (let i=0; i<screenData.length; i++) {
@ -777,6 +779,7 @@ class Session {
if (sdata.notifynum >= 0) { if (sdata.notifynum >= 0) {
this.notifyNum.set(sdata.notifynum); this.notifyNum.set(sdata.notifynum);
} }
this.archived.set(!!sdata.archived);
genMergeData(this.screens, sdata.screens, (s : Screen) => s.screenId, (s : ScreenDataType) => s.screenid, (data : ScreenDataType) => new Screen(data), (s : Screen) => s.screenIdx.get()); genMergeData(this.screens, sdata.screens, (s : Screen) => s.screenId, (s : ScreenDataType) => s.screenid, (data : ScreenDataType) => new Screen(data), (s : Screen) => s.screenIdx.get());
if (!isBlank(sdata.activescreenid)) { if (!isBlank(sdata.activescreenid)) {
let screen = this.getScreenById(sdata.activescreenid); let screen = this.getScreenById(sdata.activescreenid);