Skip to content

Commit

Permalink
Refactors
Browse files Browse the repository at this point in the history
  • Loading branch information
GavinRay97 committed Nov 23, 2020
1 parent c6ba5e1 commit 9716bab
Show file tree
Hide file tree
Showing 14 changed files with 478 additions and 123 deletions.
1 change: 0 additions & 1 deletion react-app/components/graphiql.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
import { useStoreState } from "../store"
import { useState } from "react"

// TODO: Change this to be dynamic or take UI input
const HASURA_ENDPOINT = process.env.NEXT_PUBLIC_HASURA_URL
? process.env.NEXT_PUBLIC_HASURA_URL + "/v1/graphql"
: "http://localhost:8085/v1/graphql"
Expand Down
109 changes: 109 additions & 0 deletions react-app/components/react-table.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
// import { useMemo } from "react"
// import { useTable, Column } from "react-table"

// export function ReactTable() {
// const data = useMemo(
// () => [
// {
// currency: "EUR",
// amount: 10000,
// date: "2020-01-01",
// },
// {
// currency: "EUR",
// amount: 11000,
// date: "2020-02-01",
// },
// {
// currency: "GBP",
// amount: 12000,
// date: "2020-01-01",
// },
// ],
// []
// )

// const columns: Column<typeof data[0]>[] = useMemo(
// () => [
// {
// Header: "Currency",
// accessor: "currency",
// },
// {
// Header: "Amount",
// accessor: "amount",
// },
// {
// Header: "Date",
// accessor: "date",
// },
// ],
// []
// )

// const table = useTable({ columns, data })

// const Header = () => (
// <thead className="bg-gray-200">
// {table.headerGroups.map(headerGroup => (
// <tr {...headerGroup.getHeaderGroupProps()}>
// {headerGroup.headers.map(column => (
// <th
// {...column.getHeaderProps()}
// className="px-4 py-2 text-xs font-medium leading-4 tracking-wider text-left text-gray-500 uppercase bg-gray-50"
// >
// {column.render("Header")}
// </th>
// ))}
// </tr>
// ))}
// </thead>
// )

// const Body = () => (
// <tbody
// {...table.getTableBodyProps()}
// className="bg-white divide-y divide-gray-200"
// >
// {table.rows.map(row => {
// table.prepareRow(row)
// return (
// <tr {...row.getRowProps()} className="even:bg-gray-100">
// {row.cells.map(cell => (
// <td
// {...cell.getCellProps()}
// className="px-2 py-2 whitespace-no-wrap"
// >
// <div className="flex items-center">
// <div className="ml-2">
// <div className="text-sm font-medium leading-5 text-gray-900">
// {cell.render("Cell")}
// </div>
// </div>
// </div>
// </td>
// ))}
// </tr>
// )
// })}
// </tbody>
// )

// return (
// <div className="flex flex-col">
// <div className="-my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
// <div className="inline-block min-w-full py-2 align-middle sm:px-6 lg:px-8">
// <div className="overflow-hidden border-b border-gray-200 shadow sm:rounded-lg">
// <table
// {...table.getTableProps()}
// className="min-w-full divide-y divide-gray-200"
// >
// <Header />
// <Body />
// </table>
// </div>
// </div>
// </div>
// </div>
// )
// }
18 changes: 17 additions & 1 deletion react-app/generated-gql-client/guards.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,30 @@ export var isEventTriggerDefinition = function(obj) {



var OperationSpec_possibleTypes = ['OperationSpec']
var OperationSpec_possibleTypes = ['OperationSpecAllColumns','OperationSpecIndividualColumns']
export var isOperationSpec = function(obj) {
if (!obj || !obj.__typename) throw new Error('__typename is missing in "isOperationSpec"')
return OperationSpec_possibleTypes.includes(obj.__typename)
}



var OperationSpecAllColumns_possibleTypes = ['OperationSpecAllColumns']
export var isOperationSpecAllColumns = function(obj) {
if (!obj || !obj.__typename) throw new Error('__typename is missing in "isOperationSpecAllColumns"')
return OperationSpecAllColumns_possibleTypes.includes(obj.__typename)
}



var OperationSpecIndividualColumns_possibleTypes = ['OperationSpecIndividualColumns']
export var isOperationSpecIndividualColumns = function(obj) {
if (!obj || !obj.__typename) throw new Error('__typename is missing in "isOperationSpecIndividualColumns"')
return OperationSpecIndividualColumns_possibleTypes.includes(obj.__typename)
}



var RetryConf_possibleTypes = ['RetryConf']
export var isRetryConf = function(obj) {
if (!obj || !obj.__typename) throw new Error('__typename is missing in "isRetryConf"')
Expand Down
11 changes: 9 additions & 2 deletions react-app/generated-gql-client/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,16 @@ type EventTriggerDefinition {
update: OperationSpec
}

type OperationSpec {
union OperationSpec = OperationSpecAllColumns | OperationSpecIndividualColumns

type OperationSpecAllColumns {
columns: String!
payload: [String!]
}

type OperationSpecIndividualColumns {
columns: [String!]!
payload: [String]
payload: [String!]
}

type RetryConf {
Expand Down
73 changes: 58 additions & 15 deletions react-app/generated-gql-client/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,18 @@ export interface EventTriggerDefinition {
__typename?: 'EventTriggerDefinition'
}

export interface OperationSpec {
export type OperationSpec = (OperationSpecAllColumns | OperationSpecIndividualColumns) & { __isUnion?: true }

export interface OperationSpecAllColumns {
columns: Scalars['String']
payload?: Scalars['String'][]
__typename?: 'OperationSpecAllColumns'
}

export interface OperationSpecIndividualColumns {
columns: Scalars['String'][]
payload?: (Scalars['String'] | undefined)[]
__typename?: 'OperationSpec'
payload?: Scalars['String'][]
__typename?: 'OperationSpecIndividualColumns'
}

export interface RetryConf {
Expand Down Expand Up @@ -719,7 +727,16 @@ export interface EventTriggerDefinitionRequest{
__scalar?: boolean | number
}

export interface OperationSpecRequest{
export interface OperationSpecRequest{on_OperationSpecAllColumns?:OperationSpecAllColumnsRequest,on_OperationSpecIndividualColumns?:OperationSpecIndividualColumnsRequest,__typename?:boolean | number}

export interface OperationSpecAllColumnsRequest{
columns?: boolean | number
payload?: boolean | number
__typename?: boolean | number
__scalar?: boolean | number
}

export interface OperationSpecIndividualColumnsRequest{
columns?: boolean | number
payload?: boolean | number
__typename?: boolean | number
Expand Down Expand Up @@ -1236,14 +1253,30 @@ export const isEventTriggerDefinition = (obj?: { __typename?: any } | null): obj



const OperationSpec_possibleTypes = ['OperationSpec']
const OperationSpec_possibleTypes = ['OperationSpecAllColumns','OperationSpecIndividualColumns']
export const isOperationSpec = (obj?: { __typename?: any } | null): obj is OperationSpec => {
if (!obj?.__typename) throw new Error('__typename is missing in "isOperationSpec"')
return OperationSpec_possibleTypes.includes(obj.__typename)
}



const OperationSpecAllColumns_possibleTypes = ['OperationSpecAllColumns']
export const isOperationSpecAllColumns = (obj?: { __typename?: any } | null): obj is OperationSpecAllColumns => {
if (!obj?.__typename) throw new Error('__typename is missing in "isOperationSpecAllColumns"')
return OperationSpecAllColumns_possibleTypes.includes(obj.__typename)
}



const OperationSpecIndividualColumns_possibleTypes = ['OperationSpecIndividualColumns']
export const isOperationSpecIndividualColumns = (obj?: { __typename?: any } | null): obj is OperationSpecIndividualColumns => {
if (!obj?.__typename) throw new Error('__typename is missing in "isOperationSpecIndividualColumns"')
return OperationSpecIndividualColumns_possibleTypes.includes(obj.__typename)
}



const RetryConf_possibleTypes = ['RetryConf']
export const isRetryConf = (obj?: { __typename?: any } | null): obj is RetryConf => {
if (!obj?.__typename) throw new Error('__typename is missing in "isRetryConf"')
Expand Down Expand Up @@ -1903,26 +1936,36 @@ export interface EventTriggerObservableChain{

export interface EventTriggerDefinitionPromiseChain{
enable_manual: ({get: (request?: boolean|number, defaultValue?: Scalars['Boolean']) => Promise<Scalars['Boolean']>}),
insert: (OperationSpecPromiseChain & {get: <R extends OperationSpecRequest>(request: R, defaultValue?: (FieldsSelection<OperationSpec, R> | undefined)) => Promise<(FieldsSelection<OperationSpec, R> | undefined)>}),
delete: (OperationSpecPromiseChain & {get: <R extends OperationSpecRequest>(request: R, defaultValue?: (FieldsSelection<OperationSpec, R> | undefined)) => Promise<(FieldsSelection<OperationSpec, R> | undefined)>}),
update: (OperationSpecPromiseChain & {get: <R extends OperationSpecRequest>(request: R, defaultValue?: (FieldsSelection<OperationSpec, R> | undefined)) => Promise<(FieldsSelection<OperationSpec, R> | undefined)>})
insert: ({get: <R extends OperationSpecRequest>(request: R, defaultValue?: (FieldsSelection<OperationSpec, R> | undefined)) => Promise<(FieldsSelection<OperationSpec, R> | undefined)>}),
delete: ({get: <R extends OperationSpecRequest>(request: R, defaultValue?: (FieldsSelection<OperationSpec, R> | undefined)) => Promise<(FieldsSelection<OperationSpec, R> | undefined)>}),
update: ({get: <R extends OperationSpecRequest>(request: R, defaultValue?: (FieldsSelection<OperationSpec, R> | undefined)) => Promise<(FieldsSelection<OperationSpec, R> | undefined)>})
}

export interface EventTriggerDefinitionObservableChain{
enable_manual: ({get: (request?: boolean|number, defaultValue?: Scalars['Boolean']) => Observable<Scalars['Boolean']>}),
insert: (OperationSpecObservableChain & {get: <R extends OperationSpecRequest>(request: R, defaultValue?: (FieldsSelection<OperationSpec, R> | undefined)) => Observable<(FieldsSelection<OperationSpec, R> | undefined)>}),
delete: (OperationSpecObservableChain & {get: <R extends OperationSpecRequest>(request: R, defaultValue?: (FieldsSelection<OperationSpec, R> | undefined)) => Observable<(FieldsSelection<OperationSpec, R> | undefined)>}),
update: (OperationSpecObservableChain & {get: <R extends OperationSpecRequest>(request: R, defaultValue?: (FieldsSelection<OperationSpec, R> | undefined)) => Observable<(FieldsSelection<OperationSpec, R> | undefined)>})
insert: ({get: <R extends OperationSpecRequest>(request: R, defaultValue?: (FieldsSelection<OperationSpec, R> | undefined)) => Observable<(FieldsSelection<OperationSpec, R> | undefined)>}),
delete: ({get: <R extends OperationSpecRequest>(request: R, defaultValue?: (FieldsSelection<OperationSpec, R> | undefined)) => Observable<(FieldsSelection<OperationSpec, R> | undefined)>}),
update: ({get: <R extends OperationSpecRequest>(request: R, defaultValue?: (FieldsSelection<OperationSpec, R> | undefined)) => Observable<(FieldsSelection<OperationSpec, R> | undefined)>})
}

export interface OperationSpecAllColumnsPromiseChain{
columns: ({get: (request?: boolean|number, defaultValue?: Scalars['String']) => Promise<Scalars['String']>}),
payload: ({get: (request?: boolean|number, defaultValue?: (Scalars['String'][] | undefined)) => Promise<(Scalars['String'][] | undefined)>})
}

export interface OperationSpecAllColumnsObservableChain{
columns: ({get: (request?: boolean|number, defaultValue?: Scalars['String']) => Observable<Scalars['String']>}),
payload: ({get: (request?: boolean|number, defaultValue?: (Scalars['String'][] | undefined)) => Observable<(Scalars['String'][] | undefined)>})
}

export interface OperationSpecPromiseChain{
export interface OperationSpecIndividualColumnsPromiseChain{
columns: ({get: (request?: boolean|number, defaultValue?: Scalars['String'][]) => Promise<Scalars['String'][]>}),
payload: ({get: (request?: boolean|number, defaultValue?: ((Scalars['String'] | undefined)[] | undefined)) => Promise<((Scalars['String'] | undefined)[] | undefined)>})
payload: ({get: (request?: boolean|number, defaultValue?: (Scalars['String'][] | undefined)) => Promise<(Scalars['String'][] | undefined)>})
}

export interface OperationSpecObservableChain{
export interface OperationSpecIndividualColumnsObservableChain{
columns: ({get: (request?: boolean|number, defaultValue?: Scalars['String'][]) => Observable<Scalars['String'][]>}),
payload: ({get: (request?: boolean|number, defaultValue?: ((Scalars['String'] | undefined)[] | undefined)) => Observable<((Scalars['String'] | undefined)[] | undefined)>})
payload: ({get: (request?: boolean|number, defaultValue?: (Scalars['String'][] | undefined)) => Observable<(Scalars['String'][] | undefined)>})
}

export interface RetryConfPromiseChain{
Expand Down
Loading

0 comments on commit 9716bab

Please sign in to comment.