Skip to content

Commit

Permalink
Merge oss/master onto mono/main
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 1c8c4d6
  • Loading branch information
scriptnull authored and hasura-bot committed Nov 12, 2020
1 parent 9faf5d9 commit 58c44f5
Show file tree
Hide file tree
Showing 141 changed files with 3,662 additions and 3,062 deletions.
4 changes: 2 additions & 2 deletions .circleci/cli-builder.dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM golang:1.13
FROM golang:1.14

ARG upx_version="3.94"
ARG upx_version="3.96"

# install go dependencies
RUN go get github.com/mitchellh/gox \
Expand Down
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ jobs:
# test and build cli
test_and_build_cli:
docker:
- image: hasura/graphql-engine-cli-builder:20191205
- image: hasura/graphql-engine-cli-builder:20201105
- image: circleci/postgres:10-alpine
environment:
POSTGRES_USER: gql_test
Expand Down Expand Up @@ -669,4 +669,4 @@ workflows:
- build_image
- test_console
- test_and_build_cli_migrations
- all_server_tests_pass
- all_server_tests_pass
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ This release contains the [PDV refactor (#4111)](https://github.com/hasura/graph
### Bug fixes and improvements

(Add entries here in the order of: server, console, cli, docs, others)
- cli: fix cli-migrations-v2 image failing to run as a non root user (close #4651, close #5333)

- server: Fix fine-grained incremental cache invalidation (fix #3759)

Expand All @@ -120,11 +121,14 @@ This release contains the [PDV refactor (#4111)](https://github.com/hasura/graph
- server: accept only non-negative integers for batch size and refetch interval (close #5653) (#5759)
- server: fix bug which arised when renaming a table which had a manual relationship defined (close #4158)
- server: limit the length of event trigger names (close #5786)
- server: Configurable websocket keep-alive interval. Add `--websocket-keepalive` command-line flag
and handle `HASURA_GRAPHQL_WEBSOCKET_KEEPALIVE` env variable (fix #3539)
**NOTE:** If you have event triggers with names greater than 42 chars, then you should update their names to avoid running into Postgres identifier limit bug (#5786)
- server: validate remote schema queries (fixes #4143)
- server: fix issue with tracking custom functions that return `SETOF` materialized view (close #5294) (#5945)
- server: introduce optional custom table name in table configuration to track the table according to the custom name. The `set_table_custom_fields` API has been deprecated, A new API `set_table_customization` has been added to set the configuration. (#3811)
- server: allow remote relationships with union, interface and enum type fields as well (fixes #5875) (#6080)
- server: fix event trigger cleanup on deletion via replace_metadata (fix #5461) (#6137)
- console: allow user to cascade Postgres dependencies when dropping Postgres objects (close #5109) (#5248)
- console: mark inconsistent remote schemas in the UI (close #5093) (#5181)
- console: remove ONLY as default for ALTER TABLE in column alter operations (close #5512) #5706
Expand All @@ -133,6 +137,7 @@ This release contains the [PDV refactor (#4111)](https://github.com/hasura/graph
- console: down migrations improvements (close #3503, #4988) (#4790)
- cli: add missing global flags for seed command (#5565)
- cli: allow seeds as alias for seed command (#5693)
- cli: fix bug in metadata apply which made the server aquire some redundant and unnecessary locks (close #6115)
- docs: add docs page on networking with docker (close #4346) (#4811)
- docs: add tabs for console / cli / api workflows (close #3593) (#4948)
- docs: add postgres concepts page to docs (close #4440) (#4471)
Expand Down
4 changes: 2 additions & 2 deletions cli/commands/scripts_update_config_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func newScriptsUpdateConfigV2Cmd(ec *cli.ExecutionContext) *cobra.Command {
}
}
// check if up.sql file exists
if string(sqlUp.Bytes()) != "" {
if sqlUp.String() != "" {
upMigration, ok := fileCfg.Migrations.Migrations[version][source.Up]
if !ok {
// if up.sql doesn't exists, create a up.sql file and upMigration
Expand Down Expand Up @@ -207,7 +207,7 @@ func newScriptsUpdateConfigV2Cmd(ec *cli.ExecutionContext) *cobra.Command {
}
}
// check if up.sql file exists
if string(sqlDown.Bytes()) != "" {
if sqlDown.String() != "" {
downMigration, ok := fileCfg.Migrations.Migrations[version][source.Down]
if !ok {
// if up.sql doesn't exists, create a up.sql file and upMigration
Expand Down
15 changes: 3 additions & 12 deletions cli/migrate/database/hasuradb/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,18 +180,9 @@ func (h *HasuraDB) ApplyMetadata() error {
if err != nil {
return err
}
query := HasuraInterfaceBulk{
Type: "bulk",
Args: []interface{}{
HasuraInterfaceQuery{
Type: "clear_metadata",
Args: HasuraArgs{},
},
HasuraInterfaceQuery{
Type: "replace_metadata",
Args: obj,
},
},
query := HasuraInterfaceQuery{
Type: "replace_metadata",
Args: obj,
}
resp, body, err := h.sendv1Query(query)
if err != nil {
Expand Down
10 changes: 10 additions & 0 deletions cli/plugins/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,24 @@ import (
)

func (c *Config) findPluginManifestFiles(indexDir string) ([]string, error) {
c.Logger.Debugf("finding plugin manifest files in directory %v", indexDir)
var out []string
fs := afero.Afero{
Fs: afero.NewOsFs(),
}
fs.Walk(indexDir, func(path string, info os.FileInfo, err error) error {
if info == nil {
if err != nil {
return err
}
return nil
}
if info.Mode().IsRegular() && filepath.Ext(info.Name()) == paths.ManifestExtension {
out = append(out, path)
}
return nil
})

return out, nil
}

Expand All @@ -50,6 +58,7 @@ func (c *Config) LoadPluginListFromFS(indexDir string) (Plugins, error) {
// LoadPluginByName loads a plugins index file by its name. When plugin
// file not found, it returns an error that can be checked with os.IsNotExist.
func (c *Config) LoadPluginByName(pluginName string) (*PluginVersions, error) {
c.Logger.Debugf("loading plugin %s", pluginName)
if !IsSafePluginName(pluginName) {
return nil, errors.Errorf("plugin name %q not allowed", pluginName)
}
Expand All @@ -68,6 +77,7 @@ func (c *Config) LoadPluginByName(pluginName string) (*PluginVersions, error) {
}

func (c *Config) LoadPlugins(files []string, pluginName ...string) Plugins {
c.Logger.Debugf("loading plugins")
ps := Plugins{}
for _, file := range files {
p, err := c.ReadPluginFromFile(file)
Expand Down
2 changes: 1 addition & 1 deletion cli/plugins/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ type Plugin struct {
func (p *Plugin) ParseVersion() {
v, err := semver.NewVersion(p.Version)
if err != nil {
p.ParsedVersion = nil
p.ParsedVersion = semver.MustParse("0.0.0-dev")
return
}
p.ParsedVersion = v
Expand Down
5 changes: 3 additions & 2 deletions console/src/Endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ const Endpoints = {
hasuractlMetadata: `${hasuractlUrl}/apis/metadata`,
hasuractlMigrateSettings: `${hasuractlUrl}/apis/migrate/settings`,
telemetryServer: 'wss://telemetry.hasura.io/v1/ws',
consoleNotificationsStg: 'https://data.hasura-stg.hasura-app.io/v1/query',
consoleNotificationsProd: 'https://data.hasura.io/v1/query',
consoleNotificationsStg:
'https://notifications.hasura-stg.hasura-app.io/v1/graphql',
consoleNotificationsProd: 'https://notifications.hasura.io/v1/graphql',
};

const globalCookiePolicy = 'same-origin';
Expand Down
65 changes: 26 additions & 39 deletions console/src/components/Common/utils/v1QueryUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -795,47 +795,34 @@ export const getConsoleNotificationQuery = (
time: Date | string | number,
userType?: Nullable<ConsoleScope>
) => {
let consoleUserScope = {
$ilike: `%${userType}%`,
};
let consoleUserScopeVar = `%${userType}%`;
if (!userType) {
consoleUserScope = {
$ilike: '%OSS%',
};
consoleUserScopeVar = '%OSS%';
}

return {
args: {
table: 'console_notification',
columns: ['*'],
where: {
$or: [
{
expiry_date: {
$gte: time,
},
},
{
expiry_date: {
$eq: null,
},
},
],
scope: consoleUserScope,
start_date: { $lte: time },
},
order_by: [
{
type: 'asc',
nulls: 'last',
column: 'priority',
},
{
type: 'desc',
column: 'start_date',
},
],
},
type: 'select',
const query = `query fetchNotifications($currentTime: timestamptz, $userScope: String) {
console_notifications(
where: {start_date: {_lte: $currentTime}, scope: {_ilike: $userScope}, _or: [{expiry_date: {_gte: $currentTime}}, {expiry_date: {_eq: null}}]},
order_by: {priority: asc_nulls_last, start_date: desc}
) {
content
created_at
external_link
expiry_date
id
is_active
priority
scope
start_date
subject
type
}
}`;

const variables = {
userScope: consoleUserScopeVar,
currentTime: time,
};

return { query, variables };
};
Loading

0 comments on commit 58c44f5

Please sign in to comment.