mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
# Backport This will backport the following commits from `main` to `8.10`: - [[ML] Fixing blank modal when deleting job (#164815)](https://github.com/elastic/kibana/pull/164815) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"James Gowdy","email":"jgowdy@elastic.co"},"sourceCommit":{"committedDate":"2023-08-25T17:39:19Z","message":"[ML] Fixing blank modal when deleting job (#164815)\n\nFixes https://github.com/elastic/kibana/issues/160854\r\n\r\nWhen checking the space information for the selected jobs, the modal now\r\nlooks like this:\r\n\r\n\r\n","sha":"b47c3e9387654bddd61eab802053725557c0c609","branchLabelMapping":{"^v8.11.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix",":ml","Feature:Anomaly Detection","v8.10.0","v8.11.0"],"number":164815,"url":"https://github.com/elastic/kibana/pull/164815","mergeCommit":{"message":"[ML] Fixing blank modal when deleting job (#164815)\n\nFixes https://github.com/elastic/kibana/issues/160854\r\n\r\nWhen checking the space information for the selected jobs, the modal now\r\nlooks like this:\r\n\r\n\r\n","sha":"b47c3e9387654bddd61eab802053725557c0c609"}},"sourceBranch":"main","suggestedTargetBranches":["8.10"],"targetPullRequestStates":[{"branch":"8.10","label":"v8.10.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.11.0","labelRegex":"^v8.11.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/164815","number":164815,"mergeCommit":{"message":"[ML] Fixing blank modal when deleting job (#164815)\n\nFixes https://github.com/elastic/kibana/issues/160854\r\n\r\nWhen checking the space information for the selected jobs, the modal now\r\nlooks like this:\r\n\r\n\r\n","sha":"b47c3e9387654bddd61eab802053725557c0c609"}}]}] BACKPORT--> Co-authored-by: James Gowdy <jgowdy@elastic.co>
This commit is contained in:
parent
4f85aa3cdc
commit
52c006b577
1 changed files with 63 additions and 60 deletions
|
@ -18,7 +18,6 @@ import {
|
|||
EuiModalBody,
|
||||
EuiModalFooter,
|
||||
EuiButton,
|
||||
EuiLoadingSpinner,
|
||||
EuiText,
|
||||
EuiSpacer,
|
||||
} from '@elastic/eui';
|
||||
|
@ -273,11 +272,11 @@ export const DeleteSpaceAwareItemCheckModal: FC<Props> = ({
|
|||
);
|
||||
setButtonContent(buttonText);
|
||||
setModalContent(modalText);
|
||||
setIsLoading(false);
|
||||
});
|
||||
if (typeof setDidUntag === 'function') {
|
||||
setDidUntag(false);
|
||||
}
|
||||
setIsLoading(false);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [hasManagedJob]);
|
||||
|
||||
|
@ -324,68 +323,72 @@ export const DeleteSpaceAwareItemCheckModal: FC<Props> = ({
|
|||
|
||||
return (
|
||||
<EuiModal onClose={onCloseCallback} data-test-subj="mlDeleteSpaceAwareItemCheckModalOverlay">
|
||||
{isLoading === true && (
|
||||
<>
|
||||
<EuiModalBody>
|
||||
<EuiFlexGroup justifyContent="spaceAround">
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiLoadingSpinner size="xl" />
|
||||
</EuiFlexItem>
|
||||
</EuiFlexGroup>
|
||||
</EuiModalBody>
|
||||
</>
|
||||
)}
|
||||
{isLoading === false && (
|
||||
<>
|
||||
<EuiModalHeader>
|
||||
<EuiModalHeaderTitle>
|
||||
<FormattedMessage
|
||||
id="xpack.ml.deleteSpaceAwareItemCheckModal.modalTitle"
|
||||
defaultMessage="Checking space permissions"
|
||||
/>
|
||||
</EuiModalHeaderTitle>
|
||||
</EuiModalHeader>
|
||||
<>
|
||||
<EuiModalHeader>
|
||||
<EuiModalHeaderTitle>
|
||||
<FormattedMessage
|
||||
id="xpack.ml.deleteSpaceAwareItemCheckModal.modalTitle"
|
||||
defaultMessage="Checking space permissions"
|
||||
/>
|
||||
</EuiModalHeaderTitle>
|
||||
</EuiModalHeader>
|
||||
|
||||
<EuiModalBody>{modalContent}</EuiModalBody>
|
||||
{isLoading === false ? (
|
||||
<>
|
||||
<EuiModalBody>{modalContent}</EuiModalBody>
|
||||
|
||||
<EuiModalFooter>
|
||||
<EuiFlexGroup justifyContent="spaceBetween">
|
||||
<EuiFlexItem grow={false}>
|
||||
{!hasUntagged &&
|
||||
itemCheckRespSummary?.canTakeAnyAction &&
|
||||
itemCheckRespSummary?.canRemoveFromSpace &&
|
||||
itemCheckRespSummary?.canDelete && (
|
||||
<EuiButtonEmpty
|
||||
isLoading={isUntagging}
|
||||
color="primary"
|
||||
size="s"
|
||||
onClick={onUntagClick}
|
||||
>
|
||||
{mlSavedObjectType === 'trained-model'
|
||||
? shouldUnTagModelLabel
|
||||
: shouldUnTagJobLabel}
|
||||
</EuiButtonEmpty>
|
||||
)}
|
||||
</EuiFlexItem>
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiButton
|
||||
size="s"
|
||||
onClick={
|
||||
<EuiModalFooter>
|
||||
<EuiFlexGroup justifyContent="spaceBetween">
|
||||
<EuiFlexItem grow={false}>
|
||||
{!hasUntagged &&
|
||||
itemCheckRespSummary?.canTakeAnyAction &&
|
||||
itemCheckRespSummary?.canRemoveFromSpace &&
|
||||
!itemCheckRespSummary?.canDelete
|
||||
? onUntagClick
|
||||
: onClick
|
||||
}
|
||||
fill
|
||||
>
|
||||
{buttonContent}
|
||||
</EuiButton>
|
||||
</EuiFlexItem>
|
||||
</EuiFlexGroup>
|
||||
</EuiModalFooter>
|
||||
</>
|
||||
)}
|
||||
itemCheckRespSummary?.canDelete && (
|
||||
<EuiButtonEmpty
|
||||
isLoading={isUntagging}
|
||||
color="primary"
|
||||
size="s"
|
||||
onClick={onUntagClick}
|
||||
>
|
||||
{mlSavedObjectType === 'trained-model'
|
||||
? shouldUnTagModelLabel
|
||||
: shouldUnTagJobLabel}
|
||||
</EuiButtonEmpty>
|
||||
)}
|
||||
</EuiFlexItem>
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiButton
|
||||
size="s"
|
||||
onClick={
|
||||
itemCheckRespSummary?.canTakeAnyAction &&
|
||||
itemCheckRespSummary?.canRemoveFromSpace &&
|
||||
!itemCheckRespSummary?.canDelete
|
||||
? onUntagClick
|
||||
: onClick
|
||||
}
|
||||
fill
|
||||
>
|
||||
{buttonContent}
|
||||
</EuiButton>
|
||||
</EuiFlexItem>
|
||||
</EuiFlexGroup>
|
||||
</EuiModalFooter>
|
||||
</>
|
||||
) : (
|
||||
<EuiModalBody>
|
||||
<EuiText>
|
||||
<FormattedMessage
|
||||
id="xpack.ml.deleteSpaceAwareItemCheckModal.modalDesc"
|
||||
defaultMessage="Checking to see whether the {jobCount, plural, one {job} other {jobs}} can be deleted."
|
||||
values={{
|
||||
jobCount: ids.length,
|
||||
}}
|
||||
/>
|
||||
</EuiText>
|
||||
<EuiSpacer size="s" />
|
||||
</EuiModalBody>
|
||||
)}
|
||||
</>
|
||||
</EuiModal>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue