Skip to content

Commit

Permalink
Merge branch 'master' into issue-4595
Browse files Browse the repository at this point in the history
  • Loading branch information
lastnamearya committed May 7, 2020
2 parents 7b4b68b + f1c3b43 commit 43198eb
Show file tree
Hide file tree
Showing 20 changed files with 51 additions and 39 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Read more about the session argument for computed fields in the [docs](https://h

(Add entries here in the order of: server, console, cli, docs, others)

- console: avoid count queries for large tables (#4692)
- console: add read replica support section to pro popup (#4118)
- cli: list all avialable commands in root command help (fix #4623)

Expand Down
20 changes: 2 additions & 18 deletions cli/commands/docs.go
Original file line number Diff line number Diff line change
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
2 changes: 2 additions & 0 deletions console/src/components/Services/Data/DataState.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const defaultViewState = {
manualTriggers: [],
triggeredRow: -1,
triggeredFunction: null,
estimatedCount: 0,
isCountEstimated: 0,
};

const defaultPermissionsState = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import Button from '../../../Common/Button/Button';
import ReloadEnumValuesButton from '../Common/Components/ReloadEnumValuesButton';
import styles from '../../../Common/FilterQuery/FilterQuery.scss';
import { getPersistedPageSize } from './localStorageUtils';
import { isEmpty } from '../../../Common/utils/jsUtils';

const history = createHistory();

Expand Down Expand Up @@ -205,7 +206,7 @@ class FilterQuery extends Component {
componentDidMount() {
const { dispatch, tableSchema, curQuery } = this.props;
const limit = getPersistedPageSize();
if (!this.props.urlQuery) {
if (isEmpty(this.props.urlQuery)) {
dispatch(setDefaultQuery({ ...curQuery, limit }));
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
getRunSqlQuery,
} from '../../../Common/utils/v1QueryUtils';
import { generateTableDef } from '../../../Common/utils/pgUtils';
import { COUNT_LIMIT } from '../constants';

/* ****************** View actions *************/
const V_SET_DEFAULTS = 'ViewTable/V_SET_DEFAULTS';
Expand Down Expand Up @@ -96,7 +97,7 @@ const vMakeRowsRequest = () => {
dispatch({
type: V_REQUEST_SUCCESS,
data: data[0],
estimatedCount: data[1].result[1],
estimatedCount: parseInt(data[1].result[1][0], 10),
}),
dispatch({ type: V_REQUEST_PROGRESS, data: false }),
]);
Expand Down Expand Up @@ -157,9 +158,19 @@ const vMakeCountRequest = () => {
};
};

const vMakeTableRequests = () => dispatch => {
dispatch(vMakeRowsRequest());
dispatch(vMakeCountRequest());
const vMakeTableRequests = () => (dispatch, getState) => {
dispatch(vMakeRowsRequest()).then(() => {
const { estimatedCount } = getState().tables.view;
if (estimatedCount > COUNT_LIMIT) {
dispatch({
type: V_COUNT_REQUEST_SUCCESS,
count: estimatedCount,
isEstimated: true,
});
} else {
dispatch(vMakeCountRequest());
}
});
};

const fetchManualTriggers = tableName => {
Expand Down Expand Up @@ -572,7 +583,11 @@ const viewReducer = (tableName, currentSchema, schemas, viewState, action) => {
case V_REQUEST_PROGRESS:
return { ...viewState, isProgressing: action.data };
case V_COUNT_REQUEST_SUCCESS:
return { ...viewState, count: action.count };
return {
...viewState,
count: action.count,
isCountEstimated: action.isEstimated === true,
};
case V_EXPAND_ROW:
return {
...viewState,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class ViewTable extends Component {
triggeredFunction,
location,
estimatedCount,
isCountEstimated,
} = this.props;

// check if table exists
Expand Down Expand Up @@ -161,7 +162,8 @@ class ViewTable extends Component {
// Choose the right nav bar header thing
const header = (
<TableHeader
count={count}
count={isCountEstimated ? estimatedCount : count}
isCountEstimated={isCountEstimated}
dispatch={dispatch}
table={tableSchema}
tabName="browse"
Expand Down
10 changes: 7 additions & 3 deletions console/src/components/Services/Data/TableCommon/TableHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { Link } from 'react-router';
import Helmet from 'react-helmet';
import { changeTableName } from '../TableModify/ModifyActions';
import { capitalize } from '../../../Common/utils/jsUtils';
import { capitalize, exists } from '../../../Common/utils/jsUtils';
import EditableHeading from '../../../Common/EditableHeading/EditableHeading';
import BreadCrumb from '../../../Common/Layout/BreadCrumb/BreadCrumb';
import { tabNameMap } from '../utils';
Expand All @@ -26,6 +26,7 @@ import { getReadableNumber } from '../../../Common/utils/jsUtils';
const TableHeader = ({
tabName,
count,
isCountEstimated,
table,
migrationMode,
readOnlyMode,
Expand All @@ -38,8 +39,11 @@ const TableHeader = ({
const isTable = checkIfTable(table);

let countDisplay = '';
if (!(count === null || count === undefined)) {
countDisplay = '(' + getReadableNumber(count) + ')';
// if (exists(count)) {
// countDisplay = `(${isCountEstimated ? '~' : '' }${getReadableNumber(count)})`;
// }
if (exists(count) && !isCountEstimated) {
countDisplay = `(${getReadableNumber(count)})`;
}
const activeTab = tabNameMap[tabName];

Expand Down
2 changes: 2 additions & 0 deletions console/src/components/Services/Data/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export const Integers = [
'bigint',
];

export const COUNT_LIMIT = 100000;

export const Reals = ['float4', 'float8', 'numeric'];

export const Numerics = [...Integers, ...Reals];
Expand Down
2 changes: 1 addition & 1 deletion install-manifests/azure-container-with-pg/azuredeploy.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"firewallRuleName": "allow-all-azure-firewall-rule",
"containerGroupName": "[concat(parameters('name'), '-container-group')]",
"containerName": "hasura-graphql-engine",
"containerImage": "hasura/graphql-engine:v1.2.0"
"containerImage": "hasura/graphql-engine:v1.2.1"
},
"resources": [
{
Expand Down
2 changes: 1 addition & 1 deletion install-manifests/azure-container/azuredeploy.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"dbName": "[parameters('postgresDatabaseName')]",
"containerGroupName": "[concat(parameters('name'), '-container-group')]",
"containerName": "hasura-graphql-engine",
"containerImage": "hasura/graphql-engine:v1.2.0"
"containerImage": "hasura/graphql-engine:v1.2.1"
},
"resources": [
{
Expand Down
2 changes: 1 addition & 1 deletion install-manifests/docker-compose-https/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
environment:
POSTGRES_PASSWORD: postgrespassword
graphql-engine:
image: hasura/graphql-engine:v1.2.0
image: hasura/graphql-engine:v1.2.1
depends_on:
- "postgres"
restart: always
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ services:
PGADMIN_DEFAULT_EMAIL: pgadmin@example.com
PGADMIN_DEFAULT_PASSWORD: admin
graphql-engine:
image: hasura/graphql-engine:v1.2.0
image: hasura/graphql-engine:v1.2.1
ports:
- "8080:8080"
depends_on:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
environment:
POSTGRES_PASSWORD: postgrespassword
graphql-engine:
image: hasura/graphql-engine:v1.2.0
image: hasura/graphql-engine:v1.2.1
ports:
- "8080:8080"
depends_on:
Expand Down
2 changes: 1 addition & 1 deletion install-manifests/docker-compose/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
environment:
POSTGRES_PASSWORD: postgrespassword
graphql-engine:
image: hasura/graphql-engine:v1.2.0
image: hasura/graphql-engine:v1.2.1
ports:
- "8080:8080"
depends_on:
Expand Down
2 changes: 1 addition & 1 deletion install-manifests/docker-run/docker-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
docker run -d -p 8080:8080 \
-e HASURA_GRAPHQL_DATABASE_URL=postgres://username:password@hostname:port/dbname \
-e HASURA_GRAPHQL_ENABLE_CONSOLE=true \
hasura/graphql-engine:v1.2.0
hasura/graphql-engine:v1.2.1
2 changes: 1 addition & 1 deletion install-manifests/google-cloud-k8s-sql/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
spec:
containers:
- name: graphql-engine
image: hasura/graphql-engine:v1.2.0
image: hasura/graphql-engine:v1.2.1
ports:
- containerPort: 8080
readinessProbe:
Expand Down
2 changes: 1 addition & 1 deletion install-manifests/kubernetes/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
app: hasura
spec:
containers:
- image: hasura/graphql-engine:v1.2.0
- image: hasura/graphql-engine:v1.2.1
imagePullPolicy: IfNotPresent
name: hasura
env:
Expand Down
2 changes: 1 addition & 1 deletion scripts/cli-migrations/v1/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM hasura/graphql-engine:v1.2.0
FROM hasura/graphql-engine:v1.2.1

# set an env var to let the cli know that
# it is running in server environment
Expand Down
2 changes: 1 addition & 1 deletion scripts/cli-migrations/v2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM hasura/haskell-docker-packager:20190731 as packager
WORKDIR /tmp
RUN apt-get update && apt-get download libstdc++6

FROM hasura/graphql-engine:v1.2.0
FROM hasura/graphql-engine:v1.2.1

# install libstdc++6 from .deb file
COPY --from=packager /tmp/libstdc++6* .
Expand Down
1 change: 1 addition & 0 deletions server/src-rsr/catalog_versions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ v1.2.0-beta.3 34
v1.2.0-beta.4 34
v1.2.0-beta.5 34
v1.2.0 34
v1.2.1 34

0 comments on commit 43198eb

Please sign in to comment.