Skip to content

Use Controller in Meter, User, UserGroup, and ValueListGroup components. - #932

Open
nbeatty-gpa wants to merge 14 commits into
masterfrom
switchToController
Open

Use Controller in Meter, User, UserGroup, and ValueListGroup components.#932
nbeatty-gpa wants to merge 14 commits into
masterfrom
switchToController

Conversation

@nbeatty-gpa

@nbeatty-gpa nbeatty-gpa commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Removes the user account, security group, and remote user account slices, adds a ControllerSelectPopup component to replace the gemstone slice-based SelectionPopup, and removes unused slices.

@nbeatty-gpa
nbeatty-gpa marked this pull request as ready for review August 21, 2026 17:20
@nbeatty-gpa
nbeatty-gpa force-pushed the switchToController branch 2 times, most recently from 363a0c3 to 5e45b5d Compare August 24, 2026 19:30
@nbeatty-gpa
nbeatty-gpa force-pushed the switchToController branch 2 times, most recently from 86af343 to de95926 Compare September 9, 2026 14:19
Comment thread Source/Applications/SystemCenter/wwwroot/Scripts/TSX/SystemCenter/hooks.ts Outdated
Comment thread Source/Applications/SystemCenter/wwwroot/Scripts/TSX/SystemCenter/hooks.ts Outdated
const [refreshTrigger, setRefreshTrigger] = React.useState<boolean>(false);

const [status, setStatus] = React.useState<Application.Types.Status>('uninitiated');
const [groupStatus, setGroupStatus] = React.useState<Application.Types.Status>('uninitiated');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was added but not used, was that intentional?


const handle = $.ajax({
type: "POST",
url: `${homePath}api/SystemCenter/FullSecurityGroup/Users/${props.Group.ID}`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This maps to the Users/{groupID} route in the SecurityGroup.cs model and it only accepts a get request. It also returns an array however after parsing its casted to a string. Which means that existing users never populate groupUsers. After clicking the 'Add Users' confirmation the existing memberships would get removed. The request needs to be changed to the proper type, the typings for groupUsers should change and we probably should disable confirmation until the existing memberships load succesfully.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm having some trouble understanding what you mean here. The problem with the request type I understand, but I'm casting the result to unknown, then to string, so that the value can be parsed with JSON.parse, and I've tested that it works this way but does not work without JSON.parse. Disabling confirmation of the selection until the existing memberships load successfully makes sense, but I'm not sure what typing change for groupUsers you have in mind here

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, i looked at that casting part wrong. I thought it was being casted outside the parse.

async: true
}).done((d) => {
setGroupStatus('idle');
setGroupUsers(JSON.parse(d.Data as unknown as string));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The response is actually an array. So this is going to throw when trying to parse undefined.

const [errors, setError] = React.useState<string[]>([]);
const [hover, setHover] = React.useState<('None' | 'Clear' | 'Save')>('None');

const [refreshTrigger, setRefreshTrigger] = React.useState<boolean>(false);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new refreshTrigger only reruns the warnings effect; it doesn’t fetch the saved group or update props.Group like the previous Redux flow did. After saving, warnings still remain, Clear Changes restores the old values, and switching tabs reloads the stale record. We should retrigger the parent’s fetch after a successful PATCH.

const [showVirtualChannelModal, setShowVirtualChannelModal] = React.useState<boolean>(false);
const [spareList, setSpareList] = React.useState<string[]>([]);
const [listStatus, setListStatus] = React.useState<Application.Types.Status>('idle');
const [refreshTrigger, setRefreshTrigger] = React.useState<boolean>(false);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new refreshTrigger only refreshes the spare-channel list and reattaches the file-input handler; it doesn’t refresh the three lookup lists like the previous Redux flow did. After parsing, newly created phases, measurement types, and characteristics still won’t appear in the dropdowns. We should pass a refresh counterargument to all three useControllerFetch calls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants