Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix download all logs for pod with few containers #7413

Merged
merged 3 commits into from
Mar 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/core/src/features/pod-logs/download-logs.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,12 @@ describe("download logs options in logs dock tab", () => {
it("logs have been called with query", () => {
expect(callForLogsMock).toHaveBeenCalledWith(
{ name: "dockerExporter", namespace: "default" },
{ "previous": true, "timestamps": false },
{ "previous": true, "timestamps": false, container: "docker-exporter" },
);
});

it("shows save dialog with proper attributes", async () => {
expect(openSaveFileDialogMock).toHaveBeenCalledWith("dockerExporter.log", "all-logs", "text/plain");
expect(openSaveFileDialogMock).toHaveBeenCalledWith("docker-exporter.log", "all-logs", "text/plain");
});

it("doesn't block download dropdown for interaction after click", async () => {
Expand Down Expand Up @@ -265,7 +265,7 @@ describe("download logs options in logs dock tab", () => {
it("logs have been called", () => {
expect(callForLogsMock).toHaveBeenCalledWith(
{ name: "dockerExporter", namespace: "default" },
{ "previous": true, "timestamps": false },
{ "previous": true, "timestamps": false, container: "docker-exporter" },
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const downloadAllLogsInjectable = getInjectable({
});

if (logs) {
openSaveFileDialog(`${params.name}.log`, logs, "text/plain");
openSaveFileDialog(`${query.container}.log`, logs, "text/plain");
} else {
showErrorNotification("No logs to download");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class LogTabViewModel {

if (pod && tabData) {
const params = { name: pod.getName(), namespace: pod.getNs() };
const query = { timestamps: tabData.showTimestamps, previous: tabData.showPrevious };
const query = { timestamps: tabData.showTimestamps, previous: tabData.showPrevious, container: tabData.selectedContainer };

return this.dependencies.downloadAllLogs(params, query);
}
Expand Down