-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ms2/share modal improvements 2 #446
Conversation
…for generateSharedViewerUrl
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…abs/proceed into ms2/share-modal-improvements-2
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Successfully created Preview Deployment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beside minor nit-picks lgtm
), | ||
onSuccess: (url) => setEmbeddingUrl(url), | ||
app, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit-Pick:
Really like the easy way to add some feedback to the user in case of an error with your wrapServerCall
, I don't see a reason why one should not use it here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get what you mean, are you saying that I should wrap setEmbeddingUrl
in a wrapSeverCall?
return url; | ||
}, | ||
onSuccess: (url) => setEmbeddingUrl(url), | ||
app, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
await wrapServerCall({ | ||
fn: () => | ||
updateProcessGuestAccessRights( | ||
processId, | ||
{ allowIframeTimestamp: 0 }, | ||
environment.spaceId, | ||
), | ||
onSuccess: () => setEmbeddingUrl(''), | ||
app, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here
wrapServerCall({ | ||
fn: () => | ||
generateSharedViewerUrl( | ||
{ processId, timestamp: shareTimestamp }, | ||
selectedVersionId || undefined, | ||
), | ||
onSuccess: (url) => setShareLink(url), | ||
app, | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here
await wrapServerCall({ | ||
fn: async () => { | ||
const url = generateSharedViewerUrl( | ||
{ processId: processId, timestamp }, | ||
// if there is a specific process version open in the modeler then link to that version (otherwise latest will be shown) | ||
selectedVersionId || undefined, | ||
); | ||
if (isUserErrorResponse(url)) return url; | ||
|
||
const updateRightsResult = await updateProcessGuestAccessRights( | ||
processId, | ||
{ | ||
sharedAs: 'public', | ||
shareTimestamp: timestamp, | ||
}, | ||
environment.spaceId, | ||
); | ||
if (isUserErrorResponse(updateRightsResult)) return updateRightsResult; | ||
|
||
return url; | ||
}, | ||
onSuccess: (url) => { | ||
setShareLink(url); | ||
app.message.success('Process shared'); | ||
}, | ||
app, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here
await wrapServerCall({ | ||
fn: async () => { | ||
const url = await generateSharedViewerUrl({ | ||
processId, | ||
timestamp, | ||
}); | ||
if (isUserErrorResponse(url)) return url; | ||
|
||
link = await generateSharedViewerUrl({ processId, timestamp }); | ||
await updateProcessGuestAccessRights( | ||
processId, | ||
{ | ||
sharedAs: sharedAs, | ||
shareTimestamp: timestamp, | ||
}, | ||
environment.spaceId, | ||
); | ||
} catch (err) { | ||
message.error('Failed to generate the sharing url for the process.'); | ||
return; | ||
} | ||
const accessUpdateResult = await updateProcessGuestAccessRights( | ||
processId, | ||
{ | ||
sharedAs: 'public', | ||
allowIframeTimestamp: timestamp, | ||
}, | ||
environment.spaceId, | ||
); | ||
if (isUserErrorResponse(accessUpdateResult)) return accessUpdateResult; | ||
|
||
const shareObject = { | ||
title: `${processData?.name} | PROCEED`, | ||
text: 'Here is a shared process for you', | ||
url: `${link}`, | ||
}; | ||
return url; | ||
}, | ||
onSuccess: (url) => (url = url), | ||
app, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here
return wrapServerCall({ | ||
fn: () => | ||
generateSharedViewerUrl({ processId, timestamp: 0 }, selectedVersionId || undefined), | ||
onSuccess: (url) => window.open(url, `${processId}-${selectedVersionId}-tab`), | ||
app, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here
await wrapServerCall({ | ||
fn: () => | ||
generateSharedViewerUrl( | ||
{ processId: definitionId, timestamp: 0 }, | ||
processVersion || undefined, | ||
selectedOptions as string[], | ||
), | ||
onSuccess: (url) => | ||
router.push(new URL(url, `${definitionId}-${processVersion}-tab`).toString()), | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here
@@ -1,98 +1,109 @@ | |||
'use client'; | |||
import { useEffect, useState } from 'react'; | |||
import { CopyOutlined } from '@ant-design/icons'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit-Pick:
Replace with
import { IoMdCopy } from "react-icons/io";
to align with new Buttons
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will do this in the next PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit-Pick:
Replace the export with download to align with the new buttons
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will do this in the next PR
Summary
wrapServerCall
forgenerateSharedViewerUrl