Merge branch 'fix/widget-loading' into 'release'

Fix components for widget update

See merge request theappsmith/internal-tools-client!275
This commit is contained in:
Hetu Nandu 2020-01-31 11:13:16 +00:00
commit e0aa13b35e
6 changed files with 75 additions and 38 deletions

View File

@ -25,7 +25,13 @@ class DatePickerComponent extends React.Component<DatePickerComponentProps> {
return ( return (
<StyledControlGroup fill> <StyledControlGroup fill>
{this.props.label && ( {this.props.label && (
<Label className={Classes.TEXT_OVERFLOW_ELLIPSIS}> <Label
className={
this.props.isLoading
? Classes.SKELETON
: Classes.TEXT_OVERFLOW_ELLIPSIS
}
>
{this.props.label} {this.props.label}
</Label> </Label>
)} )}

View File

@ -74,7 +74,13 @@ class DropDownComponent extends React.Component<DropDownComponentProps> {
<DropdownContainer> <DropdownContainer>
<StyledControlGroup fill> <StyledControlGroup fill>
{this.props.label && ( {this.props.label && (
<Label className={Classes.TEXT_OVERFLOW_ELLIPSIS}> <Label
className={
this.props.isLoading
? Classes.SKELETON
: Classes.TEXT_OVERFLOW_ELLIPSIS
}
>
{this.props.label} {this.props.label}
</Label> </Label>
)} )}

View File

@ -105,10 +105,14 @@ class InputComponent extends React.Component<
return ( return (
<InputComponentWrapper fill> <InputComponentWrapper fill>
{this.props.label && ( {this.props.label && (
<Label className={Classes.TEXT_OVERFLOW_ELLIPSIS}> <Label
<span className={this.props.isLoading ? "bp3-skeleton" : ""}> className={
{this.props.label} this.props.isLoading
</span> ? Classes.SKELETON
: Classes.TEXT_OVERFLOW_ELLIPSIS
}
>
{this.props.label}
</Label> </Label>
)} )}

View File

@ -31,7 +31,13 @@ class RadioGroupComponent extends React.Component<RadioGroupComponentProps> {
return ( return (
<StyledControlGroup fill> <StyledControlGroup fill>
{this.props.label && ( {this.props.label && (
<Label className={Classes.TEXT_OVERFLOW_ELLIPSIS}> <Label
className={
this.props.isLoading
? Classes.SKELETON
: Classes.TEXT_OVERFLOW_ELLIPSIS
}
>
{this.props.label} {this.props.label}
</Label> </Label>
)} )}

View File

@ -20,6 +20,7 @@ import React, { useRef, MutableRefObject, useEffect, memo } from "react";
import styled from "constants/DefaultTheme"; import styled from "constants/DefaultTheme";
import { ColumnAction } from "components/propertyControls/ColumnActionSelectorControl"; import { ColumnAction } from "components/propertyControls/ColumnActionSelectorControl";
import { ActionPayload } from "constants/ActionConstants"; import { ActionPayload } from "constants/ActionConstants";
import { Classes } from "@blueprintjs/core";
export interface TableComponentProps { export interface TableComponentProps {
data: object[]; data: object[];
@ -163,38 +164,48 @@ const TableComponent = memo(
} }
return ( return (
<StyledGridComponent <div className={props.isLoading ? Classes.SKELETON : ""}>
selectionSettings={settings} <StyledGridComponent
dataSource={props.data} selectionSettings={settings}
rowSelected={rowSelected} dataSource={props.data}
ref={grid} rowSelected={rowSelected}
width={"100%"} ref={grid}
height={"100%"} width={"100%"}
allowPaging={true} height={"100%"}
allowReordering={true} allowPaging={true}
allowResizing={true} allowReordering={true}
showColumnMenu={true} allowResizing={true}
columnDragStart={columnDragStart} showColumnMenu={true}
columnDrop={columnDrop} columnDragStart={columnDragStart}
commandClick={onCommandClick} columnDrop={columnDrop}
columnMenuOpen={columnMenuOpen} commandClick={onCommandClick}
> columnMenuOpen={columnMenuOpen}
<Inject services={[Resize, Page, Reorder, ColumnMenu, CommandColumn]} /> // queryCellInfo={customizeCell}
<ColumnsDirective> >
{props.columns.map(col => { <Inject
return ( services={[Resize, Page, Reorder, ColumnMenu, CommandColumn]}
<ColumnDirective key={col.field} field={col.field} width={200} /> />
); <ColumnsDirective>
})} {props.columns.map(col => {
{commands.length > 0 && ( return (
<ColumnDirective headerText="Actions" commands={commands} /> <ColumnDirective
)} key={col.field}
</ColumnsDirective> field={col.field}
</StyledGridComponent> width={200}
/>
);
})}
{commands.length > 0 && (
<ColumnDirective headerText="Actions" commands={commands} />
)}
</ColumnsDirective>
</StyledGridComponent>
</div>
); );
}, },
(prevProps, nextProps) => { (prevProps, nextProps) => {
const propsNotEqual = const propsNotEqual =
nextProps.isLoading !== prevProps.isLoading ||
JSON.stringify(nextProps.data) !== JSON.stringify(prevProps.data) || JSON.stringify(nextProps.data) !== JSON.stringify(prevProps.data) ||
nextProps.height !== prevProps.height || nextProps.height !== prevProps.height ||
JSON.stringify(nextProps.columnActions) !== JSON.stringify(nextProps.columnActions) !==

View File

@ -11,6 +11,7 @@ import {
put, put,
takeEvery, takeEvery,
takeLatest, takeLatest,
take,
} from "redux-saga/effects"; } from "redux-saga/effects";
import { import {
ActionPayload, ActionPayload,
@ -382,7 +383,6 @@ export function* runApiActionSaga(action: ReduxAction<string>) {
function* executePageLoadActionsSaga(action: ReduxAction<PageAction[][]>) { function* executePageLoadActionsSaga(action: ReduxAction<PageAction[][]>) {
const pageActions = action.payload; const pageActions = action.payload;
const apiResponses = yield select(getActionResponses);
const actionPayloads: ActionPayload[][] = pageActions.map(actionSet => const actionPayloads: ActionPayload[][] = pageActions.map(actionSet =>
actionSet.map(action => ({ actionSet.map(action => ({
actionId: action.id, actionId: action.id,
@ -392,10 +392,14 @@ function* executePageLoadActionsSaga(action: ReduxAction<PageAction[][]>) {
})), })),
); );
for (const actionSet of actionPayloads) { for (const actionSet of actionPayloads) {
const apiResponses = yield select(getActionResponses);
const filteredSet = actionSet.filter( const filteredSet = actionSet.filter(
action => !(action.actionId in apiResponses), action => !apiResponses[action.actionId],
); );
yield* executeReduxActionSaga(executeAction(filteredSet)); yield put(executeAction(filteredSet));
for (const {} of filteredSet) {
yield take(ReduxActionTypes.EXECUTE_ACTION_SUCCESS);
}
} }
} }