Skip to content
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
66 changes: 47 additions & 19 deletions frontend/src/components/pod/Details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { Terminal as XTerminal } from '@xterm/xterm';
import _ from 'lodash';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { useParams } from 'react-router-dom';
import { useLocation, useParams } from 'react-router-dom';
import { KubeContainerStatus } from '../../lib/k8s/cluster';
import Pod from '../../lib/k8s/pod';
import { DefaultHeaderAction } from '../../redux/actionButtonsSlice';
Expand Down Expand Up @@ -491,6 +491,48 @@ export default function PodDetails(props: PodDetailsProps) {
const { t } = useTranslation('glossary');
const dispatchHeadlampEvent = useEventCallback();

const lastAutoLaunchedPod = React.useRef<string | null>(null);
const location = useLocation();
const queryParams = new URLSearchParams(location.search);
const autoLaunchView = queryParams.get('view');
const [podItem, setPodItem] = React.useState<Pod | null>(null);

const launchLogs = React.useCallback(
(item: Pod) => {
Activity.launch({
id: 'logs-' + item.metadata.uid,
title: t('Logs: {{ itemName }}', { itemName: item.metadata.name }),
cluster: item.cluster,
icon: <Icon icon="mdi:file-document-box-outline" width="100%" height="100%" />,
location: 'full',
content: <PodLogViewer noDialog open item={item} onClose={() => {}} />,
});
dispatchHeadlampEvent({
type: HeadlampEventType.LOGS,
data: {
status: EventStatus.OPENED,
},
});
},
[t, dispatchHeadlampEvent]
);

React.useEffect(() => {
if (autoLaunchView !== 'logs') {
lastAutoLaunchedPod.current = null;
return;
}

if (
podItem &&
autoLaunchView === 'logs' &&
lastAutoLaunchedPod.current !== podItem.metadata.uid
) {
lastAutoLaunchedPod.current = podItem.metadata.uid;
launchLogs(podItem);
}
}, [podItem, launchLogs, autoLaunchView]);

function prepareExtraInfo(item: Pod | null) {
let extraInfo: {
name: string;
Expand Down Expand Up @@ -589,6 +631,9 @@ export default function PodDetails(props: PodDetailsProps) {
namespace={namespace}
cluster={cluster}
withEvents
onResourceUpdate={item => {
setPodItem(item);
}}
actions={item =>
item && [
{
Expand All @@ -598,24 +643,7 @@ export default function PodDetails(props: PodDetailsProps) {
<ActionButton
description={t('Show Logs')}
icon="mdi:file-document-box-outline"
onClick={() => {
Activity.launch({
id: 'logs-' + item.metadata.uid,
title: t('Logs') + ': ' + item.metadata.name,
cluster: item.cluster,
icon: (
<Icon icon="mdi:file-document-box-outline" width="100%" height="100%" />
),
location: 'full',
content: <PodLogViewer noDialog open item={item} onClose={() => {}} />,
});
dispatchHeadlampEvent({
type: HeadlampEventType.LOGS,
data: {
status: EventStatus.OPENED,
},
});
}}
onClick={() => launchLogs(item)}
/>
</AuthVisible>
),
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/project/ProjectResourcesTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ export function ProjectResourcesTab({
const id = 'logs-' + resource.metadata.uid;
Activity.launch({
id,
title: t('Logs') + ': ' + resource.metadata.name,
title: t('Logs: {{ itemName }}', { itemName: resource.metadata.name }),
cluster: resource.cluster,
icon: (
<Icon icon="mdi:file-document-box-outline" width="100%" height="100%" />
Expand Down
1 change: 0 additions & 1 deletion frontend/src/i18n/locales/de/glossary.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@
"QoS Class": "QoS-Klasse",
"Priority": "Priorität",
"Show Logs": "Ereignisprotokolle anzeigen",
"Logs": "",
"Terminal / Exec": "Terminal / Befehl ausführen",
"Attach": "Anhängen",
"Restarts": "Neustarts",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/i18n/locales/de/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@
"Create Project": "",
"Details": "",
"Show Logs": "",
"Logs": "",
"Logs: {{ itemName }}": "",
"Terminal / Exec": "",
"No {{category}} resources found for this project.": "",
"Current//context:replicas": "Aktuell",
Expand Down
1 change: 0 additions & 1 deletion frontend/src/i18n/locales/en/glossary.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@
"QoS Class": "QoS Class",
"Priority": "Priority",
"Show Logs": "Show Logs",
"Logs": "Logs",
"Terminal / Exec": "Terminal / Exec",
"Attach": "Attach",
"Restarts": "Restarts",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/i18n/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@
"Create Project": "Create Project",
"Details": "Details",
"Show Logs": "Show Logs",
"Logs": "Logs",
"Logs: {{ itemName }}": "Logs: {{ itemName }}",
"Terminal / Exec": "Terminal / Exec",
"No {{category}} resources found for this project.": "No {{category}} resources found for this project.",
"Current//context:replicas": "Current",
Expand Down
1 change: 0 additions & 1 deletion frontend/src/i18n/locales/es/glossary.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@
"QoS Class": "Clase QoS",
"Priority": "Prioridad",
"Show Logs": "Mostrar Registros",
"Logs": "",
"Terminal / Exec": "Terminal / Exec",
"Attach": "Adjuntar",
"Restarts": "Reinicios",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/i18n/locales/es/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@
"Create Project": "",
"Details": "",
"Show Logs": "",
"Logs": "",
"Logs: {{ itemName }}": "",
"Terminal / Exec": "",
"No {{category}} resources found for this project.": "",
"Current//context:replicas": "Actuales",
Expand Down
1 change: 0 additions & 1 deletion frontend/src/i18n/locales/fr/glossary.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@
"QoS Class": "Classe QoS",
"Priority": "Priorité",
"Show Logs": "Afficher les journaux",
"Logs": "",
"Terminal / Exec": "Terminal / Exécution",
"Attach": "Attacher",
"Restarts": "Redémarrages",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/i18n/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@
"Create Project": "",
"Details": "",
"Show Logs": "",
"Logs": "",
"Logs: {{ itemName }}": "",
"Terminal / Exec": "",
"No {{category}} resources found for this project.": "",
"Current//context:replicas": "Actuels",
Expand Down
1 change: 0 additions & 1 deletion frontend/src/i18n/locales/hi/glossary.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@
"QoS Class": "QoS क्लास",
"Priority": "प्राथमिकता",
"Show Logs": "लॉग्स दिखाएं",
"Logs": "",
"Terminal / Exec": "टर्मिनल / एक्जेक",
"Attach": "अटैच",
"Restarts": "रीस्टार्ट",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/i18n/locales/hi/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@
"Create Project": "",
"Details": "",
"Show Logs": "",
"Logs": "",
"Logs: {{ itemName }}": "",
"Terminal / Exec": "",
"No {{category}} resources found for this project.": "",
"Current//context:replicas": "",
Expand Down
1 change: 0 additions & 1 deletion frontend/src/i18n/locales/it/glossary.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@
"QoS Class": "Classe QoS",
"Priority": "Priorità",
"Show Logs": "Mostra Log",
"Logs": "",
"Terminal / Exec": "Terminale / Esegui",
"Attach": "Collega",
"Restarts": "Riavvii",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/i18n/locales/it/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@
"Create Project": "",
"Details": "",
"Show Logs": "",
"Logs": "",
"Logs: {{ itemName }}": "",
"Terminal / Exec": "",
"No {{category}} resources found for this project.": "",
"Current//context:replicas": "Attuale",
Expand Down
1 change: 0 additions & 1 deletion frontend/src/i18n/locales/ja/glossary.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@
"QoS Class": "QoS クラス",
"Priority": "優先度",
"Show Logs": "ログの表示",
"Logs": "",
"Terminal / Exec": "ターミナル / 実行",
"Attach": "アタッチ",
"Restarts": "再起動",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/i18n/locales/ja/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@
"Create Project": "",
"Details": "",
"Show Logs": "",
"Logs": "",
"Logs: {{ itemName }}": "",
"Terminal / Exec": "",
"No {{category}} resources found for this project.": "",
"Current//context:replicas": "現在",
Expand Down
1 change: 0 additions & 1 deletion frontend/src/i18n/locales/ko/glossary.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@
"QoS Class": "QoS 클래스",
"Priority": "우선순위",
"Show Logs": "로그 보기",
"Logs": "",
"Terminal / Exec": "터미널 / 실행",
"Attach": "연결",
"Restarts": "재시작",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/i18n/locales/ko/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@
"Create Project": "",
"Details": "",
"Show Logs": "",
"Logs": "",
"Logs: {{ itemName }}": "",
"Terminal / Exec": "",
"No {{category}} resources found for this project.": "",
"Current//context:replicas": "Current",
Expand Down
1 change: 0 additions & 1 deletion frontend/src/i18n/locales/pt/glossary.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@
"QoS Class": "Classe QoS",
"Priority": "Prioridade",
"Show Logs": "Mostrar Registos",
"Logs": "",
"Terminal / Exec": "Terminal / Exec",
"Attach": "Anexar",
"Restarts": "Reinícios",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/i18n/locales/pt/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@
"Create Project": "",
"Details": "",
"Show Logs": "",
"Logs": "",
"Logs: {{ itemName }}": "",
"Terminal / Exec": "",
"No {{category}} resources found for this project.": "",
"Current//context:replicas": "Actuais",
Expand Down
1 change: 0 additions & 1 deletion frontend/src/i18n/locales/ta/glossary.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@
"QoS Class": "கியோஎஸ் கிளாஸ்",
"Priority": "முன்னுரிமை",
"Show Logs": "லாக்ஸ் காட்டு",
"Logs": "",
"Terminal / Exec": "டெர்மினல் / எக்ஸிக்",
"Attach": "இணை",
"Restarts": "மறுதொடக்கம்",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/i18n/locales/ta/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@
"Create Project": "",
"Details": "",
"Show Logs": "",
"Logs": "",
"Logs: {{ itemName }}": "",
"Terminal / Exec": "",
"No {{category}} resources found for this project.": "",
"Current//context:replicas": "தற்போதையவை",
Expand Down
1 change: 0 additions & 1 deletion frontend/src/i18n/locales/zh-tw/glossary.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@
"QoS Class": "QoS 類別",
"Priority": "優先順序",
"Show Logs": "顯示日誌",
"Logs": "日誌",
"Terminal / Exec": "終端機 / 執行",
"Attach": "附加",
"Restarts": "重啟",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/i18n/locales/zh-tw/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@
"Create Project": "建立專案",
"Details": "詳細資料",
"Show Logs": "顯示日誌",
"Logs": "日誌",
"Logs: {{ itemName }}": "日誌:{{ itemName }}",
"Terminal / Exec": "終端機 / 執行",
"No {{category}} resources found for this project.": "此專案找不到 {{category}} 資源。",
"Current//context:replicas": "當前",
Expand Down
1 change: 0 additions & 1 deletion frontend/src/i18n/locales/zh/glossary.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@
"QoS Class": "QoS 类别",
"Priority": "优先顺序",
"Show Logs": "显示日志",
"Logs": "",
"Terminal / Exec": "终端 / 执行",
"Attach": "附加",
"Restarts": "重启",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/i18n/locales/zh/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@
"Create Project": "创建项目",
"Details": "详情",
"Show Logs": "显示日志",
"Logs": "日志",
"Logs: {{ itemName }}": "",
"Terminal / Exec": "Terminal / Exec",
"No {{category}} resources found for this project.": "在此项目中未找到 {{category}} 资源。",
"Current//context:replicas": "当前",
Expand Down
Loading