-
Notifications
You must be signed in to change notification settings - Fork 6
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
ZEN - Multiple bugfixes #231
base: v2.x/staging
Are you sure you want to change the base?
Changes from 6 commits
9a644e0
0bb238d
ccf7108
d97b60f
3d1f1e4
21692a6
c1d74f4
22c41f7
a9897f7
15e7661
d57f685
3b2eb91
b9da937
0322389
14421c0
756dd98
4727edb
92ef950
d20c309
5a41955
761551b
028520b
1334659
43299da
f4176a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,13 +22,13 @@ import { Tooltip } from '@mui/material'; | |
import installationImg from '../assets/installation.png' | ||
import installationDryImg from '../assets/installation-dry-run.png' | ||
import eventDispatcher from "../../services/eventDispatcher"; | ||
import { selectConnectionStatus} from './stages/progress/progressSlice'; | ||
import { selectConnectionStatus, setConnectionStatus} from './stages/progress/progressSlice'; | ||
import HorizontalLinearStepper from './common/Stepper'; | ||
import Wizard from './configuration-wizard/Wizard' | ||
import { ActiveState } from '../../types/stateInterfaces'; | ||
import { getInstallationArguments, getPreviousInstallation } from './stages/progress/StageProgressStatus'; | ||
import { DEF_NO_OUTPUT, FALLBACK_SCHEMA, FALLBACK_YAML } from './common/Utils'; | ||
import { selectInstallationArgs, setInstallationArgs, installationSlice } from './stages/installation/installationSlice'; | ||
import { selectInstallationArgs, setInstallationArgs, installationSlice, setIsNewerInstallation } from './stages/installation/installationSlice'; | ||
import PasswordDialog from './common/passwordDialog'; | ||
|
||
// REVIEW: Get rid of routing | ||
|
@@ -88,10 +88,13 @@ const Home = () => { | |
|
||
const makeCard = (card: ICard) => { | ||
const {id, name, description, link, media} = card; | ||
|
||
const handleClick = () => { | ||
let newInstallationArgs = installationSlice.getInitialState().installationArgs; | ||
if (id === "install") { | ||
dispatch(setIsNewerInstallation(true)); | ||
setIsNewInstallation(true); | ||
dispatch(setConnectionStatus(false)); | ||
newInstallationArgs = {...newInstallationArgs, dryRunMode: false}; | ||
} else if (id === "dry run") { | ||
newInstallationArgs = {...newInstallationArgs, dryRunMode: true}; | ||
|
@@ -216,6 +219,7 @@ const Home = () => { | |
const resumeProgress = () => { | ||
setShowWizard(true); | ||
dispatch(setResumeProgress(true)); | ||
dispatch(setIsNewerInstallation(false)); | ||
|
||
if(connectionStatus) { | ||
setShowPasswordDialog(true); | ||
|
@@ -268,8 +272,8 @@ const Home = () => { | |
{showWizard && | ||
<> | ||
{showPasswordDialog && <PasswordDialog onPasswordSubmit={confirmConnection}></PasswordDialog>} | ||
{(showPasswordDialog && updatedConnection) && <Wizard initialization={false}/>} | ||
{!showPasswordDialog && <Wizard initialization={false}/>} | ||
{(showPasswordDialog && updatedConnection) && <Wizard initialization={isNewInstallation}/>} | ||
{!showPasswordDialog && <Wizard initialization={isNewInstallation}/>} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These two lines look like over-complication, what is the use of updatedConnection? Why we can't use showPasswordDialog only? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The following behavior is intentional:
This behavior originates from staging. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great catch @skurnevich regarding the Thanks. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Additionally, I have removed unused states and variables in the Home component that originated from staging. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok thank you, sorry for me asking on things that are not part of this PR, but even if it is already in staging we still need to fix things that are not in a good shape. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure @skurnevich Thank you for the detailed review on my PRs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We previously discussed these two different approaches for the resume. However, we can revisit and refine them further. |
||
</> | ||
} | ||
</> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ import StepLabel from '@mui/material/StepLabel'; | |
import Button from '@mui/material/Button'; | ||
import Typography from '@mui/material/Typography'; | ||
import { Link } from 'react-router-dom'; | ||
import { selectConnectionStatus } from '../stages/progress/progressSlice'; | ||
import { selectConnectionStatus, setConnectionStatus } from '../stages/progress/progressSlice'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. setConnectionStatus does not seem to be used here, and should not be set from this component There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Additionally, I have removed unused states, functions and variables in the Stepper component that originated from staging. |
||
import { useAppDispatch, useAppSelector } from '../../hooks'; | ||
import { selectNextStepEnabled, setLoading, setYaml } from '../configuration-wizard/wizardSlice'; | ||
import { selectActiveStepIndex, selectActiveSubStepIndex } from '../stages/progress/activeStepSlice'; | ||
|
@@ -29,25 +29,31 @@ import Warning from '@mui/icons-material/Warning'; | |
import CheckCircle from '@mui/icons-material/CheckCircle'; | ||
import { TYPE_YAML, TYPE_OUTPUT, TYPE_JCL, INIT_STAGE_LABEL, REVIEW_INSTALL_STAGE_LABEL, UNPAX_STAGE_LABEL } from '../common/Utils'; | ||
import { getProgress, getCompleteProgress, mapAndSetSkipStatus, mapAndGetSkipStatus } from '../stages/progress/StageProgressStatus'; | ||
|
||
import {initProgressStatus} from '../stages/progress/progressConst'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So is this a set of defaults or replacement for the progress storage? Shouldn't defaults be part of the storage anyway? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed |
||
import '../../styles/Stepper.css'; | ||
import { StepIcon } from '@mui/material'; | ||
import { getStageDetails } from '../../../services/StageDetails'; | ||
import { IResponse } from '../../../types/interfaces'; | ||
import { selectConnectionArgs, setPassword } from '../stages/connection/connectionSlice'; | ||
import { selectInstallationArgs } from '../stages/installation/installationSlice'; | ||
import { selectInstallationArgs, selectIsNewInstallation } from '../stages/installation/installationSlice'; | ||
// TODO: define props, stages, stage interfaces | ||
// TODO: One rule in the store to enable/disable button | ||
|
||
export default function HorizontalLinearStepper({stages, initialization}:{stages: any, initialization?:boolean}) { | ||
|
||
const connectionStatus = useSelector(selectConnectionStatus); | ||
const connectionStatus = useState(useAppSelector(selectConnectionStatus)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why the useSelector even appeared there over the useAppSelector? If it was by mistake i still can see it in the line 58 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally, it should be |
||
|
||
const INIT_STAGE_ID = getStageDetails(INIT_STAGE_LABEL).id; | ||
const REVIEW_STAGE_ID = getStageDetails(REVIEW_INSTALL_STAGE_LABEL).id; | ||
|
||
const completeProgress = getCompleteProgress(); | ||
const isNewInstallation = useAppSelector(selectIsNewInstallation); | ||
|
||
let completeProgress = {...initProgressStatus}; | ||
|
||
if(!isNewInstallation) { | ||
completeProgress = getCompleteProgress(); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest to get rid of initProgressStatus, but even if not the ternary operator can be used here instead of 'completeProgress' re-assigning There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed |
||
|
||
const stageProgressStatus = [ | ||
useSelector(selectConnectionStatus), | ||
completeProgress.planningStatus, | ||
|
@@ -66,11 +72,9 @@ export default function HorizontalLinearStepper({stages, initialization}:{stages | |
completeProgress.certificateStatus, | ||
completeProgress.launchConfigStatus | ||
]) | ||
|
||
|
||
|
||
const [activeStep, setActiveStep] = initialization ? useState(0) : useState(useAppSelector(selectActiveStepIndex)); | ||
const [activeSubStep, setActiveSubStep] = initialization ? useState(0) : useState(useAppSelector(selectActiveSubStepIndex)); | ||
const [activeStep, setActiveStep] = isNewInstallation ? useState(0) : useState(useAppSelector(selectActiveStepIndex)); | ||
const [activeSubStep, setActiveSubStep] = isNewInstallation ? useState(0) : useState(useAppSelector(selectActiveSubStepIndex)); | ||
const [nextText, setNextText] = useState("Continue"); | ||
const [contentType, setContentType] = useState('output'); | ||
const [editorVisible, setEditorVisible] = useState(false); | ||
|
@@ -239,9 +243,6 @@ export default function HorizontalLinearStepper({stages, initialization}:{stages | |
alertEmitter.emit('hideAlert'); | ||
eventDispatcher.emit('saveAndCloseEvent'); | ||
dispatch(setPassword('')); | ||
// TODO: This is a workaround for same session + Save & Close + new install not resetting the Wizard properly. | ||
// Fixed by reloading page. This is not ideal and should be investigated | ||
window.location.reload(); | ||
} | ||
|
||
const isNextStepEnabled = useAppSelector(selectNextStepEnabled); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having setIsNewInstallation and setIsNewerInstallation looks like an algorithmic issue, what is the reason to have both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added
setIsNewerInstallation
as a Redux state to be used globally across other stages.The
isNewInstallation
is from v2.x/staging and it is not necessary.I just updated the PR to rely solely on the Redux state.
Thanks!