ensure unique ids on jobs list

This commit is contained in:
Keith J. Grant
2021-07-20 12:13:00 -07:00
parent 29753c6b9b
commit 5fb1b604bf
3 changed files with 11 additions and 6 deletions

View File

@@ -30,6 +30,7 @@ function ExecutionEnvironmentDetail({
virtualEnvironment, virtualEnvironment,
verifyMissingVirtualEnv, verifyMissingVirtualEnv,
helpText, helpText,
dataCy,
}) { }) {
const config = useConfig(); const config = useConfig();
const docsLink = `${getDocsBaseUrl( const docsLink = `${getDocsBaseUrl(
@@ -51,7 +52,7 @@ function ExecutionEnvironmentDetail({
</Link> </Link>
} }
helpText={helpText} helpText={helpText}
dataCy="execution-environment-detail" dataCy={dataCy}
/> />
); );
} }
@@ -89,7 +90,7 @@ function ExecutionEnvironmentDetail({
</span> </span>
</> </>
} }
dataCy="missing-execution-environment-detail" dataCy={`missing-${dataCy}`}
/> />
); );
} }
@@ -113,7 +114,7 @@ function ExecutionEnvironmentDetail({
</span> </span>
</> </>
} }
dataCy="execution-environment-detail" dataCy={dataCy}
/> />
); );
} }
@@ -127,6 +128,7 @@ ExecutionEnvironmentDetail.propTypes = {
virtualEnvironment: string, virtualEnvironment: string,
verifyMissingVirtualEnv: bool, verifyMissingVirtualEnv: bool,
helpText: string, helpText: string,
dataCy: string,
}; };
ExecutionEnvironmentDetail.defaultProps = { ExecutionEnvironmentDetail.defaultProps = {
@@ -135,6 +137,7 @@ ExecutionEnvironmentDetail.defaultProps = {
virtualEnvironment: '', virtualEnvironment: '',
verifyMissingVirtualEnv: true, verifyMissingVirtualEnv: true,
helpText: '', helpText: '',
dataCy: 'execution-environment-detail',
}; };
export default ExecutionEnvironmentDetail; export default ExecutionEnvironmentDetail;

View File

@@ -124,6 +124,7 @@ function JobListItem({
<ReLaunchDropDown <ReLaunchDropDown
handleRelaunch={handleRelaunch} handleRelaunch={handleRelaunch}
isLaunching={isLaunching} isLaunching={isLaunching}
id={`relaunch-job-${job.id}`}
/> />
)} )}
</LaunchButton> </LaunchButton>
@@ -214,6 +215,7 @@ function JobListItem({
<ExecutionEnvironmentDetail <ExecutionEnvironmentDetail
executionEnvironment={execution_environment} executionEnvironment={execution_environment}
verifyMissingVirtualEnv={false} verifyMissingVirtualEnv={false}
dataCy={`execution-environment-detail-${job.id}`}
/> />
)} )}
{credentials && credentials.length > 0 && ( {credentials && credentials.length > 0 && (

View File

@@ -15,7 +15,7 @@ function ReLaunchDropDown({
isPrimary = false, isPrimary = false,
handleRelaunch, handleRelaunch,
isLaunching, isLaunching,
id = 'relaunch-job',
ouiaId, ouiaId,
}) { }) {
const [isOpen, setIsOpen] = useState(false); const [isOpen, setIsOpen] = useState(false);
@@ -75,7 +75,7 @@ function ReLaunchDropDown({
toggleIndicator={null} toggleIndicator={null}
onToggle={onToggle} onToggle={onToggle}
aria-label={t`relaunch jobs`} aria-label={t`relaunch jobs`}
id="relaunch_jobs" id={id}
isPrimary isPrimary
> >
{t`Relaunch`} {t`Relaunch`}
@@ -97,7 +97,7 @@ function ReLaunchDropDown({
toggleIndicator={null} toggleIndicator={null}
onToggle={onToggle} onToggle={onToggle}
aria-label={t`relaunch jobs`} aria-label={t`relaunch jobs`}
id="relaunch_jobs" id={id}
> >
<RocketIcon /> <RocketIcon />
</DropdownToggle> </DropdownToggle>