Skip to content
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

Merged
merged 14 commits into from
Feb 6, 2025
Merged

Conversation

FelipeTrost
Copy link
Contributor

Summary

  • Share modal embed option now allows selecting a process version to embed.
  • Enforced in backend: embed only allows process versions
  • Refactor: use wrapServerCall 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.

This comment has been minimized.

Copy link

CLOUDRUN ACTIONS

✅ Successfully created Preview Deployment.

https://pr-446---ms-server-staging-c4f6qdpj7q-ew.a.run.app

Copy link
Contributor

@MaxiLein MaxiLein left a 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,
});
Copy link
Contributor

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.

Copy link
Contributor Author

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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Comment on lines +97 to +106
await wrapServerCall({
fn: () =>
updateProcessGuestAccessRights(
processId,
{ allowIframeTimestamp: 0 },
environment.spaceId,
),
onSuccess: () => setEmbeddingUrl(''),
app,
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here

Comment on lines +51 to 60
wrapServerCall({
fn: () =>
generateSharedViewerUrl(
{ processId, timestamp: shareTimestamp },
selectedVersionId || undefined,
),
onSuccess: (url) => setShareLink(url),
app,
});
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here

Comment on lines +99 to +124
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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here

Comment on lines +117 to +139
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,
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here

Comment on lines +201 to +206
return wrapServerCall({
fn: () =>
generateSharedViewerUrl({ processId, timestamp: 0 }, selectedVersionId || undefined),
onSuccess: (url) => window.open(url, `${processId}-${selectedVersionId}-tab`),
app,
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here

Comment on lines +143 to +152
await wrapServerCall({
fn: () =>
generateSharedViewerUrl(
{ processId: definitionId, timestamp: 0 },
processVersion || undefined,
selectedOptions as string[],
),
onSuccess: (url) =>
router.push(new URL(url, `${definitionId}-${processVersion}-tab`).toString()),
});
Copy link
Contributor

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';
Copy link
Contributor

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

Copy link
Contributor Author

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

Copy link
Contributor

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

Copy link
Contributor Author

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

@FelipeTrost FelipeTrost merged commit da088eb into main Feb 6, 2025
15 checks passed
@FelipeTrost FelipeTrost deleted the ms2/share-modal-improvements-2 branch February 6, 2025 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants