-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: adding post import sagas for application
- Loading branch information
Showing
6 changed files
with
83 additions
and
58 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
app/client/src/git-artifact-helpers/application/sagas/applicationImportFromGitSaga.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { toast } from "@appsmith/ads"; | ||
import { createMessage, IMPORT_APP_SUCCESSFUL } from "ee/constants/messages"; | ||
import { builderURL } from "ee/RouteBuilder"; | ||
import { showReconnectDatasourceModal } from "ee/actions/applicationActions"; | ||
import type { ApplicationResponsePayload } from "ee/api/ApplicationApi"; | ||
import type { GitImportSuccessPayload } from "git/store/actions/gitImportActions"; | ||
import type { GitArtifactPayloadAction } from "git/store/types"; | ||
import { put } from "redux-saga/effects"; | ||
import history from "utils/history"; | ||
|
||
export default function* applicationImportFromGitSaga( | ||
action: GitArtifactPayloadAction<GitImportSuccessPayload>, | ||
) { | ||
const { responseData } = action.payload; | ||
const { isPartialImport, unConfiguredDatasourceList } = responseData; | ||
|
||
const application = | ||
(responseData.application as ApplicationResponsePayload) ?? null; | ||
|
||
if (!application) return; | ||
|
||
// there is configuration-missing datasources | ||
if (isPartialImport) { | ||
yield put( | ||
showReconnectDatasourceModal({ | ||
application: application as ApplicationResponsePayload, | ||
unConfiguredDatasourceList: unConfiguredDatasourceList ?? [], | ||
workspaceId: application?.workspaceId ?? "", | ||
}), | ||
); | ||
} else { | ||
let basePageId = ""; | ||
|
||
if (application.pages && application.pages.length > 0) { | ||
const defaultPage = application.pages.find( | ||
(eachPage) => !!eachPage.isDefault, | ||
); | ||
|
||
basePageId = defaultPage ? defaultPage.baseId : ""; | ||
} | ||
|
||
const branch = application?.gitApplicationMetadata?.branchName; | ||
|
||
const pageURL = builderURL({ | ||
basePageId, | ||
branch, | ||
}); | ||
|
||
history.push(pageURL); | ||
toast.show(createMessage(IMPORT_APP_SUCCESSFUL), { | ||
kind: "success", | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters