mirror of
https://github.com/grafana/grafana.git
synced 2024-11-29 04:04:00 -06:00
permissions sorting fixed + icon same size as avatrs
This commit is contained in:
parent
77b8ccd7f5
commit
c431875f28
@ -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 prepareItem(item, dashboardId, isFolder, isInRoot);
|
||||
});
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user