Skip to content

Commit 0cff437

Browse files
author
Kautilya Tripathi
committed
frontend: Add feature to view logs
This adds feature to view all the pods of pods in deploy, replicaSet, daemonSet rather than a specific pod. Fixes: #2552 Signed-off-by: Kautilya Tripathi <ktripathi@microsoft.com>
1 parent f979bf5 commit 0cff437

File tree

12 files changed

+710
-136
lines changed

12 files changed

+710
-136
lines changed

frontend/src/components/common/Resource/LogsButton.tsx

Lines changed: 497 additions & 0 deletions
Large diffs are not rendered by default.

frontend/src/components/common/Resource/index.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const checkExports = [
3535
'SimpleEditor',
3636
'ViewButton',
3737
'AuthVisible',
38+
'LogsButton',
3839
];
3940

4041
function getFilesToVerify() {

frontend/src/components/common/Resource/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export { default as ResourceTableColumnChooser } from './ResourceTableColumnChoo
2727
export { addResourceTableColumnsProcessor } from './resourceTableSlice';
2828
export * from './RestartButton';
2929
export * from './ScaleButton';
30+
export * from './LogsButton';
3031
export { default as ScaleButton } from './ScaleButton';
3132
export * from './SimpleEditor';
3233
export { default as SimpleEditor } from './SimpleEditor';

frontend/src/components/workload/Details.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
ConditionsSection,
77
ContainersSection,
88
DetailsGrid,
9+
LogsButton,
910
MetadataDictGrid,
1011
OwnedPodsSection,
1112
} from '../common/Resource';
@@ -85,6 +86,18 @@ export default function WorkloadDetails<T extends WorkloadClass>(props: Workload
8586
name={name}
8687
withEvents
8788
namespace={namespace}
89+
actions={item => {
90+
if (!item) return [];
91+
const isLoggable = ['Deployment', 'ReplicaSet', 'DaemonSet'].includes(workloadKind.kind);
92+
if (!isLoggable) return [];
93+
94+
return [
95+
{
96+
id: 'logs',
97+
action: <LogsButton key="logs" item={item} />,
98+
},
99+
];
100+
}}
88101
extraInfo={item =>
89102
item && [
90103
{

frontend/src/i18n/locales/de/translation.json

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -55,31 +55,31 @@
5555
"Save": "",
5656
"Uh-oh! Something went wrong.": "Oh-oh! Etwas ist schief gelaufen.",
5757
"Error loading {{ routeName }}": "",
58-
"Namespaces must contain only lowercase alphanumeric characters or '-', and must start and end with an alphanumeric character.": "Namespaces dürfen nur alphanumerische Kleinbuchstaben oder \"-\" enthalten und müssen mit einem alphanumerischen Zeichen beginnen und enden.",
59-
"The list of namespaces you are allowed to access in this cluster.": "Liste der Namespaces, auf die Sie in diesem Cluster zugreifen dürfen.",
60-
"Add namespace": "",
61-
"Allowed namespaces": "Erlaubte Namespaces",
62-
"Cluster name must contain only lowercase alphanumeric characters or '-', and must start and end with an alphanumeric character.": "",
63-
"The current name of cluster. You can define custom modified name.": "",
64-
"Change name": "",
65-
"Are you sure you want to change the name for \"{{ clusterName }}\"?": "",
66-
"Apply": "Anwenden",
67-
"The default namespace for e.g. when applying resources (when not specified directly).": "Der Standard-Namespace z. B. für die Anwendung von Ressourcen (wenn nicht anders angegeben).",
6858
"Enter a value between {{ minRows }} and {{ maxRows }}.": "Geben Sie einen Wert zwischen {{ minRows }} und {{ maxRows }} ein.",
6959
"Custom row value": "Benutzerdefinierter Zeilenwert",
60+
"Apply": "Anwenden",
7061
"Custom value": "Benutzerdefinierter Wert",
7162
"General Settings": "Allgemeine Einstellungen",
7263
"Version": "Version",
7364
"Language": "Sprache",
7465
"Theme": "Design",
7566
"Number of rows for tables": "Zeilen pro Tabelle",
7667
"Timezone to display for dates": "Zeitzone",
68+
"Namespaces must contain only lowercase alphanumeric characters or '-', and must start and end with an alphanumeric character.": "Namespaces dürfen nur alphanumerische Kleinbuchstaben oder \"-\" enthalten und müssen mit einem alphanumerischen Zeichen beginnen und enden.",
69+
"Cluster name must contain only lowercase alphanumeric characters or '-', and must start and end with an alphanumeric character.": "",
7770
"Cluster Settings": "",
7871
"There seem to be no clusters configured…": "",
7972
"Cluster {{ clusterName }} does not exist. Please select a valid cluster:": "",
80-
"Default namespace": "Standard-Namespace",
8173
"Cluster Settings ({{ clusterName }})": "Cluster-Einstellungen ({{ clusterName }})",
8274
"Go to cluster": "",
75+
"The current name of cluster. You can define custom modified name.": "",
76+
"Change name": "",
77+
"Are you sure you want to change the name for \"{{ clusterName }}\"?": "",
78+
"Default namespace": "Standard-Namespace",
79+
"The default namespace for e.g. when applying resources (when not specified directly).": "Der Standard-Namespace z. B. für die Anwendung von Ressourcen (wenn nicht anders angegeben).",
80+
"Allowed namespaces": "Erlaubte Namespaces",
81+
"The list of namespaces you are allowed to access in this cluster.": "Liste der Namespaces, auf die Sie in diesem Cluster zugreifen dürfen.",
82+
"Add namespace": "",
8383
"Remove Cluster": "Cluster entfernen",
8484
"Server": "Server",
8585
"light theme": "helles Design",
@@ -218,6 +218,22 @@
218218
"Are you sure?": "Sind Sie sicher?",
219219
"This will discard your changes in the editor. Do you want to proceed?": "Dadurch werden Ihre Änderungen im Editor verworfen. Möchten Sie fortfahren?",
220220
"Undo Changes": "Änderungen rückgängig machen",
221+
"No label selectors found for this {{type}}": "",
222+
"Invalid response from server": "",
223+
"Failed to fetch related pods": "",
224+
"No pods found for this workload": "",
225+
"Failed to fetch pods: {{error}}": "",
226+
"Logs are paused. Click the follow button to resume following them.": "Ereignisprotokolle wurden angehalten. Klicken Sie auf die Schaltfläche \"Verfolgen\", um die Protokollanzeige fortzusetzen.",
227+
"Select Pod": "",
228+
"All Pods": "",
229+
"Container": "",
230+
"Restarted": "",
231+
"Show logs for previous instances of this container.": "Ereignisprotokolle für frühere Instanzen dieses Containers anzeigen.",
232+
"You can only select this option for containers that have been restarted.": "Sie können diese Option nur für Container wählen, die neu gestartet wurden.",
233+
"Show previous": "Vorherige anzeigen",
234+
"Timestamps": "Zeitstempel anzeigen",
235+
"Follow": "Verfolgen",
236+
"Show logs": "",
221237
"Loading resource data": "Lade Ressourcendaten",
222238
"Creation": "Erstellung",
223239
"Labels": "Labels",
@@ -299,15 +315,13 @@
299315
"Categories": "",
300316
"Accepted Names": "Akzeptierte Namen",
301317
"Versions": "Versionen",
302-
"Spawn Job": "Erzeuge Job",
303-
"This will trigger a new Job based on the CronJob {{ name }}": "Dies löst einen neuen Job aus, der auf dem CronJob {{ name }} basiert.",
304-
"Job Name": "Job Name",
305318
"Spawning Job {{ newItemName }}…": "Erzeuge Job {{ newItemName }}…",
306319
"Job {{ newItemName }} spawned": "Job {{ newItemName }} erzeugt",
307320
"Failed to spawn Job {{ newItemName }}": "Job {{ newItemName }} konnte nicht gestartet werden",
321+
"Spawn Job": "Erzeuge Job",
322+
"This will trigger a new Job based on the CronJob {{ name }}": "Dies löst einen neuen Job aus, der auf dem CronJob {{ name }} basiert.",
323+
"Job Name": "Job Name",
308324
"Spawn": "Erzeugen",
309-
"Resume": "Fortsetzen",
310-
"Suspend": "Pausieren",
311325
"Suspending CronJob {{ newItemName }}…": "CronJob {{ newItemName }} unterbrechen…",
312326
"Resuming CronJob {{ newItemName }}…": "Wiederaufnahme des CronJobs {{ newItemName }}…",
313327
"Cancelled suspending CronJob {{ newItemName }}.": "Aussetzen des CronJobs {{ newItemName }} abgebrochen.",
@@ -316,6 +330,8 @@
316330
"Resumed CronJob {{ newItemName }}.": "CronJob {{ newItemName }} wieder aufgenommen.",
317331
"Failed to suspend CronJob {{ newItemName }}.": "CronJob {{ newItemName }} konnte nicht ausgesetzt werden.",
318332
"Failed to resume CronJob {{ newItemName }}.": "CronJob {{ newItemName }} konnte nicht fortgesetzt werden.",
333+
"Resume": "Fortsetzen",
334+
"Suspend": "Pausieren",
319335
"Key": "Schlüssel",
320336
"Operator": "Betreiber",
321337
"Value": "Wert",
@@ -378,13 +394,7 @@
378394
"None": "",
379395
"Software": "Software",
380396
"Redirecting to main page…": "Weiterleiten zur Hauptseite…",
381-
"Logs are paused. Click the follow button to resume following them.": "Ereignisprotokolle wurden angehalten. Klicken Sie auf die Schaltfläche \"Verfolgen\", um die Protokollanzeige fortzusetzen.",
382397
"Lines": "Zeilen",
383-
"Show logs for previous instances of this container.": "Ereignisprotokolle für frühere Instanzen dieses Containers anzeigen.",
384-
"You can only select this option for containers that have been restarted.": "Sie können diese Option nur für Container wählen, die neu gestartet wurden.",
385-
"Show previous": "Vorherige anzeigen",
386-
"Timestamps": "Zeitstempel anzeigen",
387-
"Follow": "Verfolgen",
388398
"Max Unavailable": "Max Nicht verfügbar",
389399
"Min Available": "Min verfügbar",
390400
"Allowed disruptions": "Erlaubte Unterbrechungen",

frontend/src/i18n/locales/en/translation.json

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -55,31 +55,31 @@
5555
"Save": "Save",
5656
"Uh-oh! Something went wrong.": "Uh-oh! Something went wrong.",
5757
"Error loading {{ routeName }}": "Error loading {{ routeName }}",
58-
"Namespaces must contain only lowercase alphanumeric characters or '-', and must start and end with an alphanumeric character.": "Namespaces must contain only lowercase alphanumeric characters or '-', and must start and end with an alphanumeric character.",
59-
"The list of namespaces you are allowed to access in this cluster.": "The list of namespaces you are allowed to access in this cluster.",
60-
"Add namespace": "Add namespace",
61-
"Allowed namespaces": "Allowed namespaces",
62-
"Cluster name must contain only lowercase alphanumeric characters or '-', and must start and end with an alphanumeric character.": "Cluster name must contain only lowercase alphanumeric characters or '-', and must start and end with an alphanumeric character.",
63-
"The current name of cluster. You can define custom modified name.": "The current name of cluster. You can define custom modified name.",
64-
"Change name": "Change name",
65-
"Are you sure you want to change the name for \"{{ clusterName }}\"?": "Are you sure you want to change the name for \"{{ clusterName }}\"?",
66-
"Apply": "Apply",
67-
"The default namespace for e.g. when applying resources (when not specified directly).": "The default namespace for e.g. when applying resources (when not specified directly).",
6858
"Enter a value between {{ minRows }} and {{ maxRows }}.": "Enter a value between {{ minRows }} and {{ maxRows }}.",
6959
"Custom row value": "Custom row value",
60+
"Apply": "Apply",
7061
"Custom value": "Custom value",
7162
"General Settings": "General Settings",
7263
"Version": "Version",
7364
"Language": "Language",
7465
"Theme": "Theme",
7566
"Number of rows for tables": "Number of rows for tables",
7667
"Timezone to display for dates": "Timezone to display for dates",
68+
"Namespaces must contain only lowercase alphanumeric characters or '-', and must start and end with an alphanumeric character.": "Namespaces must contain only lowercase alphanumeric characters or '-', and must start and end with an alphanumeric character.",
69+
"Cluster name must contain only lowercase alphanumeric characters or '-', and must start and end with an alphanumeric character.": "Cluster name must contain only lowercase alphanumeric characters or '-', and must start and end with an alphanumeric character.",
7770
"Cluster Settings": "Cluster Settings",
7871
"There seem to be no clusters configured…": "There seem to be no clusters configured…",
7972
"Cluster {{ clusterName }} does not exist. Please select a valid cluster:": "Cluster {{ clusterName }} does not exist. Please select a valid cluster:",
80-
"Default namespace": "Default namespace",
8173
"Cluster Settings ({{ clusterName }})": "Cluster Settings ({{ clusterName }})",
8274
"Go to cluster": "Go to cluster",
75+
"The current name of cluster. You can define custom modified name.": "The current name of cluster. You can define custom modified name.",
76+
"Change name": "Change name",
77+
"Are you sure you want to change the name for \"{{ clusterName }}\"?": "Are you sure you want to change the name for \"{{ clusterName }}\"?",
78+
"Default namespace": "Default namespace",
79+
"The default namespace for e.g. when applying resources (when not specified directly).": "The default namespace for e.g. when applying resources (when not specified directly).",
80+
"Allowed namespaces": "Allowed namespaces",
81+
"The list of namespaces you are allowed to access in this cluster.": "The list of namespaces you are allowed to access in this cluster.",
82+
"Add namespace": "Add namespace",
8383
"Remove Cluster": "Remove Cluster",
8484
"Server": "Server",
8585
"light theme": "light theme",
@@ -218,6 +218,22 @@
218218
"Are you sure?": "Are you sure?",
219219
"This will discard your changes in the editor. Do you want to proceed?": "This will discard your changes in the editor. Do you want to proceed?",
220220
"Undo Changes": "Undo Changes",
221+
"No label selectors found for this {{type}}": "No label selectors found for this {{type}}",
222+
"Invalid response from server": "Invalid response from server",
223+
"Failed to fetch related pods": "Failed to fetch related pods",
224+
"No pods found for this workload": "No pods found for this workload",
225+
"Failed to fetch pods: {{error}}": "Failed to fetch pods: {{error}}",
226+
"Logs are paused. Click the follow button to resume following them.": "Logs are paused. Click the follow button to resume following them.",
227+
"Select Pod": "Select Pod",
228+
"All Pods": "All Pods",
229+
"Container": "Container",
230+
"Restarted": "Restarted",
231+
"Show logs for previous instances of this container.": "Show logs for previous instances of this container.",
232+
"You can only select this option for containers that have been restarted.": "You can only select this option for containers that have been restarted.",
233+
"Show previous": "Show previous",
234+
"Timestamps": "Timestamps",
235+
"Follow": "Follow",
236+
"Show logs": "Show logs",
221237
"Loading resource data": "Loading resource data",
222238
"Creation": "Creation",
223239
"Labels": "Labels",
@@ -299,15 +315,13 @@
299315
"Categories": "Categories",
300316
"Accepted Names": "Accepted Names",
301317
"Versions": "Versions",
302-
"Spawn Job": "Spawn Job",
303-
"This will trigger a new Job based on the CronJob {{ name }}": "This will trigger a new Job based on the CronJob {{ name }}",
304-
"Job Name": "Job Name",
305318
"Spawning Job {{ newItemName }}…": "Spawning Job {{ newItemName }}…",
306319
"Job {{ newItemName }} spawned": "Job {{ newItemName }} spawned",
307320
"Failed to spawn Job {{ newItemName }}": "Failed to spawn Job {{ newItemName }}",
321+
"Spawn Job": "Spawn Job",
322+
"This will trigger a new Job based on the CronJob {{ name }}": "This will trigger a new Job based on the CronJob {{ name }}",
323+
"Job Name": "Job Name",
308324
"Spawn": "Spawn",
309-
"Resume": "Resume",
310-
"Suspend": "Suspend",
311325
"Suspending CronJob {{ newItemName }}…": "Suspending CronJob {{ newItemName }}…",
312326
"Resuming CronJob {{ newItemName }}…": "Resuming CronJob {{ newItemName }}…",
313327
"Cancelled suspending CronJob {{ newItemName }}.": "Cancelled suspending CronJob {{ newItemName }}.",
@@ -316,6 +330,8 @@
316330
"Resumed CronJob {{ newItemName }}.": "Resumed CronJob {{ newItemName }}.",
317331
"Failed to suspend CronJob {{ newItemName }}.": "Failed to suspend CronJob {{ newItemName }}.",
318332
"Failed to resume CronJob {{ newItemName }}.": "Failed to resume CronJob {{ newItemName }}.",
333+
"Resume": "Resume",
334+
"Suspend": "Suspend",
319335
"Key": "Key",
320336
"Operator": "Operator",
321337
"Value": "Value",
@@ -378,13 +394,7 @@
378394
"None": "None",
379395
"Software": "Software",
380396
"Redirecting to main page…": "Redirecting to main page…",
381-
"Logs are paused. Click the follow button to resume following them.": "Logs are paused. Click the follow button to resume following them.",
382397
"Lines": "Lines",
383-
"Show logs for previous instances of this container.": "Show logs for previous instances of this container.",
384-
"You can only select this option for containers that have been restarted.": "You can only select this option for containers that have been restarted.",
385-
"Show previous": "Show previous",
386-
"Timestamps": "Timestamps",
387-
"Follow": "Follow",
388398
"Max Unavailable": "Max Unavailable",
389399
"Min Available": "Min Available",
390400
"Allowed disruptions": "Allowed disruptions",

0 commit comments

Comments
 (0)