Return message to use on successful publish

This commit is contained in:
mike cullerton 2022-12-07 14:00:46 -05:00
parent 87e105e189
commit e24ced5c34

View File

@ -21,6 +21,7 @@ import {
ButtonSet, ButtonSet,
Modal, Modal,
FileUploader, FileUploader,
InlineNotification,
Table, Table,
TableHead, TableHead,
TableHeader, TableHeader,
@ -60,6 +61,7 @@ export default function ProcessModelShow() {
const [filesToUpload, setFilesToUpload] = useState<any>(null); const [filesToUpload, setFilesToUpload] = useState<any>(null);
const [showFileUploadModal, setShowFileUploadModal] = const [showFileUploadModal, setShowFileUploadModal] =
useState<boolean>(false); useState<boolean>(false);
const [processModelPublished, setProcessModelPublished] = useState<string | null>(null);
const navigate = useNavigate(); const navigate = useNavigate();
const { targetUris } = useUriListForPermissions(); const { targetUris } = useUriListForPermissions();
@ -203,10 +205,14 @@ export default function ProcessModelShow() {
}); });
}; };
const postPublish = (value: any) => {
setProcessModelPublished(value);
};
const publishProcessModel = () => { const publishProcessModel = () => {
HttpService.makeCallToBackend({ HttpService.makeCallToBackend({
path: `/process-models/${modifiedProcessModelId}/publish`, path: `/process-models/${modifiedProcessModelId}/publish`,
successCallback: navigateToProcessModels, successCallback: postPublish,
httpMethod: 'PUT', httpMethod: 'PUT',
}); });
}; };
@ -518,10 +524,28 @@ export default function ProcessModelShow() {
return null; return null;
}; };
const processModelPublishMessage = () => {
console.log(`processModelPublishMessage: `);
if (processModelPublished) {
return (
<>
<InlineNotification
title={`Model Published:`}
subtitle={`Your model was published`}
kind="success"
/>
<br />
</>
);
}
return null;
};
if (processModel) { if (processModel) {
return ( return (
<> <>
{fileUploadModal()} {fileUploadModal()}
{processModelPublishMessage()}
<ProcessBreadcrumb <ProcessBreadcrumb
hotCrumbs={[ hotCrumbs={[
['Process Groups', '/admin'], ['Process Groups', '/admin'],