Skip to content

Commit

Permalink
Merge pull request #459 from appsmithorg/release
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
mohanarpit authored Aug 28, 2020
2 parents de161d9 + 8a0805d commit 2b8764e
Show file tree
Hide file tree
Showing 37 changed files with 594 additions and 142 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ describe("Test curl import flow", function() {
localStorage.setItem("ApiPaneV2", "ApiPaneV2");
cy.NavigateToApiEditor();
cy.get(ApiEditor.curlImage).click({ force: true });
cy.get("textarea").type(
"curl -X GET http://app.appsmith.com/scrap/api?slugifiedName=Freshdesk&ownerName=volodimir.kudriachenko",
);
cy.get("textarea").type("curl -X GET https://mock-api.appsmith.com/users");
cy.importCurl();
cy.get("@curlImport").then(response => {
cy.expect(response.response.body.responseMeta.success).to.eq(true);
Expand Down
6 changes: 4 additions & 2 deletions app/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
"@craco/craco": "^5.6.1",
"@manaflair/redux-batch": "^1.0.0",
"@optimizely/optimizely-sdk": "^4.0.0",
"@sentry/browser": "^5.6.3",
"@sentry/webpack-plugin": "^1.10.0",
"@sentry/react": "^5.22.0",
"@sentry/tracing": "^5.22.0",
"@sentry/webpack-plugin": "^1.12.1",
"@types/chance": "^1.0.7",
"@types/lodash": "^4.14.120",
"@types/moment-timezone": "^0.5.10",
Expand Down Expand Up @@ -55,6 +56,7 @@
"fusioncharts": "^3.15.0-sr.1",
"history": "^4.10.1",
"husky": "^3.0.5",
"immer": "^7.0.8",
"instantsearch.css": "^7.4.2",
"instantsearch.js": "^4.4.1",
"interweave": "^12.1.1",
Expand Down
39 changes: 39 additions & 0 deletions app/client/src/actions/actionActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,38 @@ export const runAction = (id: string, paginationField?: PaginationField) => {
};
};

export const runActionInit = (
id: string,
paginationField?: PaginationField,
) => {
return {
type: ReduxActionTypes.RUN_ACTION_INIT,
payload: {
id,
paginationField,
},
};
};

export const showRunActionConfirmModal = (show: boolean) => {
return {
type: ReduxActionTypes.SHOW_RUN_ACTION_CONFIRM_MODAL,
payload: show,
};
};

export const cancelRunActionConfirmModal = () => {
return {
type: ReduxActionTypes.CANCEL_RUN_ACTION_CONFIRM_MODAL,
};
};

export const acceptRunActionConfirmModal = () => {
return {
type: ReduxActionTypes.ACCEPT_RUN_ACTION_CONFIRM_MODAL,
};
};

export const updateAction = (payload: { id: string }) => {
return batchAction({
type: ReduxActionTypes.UPDATE_ACTION_INIT,
Expand Down Expand Up @@ -196,6 +228,13 @@ export const updateActionProperty = (
});
};

export const setActionsToExecuteOnPageLoad = (actions: string[]) => {
return {
type: ReduxActionTypes.SET_ACTION_TO_EXECUTE_ON_PAGELOAD,
payload: actions,
};
};

export default {
createAction: createActionRequest,
fetchActions,
Expand Down
6 changes: 6 additions & 0 deletions app/client/src/api/ActionAPI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@ class ActionAPI extends API {
static executeQuery(executeAction: any): AxiosPromise<ActionApiResponse> {
return API.post(ActionAPI.url + "/execute", executeAction);
}

static toggleActionExecuteOnLoad(actionId: string, shouldExecute: boolean) {
return API.put(ActionAPI.url + `/executeOnLoad/${actionId}`, undefined, {
flag: shouldExecute.toString(),
});
}
}

export default ActionAPI;
6 changes: 5 additions & 1 deletion app/client/src/api/PageApi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ export type FetchPublishedPageResponse = ApiResponse & {
};

export interface SavePageResponse extends ApiResponse {
pageId: string;
data: {
id: string;
layoutOnLoadActions: PageAction[][];
dsl: Partial<ContainerWidgetProps<any>>;
};
}

export interface CreatePageRequest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,20 @@ class ChartComponent extends React.Component<ChartComponentProps> {
componentDidMount() {
this.createGraph();
FusionCharts.ready(() => {
this.chartInstance.render();
/* Component could be unmounted before FusionCharts is ready,
this check ensure we don't render on unmounted component */
if (this.chartInstance) {
this.chartInstance.render();
}
});
}

componentWillUnmount() {
if (this.chartInstance) {
this.chartInstance = null;
}
}

componentDidUpdate(prevProps: ChartComponentProps) {
if (!_.isEqual(prevProps, this.props)) {
const chartType = this.getChartType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ export const TableHeaderWrapper = styled.div<{
.show-page-items {
display: ${props => (props.width < 700 ? "none" : "flex")};
}
overflow-x: scroll;
overflow-x: auto;
overflow-y: hidden;
height: ${props => props.tableSizes.TABLE_HEADER_HEIGHT}px;
min-height: ${props => props.tableSizes.TABLE_HEADER_HEIGHT}px;
Expand Down Expand Up @@ -325,7 +325,7 @@ export const TableIconWrapper = styled.div<{
box-shadow: ${props =>
props.selected ? `inset 0px 4px 0px ${Colors.GREEN}` : "none"};
width: 48px;
height: 45px;
height: 42px;
display: flex;
align-items: center;
justify-content: center;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,12 @@ export function sortTableFunction(
)?.metaProperties?.type || ColumnTypes.TEXT;
return tableData.sort(
(a: { [key: string]: any }, b: { [key: string]: any }) => {
if (a[sortedColumn] !== undefined && b[sortedColumn] !== undefined) {
if (
a[sortedColumn] !== undefined &&
a[sortedColumn] !== null &&
b[sortedColumn] !== undefined &&
b[sortedColumn] !== null
) {
switch (columnType) {
case ColumnTypes.CURRENCY:
case ColumnTypes.NUMBER:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { ReactNode } from "react";
import styled from "styled-components";
import * as Sentry from "@sentry/browser";
import * as Sentry from "@sentry/react";

type Props = { isValid: boolean; children: ReactNode };
type State = { hasError: boolean };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
const Wrapper = styled.div`
.dynamic-text-field {
border-radius: 4px;
border: 1px solid #d0d7dd;
border: none;
font-size: 14px;
height: calc(100vh / 4);
}
Expand Down
35 changes: 23 additions & 12 deletions app/client/src/components/formControls/SwitchControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,30 @@ const SwitchWrapped = styled.div`
}
`;

const Info = styled.div`
font-size: 12px;
opacity: 0.7;
margin-top: 8px;
`;

export class SwitchField extends React.Component<Props> {
render() {
const { label, isRequired, input } = this.props;
const { label, isRequired, input, info } = this.props;

return (
<SwitchWrapped>
<StyledFormLabel>
{label} {isRequired && "*"}
</StyledFormLabel>
<StyledSwitch
checked={input.value}
onChange={value => input.onChange(value)}
large
/>
</SwitchWrapped>
<div>
<SwitchWrapped>
<StyledFormLabel>
{label} {isRequired && "*"}
</StyledFormLabel>
<StyledSwitch
checked={input.value}
onChange={value => input.onChange(value)}
large
/>
</SwitchWrapped>
{info && <Info>{info}</Info>}
</div>
);
}
}
Expand All @@ -56,6 +65,8 @@ class SwitchControl extends BaseControl<SwitchControlProps> {
}
}

export type SwitchControlProps = ControlProps;
export interface SwitchControlProps extends ControlProps {
info?: string;
}

export default SwitchControl;
10 changes: 9 additions & 1 deletion app/client/src/configs/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { AppsmithUIConfigs, FeatureFlagConfig } from "./types";
import { Integrations } from "@sentry/tracing";

type INJECTED_CONFIGS = {
sentry: {
dsn: string;
release: string;
environment: string;
integrations: any[];
tracesSampleRate: number;
};
smartLook: {
id: string;
Expand Down Expand Up @@ -48,7 +52,11 @@ const getConfigsFromEnvVars = (): INJECTED_CONFIGS => {
sentry: {
dsn: process.env.REACT_APP_SENTRY_DSN || "",
release: process.env.REACT_APP_SENTRY_RELEASE || "",
environment: capitalizeText(process.env.NODE_ENV),
environment:
process.env.REACT_APP_SENTRY_ENVIRONMENT ||
capitalizeText(process.env.NODE_ENV),
integrations: [new Integrations.BrowserTracing()],
tracesSampleRate: 1.0,
},
smartLook: {
id: process.env.REACT_APP_SMART_LOOK_ID || "",
Expand Down
4 changes: 2 additions & 2 deletions app/client/src/constants/DefaultTheme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -754,8 +754,8 @@ export const scrollbarLight = css<{ backgroundColor?: Color }>`
scrollbar-width: thin;
&::-webkit-scrollbar {
width: 6px;
height: 6px;
width: 4px;
height: 4px;
}
&::-webkit-scrollbar-track {
box-shadow: inset 0 0 6px
Expand Down
9 changes: 9 additions & 0 deletions app/client/src/constants/ReduxActionConstants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const ReduxActionTypes: { [key: string]: string } = {
REMOVE_PAGE_WIDGET: "REMOVE_PAGE_WIDGET",
LOAD_API_RESPONSE: "LOAD_API_RESPONSE",
LOAD_QUERY_RESPONSE: "LOAD_QUERY_RESPONSE",
RUN_ACTION_INIT: "RUN_ACTION_INIT",
RUN_ACTION_REQUEST: "RUN_ACTION_REQUEST",
RUN_ACTION_SUCCESS: "RUN_ACTION_SUCCESS",
INIT_API_PANE: "INIT_API_PANE",
Expand Down Expand Up @@ -59,6 +60,9 @@ export const ReduxActionTypes: { [key: string]: string } = {
UPDATE_ACTION_SUCCESS: "UPDATE_ACTION_SUCCESS",
DELETE_ACTION_INIT: "DELETE_ACTION_INIT",
DELETE_ACTION_SUCCESS: "DELETE_ACTION_SUCCESS",
SHOW_RUN_ACTION_CONFIRM_MODAL: "SHOW_RUN_ACTION_CONFIRM_MODAL",
CANCEL_RUN_ACTION_CONFIRM_MODAL: "CANCEL_RUN_ACTION_CONFIRM_MODAL",
ACCEPT_RUN_ACTION_CONFIRM_MODAL: "ACCEPT_RUN_ACTION_CONFIRM_MODAL",
CREATE_QUERY_INIT: "CREATE_QUERY_INIT",
FETCH_DATASOURCES_INIT: "FETCH_DATASOURCES_INIT",
FETCH_DATASOURCES_SUCCESS: "FETCH_DATASOURCES_SUCCESS",
Expand Down Expand Up @@ -254,6 +258,10 @@ export const ReduxActionTypes: { [key: string]: string } = {
TOGGLE_PROPERTY_PANE_WIDGET_NAME_EDIT:
"TOGGLE_PROPERTY_PANE_WIDGET_NAME_EDIT",
UPDATE_APP_STORE: "UPDATE_APP_STORE",
SET_ACTION_TO_EXECUTE_ON_PAGELOAD: "SET_ACTION_TO_EXECUTE_ON_PAGELOAD",
TOGGLE_ACTION_EXECUTE_ON_LOAD_SUCCESS:
"TOGGLE_ACTION_EXECUTE_ON_LOAD_SUCCESS",
TOGGLE_ACTION_EXECUTE_ON_LOAD_INIT: "TOGGLE_ACTION_EXECUTE_ON_LOAD_INIT",
};

export type ReduxActionType = typeof ReduxActionTypes[keyof typeof ReduxActionTypes];
Expand Down Expand Up @@ -344,6 +352,7 @@ export const ReduxActionErrorTypes: { [key: string]: string } = {
SAVE_API_NAME_ERROR: "SAVE_API_NAME_ERROR",
POPULATE_PAGEDSLS_ERROR: "POPULATE_PAGEDSLS_ERROR",
FETCH_PAGE_DSL_ERROR: "FETCH_PAGE_DSL_ERROR",
TOGGLE_ACTION_EXECUTE_ON_LOAD_ERROR: "TOGGLE_ACTION_EXECUTE_ON_LOAD_ERROR",
};

export const ReduxFormActionTypes: { [key: string]: string } = {
Expand Down
41 changes: 41 additions & 0 deletions app/client/src/mockResponses/ActionSettings.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
export const queryActionSettingsConfig = [
{
sectionName: "",
id: 1,
children: [
{
label: "Run query on Page load",
configProperty: "executeOnLoad",
controlType: "SWITCH",
info: "Will refresh data everytime page is reloaded",
},
// {
// label: "Request confirmation before running query",
// configProperty: "requestConfirmation",
// controlType: "SWITCH",
// info: "Ask confirmation from the user everytime before refreshing data",
// },
],
},
];

export const apiActionSettingsConfig = [
{
sectionName: "",
id: 1,
children: [
{
label: "Run api on Page load",
configProperty: "executeOnLoad",
controlType: "SWITCH",
info: "Will refresh data everytime page is reloaded",
},
// {
// label: "Request confirmation before running api",
// configProperty: "requestConfirmation",
// controlType: "SWITCH",
// info: "Ask confirmation from the user everytime before refreshing data",
// },
],
},
];
20 changes: 20 additions & 0 deletions app/client/src/pages/Editor/APIEditor/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import EmbeddedDatasourcePathField from "components/editorComponents/form/fields
import { AppState } from "reducers";
import { getApiName } from "selectors/formSelectors";
import ActionNameEditor from "components/editorComponents/ActionNameEditor";
import ActionSettings from "pages/Editor/ActionSettings";
import { apiActionSettingsConfig } from "mockResponses/ActionSettings";

const Form = styled.form`
display: flex;
Expand Down Expand Up @@ -111,6 +113,13 @@ const RequestParamsWrapper = styled.div`
padding-right: 10px;
`;

const SettingsWrapper = styled.div`
padding-left: 15px;
${FormLabel} {
padding: 0px;
}
`;

const HeadersSection = styled.div`
margin-bottom: 32px;
`;
Expand Down Expand Up @@ -256,6 +265,17 @@ const ApiEditorForm: React.FC<Props> = (props: Props) => {
/>
),
},
{
key: "settings",
title: "Settings",
panelComponent: (
<SettingsWrapper>
<ActionSettings
actionSettingsConfig={apiActionSettingsConfig}
/>
</SettingsWrapper>
),
},
]}
/>
</TabbedViewContainer>
Expand Down
Loading

0 comments on commit 2b8764e

Please sign in to comment.