From 2c76c572a8c29e4ab11bf602d5cb0ba02cd46f2b Mon Sep 17 00:00:00 2001 From: rbisson <remi.bisson@inrae.fr> Date: Tue, 5 Nov 2024 14:57:11 +0100 Subject: [PATCH 1/3] [pages/*] renamed files and titles --- src/components/Layout/Layout.js | 16 +++++----- src/context/UserContext.js | 8 ++--- .../{group/Group.js => groups/Groups.js} | 10 +++--- src/pages/{group => groups}/package.json | 4 +-- src/pages/{group => groups}/styles.js | 0 .../Policy.js => policies/Policies.js} | 32 +++++++++---------- src/pages/policies/package.json | 6 ++++ src/pages/{policy => policies}/styles.js | 0 src/pages/policy/package.json | 6 ---- src/pages/requests/Requests.js | 2 +- src/pages/roles/{Role.js => Roles.js} | 16 +++++----- src/pages/roles/package.json | 2 +- src/pages/{user/User.js => users/Users.js} | 16 +++++----- src/pages/{user => users}/package.json | 4 +-- src/pages/{user => users}/styles.js | 0 src/utils.js | 8 ++--- 16 files changed, 65 insertions(+), 65 deletions(-) rename src/pages/{group/Group.js => groups/Groups.js} (98%) rename src/pages/{group => groups}/package.json (51%) rename src/pages/{group => groups}/styles.js (100%) rename src/pages/{policy/Policy.js => policies/Policies.js} (96%) create mode 100644 src/pages/policies/package.json rename src/pages/{policy => policies}/styles.js (100%) delete mode 100644 src/pages/policy/package.json rename src/pages/roles/{Role.js => Roles.js} (96%) rename src/pages/{user/User.js => users/Users.js} (96%) rename src/pages/{user => users}/package.json (52%) rename src/pages/{user => users}/styles.js (100%) diff --git a/src/components/Layout/Layout.js b/src/components/Layout/Layout.js index 23d1182..80b997e 100644 --- a/src/components/Layout/Layout.js +++ b/src/components/Layout/Layout.js @@ -5,13 +5,13 @@ import useStyles from './styles'; import Header from '../Header'; import Sidebar from '../Sidebar'; import Dashboard from '../../pages/dashboard'; -import User from '../../pages/user'; -import Role from '../../pages/roles'; +import Users from '../../pages/users'; +import Roles from '../../pages/roles/Roles'; import Requests from '../../pages/requests'; import Sources from '../../pages/sources/Sources'; import Fields from '../../pages/fields'; -import Policy from '../../pages/policy'; -import Group from '../../pages/group'; +import Policies from '../../pages/policies'; +import Groups from '../../pages/groups/Groups'; import { useLayoutState } from '../../context/LayoutContext'; function Layout(props) { @@ -31,13 +31,13 @@ function Layout(props) { <div className={classes.fakeToolbar} /> <Switch> <Route path="/app/dashboard" component={Dashboard} /> - <Route path="/app/user" component={User} /> + <Route path="/app/users" component={Users} /> <Route path="/app/requests" component={Requests} /> - <Route path="/app/role" component={Role} /> + <Route path="/app/roles" component={Roles} /> <Route path="/app/sources" component={Sources} /> <Route path="/app/fields" component={Fields} /> - <Route path="/app/policies" component={Policy} /> - <Route path="/app/groups" component={Group} /> + <Route path="/app/policies" component={Policies} /> + <Route path="/app/groups" component={Groups} /> </Switch> </div> </> diff --git a/src/context/UserContext.js b/src/context/UserContext.js index 66c689a..5c209e8 100644 --- a/src/context/UserContext.js +++ b/src/context/UserContext.js @@ -76,14 +76,14 @@ async function checkUserLogin(userId, accessToken, refreshToken, roleId) { sessionStorage.setItem('refresh_token', refreshToken); sessionStorage.setItem('roleId', roleId); //To Do: - // Load the user histories from UserHistory(userId) endpoint - // Load the user result filters from Result_Filter(userId) endpoints - // Load the user policies from Policy(userId) endpoint + // Load the users histories from UserHistory(userId) endpoint + // Load the users result filters from Result_Filter(userId) endpoints + // Load the users policies from Policies(userId) endpoint if (!sessionStorage.getItem('token_refresh_time')) { sessionStorage.setItem('token_refresh_time', Date.now()); } } else { - console.error('user not logged in'); + console.error('users not logged in'); } } diff --git a/src/pages/group/Group.js b/src/pages/groups/Groups.js similarity index 98% rename from src/pages/group/Group.js rename to src/pages/groups/Groups.js index b3fb809..48b977d 100644 --- a/src/pages/group/Group.js +++ b/src/pages/groups/Groups.js @@ -152,7 +152,7 @@ const AssignedGroups = memo( } ); -const Group = () => { +const Groups = () => { const [selectedTabNumber, setSelectedTabNumber] = useState(0); const [globalState, globalActions] = store(); const [groupNameValue, setGroupNameValue] = useState(''); @@ -243,7 +243,7 @@ const Group = () => { if (globalState.status === 'SUCCESS') { setOpen(true); - setAlertMessage('User-Group assignment completed successfully!'); + setAlertMessage('Users-Group assignment completed successfully!'); setSeverity('success'); } }; @@ -267,7 +267,7 @@ const Group = () => { const groupActions = [ { name: 'Delete', - description: 'Delete this group', + description: 'Delete this groups', icon: 'trash', type: 'icon', color: 'danger', @@ -364,7 +364,7 @@ const Group = () => { <EuiPageContentHeader> <EuiPageContentHeaderSection> <EuiTitle> - <h6>Groups</h6> + <h6>Groups management</h6> </EuiTitle> </EuiPageContentHeaderSection> </EuiPageContentHeader> @@ -387,4 +387,4 @@ const Group = () => { ); }; -export default Group; +export default Groups; diff --git a/src/pages/group/package.json b/src/pages/groups/package.json similarity index 51% rename from src/pages/group/package.json rename to src/pages/groups/package.json index 0d7c574..1dd2bee 100644 --- a/src/pages/group/package.json +++ b/src/pages/groups/package.json @@ -1,6 +1,6 @@ { - "name": "Group", + "name": "Groups", "version": "1.0.0", "private": true, - "main": "Group.js" + "main": "Groups.js" } diff --git a/src/pages/group/styles.js b/src/pages/groups/styles.js similarity index 100% rename from src/pages/group/styles.js rename to src/pages/groups/styles.js diff --git a/src/pages/policy/Policy.js b/src/pages/policies/Policies.js similarity index 96% rename from src/pages/policy/Policy.js rename to src/pages/policies/Policies.js index 8fbe356..1325cd2 100644 --- a/src/pages/policy/Policy.js +++ b/src/pages/policies/Policies.js @@ -37,7 +37,7 @@ const NewPolicyForm = memo( return ( <> <EuiForm component="form"> - <EuiFormRow label="Policy Name"> + <EuiFormRow label="Policies Name"> <EuiFieldText value={policyName} onChange={(e) => setPolicyName(e.target.value)} @@ -56,7 +56,7 @@ const NewPolicyForm = memo( hasChildLabel={false}> <EuiSwitch name="switch" - label="Is it default policy for user?" + label="Is it default policies for users?" checked={isSwitchChecked} onChange={onSwitchChange} /> @@ -288,7 +288,7 @@ const AssignedPolicies = memo( return ( <> <EuiForm component="form"> - <EuiFormRow label="Select Specific Policy"> + <EuiFormRow label="Select Specific Policies"> <EuiComboBox placeholder="Select a policy" singleSelection={{ asPlainText: true }} @@ -319,7 +319,7 @@ const AssignedPolicies = memo( } ); -const Policy = () => { +const Policies = () => { const [globalState, globalActions] = store(); const [selectedTabNumber, setSelectedTabNumber] = useState(0); const [isSwitchChecked, setIsSwitchChecked] = useState(false); @@ -477,7 +477,7 @@ const Policy = () => { if (globalState.status === 'SUCCESS') { loadPoliciesWithSources(); setOpen(true); - setAlertMessage('Policy-Source assignment completed successfully !'); + setAlertMessage('Policies-Source assignment completed successfully !'); setSeverity('success'); } } @@ -496,7 +496,7 @@ const Policy = () => { if (globalState.status === 'SUCCESS') { setOpen(true); - setAlertMessage('Policy was created successfully !'); + setAlertMessage('Policies was created successfully !'); setSeverity('success'); loadPolicies(); loadPoliciesWithSources(); @@ -515,14 +515,14 @@ const Policy = () => { for (const policy of checkedPolicies) { for (const stdField of checkedStdFields) { - //to-do: if policy is already defined, do not let insert them into table. + //to-do: if policies is already defined, do not let insert them into table. await globalActions.policy.createPolicyField(policy.value, stdField.value); } } if (globalState.status === 'SUCCESS') { setOpen(true); - setAlertMessage('Policy-Assignment completed successfully !'); + setAlertMessage('Policies-Assignment completed successfully !'); setSeverity('success'); } }; @@ -544,7 +544,7 @@ const Policy = () => { } if (globalState.status === 'SUCCESS') { setOpen(true); - setAlertMessage('Policy-Group assignment completed successfully !'); + setAlertMessage('Policies-Group assignment completed successfully !'); setSeverity('success'); } } @@ -595,7 +595,7 @@ const Policy = () => { await globalActions.policy.deletePolicyField(e.id); setOpen(true); - setAlertMessage('Policy-Field deleted successfully !'); + setAlertMessage('Policies-Field deleted successfully !'); setSeverity('success'); } }; @@ -603,7 +603,7 @@ const Policy = () => { const assignedPolicyActions = [ { name: 'Delete', - description: 'Delete this Policy-Field', + description: 'Delete this Policies-Field', icon: 'trash', type: 'icon', color: 'danger', @@ -645,7 +645,7 @@ const Policy = () => { await globalActions.group.deleteGroupPolicy(e.grouppolicyid); setOpen(true); - setAlertMessage('Policy-group deleted successfully !'); + setAlertMessage('Policies-groups deleted successfully !'); setSeverity('success'); } }; @@ -653,7 +653,7 @@ const Policy = () => { const assignedPolicyGroupActions = [ { name: 'Delete', - description: 'Delete this Policy-Group', + description: 'Delete this Policies-Group', icon: 'trash', type: 'icon', color: 'danger', @@ -672,7 +672,7 @@ const Policy = () => { await globalActions.policy.deletePolicy(e.id); if (globalState.status === 'SUCCESS') { setOpen(true); - setAlertMessage('Policy deleted successfully !'); + setAlertMessage('Policies deleted successfully !'); setSeverity('success'); loadPoliciesWithSources(); loadPolicies(); @@ -831,7 +831,7 @@ const Policy = () => { <EuiPageContentHeader> <EuiPageContentHeaderSection> <EuiTitle> - <h6>Policies</h6> + <h6>Policies management</h6> </EuiTitle> </EuiPageContentHeaderSection> </EuiPageContentHeader> @@ -852,4 +852,4 @@ const Policy = () => { ); }; -export default Policy; +export default Policies; diff --git a/src/pages/policies/package.json b/src/pages/policies/package.json new file mode 100644 index 0000000..7d3f03a --- /dev/null +++ b/src/pages/policies/package.json @@ -0,0 +1,6 @@ +{ + "name": "Policies", + "version": "1.0.0", + "private": true, + "main": "Policies.js" +} diff --git a/src/pages/policy/styles.js b/src/pages/policies/styles.js similarity index 100% rename from src/pages/policy/styles.js rename to src/pages/policies/styles.js diff --git a/src/pages/policy/package.json b/src/pages/policy/package.json deleted file mode 100644 index bd72886..0000000 --- a/src/pages/policy/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Policy", - "version": "1.0.0", - "private": true, - "main": "Policy.js" -} diff --git a/src/pages/requests/Requests.js b/src/pages/requests/Requests.js index a87a92e..111792c 100644 --- a/src/pages/requests/Requests.js +++ b/src/pages/requests/Requests.js @@ -166,7 +166,7 @@ const Requests = () => { <EuiPageContentHeader> <EuiPageContentHeaderSection> <EuiTitle> - <h6>Users</h6> + <h6>Requests management</h6> </EuiTitle> </EuiPageContentHeaderSection> </EuiPageContentHeader> diff --git a/src/pages/roles/Role.js b/src/pages/roles/Roles.js similarity index 96% rename from src/pages/roles/Role.js rename to src/pages/roles/Roles.js index 4b75f6e..6be4b34 100644 --- a/src/pages/roles/Role.js +++ b/src/pages/roles/Roles.js @@ -32,13 +32,13 @@ const newRoleForm = ({ return ( <> <EuiForm component="form"> - <EuiFormRow label="Role Name"> + <EuiFormRow label="Roles Name"> <EuiFieldText value={roleNameValue} onChange={(e) => setRoleNameValue(e.target.value)} /> </EuiFormRow> - <EuiFormRow label="Role Description"> + <EuiFormRow label="Roles Description"> <EuiFieldText value={roleDescriptionValue} onChange={(e) => setRoleDescriptionValue(e.target.value)} @@ -129,7 +129,7 @@ const assignedRoles = ({ return ( <> <EuiForm component="form"> - <EuiFormRow label="Select Specific Role"> + <EuiFormRow label="Select Specific Roles"> <EuiComboBox placeholder="Select a role" singleSelection={{ asPlainText: true }} @@ -154,7 +154,7 @@ const assignedRoles = ({ ); }; -const Role = () => { +const Roles = () => { const [globalState, globalActions] = store(); const [selectedTabNumber, setSelectedTabNumber] = useState(0); const [roleNameValue, setRoleNameValue] = useState(); @@ -221,7 +221,7 @@ const Role = () => { if (globalState.status === 'SUCCESS') { setOpen(true); - setAlertMessage('Role-Assignment completed successfully !'); + setAlertMessage('Roles-Assignment completed successfully !'); setSeverity('success'); } }; @@ -242,7 +242,7 @@ const Role = () => { await globalActions.user.deleteRole(e.id); if (globalState.status === 'SUCCESS') { setOpen(true); - setAlertMessage('Role delete successfully !'); + setAlertMessage('Roles delete successfully !'); setSeverity('success'); await globalActions.user.findRole(); @@ -339,7 +339,7 @@ const Role = () => { <EuiPageContentHeader> <EuiPageContentHeaderSection> <EuiTitle> - <h6>Roles</h6> + <h6>Roles management</h6> </EuiTitle> </EuiPageContentHeaderSection> </EuiPageContentHeader> @@ -360,4 +360,4 @@ const Role = () => { ); }; -export default Role; +export default Roles; diff --git a/src/pages/roles/package.json b/src/pages/roles/package.json index 0f4db35..bdb80c9 100644 --- a/src/pages/roles/package.json +++ b/src/pages/roles/package.json @@ -2,5 +2,5 @@ "name": "Role", "version": "1.0.0", "private": true, - "main": "Role.js" + "main": "Roles.js" } diff --git a/src/pages/user/User.js b/src/pages/users/Users.js similarity index 96% rename from src/pages/user/User.js rename to src/pages/users/Users.js index 7662de5..b921b36 100644 --- a/src/pages/user/User.js +++ b/src/pages/users/Users.js @@ -53,7 +53,7 @@ const NewUserForm = memo( <EuiFormRow label="e-mail"> <EuiFieldText value={email} onChange={(e) => setEmail(e.target.value)} /> </EuiFormRow> - <EuiFormRow label="Select Specific Role"> + <EuiFormRow label="Select Specific Roles"> <EuiSelect options={roles} value={selectedRole} @@ -97,7 +97,7 @@ const UserList = memo( } ); -const User = () => { +const Users = () => { const [globalState, globalActions] = store(); const [selectedTabNumber, setSelectedTabNumber] = useState(0); const [open, setOpen] = useState(false); @@ -166,7 +166,7 @@ const User = () => { selectedRole ); setOpen(true); - setAlertMessage('User is created successfully!'); + setAlertMessage('User has been created.'); setSeverity('success'); loadUsers(); } @@ -176,7 +176,7 @@ const User = () => { if (user) { await globalActions.user.deleteUser(user.kc_id); setOpen(true); - setAlertMessage('User is deleted successfully!'); + setAlertMessage('Users has been deleted.'); setSeverity('success'); await loadUsers(); } @@ -231,7 +231,7 @@ const User = () => { const tabContents = [ { id: 'tab1', - name: 'New User', + name: 'New user', content: ( <> <br /> @@ -254,7 +254,7 @@ const User = () => { }, { id: 'tab2', - name: 'User List', + name: 'Users list', content: ( <> <br /> @@ -283,7 +283,7 @@ const User = () => { <EuiPageContentHeader> <EuiPageContentHeaderSection> <EuiTitle> - <h6>Users</h6> + <h6>Users management</h6> </EuiTitle> </EuiPageContentHeaderSection> </EuiPageContentHeader> @@ -304,4 +304,4 @@ const User = () => { ); }; -export default User; +export default Users; diff --git a/src/pages/user/package.json b/src/pages/users/package.json similarity index 52% rename from src/pages/user/package.json rename to src/pages/users/package.json index b261e71..d14b93b 100644 --- a/src/pages/user/package.json +++ b/src/pages/users/package.json @@ -1,6 +1,6 @@ { - "name": "User", + "name": "Users", "version": "1.0.0", "private": true, - "main": "User.js" + "main": "Users.js" } diff --git a/src/pages/user/styles.js b/src/pages/users/styles.js similarity index 100% rename from src/pages/user/styles.js rename to src/pages/users/styles.js diff --git a/src/utils.js b/src/utils.js index c3c0fa8..9ad2ab2 100644 --- a/src/utils.js +++ b/src/utils.js @@ -63,15 +63,15 @@ export const getSideBarItems = () => { }, { id: 1, - label: 'User', - link: '/app/user', + label: 'Users', + link: '/app/users', roles: [1], icon: <EuiIcon type="user" size="l" />, }, { id: 2, - label: 'Roles', - link: '/app/role', + label: 'Users roles', + link: '/app/roles', roles: [1], icon: <EuiIcon type="usersRolesApp" size="l" />, }, -- GitLab From 0594728c3fafda86ecd078a075608748ea72b9ff Mon Sep 17 00:00:00 2001 From: rbisson <remi.bisson@inrae.fr> Date: Tue, 5 Nov 2024 15:25:40 +0100 Subject: [PATCH 2/3] [src/pages] Removed all useless capital letters from title, forms, etc --- src/components/Header/Header.js | 4 +- src/components/Layout/Layout.js | 6 +-- src/pages/dashboard/Dashboard.js | 16 +++--- src/pages/fields/Fields.js | 18 +++---- src/pages/groups/Groups.js | 24 ++++----- src/pages/policies/Policies.js | 85 +++++++++++--------------------- src/pages/requests/Requests.js | 8 +-- src/pages/roles/Roles.js | 27 +++++----- src/pages/sources/Sources.js | 36 +++++++------- src/pages/users/Users.js | 2 +- 10 files changed, 98 insertions(+), 128 deletions(-) diff --git a/src/components/Header/Header.js b/src/components/Header/Header.js index 252dda2..8ac55dc 100644 --- a/src/components/Header/Header.js +++ b/src/components/Header/Header.js @@ -63,7 +63,7 @@ export default function Header(props) { )} </IconButton> <Typography variant="h6" weight="medium" className={classes.logotype}> - IN-SYLVA IS Administration Portal + IN-SYLVA IS administration Portal </Typography> <div className={classes.grow} /> <IconButton @@ -100,7 +100,7 @@ export default function Header(props) { color="primary" onClick={() => signOut(userDispatch, props.history)} > - Sign Out + Sign out </Typography> </div> </Menu> diff --git a/src/components/Layout/Layout.js b/src/components/Layout/Layout.js index 80b997e..f2240a9 100644 --- a/src/components/Layout/Layout.js +++ b/src/components/Layout/Layout.js @@ -32,12 +32,12 @@ function Layout(props) { <Switch> <Route path="/app/dashboard" component={Dashboard} /> <Route path="/app/users" component={Users} /> - <Route path="/app/requests" component={Requests} /> <Route path="/app/roles" component={Roles} /> + <Route path="/app/groups" component={Groups} /> + <Route path="/app/requests" component={Requests} /> + <Route path="/app/policies" component={Policies} /> <Route path="/app/sources" component={Sources} /> <Route path="/app/fields" component={Fields} /> - <Route path="/app/policies" component={Policies} /> - <Route path="/app/groups" component={Groups} /> </Switch> </div> </> diff --git a/src/pages/dashboard/Dashboard.js b/src/pages/dashboard/Dashboard.js index 1e6745f..1932fe6 100644 --- a/src/pages/dashboard/Dashboard.js +++ b/src/pages/dashboard/Dashboard.js @@ -27,9 +27,9 @@ import Dot from '../../components/Sidebar/components/Dot'; import { getRandomData } from '../../utils'; const PieChartData = [ - { name: 'Super User', value: 400, color: 'primary' }, - { name: 'Source Manager', value: 300, color: 'secondary' }, - { name: 'Standard User', value: 300, color: 'warning' }, + { name: 'super-admin', value: 400, color: 'primary' }, + { name: 'source-manager', value: 300, color: 'secondary' }, + { name: 'normal-user', value: 300, color: 'warning' }, ]; const urlMaps = new Map(); @@ -199,7 +199,7 @@ export default function Dashboard() { <Grid container spacing={4}> <Grid item lg={3} md={4} sm={6} xs={12}> <Widget - title="Visits Today" + title="Visits today" upperTitle bodyClass={classes.fullHeightBody} className={classes.card} @@ -243,7 +243,7 @@ export default function Dashboard() { </Grid> <Grid item> <Typography color="text" colorBrightness="secondary"> - Sign Out + Sign out </Typography> <Typography size="md">32</Typography> </Grid> @@ -258,7 +258,7 @@ export default function Dashboard() { </Grid> <Grid item lg={3} md={8} sm={6} xs={12}> <Widget - title=" Query Performance" + title="Query performance" upperTitle className={classes.card} bodyClass={classes.fullHeightBody} @@ -321,7 +321,7 @@ export default function Dashboard() { </Grid> <Grid item lg={3} md={8} sm={6} xs={12}> <Widget - title="Server Overview" + title="Server overview" upperTitle className={classes.card} bodyClass={classes.fullHeightBody} @@ -398,7 +398,7 @@ export default function Dashboard() { </Widget> </Grid> <Grid item lg={3} md={4} sm={6} xs={12}> - <Widget title="Number of Users" upperTitle className={classes.card}> + <Widget title="Number of users" upperTitle className={classes.card}> <Grid container spacing={2}> <Grid item xs={6}> <ResponsiveContainer width="100%" height={144}> diff --git a/src/pages/fields/Fields.js b/src/pages/fields/Fields.js index ecbd5f5..1ec424c 100644 --- a/src/pages/fields/Fields.js +++ b/src/pages/fields/Fields.js @@ -37,7 +37,7 @@ const NewFieldsForm = memo(({ files, globalState, onFilePickerChange, onSaveFiel return ( <> <EuiForm component="form"> - <EuiFormRow label="Standard Field Files"> + <EuiFormRow label="Standard field file(s)"> <EuiFilePicker id="filePicker1" multiple @@ -81,7 +81,7 @@ const StdFields = memo( return ( <> <EuiForm component="form"> - <EuiFormRow label="Uploaded Standard Fields" fullWidth> + <EuiFormRow label="Uploaded standard fields" fullWidth> <EuiInMemoryTable // ref={tableref} // itemId="id" @@ -259,7 +259,7 @@ const Fields = (props) => { }); setOpen(true); - setAlertMessage('Standard fields added successfully!'); + setAlertMessage('Standard fields added.'); setSeverity('success'); loadStdFields(); } @@ -268,22 +268,22 @@ const Fields = (props) => { const stdFieldColumns = [ { field: 'field_name', - name: 'Field Name', + name: 'Field name', sortable: true, truncateText: true, }, { field: 'field_type', - name: 'Field Type', + name: 'Field type', }, { field: 'definition_and_comment', - name: 'Definition And Comment', + name: 'Definition And comment', // truncateText: true, }, { field: 'Obligation_or_condition', - name: 'Obligation or Condition', + name: 'Obligation or condition', }, { field: 'values', @@ -297,7 +297,7 @@ const Fields = (props) => { const tabContents = [ { id: 'tab1', - name: 'Upload Fields', + name: 'Upload fields', content: ( <> <br /> @@ -344,7 +344,7 @@ const Fields = (props) => { <EuiPageContentHeader> <EuiPageContentHeaderSection> <EuiTitle> - <h6>Field Management</h6> + <h6>Field management</h6> </EuiTitle> </EuiPageContentHeaderSection> </EuiPageContentHeader> diff --git a/src/pages/groups/Groups.js b/src/pages/groups/Groups.js index 48b977d..eeb1655 100644 --- a/src/pages/groups/Groups.js +++ b/src/pages/groups/Groups.js @@ -35,13 +35,13 @@ const NewGroupForm = memo( <> <br /> <EuiForm component="form"> - <EuiFormRow label="Group Name"> + <EuiFormRow label="Name"> <EuiFieldText value={groupNameValue} onChange={(e) => setGroupNameValue(e.target.value)} /> </EuiFormRow> - <EuiFormRow label="Group Description"> + <EuiFormRow label="Description"> <EuiFieldText id="descriptionValue" value={groupDescriptionValue} @@ -132,7 +132,7 @@ const AssignedGroups = memo( return ( <> <EuiForm component="form"> - <EuiFormRow label="Select Specific Group"> + <EuiFormRow label="Select specific group"> <EuiComboBox placeholder="Select a group" singleSelection={{ asPlainText: true }} @@ -143,7 +143,7 @@ const AssignedGroups = memo( }} /> </EuiFormRow> - <EuiFormRow label="Assigned Policies" fullWidth> + <EuiFormRow label="Assigned policies" fullWidth> <EuiBasicTable items={groupedUsers} columns={assignedGroupedUserColumns} /> </EuiFormRow> </EuiForm> @@ -219,7 +219,7 @@ const Groups = () => { if (globalState.status === 'SUCCESS') { setOpen(true); - setAlertMessage('Group created successfully!'); + setAlertMessage('Group has been created.'); setSeverity('success'); } await loadGroups(); @@ -243,7 +243,7 @@ const Groups = () => { if (globalState.status === 'SUCCESS') { setOpen(true); - setAlertMessage('Users-Group assignment completed successfully!'); + setAlertMessage('Users-group assignment has been completed.'); setSeverity('success'); } }; @@ -267,7 +267,7 @@ const Groups = () => { const groupActions = [ { name: 'Delete', - description: 'Delete this groups', + description: 'Delete this group', icon: 'trash', type: 'icon', color: 'danger', @@ -278,7 +278,7 @@ const Groups = () => { const assignedGroupedUserActions = [ { name: 'Delete', - description: 'Delete this person', + description: 'Delete this assignment', icon: 'trash', type: 'icon', color: 'danger', @@ -287,7 +287,7 @@ const Groups = () => { ]; const groupColumns = [ - { field: 'name', name: 'Group Name' }, + { field: 'name', name: 'Group name' }, { field: 'description', name: 'Group description' }, { name: 'Actions', actions: groupActions }, ]; @@ -302,7 +302,7 @@ const Groups = () => { const tabContents = [ { id: 'tab1', - name: 'New Group', + name: 'New group', content: ( <> <NewGroupForm @@ -320,7 +320,7 @@ const Groups = () => { }, { id: 'tab2', - name: 'Group Assignment', + name: 'Group assignment', content: ( <> <GroupAssignment @@ -336,7 +336,7 @@ const Groups = () => { }, { id: 'tab3', - name: 'Assigned Groups', + name: 'Assigned groups', content: ( <> <AssignedGroups diff --git a/src/pages/policies/Policies.js b/src/pages/policies/Policies.js index 1325cd2..ab3c622 100644 --- a/src/pages/policies/Policies.js +++ b/src/pages/policies/Policies.js @@ -37,30 +37,12 @@ const NewPolicyForm = memo( return ( <> <EuiForm component="form"> - <EuiFormRow label="Policies Name"> + <EuiFormRow label="Policy name"> <EuiFieldText value={policyName} onChange={(e) => setPolicyName(e.target.value)} /> </EuiFormRow> - {/* <EuiFormRow - label="Select Specific Source"> - <EuiSelect - options={sources} - value={selectedSource} - onChange={e => setSelectedSource(e.target.value)} - /> - </EuiFormRow> */} - {/*<EuiFormRow - // label="Use a switch instead of a single checkbox and set 'hasChildLabel' to false" - hasChildLabel={false}> - <EuiSwitch - name="switch" - label="Is it default policies for users?" - checked={isSwitchChecked} - onChange={onSwitchChange} - /> - </EuiFormRow>*/} <EuiSpacer /> <EuiButton type="submit" @@ -72,13 +54,7 @@ const NewPolicyForm = memo( </EuiButton> <EuiSpacer /> <EuiFormRow label="" fullWidth> - <EuiBasicTable - items={policies} - rowheader="Name" - columns={policyColumns} - // rowProps={getRowProps} - // cellProps={getCellProps} - /> + <EuiBasicTable items={policies} rowheader="Name" columns={policyColumns} /> </EuiFormRow> </EuiForm> </> @@ -117,7 +93,7 @@ const PolicyAssignment = memo( </EuiFormRow> </EuiFlexItem> <EuiFlexItem component="span"> - <EuiFormRow label="Standard Fields" fullWidth> + <EuiFormRow label="Standard fields" fullWidth> <EuiSelectable searchable options={optStdFields} @@ -288,7 +264,7 @@ const AssignedPolicies = memo( return ( <> <EuiForm component="form"> - <EuiFormRow label="Select Specific Policies"> + <EuiFormRow label="Select a specific policy"> <EuiComboBox placeholder="Select a policy" singleSelection={{ asPlainText: true }} @@ -299,7 +275,7 @@ const AssignedPolicies = memo( }} /> </EuiFormRow> - <EuiFormRow label="Assigned Standard Fields" fullWidth> + <EuiFormRow label="Assigned standard fields" fullWidth> <EuiBasicTable items={fields} columns={assignedPolicyColumns} @@ -307,7 +283,7 @@ const AssignedPolicies = memo( cellProps={getCellProps} /> </EuiFormRow> - <EuiFormRow label="Assigned Groups" fullWidth> + <EuiFormRow label="Assigned groups" fullWidth> <EuiBasicTable items={assignedPolicyGroups} columns={assignedPolicyGroupColumns} @@ -496,7 +472,7 @@ const Policies = () => { if (globalState.status === 'SUCCESS') { setOpen(true); - setAlertMessage('Policies was created successfully !'); + setAlertMessage('Policy created.'); setSeverity('success'); loadPolicies(); loadPoliciesWithSources(); @@ -522,7 +498,7 @@ const Policies = () => { if (globalState.status === 'SUCCESS') { setOpen(true); - setAlertMessage('Policies-Assignment completed successfully !'); + setAlertMessage('Policies-Assignment completed.'); setSeverity('success'); } }; @@ -544,7 +520,7 @@ const Policies = () => { } if (globalState.status === 'SUCCESS') { setOpen(true); - setAlertMessage('Policies-Group assignment completed successfully !'); + setAlertMessage('Policies-Group assignment completed.'); setSeverity('success'); } } @@ -595,7 +571,7 @@ const Policies = () => { await globalActions.policy.deletePolicyField(e.id); setOpen(true); - setAlertMessage('Policies-Field deleted successfully !'); + setAlertMessage('Policies-Field deleted.'); setSeverity('success'); } }; @@ -603,7 +579,7 @@ const Policies = () => { const assignedPolicyActions = [ { name: 'Delete', - description: 'Delete this Policies-Field', + description: 'Delete this policies-field', icon: 'trash', type: 'icon', color: 'danger', @@ -614,25 +590,20 @@ const Policies = () => { const assignedPolicyColumns = [ { field: 'field_name', - name: 'Field Name', + name: 'Field name', sortable: true, }, { field: 'definition_and_comment', - name: 'Definition And Comment', + name: 'Definition and comment', truncateText: true, - /*render: name => ( - <EuiLink href="#" target="_blank"> - {name} - </EuiLink> - ),*/ mobileOptions: { show: false, }, }, { field: 'field_type', - name: 'Field Type', + name: 'Field type', }, { name: 'Actions', @@ -645,7 +616,7 @@ const Policies = () => { await globalActions.group.deleteGroupPolicy(e.grouppolicyid); setOpen(true); - setAlertMessage('Policies-groups deleted successfully !'); + setAlertMessage('Policies-groups deleted.'); setSeverity('success'); } }; @@ -653,7 +624,7 @@ const Policies = () => { const assignedPolicyGroupActions = [ { name: 'Delete', - description: 'Delete this Policies-Group', + description: 'Delete this policies-group', icon: 'trash', type: 'icon', color: 'danger', @@ -662,9 +633,9 @@ const Policies = () => { ]; const assignedPolicyGroupColumns = [ - { field: 'group_name', name: 'Group Name' }, - { field: 'source_name', name: 'Source Name' }, - { field: 'source_description', name: 'Source Description' }, + { field: 'group_name', name: 'Group name' }, + { field: 'source_name', name: 'Source name' }, + { field: 'source_description', name: 'Source description' }, { name: 'Actions', actions: assignedPolicyGroupActions }, ]; @@ -672,7 +643,7 @@ const Policies = () => { await globalActions.policy.deletePolicy(e.id); if (globalState.status === 'SUCCESS') { setOpen(true); - setAlertMessage('Policies deleted successfully !'); + setAlertMessage('Policy deleted.'); setSeverity('success'); loadPoliciesWithSources(); loadPolicies(); @@ -682,7 +653,7 @@ const Policies = () => { const policyColumnAction = [ { name: 'Delete', - description: 'Delete this person', + description: 'Delete this policy', icon: 'trash', type: 'icon', color: 'danger', @@ -692,11 +663,11 @@ const Policies = () => { const policyColumns = [ { field: 'policyname', - name: 'Policy Name', + name: 'Policy name', }, { field: 'sourcename', - name: 'Source Name', + name: 'Source name', }, { name: 'Actions', @@ -732,7 +703,7 @@ const Policies = () => { const tabContents = [ { id: 'tab1', - name: 'New Policy', + name: 'New policy', content: ( <> <br /> @@ -754,7 +725,7 @@ const Policies = () => { }, { id: 'tab2', - name: 'Policy-Source Assignment', + name: 'Policy-Source assignment', content: ( <> <br /> @@ -771,7 +742,7 @@ const Policies = () => { }, { id: 'tab3', - name: 'Policy-Field Assignment', + name: 'Policy-Field assignment', content: ( <> <br /> @@ -788,7 +759,7 @@ const Policies = () => { }, { id: 'tab4', - name: 'Policy-Group Assignment', + name: 'Policy-Group assignment', content: ( <> <br /> @@ -805,7 +776,7 @@ const Policies = () => { }, { id: 'tab5', - name: 'Assigned Policies', + name: 'Assigned policies', content: ( <> <br /> diff --git a/src/pages/requests/Requests.js b/src/pages/requests/Requests.js index 111792c..97bec19 100644 --- a/src/pages/requests/Requests.js +++ b/src/pages/requests/Requests.js @@ -68,7 +68,7 @@ const Requests = () => { if (request) { await globalActions.user.deleteUserRequest(request.id); setOpen(true); - setAlertMessage('Request was deleted successfully!'); + setAlertMessage('Request has been deleted.'); setSeverity('success'); await loadRequests(); await loadPendingRequests(); @@ -79,7 +79,7 @@ const Requests = () => { if (request) { await globalActions.user.processUserRequest(request.id); setOpen(true); - setAlertMessage('Request was deleted successfully!'); + setAlertMessage('Request has been processed.'); setSeverity('success'); await loadRequests(); await loadPendingRequests(); @@ -131,7 +131,7 @@ const Requests = () => { const tabContents = [ { id: 'tab1', - name: 'Pending Requests List', + name: 'Pending requests', content: ( <> <br /> @@ -144,7 +144,7 @@ const Requests = () => { }, { id: 'tab2', - name: 'Full Requests List', + name: 'All requests', content: ( <> <br /> diff --git a/src/pages/roles/Roles.js b/src/pages/roles/Roles.js index 6be4b34..4706c0f 100644 --- a/src/pages/roles/Roles.js +++ b/src/pages/roles/Roles.js @@ -32,13 +32,13 @@ const newRoleForm = ({ return ( <> <EuiForm component="form"> - <EuiFormRow label="Roles Name"> + <EuiFormRow label="Name"> <EuiFieldText value={roleNameValue} onChange={(e) => setRoleNameValue(e.target.value)} /> </EuiFormRow> - <EuiFormRow label="Roles Description"> + <EuiFormRow label="Description"> <EuiFieldText value={roleDescriptionValue} onChange={(e) => setRoleDescriptionValue(e.target.value)} @@ -129,7 +129,7 @@ const assignedRoles = ({ return ( <> <EuiForm component="form"> - <EuiFormRow label="Select Specific Roles"> + <EuiFormRow label="Select specific roles"> <EuiComboBox placeholder="Select a role" singleSelection={{ asPlainText: true }} @@ -140,7 +140,7 @@ const assignedRoles = ({ }} /> </EuiFormRow> - <EuiFormRow label="Assigned Roles" fullWidth> + <EuiFormRow label="Assigned roles" fullWidth> <EuiBasicTable items={assignedRoleToUsers} rowheader="" @@ -221,7 +221,7 @@ const Roles = () => { if (globalState.status === 'SUCCESS') { setOpen(true); - setAlertMessage('Roles-Assignment completed successfully !'); + setAlertMessage('Role assignment was completed.'); setSeverity('success'); } }; @@ -242,9 +242,8 @@ const Roles = () => { await globalActions.user.deleteRole(e.id); if (globalState.status === 'SUCCESS') { setOpen(true); - setAlertMessage('Roles delete successfully !'); + setAlertMessage('Role has been deleted.'); setSeverity('success'); - await globalActions.user.findRole(); } }; @@ -252,7 +251,7 @@ const Roles = () => { const roleActions = [ { name: 'Delete', - description: 'Delete this person', + description: 'Delete this role', icon: 'trash', type: 'icon', color: 'danger', @@ -260,14 +259,14 @@ const Roles = () => { }, ]; const roleColumns = [ - { field: 'name', name: 'Role Name' }, - { field: 'description', name: 'Role Description' }, + { field: 'name', name: 'Name' }, + { field: 'description', name: 'Description' }, { name: 'Actions', actions: roleActions }, ]; const assignedRolesColumns = [ { field: 'username', name: 'Username' }, - { field: 'useremail', name: 'e-mail' }, + { field: 'useremail', name: 'E-mail' }, { field: 'rolename', name: 'Role' }, { name: 'Actions', actions: roleActions }, ]; @@ -282,7 +281,7 @@ const Roles = () => { const tabContents = [ { id: 'tab1', - name: 'New Role', + name: 'New role', content: ( <> <br /> @@ -300,7 +299,7 @@ const Roles = () => { }, { id: 'tab2', - name: 'Role Assignment', + name: 'Role assignment', content: ( <> <br /> @@ -317,7 +316,7 @@ const Roles = () => { }, { id: 'tab3', - name: 'Assigned Roles', + name: 'Assigned roles', content: ( <> <br /> diff --git a/src/pages/sources/Sources.js b/src/pages/sources/Sources.js index 7e7b9ce..9718765 100644 --- a/src/pages/sources/Sources.js +++ b/src/pages/sources/Sources.js @@ -52,14 +52,14 @@ const NewSourceForm = memo( <EuiForm component="form"> <EuiFlexGroup> <EuiFlexItem grow={3}> - <EuiFormRow label="Source / File Name"> + <EuiFormRow label="Source or file name"> <EuiFieldText id="nameValue" value={nameValue} onChange={(e) => setNameValue(e.target.value)} /> </EuiFormRow> - <EuiFormRow label="Source Description"> + <EuiFormRow label="Source description"> <EuiFieldText id="descriptionValue" value={descriptionValue} @@ -67,7 +67,7 @@ const NewSourceForm = memo( /> </EuiFormRow> <EuiSpacer /> - <EuiFormRow label="Source Files"> + <EuiFormRow label="Source files"> <EuiFilePicker id="filePicker1" multiple @@ -100,7 +100,7 @@ const NewSourceForm = memo( <> <br /> <JsonView - name="Metadata Records" + name="Metadata records" collapsed={true} iconStyle={'triangle'} src={metaUrfms} @@ -133,7 +133,7 @@ const SourcesForm = memo( <EuiSpacer size="l" /> - <EuiFormRow label="Uploaded Sources" fullWidth> + <EuiFormRow label="Uploaded sources" fullWidth> <EuiBasicTable itemId="id" isSelectable={true} @@ -369,10 +369,10 @@ const Sources = () => { }, ]; const metaUrfmColumns = [ - { field: 'name', name: 'Source / File Name' }, - { field: 'index_id', name: 'Elasticsearch Index' }, - { field: 'mng_id', name: 'MongoDb Index' }, - { field: 'description', name: 'Source Description' }, + { field: 'name', name: 'Source or file name' }, + { field: 'index_id', name: 'Elasticsearch index' }, + { field: 'mng_id', name: 'MongoDb index' }, + { field: 'description', name: 'Source description' }, { field: 'is_send', name: 'Status', @@ -440,13 +440,13 @@ const Sources = () => { if (globalState.status === 'SUCCESS') { setOpen(true); - setAlertMessage('Source was created successfully'); + setAlertMessage('Source created.'); setSeverity('success'); await loadSources(); } else { setOpen(true); - setAlertMessage('While creating the sources unexpected error has been occurred.'); + setAlertMessage('Unexpected error while creating source.'); setSeverity('error'); } } @@ -491,7 +491,7 @@ const Sources = () => { const tabContents = [ { id: 'tab1', - name: 'New Source', + name: 'New source', content: ( <> <NewSourceForm @@ -529,7 +529,7 @@ const Sources = () => { }, { id: 'tab3', - name: 'Share Sources', + name: 'Share sources', content: ( <> <ShareSources /> @@ -538,7 +538,7 @@ const Sources = () => { }, { id: 'tab4', - name: 'Shared Sources', + name: 'Shared sources', content: ( <> <SharedSources /> @@ -553,14 +553,14 @@ const Sources = () => { <p>Source / File Name is unique field for the In-Sylva Search App.</p> </EuiCallOut>{' '} <br /> - <EuiFormRow label="Source / File Name"> + <EuiFormRow label="Source or file name"> <EuiFieldText name="sourceName" value={sourceName} onChange={(e) => setSourceName(e.target.value)} /> </EuiFormRow> - <EuiFormRow label="Source Description"> + <EuiFormRow label="Source description"> <EuiFieldText name="sourceDescription" value={sourceDescription} @@ -578,7 +578,7 @@ const Sources = () => { <EuiModal onClose={closeMergeSourceModal} initialFocus="[name=popswitch]"> <EuiModalHeader> <EuiModalHeaderTitle> - Merge and Send Selected Source Files + Merge and send selected source files </EuiModalHeaderTitle> </EuiModalHeader> @@ -621,7 +621,7 @@ const Sources = () => { <EuiPageContentHeader> <EuiPageContentHeaderSection> <EuiTitle> - <h6>Source Management</h6> + <h6>Source management</h6> </EuiTitle> </EuiPageContentHeaderSection> </EuiPageContentHeader> diff --git a/src/pages/users/Users.js b/src/pages/users/Users.js index b921b36..2ccf6fd 100644 --- a/src/pages/users/Users.js +++ b/src/pages/users/Users.js @@ -53,7 +53,7 @@ const NewUserForm = memo( <EuiFormRow label="e-mail"> <EuiFieldText value={email} onChange={(e) => setEmail(e.target.value)} /> </EuiFormRow> - <EuiFormRow label="Select Specific Roles"> + <EuiFormRow label="Select specific roles"> <EuiSelect options={roles} value={selectedRole} -- GitLab From 3e2be70558acb90137e74822eba1a73c82dc500d Mon Sep 17 00:00:00 2001 From: rbisson <remi.bisson@inrae.fr> Date: Tue, 5 Nov 2024 15:55:38 +0100 Subject: [PATCH 3/3] [Header] removed useless profile fake link from menu ; cleaned styles file a bit --- src/components/Header/Header.js | 33 +++++------ src/components/Header/styles.js | 97 +-------------------------------- 2 files changed, 18 insertions(+), 112 deletions(-) diff --git a/src/components/Header/Header.js b/src/components/Header/Header.js index 8ac55dc..3064767 100644 --- a/src/components/Header/Header.js +++ b/src/components/Header/Header.js @@ -62,7 +62,7 @@ export default function Header(props) { /> )} </IconButton> - <Typography variant="h6" weight="medium" className={classes.logotype}> + <Typography variant="h6" weight="medium" className={classes.title}> IN-SYLVA IS administration Portal </Typography> <div className={classes.grow} /> @@ -85,23 +85,20 @@ export default function Header(props) { disableAutoFocusItem > <div className={classes.profileMenuUser}> - <Typography variant="h4" weight="medium"> - {user.username} - </Typography> - </div> - <MenuItem - className={classNames(classes.profileMenuItem, classes.headerMenuItem)} - > - <AccountIcon className={classes.profileMenuIcon} /> Profile - </MenuItem> - <div className={classes.profileMenuUser}> - <Typography - className={classes.profileMenuLink} - color="primary" - onClick={() => signOut(userDispatch, props.history)} - > - Sign out - </Typography> + <div className={classes.profileMenuItem}> + <Typography variant="h4" weight="medium"> + {user.username} + </Typography> + </div> + <div className={classes.profileMenuItem}> + <Typography + className={classes.profileMenuLink} + color="primary" + onClick={() => signOut(userDispatch, props.history)} + > + Sign out + </Typography> + </div> </div> </Menu> </Toolbar> diff --git a/src/components/Header/styles.js b/src/components/Header/styles.js index a9a48e8..c56095f 100644 --- a/src/components/Header/styles.js +++ b/src/components/Header/styles.js @@ -1,8 +1,7 @@ import { makeStyles } from '@material-ui/styles'; -import { alpha } from '@material-ui/core/styles'; export default makeStyles((theme) => ({ - logotype: { + title: { color: 'white', marginLeft: theme.spacing(2.5), marginRight: theme.spacing(2.5), @@ -31,68 +30,9 @@ export default makeStyles((theme) => ({ grow: { flexGrow: 1, }, - search: { - position: 'relative', - borderRadius: 25, - paddingLeft: theme.spacing(2.5), - width: 36, - backgroundColor: alpha(theme.palette.common.black, 0), - transition: theme.transitions.create(['background-color', 'width']), - '&:hover': { - cursor: 'pointer', - backgroundColor: alpha(theme.palette.common.black, 0.08), - }, - }, - searchFocused: { - backgroundColor: alpha(theme.palette.common.black, 0.08), - width: '100%', - [theme.breakpoints.up('md')]: { - width: 250, - }, - }, - searchIcon: { - width: 36, - right: 0, - height: '100%', - position: 'absolute', - display: 'flex', - alignItems: 'center', - justifyContent: 'center', - transition: theme.transitions.create('right'), - '&:hover': { - cursor: 'pointer', - }, - }, - searchIconOpened: { - right: theme.spacing(1.25), - }, - inputRoot: { - color: 'inherit', - width: '100%', - }, - inputInput: { - height: 36, - padding: 0, - paddingRight: 36 + theme.spacing(1.25), - width: '100%', - }, - messageContent: { - display: 'flex', - flexDirection: 'column', - }, headerMenu: { marginTop: theme.spacing(7), }, - headerMenuList: { - display: 'flex', - flexDirection: 'column', - }, - headerMenuItem: { - '&:hover, &:focus': { - backgroundColor: theme.palette.primary.main, - color: 'white', - }, - }, headerMenuButton: { marginLeft: theme.spacing(2), padding: theme.spacing(0.5), @@ -108,7 +48,7 @@ export default makeStyles((theme) => ({ color: 'white', }, profileMenu: { - minWidth: 265, + minWidth: 250, }, profileMenuUser: { display: 'flex', @@ -116,11 +56,7 @@ export default makeStyles((theme) => ({ padding: theme.spacing(2), }, profileMenuItem: { - color: theme.palette.text.hint, - }, - profileMenuIcon: { - marginRight: theme.spacing(2), - color: theme.palette.text.hint, + padding: theme.spacing(1), }, profileMenuLink: { fontSize: 16, @@ -129,31 +65,4 @@ export default makeStyles((theme) => ({ cursor: 'pointer', }, }, - messageNotification: { - height: 'auto', - display: 'flex', - alignItems: 'center', - '&:hover, &:focus': { - backgroundColor: theme.palette.background.light, - }, - }, - messageNotificationSide: { - display: 'flex', - flexDirection: 'column', - alignItems: 'center', - marginRight: theme.spacing(2), - }, - messageNotificationBodySide: { - alignItems: 'flex-start', - marginRight: 0, - }, - sendMessageButton: { - margin: theme.spacing(4), - marginTop: theme.spacing(2), - marginBottom: theme.spacing(2), - textTransform: 'none', - }, - sendButtonIcon: { - marginLeft: theme.spacing(2), - }, })); -- GitLab