Skip to content

Commit

Permalink
repopulate datasources when team owner changes for test. Fixes: #2049
Browse files Browse the repository at this point in the history
  • Loading branch information
johnaohara committed Oct 1, 2024
1 parent d981047 commit 1185d9e
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions horreum-web/src/domain/tests/TestSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default function TestSettings({ test, onTestIdChange, onModified, funcsRe
useEffect( () => {
apiCall(configApi.datastores(owner), alerting, "DATASTORE", "Error occurred fetching datastores")
.then(ds => setDatastores(ds))
}, [test])
}, [test, owner])

const updateState = (t?: Test) => {
setName(t?.name || "")
Expand Down Expand Up @@ -148,6 +148,20 @@ export default function TestSettings({ test, onTestIdChange, onModified, funcsRe
</HelperText>
</FormHelperText>
</FormGroup>
<FormGroup label="Team" fieldId="testOwner">
{isTester ? (
<TeamSelect
includeGeneral={false}
selection={teamToName(owner) || ""}
onSelect={selection => {
setOwner(selection.key)
onModified(true)
}}
/>
) : (
<TextInput value={teamToName(owner) || ""} id="testOwner" readOnlyVariant="default" />
)}
</FormGroup>
<FormGroup label="Datastore" fieldId="datastoreId">
<FormSelect
value={datastoreId?.toString()}
Expand Down Expand Up @@ -222,20 +236,7 @@ export default function TestSettings({ test, onTestIdChange, onModified, funcsRe
<Divider/>

<Title headingLevel="h2">Permissions</Title>
<FormGroup label="Owner" fieldId="testOwner">
{isTester ? (
<TeamSelect
includeGeneral={false}
selection={teamToName(owner) || ""}
onSelect={selection => {
setOwner(selection.key)
onModified(true)
}}
/>
) : (
<TextInput value={teamToName(owner) || ""} id="testOwner" readOnlyVariant="default" />
)}
</FormGroup>

<FormGroup label="Access rights" fieldId="testAccess">
{isTester ? (
<AccessChoice
Expand Down

0 comments on commit 1185d9e

Please sign in to comment.