Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yashwanth individual permission change show #2868

Merged
18 changes: 15 additions & 3 deletions src/components/PermissionsManagement/PermissionChangeLogTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ function PermissionChangeLogTable({ changeLogs, darkMode }) {
}
};

const formatName = name => {
if (name.startsWith('INDIVIDUAL:')) {
return name.replace('INDIVIDUAL:', '').trim();
}
return name;
};

const renderPageNumbers = () => {
const pageNumbers = [];
const maxPageNumbersToShow = 5;
Expand Down Expand Up @@ -95,7 +102,7 @@ function PermissionChangeLogTable({ changeLogs, darkMode }) {
<th className={`permission-change-log-table--header${addDark}`}>
Log Date and Time (PST)
</th>
<th className={`permission-change-log-table--header${addDark}`}>Role Name</th>
<th className={`permission-change-log-table--header${addDark}`}>Name</th>
<th className={`permission-change-log-table--header${addDark}`}>Permissions</th>
<th className={`permission-change-log-table--header${addDark}`}>Permissions Added</th>
<th className={`permission-change-log-table--header${addDark}`}>
Expand All @@ -111,8 +118,13 @@ function PermissionChangeLogTable({ changeLogs, darkMode }) {
<td className={`permission-change-log-table--cell ${bgYinmnBlue}`}>{`${formatDate(
log.logDateTime,
)} ${formattedAmPmTime(log.logDateTime)}`}</td>
<td className={`permission-change-log-table--cell ${bgYinmnBlue}`}>
{log.roleName}
<td
className={`permission-change-log-table--cell ${bgYinmnBlue}`}
style={{
fontWeight: log.name.startsWith('INDIVIDUAL:') ? 'bold' : 'normal',
}}
>
{formatName(log.name)}
</td>
<td className={`permission-change-log-table--cell permissions ${bgYinmnBlue}`}>
{renderPermissions(log.permissions, log._id)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ function PermissionsManagement({ roles, auth, getUserRole, userProfile, darkMode

getInfoCollections();
getUserRole(auth?.user.userid);

const getChangeLogs = async () => {
try {
const response = await axios.get(ENDPOINTS.PERMISSION_CHANGE_LOGS(auth?.user.userid));
Expand Down Expand Up @@ -243,7 +242,7 @@ function PermissionsManagement({ roles, auth, getUserRole, userProfile, darkMode
</div>
{loading && <p className="loading-message">Loading...</p>}
{changeLogs?.length > 0 && (
<PermissionChangeLogTable changeLogs={changeLogs.slice().reverse()} darkMode={darkMode} />
<PermissionChangeLogTable changeLogs={changeLogs} darkMode={darkMode} />
nathanah marked this conversation as resolved.
Show resolved Hide resolved
)}
<br />
<br />
Expand Down
Loading