这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@soorajshankar
Copy link
Member

@soorajshankar soorajshankar commented May 28, 2020

Description

This pr will allow console users to set sql function argument from session variable.

Changelog

  • CHANGELOG.md is updated with user-facing content relevant to this PR.

Affected components

  • Server
  • Console
  • CLI
  • Docs
  • Community Content
  • Build System
  • Tests
  • Other (list it)

Related Issues

close #4499

Solution and Design

Add UI to consume track_function v2 api https://hasura.io/docs/1.0/graphql/manual/api-reference/schema-metadata-api/custom-functions.html#track-function-v2.

Steps to test and verify

captured (3)

@soorajshankar soorajshankar requested a review from rikinsk May 28, 2020 21:55
@soorajshankar soorajshankar requested a review from a team as a code owner May 28, 2020 21:55
@netlify
Copy link

netlify bot commented May 28, 2020

Deploy preview for hasura-docs ready!

Built with commit 18fca1a

https://deploy-preview-4922--hasura-docs.netlify.app

@hasura-bot
Copy link
Contributor

Review app for commit 5cb419c deployed to Heroku: https://hge-ci-pull-4922.herokuapp.com
Docker image for server: hasura/graphql-engine:pull4922-5cb419c9

@soorajshankar soorajshankar requested a review from a team as a code owner May 29, 2020 05:43
@hasura-bot
Copy link
Contributor

Review app for commit 054c31a deployed to Heroku: https://hge-ci-pull-4922.herokuapp.com
Docker image for server: hasura/graphql-engine:pull4922-054c31a7

@hasura-bot
Copy link
Contributor

Review app for commit 33b3343 deployed to Heroku: https://hge-ci-pull-4922.herokuapp.com
Docker image for server: hasura/graphql-engine:pull4922-33b33432

@beerose beerose added the c/console Related to console label May 29, 2020
Copy link
Contributor

@beerose beerose left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very well written code! Nice!


A couple of points regarding functionality:

  1. After clicking Save for setting session argument app redirects to data/schema/public. Is it a bug or a feature?

  2. Can we prefill input after setting the session variable? Right now it remains empty after visiting the modify page again.

Screenshot 2020-06-03 at 22 15 01

  1. The name of the migration should indicate setting session variable.

  2. This is generated down migration — check missing name:

- args:
    name: ""
    schema: public
  type: untrack_function
- args:
    name: get_session_role
    schema: public
  type: track_function

Is this down migration needed?

  1. Let's be consistent with the naming. Sometimes there's Session variable argument, sometimes Session argument variable. The same goes for the casing.
    Example:

Screenshot 2020-06-03 at 22 16 11

In the docs, we refer to this by session variables, and I think we should stick to just session variable, lowercase.

  1. There's no error notification on server error. Can you check this?

2020-06-03 at 22 11 40 - Purple Shark

  1. What about having Learn more link to the docs for it? cc @rikinsk

@beerose beerose assigned soorajshankar and unassigned beerose Jun 3, 2020
Copy link
Member

@rikinsk rikinsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a few points from a UX perspective:

Screenshot from 2020-06-05 17-33-00

  • Can we make this page look consistent with Modify Page for views. i.e. Add a heading called Function definition and move the Modify button next to it.
  • Use the term Session argument everywhere (argument doesnt need to start with capital).
  • Update tooltip text to: the function argument into which hasura session variables will be passed
  • Add a Know more link next to the tooltip linking to https://hasura.io/docs/1.0/graphql/manual/schema/custom-functions.html#accessing-hasura-session-variables-in-custom-functions (there is a KnowMoreLink component for this)
  • in the placeholder change hasura-session to hasura_session. - are not allowed in SQL
  • After saving the session argument, just close the session argument editor. No redirect to schema page.
  • Once a session argument is added, prefill its value in the input box when edit is clicked
  • Disable the save button when the input value is unchanged from the current value
  • Currently, there is no way to remove a session argument once set. Allow users to save an empty string as well which we can interpret as no session argument is set

…o feature/session_argument-as-sql-function-argument-#4499
@hasura-bot
Copy link
Contributor

Review app for commit 8bde531 deployed to Heroku: https://hge-ci-pull-4922.herokuapp.com
Docker image for server: hasura/graphql-engine:pull4922-8bde531a

@hasura-bot
Copy link
Contributor

Review app for commit 63a2179 deployed to Heroku: https://hge-ci-pull-4922.herokuapp.com
Docker image for server: hasura/graphql-engine:pull4922-63a2179d

@hasura-bot
Copy link
Contributor

Review app for commit 2bb4a5a deployed to Heroku: https://hge-ci-pull-4922.herokuapp.com
Docker image for server: hasura/graphql-engine:pull4922-2bb4a5a3

@hasura-bot
Copy link
Contributor

Review app for commit fe37b34 deployed to Heroku: https://hge-ci-pull-4922.herokuapp.com
Docker image for server: hasura/graphql-engine:pull4922-fe37b341

@hasura-bot
Copy link
Contributor

Review app for commit f2d97e7 deployed to Heroku: https://hge-ci-pull-4922.herokuapp.com
Docker image for server: hasura/graphql-engine:pull4922-f2d97e7b

@soorajshankar soorajshankar requested a review from rikinsk June 9, 2020 12:41
@hasura-bot
Copy link
Contributor

Review app for commit da9260f deployed to Heroku: https://hge-ci-pull-4922.herokuapp.com
Docker image for server: hasura/graphql-engine:pull4922-da9260f4

@beerose beerose assigned rikinsk and unassigned soorajshankar Jun 9, 2020
Copy link
Member

@rikinsk rikinsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UX approved

@rikinsk rikinsk removed their assignment Jun 9, 2020
@beerose beerose changed the title allow setting session_argument while tracking functions console: allow configure session_argument for custom functions Jun 10, 2020
@beerose beerose changed the title console: allow configure session_argument for custom functions console: allow configuring session_argument for custom functions Jun 10, 2020
Copy link
Contributor

@beerose beerose left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Down migration for setting session arg is incorrect:

- args:
    name: customfunctionwithsessionarg
    schema: public
  type: untrack_function
- args:
    configuration: {}
    function:
      name: customfunctionwithsessionarg
      schema: public
  type: track_function

Missing version: 2.

@beerose beerose assigned soorajshankar and unassigned beerose Jun 10, 2020
@hasura-bot
Copy link
Contributor

Review app for commit 19e1ffa deployed to Heroku: https://hge-ci-pull-4922.herokuapp.com
Docker image for server: hasura/graphql-engine:pull4922-19e1ffa5

@soorajshankar soorajshankar requested a review from beerose June 11, 2020 07:55
@hasura-bot
Copy link
Contributor

Review app for commit 392f789 deployed to Heroku: https://hge-ci-pull-4922.herokuapp.com
Docker image for server: hasura/graphql-engine:pull4922-392f789f

@beerose beerose changed the title console: allow configuring session_argument for custom functions console: allow configuring session_argument for custom functions (close #4499) Jun 11, 2020
@beerose beerose merged commit cb3252c into hasura:master Jun 11, 2020
@hasura-bot
Copy link
Contributor

Review app https://hge-ci-pull-4922.herokuapp.com is deleted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c/console Related to console

Projects

None yet

Development

Successfully merging this pull request may close these issues.

console: allow setting session_argument while tracking functions

4 participants