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

[kie-issues#1755] - Display the correct git URL when creating a snippet, gist, or repo in the online editor #2863

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const CreateGistOrSnippetModal = (props: {
const [isGistOrSnippetLoading, setGistOrSnippetLoading] = useState(false);

const {
alerts: { successfullyUpdatedGistOrSnippetAlert, errorAlert },
alerts: { successfullyCreatedGistOrSnippetAlert, errorAlert },
} = useGitIntegration();

const createGitHubGist: () => Promise<CreateGistOrSnippetResponse> = useCallback(async () => {
Expand Down Expand Up @@ -132,7 +132,7 @@ If you are, it means that creating this Snippet failed and it can safely be dele
return (e.name = "https" && e.href.startsWith("https"));
})[0].href;

return { cloneUrl, htmlUrl: json.links.html };
return { cloneUrl, htmlUrl: json.links.html.href };
}, [bitbucketClient, env.KIE_SANDBOX_APP_NAME, isPrivate, props.workspace.name, selectedOrganization]);

const createGistOrSnippet = useCallback(async () => {
Expand Down Expand Up @@ -214,8 +214,8 @@ If you are, it means that creating this Snippet failed and it can safely be dele
});

props.onClose();
successfullyUpdatedGistOrSnippetAlert.show({ url: gistOrSnippet.cloneUrl });
props.onSuccess?.({ url: gistOrSnippet.cloneUrl });
props.onSuccess?.({ url: gistOrSnippet.htmlUrl });
successfullyCreatedGistOrSnippetAlert.show({ url: gistOrSnippet.htmlUrl });
return;
} catch (err) {
setError(err);
Expand All @@ -233,7 +233,7 @@ If you are, it means that creating this Snippet failed and it can safely be dele
workspaces,
props,
gitConfig,
successfullyUpdatedGistOrSnippetAlert,
successfullyCreatedGistOrSnippetAlert,
errorAlert,
]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,12 @@ export function useGitIntegrationAlerts(workspace: ActiveWorkspace) {

const successfullyCreatedGistOrSnippetAlert = useGlobalAlert(
useCallback(
({ close }) => {
({ close }, staticArgs?: { url: string }) => {
Copy link
Member

Choose a reason for hiding this comment

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

Could you add this to all gist related alerts here?

if (!isGistLikeWorkspaceKind(workspace.descriptor.origin.kind)) {
return <></>;
}

const gistOrSnippetUrl = workspace.descriptor.origin.url;
const gistOrSnippetUrl = staticArgs?.url || workspace.descriptor.origin.url;
return (
<Alert
variant="success"
Expand Down
Loading