Skip to content

Commit

Permalink
Merge branch 'master' into fix/bulk-delete
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksandra Sikora committed May 14, 2020
2 parents 12b8b4d + ced1b4d commit c88bffd
Show file tree
Hide file tree
Showing 204 changed files with 4,584 additions and 1,514 deletions.
32 changes: 18 additions & 14 deletions .circleci/config.yml
@@ -1,5 +1,9 @@
# anchor refs to be used elsewhere
refs:
constants:
# TODO upload to hasura docker hub:
# - &server_builder_image hasura/graphql-engine-server-builder:2020-01-14
- &server_builder_image jberryman/graphql-engine-server-builder-8.10:2020-04-29
skip_job_on_ciignore: &skip_job_on_ciignore
run:
name: checking if job should be terminated or not
Expand Down Expand Up @@ -151,7 +155,7 @@ jobs:

build_server:
docker:
- image: hasura/graphql-engine-server-builder:2020-01-14
- image: *server_builder_image
resource_class: large
working_directory: ~/graphql-engine
steps:
Expand All @@ -161,10 +165,10 @@ jobs:
- checkout
- restore_cache:
keys:
- cabal-store-v1-{{ checksum "server/cabal.project" }}-{{ checksum "server/graphql-engine.cabal" }}-{{ checksum "server/cabal.project.freeze" }}
- cabal-store-v1-{{ checksum "server/cabal.project" }}-{{ checksum "server/graphql-engine.cabal" }}-
- cabal-store-v1-{{ checksum "server/cabal.project" }}-
- cabal-store-v1-
- cabal-store-v2-{{ checksum "server/cabal.project" }}-{{ checksum "server/graphql-engine.cabal" }}-{{ checksum "server/cabal.project.freeze" }}
- cabal-store-v2-{{ checksum "server/cabal.project" }}-{{ checksum "server/graphql-engine.cabal" }}-
- cabal-store-v2-{{ checksum "server/cabal.project" }}-
- cabal-store-v2-
- run:
name: Install latest postgresql client tools
command: |
Expand All @@ -183,7 +187,7 @@ jobs:
make enable_coverage=true ci-build
fi
- save_cache:
key: cabal-store-v1-{{ checksum "server/cabal.project" }}-{{ checksum "server/graphql-engine.cabal" }}-{{ checksum "server/cabal.project.freeze" }}
key: cabal-store-v2-{{ checksum "server/cabal.project" }}-{{ checksum "server/graphql-engine.cabal" }}-{{ checksum "server/cabal.project.freeze" }}
paths:
- ~/.cabal/packages
- ~/.cabal/store
Expand All @@ -196,7 +200,7 @@ jobs:

build_image:
docker:
- image: hasura/graphql-engine-server-builder:2020-01-14
- image: *server_builder_image
working_directory: ~/graphql-engine
steps:
- attach_workspace:
Expand Down Expand Up @@ -240,7 +244,7 @@ jobs:
PG_VERSION: "12"
POSTGIS_VERSION: "3.0.0"
docker:
- image: hasura/graphql-engine-server-builder:2020-01-14
- image: *server_builder_image
- image: hasura/postgres-12.0-alpine-postgis3:6cbd863d47c0
<<: *test_pg_env

Expand All @@ -249,7 +253,7 @@ jobs:
environment:
PG_VERSION: "11"
docker:
- image: hasura/graphql-engine-server-builder:2020-01-14
- image: *server_builder_image
- image: circleci/postgres:11-alpine-postgis
<<: *test_pg_env

Expand All @@ -258,7 +262,7 @@ jobs:
environment:
PG_VERSION: "10"
docker:
- image: hasura/graphql-engine-server-builder:2020-01-14
- image: *server_builder_image
- image: circleci/postgres:10-alpine-postgis
<<: *test_pg_env

Expand All @@ -267,7 +271,7 @@ jobs:
environment:
PG_VERSION: "9_6"
docker:
- image: hasura/graphql-engine-server-builder:2020-01-14
- image: *server_builder_image
- image: circleci/postgres:9.6-alpine-postgis
<<: *test_pg_env

Expand All @@ -276,14 +280,14 @@ jobs:
environment:
PG_VERSION: "9_5"
docker:
- image: hasura/graphql-engine-server-builder:2020-01-14
- image: *server_builder_image
- image: circleci/postgres:9.5-alpine-postgis
<<: *test_pg_env

server_unit_tests:
resource_class: large
docker:
- image: hasura/graphql-engine-server-builder:2020-01-14
- image: *server_builder_image
working_directory: ~/graphql-engine
steps:
- attach_workspace:
Expand Down Expand Up @@ -538,7 +542,7 @@ jobs:
test_server_upgrade:
docker:
# Using the image for pytests, since server upgrade tests are now a bunch of pytests
- image: hasura/graphql-engine-server-builder:2020-01-14
- image: *server_builder_image
environment:
HASURA_GRAPHQL_DATABASE_URL: postgresql://gql_test:@localhost:5432/gql_test
- image: circleci/postgres:11-alpine-postgis
Expand Down
4 changes: 3 additions & 1 deletion .circleci/server-builder.dockerfile
@@ -1,6 +1,8 @@
# Don't update this without updating the
# packager imager of graphql-engine
FROM haskell:8.6.5
FROM phadej/ghc:8.10.1-stretch
# TODO https://github.com/haskell/docker-haskell/issues/17
#FROM haskell:8.10.1

ARG docker_ver="17.09.0-ce"
ARG postgres_ver="12"
Expand Down
2 changes: 2 additions & 0 deletions .circleci/test-server.sh
Expand Up @@ -191,12 +191,14 @@ pip3 install -r requirements.txt
mkdir -p "$OUTPUT_FOLDER/hpc"

export EVENT_WEBHOOK_HEADER="MyEnvValue"

export HGE_URL="http://localhost:8080"
export HGE_URL_2=""
if [ -n ${HASURA_GRAPHQL_DATABASE_URL_2:-} ] ; then
HGE_URL_2="http://localhost:8081"
fi
export WEBHOOK_FROM_ENV="http://127.0.0.1:5592"
export SCHEDULED_TRIGGERS_WEBHOOK_DOMAIN="http://127.0.0.1:5594"
export HASURA_GRAPHQL_STRINGIFY_NUMERIC_TYPES=true

HGE_PIDS=""
Expand Down
33 changes: 31 additions & 2 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,19 @@

## Next release

### Scheduled Triggers

A scheduled trigger can be used to execute custom business logic based on time. There are two types of timing events: cron based or timestamp based.

A cron trigger will be useful when something needs to be done periodically. For example, you can create a cron trigger to generate an end-of-day sales report every weekday at 9pm.

You can also schedule one-off events based on a timestamp. For example, a new scheduled event can be created for 2 weeks from when a user signs up to send them an email about their experience.

<Add docs links>

(close #1914)


### Allow access to session variables by computed fields (fix #3846)

Sometimes it is useful for computed fields to have access to the Hasura session variables directly. For example, suppose you want to fetch some articles but also get related user info, say `likedByMe`. Now, you can define a function like:
Expand All @@ -16,6 +29,7 @@ RETURNS boolean AS $$
);
$$ LANGUAGE sql STABLE;
```

and make a query like:

```
Expand All @@ -25,7 +39,7 @@ query {
content
likedByMe
}
}
}
```

Support for this is now added through the `add_computed_field` API.
Expand All @@ -35,10 +49,21 @@ Read more about the session argument for computed fields in the [docs](https://h
### Bug fixes and improvements

(Add entries here in the order of: server, console, cli, docs, others)
- server: compile with GHC 8.10.1, closing a space leak with subscriptions. (close #4517) (#3388)

- server: avoid loss of precision when passing values in scientific notation (fix #4733)
- server: fix mishandling of GeoJSON inputs in subscriptions (fix #3239)
- console: avoid count queries for large tables (#4692)
- console: add read replica support section to pro popup (#4118)
- console: allow modifying default value for PK (fix #4075) (#4679)
- console: fix checkbox for forwarding client headers in actions (#4595)
- console: re-enable foreign tables to be listed as views (fix #4714) (#4742)
- console: display rows limit in permissions editor if set to zero (fix #4559)
- console: fix inconsistency between selected rows state and displayed rows (fix #4654) (#4673)
- cli: list all avialable commands in root command help (fix #4623)
- cli: list all available commands in root command help (fix #4623)
- docs: add section on actions vs. remote schemas to actions documentation (#4284)
- docs: fix wrong info about excluding scheme in CORS config (#4685)
- docs: add docs page on query performance (close #2316) (#3693)

## `v1.2.0`

Expand Down Expand Up @@ -104,6 +129,7 @@ The `internal` field for action errors is improved with more debug information.
`response` and `error` fields instead of just `webhook_response` field.

Before:

```json
{
"errors": [
Expand All @@ -124,7 +150,9 @@ Before:
]
}
```

After:

```json
{
"errors": [
Expand Down Expand Up @@ -188,6 +216,7 @@ ENV vars can now be read from .env file present at the project root directory. A
```
hasura console --envfile production.env
```

The above command will read ENV vars from `production.env` file present at the project root directory.

(close #4129) (#4454)
Expand Down
20 changes: 2 additions & 18 deletions cli/commands/docs.go
Expand Up @@ -4,14 +4,12 @@ import (
"bytes"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"sort"
"strings"

"github.com/hasura/graphql-engine/cli"
"github.com/markbates/pkger"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/cobra/doc"
Expand Down Expand Up @@ -105,26 +103,12 @@ func genReSTCustom(cmd *cobra.Command, w io.Writer, titlePrefix string, linkHand
buf := new(bytes.Buffer)
name := cmd.CommandPath()
ref := strings.Replace(name, " ", "_", -1)
cliDocPath := "manifests/docs/" + ref + ".rst"
short := cmd.Short
long := cmd.Long
if len(long) == 0 {
long = short
}
file, err := pkger.Open(cliDocPath)
if err != nil {
return err
}
fileInfo, err := ioutil.ReadAll(file)
if err != nil {
return err
}
var info string
if err != nil || string(fileInfo) == "" {
info = short
} else {
info = string(fileInfo)
}
info := short

buf.WriteString(".. _" + ref + ":\n\n")

Expand Down Expand Up @@ -184,7 +168,7 @@ func genReSTCustom(cmd *cobra.Command, w io.Writer, titlePrefix string, linkHand
if !cmd.DisableAutoGenTag {
buf.WriteString("*Auto generated by spf13/cobra*\n")
}
_, err = buf.WriteTo(w)
_, err := buf.WriteTo(w)
return err
}

Expand Down
10 changes: 10 additions & 0 deletions console/cypress/integration/data/modify/spec.js
Expand Up @@ -80,6 +80,16 @@ export const passMTRenameColumn = () => {
validateColumn(getTableName(0, testName), ['id'], 'success');
};

export const passMTChangeDefaultValueForPKey = () => {
cy.wait(10000);
cy.get(getElementFromAlias('modify-table-edit-column-0')).click();
cy.get(getElementFromAlias('edit-col-default'))
.clear()
.type('1234');
cy.get(getElementFromAlias('modify-table-column-0-save')).click();
cy.wait(15000);
};

export const passMTMoveToTable = () => {
cy.get(getElementFromAlias(getTableName(0, testName))).click();
cy.url().should(
Expand Down
5 changes: 5 additions & 0 deletions console/cypress/integration/data/modify/test.js
Expand Up @@ -20,6 +20,7 @@ import {
passCreateUniqueKey,
passModifyUniqueKey,
passRemoveUniqueKey,
passMTChangeDefaultValueForPKey,
} from './spec';

import { testMode } from '../../../helpers/common';
Expand Down Expand Up @@ -51,6 +52,10 @@ export const runModifyTableTests = () => {
it('Pass modify with wrong default value', passMCWithRightDefaultValue);
it('Pass create foreign-key', passCreateForeignKey);
it('Pass remove foreign-key', passRemoveForeignKey);
it(
'Pass edit default value for primary key',
passMTChangeDefaultValueForPKey
);
it('Pass modifying a primary key', passModifyPkey);
it('Pass creating a unique key', passCreateUniqueKey);
it('Pass modifying a unique key', passModifyUniqueKey);
Expand Down
7 changes: 3 additions & 4 deletions console/src/components/Main/Main.js
Expand Up @@ -621,11 +621,10 @@ class Main extends React.Component {
<img src={read} alt={'read'} />
</div>
<div className={styles.featuresList}>
<div className={styles.featuresTitle}>
Read Replicas
</div>
<div className={styles.featuresTitle}>Read Replicas</div>
<div className={styles.featuresDescription}>
Native Read Replica support for enhanced performance and scalability
Native Read Replica support for enhanced performance and
scalability
</div>
</div>
</div>
Expand Down
3 changes: 1 addition & 2 deletions console/src/components/Services/Actions/Add/Add.js
Expand Up @@ -63,8 +63,7 @@ const AddAction = ({
dispatch(dispatchNewHeaders(hs));
};

const toggleForwardClientHeaders = e => {
e.preventDefault();
const toggleForwardClientHeaders = () => {
dispatch(toggleFCH());
};

Expand Down
Expand Up @@ -32,15 +32,12 @@ const HandlerEditor = ({
/>
</h2>
<div className={`${styles.add_mar_bottom_mid}`}>
<label
className={`${styles.add_mar_right} ${styles.cursorPointer}`}
onClick={toggleForwardClientHeaders}
>
<label className={`${styles.add_mar_right} ${styles.cursorPointer}`}>
<input
type="checkbox"
checked={forwardClientHeaders}
readOnly
className={`${styles.add_mar_right_small}`}
onChange={toggleForwardClientHeaders}
className={`${styles.add_mar_right_small} ${styles.cursorPointer}`}
/>
Forward client headers to webhook
</label>
Expand Down
Expand Up @@ -74,8 +74,7 @@ const ActionEditor = ({
dispatch(dispatchNewHeaders(hs));
};

const toggleForwardClientHeaders = e => {
e.preventDefault();
const toggleForwardClientHeaders = () => {
dispatch(toggleFCH());
};

Expand Down
Expand Up @@ -190,17 +190,17 @@ const RelationshipEditor = ({
disabled={!name}
>
{// default unselected option
refSchema === '' && (
<option value={''} disabled>
{'-- reference schema --'}
</option>
)}
refSchema === '' && (
<option value={''} disabled>
{'-- reference schema --'}
</option>
)}
{// all reference schema options
orderedSchemaList.map((rs, j) => (
<option key={j} value={rs}>
{rs}
</option>
))}
orderedSchemaList.map((rs, j) => (
<option key={j} value={rs}>
{rs}
</option>
))}
</select>
</div>
);
Expand Down

0 comments on commit c88bffd

Please sign in to comment.