Skip to content

Commit

Permalink
Fixed delete for enablers
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Aug 23, 2021
1 parent c9dc17c commit 72368f4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ui/src/app/metadata/domain/source/component/SourceList.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default function SourceList({ entities, onDelete, onEnable, onChangeGroup
<th className=""><Translate value="label.creation-date">Created Date</Translate></th>
<th className="text-center"><Translate value="label.enabled">Enabled</Translate></th>
{isAdmin && onChangeGroup && <th className=""><Translate value="label.group">Group</Translate></th> }
{onDelete && <th className="w-auto"></th>}
{onDelete && isAdmin && <th className="w-auto"></th>}
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -94,7 +94,7 @@ export default function SourceList({ entities, onDelete, onEnable, onChangeGroup
</GroupsProvider>
</td>
}
{onDelete &&
{onDelete && isAdmin &&
<td className="text-right align-middle">
<OverlayTrigger trigger={source.serviceEnabled ? ['hover', 'focus'] : []} placement="left"
overlay={
Expand Down
5 changes: 3 additions & 2 deletions ui/src/app/metadata/view/MetadataOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { MetadataFilterConfigurationList } from '../domain/filter/component/Meta
import { MetadataFilterTypes } from '../domain/filter';
import { useMetadataSchema } from '../hooks/schema';
import { FilterableProviders } from '../domain/provider';
import { useCanEnable } from '../../core/user/UserContext';
import { useCanEnable, useIsAdmin } from '../../core/user/UserContext';

export function MetadataOptions ({reload}) {

Expand Down Expand Up @@ -53,6 +53,7 @@ export function MetadataOptions ({reload}) {
const enabled = type === 'source' ? metadata.serviceEnabled : metadata.enabled;

const canEnable = useCanEnable();
const isAdmin = useIsAdmin();

return (
<MetadataActions type={type}>
Expand All @@ -77,7 +78,7 @@ export function MetadataOptions ({reload}) {
<FontAwesomeIcon size="lg" icon={enabled ? faToggleOn : faToggleOff} />
</Button>
}
{type === 'source' && remove &&
{type === 'source' && remove && isAdmin &&
<Button
size="sm"
variant={ 'danger' }
Expand Down

0 comments on commit 72368f4

Please sign in to comment.