2020-12-17 07:03:59 +00:00
|
|
|
import { get } from "lodash";
|
2020-11-04 11:40:59 +00:00
|
|
|
import {
|
|
|
|
|
all,
|
|
|
|
|
call,
|
|
|
|
|
put,
|
2021-03-31 07:40:59 +00:00
|
|
|
race,
|
2020-11-04 11:40:59 +00:00
|
|
|
select,
|
|
|
|
|
take,
|
|
|
|
|
takeLatest,
|
|
|
|
|
} from "redux-saga/effects";
|
2019-11-08 11:02:00 +00:00
|
|
|
import {
|
2022-03-25 10:43:26 +00:00
|
|
|
ApplicationPayload,
|
|
|
|
|
Page,
|
2020-08-14 07:43:01 +00:00
|
|
|
ReduxAction,
|
Feature/entity browse (#220)
# New Feature: Entity Explorer
- Entities are actions (apis and queries), datasources, pages, and widgets
- With this new feature, all entities in the application will be available
to view in the new entity explorer sidebar
- All existing application features from the api sidebar, query sidebar, datasource sidebar and pages sidebar
now are avialable on the entity explorer sidebar
- Users are now able to quickly switch to any entity in the application from the entity explorer sidebar.
- Users can also search all entities in the application from the new sidebar. Use cmd + f or ctrl + f to focus on the search input
- Users can rename entities from the new sidebar
- Users can also perform contextual actions on these entities like set a page as home page, copy/move actions, delete entity, etc from the context menu available alongside the entities in the sidebar
- Users can view the properties of the entities in the sidebar, as well as copy bindings to use in the application.
2020-08-10 08:52:45 +00:00
|
|
|
ReduxActionErrorTypes,
|
2020-08-14 07:43:01 +00:00
|
|
|
ReduxActionTypes,
|
2021-04-26 05:41:32 +00:00
|
|
|
ReduxActionWithoutPayload,
|
2019-11-22 14:02:55 +00:00
|
|
|
} from "constants/ReduxActionConstants";
|
2022-01-07 06:08:17 +00:00
|
|
|
import { ERROR_CODES } from "@appsmith/constants/ApiConstants";
|
2019-11-22 14:02:55 +00:00
|
|
|
|
2020-08-24 12:09:17 +00:00
|
|
|
import {
|
|
|
|
|
fetchPage,
|
2020-10-21 04:25:32 +00:00
|
|
|
fetchPublishedPage,
|
2020-08-24 12:09:17 +00:00
|
|
|
setAppMode,
|
2021-03-24 05:09:47 +00:00
|
|
|
updateAppPersistentStore,
|
2020-08-24 12:09:17 +00:00
|
|
|
} from "actions/pageActions";
|
2021-07-07 03:46:16 +00:00
|
|
|
import {
|
|
|
|
|
fetchDatasources,
|
|
|
|
|
fetchMockDatasources,
|
|
|
|
|
} from "actions/datasourceActions";
|
2021-03-30 05:29:03 +00:00
|
|
|
import { fetchPluginFormConfigs, fetchPlugins } from "actions/pluginActions";
|
2021-09-08 17:32:22 +00:00
|
|
|
import { fetchJSCollections } from "actions/jsActionActions";
|
2021-08-27 09:25:28 +00:00
|
|
|
import {
|
|
|
|
|
executePageLoadActions,
|
|
|
|
|
fetchActions,
|
|
|
|
|
fetchActionsForView,
|
|
|
|
|
} from "actions/pluginActionActions";
|
2022-03-25 10:43:26 +00:00
|
|
|
import {
|
|
|
|
|
ApplicationVersion,
|
|
|
|
|
fetchApplication,
|
|
|
|
|
} from "actions/applicationActions";
|
2020-03-06 04:59:24 +00:00
|
|
|
import AnalyticsUtil from "utils/AnalyticsUtil";
|
2020-03-09 05:46:32 +00:00
|
|
|
import { getCurrentApplication } from "selectors/applicationSelectors";
|
2021-08-06 09:17:56 +00:00
|
|
|
import { APP_MODE } from "entities/App";
|
2021-03-24 05:09:47 +00:00
|
|
|
import { getPersistentAppStore } from "constants/AppConstants";
|
2020-10-21 04:25:32 +00:00
|
|
|
import { getDefaultPageId } from "./selectors";
|
2020-11-04 11:40:59 +00:00
|
|
|
import { populatePageDSLsSaga } from "./PageSagas";
|
2021-01-14 14:37:21 +00:00
|
|
|
import log from "loglevel";
|
|
|
|
|
import * as Sentry from "@sentry/react";
|
2021-03-08 08:24:12 +00:00
|
|
|
import {
|
|
|
|
|
resetRecentEntities,
|
2021-03-31 07:40:59 +00:00
|
|
|
restoreRecentEntitiesRequest,
|
2021-03-08 08:24:12 +00:00
|
|
|
} from "actions/globalSearchActions";
|
2022-03-25 10:43:26 +00:00
|
|
|
import {
|
|
|
|
|
InitializeEditorPayload,
|
|
|
|
|
resetEditorSuccess,
|
|
|
|
|
} from "actions/initActions";
|
2021-03-31 07:40:59 +00:00
|
|
|
import PerformanceTracker, {
|
|
|
|
|
PerformanceTransactionName,
|
|
|
|
|
} from "utils/PerformanceTracker";
|
2022-03-25 10:43:26 +00:00
|
|
|
import {
|
|
|
|
|
getCurrentApplicationId,
|
|
|
|
|
getIsEditorInitialized,
|
|
|
|
|
getPageById,
|
|
|
|
|
} from "selectors/editorSelectors";
|
2021-05-20 12:03:08 +00:00
|
|
|
import { getIsInitialized as getIsViewerInitialized } from "selectors/appViewSelectors";
|
2021-09-09 16:01:26 +00:00
|
|
|
import { fetchCommentThreadsInit } from "actions/commentActions";
|
2021-09-08 17:32:22 +00:00
|
|
|
import { fetchJSCollectionsForView } from "actions/jsActionActions";
|
2022-03-25 10:43:26 +00:00
|
|
|
import { addBranchParam } from "constants/routes";
|
2021-10-18 14:03:44 +00:00
|
|
|
import history from "utils/history";
|
2021-11-16 10:24:38 +00:00
|
|
|
import {
|
|
|
|
|
fetchGitStatusInit,
|
2021-12-14 16:30:59 +00:00
|
|
|
remoteUrlInputValue,
|
2021-11-18 06:48:52 +00:00
|
|
|
resetPullMergeStatus,
|
2021-11-16 10:24:38 +00:00
|
|
|
updateBranchLocally,
|
|
|
|
|
} from "actions/gitSyncActions";
|
2021-10-18 14:03:44 +00:00
|
|
|
import { getCurrentGitBranch } from "selectors/gitSyncSelectors";
|
2022-03-25 10:43:26 +00:00
|
|
|
import { isURLDeprecated, getUpdatedRoute } from "utils/helpers";
|
2022-04-06 09:46:37 +00:00
|
|
|
import { fillPathname, viewerURL, builderURL } from "RouteBuilder";
|
2022-03-08 14:55:20 +00:00
|
|
|
import { enableGuidedTour } from "actions/onboardingActions";
|
|
|
|
|
import { setPreviewModeAction } from "actions/editorActions";
|
2021-04-26 05:41:32 +00:00
|
|
|
|
2022-03-17 10:28:54 +00:00
|
|
|
export function* failFastApiCalls(
|
2021-04-26 05:41:32 +00:00
|
|
|
triggerActions: Array<ReduxAction<unknown> | ReduxActionWithoutPayload>,
|
|
|
|
|
successActions: string[],
|
|
|
|
|
failureActions: string[],
|
|
|
|
|
) {
|
|
|
|
|
const triggerEffects = [];
|
|
|
|
|
for (const triggerAction of triggerActions) {
|
|
|
|
|
triggerEffects.push(put(triggerAction));
|
|
|
|
|
}
|
|
|
|
|
const successEffects = [];
|
|
|
|
|
for (const successAction of successActions) {
|
|
|
|
|
successEffects.push(take(successAction));
|
|
|
|
|
}
|
|
|
|
|
yield all(triggerEffects);
|
|
|
|
|
const effectRaceResult = yield race({
|
|
|
|
|
success: all(successEffects),
|
|
|
|
|
failure: take(failureActions),
|
|
|
|
|
});
|
|
|
|
|
if (effectRaceResult.failure) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.SAFE_CRASH_APPSMITH_REQUEST,
|
|
|
|
|
payload: {
|
|
|
|
|
code: get(
|
|
|
|
|
effectRaceResult,
|
|
|
|
|
"failure.payload.error.code",
|
|
|
|
|
ERROR_CODES.SERVER_ERROR,
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2019-11-01 07:11:32 +00:00
|
|
|
|
2022-03-25 10:43:26 +00:00
|
|
|
function* bootstrapEditor(payload: InitializeEditorPayload) {
|
|
|
|
|
const { branch } = payload;
|
2021-10-18 14:03:44 +00:00
|
|
|
yield put(resetEditorSuccess());
|
2022-03-25 10:43:26 +00:00
|
|
|
yield put(updateBranchLocally(branch || ""));
|
|
|
|
|
yield put(setAppMode(APP_MODE.EDIT));
|
|
|
|
|
yield put({ type: ReduxActionTypes.START_EVALUATION });
|
|
|
|
|
}
|
2021-10-18 14:03:44 +00:00
|
|
|
|
2022-03-25 10:43:26 +00:00
|
|
|
function* initiateURLUpdate(
|
|
|
|
|
pageId: string,
|
|
|
|
|
appMode: APP_MODE,
|
|
|
|
|
pageIdInUrl?: string,
|
|
|
|
|
) {
|
|
|
|
|
try {
|
|
|
|
|
const currentApplication: ApplicationPayload = yield select(
|
|
|
|
|
getCurrentApplication,
|
2021-10-18 14:03:44 +00:00
|
|
|
);
|
2022-04-06 09:46:37 +00:00
|
|
|
|
2022-03-25 10:43:26 +00:00
|
|
|
const applicationSlug = currentApplication.slug as string;
|
|
|
|
|
const currentPage: Page = yield select(getPageById(pageId));
|
|
|
|
|
const pageSlug = currentPage?.slug as string;
|
|
|
|
|
let originalUrl = "";
|
|
|
|
|
const { pathname, search } = window.location;
|
2022-04-06 09:46:37 +00:00
|
|
|
|
|
|
|
|
// For switching new URLs to old.
|
|
|
|
|
if (currentApplication.applicationVersion < ApplicationVersion.SLUG_URL) {
|
|
|
|
|
if (!isURLDeprecated(pathname)) {
|
|
|
|
|
// We do not allow downgrading application version but,
|
|
|
|
|
// when switch from a branch with updated URL to another one with legacy URLs,
|
|
|
|
|
// we need to compute the legacy url
|
|
|
|
|
// This scenario can happen only in edit mode.
|
|
|
|
|
originalUrl = builderURL({
|
|
|
|
|
applicationId: currentApplication.id,
|
|
|
|
|
pageId: pageId,
|
|
|
|
|
});
|
|
|
|
|
history.replace(originalUrl);
|
2022-03-25 10:43:26 +00:00
|
|
|
}
|
|
|
|
|
} else {
|
2022-04-06 09:46:37 +00:00
|
|
|
// For updated apps,
|
|
|
|
|
// Check if the the current route is a deprecated URL or if pageId is missing (bookmarked urls) and
|
|
|
|
|
// generate a new route with the v2 structure.
|
|
|
|
|
if (isURLDeprecated(pathname) || !pageIdInUrl) {
|
|
|
|
|
if (appMode === APP_MODE.EDIT) {
|
|
|
|
|
// If edit mode, replace /applications/appId/pages/pageId with /appSlug/pageSlug-pageId,
|
|
|
|
|
// to not affect the rest of the url. eg. /api/apiId
|
|
|
|
|
originalUrl =
|
|
|
|
|
fillPathname(pathname, currentApplication, currentPage) + search;
|
|
|
|
|
} else {
|
|
|
|
|
// View Mode - generate a new viewer URL - auto updates query params
|
|
|
|
|
originalUrl = viewerURL({ applicationSlug, pageSlug, pageId });
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// For urls which has pageId in it,
|
|
|
|
|
// replace the placeholder values of application slug and page slug with real slug names.
|
|
|
|
|
originalUrl =
|
|
|
|
|
getUpdatedRoute(pathname, {
|
|
|
|
|
applicationSlug,
|
|
|
|
|
pageSlug,
|
|
|
|
|
pageId,
|
|
|
|
|
}) + search;
|
|
|
|
|
}
|
|
|
|
|
history.replace(originalUrl);
|
2022-03-25 10:43:26 +00:00
|
|
|
}
|
|
|
|
|
} catch (e) {
|
|
|
|
|
log.error(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-11-04 11:40:59 +00:00
|
|
|
|
2022-03-25 10:43:26 +00:00
|
|
|
function* initiateEditorApplicationAndPages(payload: InitializeEditorPayload) {
|
|
|
|
|
const pageId = payload.pageId;
|
|
|
|
|
const applicationId = payload.applicationId;
|
|
|
|
|
|
|
|
|
|
const applicationCall: boolean = yield failFastApiCalls(
|
|
|
|
|
[fetchApplication({ pageId, applicationId, mode: APP_MODE.EDIT })],
|
|
|
|
|
[
|
2021-10-18 14:03:44 +00:00
|
|
|
ReduxActionTypes.FETCH_APPLICATION_SUCCESS,
|
|
|
|
|
ReduxActionTypes.FETCH_PAGE_LIST_SUCCESS,
|
2022-03-25 10:43:26 +00:00
|
|
|
],
|
|
|
|
|
[
|
2021-10-18 14:03:44 +00:00
|
|
|
ReduxActionErrorTypes.FETCH_APPLICATION_ERROR,
|
2022-03-25 10:43:26 +00:00
|
|
|
ReduxActionErrorTypes.FETCH_PAGE_ERROR,
|
|
|
|
|
],
|
|
|
|
|
);
|
2021-10-18 14:03:44 +00:00
|
|
|
|
2022-03-25 10:43:26 +00:00
|
|
|
if (!applicationCall) return;
|
2021-10-18 14:03:44 +00:00
|
|
|
|
2022-03-25 10:43:26 +00:00
|
|
|
let toLoadPageId = pageId;
|
|
|
|
|
const defaultPageId: string = yield select(getDefaultPageId);
|
|
|
|
|
toLoadPageId = toLoadPageId || defaultPageId;
|
2022-02-18 13:58:11 +00:00
|
|
|
|
2022-04-06 09:46:37 +00:00
|
|
|
yield call(initiateURLUpdate, toLoadPageId, APP_MODE.EDIT, payload.pageId);
|
|
|
|
|
|
2022-03-25 10:43:26 +00:00
|
|
|
const fetchPageCallResult: boolean = yield failFastApiCalls(
|
|
|
|
|
[fetchPage(toLoadPageId, true)],
|
|
|
|
|
[ReduxActionTypes.FETCH_PAGE_SUCCESS],
|
|
|
|
|
[ReduxActionErrorTypes.FETCH_PAGE_ERROR],
|
|
|
|
|
);
|
2022-02-18 13:58:11 +00:00
|
|
|
|
2022-03-25 10:43:26 +00:00
|
|
|
if (!fetchPageCallResult) return;
|
2022-03-28 18:30:05 +00:00
|
|
|
|
|
|
|
|
return toLoadPageId;
|
2022-03-25 10:43:26 +00:00
|
|
|
}
|
2021-11-08 06:49:22 +00:00
|
|
|
|
2022-03-25 10:43:26 +00:00
|
|
|
function* initiateEditorActions(applicationId: string) {
|
|
|
|
|
const initActionsCalls = [
|
|
|
|
|
fetchActions({ applicationId }, []),
|
|
|
|
|
fetchJSCollections({ applicationId }),
|
|
|
|
|
];
|
2021-10-18 14:03:44 +00:00
|
|
|
|
2022-03-25 10:43:26 +00:00
|
|
|
const successActionEffects = [
|
|
|
|
|
ReduxActionTypes.FETCH_JS_ACTIONS_SUCCESS,
|
|
|
|
|
ReduxActionTypes.FETCH_ACTIONS_SUCCESS,
|
|
|
|
|
];
|
|
|
|
|
const failureActionEffects = [
|
|
|
|
|
ReduxActionErrorTypes.FETCH_JS_ACTIONS_ERROR,
|
|
|
|
|
ReduxActionErrorTypes.FETCH_ACTIONS_ERROR,
|
|
|
|
|
];
|
|
|
|
|
const allActionCalls: boolean = yield failFastApiCalls(
|
|
|
|
|
initActionsCalls,
|
|
|
|
|
successActionEffects,
|
|
|
|
|
failureActionEffects,
|
|
|
|
|
);
|
2021-10-18 14:03:44 +00:00
|
|
|
|
2022-03-25 10:43:26 +00:00
|
|
|
if (!allActionCalls) {
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.FETCH_PLUGIN_AND_JS_ACTIONS_SUCCESS,
|
|
|
|
|
});
|
|
|
|
|
yield put(executePageLoadActions());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function* initiatePluginsAndDatasources() {
|
|
|
|
|
const pluginsAndDatasourcesCalls: boolean = yield failFastApiCalls(
|
|
|
|
|
[fetchPlugins(), fetchDatasources(), fetchMockDatasources()],
|
|
|
|
|
[
|
|
|
|
|
ReduxActionTypes.FETCH_PLUGINS_SUCCESS,
|
|
|
|
|
ReduxActionTypes.FETCH_DATASOURCES_SUCCESS,
|
|
|
|
|
ReduxActionTypes.FETCH_MOCK_DATASOURCES_SUCCESS,
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
ReduxActionErrorTypes.FETCH_PLUGINS_ERROR,
|
|
|
|
|
ReduxActionErrorTypes.FETCH_DATASOURCES_ERROR,
|
|
|
|
|
ReduxActionErrorTypes.FETCH_MOCK_DATASOURCES_ERROR,
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
if (!pluginsAndDatasourcesCalls) return;
|
|
|
|
|
|
|
|
|
|
const pluginFormCall: boolean = yield failFastApiCalls(
|
|
|
|
|
[fetchPluginFormConfigs()],
|
|
|
|
|
[ReduxActionTypes.FETCH_PLUGIN_FORM_CONFIGS_SUCCESS],
|
|
|
|
|
[ReduxActionErrorTypes.FETCH_PLUGIN_FORM_CONFIGS_ERROR],
|
|
|
|
|
);
|
|
|
|
|
if (!pluginFormCall) return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function* initiateGit(applicationId: string) {
|
|
|
|
|
const branchInStore: string = yield select(getCurrentGitBranch);
|
|
|
|
|
|
|
|
|
|
yield put(
|
|
|
|
|
restoreRecentEntitiesRequest({
|
|
|
|
|
applicationId,
|
|
|
|
|
branch: branchInStore,
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// init of temporay remote url from old application
|
|
|
|
|
yield put(remoteUrlInputValue({ tempRemoteUrl: "" }));
|
|
|
|
|
|
|
|
|
|
// add branch query to path and fetch status
|
|
|
|
|
if (branchInStore) {
|
|
|
|
|
history.replace(addBranchParam(branchInStore));
|
|
|
|
|
yield put(fetchGitStatusInit());
|
|
|
|
|
}
|
2021-03-30 05:29:03 +00:00
|
|
|
|
2022-03-25 10:43:26 +00:00
|
|
|
yield put(resetPullMergeStatus());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function* initializeEditorSaga(
|
|
|
|
|
initializeEditorAction: ReduxAction<InitializeEditorPayload>,
|
|
|
|
|
) {
|
|
|
|
|
try {
|
|
|
|
|
const { payload } = initializeEditorAction;
|
|
|
|
|
|
|
|
|
|
const { branch } = payload;
|
|
|
|
|
|
|
|
|
|
yield call(bootstrapEditor, payload);
|
|
|
|
|
|
|
|
|
|
PerformanceTracker.startAsyncTracking(
|
|
|
|
|
PerformanceTransactionName.INIT_EDIT_APP,
|
2021-04-26 05:41:32 +00:00
|
|
|
);
|
2021-03-30 05:29:03 +00:00
|
|
|
|
2022-04-06 09:46:37 +00:00
|
|
|
yield call(initiateEditorApplicationAndPages, payload);
|
2022-03-25 10:43:26 +00:00
|
|
|
|
|
|
|
|
const { id: applicationId, name }: ApplicationPayload = yield select(
|
|
|
|
|
getCurrentApplication,
|
|
|
|
|
);
|
Feature/entity browse (#220)
# New Feature: Entity Explorer
- Entities are actions (apis and queries), datasources, pages, and widgets
- With this new feature, all entities in the application will be available
to view in the new entity explorer sidebar
- All existing application features from the api sidebar, query sidebar, datasource sidebar and pages sidebar
now are avialable on the entity explorer sidebar
- Users are now able to quickly switch to any entity in the application from the entity explorer sidebar.
- Users can also search all entities in the application from the new sidebar. Use cmd + f or ctrl + f to focus on the search input
- Users can rename entities from the new sidebar
- Users can also perform contextual actions on these entities like set a page as home page, copy/move actions, delete entity, etc from the context menu available alongside the entities in the sidebar
- Users can view the properties of the entities in the sidebar, as well as copy bindings to use in the application.
2020-08-10 08:52:45 +00:00
|
|
|
|
2021-10-18 14:03:44 +00:00
|
|
|
yield put(
|
2022-03-25 10:43:26 +00:00
|
|
|
updateAppPersistentStore(getPersistentAppStore(applicationId, branch)),
|
2021-10-18 14:03:44 +00:00
|
|
|
);
|
2021-04-26 05:41:32 +00:00
|
|
|
|
2022-03-25 10:43:26 +00:00
|
|
|
yield all([
|
|
|
|
|
call(initiateEditorActions, applicationId),
|
|
|
|
|
call(initiatePluginsAndDatasources),
|
|
|
|
|
]);
|
2021-09-09 16:01:26 +00:00
|
|
|
|
2020-11-04 11:40:59 +00:00
|
|
|
AnalyticsUtil.logEvent("EDITOR_OPEN", {
|
2022-03-25 10:43:26 +00:00
|
|
|
appId: applicationId,
|
|
|
|
|
appName: name,
|
Feature/entity browse (#220)
# New Feature: Entity Explorer
- Entities are actions (apis and queries), datasources, pages, and widgets
- With this new feature, all entities in the application will be available
to view in the new entity explorer sidebar
- All existing application features from the api sidebar, query sidebar, datasource sidebar and pages sidebar
now are avialable on the entity explorer sidebar
- Users are now able to quickly switch to any entity in the application from the entity explorer sidebar.
- Users can also search all entities in the application from the new sidebar. Use cmd + f or ctrl + f to focus on the search input
- Users can rename entities from the new sidebar
- Users can also perform contextual actions on these entities like set a page as home page, copy/move actions, delete entity, etc from the context menu available alongside the entities in the sidebar
- Users can view the properties of the entities in the sidebar, as well as copy bindings to use in the application.
2020-08-10 08:52:45 +00:00
|
|
|
});
|
|
|
|
|
|
2022-03-25 10:43:26 +00:00
|
|
|
yield call(initiateGit, applicationId);
|
|
|
|
|
|
|
|
|
|
yield put(fetchCommentThreadsInit());
|
2021-12-14 16:30:59 +00:00
|
|
|
|
Feature/entity browse (#220)
# New Feature: Entity Explorer
- Entities are actions (apis and queries), datasources, pages, and widgets
- With this new feature, all entities in the application will be available
to view in the new entity explorer sidebar
- All existing application features from the api sidebar, query sidebar, datasource sidebar and pages sidebar
now are avialable on the entity explorer sidebar
- Users are now able to quickly switch to any entity in the application from the entity explorer sidebar.
- Users can also search all entities in the application from the new sidebar. Use cmd + f or ctrl + f to focus on the search input
- Users can rename entities from the new sidebar
- Users can also perform contextual actions on these entities like set a page as home page, copy/move actions, delete entity, etc from the context menu available alongside the entities in the sidebar
- Users can view the properties of the entities in the sidebar, as well as copy bindings to use in the application.
2020-08-10 08:52:45 +00:00
|
|
|
yield put({
|
2020-11-04 11:40:59 +00:00
|
|
|
type: ReduxActionTypes.INITIALIZE_EDITOR_SUCCESS,
|
Feature/entity browse (#220)
# New Feature: Entity Explorer
- Entities are actions (apis and queries), datasources, pages, and widgets
- With this new feature, all entities in the application will be available
to view in the new entity explorer sidebar
- All existing application features from the api sidebar, query sidebar, datasource sidebar and pages sidebar
now are avialable on the entity explorer sidebar
- Users are now able to quickly switch to any entity in the application from the entity explorer sidebar.
- Users can also search all entities in the application from the new sidebar. Use cmd + f or ctrl + f to focus on the search input
- Users can rename entities from the new sidebar
- Users can also perform contextual actions on these entities like set a page as home page, copy/move actions, delete entity, etc from the context menu available alongside the entities in the sidebar
- Users can view the properties of the entities in the sidebar, as well as copy bindings to use in the application.
2020-08-10 08:52:45 +00:00
|
|
|
});
|
2022-03-25 10:43:26 +00:00
|
|
|
|
2021-03-31 07:40:59 +00:00
|
|
|
PerformanceTracker.stopAsyncTracking(
|
|
|
|
|
PerformanceTransactionName.INIT_EDIT_APP,
|
|
|
|
|
);
|
2021-10-18 14:03:44 +00:00
|
|
|
|
|
|
|
|
yield call(populatePageDSLsSaga);
|
2020-11-04 11:40:59 +00:00
|
|
|
} catch (e) {
|
2021-01-14 14:37:21 +00:00
|
|
|
log.error(e);
|
|
|
|
|
Sentry.captureException(e);
|
2020-12-08 19:13:48 +00:00
|
|
|
yield put({
|
2021-01-06 11:24:16 +00:00
|
|
|
type: ReduxActionTypes.SAFE_CRASH_APPSMITH_REQUEST,
|
2020-12-17 07:03:59 +00:00
|
|
|
payload: {
|
|
|
|
|
code: ERROR_CODES.SERVER_ERROR,
|
|
|
|
|
},
|
2020-12-08 19:13:48 +00:00
|
|
|
});
|
2020-11-04 11:40:59 +00:00
|
|
|
return;
|
Feature/entity browse (#220)
# New Feature: Entity Explorer
- Entities are actions (apis and queries), datasources, pages, and widgets
- With this new feature, all entities in the application will be available
to view in the new entity explorer sidebar
- All existing application features from the api sidebar, query sidebar, datasource sidebar and pages sidebar
now are avialable on the entity explorer sidebar
- Users are now able to quickly switch to any entity in the application from the entity explorer sidebar.
- Users can also search all entities in the application from the new sidebar. Use cmd + f or ctrl + f to focus on the search input
- Users can rename entities from the new sidebar
- Users can also perform contextual actions on these entities like set a page as home page, copy/move actions, delete entity, etc from the context menu available alongside the entities in the sidebar
- Users can view the properties of the entities in the sidebar, as well as copy bindings to use in the application.
2020-08-10 08:52:45 +00:00
|
|
|
}
|
2019-11-01 07:11:32 +00:00
|
|
|
}
|
|
|
|
|
|
2019-11-08 11:02:00 +00:00
|
|
|
export function* initializeAppViewerSaga(
|
2021-10-18 14:03:44 +00:00
|
|
|
action: ReduxAction<{
|
|
|
|
|
branch: string;
|
|
|
|
|
pageId: string;
|
2022-03-25 10:43:26 +00:00
|
|
|
applicationId: string;
|
2021-10-18 14:03:44 +00:00
|
|
|
}>,
|
2019-11-08 11:02:00 +00:00
|
|
|
) {
|
2022-03-25 10:43:26 +00:00
|
|
|
const { branch, pageId } = action.payload;
|
|
|
|
|
|
|
|
|
|
let { applicationId } = action.payload;
|
|
|
|
|
|
2022-03-31 15:11:31 +00:00
|
|
|
PerformanceTracker.startAsyncTracking(
|
|
|
|
|
PerformanceTransactionName.INIT_VIEW_APP,
|
|
|
|
|
);
|
|
|
|
|
|
2022-04-04 15:25:03 +00:00
|
|
|
yield put(updateBranchLocally(branch || ""));
|
2022-03-31 15:11:31 +00:00
|
|
|
|
|
|
|
|
yield put(setAppMode(APP_MODE.PUBLISHED));
|
|
|
|
|
|
2022-03-25 10:43:26 +00:00
|
|
|
const applicationCall: boolean = yield failFastApiCalls(
|
|
|
|
|
[fetchApplication({ applicationId, pageId, mode: APP_MODE.PUBLISHED })],
|
|
|
|
|
[
|
|
|
|
|
ReduxActionTypes.FETCH_APPLICATION_SUCCESS,
|
|
|
|
|
ReduxActionTypes.FETCH_PAGE_LIST_SUCCESS,
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
ReduxActionErrorTypes.FETCH_APPLICATION_ERROR,
|
|
|
|
|
ReduxActionErrorTypes.FETCH_PAGE_LIST_ERROR,
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (!applicationCall) return;
|
2021-10-18 14:03:44 +00:00
|
|
|
|
2022-03-25 10:43:26 +00:00
|
|
|
applicationId = applicationId || (yield select(getCurrentApplicationId));
|
2021-10-18 14:03:44 +00:00
|
|
|
yield put(
|
|
|
|
|
updateAppPersistentStore(getPersistentAppStore(applicationId, branch)),
|
|
|
|
|
);
|
2020-10-23 18:02:59 +00:00
|
|
|
yield put({ type: ReduxActionTypes.START_EVALUATION });
|
2022-03-25 10:43:26 +00:00
|
|
|
|
|
|
|
|
const resultOfPrimaryCalls: boolean = yield failFastApiCalls(
|
|
|
|
|
[fetchActionsForView({ applicationId })],
|
|
|
|
|
[ReduxActionTypes.FETCH_ACTIONS_VIEW_MODE_SUCCESS],
|
|
|
|
|
[ReduxActionErrorTypes.FETCH_ACTIONS_VIEW_MODE_ERROR],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (!resultOfPrimaryCalls) return;
|
|
|
|
|
|
|
|
|
|
const jsActionsCall: boolean = yield failFastApiCalls(
|
2021-11-08 06:49:22 +00:00
|
|
|
[fetchJSCollectionsForView({ applicationId })],
|
|
|
|
|
[ReduxActionTypes.FETCH_JS_ACTIONS_VIEW_MODE_SUCCESS],
|
|
|
|
|
[ReduxActionErrorTypes.FETCH_JS_ACTIONS_VIEW_MODE_ERROR],
|
|
|
|
|
);
|
|
|
|
|
if (!jsActionsCall) return;
|
2021-10-18 14:03:44 +00:00
|
|
|
|
2022-03-25 10:43:26 +00:00
|
|
|
const defaultPageId: string = yield select(getDefaultPageId);
|
|
|
|
|
const toLoadPageId: string = pageId || defaultPageId;
|
2019-11-22 14:02:55 +00:00
|
|
|
|
2022-03-25 10:43:26 +00:00
|
|
|
yield call(initiateURLUpdate, toLoadPageId, APP_MODE.PUBLISHED, pageId);
|
2020-10-21 04:25:32 +00:00
|
|
|
|
2021-10-21 05:23:34 +00:00
|
|
|
if (toLoadPageId) {
|
|
|
|
|
yield put(fetchPublishedPage(toLoadPageId, true));
|
2020-12-17 07:03:59 +00:00
|
|
|
|
2022-03-25 10:43:26 +00:00
|
|
|
const resultOfFetchPage: {
|
|
|
|
|
success: boolean;
|
|
|
|
|
failure: boolean;
|
|
|
|
|
} = yield race({
|
2021-10-21 05:23:34 +00:00
|
|
|
success: take(ReduxActionTypes.FETCH_PUBLISHED_PAGE_SUCCESS),
|
|
|
|
|
failure: take(ReduxActionErrorTypes.FETCH_PUBLISHED_PAGE_ERROR),
|
|
|
|
|
});
|
2021-10-18 14:03:44 +00:00
|
|
|
|
2021-10-21 05:23:34 +00:00
|
|
|
if (resultOfFetchPage.failure) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.SAFE_CRASH_APPSMITH_REQUEST,
|
|
|
|
|
payload: {
|
|
|
|
|
code: get(
|
|
|
|
|
resultOfFetchPage,
|
|
|
|
|
"failure.payload.error.code",
|
|
|
|
|
ERROR_CODES.SERVER_ERROR,
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
return;
|
2020-11-04 11:40:59 +00:00
|
|
|
}
|
2021-10-18 14:03:44 +00:00
|
|
|
}
|
2020-10-21 04:25:32 +00:00
|
|
|
|
2021-10-18 14:03:44 +00:00
|
|
|
yield put(fetchCommentThreadsInit());
|
2021-09-09 16:01:26 +00:00
|
|
|
|
2021-10-18 14:03:44 +00:00
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.INITIALIZE_PAGE_VIEWER_SUCCESS,
|
|
|
|
|
});
|
|
|
|
|
PerformanceTracker.stopAsyncTracking(
|
|
|
|
|
PerformanceTransactionName.INIT_VIEW_APP,
|
|
|
|
|
);
|
|
|
|
|
if ("serviceWorker" in navigator) {
|
2020-05-06 05:56:07 +00:00
|
|
|
yield put({
|
2021-10-18 14:03:44 +00:00
|
|
|
type: ReduxActionTypes.FETCH_ALL_PUBLISHED_PAGES,
|
2020-05-06 05:56:07 +00:00
|
|
|
});
|
|
|
|
|
}
|
2019-11-08 11:02:00 +00:00
|
|
|
}
|
|
|
|
|
|
2021-03-08 08:24:12 +00:00
|
|
|
function* resetEditorSaga() {
|
|
|
|
|
yield put(resetRecentEntities());
|
2022-03-08 14:55:20 +00:00
|
|
|
// End guided tour once user exits editor
|
|
|
|
|
yield put(enableGuidedTour(false));
|
|
|
|
|
// Reset to edit mode once user exits editor
|
|
|
|
|
// Without doing this if the user creates a new app they
|
|
|
|
|
// might end up in preview mode if they were in preview mode
|
|
|
|
|
// previously
|
|
|
|
|
yield put(setPreviewModeAction(false));
|
2022-03-15 13:12:29 +00:00
|
|
|
yield put(resetEditorSuccess());
|
2021-03-08 08:24:12 +00:00
|
|
|
}
|
|
|
|
|
|
2021-05-20 12:03:08 +00:00
|
|
|
export function* waitForInit() {
|
2022-03-25 10:43:26 +00:00
|
|
|
const isEditorInitialised: boolean = yield select(getIsEditorInitialized);
|
|
|
|
|
const isViewerInitialized: boolean = yield select(getIsViewerInitialized);
|
2021-05-20 12:03:08 +00:00
|
|
|
if (!isEditorInitialised && !isViewerInitialized) {
|
|
|
|
|
yield take([
|
|
|
|
|
ReduxActionTypes.INITIALIZE_EDITOR_SUCCESS,
|
|
|
|
|
ReduxActionTypes.INITIALIZE_PAGE_VIEWER_SUCCESS,
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-01 07:11:32 +00:00
|
|
|
export default function* watchInitSagas() {
|
2019-11-08 11:02:00 +00:00
|
|
|
yield all([
|
2019-11-14 11:17:36 +00:00
|
|
|
takeLatest(ReduxActionTypes.INITIALIZE_EDITOR, initializeEditorSaga),
|
2019-11-08 11:02:00 +00:00
|
|
|
takeLatest(
|
|
|
|
|
ReduxActionTypes.INITIALIZE_PAGE_VIEWER,
|
|
|
|
|
initializeAppViewerSaga,
|
|
|
|
|
),
|
2021-03-08 08:24:12 +00:00
|
|
|
takeLatest(ReduxActionTypes.RESET_EDITOR_REQUEST, resetEditorSaga),
|
2019-11-08 11:02:00 +00:00
|
|
|
]);
|
2019-11-01 07:11:32 +00:00
|
|
|
}
|