Hide JumpToBottom btn on error

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev committed 2020-10-16 10:59:23 +03:00
1 parent 05bb346e7b
commit e2324aebe2
2 files changed
+10 -2

No files matched your search

@@ -144,7 +144,7 @@ export class PodLogsStore extends DockTabStore<IPodLogsData> {
getLastSinceTime(tabId: TabId) { getLastSinceTime(tabId: TabId) {
const logs = this.logs.get(tabId); const logs = this.logs.get(tabId);
const timestamps = this.getTimestamps(logs[logs.length - 1]); const timestamps = this.getTimestamps(logs[logs.length - 1]);
const stamp = new Date(timestamps[0]); const stamp = new Date(timestamps ? timestamps[0] : null);
stamp.setSeconds(stamp.getSeconds() + 1); // avoid duplicates from last second stamp.setSeconds(stamp.getSeconds() + 1); // avoid duplicates from last second
return stamp.toISOString(); return stamp.toISOString();
} }
+9 -1
View File
@@ -38,7 +38,15 @@ export class PodLogs extends React.Component<Props> {
return; return;
} }
await this.load(); await this.load();
}, { fireImmediately: true }) }, { fireImmediately: true }),
// Check if need to show JumpToBottom if new log amount is less than previous one
reaction(() => podLogsStore.logs.get(this.tabId), () => {
const { tabId } = this;
if (podLogsStore.logs.has(tabId) && podLogsStore.logs.get(tabId).length < logRange) {
this.showJumpToBottom = false;
}
})
]); ]);
} }