From a77d608776f7bf09a218033a26c3c20683aa66c1 Mon Sep 17 00:00:00 2001 From: Vemparala Surya Vamsi <121419957+vsvamsi1@users.noreply.github.com> Date: Wed, 11 Sep 2024 10:07:04 +0530 Subject: [PATCH 1/9] chore: makeParentDependedOnChildren optimisation only affected nodes in the graph is computed (#36161) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description Optimising `makeParentDependedOnChildren` function by executing `makeParentsDependOnChild` for only affected nodes in the dependencyMap graph. This has brought down the cumulative latency of execution by about 90% when testing it against a customer's app during page load. Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results > [!TIP] > 🟒 🟒 🟒 All cypress tests have passed! πŸŽ‰ πŸŽ‰ πŸŽ‰ > Workflow run: > Commit: 902f4653f17ea4d170c5c2b70e7e6431407855d9 > Cypress dashboard. > Tags: `@tag.All` > Spec: >
Tue, 10 Sep 2024 12:20:44 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No ## Summary by CodeRabbit - **New Features** - Introduced a method for linking child nodes to parent nodes in the dependency graph, allowing for more precise management of affected nodes. - Added new helper functions to streamline the addition of affected nodes and dependencies within the dependency map. - **Bug Fixes** - Enhanced testing coverage for the dependency linking logic, ensuring accurate representation of hierarchical relationships between nodes. - **Documentation** - Improved comments in existing methods to clarify functionality and enhance code readability. --- .../DependencyMap/DependencyMapUtils.ts | 21 +++++- .../DependencyMap/__tests__/index.test.ts | 64 ++++++++++++++++++ .../src/workers/common/DependencyMap/index.ts | 66 +++++++++++++++---- 3 files changed, 139 insertions(+), 12 deletions(-) diff --git a/app/client/src/entities/DependencyMap/DependencyMapUtils.ts b/app/client/src/entities/DependencyMap/DependencyMapUtils.ts index 648814575d54..ddcb0e20735f 100644 --- a/app/client/src/entities/DependencyMap/DependencyMapUtils.ts +++ b/app/client/src/entities/DependencyMap/DependencyMapUtils.ts @@ -37,7 +37,7 @@ export class DependencyMapUtils { return { success: false, cyclicNode: node, error }; } } - + // this function links childNode to its parent as a dependency for the entire dependencyGraph static makeParentsDependOnChildren(dependencyMap: DependencyMap) { const dependencies = dependencyMap.rawDependencies; for (const [node, deps] of dependencies.entries()) { @@ -49,6 +49,25 @@ export class DependencyMapUtils { return dependencyMap; } + // this function links childNode to its parent as a dependency for only affectedNodes in the graph + static linkAffectedChildNodesToParent( + dependencyMap: DependencyMap, + affectedSet: Set, + ) { + const dependencies = dependencyMap.rawDependencies; + for (const [node, deps] of dependencies.entries()) { + if (affectedSet.has(node)) { + DependencyMapUtils.makeParentsDependOnChild(dependencyMap, node); + } + deps.forEach((dep) => { + if (affectedSet.has(dep)) { + DependencyMapUtils.makeParentsDependOnChild(dependencyMap, dep); + } + }); + } + return dependencyMap; + } + static makeParentsDependOnChild = ( dependencyMap: DependencyMap, child: string, diff --git a/app/client/src/entities/DependencyMap/__tests__/index.test.ts b/app/client/src/entities/DependencyMap/__tests__/index.test.ts index a528236f6a1d..9dadc17ed0e7 100644 --- a/app/client/src/entities/DependencyMap/__tests__/index.test.ts +++ b/app/client/src/entities/DependencyMap/__tests__/index.test.ts @@ -2708,6 +2708,70 @@ describe("Tests for DependencyMapUtils", () => { "Api1", ]); } + describe("linkAffectedChildNodesToParent", () => { + const createSomeDependencyMap = () => { + const dependencyMap = new DependencyMap(); + dependencyMap.addNodes({ + tableWidget: true, + apiData: true, + "tableWidget.tableData": true, + "apiData.data": true, + "apiData.allData": true, + "apiData.allData.paginatedData": true, + }); + dependencyMap.addDependency("tableWidget", ["tableWidget.tableData"]); + return dependencyMap; + }; + + test("should link child node to its parentNode as a dependant", () => { + const dependencyMap = createSomeDependencyMap(); + dependencyMap.addDependency("tableWidget.tableData", ["apiData.data"]); + // although "apiData.data" was attached as a dependency to "tableWidget.tableData", it's parent "apiData" also needs to be linked to "apiData.data" + expect(dependencyMap.rawDependencies.get("apiData")).toEqual(undefined); + const affectedNodes = new Set(["apiData.data"]); + DependencyMapUtils.linkAffectedChildNodesToParent( + dependencyMap, + affectedNodes, + ); + // after linkAffectedChildNodesToParent execution "apiData" does get linked to "apiData.data" + expect(dependencyMap.rawDependencies.get("apiData")).toEqual( + new Set(["apiData.data"]), + ); + }); + test("should not link child node to its parentNode as a dependant when the child node is not affected ", () => { + const dependencyMap = createSomeDependencyMap(); + dependencyMap.addDependency("tableWidget.tableData", ["apiData.data"]); + // although "apiData.data" was attached as a dependency to "tableWidget.tableData", it's parent "apiData" also needs to be linked to "apiData.data" + expect(dependencyMap.rawDependencies.get("apiData")).toEqual(undefined); + const emptyAffectedNodes = new Set([]); + DependencyMapUtils.linkAffectedChildNodesToParent( + dependencyMap, + emptyAffectedNodes, + ); + expect(dependencyMap.rawDependencies.get("apiData")).toEqual(undefined); + }); + + test("should link child node to its grand parent node as a dependant", () => { + const dependencyMap = createSomeDependencyMap(); + dependencyMap.addDependency("tableWidget.tableData", [ + "apiData.allData.paginatedData", + ]); + expect(dependencyMap.rawDependencies.get("apiData")).toEqual(undefined); + const affectedNodes = new Set(["apiData.allData.paginatedData"]); + + DependencyMapUtils.linkAffectedChildNodesToParent( + dependencyMap, + affectedNodes, + ); + // after linkAffectedChildNodesToParent execution "apiData.allData.paginatedData" get linked to "apiData.data" and its parent "apiData.data" gets linked to "apiData" + expect(dependencyMap.getDirectDependencies("apiData")).toEqual([ + "apiData.allData", + ]); + expect(dependencyMap.getDirectDependencies("apiData.allData")).toEqual([ + "apiData.allData.paginatedData", + ]); + }); + }); describe("makeParentsDependOnChild", () => { const createSomeDependencyMap = () => { const dependencyMap = new DependencyMap(); diff --git a/app/client/src/workers/common/DependencyMap/index.ts b/app/client/src/workers/common/DependencyMap/index.ts index 54a23eafb455..52f5bc8a46d8 100644 --- a/app/client/src/workers/common/DependencyMap/index.ts +++ b/app/client/src/workers/common/DependencyMap/index.ts @@ -29,6 +29,7 @@ import { } from "ee/workers/Evaluation/Actions"; import { isWidgetActionOrJsObject } from "ee/entities/DataTree/utils"; import { getValidEntityType } from "workers/common/DataTreeEvaluator/utils"; +import type DependencyMap from "entities/DependencyMap"; export function createDependencyMap( dataTreeEvalRef: DataTreeEvaluator, @@ -72,6 +73,30 @@ export function createDependencyMap( inverseDependencies: dependencyMap.inverseDependencies, }; } +const addingAffectedNodesToList = ( + affectedNodes: Set, + addedNodes: string[], +) => { + addedNodes.forEach((v) => affectedNodes.add(v)); +}; + +const addNodesToDependencyMap = + (affectedNodes: Set, dependencyMap: DependencyMap) => + (addedNodes: Record, strict?: boolean) => { + const didUpdateDep = dependencyMap.addNodes(addedNodes, strict); + if (didUpdateDep) { + addingAffectedNodesToList(affectedNodes, Object.keys(addedNodes)); + } + return didUpdateDep; + }; + +const setDependenciesToDependencyMap = + (affectedNodes: Set, dependencyMap: DependencyMap) => + (node: string, dependencies: string[]) => { + dependencyMap.addDependency(node, dependencies); + + addingAffectedNodesToList(affectedNodes, [node, ...dependencies]); + }; export const updateDependencyMap = ({ configTree, @@ -91,7 +116,15 @@ export const updateDependencyMap = ({ const { allKeys, dependencyMap, oldConfigTree, oldUnEvalTree } = dataTreeEvalRef; let { errors: dataTreeEvalErrors } = dataTreeEvalRef; - + const affectedNodes: Set = new Set(); + const addNodesToDepedencyMapFn = addNodesToDependencyMap( + affectedNodes, + dependencyMap, + ); + const setDependenciesToDepedencyMapFn = setDependenciesToDependencyMap( + affectedNodes, + dependencyMap, + ); translatedDiffs.forEach((dataTreeDiff) => { const { event, @@ -117,15 +150,18 @@ export const updateDependencyMap = ({ }); // If a new entity is added, add setter functions to all nodes if (entityName === fullPropertyPath) { - const didUpdateDep = dependencyMap.addNodes( - getEntitySetterFunctions(entityConfig, entityName, entity), + const addedNodes = getEntitySetterFunctions( + entityConfig, + entityName, + entity, ); - if (didUpdateDep) didUpdateDependencyMap = true; + didUpdateDependencyMap = + addNodesToDepedencyMapFn(addedNodes) || didUpdateDependencyMap; } - const didUpdateDep = dependencyMap.addNodes(allAddedPaths, false); - - if (didUpdateDep) didUpdateDependencyMap = true; + didUpdateDependencyMap = + addNodesToDepedencyMapFn(allAddedPaths, false) || + didUpdateDependencyMap; if (isWidgetActionOrJsObject(entity)) { if (!isDynamicLeaf(unEvalDataTree, fullPropertyPath, configTree)) { @@ -141,7 +177,9 @@ export const updateDependencyMap = ({ ([path, pathDependencies]) => { const { errors: extractDependencyErrors, references } = extractInfoFromBindings(pathDependencies, allKeys); - dependencyMap.addDependency(path, references); + + setDependenciesToDepedencyMapFn(path, references); + didUpdateDependencyMap = true; dataTreeEvalErrors = dataTreeEvalErrors.concat( extractDependencyErrors, @@ -158,7 +196,9 @@ export const updateDependencyMap = ({ ); const { errors: extractDependencyErrors, references } = extractInfoFromBindings(entityPathDependencies, allKeys); - dependencyMap.addDependency(fullPropertyPath, references); + + setDependenciesToDepedencyMapFn(fullPropertyPath, references); + didUpdateDependencyMap = true; dataTreeEvalErrors = dataTreeEvalErrors.concat( extractDependencyErrors, @@ -218,7 +258,8 @@ export const updateDependencyMap = ({ ); const { errors: extractDependencyErrors, references } = extractInfoFromBindings(entityPathDependencies, allKeys); - dependencyMap.addDependency(fullPropertyPath, references); + setDependenciesToDepedencyMapFn(fullPropertyPath, references); + didUpdateDependencyMap = true; dataTreeEvalErrors = dataTreeEvalErrors.concat( extractDependencyErrors, @@ -237,7 +278,10 @@ export const updateDependencyMap = ({ const updateChangedDependenciesStart = performance.now(); if (didUpdateDependencyMap) { - DependencyMapUtils.makeParentsDependOnChildren(dependencyMap); + DependencyMapUtils.linkAffectedChildNodesToParent( + dependencyMap, + affectedNodes, + ); dataTreeEvalRef.sortedDependencies = dataTreeEvalRef.sortDependencies( dependencyMap, translatedDiffs, From b5f4c657191422dfb0c322795a221f52a1ba0f57 Mon Sep 17 00:00:00 2001 From: Pawan Kumar Date: Wed, 11 Sep 2024 11:28:44 +0530 Subject: [PATCH 2/9] chore: fix select1 spec (#36228) ## Summary by CodeRabbit - **Bug Fixes** - Enhanced test functionality by adding a check for page save errors in the "Select1" test, improving error handling before executing further actions. - **Chores** - Updated testing priorities by commenting out the "Fork Template" test and activating the "Select1" test in the limited tests configuration. > [!WARNING] > Tests have not run on the HEAD d248530e0b95d34947fef3ffc2ba08e71e81dad7 yet >
Tue, 10 Sep 2024 11:37:57 UTC --------- Co-authored-by: Pawan Kumar --- .../ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts index fafe2da10f90..f65933708669 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts @@ -162,6 +162,7 @@ describe( }); it("6. should check that on option select is working", () => { + _.agHelper.CheckForPageSaveError(); featureFlagIntercept({ release_table_cell_label_value_enabled: true }); cy.openPropertyPane("tablewidgetv2"); cy.editColumn("step"); From 336bc083c45c74fa5b4f284e06c904fcbfd66405 Mon Sep 17 00:00:00 2001 From: Ankita Kinger Date: Wed, 11 Sep 2024 12:48:52 +0530 Subject: [PATCH 3/9] feat: Action redesign: Updating the config for Databricks plugin to use sections and zones format (#36057) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description Action redesign: Updating the config for Databricks plugin to use sections and zones format Fixes #35489 ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results > [!TIP] > 🟒 🟒 🟒 All cypress tests have passed! πŸŽ‰ πŸŽ‰ πŸŽ‰ > Workflow run: > Commit: a7ba129c6f6265b83198fb87b1defbd1a00e592c > Cypress dashboard. > Tags: `@tag.All` > Spec: >
Tue, 10 Sep 2024 14:00:44 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No ## Summary by CodeRabbit - **New Features** - Updated the plugin configuration to enhance the section control, improving the user interface and overall experience. - Introduced a new layout structure with a `SINGLE_COLUMN_ZONE` control type for better organization and potential functionality expansion. - **Improvements** - Enhanced naming conventions for identifiers, making them more descriptive and contextually relevant. --- .../src/main/resources/editor/root.json | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/app/server/appsmith-plugins/databricksPlugin/src/main/resources/editor/root.json b/app/server/appsmith-plugins/databricksPlugin/src/main/resources/editor/root.json index 49a61e3faf81..bab24a7605cd 100644 --- a/app/server/appsmith-plugins/databricksPlugin/src/main/resources/editor/root.json +++ b/app/server/appsmith-plugins/databricksPlugin/src/main/resources/editor/root.json @@ -1,14 +1,20 @@ { "editor": [ { - "controlType": "SECTION", + "controlType": "SECTION_V2", "identifier": "SELECTOR", "children": [ { - "label": "", - "configProperty": "actionConfiguration.body", - "controlType": "QUERY_DYNAMIC_TEXT", - "evaluationSubstitutionType": "TEMPLATE" + "controlType": "SINGLE_COLUMN_ZONE", + "identifier": "SELECTOR-Z1", + "children": [ + { + "label": "", + "configProperty": "actionConfiguration.body", + "controlType": "QUERY_DYNAMIC_TEXT", + "evaluationSubstitutionType": "TEMPLATE" + } + ] } ] } From bc59bd173087185490b9b084049e22b69a1c3c9b Mon Sep 17 00:00:00 2001 From: Ankita Kinger Date: Wed, 11 Sep 2024 12:49:23 +0530 Subject: [PATCH 4/9] feat: Action redesign: Updating the config for MongoDB plugin to use sections and zones format (#36098) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description Action redesign: Updating the config for MongoDB plugin to use sections and zones format Fixes [#35495](https://github.com/appsmithorg/appsmith/issues/35495) ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results > [!TIP] > 🟒 🟒 🟒 All cypress tests have passed! πŸŽ‰ πŸŽ‰ πŸŽ‰ > Workflow run: > Commit: 245cde9a4d5cbadfbc8f7fe917aa7c3ba257e306 > Cypress dashboard. > Tags: `@tag.All` > Spec: >
Tue, 10 Sep 2024 17:47:21 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No ## Summary by CodeRabbit - **New Features** - Enhanced styling capabilities for dynamic input text controls with new CSS class. - Improved layout and organization of UI components in MongoDB plugin with new control types, allowing for more flexible and responsive designs. - Added new controls for sorting and limiting criteria in query interfaces. - **Bug Fixes** - Adjusted CSS to remove minimum height and width constraints for better responsiveness. - **Refactor** - Updated control types across various JSON configurations to improve user experience and interface organization. --- .../src/main/resources/editor/aggregate.json | 27 ++++--- .../src/main/resources/editor/count.json | 11 ++- .../src/main/resources/editor/delete.json | 19 +++-- .../src/main/resources/editor/distinct.json | 19 +++-- .../src/main/resources/editor/find.json | 27 +++++-- .../src/main/resources/editor/insert.json | 11 ++- .../src/main/resources/editor/raw.json | 7 +- .../src/main/resources/editor/root.json | 80 ++++++++++--------- .../src/main/resources/editor/update.json | 27 +++++-- 9 files changed, 134 insertions(+), 94 deletions(-) diff --git a/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/aggregate.json b/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/aggregate.json index 323f7f760c4b..1241370d274f 100644 --- a/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/aggregate.json +++ b/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/aggregate.json @@ -1,13 +1,13 @@ { + "controlType": "SECTION_V2", "identifier": "AGGREGATE", - "controlType": "SECTION", "conditionals": { "show": "{{actionConfiguration.formData.command.data === 'AGGREGATE'}}" }, "children": [ { - "controlType": "SECTION", - "label": "Select collection to query", + "controlType": "DOUBLE_COLUMN_ZONE", + "identifier": "AGGREGATE-Z1", "children": [ { "label": "Collection", @@ -32,9 +32,8 @@ ] }, { - "controlType": "SECTION", - "label": "Query", - "description": "Optional", + "controlType": "SINGLE_COLUMN_ZONE", + "identifier": "AGGREGATE-Z2", "children": [ { "label": "Array of pipelines", @@ -47,11 +46,17 @@ ] }, { - "label": "Limit", - "configProperty": "actionConfiguration.formData.aggregate.limit.data", - "controlType": "QUERY_DYNAMIC_INPUT_TEXT", - "evaluationSubstitutionType": "TEMPLATE", - "initialValue": "10" + "controlType": "DOUBLE_COLUMN_ZONE", + "identifier": "AGGREGATE-Z3", + "children": [ + { + "label": "Limit", + "configProperty": "actionConfiguration.formData.aggregate.limit.data", + "controlType": "QUERY_DYNAMIC_INPUT_TEXT", + "evaluationSubstitutionType": "TEMPLATE", + "initialValue": "10" + } + ] } ] } diff --git a/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/count.json b/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/count.json index 70a9ddc79895..e8848d8ca2e5 100644 --- a/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/count.json +++ b/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/count.json @@ -1,13 +1,13 @@ { + "controlType": "SECTION_V2", "identifier": "COUNT", - "controlType": "SECTION", "conditionals": { "show": "{{actionConfiguration.formData.command.data === 'COUNT'}}" }, "children": [ { - "controlType": "SECTION", - "label": "Select collection to query", + "controlType": "DOUBLE_COLUMN_ZONE", + "identifier": "COUNT-Z1", "children": [ { "label": "Collection", @@ -32,9 +32,8 @@ ] }, { - "controlType": "SECTION", - "label": "Query", - "description": "Optional", + "controlType": "SINGLE_COLUMN_ZONE", + "identifier": "COUNT-Z2", "children": [ { "label": "Query", diff --git a/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/delete.json b/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/delete.json index d5fce44dbbe1..8a3ada65124e 100644 --- a/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/delete.json +++ b/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/delete.json @@ -1,13 +1,13 @@ { + "controlType": "SECTION_V2", "identifier": "DELETE", - "controlType": "SECTION", "conditionals": { "show": "{{actionConfiguration.formData.command.data === 'DELETE'}}" }, "children": [ { - "controlType": "SECTION", - "label": "Select collection to query", + "controlType": "DOUBLE_COLUMN_ZONE", + "identifier": "DELETE-Z1", "children": [ { "label": "Collection", @@ -32,9 +32,8 @@ ] }, { - "controlType": "SECTION", - "label": "Query", - "description": "Optional", + "controlType": "SINGLE_COLUMN_ZONE", + "identifier": "DELETE-Z2", "children": [ { "label": "Query", @@ -43,7 +42,13 @@ "inputType": "JSON", "evaluationSubstitutionType": "TEMPLATE", "placeholderText": "{rating : {$gte : 9}}" - }, + } + ] + }, + { + "controlType": "DOUBLE_COLUMN_ZONE", + "identifier": "DELETE-Z3", + "children": [ { "label": "Limit", "configProperty": "actionConfiguration.formData.delete.limit.data", diff --git a/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/distinct.json b/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/distinct.json index ab4bfc4fb0d0..240c8edff7a7 100644 --- a/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/distinct.json +++ b/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/distinct.json @@ -1,13 +1,13 @@ { + "controlType": "SECTION_V2", "identifier": "DISTINCT", - "controlType": "SECTION", "conditionals": { "show": "{{actionConfiguration.formData.command.data === 'DISTINCT'}}" }, "children": [ { - "controlType": "SECTION", - "label": "Select collection to query", + "controlType": "DOUBLE_COLUMN_ZONE", + "identifier": "DISTINCT-Z1", "children": [ { "label": "Collection", @@ -32,9 +32,8 @@ ] }, { - "controlType": "SECTION", - "label": "Query", - "description": "Optional", + "controlType": "SINGLE_COLUMN_ZONE", + "identifier": "DISTINCT-Z2", "children": [ { "label": "Query", @@ -43,7 +42,13 @@ "inputType": "JSON", "evaluationSubstitutionType": "TEMPLATE", "placeholderText": "{rating : {$gte : 9}}" - }, + } + ] + }, + { + "controlType": "DOUBLE_COLUMN_ZONE", + "identifier": "DISTINCT-Z3", + "children": [ { "label": "Key", "configProperty": "actionConfiguration.formData.distinct.key.data", diff --git a/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/find.json b/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/find.json index 741a77885283..3dfec0d2c602 100644 --- a/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/find.json +++ b/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/find.json @@ -1,13 +1,13 @@ { + "controlType": "SECTION_V2", "identifier": "FIND", - "controlType": "SECTION", "conditionals": { "show": "{{actionConfiguration.formData.command.data === 'FIND'}}" }, "children": [ { - "controlType": "SECTION", - "label": "Select collection to query", + "controlType": "DOUBLE_COLUMN_ZONE", + "identifier": "FIND-Z1", "children": [ { "label": "Collection", @@ -32,9 +32,8 @@ ] }, { - "controlType": "SECTION", - "label": "Query", - "description": "Optional", + "controlType": "SINGLE_COLUMN_ZONE", + "identifier": "FIND-Z2", "children": [ { "label": "Query", @@ -42,7 +41,13 @@ "controlType": "QUERY_DYNAMIC_TEXT", "evaluationSubstitutionType": "TEMPLATE", "placeholderText": "{rating : {$gte : 9}}" - }, + } + ] + }, + { + "controlType": "DOUBLE_COLUMN_ZONE", + "identifier": "FIND-Z3", + "children": [ { "label": "Sort", "configProperty": "actionConfiguration.formData.find.sort.data", @@ -58,7 +63,13 @@ "inputType": "JSON", "evaluationSubstitutionType": "TEMPLATE", "placeholderText": "{name : 1}" - }, + } + ] + }, + { + "controlType": "DOUBLE_COLUMN_ZONE", + "identifier": "FIND-Z4", + "children": [ { "label": "Limit", "configProperty": "actionConfiguration.formData.find.limit.data", diff --git a/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/insert.json b/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/insert.json index e70f7f903bc9..488553124586 100644 --- a/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/insert.json +++ b/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/insert.json @@ -1,13 +1,13 @@ { + "controlType": "SECTION_V2", "identifier": "INSERT", - "controlType": "SECTION", "conditionals": { "show": "{{actionConfiguration.formData.command.data === 'INSERT'}}" }, "children": [ { - "controlType": "SECTION", - "label": "Select collection to query", + "controlType": "DOUBLE_COLUMN_ZONE", + "identifier": "INSERT-Z1", "children": [ { "label": "Collection", @@ -32,9 +32,8 @@ ] }, { - "controlType": "SECTION", - "label": "Query", - "description": "Optional", + "controlType": "SINGLE_COLUMN_ZONE", + "identifier": "INSERT-Z2", "children": [ { "label": "Documents", diff --git a/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/raw.json b/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/raw.json index 6829311c3817..609dd4b991ef 100644 --- a/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/raw.json +++ b/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/raw.json @@ -1,14 +1,13 @@ { + "controlType": "SECTION_V2", "identifier": "RAW", - "controlType": "SECTION", "conditionals": { "show": "{{actionConfiguration.formData.command.data === 'RAW'}}" }, "children": [ { - "controlType": "SECTION", - "label": "Query", - "description": "Optional", + "controlType": "SINGLE_COLUMN_ZONE", + "identifier": "RAW-Z1", "children": [ { "label": "", diff --git a/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/root.json b/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/root.json index 7d1c79dc8ef9..2f7f7b68b407 100644 --- a/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/root.json +++ b/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/root.json @@ -1,47 +1,53 @@ { "editor": [ { - "controlType": "SECTION", + "controlType": "SECTION_V2", "identifier": "SELECTOR", "children": [ { - "label": "Command", - "description": "Choose method you would like to use to query the database", - "configProperty": "actionConfiguration.formData.command.data", - "controlType": "DROP_DOWN", - "initialValue": "FIND", - "options": [ + "controlType": "DOUBLE_COLUMN_ZONE", + "identifier": "SELECTOR-Z1", + "children": [ { - "label": "Find document(s)", - "value": "FIND" - }, - { - "label": "Insert document(s)", - "value": "INSERT" - }, - { - "label": "Update document(s)", - "value": "UPDATE" - }, - { - "label": "Delete document(s)", - "value": "DELETE" - }, - { - "label": "Count", - "value": "COUNT" - }, - { - "label": "Distinct", - "value": "DISTINCT" - }, - { - "label": "Aggregate", - "value": "AGGREGATE" - }, - { - "label": "Raw", - "value": "RAW" + "label": "Command", + "description": "Choose method you would like to use to query the database", + "configProperty": "actionConfiguration.formData.command.data", + "controlType": "DROP_DOWN", + "initialValue": "FIND", + "options": [ + { + "label": "Find document(s)", + "value": "FIND" + }, + { + "label": "Insert document(s)", + "value": "INSERT" + }, + { + "label": "Update document(s)", + "value": "UPDATE" + }, + { + "label": "Delete document(s)", + "value": "DELETE" + }, + { + "label": "Count", + "value": "COUNT" + }, + { + "label": "Distinct", + "value": "DISTINCT" + }, + { + "label": "Aggregate", + "value": "AGGREGATE" + }, + { + "label": "Raw", + "value": "RAW" + } + ] } ] } diff --git a/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/update.json b/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/update.json index bcd4aae93c70..4f9a19c52f9c 100644 --- a/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/update.json +++ b/app/server/appsmith-plugins/mongoPlugin/src/main/resources/editor/update.json @@ -1,13 +1,13 @@ { + "controlType": "SECTION_V2", "identifier": "UPDATE", - "controlType": "SECTION", "conditionals": { "show": "{{actionConfiguration.formData.command.data === 'UPDATE'}}" }, "children": [ { - "controlType": "SECTION", - "label": "Select collection to query", + "controlType": "DOUBLE_COLUMN_ZONE", + "identifier": "UPDATE-Z1", "children": [ { "label": "Collection", @@ -32,9 +32,8 @@ ] }, { - "controlType": "SECTION", - "label": "Query", - "description": "Optional", + "controlType": "SINGLE_COLUMN_ZONE", + "identifier": "UPDATE-Z2", "children": [ { "label": "Query", @@ -43,7 +42,13 @@ "inputType": "JSON", "evaluationSubstitutionType": "TEMPLATE", "placeholderText": "{rating : {$gte : 9}}" - }, + } + ] + }, + { + "controlType": "SINGLE_COLUMN_ZONE", + "identifier": "UPDATE-Z3", + "children": [ { "label": "Update", "configProperty": "actionConfiguration.formData.updateMany.update.data", @@ -51,7 +56,13 @@ "inputType": "JSON", "evaluationSubstitutionType": "TEMPLATE", "placeholderText": "{ $inc: { score: 1 } }" - }, + } + ] + }, + { + "controlType": "DOUBLE_COLUMN_ZONE", + "identifier": "UPDATE-Z4", + "children": [ { "label": "Limit", "configProperty": "actionConfiguration.formData.updateMany.limit.data", From 89154c56cd9620b74cb9c46589ad324d04145841 Mon Sep 17 00:00:00 2001 From: Hetu Nandu Date: Wed, 11 Sep 2024 14:06:28 +0530 Subject: [PATCH 5/9] fix: RBAC errors not showing toasts (#36244) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description Updates the error handling for Access Control scenarios to show toasts when correct permissions are not present Fixes #36229 ## Automation /ok-to-test tags="@tag.AccessControl" ### :mag: Cypress test results > [!CAUTION] > πŸ”΄ πŸ”΄ πŸ”΄ Some tests have failed. > Workflow run: > Commit: 08edaeefb87d02f8951a38cef2ac0c608d8fe8f8 > Cypress dashboard. > Tags: @tag.AccessControl > Spec: > The following are new failures, please fix them before merging the PR:
    >
  1. cypress/e2e/Regression/ServerSide/GenerateCRUD/MySQL2_Spec.ts
> List of identified flaky tests. >
Wed, 11 Sep 2024 08:28:37 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No ## Summary by CodeRabbit - **New Features** - Enhanced error handling with structured Redux actions for better state management. - Improved clarity in error message construction based on error types. - **Bug Fixes** - Refined logic for displaying toast notifications based on the `show` parameter. - **Documentation** - Updated comments for better understanding of error handling logic. --- app/client/src/sagas/ActionSagas.ts | 10 ++++++++-- app/client/src/sagas/ErrorSagas.tsx | 27 +++++++++++++++++---------- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/app/client/src/sagas/ActionSagas.ts b/app/client/src/sagas/ActionSagas.ts index a5f88ef14e0d..94f7cfe44d63 100644 --- a/app/client/src/sagas/ActionSagas.ts +++ b/app/client/src/sagas/ActionSagas.ts @@ -795,13 +795,19 @@ function* copyActionSaga( // @ts-expect-error: type mismatch Action vs ActionCreateUpdateResponse yield put(copyActionSuccess(payload)); - } catch (e) { + } catch (e: unknown) { const actionName = actionObject ? actionObject.name : ""; + const errorMessage = + e instanceof Error + ? e.message + : createMessage(ERROR_ACTION_COPY_FAIL, actionName); yield put( copyActionError({ ...action.payload, show: true, - error: { message: createMessage(ERROR_ACTION_COPY_FAIL, actionName) }, + error: { + message: errorMessage, + }, }), ); } diff --git a/app/client/src/sagas/ErrorSagas.tsx b/app/client/src/sagas/ErrorSagas.tsx index 3a690ce17ebe..559c0b9d6e9b 100644 --- a/app/client/src/sagas/ErrorSagas.tsx +++ b/app/client/src/sagas/ErrorSagas.tsx @@ -112,7 +112,16 @@ export function* validateResponse( } if (!response.responseMeta && response.status) { - throw Error(getErrorMessage(response.status, response.resourceType)); + yield put({ + type: ReduxActionErrorTypes.API_ERROR, + payload: { + error: new Error( + getErrorMessage(response.status, response.resourceType), + ), + logToSentry, + show, + }, + }); } if (response.responseMeta.success) { @@ -218,22 +227,20 @@ export interface ErrorActionPayload { export function* errorSaga(errorAction: ReduxAction) { const effects = [ErrorEffectTypes.LOG_TO_CONSOLE]; const { payload, type } = errorAction; - const { - error, - logToDebugger, - logToSentry, - show = true, - sourceEntity, - } = payload || {}; + const { error, logToDebugger, logToSentry, show, sourceEntity } = + payload || {}; const appMode: APP_MODE = yield select(getAppMode); // "show" means show a toast. We check if the error has been asked to not been shown - // By making the default behaviour "true" we are ensuring undefined actions still pass through this check - if (show) { + // By checking undefined, undecided actions still pass through this check + if (show === undefined) { // We want to show toasts for certain actions only so we avoid issues or if it is outside edit mode if (shouldShowToast(type) || appMode !== APP_MODE.EDIT) { effects.push(ErrorEffectTypes.SHOW_ALERT); } + // If true is passed, show the error no matter what + } else if (show) { + effects.push(ErrorEffectTypes.SHOW_ALERT); } if (logToDebugger) { From a182e7409d768b686f854bc9da6295ae37b7f4c5 Mon Sep 17 00:00:00 2001 From: Sagar Khalasi Date: Wed, 11 Sep 2024 15:08:12 +0530 Subject: [PATCH 6/9] chore: Return failure results (#36233) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description **Problem:** When running Cypress tests multiple times with the cypress-repeat-pro --force option, we only see success messages. This is because the `--force` option may override or mask failures, leading to misleading results. **Solution:** To address this, we have added a step to check for specific failure indicators in the test summary file. If the summary indicates that there were any failed tests (i.e., `Total Failed: 0` is not present), the GitHub Action step will fail. This ensures that failures are properly highlighted and reported in the PR comments. Fixes #`36232` ## Automation /ok-to-test tags="@tag.Sanity" ### :mag: Cypress test results > [!TIP] > 🟒 🟒 🟒 All cypress tests have passed! πŸŽ‰ πŸŽ‰ πŸŽ‰ > Workflow run: > Commit: 3a04b01650a4f92967d6b489eead5d61e48cb89a > Cypress dashboard. > Tags: `@tag.Sanity` > Spec: >
Wed, 11 Sep 2024 07:01:29 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No ## Summary by CodeRabbit - **New Features** - Enhanced CI workflow to ensure GitHub Action fails if Cypress tests do not pass, improving reliability. - **Bug Fixes** - Implemented a conditional check for test failures, providing clearer feedback on test outcomes. --- .github/workflows/ci-test-limited-with-count.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-test-limited-with-count.yml b/.github/workflows/ci-test-limited-with-count.yml index d6553309d0f2..3399eaddb703 100644 --- a/.github/workflows/ci-test-limited-with-count.yml +++ b/.github/workflows/ci-test-limited-with-count.yml @@ -349,7 +349,12 @@ jobs: npx cypress-repeat-pro run -n ${{ inputs.run_count }} --force \ --spec ${{ env.specs_to_run }} \ --config-file "cypress_ci_custom.config.ts" - cat cy-repeat-summary.txt + cat cy-repeat-summary.txt + # Check if "Total Failed: 0" is present + if ! grep -q "Total Failed: 0" cy-repeat-summary.txt; then + echo "Tests failed, failing the GitHub Action." + exit 1 # Fails the step if tests failed + fi - name: Trim number of cypress log files if: failure() From cd7b66fa37e557162d9038c3e301f25d96b2e4f4 Mon Sep 17 00:00:00 2001 From: albinAppsmith <87797149+albinAppsmith@users.noreply.github.com> Date: Wed, 11 Sep 2024 15:37:09 +0530 Subject: [PATCH 7/9] fix: Anthropic plugin config updated with better file structure (#36223) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description Reverting the Anthropic file structure to the previous structure. This also means the UI will get updated to the new shared design. Fixes #35485 ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results > [!CAUTION] > πŸ”΄ πŸ”΄ πŸ”΄ Some tests have failed. > Workflow run: > Commit: b7a718460edaae4b37de29169b971b88e2dd5b67 > Cypress dashboard. > Tags: @tag.All > Spec: > The following are new failures, please fix them before merging the PR:
    >
  1. cypress/e2e/Regression/ClientSide/Debugger/Widget_property_navigation_spec.ts >
  2. cypress/e2e/Regression/ClientSide/OneClickBinding/PropertyControl_spec.ts
> List of identified flaky tests. >
Wed, 11 Sep 2024 08:07:04 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No ## Summary by CodeRabbit - **New Features** - Introduced a new chat interface configuration for AI-driven interactions, enhancing user engagement with dynamic input fields. - Added a new configuration for vision capabilities, allowing users to interact with vision-based AI models through a structured interface. - **Changes** - Simplified the editor's configuration by renaming sections and removing unnecessary controls, streamlining the user experience. - Updated file management structure to enhance modularity with external references to configuration files. --- .../src/main/resources/editor/chat.json | 130 ++++++++ .../src/main/resources/editor/root.json | 313 +----------------- .../src/main/resources/editor/vision.json | 142 ++++++++ 3 files changed, 275 insertions(+), 310 deletions(-) create mode 100644 app/server/appsmith-plugins/anthropicPlugin/src/main/resources/editor/chat.json create mode 100644 app/server/appsmith-plugins/anthropicPlugin/src/main/resources/editor/vision.json diff --git a/app/server/appsmith-plugins/anthropicPlugin/src/main/resources/editor/chat.json b/app/server/appsmith-plugins/anthropicPlugin/src/main/resources/editor/chat.json new file mode 100644 index 000000000000..a1621376380e --- /dev/null +++ b/app/server/appsmith-plugins/anthropicPlugin/src/main/resources/editor/chat.json @@ -0,0 +1,130 @@ +{ + "identifier": "CHAT", + "controlType": "SECTION_V2", + "conditionals": { + "show": "{{actionConfiguration.formData.command.data === 'CHAT'}}" + }, + "children": [ + { + "controlType": "DOUBLE_COLUMN_ZONE", + "children": [ + { + "label": "Models", + "tooltipText": "Select the model for response generation", + "subtitle": "ID of the model to use.", + "isRequired": true, + "propertyName": "chat_model_id", + "configProperty": "actionConfiguration.formData.chatModel.data", + "controlType": "DROP_DOWN", + "initialValue": "", + "options": [], + "placeholderText": "All models will be fetched.", + "fetchOptionsConditionally": true, + "setFirstOptionAsDefault": true, + "alternateViewTypes": ["json"], + "conditionals": { + "enable": "{{true}}", + "fetchDynamicValues": { + "condition": "{{actionConfiguration.formData.command.data === 'CHAT'}}", + "config": { + "params": { + "requestType": "CHAT_MODELS", + "displayType": "DROP_DOWN" + } + } + } + } + }, + { + "label": "Max Tokens", + "tooltipText": "The maximum number of tokens to generate in the chat completion.", + "subtitle": "The maximum number of tokens to generate in the chat completion.", + "Description": "Put a positive integer value", + "configProperty": "actionConfiguration.formData.maxTokens", + "controlType": "INPUT_TEXT", + "initialValue": "256", + "isRequired": true, + "dataType": "NUMBER", + "customStyles": { + "width": "270px", + "minWidth": "270px" + } + } + ] + }, + { + "controlType": "SINGLE_COLUMN_ZONE", + "children": [ + { + "label": "System Prompt", + "Description": "Provide additional instructions for the AI model as system prompt", + "subtitle": "Provide additional instructions for the AI model as system prompt", + "configProperty": "actionConfiguration.formData.systemPrompt.data", + "controlType": "QUERY_DYNAMIC_TEXT", + "placeholderText": "Write some text or use {{ }} to reference a dynamic text value", + "initialValue": "", + "isRequired": false, + "customStyles": { + "width": "590px", + "minWidth": "400px" + } + }, + { + "label": "Messages", + "tooltipText": "Ask a question", + "subtitle": "A list of messages comprising the conversation so far.", + "propertyName": "messages", + "isRequired": true, + "configProperty": "actionConfiguration.formData.messages.data", + "controlType": "ARRAY_FIELD", + "addMoreButtonLabel": "Add message", + "alternateViewTypes": ["json"], + "schema": [ + { + "label": "Role", + "key": "role", + "controlType": "DROP_DOWN", + "initialValue": "Human", + "options": [ + { + "label": "Human", + "value": "Human" + }, + { + "label": "Assistant", + "value": "Assistant" + } + ] + }, + { + "label": "Content", + "key": "content", + "controlType": "QUERY_DYNAMIC_INPUT_TEXT", + "placeholderText": "{{ UserInput.text }}" + } + ] + } + ] + }, + { + "controlType": "DOUBLE_COLUMN_ZONE", + "children": [ + { + "label": "Temperature", + "tooltipText": "Put a value between 0 and 1", + "Description": "Put a value between 0 and 1", + "subtitle": "Defaults to 1. Ranges from 0 to 1. Use temp closer to 0 for analytical / multiple choice, and closer to 1 for creative and generative tasks.", + "configProperty": "actionConfiguration.formData.temperature", + "controlType": "INPUT_TEXT", + "dataType": "NUMBER", + "initialValue": "1", + "isRequired": false, + "customStyles": { + "width": "270px", + "minWidth": "270px" + } + } + ] + } + ] +} diff --git a/app/server/appsmith-plugins/anthropicPlugin/src/main/resources/editor/root.json b/app/server/appsmith-plugins/anthropicPlugin/src/main/resources/editor/root.json index 2b674a2fc49d..abc010dddc76 100644 --- a/app/server/appsmith-plugins/anthropicPlugin/src/main/resources/editor/root.json +++ b/app/server/appsmith-plugins/anthropicPlugin/src/main/resources/editor/root.json @@ -2,7 +2,7 @@ "editor": [ { "controlType": "SECTION_V2", - "identifier": "SECTION-ONE", + "identifier": "SELECTOR", "children": [ { "controlType": "DOUBLE_COLUMN_ZONE", @@ -27,316 +27,9 @@ ] } ] - }, - { - "controlType": "DOUBLE_COLUMN_ZONE", - "identifier": "SO-Z2", - "conditionals": { - "show": "{{actionConfiguration.formData.command.data === 'CHAT'}}" - }, - "children": [ - { - "label": "Models", - "tooltipText": "Select the model for response generation", - "subtitle": "ID of the model to use.", - "isRequired": true, - "propertyName": "chat_model_id", - "configProperty": "actionConfiguration.formData.chatModel.data", - "controlType": "DROP_DOWN", - "initialValue": "", - "options": [], - "placeholderText": "All models will be fetched.", - "fetchOptionsConditionally": true, - "setFirstOptionAsDefault": true, - "alternateViewTypes": ["json"], - "conditionals": { - "enable": "{{true}}", - "fetchDynamicValues": { - "condition": "{{actionConfiguration.formData.command.data === 'CHAT'}}", - "config": { - "params": { - "requestType": "CHAT_MODELS", - "displayType": "DROP_DOWN" - } - } - } - } - }, - { - "label": "Max Tokens", - "tooltipText": "The maximum number of tokens to generate in the chat completion.", - "subtitle": "The maximum number of tokens to generate in the chat completion.", - "Description": "Put a positive integer value", - "configProperty": "actionConfiguration.formData.maxTokens", - "controlType": "INPUT_TEXT", - "initialValue": "256", - "isRequired": true, - "dataType": "NUMBER", - "customStyles": { - "width": "270px", - "minWidth": "270px" - } - } - ] - }, - { - "controlType": "SINGLE_COLUMN_ZONE", - "identifier": "SO-Z3", - "conditionals": { - "show": "{{actionConfiguration.formData.command.data === 'CHAT'}}" - }, - "children": [ - { - "label": "System Prompt", - "Description": "Provide additional instructions for the AI model as system prompt", - "subtitle": "Provide additional instructions for the AI model as system prompt", - "configProperty": "actionConfiguration.formData.systemPrompt.data", - "controlType": "QUERY_DYNAMIC_TEXT", - "placeholderText": "Write some text or use {{ }} to reference a dynamic text value", - "initialValue": "", - "isRequired": false, - "customStyles": { - "width": "590px", - "minWidth": "400px" - } - } - ] - }, - { - "controlType": "DOUBLE_COLUMN_ZONE", - "identifier": "SO-Z4", - "conditionals": { - "show": "{{actionConfiguration.formData.command.data === 'VISION'}}" - }, - "children": [ - { - "label": "Models", - "tooltipText": "Select the model for response generation", - "subtitle": "ID of the model to use.", - "isRequired": true, - "propertyName": "vision_model_id", - "configProperty": "actionConfiguration.formData.visionModel.data", - "controlType": "DROP_DOWN", - "initialValue": "", - "options": [], - "placeholderText": "All models will be fetched.", - "fetchOptionsConditionally": true, - "setFirstOptionAsDefault": true, - "alternateViewTypes": ["json"], - "conditionals": { - "enable": "{{true}}", - "fetchDynamicValues": { - "condition": "{{actionConfiguration.formData.command.data === 'VISION'}}", - "config": { - "params": { - "requestType": "VISION_MODELS", - "displayType": "DROP_DOWN" - } - } - } - } - }, - { - "label": "Max Tokens", - "tooltipText": "The maximum number of tokens to generate in the chat completion.", - "subtitle": "The maximum number of tokens to generate in the chat completion.", - "Description": "Put a positive integer value", - "configProperty": "actionConfiguration.formData.maxTokens", - "controlType": "INPUT_TEXT", - "initialValue": "256", - "isRequired": true, - "dataType": "NUMBER", - "customStyles": { - "width": "270px", - "minWidth": "270px" - } - } - ] - }, - { - "controlType": "SINGLE_COLUMN_ZONE", - "identifier": "SO-Z5", - "conditionals": { - "show": "{{actionConfiguration.formData.command.data === 'VISION'}}" - }, - "children": [ - { - "label": "System Prompt", - "Description": "Provide additional instructions for the AI model as system prompt", - "subtitle": "Provide additional instructions for the AI model as system prompt", - "configProperty": "actionConfiguration.formData.systemPrompt.data", - "controlType": "QUERY_DYNAMIC_TEXT", - "placeholderText": "Write some text or use {{ }} to reference a dynamic text value", - "initialValue": "", - "isRequired": false - } - ] - } - ] - }, - { - "controlType": "SECTION_V2", - "identifier": "SECTION-TWO", - "children": [ - { - "controlType": "SINGLE_COLUMN_ZONE", - "identifier": "ST-Z1", - "conditionals": { - "show": "{{actionConfiguration.formData.command.data === 'CHAT'}}" - }, - "children": [ - { - "label": "Messages", - "tooltipText": "Ask a question", - "subtitle": "A list of messages comprising the conversation so far.", - "propertyName": "messages", - "isRequired": true, - "configProperty": "actionConfiguration.formData.messages.data", - "controlType": "ARRAY_FIELD", - "addMoreButtonLabel": "Add message", - "alternateViewTypes": ["json"], - "schema": [ - { - "label": "Role", - "key": "role", - "controlType": "DROP_DOWN", - "initialValue": "Human", - "options": [ - { - "label": "Human", - "value": "Human" - }, - { - "label": "Assistant", - "value": "Assistant" - } - ] - }, - { - "label": "Content", - "key": "content", - "controlType": "QUERY_DYNAMIC_INPUT_TEXT", - "placeholderText": "{{ UserInput.text }}" - } - ] - } - ] - }, - { - "controlType": "SINGLE_COLUMN_ZONE", - "identifier": "ST-Z2", - "conditionals": { - "show": "{{actionConfiguration.formData.command.data === 'VISION'}}" - }, - "children": [ - { - "label": "Messages", - "tooltipText": "Ask a question", - "subtitle": "A list of messages comprising the conversation so far. You can pass base64 encoded image directly in the request.", - "propertyName": "messages", - "isRequired": true, - "configProperty": "actionConfiguration.formData.messages.data", - "controlType": "ARRAY_FIELD", - "addMoreButtonLabel": "Add message", - "alternateViewTypes": ["json"], - "schema": [ - { - "label": "Role", - "key": "role", - "controlType": "DROP_DOWN", - "initialValue": "Human", - "options": [ - { - "label": "Human", - "value": "Human" - }, - { - "label": "Assistant", - "value": "Assistant" - } - ] - }, - { - "label": "Type", - "key": "type", - "controlType": "DROP_DOWN", - "initialValue": "text", - "options": [ - { - "label": "Text", - "value": "text" - }, - { - "label": "Image", - "value": "image" - } - ] - }, - { - "label": "Content", - "key": "content", - "controlType": "QUERY_DYNAMIC_INPUT_TEXT", - "placeholderText": "{{Img1.image}} or {{Input1.text}}" - } - ] - } - ] - } - ] - }, - { - "controlType": "SECTION_V2", - "identifier": "SECTION-THREE", - "children": [ - { - "controlType": "DOUBLE_COLUMN_ZONE", - "identifier": "STH-Z1", - "conditionals": { - "show": "{{actionConfiguration.formData.command.data === 'CHAT'}}" - }, - "children": [ - { - "label": "Temperature", - "tooltipText": "Put a value between 0 and 1", - "Description": "Put a value between 0 and 1", - "subtitle": "Defaults to 1. Ranges from 0 to 1. Use temp closer to 0 for analytical / multiple choice, and closer to 1 for creative and generative tasks.", - "configProperty": "actionConfiguration.formData.temperature", - "controlType": "INPUT_TEXT", - "dataType": "NUMBER", - "initialValue": "1", - "isRequired": false, - "customStyles": { - "width": "270px", - "minWidth": "270px" - } - } - ] - }, - { - "controlType": "DOUBLE_COLUMN_ZONE", - "identifier": "STH-Z2", - "conditionals": { - "show": "{{actionConfiguration.formData.command.data === 'VISION'}}" - }, - "children": [ - { - "label": "Temperature", - "tooltipText": "Put a value between 0 and 1", - "Description": "Put a value between 0 and 1", - "subtitle": "Defaults to 1. Ranges from 0 to 1. Use temp closer to 0 for analytical / multiple choice, and closer to 1 for creative and generative tasks.", - "configProperty": "actionConfiguration.formData.temperature", - "controlType": "INPUT_TEXT", - "dataType": "NUMBER", - "initialValue": "1", - "isRequired": false, - "customStyles": { - "width": "270px", - "minWidth": "270px" - } - } - ] } ] } - ] + ], + "files": ["chat.json", "vision.json"] } diff --git a/app/server/appsmith-plugins/anthropicPlugin/src/main/resources/editor/vision.json b/app/server/appsmith-plugins/anthropicPlugin/src/main/resources/editor/vision.json new file mode 100644 index 000000000000..282ddac5355b --- /dev/null +++ b/app/server/appsmith-plugins/anthropicPlugin/src/main/resources/editor/vision.json @@ -0,0 +1,142 @@ +{ + "identifier": "VISION", + "controlType": "SECTION_V2", + "conditionals": { + "show": "{{actionConfiguration.formData.command.data === 'VISION'}}" + }, + "children": [ + { + "controlType": "DOUBLE_COLUMN_ZONE", + "children": [ + { + "label": "Models", + "tooltipText": "Select the model for response generation", + "subtitle": "ID of the model to use.", + "isRequired": true, + "propertyName": "vision_model_id", + "configProperty": "actionConfiguration.formData.visionModel.data", + "controlType": "DROP_DOWN", + "initialValue": "", + "options": [], + "placeholderText": "All models will be fetched.", + "fetchOptionsConditionally": true, + "setFirstOptionAsDefault": true, + "alternateViewTypes": ["json"], + "conditionals": { + "enable": "{{true}}", + "fetchDynamicValues": { + "condition": "{{actionConfiguration.formData.command.data === 'VISION'}}", + "config": { + "params": { + "requestType": "VISION_MODELS", + "displayType": "DROP_DOWN" + } + } + } + } + }, + { + "label": "Max Tokens", + "tooltipText": "The maximum number of tokens to generate in the chat completion.", + "subtitle": "The maximum number of tokens to generate in the chat completion.", + "Description": "Put a positive integer value", + "configProperty": "actionConfiguration.formData.maxTokens", + "controlType": "INPUT_TEXT", + "initialValue": "256", + "isRequired": true, + "dataType": "NUMBER", + "customStyles": { + "width": "270px", + "minWidth": "270px" + } + } + ] + }, + { + "controlType": "SINGLE_COLUMN_ZONE", + "children": [ + { + "label": "System Prompt", + "Description": "Provide additional instructions for the AI model as system prompt", + "subtitle": "Provide additional instructions for the AI model as system prompt", + "configProperty": "actionConfiguration.formData.systemPrompt.data", + "controlType": "QUERY_DYNAMIC_TEXT", + "placeholderText": "Write some text or use {{ }} to reference a dynamic text value", + "initialValue": "", + "isRequired": false + }, + { + "label": "Messages", + "tooltipText": "Ask a question", + "subtitle": "A list of messages comprising the conversation so far. You can pass base64 encoded image directly in the request.", + "propertyName": "messages", + "isRequired": true, + "configProperty": "actionConfiguration.formData.messages.data", + "controlType": "ARRAY_FIELD", + "addMoreButtonLabel": "Add message", + "alternateViewTypes": ["json"], + "schema": [ + { + "label": "Role", + "key": "role", + "controlType": "DROP_DOWN", + "initialValue": "Human", + "options": [ + { + "label": "Human", + "value": "Human" + }, + { + "label": "Assistant", + "value": "Assistant" + } + ] + }, + { + "label": "Type", + "key": "type", + "controlType": "DROP_DOWN", + "initialValue": "text", + "options": [ + { + "label": "Text", + "value": "text" + }, + { + "label": "Image", + "value": "image" + } + ] + }, + { + "label": "Content", + "key": "content", + "controlType": "QUERY_DYNAMIC_INPUT_TEXT", + "placeholderText": "{{Img1.image}} or {{Input1.text}}" + } + ] + } + ] + }, + { + "controlType": "DOUBLE_COLUMN_ZONE", + "children": [ + { + "label": "Temperature", + "tooltipText": "Put a value between 0 and 1", + "Description": "Put a value between 0 and 1", + "subtitle": "Defaults to 1. Ranges from 0 to 1. Use temp closer to 0 for analytical / multiple choice, and closer to 1 for creative and generative tasks.", + "configProperty": "actionConfiguration.formData.temperature", + "controlType": "INPUT_TEXT", + "dataType": "NUMBER", + "initialValue": "1", + "isRequired": false, + "customStyles": { + "width": "270px", + "minWidth": "270px" + } + } + ] + } + ] +} From 1c8712aa66fc7e2354cc014f8eccabcf63ce7c7d Mon Sep 17 00:00:00 2001 From: sneha122 Date: Wed, 11 Sep 2024 15:48:28 +0530 Subject: [PATCH 8/9] fix: fixed page data DB call getting called twice (#36247) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description After perf updates made in PR https://github.com/appsmithorg/appsmith/pull/36118/files, Page data DB fetch call was getting triggered twice, one for PAGES_SPAN and one for ACTIONS_SPAN. With this PR, we have replaced that a single Mono which is being cached. More details: https://theappsmith.slack.com/archives/C024GUDM0LT/p1725960912325389 Fixes #`Issue Number` _or_ Fixes https://github.com/appsmithorg/appsmith/issues/36243 > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.Sanity" ### :mag: Cypress test results > [!TIP] > 🟒 🟒 🟒 All cypress tests have passed! πŸŽ‰ πŸŽ‰ πŸŽ‰ > Workflow run: > Commit: d36df4cb300653a51d10a09b3315aaa114b68034 > Cypress dashboard. > Tags: `@tag.Sanity` > Spec: >
Wed, 11 Sep 2024 09:49:39 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No ## Summary by CodeRabbit - **Performance Improvements** - Enhanced the page loading process by implementing a caching mechanism for retrieving branched page data, potentially reducing database calls and improving overall application performance. - Streamlined the retrieval logic for branched pages, ensuring consistent execution regardless of the base page ID state. --------- Co-authored-by: β€œsneha122” <β€œsneha@appsmith.com”> --- .../ce/ConsolidatedAPIServiceCEImpl.java | 48 +++++++++---------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ConsolidatedAPIServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ConsolidatedAPIServiceCEImpl.java index 2cc9776c4744..1f046c8ba290 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ConsolidatedAPIServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ConsolidatedAPIServiceCEImpl.java @@ -201,6 +201,9 @@ public Mono getConsolidatedInfoForPageLoad( boolean isViewMode = ApplicationMode.PUBLISHED.equals(mode); /* Fetch default application id if not provided */ + if (isBlank(basePageId)) { + return Mono.when(fetches).thenReturn(consolidatedAPIResponseDTO); + } Mono branchedApplicationMonoCached; Mono baseApplicationIdMono = Mono.just(""); if (isViewMode) { @@ -215,36 +218,29 @@ public Mono getConsolidatedInfoForPageLoad( .tap(Micrometer.observation(observationRegistry)) .cache(); - Mono branchedPageMonoCached = Mono.empty(); - if (!isBlank(basePageId)) { - branchedPageMonoCached = newPageService - .findByBranchNameAndBasePageIdAndApplicationMode(branchName, basePageId, mode) - .cache(); - } + Mono branchedPageMonoCached = newPageService + .findByBranchNameAndBasePageIdAndApplicationMode(branchName, basePageId, mode) + .cache(); branchedApplicationMonoCached = baseApplicationIdMono.flatMap(cachedBaseApplicationId -> { if (!StringUtils.hasText(cachedBaseApplicationId)) { // Handle empty or null baseApplicationId - return newPageService - .findByBranchNameAndBasePageIdAndApplicationMode(branchName, basePageId, mode) - .flatMap(branchedPage -> - // Use the application ID to find the complete application details. - applicationService - .findByBranchedApplicationIdAndApplicationMode( - branchedPage.getApplicationId(), mode) - .flatMap(application -> { - if (isViewMode) { - // Update the cache with the new application’s base ID for future - // queries. - return cacheableRepositoryHelper - .fetchBaseApplicationId(basePageId, application.getBaseId()) - .thenReturn(application) - .name(getQualifiedSpanName( - APPLICATION_ID_UPDATE_REDIS_SPAN, mode)) - .tap(Micrometer.observation(observationRegistry)); - } - return Mono.just(application); - })); + return branchedPageMonoCached.flatMap(branchedPage -> + // Use the application ID to find the complete application details. + applicationService + .findByBranchedApplicationIdAndApplicationMode(branchedPage.getApplicationId(), mode) + .flatMap(application -> { + if (isViewMode) { + // Update the cache with the new application’s base ID for future + // queries. + return cacheableRepositoryHelper + .fetchBaseApplicationId(basePageId, application.getBaseId()) + .thenReturn(application) + .name(getQualifiedSpanName(APPLICATION_ID_UPDATE_REDIS_SPAN, mode)) + .tap(Micrometer.observation(observationRegistry)); + } + return Mono.just(application); + })); } else { // Handle non-empty baseApplicationId return applicationService.findByBaseIdBranchNameAndApplicationMode( From 91fd967311d19ea274039d8140edeff6b361473c Mon Sep 17 00:00:00 2001 From: albinAppsmith <87797149+albinAppsmith@users.noreply.github.com> Date: Wed, 11 Sep 2024 16:32:53 +0530 Subject: [PATCH 9/9] feat: Action redesign - changes in save and edit datasource (#36222) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description This PR updates the save datasource text to "Save" and edit datasource text to "Edit". Also, updated the save datasource icon to better represent datasource. Fixes #35503 ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results > [!TIP] > 🟒 🟒 🟒 All cypress tests have passed! πŸŽ‰ πŸŽ‰ πŸŽ‰ > Workflow run: > Commit: fda9c7479d4626aa7178e74f310586264724471c > Cypress dashboard. > Tags: `@tag.All` > Spec: >
Wed, 11 Sep 2024 09:43:42 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No ## Summary by CodeRabbit - **New Features** - Simplified user interface messages for editing and saving data sources to "Edit" and "Save." - Updated the icon for the save button to better represent the action when saving a datasource. - Introduced a new locator for the save datasource button to enhance testing capabilities. - **Bug Fixes** - Improved adherence to coding standards by modifying ESLint rules related to function props. --- app/client/cypress/e2e/Sanity/Datasources/GraphQL_spec.ts | 8 +++----- app/client/cypress/support/Objects/CommonLocators.ts | 1 + app/client/src/ce/constants/messages.ts | 4 ++-- .../src/components/editorComponents/StoreAsDatasource.tsx | 3 ++- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/client/cypress/e2e/Sanity/Datasources/GraphQL_spec.ts b/app/client/cypress/e2e/Sanity/Datasources/GraphQL_spec.ts index 68b07e359a8e..22f5f17454cd 100644 --- a/app/client/cypress/e2e/Sanity/Datasources/GraphQL_spec.ts +++ b/app/client/cypress/e2e/Sanity/Datasources/GraphQL_spec.ts @@ -279,7 +279,7 @@ describe( }); apiPage.SelectPaneTab("Authentication"); - agHelper.ClickButton("Save as datasource"); + agHelper.GetNClick(locators._saveDatasource); agHelper.AssertText( locators._inputFieldByName("URL") + "//" + locators._inputField, @@ -296,16 +296,14 @@ describe( // }); dataSources.SaveDatasource(); agHelper.ValidateToastMessage("datasource created"); - agHelper.AssertElementVisibility( - locators._buttonByText("Edit datasource"), - ); + agHelper.AssertElementVisibility(locators._saveDatasource); apiPage.SelectPaneTab("Body"); dataSources.UpdateGraphqlQueryAndVariable({ query: GRAPHQL_QUERY, variable: GRAPHQL_VARIABLES, }); apiPage.RunAPI(); - agHelper.ClickButton("Edit datasource"); + agHelper.GetNClick(locators._saveDatasource); dataSources.AssertDataSourceInfo([ dataManager.dsValues[ dataManager.defaultEnviorment diff --git a/app/client/cypress/support/Objects/CommonLocators.ts b/app/client/cypress/support/Objects/CommonLocators.ts index 3152737bfa05..3db2224e7c1f 100644 --- a/app/client/cypress/support/Objects/CommonLocators.ts +++ b/app/client/cypress/support/Objects/CommonLocators.ts @@ -338,4 +338,5 @@ export class CommonLocators { errorPageDescription = ".t--error-page-description"; _selectClearButton_testId = "selectbutton.btn.cancel"; _selectClearButton_dataTestId = `[data-testid="${this._selectClearButton_testId}"]`; + _saveDatasource = `[data-testid='t--store-as-datasource']`; } diff --git a/app/client/src/ce/constants/messages.ts b/app/client/src/ce/constants/messages.ts index 7de903836a11..8407a185902a 100644 --- a/app/client/src/ce/constants/messages.ts +++ b/app/client/src/ce/constants/messages.ts @@ -364,8 +364,8 @@ export const DATASOURCE_UPDATE = (dsName: string) => `${dsName} datasource updated successfully`; export const DATASOURCE_VALID = (dsName: string) => `${dsName} datasource is valid`; -export const EDIT_DATASOURCE = () => "Edit datasource"; -export const SAVE_DATASOURCE = () => "Save as datasource"; +export const EDIT_DATASOURCE = () => "Edit"; +export const SAVE_DATASOURCE = () => "Save"; export const SAVE_DATASOURCE_MESSAGE = () => "Save the URL as a datasource to access authentication settings"; export const EDIT_DATASOURCE_MESSAGE = () => diff --git a/app/client/src/components/editorComponents/StoreAsDatasource.tsx b/app/client/src/components/editorComponents/StoreAsDatasource.tsx index 84c2f5111afb..b605ca26eb38 100644 --- a/app/client/src/components/editorComponents/StoreAsDatasource.tsx +++ b/app/client/src/components/editorComponents/StoreAsDatasource.tsx @@ -60,11 +60,12 @@ function StoreAsDatasource(props: storeDataSourceProps) { return (