Fixing merge conflicts

This commit is contained in:
Arpit Mohan 2020-11-03 16:50:23 +05:30
commit 33b18a9336
10 changed files with 85 additions and 33 deletions

View File

@ -168,7 +168,7 @@ jobs:
shell: bash shell: bash
run: | run: |
echo ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin echo ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin
docker run -d --net=host --name appsmith-internal-server -p 8080:8080 \ docker run -d --net=host --name appsmith-internal-server -p 8080:8080 \
--env APPSMITH_MONGODB_URI=mongodb://localhost:27017/appsmith \ --env APPSMITH_MONGODB_URI=mongodb://localhost:27017/appsmith \
--env APPSMITH_REDIS_URL=redis://localhost:6379 \ --env APPSMITH_REDIS_URL=redis://localhost:6379 \

View File

@ -122,7 +122,7 @@ The Appsmith platform is available under the [Apache License 2.0](https://www.ap
<td align="center"><a href="https://github.com/A-Scratchy"><img src="https://avatars0.githubusercontent.com/u/25309929?v=4" width="100px;" alt=""/><br /><sub><b>Adam</b></sub></a><br /><a href="https://github.com/appsmithorg/appsmith/commits?author=A-Scratchy" title="Code">💻</a></td> <td align="center"><a href="https://github.com/A-Scratchy"><img src="https://avatars0.githubusercontent.com/u/25309929?v=4" width="100px;" alt=""/><br /><sub><b>Adam</b></sub></a><br /><a href="https://github.com/appsmithorg/appsmith/commits?author=A-Scratchy" title="Code">💻</a></td>
</tr> </tr>
<tr> <tr>
<td align="center"><a href="https://github.com/sumanthyedoti"><img src="https://avatars3.githubusercontent.com/u/30371888?v=4" width="100px;" alt=""/><br /><sub><b>Sumanth Yedoti</b></sub></a><br /><a href="#tool-sumanthyedoti" title="Tools">🔧</a> <a href="https://github.com/appsmithorg/appsmith/commits?author=sumanthyedoti" title="Code">💻</a></td> <td align="center"><a href="https://github.com/sumanthyedoti"><img src="https://avatars3.githubusercontent.com/u/30371888?v=4" width="100px;" alt=""/><br /><sub><b>Sumanth Yedoti</b></sub></a><br /> <a href="https://github.com/appsmithorg/appsmith/commits?author=sumanthyedoti" title="Code">💻</a></td>
</tr> </tr>
</table> </table>

View File

@ -2,6 +2,7 @@ import { FetchPageRequest, SavePageResponse } from "api/PageApi";
import { WidgetOperation, WidgetProps } from "widgets/BaseWidget"; import { WidgetOperation, WidgetProps } from "widgets/BaseWidget";
import { WidgetType } from "constants/WidgetConstants"; import { WidgetType } from "constants/WidgetConstants";
import { import {
EvaluationReduxAction,
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,
UpdateCanvasPayload, UpdateCanvasPayload,
@ -46,9 +47,13 @@ export const fetchPublishedPage = (pageId: string, bustCache = false) => ({
}, },
}); });
export const fetchPageSuccess = () => { export const fetchPageSuccess = (
postEvalActions: ReduxAction<unknown>[],
): EvaluationReduxAction<unknown> => {
return { return {
type: ReduxActionTypes.FETCH_PAGE_SUCCESS, type: ReduxActionTypes.FETCH_PAGE_SUCCESS,
payload: {},
postEvalActions,
}; };
}; };
@ -60,9 +65,11 @@ export type FetchPublishedPageSuccessPayload = {
export const fetchPublishedPageSuccess = ( export const fetchPublishedPageSuccess = (
payload: FetchPublishedPageSuccessPayload, payload: FetchPublishedPageSuccessPayload,
) => ({ postEvalActions: ReduxAction<unknown>[],
): EvaluationReduxAction<FetchPublishedPageSuccessPayload> => ({
type: ReduxActionTypes.FETCH_PUBLISHED_PAGE_SUCCESS, type: ReduxActionTypes.FETCH_PUBLISHED_PAGE_SUCCESS,
payload, payload,
postEvalActions,
}); });
export const updateCurrentPage = (id: string) => ({ export const updateCurrentPage = (id: string) => ({

View File

@ -30,11 +30,10 @@ export const executeActionError = (
export const executePageLoadActions = ( export const executePageLoadActions = (
payload: PageAction[][], payload: PageAction[][],
): BatchAction<PageAction[][]> => ): ReduxAction<PageAction[][]> => ({
batchAction({ type: ReduxActionTypes.EXECUTE_PAGE_LOAD_ACTIONS,
type: ReduxActionTypes.EXECUTE_PAGE_LOAD_ACTIONS, payload,
payload, });
});
export const disableDragAction = ( export const disableDragAction = (
isDraggingDisabled: boolean, isDraggingDisabled: boolean,

View File

@ -410,6 +410,11 @@ export type ReduxActionWithoutPayload = Pick<ReduxAction<undefined>, "type">;
export interface ReduxActionWithMeta<T, M> extends ReduxAction<T> { export interface ReduxActionWithMeta<T, M> extends ReduxAction<T> {
meta: M; meta: M;
} }
export interface EvaluationReduxAction<T> extends ReduxAction<T> {
postEvalActions?: ReduxAction<any>[];
}
export interface PromisePayload { export interface PromisePayload {
reject: any; reject: any;
resolve: any; resolve: any;

View File

@ -27,6 +27,8 @@ export const TableWrapper = styled.div`
justify-content: space-between; justify-content: space-between;
flex-direction: column; flex-direction: column;
overflow: hidden; overflow: hidden;
min-height: 0px;
height: 100%;
.tableWrap { .tableWrap {
height: 100%; height: 100%;
display: block; display: block;
@ -38,6 +40,10 @@ export const TableWrapper = styled.div`
color: ${Colors.THUNDER}; color: ${Colors.THUNDER};
position: relative; position: relative;
background: ${Colors.ATHENS_GRAY_DARKER}; background: ${Colors.ATHENS_GRAY_DARKER};
display: flex;
flex: 1;
flex-direction: column;
height: 100%;
display: table; display: table;
width: 100%; width: 100%;
.thead, .thead,
@ -45,8 +51,8 @@ export const TableWrapper = styled.div`
overflow: hidden; overflow: hidden;
} }
.tbody { .tbody {
overflow-y: scroll; height: 100%;
height: auto; overflow: auto;
.tr { .tr {
width: 100%; width: 100%;
} }

View File

@ -43,6 +43,7 @@ import {
select, select,
takeLatest, takeLatest,
takeLeading, takeLeading,
take,
} from "redux-saga/effects"; } from "redux-saga/effects";
import history from "utils/history"; import history from "utils/history";
import { BUILDER_PAGE_URL } from "constants/routes"; import { BUILDER_PAGE_URL } from "constants/routes";
@ -173,9 +174,12 @@ export function* fetchPageSaga(
// set current page // set current page
yield put(updateCurrentPage(id)); yield put(updateCurrentPage(id));
// dispatch fetch page success // dispatch fetch page success
yield put(fetchPageSuccess()); yield put(
// Execute page load actions fetchPageSuccess([
yield put(executePageLoadActions(canvasWidgetsPayload.pageActions)); // Execute page load actions after evaluation of fetch page
executePageLoadActions(canvasWidgetsPayload.pageActions),
]),
);
// Add this to the page DSLs for entity explorer // Add this to the page DSLs for entity explorer
yield put({ yield put({
@ -237,17 +241,19 @@ export function* fetchPublishedPageSaga(
yield put(updateCurrentPage(pageId)); yield put(updateCurrentPage(pageId));
// dispatch fetch page success // dispatch fetch page success
yield put( yield put(
fetchPublishedPageSuccess({ fetchPublishedPageSuccess(
dsl: response.data.layouts[0].dsl, {
pageId: request.pageId, dsl: response.data.layouts[0].dsl,
pageWidgetId: canvasWidgetsPayload.pageWidgetId, pageId: request.pageId,
}), pageWidgetId: canvasWidgetsPayload.pageWidgetId,
},
// Execute page load actions post published page eval
[executePageLoadActions(canvasWidgetsPayload.pageActions)],
),
); );
// Execute page load actions
PerformanceTracker.stopAsyncTracking( PerformanceTracker.stopAsyncTracking(
PerformanceTransactionName.FETCH_PAGE_API, PerformanceTransactionName.FETCH_PAGE_API,
); );
yield put(executePageLoadActions(canvasWidgetsPayload.pageActions));
} }
} catch (error) { } catch (error) {
PerformanceTracker.stopAsyncTracking( PerformanceTracker.stopAsyncTracking(

View File

@ -9,11 +9,15 @@ import {
} from "redux-saga/effects"; } from "redux-saga/effects";
import { eventChannel, EventChannel } from "redux-saga"; import { eventChannel, EventChannel } from "redux-saga";
import { import {
EvaluationReduxAction,
ReduxAction, ReduxAction,
ReduxActionErrorTypes, ReduxActionErrorTypes,
ReduxActionTypes, ReduxActionTypes,
} from "constants/ReduxActionConstants"; } from "constants/ReduxActionConstants";
import { getUnevaluatedDataTree } from "selectors/dataTreeSelectors"; import {
getDataTree,
getUnevaluatedDataTree,
} from "selectors/dataTreeSelectors";
import WidgetFactory, { WidgetTypeConfigMap } from "../utils/WidgetFactory"; import WidgetFactory, { WidgetTypeConfigMap } from "../utils/WidgetFactory";
import Worker from "worker-loader!../workers/evaluation.worker"; import Worker from "worker-loader!../workers/evaluation.worker";
import { import {
@ -27,12 +31,19 @@ import log from "loglevel";
import _ from "lodash"; import _ from "lodash";
import { WidgetType } from "../constants/WidgetConstants"; import { WidgetType } from "../constants/WidgetConstants";
import { WidgetProps } from "../widgets/BaseWidget"; import { WidgetProps } from "../widgets/BaseWidget";
import PerformanceTracker, {
PerformanceTransactionName,
} from "../utils/PerformanceTracker";
let evaluationWorker: Worker; let evaluationWorker: Worker;
let workerChannel: EventChannel<any>; let workerChannel: EventChannel<any>;
let widgetTypeConfigMap: WidgetTypeConfigMap; let widgetTypeConfigMap: WidgetTypeConfigMap;
const initEvaluationWorkers = () => { const initEvaluationWorkers = () => {
// If an old worker exists, terminate it
if (evaluationWorker) {
evaluationWorker.terminate();
}
widgetTypeConfigMap = WidgetFactory.getWidgetTypeConfigMap(); widgetTypeConfigMap = WidgetFactory.getWidgetTypeConfigMap();
evaluationWorker = new Worker(); evaluationWorker = new Worker();
workerChannel = eventChannel(emitter => { workerChannel = eventChannel(emitter => {
@ -56,7 +67,16 @@ const evalErrorHandler = (errors: EvalError[]) => {
}); });
}; };
function* evaluateTreeSaga() { function* postEvalActionDispatcher(actions: ReduxAction<unknown>[]) {
for (const action of actions) {
yield put(action);
}
}
function* evaluateTreeSaga(postEvalActions?: ReduxAction<unknown>[]) {
PerformanceTracker.startAsyncTracking(
PerformanceTransactionName.DATA_TREE_EVALUATION,
);
const unEvalTree = yield select(getUnevaluatedDataTree); const unEvalTree = yield select(getUnevaluatedDataTree);
log.debug({ unEvalTree }); log.debug({ unEvalTree });
evaluationWorker.postMessage({ evaluationWorker.postMessage({
@ -73,14 +93,20 @@ function* evaluateTreeSaga() {
type: ReduxActionTypes.SET_EVALUATED_TREE, type: ReduxActionTypes.SET_EVALUATED_TREE,
payload: parsedDataTree, payload: parsedDataTree,
}); });
PerformanceTracker.stopAsyncTracking(
PerformanceTransactionName.DATA_TREE_EVALUATION,
);
if (postEvalActions && postEvalActions.length) {
yield call(postEvalActionDispatcher, postEvalActions);
}
} }
export function* evaluateSingleValue(binding: string) { export function* evaluateSingleValue(binding: string) {
if (evaluationWorker) { if (evaluationWorker) {
const unEvalTree = yield select(getUnevaluatedDataTree); const dataTree = yield select(getDataTree);
evaluationWorker.postMessage({ evaluationWorker.postMessage({
action: EVAL_WORKER_ACTIONS.EVAL_SINGLE, action: EVAL_WORKER_ACTIONS.EVAL_SINGLE,
dataTree: unEvalTree, dataTree,
binding, binding,
}); });
const workerResponse = yield take(workerChannel); const workerResponse = yield take(workerChannel);
@ -190,14 +216,19 @@ const EVALUATE_REDUX_ACTIONS = [
function* evaluationChangeListenerSaga() { function* evaluationChangeListenerSaga() {
initEvaluationWorkers(); initEvaluationWorkers();
yield call(evaluateTreeSaga); yield fork(evaluateTreeSaga);
while (true) { while (true) {
const action: ReduxAction<any> = yield take(EVALUATE_REDUX_ACTIONS); const action: EvaluationReduxAction<unknown | unknown[]> = yield take(
EVALUATE_REDUX_ACTIONS,
);
// When batching success action happens, we need to only evaluate // When batching success action happens, we need to only evaluate
// if the batch had any action we need to evaluate properties for // if the batch had any action we need to evaluate properties for
if (action.type === ReduxActionTypes.BATCH_UPDATES_SUCCESS) { if (
action.type === ReduxActionTypes.BATCH_UPDATES_SUCCESS &&
Array.isArray(action.payload)
) {
const batchedActionTypes = action.payload.map( const batchedActionTypes = action.payload.map(
(batchedAction: ReduxAction<any>) => batchedAction.type, (batchedAction: ReduxAction<unknown>) => batchedAction.type,
); );
if ( if (
_.intersection(EVALUATE_REDUX_ACTIONS, batchedActionTypes).length === 0 _.intersection(EVALUATE_REDUX_ACTIONS, batchedActionTypes).length === 0
@ -206,7 +237,7 @@ function* evaluationChangeListenerSaga() {
} }
} }
log.debug(`Evaluating`, { action }); log.debug(`Evaluating`, { action });
yield fork(evaluateTreeSaga); yield fork(evaluateTreeSaga, action.postEvalActions);
} }
// TODO(hetu) need an action to stop listening and evaluate (exit app) // TODO(hetu) need an action to stop listening and evaluate (exit app)
} }

View File

@ -3,7 +3,6 @@ import { getActionsForCurrentPage, getAppData } from "./entitiesSelector";
import { ActionDataState } from "reducers/entityReducers/actionsReducer"; import { ActionDataState } from "reducers/entityReducers/actionsReducer";
import { DataTree, DataTreeFactory } from "entities/DataTree/dataTreeFactory"; import { DataTree, DataTreeFactory } from "entities/DataTree/dataTreeFactory";
import { getWidgets, getWidgetsMeta } from "sagas/selectors"; import { getWidgets, getWidgetsMeta } from "sagas/selectors";
import * as log from "loglevel";
import "url-search-params-polyfill"; import "url-search-params-polyfill";
import { getPageList } from "./appViewSelectors"; import { getPageList } from "./appViewSelectors";
import PerformanceTracker, { import PerformanceTracker, {

View File

@ -63,8 +63,7 @@ ctx.addEventListener("message", e => {
} }
case EVAL_WORKER_ACTIONS.EVAL_SINGLE: { case EVAL_WORKER_ACTIONS.EVAL_SINGLE: {
const { binding, dataTree } = rest; const { binding, dataTree } = rest;
const evalTree = getEvaluatedDataTree(dataTree); const withFunctions = addFunctions(dataTree);
const withFunctions = addFunctions(evalTree);
const value = getDynamicValue(binding, withFunctions, false); const value = getDynamicValue(binding, withFunctions, false);
ctx.postMessage({ value, errors: ERRORS }); ctx.postMessage({ value, errors: ERRORS });
ERRORS = []; ERRORS = [];