Skip to content

Commit

Permalink
fix: recent entities and incoming entity change (appsmithorg#8342)
Browse files Browse the repository at this point in the history
* recent entities and incoming entity change

* added icon for js objects
  • Loading branch information
ApekshaBhosale authored Oct 11, 2021
1 parent b4b038d commit 5eb292a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ import { getSelectedWidget } from "selectors/ui";
import { getDataTree } from "selectors/dataTreeSelectors";
import { useNavigateToWidget } from "pages/Editor/Explorer/Widgets/useNavigateToWidget";
import { getActionConfig } from "pages/Editor/Explorer/Actions/helpers";
import { isWidget, isAction } from "workers/evaluationUtils";
import { isWidget, isAction, isJSAction } from "workers/evaluationUtils";
import history from "utils/history";
import { JS_COLLECTION_ID_URL } from "constants/routes";

export const useFilteredLogs = (query: string, filter?: any) => {
let logs = useSelector((state: AppState) => state.ui.debugger.logs);
Expand Down Expand Up @@ -134,6 +135,10 @@ export const useEntityLink = () => {
if (url) {
history.push(url);
}
} else if (isJSAction(entity)) {
history.push(
JS_COLLECTION_ID_URL(applicationId, pageId, entity.actionId),
);
}
},
[dataTree],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import { isEqual, keyBy } from "lodash";
import {
getPluginIcon,
getWidgetIcon,
jsIcon,
} from "pages/Editor/Explorer/ExplorerIcons";
import { useMemo, useCallback } from "react";
import { AppState } from "reducers";
import { getFilteredErrors } from "selectors/debuggerSelectors";
import { getAction, getDatasource } from "selectors/entitiesSelector";
import { useSelector } from "react-redux";
import { isAction, isWidget } from "workers/evaluationUtils";
import { isAction, isJSAction, isWidget } from "workers/evaluationUtils";
import { doesEntityHaveErrors } from "../helpers";

export const useGetEntityInfo = (name: string) => {
Expand All @@ -19,7 +20,6 @@ export const useGetEntityInfo = (name: string) => {
const action = useSelector((state: AppState) =>
isAction(entity) ? getAction(state, entity.actionId) : undefined,
);

const plugins = useSelector((state: AppState) => {
return state.entities.plugins.list;
}, isEqual);
Expand Down Expand Up @@ -54,6 +54,16 @@ export const useGetEntityInfo = (name: string) => {
type: ENTITY_TYPE.ACTION,
entityType: action?.pluginId ? pluginGroups[action.pluginId].name : "",
};
} else if (isJSAction(entity)) {
const hasError = doesEntityHaveErrors(entity.actionId, debuggerErrors);
const icon = jsIcon;
return {
name,
icon,
hasError,
type: ENTITY_TYPE.JSACTION,
entityType: entity.type,
};
}
}, [name]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ export const getEntityId = (entity: any) => {
case "widget":
return entity.widgetId;
case "action":
case "jsAction":
return entity.config?.id;
}
};

0 comments on commit 5eb292a

Please sign in to comment.