Merge branch 'master' of gitlab.com:theappsmith/internal-tools-client into feature/widget-actions-menu
This commit is contained in:
commit
f55b76b582
|
|
@ -148,39 +148,34 @@
|
||||||
"chartType": "BAR_CHART",
|
"chartType": "BAR_CHART",
|
||||||
"chartName": "App Sign Up",
|
"chartName": "App Sign Up",
|
||||||
"allowHorizontalScroll": false,
|
"allowHorizontalScroll": false,
|
||||||
"chartData": [
|
"singleChartData": [
|
||||||
{
|
{
|
||||||
"seriesName": "",
|
"x": "Mon",
|
||||||
"data": [
|
"y": 10000
|
||||||
{
|
},
|
||||||
"x": "Mon",
|
{
|
||||||
"y": 10000
|
"x": "Tue",
|
||||||
},
|
"y": 12000
|
||||||
{
|
},
|
||||||
"x": "Tue",
|
{
|
||||||
"y": 12000
|
"x": "Wed",
|
||||||
},
|
"y": 32000
|
||||||
{
|
},
|
||||||
"x": "Wed",
|
{
|
||||||
"y": 32000
|
"x": "Thu",
|
||||||
},
|
"y": 28000
|
||||||
{
|
},
|
||||||
"x": "Thu",
|
{
|
||||||
"y": 28000
|
"x": "Fri",
|
||||||
},
|
"y": 14000
|
||||||
{
|
},
|
||||||
"x": "Fri",
|
{
|
||||||
"y": 14000
|
"x": "Sat",
|
||||||
},
|
"y": 19000
|
||||||
{
|
},
|
||||||
"x": "Sat",
|
{
|
||||||
"y": 19000
|
"x": "Sun",
|
||||||
},
|
"y": 36000
|
||||||
{
|
|
||||||
"x": "Sun",
|
|
||||||
"y": 36000
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"xAxisName": "Last Week",
|
"xAxisName": "Last Week",
|
||||||
|
|
@ -265,4 +260,4 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"layoutOnLoadActions": []
|
"layoutOnLoadActions": []
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,14 +25,14 @@ describe("Input Widget Functionality", function() {
|
||||||
cy.get(widgetsPage.innertext)
|
cy.get(widgetsPage.innertext)
|
||||||
.click({ force: true })
|
.click({ force: true })
|
||||||
.type(this.data.para);
|
.type(this.data.para);
|
||||||
cy.get(publish.inputWidget + " " + "input")
|
cy.get(widgetsPage.inputWidget + " " + "input")
|
||||||
.invoke("attr", "value")
|
.invoke("attr", "value")
|
||||||
.should("contain", this.data.para);
|
.should("contain", this.data.para);
|
||||||
cy.openPropertyPane("inputwidget");
|
cy.openPropertyPane("inputwidget");
|
||||||
cy.get(widgetsPage.defaultInput)
|
cy.get(widgetsPage.defaultInput)
|
||||||
.type(this.data.command)
|
.type(this.data.command)
|
||||||
.type(this.data.defaultdata);
|
.type(this.data.defaultdata);
|
||||||
cy.get(publish.inputWidget + " " + "input")
|
cy.get(widgetsPage.inputWidget + " " + "input")
|
||||||
.invoke("attr", "value")
|
.invoke("attr", "value")
|
||||||
.should("contain", this.data.defaultdata);
|
.should("contain", this.data.defaultdata);
|
||||||
cy.get(widgetsPage.placeholder)
|
cy.get(widgetsPage.placeholder)
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ const dsl = require("../../../fixtures/viewdsl.json");
|
||||||
describe("Chart Widget Functionality", function() {
|
describe("Chart Widget Functionality", function() {
|
||||||
before(() => {
|
before(() => {
|
||||||
cy.addDsl(dsl);
|
cy.addDsl(dsl);
|
||||||
|
cy.viewport("macbook-15"); //To avoid screen Resize issues
|
||||||
});
|
});
|
||||||
it("Chart Widget Functionality", function() {
|
it("Chart Widget Functionality", function() {
|
||||||
cy.openPropertyPane("chartwidget");
|
cy.openPropertyPane("chartwidget");
|
||||||
|
|
@ -65,6 +66,7 @@ describe("Chart Widget Functionality", function() {
|
||||||
cy.get(commonlocators.editPropCrossButton).click();
|
cy.get(commonlocators.editPropCrossButton).click();
|
||||||
});
|
});
|
||||||
it("Chart Widget Functionality To Unchecked Visible Widget", function() {
|
it("Chart Widget Functionality To Unchecked Visible Widget", function() {
|
||||||
|
cy.viewport("macbook-15"); //To avoid screen Resize issues
|
||||||
cy.openPropertyPane("chartwidget");
|
cy.openPropertyPane("chartwidget");
|
||||||
cy.togglebarDisable(commonlocators.visibleCheckbox);
|
cy.togglebarDisable(commonlocators.visibleCheckbox);
|
||||||
cy.PublishtheApp();
|
cy.PublishtheApp();
|
||||||
|
|
@ -72,6 +74,7 @@ describe("Chart Widget Functionality", function() {
|
||||||
cy.get(publish.backToEditor).click();
|
cy.get(publish.backToEditor).click();
|
||||||
});
|
});
|
||||||
it("Chart Widget Functionality To Check Visible Widget", function() {
|
it("Chart Widget Functionality To Check Visible Widget", function() {
|
||||||
|
cy.viewport("macbook-15"); //To avoid screen Resize issues
|
||||||
cy.openPropertyPane("chartwidget");
|
cy.openPropertyPane("chartwidget");
|
||||||
cy.togglebar(commonlocators.visibleCheckbox);
|
cy.togglebar(commonlocators.visibleCheckbox);
|
||||||
cy.PublishtheApp();
|
cy.PublishtheApp();
|
||||||
|
|
@ -79,6 +82,7 @@ describe("Chart Widget Functionality", function() {
|
||||||
cy.get(publish.backToEditor).click();
|
cy.get(publish.backToEditor).click();
|
||||||
});
|
});
|
||||||
it("Chart Widget Functionality To Uncheck Horizontal Scroll Visible", function() {
|
it("Chart Widget Functionality To Uncheck Horizontal Scroll Visible", function() {
|
||||||
|
cy.viewport("macbook-15"); //To avoid screen Resize issues
|
||||||
cy.openPropertyPane("chartwidget");
|
cy.openPropertyPane("chartwidget");
|
||||||
cy.togglebarDisable(commonlocators.horizontalScroll);
|
cy.togglebarDisable(commonlocators.horizontalScroll);
|
||||||
cy.PublishtheApp();
|
cy.PublishtheApp();
|
||||||
|
|
@ -86,6 +90,7 @@ describe("Chart Widget Functionality", function() {
|
||||||
cy.get(publish.backToEditor).click();
|
cy.get(publish.backToEditor).click();
|
||||||
});
|
});
|
||||||
it("Chart Widget Functionality To Check Horizontal Scroll Visible", function() {
|
it("Chart Widget Functionality To Check Horizontal Scroll Visible", function() {
|
||||||
|
cy.viewport("macbook-15"); //To avoid screen Resize issues
|
||||||
cy.openPropertyPane("chartwidget");
|
cy.openPropertyPane("chartwidget");
|
||||||
cy.togglebar(commonlocators.horizontalScroll);
|
cy.togglebar(commonlocators.horizontalScroll);
|
||||||
cy.PublishtheApp();
|
cy.PublishtheApp();
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,10 @@
|
||||||
"dropdownWidget": ".t--widget-dropdownwidget",
|
"dropdownWidget": ".t--widget-dropdownwidget",
|
||||||
"tabWidget": ".t--widget-tabswidget",
|
"tabWidget": ".t--widget-tabswidget",
|
||||||
"chartWidget": ".t--widget-chartwidget",
|
"chartWidget": ".t--widget-chartwidget",
|
||||||
"horizontalTab": ".t--widget-chartwidget g[class='raphael-group-104-axis-Line-group'] rect",
|
"horizontalTab": ".t--widget-chartwidget g[class*='-scrollContainer'] rect",
|
||||||
"tableWidget": ".t--widget-tablewidget",
|
"tableWidget": ".t--widget-tablewidget",
|
||||||
"mapWidget": ".t--widget-mapwidget",
|
"mapWidget": ".t--widget-mapwidget",
|
||||||
"tableLength": ".t--widget-tablewidget .e-gridcontent.e-lib.e-droppable",
|
"tableLength": ".t--widget-tablewidget .e-gridcontent.e-lib.e-droppable",
|
||||||
"mapSearch": ".t--widget-mapwidget input",
|
"mapSearch": ".t--widget-mapwidget input",
|
||||||
"pickMyLocation": ".t--widget-mapwidget div[title='Pick My Location']"
|
"pickMyLocation": ".t--widget-mapwidget div[title='Pick My Location']"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ export const VALIDATION_TYPES = {
|
||||||
ARRAY: "ARRAY",
|
ARRAY: "ARRAY",
|
||||||
TABLE_DATA: "TABLE_DATA",
|
TABLE_DATA: "TABLE_DATA",
|
||||||
OPTIONS_DATA: "OPTIONS_DATA",
|
OPTIONS_DATA: "OPTIONS_DATA",
|
||||||
|
SINGLE_CHART_DATA: "SINGLE_CHART_DATA",
|
||||||
DATE: "DATE",
|
DATE: "DATE",
|
||||||
TABS_DATA: "TABS_DATA",
|
TABS_DATA: "TABS_DATA",
|
||||||
CHART_DATA: "CHART_DATA",
|
CHART_DATA: "CHART_DATA",
|
||||||
|
|
|
||||||
|
|
@ -312,39 +312,34 @@ const WidgetConfigResponse: WidgetConfigReducerState = {
|
||||||
chartType: "LINE_CHART",
|
chartType: "LINE_CHART",
|
||||||
chartName: "Sales on working days",
|
chartName: "Sales on working days",
|
||||||
allowHorizontalScroll: false,
|
allowHorizontalScroll: false,
|
||||||
chartData: [
|
singleChartData: [
|
||||||
{
|
{
|
||||||
seriesName: "",
|
x: "Mon",
|
||||||
data: [
|
y: 10000,
|
||||||
{
|
},
|
||||||
x: "Mon",
|
{
|
||||||
y: 10000,
|
x: "Tue",
|
||||||
},
|
y: 12000,
|
||||||
{
|
},
|
||||||
x: "Tue",
|
{
|
||||||
y: 12000,
|
x: "Wed",
|
||||||
},
|
y: 32000,
|
||||||
{
|
},
|
||||||
x: "Wed",
|
{
|
||||||
y: 32000,
|
x: "Thu",
|
||||||
},
|
y: 28000,
|
||||||
{
|
},
|
||||||
x: "Thu",
|
{
|
||||||
y: 28000,
|
x: "Fri",
|
||||||
},
|
y: 14000,
|
||||||
{
|
},
|
||||||
x: "Fri",
|
{
|
||||||
y: 14000,
|
x: "Sat",
|
||||||
},
|
y: 19000,
|
||||||
{
|
},
|
||||||
x: "Sat",
|
{
|
||||||
y: 19000,
|
x: "Sun",
|
||||||
},
|
y: 36000,
|
||||||
{
|
|
||||||
x: "Sun",
|
|
||||||
y: 36000,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
xAxisName: "Last Week",
|
xAxisName: "Last Week",
|
||||||
|
|
|
||||||
|
|
@ -316,6 +316,45 @@ export const VALIDATORS: Record<ValidationType, Validator> = {
|
||||||
}
|
}
|
||||||
return { isValid, parsed };
|
return { isValid, parsed };
|
||||||
},
|
},
|
||||||
|
[VALIDATION_TYPES.SINGLE_CHART_DATA]: (value, props, dataTree) => {
|
||||||
|
const { isValid, parsed } = VALIDATORS[VALIDATION_TYPES.TABLE_DATA](
|
||||||
|
value,
|
||||||
|
props,
|
||||||
|
dataTree,
|
||||||
|
);
|
||||||
|
if (!isValid) {
|
||||||
|
return {
|
||||||
|
isValid: false,
|
||||||
|
parsed: [],
|
||||||
|
message: `${WIDGET_TYPE_VALIDATION_ERROR}: Chart Data`,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const isValidChartData = _.every(
|
||||||
|
parsed,
|
||||||
|
(chartPoint: { x: string; y: any }) => {
|
||||||
|
return (
|
||||||
|
_.isObject(chartPoint) &&
|
||||||
|
_.isString(chartPoint.x) &&
|
||||||
|
!_.isUndefined(chartPoint.y)
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!isValidChartData) {
|
||||||
|
return {
|
||||||
|
isValid: false,
|
||||||
|
parsed: [],
|
||||||
|
message: `${WIDGET_TYPE_VALIDATION_ERROR}: Chart Data`,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
isValid: true,
|
||||||
|
parsed,
|
||||||
|
message: "",
|
||||||
|
};
|
||||||
|
},
|
||||||
[VALIDATION_TYPES.MARKERS]: (
|
[VALIDATION_TYPES.MARKERS]: (
|
||||||
value: any,
|
value: any,
|
||||||
props: WidgetProps,
|
props: WidgetProps,
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,20 @@ class ChartWidget extends BaseWidget<ChartWidgetProps, WidgetState> {
|
||||||
chartName: VALIDATION_TYPES.TEXT,
|
chartName: VALIDATION_TYPES.TEXT,
|
||||||
isVisible: VALIDATION_TYPES.BOOLEAN,
|
isVisible: VALIDATION_TYPES.BOOLEAN,
|
||||||
chartData: VALIDATION_TYPES.CHART_DATA,
|
chartData: VALIDATION_TYPES.CHART_DATA,
|
||||||
|
singleChartData: VALIDATION_TYPES.SINGLE_CHART_DATA,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
getPageView() {
|
getPageView() {
|
||||||
|
let chartData: ChartData[] = this.props.chartData;
|
||||||
|
if (this.props.singleChartData) {
|
||||||
|
chartData = [
|
||||||
|
{
|
||||||
|
seriesName: this.props.chartName,
|
||||||
|
data: this.props.singleChartData,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<Suspense fallback={<Skeleton />}>
|
<Suspense fallback={<Skeleton />}>
|
||||||
<ChartComponent
|
<ChartComponent
|
||||||
|
|
@ -33,7 +43,7 @@ class ChartWidget extends BaseWidget<ChartWidgetProps, WidgetState> {
|
||||||
xAxisName={this.props.xAxisName}
|
xAxisName={this.props.xAxisName}
|
||||||
yAxisName={this.props.yAxisName}
|
yAxisName={this.props.yAxisName}
|
||||||
chartName={this.props.chartName}
|
chartName={this.props.chartName}
|
||||||
chartData={this.props.chartData}
|
chartData={chartData}
|
||||||
widgetId={this.props.widgetId}
|
widgetId={this.props.widgetId}
|
||||||
allowHorizontalScroll={this.props.allowHorizontalScroll}
|
allowHorizontalScroll={this.props.allowHorizontalScroll}
|
||||||
/>
|
/>
|
||||||
|
|
@ -67,6 +77,7 @@ export interface ChartData {
|
||||||
export interface ChartWidgetProps extends WidgetProps {
|
export interface ChartWidgetProps extends WidgetProps {
|
||||||
chartType: ChartType;
|
chartType: ChartType;
|
||||||
chartData: ChartData[];
|
chartData: ChartData[];
|
||||||
|
singleChartData: ChartDataPoint[];
|
||||||
xAxisName: string;
|
xAxisName: string;
|
||||||
yAxisName: string;
|
yAxisName: string;
|
||||||
chartName: string;
|
chartName: string;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user