mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Respect timestamps and previous props
in callForAllLogsInjectable Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
175a1dc815
commit
f6d30f289c
@ -3,6 +3,7 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import type { Pod, PodLogsQuery } from "../../../../common/k8s-api/endpoints";
|
||||
import callForLogsInjectable from "./call-for-logs.injectable";
|
||||
|
||||
const callForAllLogsInjectable = getInjectable({
|
||||
@ -11,11 +12,10 @@ const callForAllLogsInjectable = getInjectable({
|
||||
instantiate: (di) => {
|
||||
const callForLogs = di.inject(callForLogsInjectable);
|
||||
|
||||
return async (name: string, namespace: string) => {
|
||||
const logs = await callForLogs({
|
||||
name,
|
||||
namespace,
|
||||
});
|
||||
return async (pod: Pod, query?: PodLogsQuery) => {
|
||||
const namespace = pod.getNs();
|
||||
const name = pod.getName();
|
||||
const logs = await callForLogs({ name, namespace }, query);
|
||||
|
||||
return logs;
|
||||
};
|
||||
|
||||
@ -15,6 +15,7 @@ import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
import openSaveFileDialogInjectable from "../../../utils/save-file.injectable";
|
||||
import callForAllLogsInjectable from "./call-for-all-logs.injectable";
|
||||
import { DownloadLogsDropdown } from "./download-logs-dropdown";
|
||||
import type { Pod, PodLogsQuery } from "../../../../common/k8s-api/endpoints";
|
||||
|
||||
export interface LogControlsProps {
|
||||
model: LogTabViewModel;
|
||||
@ -22,7 +23,7 @@ export interface LogControlsProps {
|
||||
|
||||
interface Dependencies {
|
||||
openSaveFileDialog: (filename: string, contents: BlobPart | BlobPart[], type: string) => void;
|
||||
callForAllLogs: (name: string, namespace: string) => Promise<string>;
|
||||
callForAllLogs: (pod: Pod, query?: PodLogsQuery) => Promise<string>;
|
||||
}
|
||||
|
||||
const NonInjectedLogControls = observer(({ openSaveFileDialog, model, callForAllLogs }: Dependencies & LogControlsProps) => {
|
||||
@ -50,7 +51,7 @@ const NonInjectedLogControls = observer(({ openSaveFileDialog, model, callForAll
|
||||
const pod = model.pod.get();
|
||||
|
||||
if (pod) {
|
||||
const logs = await callForAllLogs(pod.getName(), pod.getNs());
|
||||
const logs = await callForAllLogs(pod, { timestamps: showTimestamps, previous });
|
||||
|
||||
openSaveFileDialog(`${pod.getName()}.log`, logs, "text/plain");
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user