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
run: |
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 \
--env APPSMITH_MONGODB_URI=mongodb://localhost:27017/appsmith \
--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>
</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>
</table>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -9,11 +9,15 @@ import {
} from "redux-saga/effects";
import { eventChannel, EventChannel } from "redux-saga";
import {
EvaluationReduxAction,
ReduxAction,
ReduxActionErrorTypes,
ReduxActionTypes,
} from "constants/ReduxActionConstants";
import { getUnevaluatedDataTree } from "selectors/dataTreeSelectors";
import {
getDataTree,
getUnevaluatedDataTree,
} from "selectors/dataTreeSelectors";
import WidgetFactory, { WidgetTypeConfigMap } from "../utils/WidgetFactory";
import Worker from "worker-loader!../workers/evaluation.worker";
import {
@ -27,12 +31,19 @@ import log from "loglevel";
import _ from "lodash";
import { WidgetType } from "../constants/WidgetConstants";
import { WidgetProps } from "../widgets/BaseWidget";
import PerformanceTracker, {
PerformanceTransactionName,
} from "../utils/PerformanceTracker";
let evaluationWorker: Worker;
let workerChannel: EventChannel<any>;
let widgetTypeConfigMap: WidgetTypeConfigMap;
const initEvaluationWorkers = () => {
// If an old worker exists, terminate it
if (evaluationWorker) {
evaluationWorker.terminate();
}
widgetTypeConfigMap = WidgetFactory.getWidgetTypeConfigMap();
evaluationWorker = new Worker();
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);
log.debug({ unEvalTree });
evaluationWorker.postMessage({
@ -73,14 +93,20 @@ function* evaluateTreeSaga() {
type: ReduxActionTypes.SET_EVALUATED_TREE,
payload: parsedDataTree,
});
PerformanceTracker.stopAsyncTracking(
PerformanceTransactionName.DATA_TREE_EVALUATION,
);
if (postEvalActions && postEvalActions.length) {
yield call(postEvalActionDispatcher, postEvalActions);
}
}
export function* evaluateSingleValue(binding: string) {
if (evaluationWorker) {
const unEvalTree = yield select(getUnevaluatedDataTree);
const dataTree = yield select(getDataTree);
evaluationWorker.postMessage({
action: EVAL_WORKER_ACTIONS.EVAL_SINGLE,
dataTree: unEvalTree,
dataTree,
binding,
});
const workerResponse = yield take(workerChannel);
@ -190,14 +216,19 @@ const EVALUATE_REDUX_ACTIONS = [
function* evaluationChangeListenerSaga() {
initEvaluationWorkers();
yield call(evaluateTreeSaga);
yield fork(evaluateTreeSaga);
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
// 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(
(batchedAction: ReduxAction<any>) => batchedAction.type,
(batchedAction: ReduxAction<unknown>) => batchedAction.type,
);
if (
_.intersection(EVALUATE_REDUX_ACTIONS, batchedActionTypes).length === 0
@ -206,7 +237,7 @@ function* evaluationChangeListenerSaga() {
}
}
log.debug(`Evaluating`, { action });
yield fork(evaluateTreeSaga);
yield fork(evaluateTreeSaga, action.postEvalActions);
}
// 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 { DataTree, DataTreeFactory } from "entities/DataTree/dataTreeFactory";
import { getWidgets, getWidgetsMeta } from "sagas/selectors";
import * as log from "loglevel";
import "url-search-params-polyfill";
import { getPageList } from "./appViewSelectors";
import PerformanceTracker, {

View File

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