Skip to content

Commit

Permalink
disable super select if not permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
Esteban Beltran committed May 5, 2022
1 parent b2890b1 commit 248092a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ export const CaseViewActivity = ({
</EuiFlexItem>
<EuiFlexItem grow={2}>
<SeveritySidebarSelector
isDisabled={!userCanCrud}
isLoading={isLoading}
selectedSeverity={caseData.severity}
onSeverityChange={onUpdateSeverity}
Expand Down
3 changes: 3 additions & 0 deletions x-pack/plugins/cases/public/components/severity/selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,21 @@ interface Props {
selectedSeverity: CaseSeverity;
onSeverityChange: (status: CaseSeverity) => void;
isLoading: boolean;
isDisabled: boolean;
}

export const SeveritySelector: React.FC<Props> = ({
selectedSeverity,
onSeverityChange,
isLoading,
isDisabled,
}) => {
const caseSeverities = Object.keys(severities) as CaseSeverity[];
const options: Array<EuiSuperSelectOption<CaseSeverity>> = caseSeverities.map((severity) => {
const severityData = severities[severity];
return {
value: severity,
disabled: isDisabled,
inputDisplay: (
<EuiFlexGroup
gutterSize="xs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ interface Props {
selectedSeverity: CaseSeverity;
onSeverityChange: (status: CaseSeverity) => void;
isLoading: boolean;
isDisabled: boolean;
}

export const SeveritySidebarSelector: React.FC<Props> = ({
selectedSeverity,
onSeverityChange,
isLoading,
isDisabled,
}) => {
return (
<EuiFlexItem grow={false}>
Expand All @@ -32,6 +34,7 @@ export const SeveritySidebarSelector: React.FC<Props> = ({
isLoading={isLoading}
selectedSeverity={selectedSeverity}
onSeverityChange={onSeverityChange}
isDisabled={isDisabled}
/>
<EuiSpacer size="m" />
</EuiFlexItem>
Expand Down

0 comments on commit 248092a

Please sign in to comment.