Commit c431875f by Patrick O'Carroll

permissions sorting fixed + icon same size as avatrs

parent 77b8ccd7
......@@ -13,7 +13,7 @@ export default class DisabledPermissionListItem extends Component<IProps, any> {
return (
<tr className="gf-form-disabled">
<td style={{ width: '1%' }}>
<i style={{ width: '25px', fontSize: '1.5rem' }} className="gicon gicon-shield" />
<i style={{ width: '25px', height: '25px' }} className="gicon gicon-shield" />
</td>
<td style={{ width: '90%' }}>
{item.name}
......
......@@ -15,10 +15,10 @@ function ItemAvatar({ item }) {
return <img className="filter-table__avatar" src={item.teamAvatarUrl} />;
}
if (item.role === 'Editor') {
return <i style={{ width: '25px', fontSize: '1.5rem' }} className="gicon gicon-editor" />;
return <i style={{ width: '25px', height: '25px' }} className="gicon gicon-editor" />;
}
return <i style={{ width: '25px', fontSize: '1.5rem' }} className="gicon gicon-viewer" />;
return <i style={{ width: '25px', height: '25px' }} className="gicon gicon-viewer" />;
}
function ItemDescription({ item }) {
......
......@@ -155,6 +155,8 @@ export const PermissionsStore = types
try {
yield updateItems(self, updatedItems);
self.items.push(newItem);
let sortedItems = self.items.sort((a, b) => b.sortRank - a.sortRank || a.name.localeCompare(b.name));
self.items = sortedItems;
resetNewTypeInternal();
} catch {}
yield Promise.resolve();
......@@ -214,9 +216,11 @@ const updateItems = (self, items) => {
};
const prepareServerResponse = (response, dashboardId: number, isFolder: boolean, isInRoot: boolean) => {
return response.map(item => {
return response
.map(item => {
return prepareItem(item, dashboardId, isFolder, isInRoot);
});
})
.sort((a, b) => b.sortRank - a.sortRank || a.name.localeCompare(b.name));
};
const prepareItem = (item, dashboardId: number, isFolder: boolean, isInRoot: boolean) => {
......@@ -233,7 +237,7 @@ const prepareItem = (item, dashboardId: number, isFolder: boolean, isInRoot: boo
item.icon = 'fa fa-fw fa-street-view';
item.name = item.role;
item.sortRank = 30;
if (item.role === 'Viewer') {
if (item.role === 'Editor') {
item.sortRank += 1;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment