This is an automated email from the ASF dual-hosted git repository.

tiagobento pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-tools.git


The following commit(s) were added to refs/heads/main by this push:
     new eb39346023f [kie-issues#1755] - Display the correct git URL when 
creating a snippet, gist, or repo in the online editor (#2863)
eb39346023f is described below

commit eb39346023f804a0539f1b18d3e7a22f14b0fdc9
Author: Jason Porter <[email protected]>
AuthorDate: Tue Feb 11 07:48:21 2025 -0700

    [kie-issues#1755] - Display the correct git URL when creating a snippet, 
gist, or repo in the online editor (#2863)
---
 .../editor/Toolbar/GitIntegration/CreateGistOrSnippetModal.tsx | 10 +++++-----
 .../src/editor/Toolbar/GitIntegration/GitIntegrationAlerts.tsx |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git 
a/packages/online-editor/src/editor/Toolbar/GitIntegration/CreateGistOrSnippetModal.tsx
 
b/packages/online-editor/src/editor/Toolbar/GitIntegration/CreateGistOrSnippetModal.tsx
index 42870dea0cc..ada3331c4cd 100644
--- 
a/packages/online-editor/src/editor/Toolbar/GitIntegration/CreateGistOrSnippetModal.tsx
+++ 
b/packages/online-editor/src/editor/Toolbar/GitIntegration/CreateGistOrSnippetModal.tsx
@@ -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 () => {
@@ -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 () => {
@@ -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);
@@ -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,
   ]);
 
diff --git 
a/packages/online-editor/src/editor/Toolbar/GitIntegration/GitIntegrationAlerts.tsx
 
b/packages/online-editor/src/editor/Toolbar/GitIntegration/GitIntegrationAlerts.tsx
index bfdcb4f0ea8..15a1f8b4498 100644
--- 
a/packages/online-editor/src/editor/Toolbar/GitIntegration/GitIntegrationAlerts.tsx
+++ 
b/packages/online-editor/src/editor/Toolbar/GitIntegration/GitIntegrationAlerts.tsx
@@ -225,12 +225,12 @@ export function useGitIntegrationAlerts(workspace: 
ActiveWorkspace) {
 
   const successfullyCreatedGistOrSnippetAlert = useGlobalAlert(
     useCallback(
-      ({ close }) => {
+      ({ close }, staticArgs?: { url: string }) => {
         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"


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to