From 6028a93078939650dd6ef9e02489c59f1e689027 Mon Sep 17 00:00:00 2001 From: Varun Choudhary <68095256+Varun-Choudhary@users.noreply.github.com> Date: Wed, 28 Sep 2022 10:58:58 +0530 Subject: [PATCH] console: add `Try it` button on table view to try operations from graphiql tab PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6016 Co-authored-by: Daniele Cammareri <5709409+dancamma@users.noreply.github.com> GitOrigin-RevId: a26d5c6e3b61a9f12f8e2ff476091a8dcef9e696 --- .../Common/EditableHeading/EditableHeading.js | 21 ++- .../Common/EditableHeading/TryOperation.tsx | 140 ++++++++++++++ .../generateGqlQueryFromTable.test.tsx | 150 +++++++++++++++ .../Common/EditableHeading/utils.ts | 177 ++++++++++++++++++ .../Services/Data/TableCommon/TableHeader.js | 2 + .../EventTriggers/Common/AutoCleanupForm.tsx | 2 +- .../features/Data/ManageTable/ManageTable.tsx | 2 +- .../QueryCollectionHeaderMenu.tsx | 6 +- .../QuickAdd.tsx | 2 +- .../QueryCollectionOperationsHeader.tsx | 2 + .../DropdownButton/DropdownButton.tsx | 1 + .../DropdownMenu/DropdownMenu.tsx | 24 ++- console/src/utils/localStorage.ts | 1 + 13 files changed, 512 insertions(+), 18 deletions(-) create mode 100644 console/src/components/Common/EditableHeading/TryOperation.tsx create mode 100644 console/src/components/Common/EditableHeading/generateGqlQueryFromTable.test.tsx create mode 100644 console/src/components/Common/EditableHeading/utils.ts diff --git a/console/src/components/Common/EditableHeading/EditableHeading.js b/console/src/components/Common/EditableHeading/EditableHeading.js index a8b3564799d..1990c90bd63 100644 --- a/console/src/components/Common/EditableHeading/EditableHeading.js +++ b/console/src/components/Common/EditableHeading/EditableHeading.js @@ -1,6 +1,7 @@ import React from 'react'; import { FaEdit } from 'react-icons/fa'; import styles from '../Common.module.scss'; +import { TryOperation } from './TryOperation'; class Heading extends React.Component { state = { @@ -32,12 +33,25 @@ class Heading extends React.Component { }; render = () => { - const { editable, currentValue, save, loading, property } = this.props; - + const { + editable, + currentValue, + save, + loading, + property, + table, + dispatch, + source, + } = this.props; const { text, isEditting } = this.state; if (!editable) { - return
{cron.label}
diff --git a/console/src/features/Data/ManageTable/ManageTable.tsx b/console/src/features/Data/ManageTable/ManageTable.tsx
index 4b47049c253..e70738e1e39 100644
--- a/console/src/features/Data/ManageTable/ManageTable.tsx
+++ b/console/src/features/Data/ManageTable/ManageTable.tsx
@@ -93,7 +93,7 @@ export const ManageTable = (props: ManageTableProps) => {
items={[
[
// TODO: To be implemented after metadata util functions have been added to the metadata library
- {}}>
+ {}}>
Untrack {tableName}
,
],
diff --git a/console/src/features/QueryCollections/components/QueryCollectionHeader/QueryCollectionHeaderMenu.tsx b/console/src/features/QueryCollections/components/QueryCollectionHeader/QueryCollectionHeaderMenu.tsx
index ec621c49b1e..beed792b6a1 100644
--- a/console/src/features/QueryCollections/components/QueryCollectionHeader/QueryCollectionHeaderMenu.tsx
+++ b/console/src/features/QueryCollections/components/QueryCollectionHeader/QueryCollectionHeaderMenu.tsx
@@ -37,7 +37,7 @@ export const QueryCollectionHeaderMenu: React.FC
{operation.name}
diff --git a/console/src/features/QueryCollections/components/QueryCollectionOperations/QueryCollectionOperationsHeader.tsx b/console/src/features/QueryCollections/components/QueryCollectionOperations/QueryCollectionOperationsHeader.tsx
index 145d40cdeaf..672ab1e1825 100644
--- a/console/src/features/QueryCollections/components/QueryCollectionOperations/QueryCollectionOperationsHeader.tsx
+++ b/console/src/features/QueryCollections/components/QueryCollectionOperations/QueryCollectionOperationsHeader.tsx
@@ -62,6 +62,7 @@ export const QueryCollectionsOperationsHeader: React.FC