Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const StepInfoDrawer = (props) => {
hasBuildDebugMode={data?.debug || false}
buildStatus={data?.status}
stageStatus={data?.stages?.[stage - 1]?.status}
stageNumber={data?.stages?.[stage - 1]?.number}
stageName={data?.stages?.[stage - 1]?.name}
stepData={stepData}
consoleProps={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ const stepDefferedLogsStates = [
const stageDefferedLogsStates = stepDefferedLogsStates.slice(1);

export default function LogViewConsoleManager(props) {
const { consoleProps } = props;
const { consoleProps, ...rest } = props;
const params = useParams();
/* State */
const [state, dispatch] = useReducer(logsReducer, props, logsInitFn);
const [state, dispatch] = useReducer(logsReducer, rest, logsInitFn);
// derived
const logsBlobName = `logs_${params.namespace}_${params.name}_${params.build}_${params.stage}_${params.step}`;
/* Refs */
Expand All @@ -69,7 +69,11 @@ export default function LogViewConsoleManager(props) {
dispatch,
useLogsActionTypes,
params,
state.compState !== STATES.STREAM_ON
state.stageNumber
&& state.stepData?.number
&& (params.step || 1) == state.stepData.number
&& (params.stage || 1) == state.stageNumber
&& state.compState !== STATES.STREAM_ON
&& !!state.stageStatus
&& !!state.stepData.status
&& !stageDefferedLogsStates.includes(state.stageStatus)
Expand All @@ -88,9 +92,6 @@ export default function LogViewConsoleManager(props) {
// during build stage/step navigation
useLayoutEffect(() => {
dispatch({ type: ACTION_LIST.SET_LOGS, payload: [] });
return () => {
dispatch({ type: ACTION_LIST.SET_LOGS, payload: [] });
};
}, [params.stage, params.step]);

useEffect(() => {
Expand All @@ -101,6 +102,12 @@ export default function LogViewConsoleManager(props) {
dispatch({ type: ACTION_LIST.UPDATE_IS_DATA_LOADING, payload: props.isDataLoading });
}, [props.isDataLoading]);

useEffect(() => {
if (props.stageNumber) {
dispatch({ type: ACTION_LIST.UPDATE_STAGE_NUMBER, payload: props.stageNumber });
}
}, [props.stageNumber]);

useEffect(() => {
if (props.stageStatus) {
dispatch({ type: ACTION_LIST.UPDATE_STAGE_STATUS, payload: props.stageStatus });
Expand Down Expand Up @@ -187,6 +194,7 @@ LogViewConsoleManager.propTypes = {
hasBuildDebugMode: PropTypes.bool,
buildStatus: PropTypes.string,
stageStatus: PropTypes.string,
stageNumber: PropTypes.number,
stageName: PropTypes.string,
stepData: PropTypes.shape({
status: PropTypes.string,
Expand All @@ -207,6 +215,7 @@ LogViewConsoleManager.defaultProps = {
buildStatus: '',
stageStatus: '',
stageName: '',
stageNumber: 0,
consoleProps: {
showHeader: true,
showFooter: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const ACTION_LIST = {
UPDATE_IS_DATA_LOADING: 'update_is_data_loading',
UPDATE_BUILD_STATUS: 'update_build_status',
UPDATE_STAGE_STATUS: 'update_stage_status',
UPDATE_STAGE_NUMBER: 'update_stage_number',
UPDATE_STAGE_NAME: 'update_stage_name',
UPDATE_STEP_DATA: 'update_step_data',
UPDATE_LOGS_HOOK_ERROR: 'update_logs_hook_error',
Expand All @@ -29,6 +30,7 @@ export const logsInitFn = (props) => {
hasBuildDebugMode,
buildStatus,
stageStatus,
stageNumber,
stageName,
stepData = {},
} = props;
Expand All @@ -49,6 +51,7 @@ export const logsInitFn = (props) => {
isDataLoading,
stageName,
stageStatus,
stageNumber,
buildStatus,
logsHookError: {},
tmateLink: '',
Expand Down Expand Up @@ -78,6 +81,8 @@ export const logsReducer = (state, action) => {
};
case ACTION_LIST.UPDATE_STAGE_NAME:
return { ...state, stageName: action.payload };
case ACTION_LIST.UPDATE_STAGE_NUMBER:
return { ...state, stageNumber: action.payload };
case ACTION_LIST.UPDATE_IS_DATA_LOADING:
return {
...state,
Expand Down
1 change: 1 addition & 0 deletions src/components/pages/build/log-view/log-view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const LogView = (props) => {
hasBuildDebugMode={data?.debug || false}
buildStatus={data?.status}
stageStatus={data?.stages?.[stage - 1]?.status}
stageNumber={data?.stages?.[stage - 1]?.number}
stageName={data?.stages?.[stage - 1]?.name}
stepData={data?.stages?.[stage - 1]?.steps?.[step - 1]}
/>
Expand Down