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

Remove step status icon on pipeline run log containers #2775

Merged
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
39 changes: 1 addition & 38 deletions frontend/src/concepts/k8s/pods/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PodKind } from '~/k8sTypes';
import { PodContainer, PodContainerStatuses, PodStepState, PodStepStateType } from '~/types';
import { PodContainer, PodContainerStatuses } from '~/types';
import { getPodContainerLogText } from '~/api';
import { downloadString } from '~/utilities/string';

Expand Down Expand Up @@ -54,40 +54,3 @@ ${logsIndividualStep}`,
const combinedLogs = allStepLogs.join('\n');
downloadString(`${pod.metadata.name}-${completed ? 'full' : currentTimeStamp}.log`, combinedLogs);
};

export const getPodStepsStates = async (
podContainerStatuses: PodContainerStatuses,
namespace: string,
podName: string | undefined,
): Promise<PodStepState[]> => {
const stepsStatesPromises = podContainerStatuses.reduce<Promise<PodStepState>[]>(
(accumulator, podContainerStatus) => {
if (podContainerStatus && podName) {
const stepsStatePromise = getPodContainerLogText(
namespace,
podName,
podContainerStatus.name,
)
.then((logsIndividualStep) => ({
stepName: podContainerStatus.name || '',
state:
podContainerStatus.state?.running || podContainerStatus.state?.waiting
? PodStepStateType.loading
: logsIndividualStep.toLowerCase().includes('error')
? PodStepStateType.error
: podContainerStatus.state?.terminated
? PodStepStateType.success
: PodStepStateType.loading,
}))
.catch(() => ({
stepName: podContainerStatus.name || '',
state: PodStepStateType.error,
}));
accumulator.push(stepsStatePromise);
}
return accumulator;
},
[],
);
return Promise.all(stepsStatesPromises);
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
Button,
Checkbox,
DropdownList,
Icon,
Spinner,
Stack,
StackItem,
Expand All @@ -20,10 +19,8 @@ import { PlayIcon } from '@patternfly/react-icons/dist/esm/icons/play-icon';
import { DownloadIcon } from '@patternfly/react-icons/dist/esm/icons/download-icon';
import { LogViewer, LogViewerSearch } from '@patternfly/react-log-viewer';
import {
CheckCircleIcon,
CompressIcon,
EllipsisVIcon,
ExclamationCircleIcon,
ExpandIcon,
OutlinedWindowRestoreIcon,
} from '@patternfly/react-icons';
Expand All @@ -34,10 +31,8 @@ import usePodContainerLogState from '~/concepts/pipelines/content/pipelinesDetai
import LogsTabStatus from '~/concepts/pipelines/content/pipelinesDetails/pipelineRun/runLogs/LogsTabStatus';
import { LOG_TAIL_LINES } from '~/concepts/pipelines/content/pipelinesDetails/pipelineRun/runLogs/const';
import { downloadAllStepLogs, downloadCurrentStepLog } from '~/concepts/k8s/pods/utils';
import usePodStepsStates from '~/concepts/pipelines/content/pipelinesDetails/pipelineRun/runLogs/usePodStepsStates';
import { usePipelinesAPI } from '~/concepts/pipelines/context';
import DownloadDropdown from '~/concepts/pipelines/content/pipelinesDetails/pipelineRun/runLogs/DownloadDropdown';
import { PodStepStateType } from '~/types';
import useDebounceCallback from '~/utilities/useDebounceCallback';
import { PipelineTask } from '~/concepts/pipelines/topology';
import { ExecutionStateKF } from '~/concepts/pipelines/kfTypes';
Expand Down Expand Up @@ -83,7 +78,6 @@ const LogsTabForPodName: React.FC<{ podName: string; isFailedPod: boolean }> = (
(podContainerStatus) => podContainerStatus?.name === podContainer.name,
),
);
const podStepStates = usePodStepsStates(sortedContainerStatuses, podName);
const [downloading, setDownloading] = React.useState(false);
const [downloadError, setDownloadError] = React.useState<Error | undefined>();
const logViewerRef = React.useRef<{ scrollToBottom: () => void }>();
Expand Down Expand Up @@ -244,26 +238,10 @@ const LogsTabForPodName: React.FC<{ podName: string; isFailedPod: boolean }> = (
<ToolbarItem spacer={{ default: 'spacerSm' }} style={{ maxWidth: '200px' }}>
<SimpleDropdownSelect
dataTestId="logs-step-select"
isDisabled={podStepStates.length <= 1}
options={podStepStates.map((podStepState) => ({
key: podStepState.stepName,
label: podStepState.stepName,
dropdownLabel: (
<>
<span className="pf-v5-u-mr-sm">{podStepState.stepName}</span>
{podStepState.state === PodStepStateType.loading ? (
<Spinner size="sm" />
) : podStepState.state === PodStepStateType.error ? (
<Icon status="danger">
<ExclamationCircleIcon />
</Icon>
) : (
<Icon status="success">
<CheckCircleIcon />
</Icon>
)}
</>
),
isDisabled={sortedContainerStatuses.length <= 1}
options={sortedContainerStatuses.map((containerStatus) => ({
key: containerStatus?.name || '',
label: containerStatus?.name || '',
}))}
value={containerName}
placeholder="Select container..."
Expand Down

This file was deleted.

8 changes: 0 additions & 8 deletions frontend/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,14 +331,6 @@ export type PodContainer = {
securityContext?: unknown;
};

export type PodStepState = { stepName: string; state: PodStepStateType };

export enum PodStepStateType {
success = 'Success',
error = 'Error',
loading = 'Loading',
}

export type PodContainerStatus = {
name?: string;
ready: boolean;
Expand Down
Loading