chore: reverted consolidated api (#30314)
## Description Reverted consolidated api changes and also some CE related changes to make it compatible with EE. #### PR fixes following issue(s) Reverts #29650 & #29939 #### Type of change - Chore (housekeeping or task changes that don't impact user perception) > > > ## Testing #### How Has This Been Tested? - [ ] Manual - [ ] JUnit - [ ] Jest - [x ] Cypress > > #### Test Plan > Add Testsmith test cases links that relate to this PR > > #### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) > > > ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Enhanced the reliability and efficiency of Cypress e2e tests by adjusting wait conditions and assertions. - Simplified network request handling across various test cases. - Updated test logic to align with changes in application data structure and network requests. - **Tests** - Improved test stability for application import/export, Git sync, page load behavior, and widget interactions. - Refined mobile responsiveness tests to accurately validate layout conversions and autofill behaviors. - **Chores** - Removed deprecated feature flags and code related to consolidated page load functionality. - Cleaned up unused parameters and simplified action payloads in Redux actions. - **Documentation** - Updated comments for clarity in test specifications. - **Style** - Adjusted code styling for consistency across test suites. - **Bug Fixes** - Fixed data retrieval logic in tests to ensure correct data extraction from API responses. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
parent
cb37369f45
commit
8bb61d996a
|
|
@ -136,8 +136,8 @@ describe(
|
|||
}
|
||||
const importedApp = interception.response.body.data.application;
|
||||
const appSlug = importedApp.slug;
|
||||
cy.wait("@getConsolidatedData").then((interception) => {
|
||||
const pages = interception.response.body.data.pages.data.pages;
|
||||
cy.wait("@getPagesForCreateApp").then((interception) => {
|
||||
const pages = interception.response.body.data.pages;
|
||||
let defaultPage = pages.find(
|
||||
(eachPage) => !!eachPage.isDefault,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ describe(
|
|||
},
|
||||
);
|
||||
EditorNavigation.SelectEntityByName("Page1", EntityType.Page);
|
||||
cy.wait("@getConsolidatedData");
|
||||
cy.wait("@getPage");
|
||||
// verify text in the text widget
|
||||
|
||||
agHelper.AssertContains(
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ describe(
|
|||
_.deployMode.NavigateBacktoEditor();
|
||||
cy.wait(2000);
|
||||
cy.visit(currentUrl, { timeout: 60000 });
|
||||
cy.wait("@getConsolidatedData").should(
|
||||
cy.wait("@getPagesForViewApp").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ describe("Page Load tests", { tags: ["@tag.IDE"] }, () => {
|
|||
"This is Page 2",
|
||||
);
|
||||
// Test after reload
|
||||
agHelper.RefreshPage("getConsolidatedData");
|
||||
agHelper.RefreshPage("viewPage");
|
||||
// Assert active page tab
|
||||
cy.get(".t--page-switch-tab")
|
||||
.contains("Page2")
|
||||
|
|
|
|||
|
|
@ -43,10 +43,10 @@ describe(
|
|||
.its("response.body.responseMeta.status")
|
||||
.should("eq", 200);
|
||||
// check that forked application has same dsl
|
||||
cy.get("@getConsolidatedData")
|
||||
cy.get("@getPage")
|
||||
.its("response.body.data")
|
||||
.then((data) => {
|
||||
forkedApplicationDsl = data.pageWithMigratedDsl.data.layouts[0].dsl;
|
||||
forkedApplicationDsl = data.layouts[0].dsl;
|
||||
expect(JSON.stringify(forkedApplicationDsl)).to.contain(
|
||||
JSON.stringify(parentApplicationDsl),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ describe(
|
|||
.should("eq", 200);
|
||||
cy.wait("@getWorkspace");
|
||||
// check that forked application has same dsl
|
||||
cy.get("@getConsolidatedData").then((httpResponse) => {
|
||||
const data = httpResponse.response.body.data?.pageWithMigratedDsl?.data;
|
||||
cy.get("@getPage").then((httpResponse) => {
|
||||
const data = httpResponse.response.body.data;
|
||||
forkedApplicationDsl = data.layouts[0].dsl;
|
||||
cy.log(JSON.stringify(forkedApplicationDsl));
|
||||
cy.log(JSON.stringify(parentApplicationDsl));
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ describe("Git sync apps", { tags: ["@tag.Git"] }, function () {
|
|||
cy.fixture("datasources").then((datasourceFormData) => {
|
||||
cy.Createpage(newPage);
|
||||
cy.get(`.t--entity-item:contains(${newPage})`).click();
|
||||
cy.wait("@getConsolidatedData");
|
||||
cy.wait("@getPage");
|
||||
// create a get api call
|
||||
|
||||
apiPage.CreateAndFillApi(datasourceFormData["echoApiUrl"], "get_data");
|
||||
|
|
@ -176,7 +176,7 @@ describe("Git sync apps", { tags: ["@tag.Git"] }, function () {
|
|||
201,
|
||||
);
|
||||
cy.get(`.t--entity-item:contains(${newPage} Copy)`).click();
|
||||
cy.wait("@getConsolidatedData");
|
||||
cy.wait("@getPage");
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -194,7 +194,7 @@ describe("Git sync apps", { tags: ["@tag.Git"] }, function () {
|
|||
.invoke("val")
|
||||
.should("be.oneOf", ["morpheus", "This is a test"]);
|
||||
cy.get(`.t--entity-item:contains(${newPage})`).first().click();
|
||||
cy.wait("@getConsolidatedData");
|
||||
cy.wait("@getPage");
|
||||
cy.get(".t--draggable-inputwidgetv2")
|
||||
.first()
|
||||
.find(".bp3-input")
|
||||
|
|
@ -205,13 +205,13 @@ describe("Git sync apps", { tags: ["@tag.Git"] }, function () {
|
|||
.should("have.value", "This is a test");
|
||||
|
||||
cy.get(`.t--entity-item:contains(${pageName})`).first().click();
|
||||
cy.wait("@getConsolidatedData");
|
||||
cy.wait("@getPage");
|
||||
cy.readTabledataPublish("0", "1").then((cellData) => {
|
||||
expect(cellData).to.be.equal("New Config");
|
||||
});
|
||||
|
||||
cy.get(`.t--entity-item:contains(${pageName} Copy)`).click();
|
||||
cy.wait("@getConsolidatedData");
|
||||
cy.wait("@getPage");
|
||||
cy.readTabledataPublish("0", "1").then((cellData) => {
|
||||
expect(cellData).to.be.equal("New Config");
|
||||
});
|
||||
|
|
@ -232,7 +232,7 @@ describe("Git sync apps", { tags: ["@tag.Git"] }, function () {
|
|||
expect(cellData).to.be.equal("New Config");
|
||||
});
|
||||
cy.get(".t--page-switch-tab").contains(`${newPage}`).click({ force: true });
|
||||
agHelper.RefreshPage("getConsolidatedData");
|
||||
agHelper.RefreshPage("viewPage");
|
||||
cy.get(".bp3-input")
|
||||
.first()
|
||||
.invoke("val")
|
||||
|
|
@ -433,7 +433,7 @@ describe("Git sync apps", { tags: ["@tag.Git"] }, function () {
|
|||
});
|
||||
|
||||
EditorNavigation.SelectEntityByName("Child_Page", EntityType.Page);
|
||||
cy.wait("@getConsolidatedData");
|
||||
cy.wait("@getPage");
|
||||
cy.get(homePageLocators.publishButton).click();
|
||||
cy.get(gitSyncLocators.commitCommentInput).type("Initial Commit");
|
||||
cy.get(gitSyncLocators.commitButton).click();
|
||||
|
|
@ -458,7 +458,7 @@ describe("Git sync apps", { tags: ["@tag.Git"] }, function () {
|
|||
gitSync.CreateGitBranch(tempBranch1, true);
|
||||
// delete page from page settings
|
||||
EditorNavigation.SelectEntityByName("Child_Page Copy", EntityType.Page);
|
||||
cy.wait("@getConsolidatedData");
|
||||
cy.wait("@getPage");
|
||||
cy.Deletepage("Child_Page Copy");
|
||||
cy.get(homePageLocators.publishButton).click();
|
||||
cy.get(gitSyncLocators.commitCommentInput).type("Initial Commit");
|
||||
|
|
|
|||
|
|
@ -231,13 +231,12 @@ describe(
|
|||
cy.wait(1000);
|
||||
let legacyPathname = "";
|
||||
let newPathname = "";
|
||||
// question to qa can we remove this assertion
|
||||
cy.intercept("GET", "/api/v1/pages?*mode=EDIT", (req) => {
|
||||
req.continue();
|
||||
}).as("appAndPages");
|
||||
cy.reload();
|
||||
cy.wait("@getConsolidatedData").then((intercept2) => {
|
||||
const { application, pages } = intercept2.response.body.data.pages.data;
|
||||
cy.wait("@appAndPages").then((intercept2) => {
|
||||
const { application, pages } = intercept2.response.body.data;
|
||||
const defaultPage = pages.find((p) => p.isDefault);
|
||||
legacyPathname = `/applications/${application.id}/pages/${defaultPage.id}`;
|
||||
newPathname = `/app/${application.slug}/${defaultPage.slug}-${defaultPage.id}`;
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ describe("Git sync:", { tags: ["@tag.Git"] }, function () {
|
|||
urlObject.searchParams.set(branchQueryKey, parentBranchKey);
|
||||
cy.visit(urlObject.toString(), { timeout: 60000 });
|
||||
|
||||
cy.wait("@getConsolidatedData").should(
|
||||
cy.wait("@getPagesForViewApp").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ describe(
|
|||
currentUrl = url;
|
||||
cy.log(currentUrl);
|
||||
homePage.Signout(false);
|
||||
agHelper.VisitNAssert(url, "getConsolidatedData");
|
||||
agHelper.VisitNAssert(url, "getPagesForViewApp");
|
||||
agHelper.AssertCSS(
|
||||
autoLayout.getAutoLayoutLayerClassName("0", 0),
|
||||
"flex-wrap",
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ describe(
|
|||
it("1. Validate basic conversion algorithm usecases", function () {
|
||||
_.agHelper.AddDsl("conversionFrAutoLayoutDsl");
|
||||
//cy.openPropertyPane("containerwidget");
|
||||
cy.get("@getConsolidatedData").then((httpResponse) => {
|
||||
const data = httpResponse.response.body.data.pageWithMigratedDsl.data;
|
||||
cy.get("@getPage").then((httpResponse) => {
|
||||
const data = httpResponse.response.body.data;
|
||||
testHeight = data.layouts[0].dsl.bottomRow;
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ describe(
|
|||
it("1. Validate basic conversion algorithm usecases fixed layout usecase Mobile", function () {
|
||||
agHelper.AddDsl("conversionFrAutoLayoutDsl");
|
||||
//cy.openPropertyPane("containerwidget");
|
||||
cy.get("@getConsolidatedData").then((httpResponse) => {
|
||||
const data = httpResponse.response.body.data.pageWithMigratedDsl.data;
|
||||
cy.get("@getPage").then((httpResponse) => {
|
||||
const data = httpResponse.response.body.data;
|
||||
testHeight = data.layouts[0].dsl.bottomRow;
|
||||
//expect(testHeight).to.equal(380);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ describe(
|
|||
it("1. Validate basic conversion algorithm usecases fixed layout Desktop", function () {
|
||||
_.agHelper.AddDsl("conversionFrAutoLayoutDsl");
|
||||
//cy.openPropertyPane("containerwidget");
|
||||
cy.get("@getConsolidatedData").then((httpResponse) => {
|
||||
const data = httpResponse.response.body.data.pageWithMigratedDsl.data;
|
||||
cy.get("@getPage").then((httpResponse) => {
|
||||
const data = httpResponse.response.body.data;
|
||||
testHeight = data.layouts[0].dsl.bottomRow;
|
||||
//expect(testHeight).to.equal(380);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ describe("FirstTimeUserOnboarding", function () {
|
|||
agHelper.AssertElementVisibility(OnboardingLocator.widgetSidebar);
|
||||
agHelper.AssertElementVisibility(OnboardingLocator.dropTarget);
|
||||
entityExplorer.DragDropWidgetNVerify(draggableWidgets.TEXT);
|
||||
agHelper.RefreshPage("getConsolidatedData");
|
||||
agHelper.RefreshPage("getPage");
|
||||
agHelper.AssertElementEnabledDisabled(
|
||||
debuggerHelper.locators._helpButton,
|
||||
0,
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ describe(
|
|||
it("2. Should check smartlook is not initialised when enableTelemtry is false", function () {
|
||||
agHelper.VisitNAssert("/applications", "getReleaseItems");
|
||||
cy.wait(3000);
|
||||
cy.wait("@getConsolidatedData");
|
||||
cy.wait("@getMe");
|
||||
cy.window().then((window) => {
|
||||
expect(window.smartlook).to.be.equal(undefined);
|
||||
});
|
||||
|
|
@ -69,7 +69,7 @@ describe(
|
|||
it("3. Should check Sentry is not initialised when enableTelemtry is false", function () {
|
||||
agHelper.VisitNAssert("/applications", "getReleaseItems");
|
||||
cy.wait(3000);
|
||||
cy.wait("@getConsolidatedData");
|
||||
cy.wait("@getMe");
|
||||
cy.window().then((window) => {
|
||||
expect(window.Sentry).to.be.equal(undefined);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -66,8 +66,8 @@ describe("Slug URLs", () => {
|
|||
|
||||
cy.SearchApp(applicationName);
|
||||
|
||||
cy.wait("@getConsolidatedData").then((intercept) => {
|
||||
const { application, pages } = intercept.response.body.data.pages.data;
|
||||
cy.wait("@getPagesForCreateApp").then((intercept) => {
|
||||
const { application, pages } = intercept.response.body.data;
|
||||
const defaultPage = pages.find((p) => p.isDefault);
|
||||
|
||||
cy.location().should((loc) => {
|
||||
|
|
@ -99,10 +99,8 @@ describe("Slug URLs", () => {
|
|||
|
||||
cy.get(".t--upgrade-confirm").click({ force: true });
|
||||
|
||||
cy.wait("@getConsolidatedData").then((intercept) => {
|
||||
const { application, pages } =
|
||||
intercept.response.body.data.pages.data;
|
||||
|
||||
cy.wait("@getPagesForCreateApp").then((intercept) => {
|
||||
const { application, pages } = intercept.response.body.data;
|
||||
const currentPage = pages.find((p) => p.id === currentPageId);
|
||||
|
||||
cy.location().should((loc) => {
|
||||
|
|
@ -134,12 +132,7 @@ describe("Slug URLs", () => {
|
|||
it("4. Checks redirect url", () => {
|
||||
cy.url().then((url) => {
|
||||
homePage.Signout(true);
|
||||
agHelper.VisitNAssert(url + "?embed=true&a=b");
|
||||
|
||||
// status should be 401 since the user is still unauthenticated from the previous signin request
|
||||
cy.wait("@getConsolidatedData").then((res1) => {
|
||||
expect(res1.response).to.have.property("statusCode", 401);
|
||||
});
|
||||
agHelper.VisitNAssert(url + "?embed=true&a=b", "signUpLogin");
|
||||
agHelper.AssertURL(
|
||||
`?redirectUrl=${encodeURIComponent(url + "?embed=true&a=b")}`,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ describe("Omnibar functionality test cases", () => {
|
|||
deployMode.StubWindowNAssert(
|
||||
'//span[text()="Learn more"]',
|
||||
"connect-to-a-database",
|
||||
"getConsolidatedData",
|
||||
"getPluginForm",
|
||||
);
|
||||
});
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ describe("Omnibar functionality test cases", () => {
|
|||
deployMode.StubWindowNAssert(
|
||||
omnibar.discordLink,
|
||||
"https://discord.com/invite/rBTTVJp",
|
||||
"getConsolidatedData",
|
||||
"getPluginForm",
|
||||
);
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ describe("Preview mode functionality", function () {
|
|||
|
||||
beforeEach(() => {
|
||||
cy.getSharedUrl().then((url) => {
|
||||
agHelper.VisitNAssert(url, "getConsolidatedData"),
|
||||
agHelper.VisitNAssert(url, "getPagesForViewApp"),
|
||||
agHelper.AssertElementVisibility(
|
||||
locators._widgetInDeployed(draggableWidgets.BUTTON),
|
||||
);
|
||||
|
|
@ -42,7 +42,7 @@ describe("Preview mode functionality", function () {
|
|||
cy.url().then((url) => {
|
||||
url = new URL(url);
|
||||
url.searchParams.append("embed", "true");
|
||||
agHelper.VisitNAssert(url.toString(), "getConsolidatedData");
|
||||
agHelper.VisitNAssert(url.toString(), "getPagesForViewApp");
|
||||
agHelper.AssertElementVisibility(
|
||||
locators._widgetInDeployed(draggableWidgets.BUTTON),
|
||||
);
|
||||
|
|
@ -55,7 +55,7 @@ describe("Preview mode functionality", function () {
|
|||
url = new URL(url);
|
||||
url.searchParams.append("embed", "true");
|
||||
url.searchParams.append("navbar", "true");
|
||||
agHelper.VisitNAssert(url.toString(), "getConsolidatedData");
|
||||
agHelper.VisitNAssert(url.toString(), "getPagesForViewApp");
|
||||
agHelper.AssertElementVisibility(
|
||||
locators._widgetInDeployed(draggableWidgets.BUTTON),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ describe(
|
|||
|
||||
//Open the Code Scanner modal and Scan a QR using fake webcam video
|
||||
cy.task("changeVideoSource", "qrCodeVideo.y4m");
|
||||
agHelper.RefreshPage("getConsolidatedData");
|
||||
agHelper.RefreshPage("viewPage");
|
||||
agHelper.ValidateToastMessage("Code scanned successfully!");
|
||||
|
||||
//Verify that the scanned data is correctly displayed on the app's screen
|
||||
|
|
@ -190,7 +190,7 @@ describe(
|
|||
|
||||
//Open the Code Scanner modal and Scan a QR using fake webcam video
|
||||
cy.task("changeVideoSource", "qrCodeVideo.y4m");
|
||||
agHelper.RefreshPage("getConsolidatedData");
|
||||
agHelper.RefreshPage("viewPage");
|
||||
agHelper.AssertElementVisibility(
|
||||
widgetLocators.codeScannerNewScanButton,
|
||||
);
|
||||
|
|
@ -211,7 +211,7 @@ describe(
|
|||
it("5. Validate scanning rotated QR code.", () => {
|
||||
//Open the Code Scanner modal and Scan rotated QR code using fake webcam video
|
||||
cy.task("changeVideoSource", "rotatedQRCode.y4m");
|
||||
agHelper.RefreshPage("getConsolidatedData");
|
||||
agHelper.RefreshPage("viewPage");
|
||||
agHelper.AssertElementVisibility(widgetLocators.codeScannerNewScanButton);
|
||||
agHelper.GetNClick(widgetLocators.codeScannerNewScanButton, 0, true);
|
||||
agHelper.AssertElementVisibility(widgetLocators.codeScannerModal);
|
||||
|
|
@ -229,7 +229,7 @@ describe(
|
|||
it("6. Validate scanning invalid QR code.", () => {
|
||||
//Open the Code Scanner modal and Scan invalid QR code using fake webcam video
|
||||
cy.task("changeVideoSource", "invalidQRCode.y4m");
|
||||
agHelper.RefreshPage("getConsolidatedData");
|
||||
agHelper.RefreshPage("viewPage");
|
||||
agHelper.AssertElementVisibility(widgetLocators.codeScannerNewScanButton);
|
||||
agHelper.GetNClick(widgetLocators.codeScannerNewScanButton, 0, true);
|
||||
agHelper.AssertElementVisibility(widgetLocators.codeScannerModal);
|
||||
|
|
@ -247,7 +247,7 @@ describe(
|
|||
it("7. Validate scanning multiple QR codes.", () => {
|
||||
//Open the Code Scanner modal and Scan multiple QR codes using fake webcam video
|
||||
cy.task("changeVideoSource", "multipleQRCodes.y4m");
|
||||
agHelper.RefreshPage("getConsolidatedData");
|
||||
agHelper.RefreshPage("viewPage");
|
||||
agHelper.AssertElementVisibility(widgetLocators.codeScannerNewScanButton);
|
||||
agHelper.GetNClick(widgetLocators.codeScannerNewScanButton, 0, true);
|
||||
agHelper.AssertElementVisibility(widgetLocators.codeScannerModal);
|
||||
|
|
@ -284,7 +284,7 @@ describe(
|
|||
it("9. Validate scanning high density QR code.", () => {
|
||||
//Open the Code Scanner modal and Scan high density QR code using fake webcam video
|
||||
cy.task("changeVideoSource", "highDensityQRCode.y4m");
|
||||
agHelper.RefreshPage("getConsolidatedData");
|
||||
agHelper.RefreshPage("viewPage");
|
||||
agHelper.AssertElementVisibility(widgetLocators.codeScannerNewScanButton);
|
||||
agHelper.GetNClick(widgetLocators.codeScannerNewScanButton, 0, true);
|
||||
agHelper.AssertElementVisibility(widgetLocators.codeScannerModal);
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ describe(
|
|||
agHelper.WaitUntilEleAppear(
|
||||
locators._widgetInDeployed("iconbuttonwidget"),
|
||||
);
|
||||
assertHelper.AssertNetworkResponseData("@getConsolidatedData");
|
||||
assertHelper.AssertNetworkResponseData("@viewPage");
|
||||
assertHelper.AssertDocumentReady();
|
||||
agHelper.Sleep(3000); //for view page to complete loading & then navigate back
|
||||
deployMode.NavigateBacktoEditor();
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ describe(
|
|||
freezeColumnFromDropdown("status", "left");
|
||||
freezeColumnFromDropdown("action", "right");
|
||||
|
||||
agHelper.RefreshPage("getConsolidatedData");
|
||||
agHelper.RefreshPage("viewPage");
|
||||
|
||||
checkIfColumnIsFrozenViaCSS("status");
|
||||
checkIfColumnIsFrozenViaCSS("action");
|
||||
|
|
@ -215,7 +215,7 @@ describe(
|
|||
freezeColumnFromDropdown("id", "left");
|
||||
freezeColumnFromDropdown("updatedAt", "right");
|
||||
|
||||
agHelper.RefreshPage("getConsolidatedData");
|
||||
agHelper.RefreshPage("viewPage");
|
||||
|
||||
checkIfColumnIsFrozenViaCSS("id");
|
||||
checkIfColumnIsFrozenViaCSS("updatedAt");
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ describe(
|
|||
agHelper.Sleep(2000);
|
||||
homePage.EditAppFromAppHover();
|
||||
agHelper.AssertElementAbsence(locators._loading);
|
||||
assertHelper.AssertNetworkStatus("@getConsolidatedData");
|
||||
assertHelper.AssertNetworkStatus("@getPagesForCreateApp");
|
||||
agHelper.GetNClick(inviteModal.locators._shareButton, 0, true);
|
||||
agHelper.GetNClick(homePage._sharePublicToggle, 0, true);
|
||||
agHelper.Sleep(5000);
|
||||
|
|
@ -94,7 +94,7 @@ describe(
|
|||
});
|
||||
|
||||
it("4. Open the app without login and validate public access of Application", function () {
|
||||
agHelper.VisitNAssert(currentUrl, "@getConsolidatedData");
|
||||
agHelper.VisitNAssert(currentUrl, "@getPagesForViewApp");
|
||||
agHelper.Sleep(3000);
|
||||
agHelper.GetText(locators._emptyPageTxt).then((text) => {
|
||||
expect(text).to.equal("This page seems to be blank");
|
||||
|
|
@ -114,7 +114,7 @@ describe(
|
|||
Cypress.env("TESTUSERNAME2"),
|
||||
Cypress.env("TESTPASSWORD2"),
|
||||
);
|
||||
agHelper.VisitNAssert(currentUrl, "@getConsolidatedData");
|
||||
agHelper.VisitNAssert(currentUrl, "@getPagesForViewApp");
|
||||
agHelper.GetText(locators._emptyPageTxt).then((text) => {
|
||||
expect(text).to.equal("This page seems to be blank");
|
||||
});
|
||||
|
|
@ -152,23 +152,11 @@ describe(
|
|||
);
|
||||
agHelper.Sleep(); //for CI
|
||||
agHelper.VisitNAssert(currentUrl);
|
||||
cy.get("@getConsolidatedData").then((interception: any) => {
|
||||
expect(
|
||||
Number(interception.response.body.data.pages.responseMeta.status),
|
||||
).to.eq(404);
|
||||
});
|
||||
assertHelper.AssertNetworkStatus("@getPagesForViewApp", 404);
|
||||
homePage.LogOutviaAPI();
|
||||
// visit the app as anonymous user and validate redirection to login page
|
||||
agHelper.VisitNAssert(currentUrl);
|
||||
cy.get("@getConsolidatedData").then((interception: any) => {
|
||||
//we make two getConsolidatedData calls during the first we get a 404 error which redirects the browser back to signin
|
||||
//page and that causes to fetch the getConsolidatedData without any page params again we should expect no pages resp during then
|
||||
if (interception.response.body.data.pages) {
|
||||
expect(
|
||||
Number(interception.response.body.data.pages.responseMeta.status),
|
||||
).to.eq(404);
|
||||
}
|
||||
});
|
||||
assertHelper.AssertNetworkStatus("@getPagesForViewApp", 404);
|
||||
agHelper.AssertContains("Sign in to your account", "be.visible");
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -67,9 +67,8 @@ describe(
|
|||
"contain",
|
||||
"Application imported successfully",
|
||||
);
|
||||
cy.wait("@getConsolidatedData").then((interception) => {
|
||||
const pages =
|
||||
interception.response.body.data.pages.data.pages;
|
||||
cy.wait("@getPagesForCreateApp").then((interception) => {
|
||||
const pages = interception.response.body.data.pages;
|
||||
const pageSlug =
|
||||
pages.find((page) => page.isDefault)?.slug ?? "page";
|
||||
cy.url().should(
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ describe("Login failure", function () {
|
|||
.then((url) => {
|
||||
urlWithoutQueryParams = url.split("?")[0];
|
||||
homePage.LogOutviaAPI();
|
||||
agHelper.VisitNAssert(urlWithoutQueryParams, "getConsolidatedData");
|
||||
agHelper.VisitNAssert(urlWithoutQueryParams, "signUpLogin");
|
||||
// agHelper.Sleep(3000); //for page redirect to complete
|
||||
// assertHelper.AssertNetworkStatus("signUpLogin");
|
||||
})
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ describe(
|
|||
table.WaitForTableEmpty();
|
||||
agHelper.WaitUntilAllToastsDisappear();
|
||||
|
||||
agHelper.RefreshPage("getConsolidatedData");
|
||||
agHelper.RefreshPage("viewPage");
|
||||
agHelper.AssertElementVisibility(jsEditor._dialog("Confirmation dialog"));
|
||||
agHelper.AssertElementVisibility(
|
||||
jsEditor._dialogBody((jsName as string) + ".getEmployee"),
|
||||
|
|
|
|||
|
|
@ -94,9 +94,9 @@ describe(
|
|||
// cy.get(widgetsPage.NavHomePage).click({ force: true });
|
||||
cy.reload();
|
||||
cy.openPropertyPane("inputwidgetv2");
|
||||
cy.wait("@getConsolidatedData").should(
|
||||
cy.wait("@getPage").should(
|
||||
"have.nested.property",
|
||||
"response.body.data.pageWithMigratedDsl.data.layouts[0].layoutOnLoadActionErrors.length",
|
||||
"response.body.data.layouts[0].layoutOnLoadActionErrors.length",
|
||||
0,
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ describe(
|
|||
|
||||
agHelper.AssertElementAbsence(jsEditor._dialogBody("WhatTrumpThinks")); //Since JS call is NO, dependent API confirmation should not appear
|
||||
|
||||
agHelper.RefreshPage("getConsolidatedData");
|
||||
agHelper.RefreshPage("viewPage");
|
||||
// agHelper.AssertElementVisibility(
|
||||
// jsEditor._dialogBody((jsName as string) + ".callTrump"),
|
||||
// );
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import {
|
||||
agHelper,
|
||||
apiPage,
|
||||
assertHelper,
|
||||
deployMode,
|
||||
entityExplorer,
|
||||
entityItems,
|
||||
|
|
@ -138,19 +137,17 @@ describe(
|
|||
|
||||
deployMode.DeployApp(locators._widgetInDeployed("textwidget"), false);
|
||||
agHelper.Sleep(5000); //for all api's to ccomplete call!
|
||||
assertHelper.AssertNetworkStatus("@getConsolidatedData");
|
||||
|
||||
cy.get("@getConsolidatedData").then(($response: any) => {
|
||||
cy.wait("@viewPage").then(($response) => {
|
||||
const respBody = JSON.stringify($response.response?.body);
|
||||
const { pageWithMigratedDsl } = JSON.parse(respBody)?.data;
|
||||
|
||||
const _randomFlora =
|
||||
pageWithMigratedDsl.data.layouts[0].layoutOnLoadActions[0];
|
||||
JSON.parse(respBody).data.layouts[0].layoutOnLoadActions[0];
|
||||
const _randomUser =
|
||||
pageWithMigratedDsl.data.layouts[0].layoutOnLoadActions[1];
|
||||
JSON.parse(respBody).data.layouts[0].layoutOnLoadActions[1];
|
||||
const _genderize =
|
||||
pageWithMigratedDsl.data.layouts[0].layoutOnLoadActions[2];
|
||||
JSON.parse(respBody).data.layouts[0].layoutOnLoadActions[2];
|
||||
const _suggestions =
|
||||
pageWithMigratedDsl.data.layouts[0].layoutOnLoadActions[3];
|
||||
JSON.parse(respBody).data.layouts[0].layoutOnLoadActions[3];
|
||||
// cy.log("_randomFlora is: " + JSON.stringify(_randomFlora))
|
||||
// cy.log("_randomUser is: " + JSON.stringify(_randomUser))
|
||||
// cy.log("_genderize is: " + JSON.stringify(_genderize))
|
||||
|
|
@ -199,20 +196,17 @@ describe(
|
|||
}); // verifies Bug 10055
|
||||
|
||||
deployMode.DeployApp(locators._widgetInDeployed("textwidget"), false);
|
||||
assertHelper.AssertNetworkStatus("@getConsolidatedData");
|
||||
|
||||
cy.get("@getConsolidatedData").then(($response: any) => {
|
||||
agHelper.Sleep(5000); //for all api's to ccomplete call!
|
||||
cy.wait("@viewPage").then(($response) => {
|
||||
const respBody = JSON.stringify($response.response?.body);
|
||||
const { pageWithMigratedDsl } = JSON.parse(respBody)?.data;
|
||||
|
||||
const _randomFlora =
|
||||
pageWithMigratedDsl.data.layouts[0].layoutOnLoadActions[0];
|
||||
JSON.parse(respBody).data.layouts[0].layoutOnLoadActions[0];
|
||||
const _randomUser =
|
||||
pageWithMigratedDsl.data.layouts[0].layoutOnLoadActions[1];
|
||||
JSON.parse(respBody).data.layouts[0].layoutOnLoadActions[1];
|
||||
const _genderize =
|
||||
pageWithMigratedDsl.data.layouts[0].layoutOnLoadActions[2];
|
||||
JSON.parse(respBody).data.layouts[0].layoutOnLoadActions[2];
|
||||
const _suggestions =
|
||||
pageWithMigratedDsl.data.layouts[0].layoutOnLoadActions[3];
|
||||
JSON.parse(respBody).data.layouts[0].layoutOnLoadActions[3];
|
||||
|
||||
expect(JSON.parse(JSON.stringify(_randomFlora))[0]["name"]).to.eq(
|
||||
"RandomFlora",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import produce from "immer";
|
||||
import { LICENSE_FEATURE_FLAGS } from "../Constants";
|
||||
|
||||
export const featureFlagIntercept = (
|
||||
flags: Record<string, boolean> = {},
|
||||
reload = true,
|
||||
|
|
@ -12,33 +13,48 @@ export const featureFlagIntercept = (
|
|||
...flags,
|
||||
release_app_sidebar_enabled: true,
|
||||
release_show_new_sidebar_pages_pane_enabled: true,
|
||||
rollout_consolidated_page_load_fetch_enabled: true,
|
||||
},
|
||||
errorDisplay: "",
|
||||
};
|
||||
cy.intercept("GET", "/api/v1/users/features", response);
|
||||
|
||||
cy.intercept("GET", "/api/v1/consolidated-api/*?*", (req) => {
|
||||
req.reply((res: any) => {
|
||||
if (res.statusCode === 200) {
|
||||
const originalResponse = res?.body;
|
||||
const updatedResponse = produce(originalResponse, (draft: any) => {
|
||||
draft.data.featureFlags.data = { ...flags };
|
||||
draft.data.featureFlags.data["release_app_sidebar_enabled"] = true;
|
||||
draft.data.featureFlags.data[
|
||||
"release_show_new_sidebar_pages_pane_enabled"
|
||||
] = true;
|
||||
draft.data.featureFlags.data[
|
||||
"rollout_consolidated_page_load_fetch_enabled"
|
||||
] = true;
|
||||
});
|
||||
return res.send(updatedResponse);
|
||||
}
|
||||
});
|
||||
}).as("getConsolidatedData");
|
||||
|
||||
if (reload) {
|
||||
cy.reload();
|
||||
cy.wait(2000); //for the page to re-load finish for CI runs
|
||||
}
|
||||
};
|
||||
|
||||
export const featureFlagInterceptForLicenseFlags = () => {
|
||||
cy.intercept(
|
||||
{
|
||||
method: "GET",
|
||||
url: "/api/v1/users/features",
|
||||
},
|
||||
(req) => {
|
||||
req.reply((res) => {
|
||||
if (res) {
|
||||
const originalResponse = res.body;
|
||||
let modifiedResponse: any = {};
|
||||
Object.keys(originalResponse.data).forEach((flag) => {
|
||||
if (LICENSE_FEATURE_FLAGS.includes(flag)) {
|
||||
modifiedResponse[flag] = originalResponse.data[flag];
|
||||
}
|
||||
});
|
||||
modifiedResponse = {
|
||||
...modifiedResponse,
|
||||
release_app_sidebar_enabled: true,
|
||||
};
|
||||
res.send({
|
||||
responseMeta: {
|
||||
status: 200,
|
||||
success: true,
|
||||
},
|
||||
data: { ...modifiedResponse },
|
||||
errorDisplay: "",
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
).as("getLicenseFeatures");
|
||||
cy.reload();
|
||||
cy.wait(2000); //for the page to re-load finish for CI runs
|
||||
};
|
||||
|
|
|
|||
|
|
@ -158,8 +158,8 @@ export class AggregateHelper {
|
|||
this.RefreshPage();
|
||||
if (elementToCheckPresenceaftDslLoad)
|
||||
this.WaitUntilEleAppear(elementToCheckPresenceaftDslLoad);
|
||||
// this.Sleep(5000); //settling time for dsl
|
||||
this.assertHelper.AssertNetworkResponseData("@getConsolidatedData");
|
||||
//this.Sleep(2000); //settling time for dsl
|
||||
this.assertHelper.AssertNetworkResponseData("@getPluginForm");
|
||||
this.AssertElementAbsence(this.locator._loading); //Checks the spinner is gone & dsl loaded!
|
||||
this.AssertElementAbsence(this.locator._animationSpnner, 20000); //Checks page is loaded with dsl!
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1008,7 +1008,7 @@ export class DataSources {
|
|||
else if (dsName == "MySQL") this.FillMySqlDSForm();
|
||||
else if (dsName == "MongoDB") this.FillMongoDSForm();
|
||||
this.TestSaveDatasource(true, true);
|
||||
this.assertHelper.AssertNetworkStatus("@getConsolidatedData", 200);
|
||||
this.assertHelper.AssertNetworkStatus("@getPage", 200);
|
||||
this.assertHelper.AssertNetworkStatus("getWorkspace");
|
||||
}
|
||||
public ReconnectModalValidation(
|
||||
|
|
|
|||
|
|
@ -165,8 +165,8 @@ export class DeployMode {
|
|||
this.agHelper.AssertElementAbsence(
|
||||
this.locator._specificToast("Cannot read properties of undefined"),
|
||||
);
|
||||
this.assertHelper.AssertNetworkResponseData("@getConsolidatedData"); //for auth rest api
|
||||
|
||||
this.assertHelper.AssertNetworkResponseData("@getPluginForm"); //for auth rest api
|
||||
this.assertHelper.AssertNetworkResponseData("@getPluginForm"); //for graphql
|
||||
this.assertHelper.AssertNetworkStatus("@getWorkspace");
|
||||
|
||||
// cy.window().then((win) => {
|
||||
|
|
|
|||
|
|
@ -383,12 +383,12 @@ export class HomePage {
|
|||
this.agHelper.Sleep(); //waiting for window to load
|
||||
this.InvokeDispatchOnStore();
|
||||
cy.wait("@postLogout");
|
||||
this.agHelper.VisitNAssert("/user/login", "getConsolidatedData");
|
||||
this.agHelper.VisitNAssert("/user/login", "signUpLogin");
|
||||
this.agHelper.AssertElementVisibility(this._username);
|
||||
this.agHelper.TypeText(this._username, uname);
|
||||
this.agHelper.TypeText(this._password, pswd);
|
||||
this.agHelper.GetNClick(this._submitBtn);
|
||||
this.assertHelper.AssertNetworkStatus("@getConsolidatedData");
|
||||
this.assertHelper.AssertNetworkStatus("@getMe");
|
||||
this.agHelper.Sleep(3000);
|
||||
if (role != "App Viewer") {
|
||||
this.agHelper.AssertElementVisibility(this._homePageAppCreateBtn);
|
||||
|
|
@ -401,7 +401,7 @@ export class HomePage {
|
|||
}
|
||||
|
||||
public SignUp(uname: string, pswd: string) {
|
||||
this.agHelper.VisitNAssert("/user/signup", "@getConsolidatedData");
|
||||
this.agHelper.VisitNAssert("/user/signup", "signUpLogin");
|
||||
this.agHelper.AssertElementVisibility(this.signupUsername);
|
||||
this.agHelper.TypeText(this.signupUsername, uname);
|
||||
this.agHelper.TypeText(this._password, pswd);
|
||||
|
|
@ -418,7 +418,7 @@ export class HomePage {
|
|||
);
|
||||
}
|
||||
});
|
||||
this.assertHelper.AssertNetworkStatus("@getConsolidatedData");
|
||||
this.assertHelper.AssertNetworkStatus("@getMe");
|
||||
this.agHelper.Sleep(3000);
|
||||
}
|
||||
|
||||
|
|
@ -451,7 +451,7 @@ export class HomePage {
|
|||
public LaunchAppFromAppHover() {
|
||||
cy.get(this._appHoverIcon("view")).should("be.visible").first().click();
|
||||
this.agHelper.AssertElementAbsence(this.locator._loading);
|
||||
this.assertHelper.AssertNetworkStatus("getConsolidatedData");
|
||||
this.assertHelper.AssertNetworkStatus("getPagesForViewApp");
|
||||
}
|
||||
|
||||
public EditAppFromAppHover(appName = "") {
|
||||
|
|
|
|||
|
|
@ -561,7 +561,7 @@ export class Table {
|
|||
col: number,
|
||||
expectedURL: string,
|
||||
tableVersion: "v1" | "v2" = "v1",
|
||||
networkCall = "getConsolidatedData",
|
||||
networkCall = "viewPage",
|
||||
) {
|
||||
this.deployMode.StubWindowNAssert(
|
||||
this._tableRowColumnData(row, col, tableVersion),
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ Cypress.Commands.add(
|
|||
Cypress.Commands.add("launchApp", () => {
|
||||
cy.get(homePage.appView).should("be.visible").first().click();
|
||||
cy.get("#loading").should("not.exist");
|
||||
cy.wait("@getConsolidatedData").should(
|
||||
cy.wait("@getPagesForViewApp").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
|
|
@ -295,7 +295,8 @@ Cypress.Commands.add("CreateNewAppInNewWorkspace", () => {
|
|||
});
|
||||
});
|
||||
AppSidebar.assertVisible();
|
||||
assertHelper.AssertNetworkResponseData("@getConsolidatedData"); //for auth rest api
|
||||
assertHelper.AssertNetworkResponseData("@getPluginForm"); //for auth rest api
|
||||
assertHelper.AssertNetworkResponseData("@getPluginForm"); //for graphql
|
||||
|
||||
// If the intro modal is open, close it
|
||||
cy.skipSignposting();
|
||||
|
|
|
|||
|
|
@ -280,12 +280,14 @@ Cypress.Commands.add("LogOutUser", () => {
|
|||
Cypress.Commands.add("LoginUser", (uname, pword, goToLoginPage = true) => {
|
||||
goToLoginPage && cy.visit("/user/login", { timeout: 60000 });
|
||||
cy.wait(3000); //for login page to load fully for CI runs
|
||||
cy.wait("@getConsolidatedData");
|
||||
cy.wait("@signUpLogin")
|
||||
.its("response.body.responseMeta.status")
|
||||
.should("eq", 200);
|
||||
cy.get(loginPage.username).should("be.visible");
|
||||
cy.get(loginPage.username).type(uname);
|
||||
cy.get(loginPage.password).type(pword, { log: false });
|
||||
cy.get(loginPage.submitBtn).click();
|
||||
cy.wait("@getConsolidatedData");
|
||||
cy.wait("@getMe");
|
||||
cy.wait(3000);
|
||||
});
|
||||
|
||||
|
|
@ -309,7 +311,7 @@ Cypress.Commands.add("Signup", (uname, pword) => {
|
|||
homePageTS.InvokeDispatchOnStore();
|
||||
cy.wait("@postLogout");
|
||||
cy.visit("/user/signup", { timeout: 60000 });
|
||||
cy.wait("@getConsolidatedData")
|
||||
cy.wait("@signUpLogin")
|
||||
.its("response.body.responseMeta.status")
|
||||
.should("eq", 200);
|
||||
agHelper.WaitUntilEleAppear(signupPage.username);
|
||||
|
|
@ -323,7 +325,7 @@ Cypress.Commands.add("Signup", (uname, pword) => {
|
|||
cy.get(signupPage.getStartedSubmit).click({ force: true });
|
||||
}
|
||||
});
|
||||
cy.wait("@getConsolidatedData");
|
||||
cy.wait("@getMe");
|
||||
cy.wait(3000);
|
||||
initLocalstorage();
|
||||
});
|
||||
|
|
@ -370,7 +372,7 @@ Cypress.Commands.add("LoginFromAPI", (uname, pword) => {
|
|||
if (CURRENT_REPO === REPO.EE) {
|
||||
cy.wait(2000);
|
||||
} else {
|
||||
assertHelper.AssertNetworkStatus("getConsolidatedData");
|
||||
assertHelper.AssertNetworkStatus("getMe");
|
||||
assertHelper.AssertNetworkStatus("applications");
|
||||
assertHelper.AssertNetworkStatus("getReleaseItems");
|
||||
}
|
||||
|
|
@ -414,7 +416,7 @@ Cypress.Commands.add("LogOut", (toCheckgetPluginForm = true) => {
|
|||
|
||||
if (CURRENT_REPO === REPO.CE)
|
||||
toCheckgetPluginForm &&
|
||||
assertHelper.AssertNetworkResponseData("@getConsolidatedData", false);
|
||||
assertHelper.AssertNetworkResponseData("@getPluginForm", false);
|
||||
|
||||
cy.request({
|
||||
method: httpMethod,
|
||||
|
|
|
|||
|
|
@ -90,8 +90,7 @@ before(function () {
|
|||
window.indexedDB.deleteDatabase("Appsmith");
|
||||
});
|
||||
cy.visit("/setup/welcome", { timeout: 60000 });
|
||||
cy.wait("@getConsolidatedData");
|
||||
|
||||
cy.wait("@getMe");
|
||||
cy.wait(2000);
|
||||
const username = Cypress.env("USERNAME");
|
||||
const password = Cypress.env("PASSWORD");
|
||||
|
|
|
|||
|
|
@ -1,14 +1,10 @@
|
|||
import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";
|
||||
import type { ApiResponse } from "api/ApiResponses";
|
||||
import type { JSLibrary } from "workers/common/JSLibrary";
|
||||
|
||||
export function fetchJSLibraries(
|
||||
applicationId: string,
|
||||
customJSLibraries?: ApiResponse,
|
||||
) {
|
||||
export function fetchJSLibraries(applicationId: string) {
|
||||
return {
|
||||
type: ReduxActionTypes.FETCH_JS_LIBRARIES_INIT,
|
||||
payload: { applicationId, customJSLibraries },
|
||||
payload: applicationId,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import type { AppTheme } from "entities/AppTheming";
|
||||
import type { AppThemingMode } from "selectors/appThemingSelectors";
|
||||
import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";
|
||||
import type { ApiResponse } from "api/ApiResponses";
|
||||
|
||||
/**
|
||||
* ----------------------------------------------------------------------------
|
||||
|
|
@ -11,12 +10,10 @@ import type { ApiResponse } from "api/ApiResponses";
|
|||
|
||||
export interface FetchAppThemesAction {
|
||||
applicationId: string;
|
||||
themes?: ApiResponse<AppTheme>;
|
||||
}
|
||||
|
||||
export interface FetchSelectedAppThemeAction {
|
||||
applicationId: string;
|
||||
currentTheme?: ApiResponse<AppTheme[]>;
|
||||
}
|
||||
|
||||
export interface UpdateSelectedAppThemeAction {
|
||||
|
|
@ -68,14 +65,10 @@ export const setAppThemingModeStackAction = (stack: AppThemingMode[]) => ({
|
|||
* @param mode
|
||||
* @returns
|
||||
*/
|
||||
export const fetchAppThemesAction = (
|
||||
applicationId: string,
|
||||
themes?: ApiResponse<AppTheme>,
|
||||
) => ({
|
||||
export const fetchAppThemesAction = (applicationId: string) => ({
|
||||
type: ReduxActionTypes.FETCH_APP_THEMES_INIT,
|
||||
payload: {
|
||||
applicationId,
|
||||
themes,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -85,14 +78,10 @@ export const fetchAppThemesAction = (
|
|||
* @param mode
|
||||
* @returns
|
||||
*/
|
||||
export const fetchSelectedAppThemeAction = (
|
||||
applicationId: string,
|
||||
currentTheme?: ApiResponse<AppTheme[]>,
|
||||
) => ({
|
||||
export const fetchSelectedAppThemeAction = (applicationId: string) => ({
|
||||
type: ReduxActionTypes.FETCH_SELECTED_APP_THEME_INIT,
|
||||
payload: {
|
||||
applicationId,
|
||||
currentTheme,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";
|
||||
import type { ApiResponse } from "api/ApiResponses";
|
||||
|
||||
export const getCurrentUser = (userProfile?: ApiResponse) => ({
|
||||
export const getCurrentUser = () => ({
|
||||
type: ReduxActionTypes.FETCH_USER_INIT,
|
||||
payload: { userProfile },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import type {
|
|||
MockDatasource,
|
||||
} from "entities/Datasource";
|
||||
import type { PluginType } from "entities/Action";
|
||||
import type { ApiResponse, ResponseMeta } from "api/ApiResponses";
|
||||
import type { ResponseMeta } from "api/ApiResponses";
|
||||
import { TEMP_DATASOURCE_ID } from "constants/Datasource";
|
||||
|
||||
export const createDatasourceFromForm = (
|
||||
|
|
@ -273,20 +273,16 @@ export const setDatasourceCollapsible = (key: string, isOpen: boolean) => {
|
|||
};
|
||||
};
|
||||
|
||||
export const fetchDatasources = (payload?: {
|
||||
workspaceId?: string;
|
||||
datasources?: ApiResponse<Datasource[]>;
|
||||
}) => {
|
||||
export const fetchDatasources = (payload?: { workspaceId?: string }) => {
|
||||
return {
|
||||
type: ReduxActionTypes.FETCH_DATASOURCES_INIT,
|
||||
payload,
|
||||
};
|
||||
};
|
||||
|
||||
export const fetchMockDatasources = (mockDatasources?: ApiResponse) => {
|
||||
export const fetchMockDatasources = () => {
|
||||
return {
|
||||
type: ReduxActionTypes.FETCH_MOCK_DATASOURCES_INIT,
|
||||
payload: { mockDatasources },
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ export interface InitializeEditorPayload {
|
|||
pageId?: string;
|
||||
branch?: string;
|
||||
mode: APP_MODE;
|
||||
shouldInitialiseUserDetails?: boolean;
|
||||
}
|
||||
|
||||
export const initEditor = (
|
||||
|
|
@ -28,7 +27,6 @@ export interface InitAppViewerPayload {
|
|||
applicationId?: string;
|
||||
pageId: string;
|
||||
mode: APP_MODE;
|
||||
shouldInitialiseUserDetails?: boolean;
|
||||
}
|
||||
|
||||
export const initAppViewer = ({
|
||||
|
|
@ -36,7 +34,6 @@ export const initAppViewer = ({
|
|||
branch,
|
||||
mode,
|
||||
pageId,
|
||||
shouldInitialiseUserDetails,
|
||||
}: InitAppViewerPayload) => ({
|
||||
type: ReduxActionTypes.INITIALIZE_PAGE_VIEWER,
|
||||
payload: {
|
||||
|
|
@ -44,7 +41,6 @@ export const initAppViewer = ({
|
|||
applicationId,
|
||||
pageId,
|
||||
mode,
|
||||
shouldInitialiseUserDetails,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -9,23 +9,19 @@ import {
|
|||
import type { JSCollection } from "entities/JSCollection";
|
||||
import type { CreateJSCollectionRequest } from "@appsmith/api/JSActionAPI";
|
||||
import type { EventLocation } from "@appsmith/utils/analyticsUtilTypes";
|
||||
import type { ApiResponse } from "api/ApiResponses";
|
||||
|
||||
export interface FetchJSCollectionsPayload {
|
||||
applicationId: string;
|
||||
publishedActionCollections?: ApiResponse<JSCollection[]>;
|
||||
}
|
||||
|
||||
export const fetchJSCollections = ({
|
||||
applicationId,
|
||||
unpublishedActionCollections,
|
||||
}: {
|
||||
applicationId: string;
|
||||
unpublishedActionCollections?: ApiResponse<JSCollection[]>;
|
||||
}): EvaluationReduxAction<unknown> => {
|
||||
return {
|
||||
type: ReduxActionTypes.FETCH_JS_ACTIONS_INIT,
|
||||
payload: { applicationId, unpublishedActionCollections },
|
||||
payload: { applicationId },
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -150,14 +146,12 @@ export const fetchJSCollectionsForPageError = () => {
|
|||
|
||||
export const fetchJSCollectionsForView = ({
|
||||
applicationId,
|
||||
publishedActionCollections,
|
||||
}: {
|
||||
applicationId: string;
|
||||
publishedActionCollections?: ApiResponse<JSCollection[]>;
|
||||
}): ReduxAction<FetchJSCollectionsPayload> => {
|
||||
return {
|
||||
type: ReduxActionTypes.FETCH_JS_ACTIONS_VIEW_MODE_INIT,
|
||||
payload: { applicationId, publishedActionCollections },
|
||||
payload: { applicationId },
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import AnalyticsUtil from "utils/AnalyticsUtil";
|
|||
import type { WidgetOperation } from "widgets/BaseWidget";
|
||||
import type {
|
||||
FetchPageRequest,
|
||||
FetchPageResponse,
|
||||
PageLayout,
|
||||
SavePageResponse,
|
||||
UpdatePageRequest,
|
||||
|
|
@ -549,21 +548,18 @@ export const resetApplicationWidgets = () => ({
|
|||
type: ReduxActionTypes.RESET_APPLICATION_WIDGET_STATE_REQUEST,
|
||||
});
|
||||
|
||||
export const fetchPageDSLs = (payload?: any) => ({
|
||||
export const fetchPageDSLs = () => ({
|
||||
type: ReduxActionTypes.POPULATE_PAGEDSLS_INIT,
|
||||
payload,
|
||||
});
|
||||
|
||||
export const setupPage = (
|
||||
pageId: string,
|
||||
isFirstLoad = false,
|
||||
pageWithMigratedDsl?: FetchPageResponse,
|
||||
): ReduxAction<FetchPageRequest> => ({
|
||||
type: ReduxActionTypes.SETUP_PAGE_INIT,
|
||||
payload: {
|
||||
id: pageId,
|
||||
isFirstLoad,
|
||||
pageWithMigratedDsl,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -571,13 +567,11 @@ export const setupPublishedPage = (
|
|||
pageId: string,
|
||||
bustCache = false,
|
||||
firstLoad = false,
|
||||
pageWithMigratedDsl?: FetchPageResponse,
|
||||
) => ({
|
||||
type: ReduxActionTypes.SETUP_PUBLISHED_PAGE_INIT,
|
||||
payload: {
|
||||
pageId,
|
||||
bustCache,
|
||||
firstLoad,
|
||||
pageWithMigratedDsl,
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -10,13 +10,11 @@ import {
|
|||
ReduxActionErrorTypes,
|
||||
ReduxActionTypes,
|
||||
} from "@appsmith/constants/ReduxActionConstants";
|
||||
import type { Action, ActionViewMode } from "entities/Action";
|
||||
import type { Action } from "entities/Action";
|
||||
import { batchAction } from "actions/batchActions";
|
||||
import type { ExecuteErrorPayload } from "constants/AppsmithActionConstants/ActionConstants";
|
||||
import type { ModalInfo } from "reducers/uiReducers/modalActionReducer";
|
||||
import type { OtlpSpan } from "UITelemetry/generateTraces";
|
||||
import type { ApiResponse } from "api/ApiResponses";
|
||||
import type { JSCollection } from "entities/JSCollection";
|
||||
|
||||
export const createActionRequest = (payload: Partial<Action>) => {
|
||||
return {
|
||||
|
|
@ -34,36 +32,27 @@ export const createActionSuccess = (payload: Action) => {
|
|||
|
||||
export interface FetchActionsPayload {
|
||||
applicationId: string;
|
||||
publishedActions?: ApiResponse<ActionViewMode[]>;
|
||||
publishedActionCollections?: ApiResponse<JSCollection[]>;
|
||||
unpublishedActionCollections?: ApiResponse<JSCollection[]>;
|
||||
unpublishedActions?: ApiResponse<Action[]>;
|
||||
}
|
||||
|
||||
export const fetchActions = (
|
||||
{
|
||||
applicationId,
|
||||
unpublishedActions,
|
||||
}: { applicationId: string; unpublishedActions?: ApiResponse<Action[]> },
|
||||
{ applicationId }: { applicationId: string },
|
||||
postEvalActions: Array<AnyReduxAction>,
|
||||
): EvaluationReduxAction<unknown> => {
|
||||
return {
|
||||
type: ReduxActionTypes.FETCH_ACTIONS_INIT,
|
||||
payload: { applicationId, unpublishedActions },
|
||||
payload: { applicationId },
|
||||
postEvalActions,
|
||||
};
|
||||
};
|
||||
|
||||
export const fetchActionsForView = ({
|
||||
applicationId,
|
||||
publishedActions,
|
||||
}: {
|
||||
applicationId: string;
|
||||
publishedActions?: ApiResponse<ActionViewMode[]>;
|
||||
}): ReduxAction<FetchActionsPayload> => {
|
||||
return {
|
||||
type: ReduxActionTypes.FETCH_ACTIONS_VIEW_MODE_INIT,
|
||||
payload: { applicationId, publishedActions },
|
||||
payload: { applicationId },
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -6,26 +6,18 @@ import {
|
|||
ReduxActionTypes,
|
||||
ReduxActionErrorTypes,
|
||||
} from "@appsmith/constants/ReduxActionConstants";
|
||||
import type { ApiResponse } from "api/ApiResponses";
|
||||
import type { PluginFormPayload } from "api/PluginApi";
|
||||
import type { DependencyMap } from "utils/DynamicBindingUtils";
|
||||
import type { Plugin } from "api/PluginApi";
|
||||
|
||||
export const fetchPlugins = (payload?: {
|
||||
workspaceId?: string;
|
||||
plugins?: ApiResponse<Plugin[]>;
|
||||
}): ReduxAction<{ workspaceId?: string } | undefined> => ({
|
||||
type: ReduxActionTypes.FETCH_PLUGINS_REQUEST,
|
||||
payload,
|
||||
});
|
||||
|
||||
export const fetchPluginFormConfigs = (
|
||||
pluginFormConfigs?: ApiResponse<PluginFormPayload>[],
|
||||
): ReduxAction<{
|
||||
pluginFormConfigs?: ApiResponse<PluginFormPayload>[];
|
||||
}> => ({
|
||||
export const fetchPluginFormConfigs = (): ReduxActionWithoutPayload => ({
|
||||
type: ReduxActionTypes.FETCH_PLUGIN_FORM_CONFIGS_REQUEST,
|
||||
payload: { pluginFormConfigs },
|
||||
});
|
||||
|
||||
export interface PluginFormsPayload {
|
||||
|
|
|
|||
|
|
@ -10,11 +10,9 @@ import type {
|
|||
} from "@appsmith/api/UserApi";
|
||||
import type { FeatureFlags } from "@appsmith/entities/FeatureFlag";
|
||||
import type {
|
||||
ProductAlert,
|
||||
ProductAlertConfig,
|
||||
ProductAlertState,
|
||||
} from "reducers/uiReducers/usersReducer";
|
||||
import type { ApiResponse } from "api/ApiResponses";
|
||||
|
||||
export const logoutUser = (payload?: { redirectURL: string }) => ({
|
||||
type: ReduxActionTypes.LOGOUT_USER_INIT,
|
||||
|
|
@ -105,13 +103,8 @@ export const leaveWorkspace = (workspaceId: string) => {
|
|||
};
|
||||
};
|
||||
|
||||
export const fetchFeatureFlagsInit = (
|
||||
featureFlags?: ApiResponse<FeatureFlags>,
|
||||
) => ({
|
||||
export const fetchFeatureFlagsInit = () => ({
|
||||
type: ReduxActionTypes.FETCH_FEATURE_FLAGS_INIT,
|
||||
payload: {
|
||||
featureFlags,
|
||||
},
|
||||
});
|
||||
|
||||
export const fetchFeatureFlagsSuccess = (payload: FeatureFlags) => ({
|
||||
|
|
@ -124,13 +117,8 @@ export const fetchFeatureFlagsError = (error: any) => ({
|
|||
payload: { error, show: false },
|
||||
});
|
||||
|
||||
export const fetchProductAlertInit = (
|
||||
productAlert?: ApiResponse<ProductAlert>,
|
||||
) => ({
|
||||
export const fetchProductAlertInit = () => ({
|
||||
type: ReduxActionTypes.FETCH_PRODUCT_ALERT_INIT,
|
||||
payload: {
|
||||
productAlert,
|
||||
},
|
||||
});
|
||||
|
||||
export const fetchProductAlertSuccess = (productAlert: ProductAlertState) => ({
|
||||
|
|
|
|||
|
|
@ -1,24 +0,0 @@
|
|||
import Api from "./Api";
|
||||
import type { AxiosPromise } from "axios";
|
||||
import type { ApiResponse } from "api/ApiResponses";
|
||||
|
||||
import type { InitConsolidatedApi } from "sagas/InitSagas";
|
||||
|
||||
class ConsolidatedPageLoadApi extends Api {
|
||||
static url = "/v1/consolidated-api";
|
||||
|
||||
static async getConsolidatedPageLoadDataView(params: {
|
||||
applicationId?: string;
|
||||
defaultPageId?: string;
|
||||
}): Promise<AxiosPromise<ApiResponse<InitConsolidatedApi>>> {
|
||||
return Api.get(ConsolidatedPageLoadApi.url + "/view", params);
|
||||
}
|
||||
static async getConsolidatedPageLoadDataEdit(params: {
|
||||
applicationId?: string;
|
||||
defaultPageId?: string;
|
||||
}): Promise<AxiosPromise<ApiResponse<InitConsolidatedApi>>> {
|
||||
return Api.get(ConsolidatedPageLoadApi.url + "/edit", params);
|
||||
}
|
||||
}
|
||||
|
||||
export default ConsolidatedPageLoadApi;
|
||||
|
|
@ -18,7 +18,6 @@ export interface FetchPageRequest {
|
|||
isFirstLoad?: boolean;
|
||||
handleResponseLater?: boolean;
|
||||
migrateDSL?: boolean;
|
||||
pageWithMigratedDsl?: FetchPageResponse;
|
||||
}
|
||||
|
||||
export interface FetchPublishedPageRequest {
|
||||
|
|
|
|||
|
|
@ -41,11 +41,13 @@ import ErrorPage from "pages/common/ErrorPage";
|
|||
import PageNotFound from "pages/common/ErrorPages/PageNotFound";
|
||||
import PageLoadingBar from "pages/common/PageLoadingBar";
|
||||
import ErrorPageHeader from "pages/common/ErrorPageHeader";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import type { AppState } from "@appsmith/reducers";
|
||||
import { connect, useSelector } from "react-redux";
|
||||
|
||||
import * as Sentry from "@sentry/react";
|
||||
import { getSafeCrash, getSafeCrashCode } from "selectors/errorSelectors";
|
||||
import UserProfile from "pages/UserProfile";
|
||||
import { getCurrentUser } from "actions/authActions";
|
||||
import {
|
||||
getCurrentUserLoading,
|
||||
getFeatureFlagsFetching,
|
||||
|
|
@ -55,6 +57,11 @@ import SettingsLoader from "pages/AdminSettings/loader";
|
|||
import SignupSuccess from "pages/setup/SignupSuccess";
|
||||
import type { ERROR_CODES } from "@appsmith/constants/ApiConstants";
|
||||
import TemplatesListLoader from "pages/Templates/loader";
|
||||
import {
|
||||
fetchFeatureFlagsInit,
|
||||
fetchProductAlertInit,
|
||||
} from "actions/userActions";
|
||||
import { getCurrentTenant } from "@appsmith/actions/tenantActions";
|
||||
import { getCurrentUser as getCurrentUserSelector } from "selectors/usersSelectors";
|
||||
import {
|
||||
getTenantPermissions,
|
||||
|
|
@ -70,7 +77,6 @@ import { getAdminSettingsPath } from "@appsmith/utils/BusinessFeatures/adminSett
|
|||
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
|
||||
import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag";
|
||||
import CustomWidgetBuilderLoader from "pages/Editor/CustomWidgetBuilder/loader";
|
||||
import { getIsConsolidatedPageLoading } from "selectors/ui";
|
||||
|
||||
export const SentryRoute = Sentry.withSentryRouting(Route);
|
||||
|
||||
|
|
@ -153,53 +159,65 @@ export function Routes() {
|
|||
);
|
||||
}
|
||||
|
||||
export default function AppRouter() {
|
||||
const safeCrash: boolean = useSelector(getSafeCrash);
|
||||
const safeCrashCode: ERROR_CODES | undefined = useSelector(getSafeCrashCode);
|
||||
function AppRouter(props: {
|
||||
safeCrash: boolean;
|
||||
getCurrentUser: () => void;
|
||||
getFeatureFlags: () => void;
|
||||
getCurrentTenant: () => void;
|
||||
initCurrentPage: () => void;
|
||||
fetchProductAlert: () => void;
|
||||
safeCrashCode?: ERROR_CODES;
|
||||
}) {
|
||||
const {
|
||||
fetchProductAlert,
|
||||
getCurrentTenant,
|
||||
getCurrentUser,
|
||||
getFeatureFlags,
|
||||
initCurrentPage,
|
||||
} = props;
|
||||
const tenantIsLoading = useSelector(isTenantLoading);
|
||||
const currentUserIsLoading = useSelector(getCurrentUserLoading);
|
||||
const featuresIsLoading = useSelector(getFeatureFlagsFetching);
|
||||
const isConsolidatedPageLoading = useSelector(getIsConsolidatedPageLoading);
|
||||
const dispatch = useDispatch();
|
||||
const isConsolidatedFetchEnabled = useFeatureFlag(
|
||||
FEATURE_FLAG.rollout_consolidated_page_load_fetch_enabled,
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(initCurrentPage());
|
||||
getCurrentUser();
|
||||
getFeatureFlags();
|
||||
getCurrentTenant();
|
||||
initCurrentPage();
|
||||
fetchProductAlert();
|
||||
}, []);
|
||||
|
||||
useBrandingTheme();
|
||||
|
||||
let isLoading: boolean;
|
||||
if (isConsolidatedFetchEnabled) {
|
||||
isLoading = isConsolidatedPageLoading;
|
||||
} else {
|
||||
isLoading = tenantIsLoading || currentUserIsLoading || featuresIsLoading;
|
||||
}
|
||||
// hide the top loader once the tenant is loaded
|
||||
useEffect(() => {
|
||||
if (!isLoading) {
|
||||
if (
|
||||
tenantIsLoading === false &&
|
||||
currentUserIsLoading === false &&
|
||||
featuresIsLoading === false
|
||||
) {
|
||||
const loader = document.getElementById("loader") as HTMLDivElement;
|
||||
|
||||
if (loader) {
|
||||
loader.style.width = "100vw";
|
||||
|
||||
setTimeout(() => {
|
||||
loader.style.opacity = "0";
|
||||
});
|
||||
}
|
||||
}
|
||||
}, [isLoading]);
|
||||
}, [tenantIsLoading, currentUserIsLoading, featuresIsLoading]);
|
||||
|
||||
if (isLoading) return null;
|
||||
if (tenantIsLoading || currentUserIsLoading || featuresIsLoading) return null;
|
||||
|
||||
return (
|
||||
<Router history={history}>
|
||||
<Suspense fallback={loadingIndicator}>
|
||||
<RouteChangeListener />
|
||||
{safeCrash && safeCrashCode ? (
|
||||
{props.safeCrash && props.safeCrashCode ? (
|
||||
<>
|
||||
<ErrorPageHeader />
|
||||
<ErrorPage code={safeCrashCode} />
|
||||
<ErrorPage code={props.safeCrashCode} />
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
|
|
@ -214,3 +232,18 @@ export default function AppRouter() {
|
|||
</Router>
|
||||
);
|
||||
}
|
||||
|
||||
export const mapStateToProps = (state: AppState) => ({
|
||||
safeCrash: getSafeCrash(state),
|
||||
safeCrashCode: getSafeCrashCode(state),
|
||||
});
|
||||
|
||||
export const mapDispatchToProps = (dispatch: any) => ({
|
||||
getCurrentUser: () => dispatch(getCurrentUser()),
|
||||
getFeatureFlags: () => dispatch(fetchFeatureFlagsInit()),
|
||||
getCurrentTenant: () => dispatch(getCurrentTenant(false)),
|
||||
initCurrentPage: () => dispatch(initCurrentPage()),
|
||||
fetchProductAlert: () => dispatch(fetchProductAlertInit()),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(AppRouter);
|
||||
|
|
|
|||
|
|
@ -1,15 +1,10 @@
|
|||
import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";
|
||||
import type { UpdateTenantConfigRequest } from "@appsmith/api/TenantApi";
|
||||
import type { ApiResponse } from "api/ApiResponses";
|
||||
|
||||
export const getCurrentTenant = (
|
||||
isBackgroundRequest = true,
|
||||
tenantConfig?: ApiResponse,
|
||||
) => ({
|
||||
export const getCurrentTenant = (isBackgroundRequest = true) => ({
|
||||
type: ReduxActionTypes.FETCH_CURRENT_TENANT_CONFIG,
|
||||
payload: {
|
||||
isBackgroundRequest,
|
||||
tenantConfig,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,6 @@ export interface ApplicationResponsePayload {
|
|||
export interface FetchApplicationPayload {
|
||||
applicationId?: string;
|
||||
pageId?: string;
|
||||
pages?: FetchApplicationResponse;
|
||||
mode: APP_MODE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -923,8 +923,6 @@ const ActionTypes = {
|
|||
UPDATE_THEME_SETTING: "UPDATE_THEME_SETTING",
|
||||
SET_IDE_EDITOR_VIEW_MODE: "SET_IDE_EDITOR_VIEW_MODE",
|
||||
SET_IDE_EDITOR_PAGES_ACTIVE_STATUS: "SET_IDE_EDITOR_PAGES_ACTIVE_STATUS",
|
||||
START_CONSOLIDATED_PAGE_LOAD: "START_CONSOLIDATED_PAGE_LOAD",
|
||||
END_CONSOLIDATED_PAGE_LOAD: "END_CONSOLIDATED_PAGE_LOAD",
|
||||
};
|
||||
|
||||
export const ReduxActionTypes = {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
import type { ReduxAction } from "@appsmith/constants/ReduxActionConstants";
|
||||
import {
|
||||
ReduxActionErrorTypes,
|
||||
ReduxActionTypes,
|
||||
|
|
@ -8,7 +7,6 @@ import type { DependentFeatureFlags } from "@appsmith/selectors/engineSelectors"
|
|||
import { fetchDatasources } from "actions/datasourceActions";
|
||||
import { fetchPageDSLs } from "actions/pageActions";
|
||||
import { fetchPlugins } from "actions/pluginActions";
|
||||
import type { EditConsolidatedApi } from "sagas/InitSagas";
|
||||
|
||||
export const CreateNewActionKey = {
|
||||
PAGE: "pageId",
|
||||
|
|
@ -19,16 +17,10 @@ export const ActionParentEntityType = {
|
|||
} as const;
|
||||
|
||||
export const getPageDependencyActions = (
|
||||
allResponses: EditConsolidatedApi,
|
||||
currentWorkspaceId: string = "",
|
||||
featureFlags: DependentFeatureFlags = {},
|
||||
) => {
|
||||
const { datasources, pagesWithMigratedDsl, plugins } = allResponses || {};
|
||||
const initActions = [
|
||||
fetchPlugins({ plugins }),
|
||||
fetchDatasources({ datasources }),
|
||||
fetchPageDSLs({ pagesWithMigratedDsl }),
|
||||
] as Array<ReduxAction<unknown>>;
|
||||
const initActions = [fetchPlugins(), fetchDatasources(), fetchPageDSLs()];
|
||||
|
||||
const successActions = [
|
||||
ReduxActionTypes.FETCH_PLUGINS_SUCCESS,
|
||||
|
|
|
|||
|
|
@ -48,8 +48,6 @@ export const FEATURE_FLAG = {
|
|||
"ab_one_click_learning_popover_enabled",
|
||||
release_side_by_side_ide_enabled: "release_side_by_side_ide_enabled",
|
||||
release_global_add_pane_enabled: "release_global_add_pane_enabled",
|
||||
rollout_consolidated_page_load_fetch_enabled:
|
||||
"rollout_consolidated_page_load_fetch_enabled",
|
||||
} as const;
|
||||
|
||||
export type FeatureFlag = keyof typeof FEATURE_FLAG;
|
||||
|
|
@ -91,7 +89,6 @@ export const DEFAULT_FEATURE_FLAG_VALUE: FeatureFlags = {
|
|||
ab_one_click_learning_popover_enabled: false,
|
||||
release_side_by_side_ide_enabled: false,
|
||||
release_global_add_pane_enabled: false,
|
||||
rollout_consolidated_page_load_fetch_enabled: false,
|
||||
};
|
||||
|
||||
export const AB_TESTING_EVENT_KEYS = {
|
||||
|
|
|
|||
|
|
@ -81,7 +81,6 @@ import type { IDEState } from "reducers/uiReducers/ideReducer";
|
|||
or done so by a module that is designed to be eventually pluggable */
|
||||
import type { LayoutElementPositionsReduxState } from "layoutSystems/anvil/integrations/reducers/layoutElementPositionsReducer";
|
||||
import type { ActiveField } from "reducers/uiReducers/activeFieldEditorReducer";
|
||||
import type { ConsolidatedPageLoadState } from "reducers/uiReducers/consolidatedPageLoadReducer";
|
||||
|
||||
export const reducerObject = {
|
||||
entities: entityReducer,
|
||||
|
|
@ -95,7 +94,6 @@ export const reducerObject = {
|
|||
|
||||
export interface AppState {
|
||||
ui: {
|
||||
consolidatedPageLoad: ConsolidatedPageLoadState;
|
||||
analytics: AnalyticsReduxState;
|
||||
editor: EditorReduxState;
|
||||
propertyPane: PropertyPaneReduxState;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ import layoutConversionReducer from "reducers/uiReducers/layoutConversionReducer
|
|||
import oneClickBindingReducer from "reducers/uiReducers/oneClickBindingReducer";
|
||||
import activeFieldReducer from "reducers/uiReducers/activeFieldEditorReducer";
|
||||
import ideReducer from "../../../reducers/uiReducers/ideReducer";
|
||||
import consolidatedPageLoadReducer from "reducers/uiReducers/consolidatedPageLoadReducer";
|
||||
|
||||
export const uiReducerObject = {
|
||||
analytics: analyticsReducer,
|
||||
|
|
@ -105,5 +104,4 @@ export const uiReducerObject = {
|
|||
oneClickBinding: oneClickBindingReducer,
|
||||
activeField: activeFieldReducer,
|
||||
ide: ideReducer,
|
||||
consolidatedPageLoad: consolidatedPageLoadReducer,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -136,7 +136,6 @@ import { selectFeatureFlagCheck } from "@appsmith/selectors/featureFlagsSelector
|
|||
import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag";
|
||||
import { LayoutSystemTypes } from "layoutSystems/types";
|
||||
import equal from "fast-deep-equal";
|
||||
import { getFromServerWhenNoPrefetchedResult } from "sagas/helper";
|
||||
|
||||
export const getDefaultPageId = (
|
||||
pages?: ApplicationPagePayload[],
|
||||
|
|
@ -269,20 +268,18 @@ export function* getAllApplicationSaga() {
|
|||
});
|
||||
}
|
||||
}
|
||||
// v1
|
||||
|
||||
export function* fetchAppAndPagesSaga(
|
||||
action: ReduxAction<FetchApplicationPayload>,
|
||||
) {
|
||||
try {
|
||||
const { pages, ...payload } = action.payload;
|
||||
const params = pickBy(payload, identity);
|
||||
const params = pickBy(action.payload, identity);
|
||||
if (params.pageId && params.applicationId) {
|
||||
delete params.applicationId;
|
||||
}
|
||||
const response: FetchApplicationResponse = yield call(
|
||||
getFromServerWhenNoPrefetchedResult,
|
||||
pages,
|
||||
() => call(PageApi.fetchAppAndPages, params),
|
||||
PageApi.fetchAppAndPages,
|
||||
params,
|
||||
);
|
||||
const isValidResponse: boolean = yield call(validateResponse, response);
|
||||
if (isValidResponse) {
|
||||
|
|
|
|||
|
|
@ -63,10 +63,7 @@ import {
|
|||
} from "@appsmith/RouteBuilder";
|
||||
import type { EventLocation } from "@appsmith/utils/analyticsUtilTypes";
|
||||
import AnalyticsUtil from "utils/AnalyticsUtil";
|
||||
import {
|
||||
checkAndLogErrorsIfCyclicDependency,
|
||||
getFromServerWhenNoPrefetchedResult,
|
||||
} from "../../sagas/helper";
|
||||
import { checkAndLogErrorsIfCyclicDependency } from "../../sagas/helper";
|
||||
import { toast } from "design-system";
|
||||
import { updateAndSaveLayout } from "actions/pageActions";
|
||||
import type { CanvasWidgetsReduxState } from "reducers/entityReducers/canvasWidgetsReducer";
|
||||
|
|
@ -82,14 +79,9 @@ import type { JSCollectionDataState } from "@appsmith/reducers/entityReducers/js
|
|||
export function* fetchJSCollectionsSaga(
|
||||
action: EvaluationReduxAction<FetchActionsPayload>,
|
||||
) {
|
||||
const { unpublishedActionCollections, ...payload } = action.payload;
|
||||
try {
|
||||
const response: ApiResponse<JSCollection[]> = yield call(
|
||||
getFromServerWhenNoPrefetchedResult,
|
||||
unpublishedActionCollections,
|
||||
async () => JSActionAPI.fetchJSCollections(payload),
|
||||
);
|
||||
|
||||
const response: ApiResponse<JSCollection[]> =
|
||||
yield JSActionAPI.fetchJSCollections(action.payload);
|
||||
yield put({
|
||||
type: ReduxActionTypes.FETCH_JS_ACTIONS_SUCCESS,
|
||||
payload: response.data || [],
|
||||
|
|
@ -503,15 +495,10 @@ export function* fetchJSCollectionsForPageSaga(
|
|||
export function* fetchJSCollectionsForViewModeSaga(
|
||||
action: ReduxAction<FetchActionsPayload>,
|
||||
) {
|
||||
const { applicationId, publishedActionCollections } = action.payload;
|
||||
|
||||
const { applicationId } = action.payload;
|
||||
try {
|
||||
const response: ApiResponse<JSCollection[]> = yield call(
|
||||
getFromServerWhenNoPrefetchedResult,
|
||||
publishedActionCollections,
|
||||
async () => JSActionAPI.fetchJSCollectionsForViewMode(applicationId),
|
||||
);
|
||||
|
||||
const response: ApiResponse<JSCollection[]> =
|
||||
yield JSActionAPI.fetchJSCollectionsForViewMode(applicationId);
|
||||
const resultJSCollections = response.data;
|
||||
const isValidResponse: boolean = yield validateResponse(response);
|
||||
if (isValidResponse) {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ import type {
|
|||
FetchPageListResponse,
|
||||
FetchPageRequest,
|
||||
FetchPageResponse,
|
||||
FetchPageResponseData,
|
||||
FetchPublishedPageRequest,
|
||||
GenerateTemplatePageRequest,
|
||||
PageLayout,
|
||||
|
|
@ -124,10 +123,7 @@ import {
|
|||
waitForWidgetConfigBuild,
|
||||
} from "../../sagas/InitSagas";
|
||||
import { resizePublishedMainCanvasToLowestWidget } from "../../sagas/WidgetOperationUtils";
|
||||
import {
|
||||
checkAndLogErrorsIfCyclicDependency,
|
||||
getFromServerWhenNoPrefetchedResult,
|
||||
} from "../../sagas/helper";
|
||||
import { checkAndLogErrorsIfCyclicDependency } from "../../sagas/helper";
|
||||
import { LOCAL_STORAGE_KEYS } from "utils/localStorage";
|
||||
import { generateAutoHeightLayoutTreeAction } from "actions/autoHeightActions";
|
||||
import { getUsedActionNames } from "selectors/actionSelectors";
|
||||
|
|
@ -379,23 +375,22 @@ export function* fetchPageSaga(
|
|||
pageRequestAction: ReduxAction<FetchPageRequest>,
|
||||
) {
|
||||
try {
|
||||
const { id, isFirstLoad, pageWithMigratedDsl } = pageRequestAction.payload;
|
||||
const { id, isFirstLoad } = pageRequestAction.payload;
|
||||
PerformanceTracker.startAsyncTracking(
|
||||
PerformanceTransactionName.FETCH_PAGE_API,
|
||||
{ pageId: id },
|
||||
);
|
||||
|
||||
const isServerDSLMigrationsEnabled = select(
|
||||
getIsServerDSLMigrationsEnabled,
|
||||
);
|
||||
|
||||
const params: FetchPageRequest = { id };
|
||||
if (isServerDSLMigrationsEnabled) {
|
||||
params.migrateDSL = true;
|
||||
}
|
||||
const fetchPageResponse: FetchPageResponse = yield call(
|
||||
getFromServerWhenNoPrefetchedResult,
|
||||
pageWithMigratedDsl,
|
||||
() => call(PageApi.fetchPage, params),
|
||||
PageApi.fetchPage,
|
||||
params,
|
||||
);
|
||||
|
||||
yield handleFetchedPage({
|
||||
|
|
@ -429,12 +424,10 @@ export function* fetchPublishedPageSaga(
|
|||
pageId: string;
|
||||
bustCache: boolean;
|
||||
firstLoad: boolean;
|
||||
pageWithMigratedDsl?: FetchPageResponse;
|
||||
}>,
|
||||
) {
|
||||
try {
|
||||
const { bustCache, firstLoad, pageId, pageWithMigratedDsl } =
|
||||
pageRequestAction.payload;
|
||||
const { bustCache, firstLoad, pageId } = pageRequestAction.payload;
|
||||
PerformanceTracker.startAsyncTracking(
|
||||
PerformanceTransactionName.FETCH_PAGE_API,
|
||||
{
|
||||
|
|
@ -446,13 +439,10 @@ export function* fetchPublishedPageSaga(
|
|||
pageId,
|
||||
bustCache,
|
||||
};
|
||||
|
||||
const response: FetchPageResponse = yield call(
|
||||
getFromServerWhenNoPrefetchedResult,
|
||||
pageWithMigratedDsl,
|
||||
() => call(PageApi.fetchPublishedPage, request),
|
||||
PageApi.fetchPublishedPage,
|
||||
request,
|
||||
);
|
||||
|
||||
const isValidResponse: boolean = yield validateResponse(response);
|
||||
if (isValidResponse) {
|
||||
// Clear any existing caches
|
||||
|
|
@ -1199,10 +1189,7 @@ export function* setDataUrl() {
|
|||
yield put(setUrlData(urlData));
|
||||
}
|
||||
|
||||
export function* fetchPageDSLSaga(
|
||||
pageId: string,
|
||||
pageDSL?: ApiResponse<FetchPageResponseData>,
|
||||
) {
|
||||
export function* fetchPageDSLSaga(pageId: string) {
|
||||
try {
|
||||
const layoutSystemType: LayoutSystemTypes =
|
||||
yield select(getLayoutSystemType);
|
||||
|
|
@ -1220,11 +1207,9 @@ export function* fetchPageDSLSaga(
|
|||
params.migrateDSL = true;
|
||||
}
|
||||
const fetchPageResponse: FetchPageResponse = yield call(
|
||||
getFromServerWhenNoPrefetchedResult,
|
||||
pageDSL,
|
||||
() => call(PageApi.fetchPage, params),
|
||||
PageApi.fetchPage,
|
||||
params,
|
||||
);
|
||||
|
||||
const isValidResponse: boolean = yield validateResponse(fetchPageResponse);
|
||||
if (isValidResponse) {
|
||||
// Wait for the Widget config to be loaded before we can migrate the DSL
|
||||
|
|
@ -1264,25 +1249,14 @@ export function* fetchPageDSLSaga(
|
|||
}
|
||||
}
|
||||
|
||||
export function* populatePageDSLsSaga(action?: {
|
||||
payload?: { pagesWithMigratedDsl?: ApiResponse<FetchPageResponseData[]> };
|
||||
}) {
|
||||
const { pagesWithMigratedDsl } = action?.payload || {};
|
||||
export function* populatePageDSLsSaga() {
|
||||
try {
|
||||
const pageIds: string[] = yield select((state: AppState) =>
|
||||
state.entities.pageList.pages.map((page: Page) => page.pageId),
|
||||
);
|
||||
const pageDSLs: unknown = yield all(
|
||||
pageIds.map((pageId: string) => {
|
||||
if (!pagesWithMigratedDsl) {
|
||||
return call(fetchPageDSLSaga, pageId);
|
||||
}
|
||||
const { data } = pagesWithMigratedDsl;
|
||||
const v1PageDSL = data?.find?.((v: any) => v?.id === pageId);
|
||||
return call(fetchPageDSLSaga, pageId, {
|
||||
...pagesWithMigratedDsl,
|
||||
data: v1PageDSL,
|
||||
} as ApiResponse<FetchPageResponseData>);
|
||||
return call(fetchPageDSLSaga, pageId);
|
||||
}),
|
||||
);
|
||||
yield put({
|
||||
|
|
@ -1463,11 +1437,11 @@ export function* setPreviewModeInitSaga(action: ReduxAction<boolean>) {
|
|||
|
||||
export function* setupPageSaga(action: ReduxAction<FetchPageRequest>) {
|
||||
try {
|
||||
const { id, isFirstLoad, pageWithMigratedDsl } = action.payload;
|
||||
const { id, isFirstLoad } = action.payload;
|
||||
|
||||
yield call(fetchPageSaga, {
|
||||
type: ReduxActionTypes.FETCH_PAGE_INIT,
|
||||
payload: { id, isFirstLoad, pageWithMigratedDsl },
|
||||
payload: { id, isFirstLoad },
|
||||
});
|
||||
|
||||
yield put({
|
||||
|
|
@ -1486,16 +1460,14 @@ export function* setupPublishedPageSaga(
|
|||
pageId: string;
|
||||
bustCache: boolean;
|
||||
firstLoad: boolean;
|
||||
pageWithMigratedDsl?: FetchPageResponse;
|
||||
}>,
|
||||
) {
|
||||
try {
|
||||
const { bustCache, firstLoad, pageId, pageWithMigratedDsl } =
|
||||
action.payload;
|
||||
const { bustCache, firstLoad, pageId } = action.payload;
|
||||
|
||||
yield call(fetchPublishedPageSaga, {
|
||||
type: ReduxActionTypes.FETCH_PUBLISHED_PAGE_INIT,
|
||||
payload: { bustCache, firstLoad, pageId, pageWithMigratedDsl },
|
||||
payload: { bustCache, firstLoad, pageId },
|
||||
});
|
||||
|
||||
yield put({
|
||||
|
|
|
|||
|
|
@ -13,20 +13,13 @@ import { ERROR_CODES } from "@appsmith/constants/ApiConstants";
|
|||
import { defaultBrandingConfig as CE_defaultBrandingConfig } from "@appsmith/reducers/tenantReducer";
|
||||
import { toast } from "design-system";
|
||||
import AnalyticsUtil from "utils/AnalyticsUtil";
|
||||
import { getFromServerWhenNoPrefetchedResult } from "sagas/helper";
|
||||
|
||||
// On CE we don't expose tenant config so this shouldn't make any API calls and should just return necessary permissions for the user
|
||||
export function* fetchCurrentTenantConfigSaga(action?: {
|
||||
payload?: { tenantConfig?: ApiResponse };
|
||||
}) {
|
||||
const tenantConfig = action?.payload?.tenantConfig;
|
||||
export function* fetchCurrentTenantConfigSaga() {
|
||||
try {
|
||||
const response: ApiResponse = yield call(
|
||||
getFromServerWhenNoPrefetchedResult,
|
||||
tenantConfig,
|
||||
() => call(TenantApi.fetchCurrentTenantConfig),
|
||||
TenantApi.fetchCurrentTenantConfig,
|
||||
);
|
||||
|
||||
const isValidResponse: boolean = yield validateResponse(response);
|
||||
if (isValidResponse) {
|
||||
const data: any = response.data;
|
||||
|
|
|
|||
|
|
@ -90,7 +90,6 @@ import type {
|
|||
ProductAlertConfig,
|
||||
} from "reducers/uiReducers/usersReducer";
|
||||
import { selectFeatureFlags } from "@appsmith/selectors/featureFlagsSelectors";
|
||||
import { getFromServerWhenNoPrefetchedResult } from "sagas/helper";
|
||||
|
||||
export function* createUserSaga(
|
||||
action: ReduxActionWithPromise<CreateUserRequest>,
|
||||
|
|
@ -149,19 +148,12 @@ export function* waitForSegmentInit(skipWithAnonymousId: boolean) {
|
|||
}
|
||||
}
|
||||
|
||||
export function* getCurrentUserSaga(action?: {
|
||||
payload?: { userProfile?: ApiResponse };
|
||||
}) {
|
||||
const userProfile = action?.payload?.userProfile;
|
||||
export function* getCurrentUserSaga() {
|
||||
try {
|
||||
PerformanceTracker.startAsyncTracking(
|
||||
PerformanceTransactionName.USER_ME_API,
|
||||
);
|
||||
const response: ApiResponse = yield call(
|
||||
getFromServerWhenNoPrefetchedResult,
|
||||
userProfile,
|
||||
() => call(UserApi.getCurrentUser),
|
||||
);
|
||||
const response: ApiResponse = yield call(UserApi.getCurrentUser);
|
||||
|
||||
const isValidResponse: boolean = yield validateResponse(response);
|
||||
|
||||
|
|
@ -542,17 +534,11 @@ export function* updatePhoto(
|
|||
}
|
||||
}
|
||||
|
||||
export function* fetchFeatureFlags(action?: {
|
||||
payload?: { featureFlags?: ApiResponse<FeatureFlags> };
|
||||
}) {
|
||||
const featureFlags = action?.payload?.featureFlags;
|
||||
export function* fetchFeatureFlags() {
|
||||
try {
|
||||
const response: ApiResponse<FeatureFlags> = yield call(
|
||||
getFromServerWhenNoPrefetchedResult,
|
||||
featureFlags,
|
||||
() => call(UserApi.fetchFeatureFlags),
|
||||
UserApi.fetchFeatureFlags,
|
||||
);
|
||||
|
||||
const isValidResponse: boolean = yield validateResponse(response);
|
||||
if (isValidResponse) {
|
||||
yield put(
|
||||
|
|
@ -608,17 +594,11 @@ export function* leaveWorkspaceSaga(
|
|||
}
|
||||
}
|
||||
|
||||
export function* fetchProductAlertSaga(action?: {
|
||||
payload?: { productAlert?: ApiResponse<ProductAlert> };
|
||||
}) {
|
||||
const productAlert = action?.payload?.productAlert;
|
||||
export function* fetchProductAlertSaga() {
|
||||
try {
|
||||
const response: ApiResponse<ProductAlert> = yield call(
|
||||
getFromServerWhenNoPrefetchedResult,
|
||||
productAlert,
|
||||
() => call(UserApi.getProductAlert),
|
||||
UserApi.getProductAlert,
|
||||
);
|
||||
|
||||
const isValidResponse: boolean = yield validateResponse(response);
|
||||
if (isValidResponse) {
|
||||
const message = response.data;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,10 @@ import {
|
|||
fetchActions,
|
||||
} from "actions/pluginActionActions";
|
||||
import { fetchPluginFormConfigs } from "actions/pluginActions";
|
||||
import type { ApplicationPayload } from "@appsmith/constants/ReduxActionConstants";
|
||||
import type {
|
||||
ApplicationPayload,
|
||||
ReduxAction,
|
||||
} from "@appsmith/constants/ReduxActionConstants";
|
||||
import {
|
||||
ReduxActionErrorTypes,
|
||||
ReduxActionTypes,
|
||||
|
|
@ -26,7 +29,6 @@ import {
|
|||
import { addBranchParam } from "constants/routes";
|
||||
import type { APP_MODE } from "entities/App";
|
||||
import { call, fork, put, select, spawn } from "redux-saga/effects";
|
||||
import type { EditConsolidatedApi } from "sagas/InitSagas";
|
||||
import {
|
||||
failFastApiCalls,
|
||||
reportSWStatus,
|
||||
|
|
@ -61,16 +63,16 @@ import { trackOpenEditorTabs } from "../../utils/editor/browserTabsTracking";
|
|||
import { EditorModes } from "components/editorComponents/CodeEditor/EditorConfig";
|
||||
import { waitForFetchEnvironments } from "@appsmith/sagas/EnvironmentSagas";
|
||||
import { getPageDependencyActions } from "@appsmith/entities/Engine/actionHelpers";
|
||||
import { fetchJSCollections } from "actions/jsActionActions";
|
||||
import {
|
||||
fetchAppThemesAction,
|
||||
fetchSelectedAppThemeAction,
|
||||
} from "actions/appThemingActions";
|
||||
import { getCurrentWorkspaceId } from "@appsmith/selectors/workspaceSelectors";
|
||||
import {
|
||||
getFeatureFlagsForEngine,
|
||||
type DependentFeatureFlags,
|
||||
} from "@appsmith/selectors/engineSelectors";
|
||||
import { fetchJSCollections } from "actions/jsActionActions";
|
||||
import {
|
||||
fetchAppThemesAction,
|
||||
fetchSelectedAppThemeAction,
|
||||
} from "actions/appThemingActions";
|
||||
|
||||
export default class AppEditorEngine extends AppEngine {
|
||||
constructor(mode: APP_MODE) {
|
||||
|
|
@ -113,22 +115,13 @@ export default class AppEditorEngine extends AppEngine {
|
|||
private *loadPageThemesAndActions(
|
||||
toLoadPageId: string,
|
||||
applicationId: string,
|
||||
allResponses: EditConsolidatedApi,
|
||||
) {
|
||||
const {
|
||||
currentTheme,
|
||||
customJSLibraries,
|
||||
pageWithMigratedDsl,
|
||||
themes,
|
||||
unpublishedActionCollections,
|
||||
unpublishedActions,
|
||||
} = allResponses;
|
||||
const initActionsCalls = [
|
||||
setupPage(toLoadPageId, true, pageWithMigratedDsl),
|
||||
fetchActions({ applicationId, unpublishedActions }, []),
|
||||
fetchJSCollections({ applicationId, unpublishedActionCollections }),
|
||||
fetchSelectedAppThemeAction(applicationId, currentTheme),
|
||||
fetchAppThemesAction(applicationId, themes),
|
||||
setupPage(toLoadPageId, true),
|
||||
fetchActions({ applicationId }, []),
|
||||
fetchJSCollections({ applicationId }),
|
||||
fetchSelectedAppThemeAction(applicationId),
|
||||
fetchAppThemesAction(applicationId),
|
||||
];
|
||||
|
||||
const successActionEffects = [
|
||||
|
|
@ -147,7 +140,7 @@ export default class AppEditorEngine extends AppEngine {
|
|||
ReduxActionErrorTypes.SETUP_PAGE_ERROR,
|
||||
];
|
||||
|
||||
initActionsCalls.push(fetchJSLibraries(applicationId, customJSLibraries));
|
||||
initActionsCalls.push(fetchJSLibraries(applicationId));
|
||||
successActionEffects.push(ReduxActionTypes.FETCH_JS_LIBRARIES_SUCCESS);
|
||||
|
||||
const allActionCalls: boolean = yield call(
|
||||
|
|
@ -168,19 +161,17 @@ export default class AppEditorEngine extends AppEngine {
|
|||
yield put(fetchAllPageEntityCompletion([executePageLoadActions()]));
|
||||
}
|
||||
|
||||
private *loadPluginsAndDatasources(allResponses: EditConsolidatedApi) {
|
||||
private *loadPluginsAndDatasources() {
|
||||
const isAirgappedInstance = isAirgapped();
|
||||
const currentWorkspaceId: string = yield select(getCurrentWorkspaceId);
|
||||
const featureFlags: DependentFeatureFlags = yield select(
|
||||
getFeatureFlagsForEngine,
|
||||
);
|
||||
const { mockDatasources, pluginFormConfigs } = allResponses || {};
|
||||
|
||||
const { errorActions, initActions, successActions } =
|
||||
getPageDependencyActions(allResponses, currentWorkspaceId, featureFlags);
|
||||
getPageDependencyActions(currentWorkspaceId, featureFlags);
|
||||
|
||||
if (!isAirgappedInstance) {
|
||||
initActions.push(fetchMockDatasources(mockDatasources));
|
||||
initActions.push(fetchMockDatasources() as ReduxAction<{ type: string }>);
|
||||
successActions.push(ReduxActionTypes.FETCH_MOCK_DATASOURCES_SUCCESS);
|
||||
errorActions.push(ReduxActionErrorTypes.FETCH_MOCK_DATASOURCES_ERROR);
|
||||
}
|
||||
|
|
@ -197,7 +188,7 @@ export default class AppEditorEngine extends AppEngine {
|
|||
|
||||
const pluginFormCall: boolean = yield call(
|
||||
failFastApiCalls,
|
||||
[fetchPluginFormConfigs(pluginFormConfigs)],
|
||||
[fetchPluginFormConfigs()],
|
||||
[ReduxActionTypes.FETCH_PLUGIN_FORM_CONFIGS_SUCCESS],
|
||||
[ReduxActionErrorTypes.FETCH_PLUGIN_FORM_CONFIGS_ERROR],
|
||||
);
|
||||
|
|
@ -207,18 +198,9 @@ export default class AppEditorEngine extends AppEngine {
|
|||
);
|
||||
}
|
||||
|
||||
public *loadAppEntities(
|
||||
toLoadPageId: string,
|
||||
applicationId: string,
|
||||
allResponses: EditConsolidatedApi,
|
||||
): any {
|
||||
yield call(
|
||||
this.loadPageThemesAndActions,
|
||||
toLoadPageId,
|
||||
applicationId,
|
||||
allResponses,
|
||||
);
|
||||
yield call(this.loadPluginsAndDatasources, allResponses);
|
||||
public *loadAppEntities(toLoadPageId: string, applicationId: string): any {
|
||||
yield call(this.loadPageThemesAndActions, toLoadPageId, applicationId);
|
||||
yield call(this.loadPluginsAndDatasources);
|
||||
}
|
||||
|
||||
public *completeChore() {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import {
|
|||
} from "@appsmith/constants/ReduxActionConstants";
|
||||
import type { APP_MODE } from "entities/App";
|
||||
import { call, put, spawn } from "redux-saga/effects";
|
||||
import type { DeployConsolidatedApi } from "sagas/InitSagas";
|
||||
import {
|
||||
failFastApiCalls,
|
||||
reportSWStatus,
|
||||
|
|
@ -55,6 +54,11 @@ export default class AppViewerEngine extends AppEngine {
|
|||
yield put({
|
||||
type: ReduxActionTypes.INITIALIZE_PAGE_VIEWER_SUCCESS,
|
||||
});
|
||||
if ("serviceWorker" in navigator) {
|
||||
yield put({
|
||||
type: ReduxActionTypes.FETCH_ALL_PUBLISHED_PAGES,
|
||||
});
|
||||
}
|
||||
yield spawn(reportSWStatus);
|
||||
}
|
||||
|
||||
|
|
@ -74,28 +78,13 @@ export default class AppViewerEngine extends AppEngine {
|
|||
);
|
||||
}
|
||||
|
||||
*loadAppEntities(
|
||||
toLoadPageId: string,
|
||||
applicationId: string,
|
||||
allResponses: DeployConsolidatedApi,
|
||||
): any {
|
||||
const {
|
||||
currentTheme,
|
||||
customJSLibraries,
|
||||
pageWithMigratedDsl,
|
||||
publishedActionCollections,
|
||||
publishedActions,
|
||||
themes,
|
||||
} = allResponses;
|
||||
*loadAppEntities(toLoadPageId: string, applicationId: string): any {
|
||||
const initActionsCalls: any = [
|
||||
fetchActionsForView({ applicationId, publishedActions }),
|
||||
fetchJSCollectionsForView({
|
||||
applicationId,
|
||||
publishedActionCollections,
|
||||
}),
|
||||
fetchSelectedAppThemeAction(applicationId, currentTheme),
|
||||
fetchAppThemesAction(applicationId, themes),
|
||||
setupPublishedPage(toLoadPageId, true, true, pageWithMigratedDsl),
|
||||
fetchActionsForView({ applicationId }),
|
||||
fetchJSCollectionsForView({ applicationId }),
|
||||
fetchSelectedAppThemeAction(applicationId),
|
||||
fetchAppThemesAction(applicationId),
|
||||
setupPublishedPage(toLoadPageId, true, true),
|
||||
];
|
||||
|
||||
const successActionEffects = [
|
||||
|
|
@ -113,7 +102,7 @@ export default class AppViewerEngine extends AppEngine {
|
|||
ReduxActionErrorTypes.SETUP_PUBLISHED_PAGE_ERROR,
|
||||
];
|
||||
|
||||
initActionsCalls.push(fetchJSLibraries(applicationId, customJSLibraries));
|
||||
initActionsCalls.push(fetchJSLibraries(applicationId));
|
||||
successActionEffects.push(ReduxActionTypes.FETCH_JS_LIBRARIES_SUCCESS);
|
||||
failureActionEffects.push(ReduxActionErrorTypes.FETCH_JS_LIBRARIES_FAILED);
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import { getPersistentAppStore } from "constants/AppConstants";
|
|||
import type { APP_MODE } from "entities/App";
|
||||
import log from "loglevel";
|
||||
import { call, put, select } from "redux-saga/effects";
|
||||
import type { InitConsolidatedApi } from "sagas/InitSagas";
|
||||
import { failFastApiCalls } from "sagas/InitSagas";
|
||||
import { getDefaultPageId } from "sagas/selectors";
|
||||
import { getCurrentApplication } from "@appsmith/selectors/applicationSelectors";
|
||||
|
|
@ -24,7 +23,6 @@ export interface AppEnginePayload {
|
|||
pageId?: string;
|
||||
branch?: string;
|
||||
mode: APP_MODE;
|
||||
shouldInitialiseUserDetails?: boolean;
|
||||
}
|
||||
|
||||
export interface IAppEngine {
|
||||
|
|
@ -50,28 +48,16 @@ export default abstract class AppEngine {
|
|||
}
|
||||
private _urlRedirect: URLRedirect | null;
|
||||
|
||||
abstract loadAppEntities(
|
||||
toLoadPageId: string,
|
||||
applicationId: string,
|
||||
allResponses: InitConsolidatedApi,
|
||||
): any;
|
||||
abstract loadAppEntities(toLoadPageId: string, applicationId: string): any;
|
||||
abstract loadGit(applicationId: string): any;
|
||||
abstract startPerformanceTracking(): any;
|
||||
abstract stopPerformanceTracking(): any;
|
||||
abstract completeChore(): any;
|
||||
|
||||
*loadAppData(payload: AppEnginePayload, allResponses: InitConsolidatedApi) {
|
||||
*loadAppData(payload: AppEnginePayload) {
|
||||
const { applicationId, branch, pageId } = payload;
|
||||
const { pages } = allResponses;
|
||||
const apiCalls: boolean = yield failFastApiCalls(
|
||||
[
|
||||
fetchApplication({
|
||||
applicationId,
|
||||
pageId,
|
||||
mode: this._mode,
|
||||
pages,
|
||||
}),
|
||||
],
|
||||
[fetchApplication({ applicationId, pageId, mode: this._mode })],
|
||||
[
|
||||
ReduxActionTypes.FETCH_APPLICATION_SUCCESS,
|
||||
ReduxActionTypes.FETCH_PAGE_LIST_SUCCESS,
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
import { createReducer } from "utils/ReducerUtils";
|
||||
import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";
|
||||
|
||||
const initialState: ConsolidatedPageLoadState = {
|
||||
isLoading: true,
|
||||
};
|
||||
|
||||
const consolidatedPageLoadReducer = createReducer(initialState, {
|
||||
[ReduxActionTypes.START_CONSOLIDATED_PAGE_LOAD]: () => ({
|
||||
isLoading: true,
|
||||
}),
|
||||
[ReduxActionTypes.END_CONSOLIDATED_PAGE_LOAD]: () => ({
|
||||
isLoading: false,
|
||||
}),
|
||||
});
|
||||
|
||||
export interface ConsolidatedPageLoadState {
|
||||
isLoading: boolean;
|
||||
}
|
||||
|
||||
export default consolidatedPageLoadReducer;
|
||||
|
|
@ -117,7 +117,6 @@ import {
|
|||
RequestPayloadAnalyticsPath,
|
||||
checkAndLogErrorsIfCyclicDependency,
|
||||
enhanceRequestPayloadWithEventData,
|
||||
getFromServerWhenNoPrefetchedResult,
|
||||
} from "./helper";
|
||||
import { setSnipingMode as setSnipingModeAction } from "actions/propertyPaneActions";
|
||||
import { toast } from "design-system";
|
||||
|
|
@ -311,18 +310,15 @@ export function* fetchActionDatasourceStructure(
|
|||
export function* fetchActionsSaga(
|
||||
action: EvaluationReduxAction<FetchActionsPayload>,
|
||||
) {
|
||||
const { applicationId, unpublishedActions } = action.payload;
|
||||
const { applicationId } = action.payload;
|
||||
PerformanceTracker.startAsyncTracking(
|
||||
PerformanceTransactionName.FETCH_ACTIONS_API,
|
||||
{ mode: "EDITOR", appId: applicationId },
|
||||
);
|
||||
try {
|
||||
const response: ApiResponse<Action[]> = yield call(
|
||||
getFromServerWhenNoPrefetchedResult,
|
||||
unpublishedActions,
|
||||
async () => ActionAPI.fetchActions({ applicationId }),
|
||||
);
|
||||
|
||||
const response: ApiResponse<Action[]> = yield ActionAPI.fetchActions({
|
||||
applicationId,
|
||||
});
|
||||
const isValidResponse: boolean = yield validateResponse(response);
|
||||
if (isValidResponse) {
|
||||
yield put({
|
||||
|
|
@ -349,18 +345,14 @@ export function* fetchActionsSaga(
|
|||
export function* fetchActionsForViewModeSaga(
|
||||
action: ReduxAction<FetchActionsPayload>,
|
||||
) {
|
||||
const { applicationId, publishedActions } = action.payload;
|
||||
const { applicationId } = action.payload;
|
||||
PerformanceTracker.startAsyncTracking(
|
||||
PerformanceTransactionName.FETCH_ACTIONS_API,
|
||||
{ mode: "VIEWER", appId: applicationId },
|
||||
);
|
||||
try {
|
||||
const response: ApiResponse<ActionViewMode[]> = yield call(
|
||||
getFromServerWhenNoPrefetchedResult,
|
||||
publishedActions,
|
||||
async () => ActionAPI.fetchActionsForViewMode(applicationId),
|
||||
);
|
||||
|
||||
const response: ApiResponse<ActionViewMode[]> =
|
||||
yield ActionAPI.fetchActionsForViewMode(applicationId);
|
||||
const isValidResponse: boolean = yield validateResponse(response);
|
||||
if (isValidResponse) {
|
||||
const correctFormatResponse = response.data.map((action) => {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import {
|
|||
ReduxActionTypes,
|
||||
} from "@appsmith/constants/ReduxActionConstants";
|
||||
import ThemingApi from "api/AppThemingApi";
|
||||
import { all, takeLatest, put, select, call } from "redux-saga/effects";
|
||||
import { all, takeLatest, put, select } from "redux-saga/effects";
|
||||
import { toast } from "design-system";
|
||||
import {
|
||||
CHANGE_APP_THEME,
|
||||
|
|
@ -46,7 +46,6 @@ import { Severity } from "@sentry/react";
|
|||
import { getAllPageIds } from "./selectors";
|
||||
import type { SagaIterator } from "@redux-saga/types";
|
||||
import type { AxiosPromise } from "axios";
|
||||
import { getFromServerWhenNoPrefetchedResult } from "./helper";
|
||||
|
||||
/**
|
||||
* init app theming
|
||||
|
|
@ -74,13 +73,9 @@ export function* initAppTheming() {
|
|||
// eslint-disable-next-line
|
||||
export function* fetchAppThemes(action: ReduxAction<FetchAppThemesAction>) {
|
||||
try {
|
||||
const { applicationId, themes } = action.payload;
|
||||
|
||||
const response: ApiResponse<AppTheme> = yield call(
|
||||
getFromServerWhenNoPrefetchedResult,
|
||||
themes,
|
||||
async () => ThemingApi.fetchThemes(applicationId),
|
||||
);
|
||||
const { applicationId } = action.payload;
|
||||
const response: ApiResponse<AppTheme> =
|
||||
yield ThemingApi.fetchThemes(applicationId);
|
||||
|
||||
yield put({
|
||||
type: ReduxActionTypes.FETCH_APP_THEMES_SUCCESS,
|
||||
|
|
@ -104,19 +99,18 @@ export function* fetchAppSelectedTheme(
|
|||
// eslint-disable-next-line
|
||||
action: ReduxAction<FetchSelectedAppThemeAction>,
|
||||
): SagaIterator | AxiosPromise {
|
||||
const { applicationId, currentTheme } = action.payload;
|
||||
const { applicationId } = action.payload;
|
||||
const mode: APP_MODE = yield select(getAppMode);
|
||||
|
||||
const pageIds = yield select(getAllPageIds);
|
||||
const userDetails = yield select(getCurrentUser);
|
||||
const applicationVersion = yield select(selectApplicationVersion);
|
||||
try {
|
||||
const response: ApiResponse<AppTheme[]> = yield call(
|
||||
getFromServerWhenNoPrefetchedResult,
|
||||
currentTheme,
|
||||
async () => ThemingApi.fetchSelected(applicationId, mode),
|
||||
// eslint-disable-next-line
|
||||
const response: ApiResponse<AppTheme[]> = yield ThemingApi.fetchSelected(
|
||||
applicationId,
|
||||
mode,
|
||||
);
|
||||
|
||||
if (response?.data) {
|
||||
yield put({
|
||||
type: ReduxActionTypes.FETCH_SELECTED_APP_THEME_SUCCESS,
|
||||
|
|
|
|||
|
|
@ -174,24 +174,16 @@ import { selectFeatureFlagCheck } from "@appsmith/selectors/featureFlagsSelector
|
|||
import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag";
|
||||
import { identifyEntityFromPath } from "../navigation/FocusEntity";
|
||||
import { MAX_DATASOURCE_SUGGESTIONS } from "constants/DatasourceEditorConstants";
|
||||
import { getFromServerWhenNoPrefetchedResult } from "./helper";
|
||||
|
||||
function* fetchDatasourcesSaga(
|
||||
action: ReduxAction<
|
||||
| { workspaceId?: string; datasources?: ApiResponse<Datasource[]> }
|
||||
| undefined
|
||||
>,
|
||||
action: ReduxAction<{ workspaceId?: string } | undefined>,
|
||||
) {
|
||||
try {
|
||||
let workspaceId: string = yield select(getCurrentWorkspaceId);
|
||||
if (action.payload?.workspaceId) workspaceId = action.payload?.workspaceId;
|
||||
const datasources = action.payload?.datasources;
|
||||
const response: ApiResponse<Datasource[]> = yield call(
|
||||
getFromServerWhenNoPrefetchedResult,
|
||||
datasources,
|
||||
async () => DatasourcesApi.fetchDatasources(workspaceId),
|
||||
);
|
||||
|
||||
const response: ApiResponse<Datasource[]> =
|
||||
yield DatasourcesApi.fetchDatasources(workspaceId);
|
||||
const isValidResponse: boolean = yield validateResponse(response);
|
||||
if (isValidResponse) {
|
||||
yield put({
|
||||
|
|
@ -239,17 +231,9 @@ function* fetchDatasourceStructureOnLoad() {
|
|||
} catch (error) {}
|
||||
}
|
||||
|
||||
function* fetchMockDatasourcesSaga(action?: {
|
||||
payload?: { mockDatasources?: ApiResponse };
|
||||
}) {
|
||||
const mockDatasources = action?.payload?.mockDatasources;
|
||||
function* fetchMockDatasourcesSaga() {
|
||||
try {
|
||||
const response: ApiResponse = yield call(
|
||||
getFromServerWhenNoPrefetchedResult,
|
||||
mockDatasources,
|
||||
async () => DatasourcesApi.fetchMockDatasources(),
|
||||
);
|
||||
|
||||
const response: ApiResponse = yield DatasourcesApi.fetchMockDatasources();
|
||||
// not validating the api call here. If the call is unsuccessful it'll be unblocking. And we'll hide the mock DB section.
|
||||
yield put({
|
||||
type: ReduxActionTypes.FETCH_MOCK_DATASOURCES_SUCCESS,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { get, identity, pickBy } from "lodash";
|
||||
import { get } from "lodash";
|
||||
import {
|
||||
all,
|
||||
call,
|
||||
|
|
@ -24,7 +24,6 @@ import { resetCurrentApplication } from "@appsmith/actions/applicationActions";
|
|||
import log from "loglevel";
|
||||
import * as Sentry from "@sentry/react";
|
||||
import { resetRecentEntities } from "actions/globalSearchActions";
|
||||
|
||||
import {
|
||||
initAppViewer,
|
||||
initEditor,
|
||||
|
|
@ -40,14 +39,10 @@ import { getIsInitialized as getIsViewerInitialized } from "selectors/appViewSel
|
|||
import { enableGuidedTour } from "actions/onboardingActions";
|
||||
import { setPreviewModeAction } from "actions/editorActions";
|
||||
import type { AppEnginePayload } from "entities/Engine";
|
||||
import { PageNotFoundError } from "entities/Engine";
|
||||
import type AppEngine from "entities/Engine";
|
||||
import { AppEngineApiError } from "entities/Engine";
|
||||
import AppEngineFactory from "entities/Engine/factory";
|
||||
import type {
|
||||
ApplicationPagePayload,
|
||||
FetchApplicationResponse,
|
||||
} from "@appsmith/api/ApplicationApi";
|
||||
import type { ApplicationPagePayload } from "@appsmith/api/ApplicationApi";
|
||||
import { getSearchQuery, updateSlugNamesInURL } from "utils/helpers";
|
||||
import { generateAutoHeightLayoutTreeAction } from "actions/autoHeightActions";
|
||||
import { safeCrashAppRequest } from "../actions/errorActions";
|
||||
|
|
@ -70,28 +65,6 @@ import AnalyticsUtil from "utils/AnalyticsUtil";
|
|||
import { getAppMode } from "@appsmith/selectors/applicationSelectors";
|
||||
import { getDebuggerErrors } from "selectors/debuggerSelectors";
|
||||
import { deleteErrorLog } from "actions/debuggerActions";
|
||||
import { getCurrentUser } from "actions/authActions";
|
||||
|
||||
import { getCurrentTenant } from "@appsmith/actions/tenantActions";
|
||||
import {
|
||||
fetchFeatureFlagsInit,
|
||||
fetchProductAlertInit,
|
||||
} from "actions/userActions";
|
||||
import { validateResponse } from "./ErrorSagas";
|
||||
import type { ApiResponse } from "api/ApiResponses";
|
||||
import type { ProductAlert } from "reducers/uiReducers/usersReducer";
|
||||
import type { FeatureFlags } from "@appsmith/entities/FeatureFlag";
|
||||
import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag";
|
||||
import type { Action, ActionViewMode } from "entities/Action";
|
||||
import type { JSCollection } from "entities/JSCollection";
|
||||
import type { FetchPageResponse, FetchPageResponseData } from "api/PageApi";
|
||||
import type { AppTheme } from "entities/AppTheming";
|
||||
import type { Datasource } from "entities/Datasource";
|
||||
import type { Plugin, PluginFormPayload } from "api/PluginApi";
|
||||
import { selectFeatureFlagCheck } from "@appsmith/selectors/featureFlagsSelectors";
|
||||
import { fetchFeatureFlags } from "@appsmith/sagas/userSagas";
|
||||
import ConsolidatedPageLoadApi from "api/ConsolidatedPageLoadApi";
|
||||
import { axiosConnectionAbortedCode } from "@appsmith/api/ApiUtils";
|
||||
|
||||
export const URL_CHANGE_ACTIONS = [
|
||||
ReduxActionTypes.CURRENT_APPLICATION_NAME_UPDATE,
|
||||
|
|
@ -103,40 +76,7 @@ export interface ReduxURLChangeAction {
|
|||
type: typeof URL_CHANGE_ACTIONS;
|
||||
payload: ApplicationPagePayload | ApplicationPayload | Page;
|
||||
}
|
||||
export interface DeployConsolidatedApi {
|
||||
productAlert: ApiResponse<ProductAlert>;
|
||||
tenantConfig: ApiResponse;
|
||||
featureFlags: ApiResponse<FeatureFlags>;
|
||||
userProfile: ApiResponse;
|
||||
pages: FetchApplicationResponse;
|
||||
publishedActions: ApiResponse<ActionViewMode[]>;
|
||||
publishedActionCollections: ApiResponse<JSCollection[]>;
|
||||
customJSLibraries: ApiResponse;
|
||||
pageWithMigratedDsl: FetchPageResponse;
|
||||
currentTheme: ApiResponse<AppTheme[]>;
|
||||
themes: ApiResponse<AppTheme>;
|
||||
}
|
||||
export interface EditConsolidatedApi {
|
||||
productAlert: ApiResponse<ProductAlert>;
|
||||
tenantConfig: ApiResponse;
|
||||
featureFlags: ApiResponse<FeatureFlags>;
|
||||
userProfile: ApiResponse;
|
||||
pages: FetchApplicationResponse;
|
||||
publishedActions: ApiResponse<ActionViewMode[]>;
|
||||
publishedActionCollections: ApiResponse<JSCollection[]>;
|
||||
customJSLibraries: ApiResponse;
|
||||
pageWithMigratedDsl: FetchPageResponse;
|
||||
currentTheme: ApiResponse<AppTheme[]>;
|
||||
themes: ApiResponse<AppTheme>;
|
||||
datasources: ApiResponse<Datasource[]>;
|
||||
pagesWithMigratedDsl: ApiResponse<FetchPageResponseData[]>;
|
||||
plugins: ApiResponse<Plugin[]>;
|
||||
mockDatasources: ApiResponse;
|
||||
pluginFormConfigs: ApiResponse<PluginFormPayload>[];
|
||||
unpublishedActions: ApiResponse<Action[]>;
|
||||
unpublishedActionCollections: ApiResponse<JSCollection[]>;
|
||||
}
|
||||
export type InitConsolidatedApi = DeployConsolidatedApi | EditConsolidatedApi;
|
||||
|
||||
export function* failFastApiCalls(
|
||||
triggerActions: Array<ReduxAction<unknown> | ReduxActionWithoutPayload>,
|
||||
successActions: string[],
|
||||
|
|
@ -193,114 +133,6 @@ export function* reportSWStatus() {
|
|||
});
|
||||
}
|
||||
}
|
||||
function* isConsolidatedFetchFeatureFlagEnabled() {
|
||||
yield call(fetchFeatureFlags);
|
||||
|
||||
const consolidatedApiFetch: boolean = yield select(
|
||||
selectFeatureFlagCheck,
|
||||
FEATURE_FLAG.rollout_consolidated_page_load_fetch_enabled,
|
||||
);
|
||||
return consolidatedApiFetch;
|
||||
}
|
||||
function* executeActionDuringUserDetailsInitialisation(
|
||||
actionType: string,
|
||||
shouldInitialiseUserDetails?: boolean,
|
||||
) {
|
||||
if (!shouldInitialiseUserDetails) {
|
||||
return;
|
||||
}
|
||||
yield put({ type: actionType });
|
||||
}
|
||||
|
||||
export function* getInitResponses({
|
||||
applicationId,
|
||||
mode,
|
||||
pageId,
|
||||
shouldInitialiseUserDetails,
|
||||
}: {
|
||||
applicationId?: string;
|
||||
pageId?: string;
|
||||
branch?: string;
|
||||
mode?: APP_MODE;
|
||||
shouldInitialiseUserDetails?: boolean;
|
||||
}): any {
|
||||
const params = pickBy(
|
||||
{
|
||||
applicationId,
|
||||
defaultPageId: pageId,
|
||||
mode,
|
||||
},
|
||||
identity,
|
||||
);
|
||||
let response: InitConsolidatedApi | undefined;
|
||||
|
||||
const isConsolidatedApiFetchEnabled = yield call(
|
||||
isConsolidatedFetchFeatureFlagEnabled,
|
||||
);
|
||||
|
||||
if (!!isConsolidatedApiFetchEnabled) {
|
||||
try {
|
||||
yield call(
|
||||
executeActionDuringUserDetailsInitialisation,
|
||||
ReduxActionTypes.START_CONSOLIDATED_PAGE_LOAD,
|
||||
shouldInitialiseUserDetails,
|
||||
);
|
||||
|
||||
const initConsolidatedApiResponse: ApiResponse<InitConsolidatedApi> =
|
||||
yield mode === APP_MODE.EDIT
|
||||
? ConsolidatedPageLoadApi.getConsolidatedPageLoadDataEdit(params)
|
||||
: ConsolidatedPageLoadApi.getConsolidatedPageLoadDataView(params);
|
||||
|
||||
const isValidResponse: boolean = yield validateResponse(
|
||||
initConsolidatedApiResponse,
|
||||
);
|
||||
response = initConsolidatedApiResponse.data;
|
||||
|
||||
if (!isValidResponse) {
|
||||
// its only invalid when there is a axios related error
|
||||
throw new Error("Error occured " + axiosConnectionAbortedCode);
|
||||
}
|
||||
} catch (e) {
|
||||
yield call(
|
||||
executeActionDuringUserDetailsInitialisation,
|
||||
ReduxActionTypes.END_CONSOLIDATED_PAGE_LOAD,
|
||||
shouldInitialiseUserDetails,
|
||||
);
|
||||
Sentry.captureMessage(
|
||||
`consolidated api failure for ${JSON.stringify(
|
||||
params,
|
||||
)} errored message response ${e}`,
|
||||
);
|
||||
throw new PageNotFoundError(`Cannot find page with id: ${pageId}`);
|
||||
}
|
||||
}
|
||||
|
||||
const { featureFlags, productAlert, tenantConfig, userProfile, ...rest } =
|
||||
response || {};
|
||||
//actions originating from INITIALIZE_CURRENT_PAGE should update user details
|
||||
//other actions are not necessary
|
||||
|
||||
if (!shouldInitialiseUserDetails) {
|
||||
return rest;
|
||||
}
|
||||
|
||||
yield put(getCurrentUser(userProfile));
|
||||
// we already fetch this feature flag when isConsolidatedApiFetchEnabled is true
|
||||
// do not fetch this again
|
||||
if (isConsolidatedApiFetchEnabled) {
|
||||
yield put(fetchFeatureFlagsInit(featureFlags));
|
||||
}
|
||||
|
||||
yield put(getCurrentTenant(false, tenantConfig));
|
||||
|
||||
yield put(fetchProductAlertInit(productAlert));
|
||||
yield call(
|
||||
executeActionDuringUserDetailsInitialisation,
|
||||
ReduxActionTypes.END_CONSOLIDATED_PAGE_LOAD,
|
||||
shouldInitialiseUserDetails,
|
||||
);
|
||||
return rest;
|
||||
}
|
||||
|
||||
export function* startAppEngine(action: ReduxAction<AppEnginePayload>) {
|
||||
try {
|
||||
|
|
@ -310,22 +142,12 @@ export function* startAppEngine(action: ReduxAction<AppEnginePayload>) {
|
|||
);
|
||||
engine.startPerformanceTracking();
|
||||
yield call(engine.setupEngine, action.payload);
|
||||
const allResponses: InitConsolidatedApi = yield call(getInitResponses, {
|
||||
...action.payload,
|
||||
});
|
||||
const { applicationId, toLoadPageId } = yield call(
|
||||
engine.loadAppData,
|
||||
action.payload,
|
||||
allResponses,
|
||||
);
|
||||
yield call(engine.loadAppURL, toLoadPageId, action.payload.pageId);
|
||||
|
||||
yield call(
|
||||
engine.loadAppEntities,
|
||||
toLoadPageId,
|
||||
applicationId,
|
||||
allResponses,
|
||||
);
|
||||
yield call(engine.loadAppEntities, toLoadPageId, applicationId);
|
||||
yield call(engine.loadGit, applicationId);
|
||||
yield call(engine.completeChore);
|
||||
yield put(generateAutoHeightLayoutTreeAction(true, false));
|
||||
|
|
@ -418,55 +240,38 @@ function* appEngineSaga(action: ReduxAction<AppEnginePayload>) {
|
|||
function* eagerPageInitSaga() {
|
||||
const url = window.location.pathname;
|
||||
const search = window.location.search;
|
||||
|
||||
if (isEditorPath(url)) {
|
||||
const matchObj = matchBuilderPath(url);
|
||||
if (matchObj) {
|
||||
const {
|
||||
params: { applicationId, pageId },
|
||||
} = matchObj;
|
||||
const branch = getSearchQuery(search, GIT_BRANCH_QUERY_KEY);
|
||||
if (pageId) {
|
||||
yield put(
|
||||
initEditor({
|
||||
pageId,
|
||||
applicationId,
|
||||
branch,
|
||||
mode: APP_MODE.EDIT,
|
||||
shouldInitialiseUserDetails: true,
|
||||
}),
|
||||
);
|
||||
return;
|
||||
}
|
||||
const matchedUrl = matchBuilderPath(url);
|
||||
if (isEditorPath(url) && matchedUrl) {
|
||||
const {
|
||||
params: { applicationId, pageId },
|
||||
} = matchedUrl;
|
||||
const branch = getSearchQuery(search, GIT_BRANCH_QUERY_KEY);
|
||||
if (pageId) {
|
||||
yield put(
|
||||
initEditor({
|
||||
pageId,
|
||||
applicationId,
|
||||
branch,
|
||||
mode: APP_MODE.EDIT,
|
||||
}),
|
||||
);
|
||||
}
|
||||
} else if (isViewerPath(url)) {
|
||||
const matchObj = matchViewerPath(url);
|
||||
if (matchObj) {
|
||||
const {
|
||||
params: { applicationId, pageId },
|
||||
} = matchObj;
|
||||
const branch = getSearchQuery(search, GIT_BRANCH_QUERY_KEY);
|
||||
if (applicationId || pageId) {
|
||||
yield put(
|
||||
initAppViewer({
|
||||
applicationId,
|
||||
branch,
|
||||
pageId,
|
||||
mode: APP_MODE.PUBLISHED,
|
||||
shouldInitialiseUserDetails: true,
|
||||
}),
|
||||
);
|
||||
return;
|
||||
}
|
||||
const {
|
||||
params: { applicationId, pageId },
|
||||
} = matchViewerPath(url);
|
||||
const branch = getSearchQuery(search, GIT_BRANCH_QUERY_KEY);
|
||||
if (applicationId || pageId) {
|
||||
yield put(
|
||||
initAppViewer({
|
||||
applicationId,
|
||||
branch,
|
||||
pageId,
|
||||
mode: APP_MODE.PUBLISHED,
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
yield call(getInitResponses, {
|
||||
shouldInitialiseUserDetails: true,
|
||||
mode: APP_MODE.PUBLISHED,
|
||||
});
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
export default function* watchInitSagas() {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ import AppsmithConsole from "utils/AppsmithConsole";
|
|||
import { selectInstalledLibraries } from "@appsmith/selectors/entitiesSelector";
|
||||
import { toast } from "design-system";
|
||||
import { endSpan, startRootSpan } from "UITelemetry/generateTraces";
|
||||
import { getFromServerWhenNoPrefetchedResult } from "./helper";
|
||||
|
||||
export function parseErrorMessage(text: string) {
|
||||
return text.split(": ").slice(1).join("");
|
||||
|
|
@ -310,23 +309,16 @@ function* uninstallLibrarySaga(action: ReduxAction<JSLibrary>) {
|
|||
}
|
||||
}
|
||||
|
||||
function* fetchJSLibraries(
|
||||
action: ReduxAction<{
|
||||
applicationId: string;
|
||||
customJSLibraries: ApiResponse;
|
||||
}>,
|
||||
) {
|
||||
function* fetchJSLibraries(action: ReduxAction<string>) {
|
||||
const span = startRootSpan("fetchJSLibraries");
|
||||
const { applicationId, customJSLibraries } = action.payload;
|
||||
const applicationId: string = action.payload;
|
||||
const mode: APP_MODE = yield select(getAppMode);
|
||||
|
||||
try {
|
||||
const response: ApiResponse = yield call(
|
||||
getFromServerWhenNoPrefetchedResult,
|
||||
customJSLibraries,
|
||||
() => call(LibraryApi.getLibraries, applicationId, mode),
|
||||
LibraryApi.getLibraries,
|
||||
applicationId,
|
||||
mode,
|
||||
);
|
||||
|
||||
const isValidResponse: boolean = yield validateResponse(response);
|
||||
if (!isValidResponse) {
|
||||
endSpan(span);
|
||||
|
|
|
|||
|
|
@ -39,15 +39,11 @@ import type {
|
|||
FormDatasourceButtonConfigs,
|
||||
} from "utils/DynamicBindingUtils";
|
||||
import type { ActionDataState } from "@appsmith/reducers/entityReducers/actionsReducer";
|
||||
import { getFromServerWhenNoPrefetchedResult } from "./helper";
|
||||
|
||||
function* fetchPluginsSaga(
|
||||
action: ReduxAction<
|
||||
{ workspaceId?: string; plugins?: ApiResponse<Plugin[]> } | undefined
|
||||
>,
|
||||
action: ReduxAction<{ workspaceId?: string } | undefined>,
|
||||
) {
|
||||
try {
|
||||
const plugins = action.payload?.plugins;
|
||||
let workspaceId: string = yield select(getCurrentWorkspaceId);
|
||||
if (action.payload?.workspaceId) workspaceId = action.payload?.workspaceId;
|
||||
|
||||
|
|
@ -55,11 +51,9 @@ function* fetchPluginsSaga(
|
|||
throw Error("Workspace id does not exist");
|
||||
}
|
||||
const pluginsResponse: ApiResponse<Plugin[]> = yield call(
|
||||
getFromServerWhenNoPrefetchedResult,
|
||||
plugins,
|
||||
() => call(PluginsApi.fetchPlugins, workspaceId),
|
||||
PluginsApi.fetchPlugins,
|
||||
workspaceId,
|
||||
);
|
||||
|
||||
const isValid: boolean = yield validateResponse(pluginsResponse);
|
||||
if (isValid) {
|
||||
yield put({
|
||||
|
|
@ -75,10 +69,7 @@ function* fetchPluginsSaga(
|
|||
}
|
||||
}
|
||||
|
||||
function* fetchPluginFormConfigsSaga(action?: {
|
||||
payload?: { pluginFormConfigs?: ApiResponse<PluginFormPayload[]> };
|
||||
}) {
|
||||
const pluginFormConfigs = action?.payload?.pluginFormConfigs;
|
||||
function* fetchPluginFormConfigsSaga() {
|
||||
try {
|
||||
const datasources: Datasource[] = yield select(getDatasources);
|
||||
const plugins: Plugin[] = yield select(getPlugins);
|
||||
|
|
@ -105,19 +96,10 @@ function* fetchPluginFormConfigsSaga(action?: {
|
|||
}
|
||||
|
||||
const pluginFormData: PluginFormPayload[] = [];
|
||||
const pluginFormResponses: ApiResponse<PluginFormPayload>[] = yield call(
|
||||
getFromServerWhenNoPrefetchedResult,
|
||||
pluginFormConfigs &&
|
||||
[...pluginIdFormsToFetch].map((id) => ({
|
||||
...pluginFormConfigs,
|
||||
data: pluginFormConfigs?.data?.[id as any],
|
||||
})),
|
||||
() =>
|
||||
all(
|
||||
[...pluginIdFormsToFetch].map((id) =>
|
||||
call(PluginsApi.fetchFormConfig, id),
|
||||
),
|
||||
),
|
||||
const pluginFormResponses: ApiResponse<PluginFormPayload>[] = yield all(
|
||||
[...pluginIdFormsToFetch].map((id) =>
|
||||
call(PluginsApi.fetchFormConfig, id),
|
||||
),
|
||||
);
|
||||
|
||||
for (let i = 0; i < pluginFormResponses.length; i++) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import { APP_MODE } from "entities/App";
|
|||
import type AppEngine from "entities/Engine";
|
||||
import AppEngineFactory from "entities/Engine/factory";
|
||||
import { call } from "redux-saga/effects";
|
||||
import { getInitResponses } from "sagas/InitSagas";
|
||||
import { startAppEngine } from "sagas/InitSagas";
|
||||
|
||||
jest.mock("../../api/Api", () => ({
|
||||
|
|
@ -22,7 +21,6 @@ describe("tests the sagas in initSagas", () => {
|
|||
},
|
||||
};
|
||||
const gen = startAppEngine(action);
|
||||
|
||||
const engine: AppEngine = AppEngineFactory.create(
|
||||
APP_MODE.EDIT,
|
||||
APP_MODE.EDIT,
|
||||
|
|
@ -30,24 +28,15 @@ describe("tests the sagas in initSagas", () => {
|
|||
expect(JSON.stringify(gen.next().value)).toStrictEqual(
|
||||
JSON.stringify(call(engine.setupEngine, action.payload)),
|
||||
);
|
||||
expect(gen.next().value).toStrictEqual(
|
||||
call(getInitResponses, action.payload),
|
||||
);
|
||||
const someInitResponse = {
|
||||
pages: { responseMeta: {}, data: {}, code: "232" },
|
||||
} as any;
|
||||
|
||||
expect(JSON.stringify(gen.next(someInitResponse).value)).toStrictEqual(
|
||||
JSON.stringify(
|
||||
call(engine.loadAppData, action.payload, someInitResponse),
|
||||
),
|
||||
expect(JSON.stringify(gen.next().value)).toStrictEqual(
|
||||
JSON.stringify(call(engine.loadAppData, action.payload)),
|
||||
);
|
||||
expect(
|
||||
JSON.stringify(
|
||||
gen.next({
|
||||
applicationId: action.payload.applicationId,
|
||||
toLoadPageId: action.payload.pageId,
|
||||
} as any).value,
|
||||
}).value,
|
||||
),
|
||||
).toStrictEqual(
|
||||
JSON.stringify(
|
||||
|
|
@ -60,7 +49,6 @@ describe("tests the sagas in initSagas", () => {
|
|||
engine.loadAppEntities,
|
||||
action.payload.pageId,
|
||||
action.payload.applicationId,
|
||||
someInitResponse,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import log from "loglevel";
|
|||
import { isPlainObject, isString } from "lodash";
|
||||
import { DATA_BIND_REGEX_GLOBAL } from "constants/BindingsConstants";
|
||||
import { klona } from "klona/lite";
|
||||
import { apiFailureResponseInterceptor } from "@appsmith/api/ApiUtils";
|
||||
|
||||
// function to extract all objects that have dynamic values
|
||||
export const extractFetchDynamicValueFormConfigs = (
|
||||
|
|
@ -204,29 +203,3 @@ export async function generateHashFromString(str: unknown) {
|
|||
|
||||
return hashHex;
|
||||
}
|
||||
|
||||
export function* getFromServerWhenNoPrefetchedResult(
|
||||
prefetchedResult?: any,
|
||||
apiEffect?: any,
|
||||
): any {
|
||||
if (prefetchedResult) {
|
||||
if (prefetchedResult?.responseMeta?.error) {
|
||||
const { responseMeta } = prefetchedResult;
|
||||
const { status } = responseMeta;
|
||||
|
||||
const resp = yield apiFailureResponseInterceptor({
|
||||
response: {
|
||||
data: {
|
||||
responseMeta,
|
||||
},
|
||||
status,
|
||||
},
|
||||
});
|
||||
return resp;
|
||||
}
|
||||
|
||||
return prefetchedResult;
|
||||
}
|
||||
|
||||
return yield apiEffect();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,6 +65,3 @@ export const getDatasourceCollapsibleState = createSelector(
|
|||
|
||||
export const getIsImportingCurl = (state: AppState) =>
|
||||
state.ui.imports.isImportingCurl;
|
||||
|
||||
export const getIsConsolidatedPageLoading = (state: AppState) =>
|
||||
state.ui.consolidatedPageLoad.isLoading;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user