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 488e35cf507 kie-issues#129: Import private repository into sandbox via
chrome-extension [backend-part] (#2087)
488e35cf507 is described below
commit 488e35cf507d7aad52294f518b648c6b8c7595c5
Author: Jozef Marko <[email protected]>
AuthorDate: Wed Jan 3 18:27:35 2024 +0100
kie-issues#129: Import private repository into sandbox via chrome-extension
[backend-part] (#2087)
---
.../src/importFromUrl/NewWorkspaceFromUrlPage.tsx | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git
a/packages/online-editor/src/importFromUrl/NewWorkspaceFromUrlPage.tsx
b/packages/online-editor/src/importFromUrl/NewWorkspaceFromUrlPage.tsx
index 95228f03ba7..de3fd58c0d7 100644
--- a/packages/online-editor/src/importFromUrl/NewWorkspaceFromUrlPage.tsx
+++ b/packages/online-editor/src/importFromUrl/NewWorkspaceFromUrlPage.tsx
@@ -30,7 +30,6 @@ import { useRoutes } from "../navigation/Hooks";
import { QueryParams } from "../navigation/Routes";
import { OnlineEditorPage } from "../pageTemplate/OnlineEditorPage";
import { useQueryParam, useQueryParams } from
"../queryParams/QueryParamsContext";
-import { useSettingsDispatch } from "../settings/SettingsContext";
import {
ImportableUrl,
isPotentiallyGit,
@@ -187,7 +186,7 @@ export function NewWorkspaceFromUrlPage() {
// Startup the page. Only import if those are set.
useEffect(() => {
- if (!selectedGitRefName || !queryParamUrl) {
+ if (!queryParamUrl) {
return;
}
@@ -198,12 +197,19 @@ export function NewWorkspaceFromUrlPage() {
urlDomain: new URL(queryParamUrl).hostname,
});
+ let newQueryParams = queryParams;
+ if (authSession?.id && AUTH_SESSION_NONE.id !== authSession?.id) {
+ newQueryParams = newQueryParams.with(QueryParams.AUTH_SESSION_ID,
authSession?.id);
+ } else if (compatible.length > 0) {
+ newQueryParams = newQueryParams.with(QueryParams.AUTH_SESSION_ID,
compatible[0].id);
+ }
+
+ if (selectedGitRefName) {
+ newQueryParams = newQueryParams.with(QueryParams.BRANCH,
selectedGitRefName);
+ }
history.replace({
pathname: routes.import.path({}),
- search: queryParams
- .with(QueryParams.BRANCH, selectedGitRefName)
- .with(QueryParams.AUTH_SESSION_ID, authSession?.id ?? compatible[0].id)
- .toString(),
+ search: newQueryParams.toString(),
});
}, [
authProviders,
@@ -416,13 +422,13 @@ export function NewWorkspaceFromUrlPage() {
]);
useEffect(() => {
- if (!queryParamUrl) {
+ if (!queryParamUrl || (importingError && queryParamAuthSessionId)) {
history.replace({
pathname: routes.import.path({}),
search: queryParams.with(QueryParams.CONFIRM, "true").toString(),
});
}
- }, [history, queryParamUrl, queryParams, routes.import]);
+ }, [history, importingError, queryParamUrl, queryParams,
queryParamAuthSessionId, routes.import]);
useEffect(() => {
if ((!queryParamBranch || !queryParamAuthSessionId) && selectedGitRefName)
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]