Fix empty pod logs tab content (#7177)

* Replace logsViewModelInjectable lifecycle
to keyedSingleton

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Await logs view model to instantiate

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Remove async from instantiating LogTabViewModel

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Fix LogList overflow (#7178)

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

---------

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev authored and GitHub committed 2023-02-17 13:22:34 -05:00
1 parent ff95eaefd6
commit 219a683890
3 files changed
+7 -9

No files matched your search

@@ -7,10 +7,6 @@
--overlay-bg: #8cc474b8;
--overlay-active-bg: orange;
// fix for `this.logsElement.scrollTop = this.logsElement.scrollHeight`
// `overflow: overlay` don't allow scroll to the last line
overflow: auto;
position: relative;
color: var(--logsForeground);
background: var(--logsBackground);
@@ -21,6 +17,7 @@
.list {
overflow-x: scroll!important;
overflow-y: auto!important;
.LogRow {
padding: 2px 16px;
@@ -28,7 +28,7 @@ export interface InstantiateArgs {
const logsViewModelInjectable = getInjectable({
id: "logs-view-model",
instantiate: (di, { tabId }: InstantiateArgs) => new LogTabViewModel(tabId, {
instantiate: (di, tabId) => new LogTabViewModel(tabId, {
getLogs: di.inject(getLogsInjectable),
getLogsWithoutTimestamps: di.inject(getLogsWithoutTimestampsInjectable),
getTimestampSplitLogs: di.inject(getTimestampSplitLogsInjectable),
@@ -45,7 +45,10 @@ const logsViewModelInjectable = getInjectable({
downloadAllLogs: di.inject(downloadAllLogsInjectable),
searchStore: di.inject(searchStoreInjectable),
}),
lifecycle: lifecycleEnum.transient,
lifecycle: lifecycleEnum.keyedSingleton({
getInstanceKey: (di, tabId: TabId) => `log-tab-view-model-${tabId}}`,
}),
});
export default logsViewModelInjectable;
@@ -101,9 +101,7 @@ const NonInjectedLogsDockTab = observer(({
export const LogsDockTab = withInjectables<Dependencies, LogsDockTabProps>(NonInjectedLogsDockTab, {
getProps: (di, props) => ({
...props,
model: di.inject(logsViewModelInjectable, {
tabId: props.tab.id,
}),
model: di.inject(logsViewModelInjectable, props.tab.id),
subscribeStores: di.inject(subscribeStoresInjectable),
podStore: di.inject(podStoreInjectable),
}),