Skip to content

Commit

Permalink
[ML] Fixes permissions checks for data visualizer create job links (e…
Browse files Browse the repository at this point in the history
…lastic#55431)

* [ML] Fixes permissions checks for data visualizer create job links

* [ML] Edits to permissions check following review

* [ML] Revert unintentional additions
  • Loading branch information
peteharverson committed Jan 22, 2020
1 parent 4d5cd1d commit 00e5070
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import { NavigationMenu } from '../../components/navigation_menu';
import { ML_JOB_FIELD_TYPES } from '../../../../common/constants/field_types';
import { SEARCH_QUERY_LANGUAGE } from '../../../../common/constants/search';
import { isFullLicense } from '../../license/check_license';
import { checkPermission } from '../../privilege/check_privilege';
import { mlNodesAvailable } from '../../ml_nodes_check/check_ml_nodes';
import { FullTimeRangeSelector } from '../../components/full_time_range_selector';
import { mlTimefilterRefresh$ } from '../../services/timefilter_refresh_service';
import { useKibanaContext, SavedSearchQuery } from '../../contexts/kibana';
Expand Down Expand Up @@ -130,9 +132,11 @@ export const Page: FC = () => {

const defaults = getDefaultPageState();

const [showActionsPanel] = useState(
isFullLicense() && currentIndexPattern.timeFieldName !== undefined
);
const showActionsPanel =
isFullLicense() &&
checkPermission('canCreateJob') &&
mlNodesAvailable() &&
currentIndexPattern.timeFieldName !== undefined;

const [searchString, setSearchString] = useState(defaults.searchString);
const [searchQuery, setSearchQuery] = useState(defaults.searchQuery);
Expand Down Expand Up @@ -613,7 +617,9 @@ export const Page: FC = () => {
)}
</EuiPageContentHeader>
</EuiFlexItem>
<EuiFlexItem grow={false} style={{ width: wizardPanelWidth }} />
{showActionsPanel === true && (
<EuiFlexItem grow={false} style={{ width: wizardPanelWidth }} />
)}
</EuiFlexGroup>
<EuiSpacer size="m" />
<EuiPageContentBody>
Expand Down

0 comments on commit 00e5070

Please sign in to comment.