From 8e085fb275bf4aea121c3e9bb6bbf127300cd12b Mon Sep 17 00:00:00 2001 From: jeznorth Date: Fri, 19 Jan 2024 10:37:34 -0800 Subject: [PATCH] Iterating on dialog language --- .../components/security/SecurityRuleForm.tsx | 261 +++++++++--------- 1 file changed, 126 insertions(+), 135 deletions(-) diff --git a/app/src/components/security/SecurityRuleForm.tsx b/app/src/components/security/SecurityRuleForm.tsx index e922cf21..6e88c015 100644 --- a/app/src/components/security/SecurityRuleForm.tsx +++ b/app/src/components/security/SecurityRuleForm.tsx @@ -137,148 +137,139 @@ const SecurityRuleForm = () => { return (
- - - Manage security rules for features in this submission. + + Add Security Rules + + Select one or more security rules to apply to selected records. + { + const searchFilter = createFilterOptions({ + ignoreCase: true, + matchFrom: 'any', + stringify: (option) => option.name + option.category_name + }); - - Add Security Rules - { - const searchFilter = createFilterOptions({ - ignoreCase: true, - matchFrom: 'any', - stringify: (option) => option.name + option.category_name - }); - - const selectableOptions = options.filter((securityRule) => { - return !formikProps.values.stagedForApply.some( - (applyingRule) => applyingRule.security_rule_id === securityRule.security_rule_id - ); - }); - - return searchFilter(selectableOptions, state); - }} - getOptionLabel={(option) => option.name} - isOptionEqualToValue={(option, value) => option.security_rule_id === value.security_rule_id} - inputValue={searchText} - onInputChange={(_, value, reason) => { - if (reason === 'reset') { - setSearchText(''); - } else { - setSearchText(value); - } - }} - onChange={(_, option) => { - if (option) { - toggleStageApply(option); - } - }} - renderInput={(params) => ( - - - - ) - }} - /> - )} - renderOption={(renderProps, renderOption) => { - return ( - - - - ); - }} - /> - - {formikProps.values.stagedForApply.map((applyingRule) => { - return ( - - toggleStageApply(applyingRule)} - /> - + const selectableOptions = options.filter((securityRule) => { + return !formikProps.values.stagedForApply.some( + (applyingRule) => applyingRule.security_rule_id === securityRule.security_rule_id ); - })} - - + }); - - Manage Existing Security - - Manage security rules have already been applied. - + return searchFilter(selectableOptions, state); + }} + getOptionLabel={(option) => option.name} + isOptionEqualToValue={(option, value) => option.security_rule_id === value.security_rule_id} + inputValue={searchText} + onInputChange={(_, value, reason) => { + if (reason === 'reset') { + setSearchText(''); + } else { + setSearchText(value); + } + }} + onChange={(_, option) => { + if (option) { + toggleStageApply(option); + } + }} + renderInput={(params) => ( + + + + ) + }} + /> + )} + renderOption={(renderProps, renderOption) => { + return ( + + + + ); + }} + /> + + {formikProps.values.stagedForApply.map((applyingRule) => { + return ( + + toggleStageApply(applyingRule)} + /> + + ); + })} + + + + Secured Records + + Some of the selected records have been secured using one or more of the following rules. + - - {groupedAppliedSecurityRules.map((group: IAppliedSecurityRuleGroup) => { - const cardAction = formikProps.values.stagedForRemove.some( - (removingRule) => removingRule.security_rule_id === group.securityRule.security_rule_id - ) - ? 'remove' - : 'persist'; + + {groupedAppliedSecurityRules.map((group: IAppliedSecurityRuleGroup) => { + const cardAction = formikProps.values.stagedForRemove.some( + (removingRule) => removingRule.security_rule_id === group.securityRule.security_rule_id + ) + ? 'remove' + : 'persist'; - return ( - - - `${p(featureGroup.numFeatures, featureGroup.displayName)} (${featureGroup.numFeatures})` - )} - onRemove={() => toggleStageRemove(group.securityRule)} - /> - - ); - })} - + return ( + + + `${p(featureGroup.numFeatures, featureGroup.displayName)} (${featureGroup.numFeatures})` + )} + onRemove={() => toggleStageRemove(group.securityRule)} + /> + + ); + })} + - {hasNoSecuritySelected && ( - - No security applied - All users will have unrestricted access to records that have been included in this submission. - - )} - + {hasNoSecuritySelected && ( + + No security applied + All users will have unrestricted access to records that have been included in this submission. + + )}
);