[FLASK] Fix an issue with updating snaps that have caveat permissions (#16473)

feature/default_network_editable
Frederik Bolding 2 years ago committed by GitHub
parent b2e621b5f9
commit 8f30e03613
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 38
      ui/components/app/flask/update-snap-permission-list/update-snap-permission-list.js

@ -14,15 +14,17 @@ export default function UpdateSnapPermissionList({
const t = useI18nContext(); const t = useI18nContext();
const ApprovedPermissions = () => { const ApprovedPermissions = () => {
return Object.keys(approvedPermissions).map((approvedPermission) => { return Object.entries(approvedPermissions).map(
([permissionName, permissionValue]) => {
const { label, rightIcon } = getPermissionDescription( const { label, rightIcon } = getPermissionDescription(
t, t,
approvedPermission, permissionName,
permissionValue,
); );
const { date } = approvedPermissions[approvedPermission]; const { date } = permissionValue;
const formattedDate = formatDate(date, 'yyyy-MM-dd'); const formattedDate = formatDate(date, 'yyyy-MM-dd');
return ( return (
<div className="approved-permission" key={approvedPermission}> <div className="approved-permission" key={permissionName}>
<i className="fas fa-check" /> <i className="fas fa-check" />
<div className="permission-description"> <div className="permission-description">
{label} {label}
@ -37,17 +39,20 @@ export default function UpdateSnapPermissionList({
{rightIcon && <i className={rightIcon} />} {rightIcon && <i className={rightIcon} />}
</div> </div>
); );
}); },
);
}; };
const RevokedPermissions = () => { const RevokedPermissions = () => {
return Object.keys(revokedPermissions).map((revokedPermission) => { return Object.entries(revokedPermissions).map(
([permissionName, permissionValue]) => {
const { label, rightIcon } = getPermissionDescription( const { label, rightIcon } = getPermissionDescription(
t, t,
revokedPermission, permissionName,
permissionValue,
); );
return ( return (
<div className="revoked-permission" key={revokedPermission}> <div className="revoked-permission" key={permissionName}>
<i className="fas fa-x" /> <i className="fas fa-x" />
<div className="permission-description"> <div className="permission-description">
{label} {label}
@ -62,14 +67,20 @@ export default function UpdateSnapPermissionList({
{rightIcon && <i className={rightIcon} />} {rightIcon && <i className={rightIcon} />}
</div> </div>
); );
}); },
);
}; };
const NewPermissions = () => { const NewPermissions = () => {
return Object.keys(newPermissions).map((newPermission) => { return Object.entries(newPermissions).map(
const { label, rightIcon } = getPermissionDescription(t, newPermission); ([permissionName, permissionValue]) => {
const { label, rightIcon } = getPermissionDescription(
t,
permissionName,
permissionValue,
);
return ( return (
<div className="new-permission" key={newPermission}> <div className="new-permission" key={permissionName}>
<i className="fas fa-arrow-right" /> <i className="fas fa-arrow-right" />
<div className="permission-description"> <div className="permission-description">
{label} {label}
@ -84,7 +95,8 @@ export default function UpdateSnapPermissionList({
{rightIcon && <i className={rightIcon} />} {rightIcon && <i className={rightIcon} />}
</div> </div>
); );
}); },
);
}; };
return ( return (

Loading…
Cancel
Save