1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

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 2023-02-17 21:22:34 +03:00 committed by GitHub
parent ff95eaefd6
commit 219a683890
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 9 deletions

View File

@ -7,10 +7,6 @@
--overlay-bg: #8cc474b8; --overlay-bg: #8cc474b8;
--overlay-active-bg: orange; --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; position: relative;
color: var(--logsForeground); color: var(--logsForeground);
background: var(--logsBackground); background: var(--logsBackground);
@ -21,6 +17,7 @@
.list { .list {
overflow-x: scroll!important; overflow-x: scroll!important;
overflow-y: auto!important;
.LogRow { .LogRow {
padding: 2px 16px; padding: 2px 16px;

View File

@ -28,7 +28,7 @@ export interface InstantiateArgs {
const logsViewModelInjectable = getInjectable({ const logsViewModelInjectable = getInjectable({
id: "logs-view-model", id: "logs-view-model",
instantiate: (di, { tabId }: InstantiateArgs) => new LogTabViewModel(tabId, { instantiate: (di, tabId) => new LogTabViewModel(tabId, {
getLogs: di.inject(getLogsInjectable), getLogs: di.inject(getLogsInjectable),
getLogsWithoutTimestamps: di.inject(getLogsWithoutTimestampsInjectable), getLogsWithoutTimestamps: di.inject(getLogsWithoutTimestampsInjectable),
getTimestampSplitLogs: di.inject(getTimestampSplitLogsInjectable), getTimestampSplitLogs: di.inject(getTimestampSplitLogsInjectable),
@ -45,7 +45,10 @@ const logsViewModelInjectable = getInjectable({
downloadAllLogs: di.inject(downloadAllLogsInjectable), downloadAllLogs: di.inject(downloadAllLogsInjectable),
searchStore: di.inject(searchStoreInjectable), searchStore: di.inject(searchStoreInjectable),
}), }),
lifecycle: lifecycleEnum.transient,
lifecycle: lifecycleEnum.keyedSingleton({
getInstanceKey: (di, tabId: TabId) => `log-tab-view-model-${tabId}}`,
}),
}); });
export default logsViewModelInjectable; export default logsViewModelInjectable;

View File

@ -101,9 +101,7 @@ const NonInjectedLogsDockTab = observer(({
export const LogsDockTab = withInjectables<Dependencies, LogsDockTabProps>(NonInjectedLogsDockTab, { export const LogsDockTab = withInjectables<Dependencies, LogsDockTabProps>(NonInjectedLogsDockTab, {
getProps: (di, props) => ({ getProps: (di, props) => ({
...props, ...props,
model: di.inject(logsViewModelInjectable, { model: di.inject(logsViewModelInjectable, props.tab.id),
tabId: props.tab.id,
}),
subscribeStores: di.inject(subscribeStoresInjectable), subscribeStores: di.inject(subscribeStoresInjectable),
podStore: di.inject(podStoreInjectable), podStore: di.inject(podStoreInjectable),
}), }),