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