From 1194bd5a57d45121a1aeb328901c63fecd1a75d1 Mon Sep 17 00:00:00 2001 From: Hetu Nandu Date: Thu, 9 May 2024 17:02:48 +0530 Subject: [PATCH] fix: Api pane and settings responsiveness (#33297) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description Various style and layout changes for side by side responsiveness Fixes #33249 ## Automation /ok-to-test tags="@tag.Datasource" ### :mag: Cypress test results > [!TIP] > ๐ŸŸข ๐ŸŸข ๐ŸŸข All cypress tests have passed! ๐ŸŽ‰ ๐ŸŽ‰ ๐ŸŽ‰ > Workflow run: > Commit: de02d207d06524e3aace37647821ffd45ee17e64 > Cypress dashboard url: Click here! ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No --- .../ApiTests/API_DefaultContentType_spec.js | 6 ++-- app/client/cypress/locators/ApiEditor.js | 5 +-- app/client/cypress/support/Pages/ApiPage.ts | 10 ++++-- .../form/fields/KeyValueFieldArray.tsx | 7 ++-- .../formConfig/GoogleSheetsSettingsConfig.ts | 1 + .../formConfig/QuerySettingsConfig.ts | 1 + .../Editor/APIEditor/ApiAuthentication.tsx | 12 +++---- .../src/pages/Editor/APIEditor/Pagination.tsx | 32 ++++++++----------- .../pages/Editor/APIEditor/PostBodyData.tsx | 27 ++++++++++------ .../src/main/resources/setting.json | 3 +- .../src/main/resources/setting.json | 3 +- .../src/main/resources/setting.json | 3 +- .../src/main/resources/setting.json | 5 +-- .../src/main/resources/setting.json | 3 +- .../src/main/resources/setting.json | 3 +- .../src/main/resources/setting.json | 3 +- .../src/main/resources/setting.json | 3 +- .../src/main/resources/setting.json | 3 +- .../src/main/resources/setting.json | 3 +- .../src/main/resources/setting.json | 3 +- .../src/main/resources/setting.json | 3 +- 21 files changed, 78 insertions(+), 61 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_DefaultContentType_spec.js b/app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_DefaultContentType_spec.js index 63700d4c74..75f2ba07d7 100644 --- a/app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_DefaultContentType_spec.js +++ b/app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_DefaultContentType_spec.js @@ -3,10 +3,10 @@ import { AppSidebarButton, } from "../../../../support/Pages/EditorNavigation"; -const testdata = require("../../../../fixtures/testdata.json"); const apiwidget = require("../../../../locators/apiWidgetslocator.json"); import appPage from "../../../../locators/CMSApplocators"; import apiEditor from "../../../../locators/ApiEditor"; +import { apiPage } from "../../../../support/Objects/ObjectsCore"; describe("API Panel request body", { tags: ["@tag.Datasource"] }, function () { it("1. Check whether the default content-type changes on changing method types and remains unchanged on switching to GET", function () { @@ -16,7 +16,7 @@ describe("API Panel request body", { tags: ["@tag.Datasource"] }, function () { cy.contains(apiEditor.bodyTab).click({ force: true }); cy.get(apiEditor.bodyTypeSelected).should("have.text", "NONE"); - cy.get(apiEditor.jsonBodyTab).click({ force: true }); + apiPage.SelectSubTab("JSON"); //Switch to headers tab cy.contains(apiEditor.headersTab).click(); @@ -35,7 +35,7 @@ describe("API Panel request body", { tags: ["@tag.Datasource"] }, function () { // Checking Body type to be JSON cy.contains(apiEditor.bodyTab).click({ force: true }); - cy.get(apiEditor.jsonBodyTab).click({ force: true }); + apiPage.SelectSubTab("JSON"); cy.get(apiEditor.bodyTypeSelected).should("have.text", "JSON"); // Changing method type to GET diff --git a/app/client/cypress/locators/ApiEditor.js b/app/client/cypress/locators/ApiEditor.js index 399dc2211b..0edf29323b 100644 --- a/app/client/cypress/locators/ApiEditor.js +++ b/app/client/cypress/locators/ApiEditor.js @@ -23,11 +23,8 @@ export default { ".t--apiFormPaginationType label:contains('Paginate with response URL') input", apiTab: ".react-tabs__tab-list li", bodyType: ".t--apiFormPostBodyType", - bodyTypeSelected: - '[data-testid="t--api-body-tab-switch"] .ads-v2-segmented-control__segments-container-segment[data-selected="true"]', + bodyTypeSelected: '[data-testid="t--api-body-tab-switch"] .rc-select-selection-item', bodyTab: "Body", - jsonBodyTab: - ".ads-v2-segmented-control__segments-container-segment[data-value='application/json']", headersTab: "Header", jsonResponseTab: "[data-value='JSON']", tableResponseTab: "[data-value='TABLE']", diff --git a/app/client/cypress/support/Pages/ApiPage.ts b/app/client/cypress/support/Pages/ApiPage.ts index 45ba3b6b2c..115d2a3f59 100644 --- a/app/client/cypress/support/Pages/ApiPage.ts +++ b/app/client/cypress/support/Pages/ApiPage.ts @@ -61,8 +61,11 @@ export class ApiPage { "//div[contains(@class, 'rc-select-item-option')]//div[contains(text(),'" + verb + "')]"; - private _bodySubTab = (subTab: string) => - `//div[@data-testid="t--api-body-tab-switch"]//span[text()='${subTab}']`; + private _bodyTypeSelect = `//div[@data-testid="t--api-body-tab-switch"]`; + private _bodyTypeToSelect = (subTab: string) => + "//div[contains(@class, 'rc-select-item-option')]//div[contains(text(),'" + + subTab + + "')]"; private _rightPaneTab = (tab: string) => "//span[contains(text(), '" + tab + "')]/parent::button"; _visibleTextSpan = (spanText: string) => "//span[text()='" + spanText + "']"; @@ -290,7 +293,8 @@ export class ApiPage { | "BINARY" | "RAW", ) { - this.agHelper.GetNClick(this._bodySubTab(subTabName)); + this.agHelper.GetNClick(this._bodyTypeSelect); + cy.xpath(this._bodyTypeToSelect(subTabName)).should("be.visible").click(); } AssertRightPaneSelectedTab(tabName: RightPaneTabs) { diff --git a/app/client/src/components/editorComponents/form/fields/KeyValueFieldArray.tsx b/app/client/src/components/editorComponents/form/fields/KeyValueFieldArray.tsx index 3daa266609..d87f3dbb2e 100644 --- a/app/client/src/components/editorComponents/form/fields/KeyValueFieldArray.tsx +++ b/app/client/src/components/editorComponents/form/fields/KeyValueFieldArray.tsx @@ -116,7 +116,7 @@ function KeyValueRow(props: Props & WrappedFieldArrayProps) { > {!props.hideHeader && ( - + Key @@ -144,7 +144,10 @@ function KeyValueRow(props: Props & WrappedFieldArrayProps) { return ( - + {props.hasType ? ( ` margin-left: 5px; `; -const DescriptionText = styled(Text)` - margin: 12px auto; -`; - function OAuthLabel(props: ErrorProps) { return ( @@ -118,11 +116,11 @@ function ApiAuthentication(props: Props): JSX.Element { return ( {authType === AuthType.OAuth2 && } - + {shouldSave ? createMessage(SAVE_DATASOURCE_MESSAGE) : createMessage(EDIT_DATASOURCE_MESSAGE)} - + props.theme.spaces[11]}px; + max-width: 100%; `; const PaginationSection = styled.div` display: flex; padding: var(--ads-v2-spaces-4) 0 0 0; + flex-direction: column; + align-items: flex-start; + gap: var(--ads-v2-spaces-3); `; const Example = styled(Text)` @@ -77,7 +81,7 @@ const BindingKey = styled.div` const GifContainer = styled.div` display: flex; flex-direction: column; - align-items: center; + align-items: flex-start; img { width: 320px; @@ -121,15 +125,13 @@ export default function Pagination(props: PaginationProps) { 1. Configure table for pagination - 1. Enable server side pagination - 2. Configure OnPageChange action 2. Configure request parameters - - 1. Map appropiate parameter or header in your request to + + 1. Map appropriate parameter or header in your request to UsersTableโ€™s page number property @@ -139,12 +141,6 @@ export default function Pagination(props: PaginationProps) { {"{{UsersTable.pageNo}}"} - - - - 1. How to configure table for pagination - - ,
@@ -153,8 +149,6 @@ export default function Pagination(props: PaginationProps) { 1. Configure table for pagination - 1. Enable server side pagination - 2. Configure OnPageChange action 2. Configure Request Parameters @@ -212,16 +206,16 @@ export default function Pagination(props: PaginationProps) {
- - - - 1. How to configure table for pagination - -
, ]} /> + {props.paginationType !== PaginationType.NONE ? ( + + + Configure table for pagination + + ) : null} ); } diff --git a/app/client/src/pages/Editor/APIEditor/PostBodyData.tsx b/app/client/src/pages/Editor/APIEditor/PostBodyData.tsx index 2dbdc7093b..2eff5c354b 100644 --- a/app/client/src/pages/Editor/APIEditor/PostBodyData.tsx +++ b/app/client/src/pages/Editor/APIEditor/PostBodyData.tsx @@ -23,16 +23,18 @@ import { updateBodyContentType } from "actions/apiPaneActions"; import type { CodeEditorExpected } from "components/editorComponents/CodeEditor"; import { AutocompleteDataType } from "utils/autocomplete/AutocompleteDataType"; import { createMessage, API_PANE_NO_BODY } from "@appsmith/constants/messages"; -import { SegmentedControl } from "design-system"; +import { Select, Option } from "design-system"; const PostBodyContainer = styled.div` + display: flex; + flex-direction: column; padding: 12px 0px 0px; background-color: var(--ads-v2-color-bg); height: 100%; - .ads-v2-segmented-control { - /* max-width: fit-content; - margin-left: 30px; */ - margin-bottom: 12px; + gap: var(--ads-v2-spaces-4); + .ads-v2-select { + max-width: 250px; + width: 100%; } `; @@ -174,13 +176,18 @@ function PostBodyData(props: Props) { return ( - postBodyDataOnChangeFn(key)} - options={options} - /> + onSelect={(value) => postBodyDataOnChangeFn(value)} + value={selectedTab} + > + {options.map((option) => ( + + ))} + {tabComponentsMap(selectedTab)} ); diff --git a/app/server/appsmith-plugins/amazons3Plugin/src/main/resources/setting.json b/app/server/appsmith-plugins/amazons3Plugin/src/main/resources/setting.json index 1c2d79edc9..e50f52d848 100644 --- a/app/server/appsmith-plugins/amazons3Plugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/amazons3Plugin/src/main/resources/setting.json @@ -29,8 +29,9 @@ "configProperty": "actionConfiguration.timeoutInMillisecond", "controlType": "INPUT_TEXT", "dataType": "NUMBER" + "width": "270px" } ] } ] -} \ No newline at end of file +} diff --git a/app/server/appsmith-plugins/anthropicPlugin/src/main/resources/setting.json b/app/server/appsmith-plugins/anthropicPlugin/src/main/resources/setting.json index 4dd710a3bc..dd959a1b4b 100644 --- a/app/server/appsmith-plugins/anthropicPlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/anthropicPlugin/src/main/resources/setting.json @@ -22,7 +22,8 @@ "configProperty": "actionConfiguration.timeoutInMillisecond", "controlType": "INPUT_TEXT", "initialValue": 60000, - "dataType": "NUMBER" + "dataType": "NUMBER", + "width": "270px" } ] } diff --git a/app/server/appsmith-plugins/appsmithAiPlugin/src/main/resources/setting.json b/app/server/appsmith-plugins/appsmithAiPlugin/src/main/resources/setting.json index 4dd710a3bc..dd959a1b4b 100644 --- a/app/server/appsmith-plugins/appsmithAiPlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/appsmithAiPlugin/src/main/resources/setting.json @@ -22,7 +22,8 @@ "configProperty": "actionConfiguration.timeoutInMillisecond", "controlType": "INPUT_TEXT", "initialValue": 60000, - "dataType": "NUMBER" + "dataType": "NUMBER", + "width": "270px" } ] } diff --git a/app/server/appsmith-plugins/firestorePlugin/src/main/resources/setting.json b/app/server/appsmith-plugins/firestorePlugin/src/main/resources/setting.json index a3ff4182e6..0cad17a20c 100644 --- a/app/server/appsmith-plugins/firestorePlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/firestorePlugin/src/main/resources/setting.json @@ -28,9 +28,10 @@ "subtitle": "Maximum time after which the query will return", "configProperty": "actionConfiguration.timeoutInMillisecond", "controlType": "INPUT_TEXT", - "dataType": "NUMBER" + "dataType": "NUMBER", + "width": "270px" } ] } ] -} \ No newline at end of file +} diff --git a/app/server/appsmith-plugins/googleAiPlugin/src/main/resources/setting.json b/app/server/appsmith-plugins/googleAiPlugin/src/main/resources/setting.json index 4dd710a3bc..dd959a1b4b 100644 --- a/app/server/appsmith-plugins/googleAiPlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/googleAiPlugin/src/main/resources/setting.json @@ -22,7 +22,8 @@ "configProperty": "actionConfiguration.timeoutInMillisecond", "controlType": "INPUT_TEXT", "initialValue": 60000, - "dataType": "NUMBER" + "dataType": "NUMBER", + "width": "270px" } ] } diff --git a/app/server/appsmith-plugins/googleSheetsPlugin/src/main/resources/setting.json b/app/server/appsmith-plugins/googleSheetsPlugin/src/main/resources/setting.json index c143023ee8..5f9686e6b7 100644 --- a/app/server/appsmith-plugins/googleSheetsPlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/googleSheetsPlugin/src/main/resources/setting.json @@ -28,7 +28,8 @@ "subtitle": "Maximum time after which the query will return", "configProperty": "actionConfiguration.timeoutInMillisecond", "controlType": "INPUT_TEXT", - "dataType": "NUMBER" + "dataType": "NUMBER", + "width": "270px" } ] } diff --git a/app/server/appsmith-plugins/mongoPlugin/src/main/resources/setting.json b/app/server/appsmith-plugins/mongoPlugin/src/main/resources/setting.json index aa6737e9cd..b4392c833f 100644 --- a/app/server/appsmith-plugins/mongoPlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/mongoPlugin/src/main/resources/setting.json @@ -28,7 +28,8 @@ "subtitle": "Maximum time after which the query will return", "configProperty": "actionConfiguration.timeoutInMillisecond", "controlType": "INPUT_TEXT", - "dataType": "NUMBER" + "dataType": "NUMBER", + "width": "270px" } ] } diff --git a/app/server/appsmith-plugins/mssqlPlugin/src/main/resources/setting.json b/app/server/appsmith-plugins/mssqlPlugin/src/main/resources/setting.json index 7474a0fc06..dfcf8fcc37 100644 --- a/app/server/appsmith-plugins/mssqlPlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/mssqlPlugin/src/main/resources/setting.json @@ -28,7 +28,8 @@ "subtitle": "Maximum time after which the query will return", "configProperty": "actionConfiguration.timeoutInMillisecond", "controlType": "INPUT_TEXT", - "dataType": "NUMBER" + "dataType": "NUMBER", + "width": "270px" } ] } diff --git a/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/setting.json b/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/setting.json index 7474a0fc06..dfcf8fcc37 100644 --- a/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/setting.json @@ -28,7 +28,8 @@ "subtitle": "Maximum time after which the query will return", "configProperty": "actionConfiguration.timeoutInMillisecond", "controlType": "INPUT_TEXT", - "dataType": "NUMBER" + "dataType": "NUMBER", + "width": "270px" } ] } diff --git a/app/server/appsmith-plugins/openAiPlugin/src/main/resources/setting.json b/app/server/appsmith-plugins/openAiPlugin/src/main/resources/setting.json index 4dd710a3bc..dd959a1b4b 100644 --- a/app/server/appsmith-plugins/openAiPlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/openAiPlugin/src/main/resources/setting.json @@ -22,7 +22,8 @@ "configProperty": "actionConfiguration.timeoutInMillisecond", "controlType": "INPUT_TEXT", "initialValue": 60000, - "dataType": "NUMBER" + "dataType": "NUMBER", + "width": "270px" } ] } diff --git a/app/server/appsmith-plugins/oraclePlugin/src/main/resources/setting.json b/app/server/appsmith-plugins/oraclePlugin/src/main/resources/setting.json index 58fea8dc64..458233d4b2 100755 --- a/app/server/appsmith-plugins/oraclePlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/oraclePlugin/src/main/resources/setting.json @@ -28,7 +28,8 @@ "subtitle": "Maximum time after which the query will return", "configProperty": "actionConfiguration.timeoutInMillisecond", "controlType": "INPUT_TEXT", - "dataType": "NUMBER" + "dataType": "NUMBER", + "width": "270px" } ] } diff --git a/app/server/appsmith-plugins/postgresPlugin/src/main/resources/setting.json b/app/server/appsmith-plugins/postgresPlugin/src/main/resources/setting.json index 7474a0fc06..dfcf8fcc37 100644 --- a/app/server/appsmith-plugins/postgresPlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/postgresPlugin/src/main/resources/setting.json @@ -28,7 +28,8 @@ "subtitle": "Maximum time after which the query will return", "configProperty": "actionConfiguration.timeoutInMillisecond", "controlType": "INPUT_TEXT", - "dataType": "NUMBER" + "dataType": "NUMBER", + "width": "270px" } ] }