From a11c44e44411c25f0b43ff82d940edb6b59a3233 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 19 Oct 2020 13:03:57 -0700 Subject: [PATCH] Added job searching, sider keys, formatting on settings --- .../1603135634854_run_sql_migration/down.yaml | 1 + .../1603135634854_run_sql_migration/up.yaml | 16 +++ .../1603135748604_run_sql_migration/down.yaml | 1 + .../1603135748604_run_sql_migration/up.yaml | 5 + .../1603135755518_run_sql_migration/down.yaml | 1 + .../1603135755518_run_sql_migration/up.yaml | 16 +++ .../1603135821609_run_sql_migration/down.yaml | 1 + .../1603135821609_run_sql_migration/up.yaml | 13 +++ .../1603135880002_run_sql_migration/down.yaml | 1 + .../1603135880002_run_sql_migration/up.yaml | 18 ++++ .../1603135999901_run_sql_migration/down.yaml | 1 + .../1603135999901_run_sql_migration/up.yaml | 18 ++++ .../1603136020110_run_sql_migration/down.yaml | 1 + .../1603136020110_run_sql_migration/up.yaml | 18 ++++ hasura/migrations/metadata.yaml | 4 + src/App/App.styles.scss | 11 ++ .../jobs-parts-graph.atom.jsx | 4 +- .../watcher-status/watcher-status.atom.jsx | 4 +- .../jobs-search-fields.molecule.jsx | 38 +++++++ .../shop-settings-form.molecule.jsx | 53 ++++----- .../filepaths-list.organism.jsx | 4 +- .../jobs-list-latest.organism.jsx | 15 +-- .../jobs-list-latest.organism.styles.scss | 9 -- .../jobs-list-search.organism.jsx | 102 ++++++++++++++++++ .../sider-menu/sider-menu.organism.jsx | 9 +- .../watcher-manager.organism.jsx | 2 + src/components/pages/jobs/jobs.page.jsx | 5 +- .../pages/settings/settings.page.jsx | 13 ++- src/graphql/jobs.queries.js | 34 ++++++ 29 files changed, 357 insertions(+), 61 deletions(-) create mode 100644 hasura/migrations/1603135634854_run_sql_migration/down.yaml create mode 100644 hasura/migrations/1603135634854_run_sql_migration/up.yaml create mode 100644 hasura/migrations/1603135748604_run_sql_migration/down.yaml create mode 100644 hasura/migrations/1603135748604_run_sql_migration/up.yaml create mode 100644 hasura/migrations/1603135755518_run_sql_migration/down.yaml create mode 100644 hasura/migrations/1603135755518_run_sql_migration/up.yaml create mode 100644 hasura/migrations/1603135821609_run_sql_migration/down.yaml create mode 100644 hasura/migrations/1603135821609_run_sql_migration/up.yaml create mode 100644 hasura/migrations/1603135880002_run_sql_migration/down.yaml create mode 100644 hasura/migrations/1603135880002_run_sql_migration/up.yaml create mode 100644 hasura/migrations/1603135999901_run_sql_migration/down.yaml create mode 100644 hasura/migrations/1603135999901_run_sql_migration/up.yaml create mode 100644 hasura/migrations/1603136020110_run_sql_migration/down.yaml create mode 100644 hasura/migrations/1603136020110_run_sql_migration/up.yaml create mode 100644 src/components/molecules/jobs-search-fields/jobs-search-fields.molecule.jsx delete mode 100644 src/components/organisms/jobs-list-latest/jobs-list-latest.organism.styles.scss create mode 100644 src/components/organisms/jobs-list-search/jobs-list-search.organism.jsx diff --git a/hasura/migrations/1603135634854_run_sql_migration/down.yaml b/hasura/migrations/1603135634854_run_sql_migration/down.yaml new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/hasura/migrations/1603135634854_run_sql_migration/down.yaml @@ -0,0 +1 @@ +[] diff --git a/hasura/migrations/1603135634854_run_sql_migration/up.yaml b/hasura/migrations/1603135634854_run_sql_migration/up.yaml new file mode 100644 index 0000000..af0ec8e --- /dev/null +++ b/hasura/migrations/1603135634854_run_sql_migration/up.yaml @@ -0,0 +1,16 @@ +- args: + cascade: true + read_only: false + sql: "CREATE OR REPLACE FUNCTION public.search_jobs(search text)\r\n RETURNS SETOF + jobs\r\n LANGUAGE plpgsql\r\n STABLE\r\nAS $function$ BEGIN if search = '' then + return query\r\nselect *\r\nfrom jobs j;\r\nelse return query\r\nSELECT *\r\nFROM + jobs j2\r\nWHERE ownr_fn ILIKE '%' || search || '%'\r\n or ownr_ln ILIKE + '%' || search || '%'\r\n \r\n or clm_no ILIKE '%' || search || '%'\r\n\r\nORDER + BY \r\n clm_no ILIKE '%' || search || '%'\r\n OR null,\r\n ownr_fn + ILIKE '%' || search || '%'\r\n OR NULL,\r\n ownr_ln ILIKE '%' || search + || '%'\r\n OR NULL;\r\nend if;\r\nEND $function$;" + type: run_sql +- args: + name: search_jobs + schema: public + type: track_function diff --git a/hasura/migrations/1603135748604_run_sql_migration/down.yaml b/hasura/migrations/1603135748604_run_sql_migration/down.yaml new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/hasura/migrations/1603135748604_run_sql_migration/down.yaml @@ -0,0 +1 @@ +[] diff --git a/hasura/migrations/1603135748604_run_sql_migration/up.yaml b/hasura/migrations/1603135748604_run_sql_migration/up.yaml new file mode 100644 index 0000000..fad1f40 --- /dev/null +++ b/hasura/migrations/1603135748604_run_sql_migration/up.yaml @@ -0,0 +1,5 @@ +- args: + cascade: true + read_only: false + sql: drop FUNCTION public.search_jobs; + type: run_sql diff --git a/hasura/migrations/1603135755518_run_sql_migration/down.yaml b/hasura/migrations/1603135755518_run_sql_migration/down.yaml new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/hasura/migrations/1603135755518_run_sql_migration/down.yaml @@ -0,0 +1 @@ +[] diff --git a/hasura/migrations/1603135755518_run_sql_migration/up.yaml b/hasura/migrations/1603135755518_run_sql_migration/up.yaml new file mode 100644 index 0000000..982c2bb --- /dev/null +++ b/hasura/migrations/1603135755518_run_sql_migration/up.yaml @@ -0,0 +1,16 @@ +- args: + cascade: true + read_only: false + sql: "CREATE OR REPLACE FUNCTION public.search_jobs(search text, startDate date, + endDate date)\n RETURNS SETOF jobs\n LANGUAGE plpgsql\n STABLE\nAS $function$ + BEGIN if search = '' then return query\nselect *\nfrom jobs j;\nelse return + query\nSELECT *\nFROM jobs j2\nWHERE ownr_fn ILIKE '%' || search || '%'\n or + ownr_ln ILIKE '%' || search || '%'\n \n or clm_no ILIKE '%' || search || + '%'\n\nORDER BY \n clm_no ILIKE '%' || search || '%'\n OR null,\n ownr_fn + ILIKE '%' || search || '%'\n OR NULL,\n ownr_ln ILIKE '%' || search || + '%'\n OR NULL;\nend if;\nEND $function$;" + type: run_sql +- args: + name: search_jobs + schema: public + type: track_function diff --git a/hasura/migrations/1603135821609_run_sql_migration/down.yaml b/hasura/migrations/1603135821609_run_sql_migration/down.yaml new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/hasura/migrations/1603135821609_run_sql_migration/down.yaml @@ -0,0 +1 @@ +[] diff --git a/hasura/migrations/1603135821609_run_sql_migration/up.yaml b/hasura/migrations/1603135821609_run_sql_migration/up.yaml new file mode 100644 index 0000000..c8c41d5 --- /dev/null +++ b/hasura/migrations/1603135821609_run_sql_migration/up.yaml @@ -0,0 +1,13 @@ +- args: + cascade: true + read_only: false + sql: "CREATE OR REPLACE FUNCTION public.search_jobs(search text, startDate date, + endDate date)\n RETURNS SETOF jobs\n LANGUAGE plpgsql\n STABLE\nAS $function$ + BEGIN if search = '' then return query\nselect *\nfrom jobs j;\nelse return + query\nSELECT *\nFROM jobs j2\nWHERE \nclose_date between startDate and endDate + \ and\n(\nownr_fn ILIKE '%' || search || '%'\n or ownr_ln ILIKE '%' || search + || '%'\n \n or clm_no ILIKE '%' || search || '%')\n\nORDER BY \n clm_no + ILIKE '%' || search || '%'\n OR null,\n ownr_fn ILIKE '%' || search || + '%'\n OR NULL,\n ownr_ln ILIKE '%' || search || '%'\n OR NULL;\nend + if;\nEND $function$;" + type: run_sql diff --git a/hasura/migrations/1603135880002_run_sql_migration/down.yaml b/hasura/migrations/1603135880002_run_sql_migration/down.yaml new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/hasura/migrations/1603135880002_run_sql_migration/down.yaml @@ -0,0 +1 @@ +[] diff --git a/hasura/migrations/1603135880002_run_sql_migration/up.yaml b/hasura/migrations/1603135880002_run_sql_migration/up.yaml new file mode 100644 index 0000000..5c88108 --- /dev/null +++ b/hasura/migrations/1603135880002_run_sql_migration/up.yaml @@ -0,0 +1,18 @@ +- args: + cascade: true + read_only: false + sql: "CREATE OR REPLACE FUNCTION public.search_jobs(search text, startDate date, + endDate date)\n RETURNS SETOF jobs\n LANGUAGE plpgsql\n STABLE\nAS $function$ + BEGIN if search = '' then return query\nselect *\nfrom jobs j;\nelse\n\nif startDate + is null || endDate is null then \nreturn query\nSELECT *\nFROM jobs j2\nWHERE + \n\nownr_fn ILIKE '%' || search || '%'\n or ownr_ln ILIKE '%' || search || + '%'\n \n or clm_no ILIKE '%' || search || '%'\nORDER BY \n clm_no ILIKE + '%' || search || '%'\n OR null,\n ownr_fn ILIKE '%' || search || '%'\n + \ OR NULL,\n ownr_ln ILIKE '%' || search || '%'\n OR NULL;\nelse \nreturn + query\nSELECT *\nFROM jobs j2\nWHERE \nclose_date between startDate and endDate + \ and\n(\nownr_fn ILIKE '%' || search || '%'\n or ownr_ln ILIKE '%' || search + || '%'\n \n or clm_no ILIKE '%' || search || '%')\n\nORDER BY \n clm_no + ILIKE '%' || search || '%'\n OR null,\n ownr_fn ILIKE '%' || search || + '%'\n OR NULL,\n ownr_ln ILIKE '%' || search || '%'\n OR NULL;\n\nend + if;\n\n\nend if;\nEND $function$;" + type: run_sql diff --git a/hasura/migrations/1603135999901_run_sql_migration/down.yaml b/hasura/migrations/1603135999901_run_sql_migration/down.yaml new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/hasura/migrations/1603135999901_run_sql_migration/down.yaml @@ -0,0 +1 @@ +[] diff --git a/hasura/migrations/1603135999901_run_sql_migration/up.yaml b/hasura/migrations/1603135999901_run_sql_migration/up.yaml new file mode 100644 index 0000000..a00240f --- /dev/null +++ b/hasura/migrations/1603135999901_run_sql_migration/up.yaml @@ -0,0 +1,18 @@ +- args: + cascade: true + read_only: false + sql: "CREATE OR REPLACE FUNCTION public.search_jobs(search text, startdate date, + enddate date)\n RETURNS SETOF jobs\n LANGUAGE plpgsql\n STABLE\nAS $function$ + BEGIN if search = '' then return query\nselect *\nfrom jobs j;\nelse\n\nif (startDate + is null) || (endDate is null) then \nreturn query\nSELECT *\nFROM jobs j2\nWHERE + \n\nownr_fn ILIKE '%' || search || '%'\n or ownr_ln ILIKE '%' || search || + '%'\n \n or clm_no ILIKE '%' || search || '%'\nORDER BY \n clm_no ILIKE + '%' || search || '%'\n OR null,\n ownr_fn ILIKE '%' || search || '%'\n + \ OR NULL,\n ownr_ln ILIKE '%' || search || '%'\n OR NULL;\nelse \nreturn + query\nSELECT *\nFROM jobs j2\nWHERE \nclose_date between startDate and endDate + \ and\n(\nownr_fn ILIKE '%' || search || '%'\n or ownr_ln ILIKE '%' || search + || '%'\n \n or clm_no ILIKE '%' || search || '%')\n\nORDER BY \n clm_no + ILIKE '%' || search || '%'\n OR null,\n ownr_fn ILIKE '%' || search || + '%'\n OR NULL,\n ownr_ln ILIKE '%' || search || '%'\n OR NULL;\n\nend + if;\n\n\nend if;\nEND $function$;" + type: run_sql diff --git a/hasura/migrations/1603136020110_run_sql_migration/down.yaml b/hasura/migrations/1603136020110_run_sql_migration/down.yaml new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/hasura/migrations/1603136020110_run_sql_migration/down.yaml @@ -0,0 +1 @@ +[] diff --git a/hasura/migrations/1603136020110_run_sql_migration/up.yaml b/hasura/migrations/1603136020110_run_sql_migration/up.yaml new file mode 100644 index 0000000..9fd5cec --- /dev/null +++ b/hasura/migrations/1603136020110_run_sql_migration/up.yaml @@ -0,0 +1,18 @@ +- args: + cascade: true + read_only: false + sql: "CREATE OR REPLACE FUNCTION public.search_jobs(search text, startdate date, + enddate date)\n RETURNS SETOF jobs\n LANGUAGE plpgsql\n STABLE\nAS $function$ + BEGIN if search = '' then return query\nselect *\nfrom jobs j;\nelse\n\nif (startDate + is null) or (endDate is null) then \nreturn query\nSELECT *\nFROM jobs j2\nWHERE + \n\nownr_fn ILIKE '%' || search || '%'\n or ownr_ln ILIKE '%' || search || + '%'\n \n or clm_no ILIKE '%' || search || '%'\nORDER BY \n clm_no ILIKE + '%' || search || '%'\n OR null,\n ownr_fn ILIKE '%' || search || '%'\n + \ OR NULL,\n ownr_ln ILIKE '%' || search || '%'\n OR NULL;\nelse \nreturn + query\nSELECT *\nFROM jobs j2\nWHERE \nclose_date between startDate and endDate + \ and\n(\nownr_fn ILIKE '%' || search || '%'\n or ownr_ln ILIKE '%' || search + || '%'\n \n or clm_no ILIKE '%' || search || '%')\n\nORDER BY \n clm_no + ILIKE '%' || search || '%'\n OR null,\n ownr_fn ILIKE '%' || search || + '%'\n OR NULL,\n ownr_ln ILIKE '%' || search || '%'\n OR NULL;\n\nend + if;\n\n\nend if;\nEND $function$;" + type: run_sql diff --git a/hasura/migrations/metadata.yaml b/hasura/migrations/metadata.yaml index 3bf57a9..2942282 100644 --- a/hasura/migrations/metadata.yaml +++ b/hasura/migrations/metadata.yaml @@ -329,3 +329,7 @@ tables: - type - group filter: {} +functions: +- function: + schema: public + name: search_jobs diff --git a/src/App/App.styles.scss b/src/App/App.styles.scss index 54576c3..7a09eba 100644 --- a/src/App/App.styles.scss +++ b/src/App/App.styles.scss @@ -50,6 +50,17 @@ body { -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3); background-color: #188fff; } +.jobs-list-container { + height: 100%; +} + +.jobs-list-infinite-container { + overflow-y: auto; + overflow-x: hidden; + height: 100%; +} + + //Required for the tab with infinite loading .ant-tabs-content { diff --git a/src/components/atoms/jobs-parts-graph/jobs-parts-graph.atom.jsx b/src/components/atoms/jobs-parts-graph/jobs-parts-graph.atom.jsx index 869f211..358d889 100644 --- a/src/components/atoms/jobs-parts-graph/jobs-parts-graph.atom.jsx +++ b/src/components/atoms/jobs-parts-graph/jobs-parts-graph.atom.jsx @@ -1,8 +1,8 @@ import { Skeleton, Typography } from "antd"; +import Dinero from "dinero.js"; import React, { useMemo } from "react"; import { Cell, Pie, PieChart, ResponsiveContainer } from "recharts"; import ErrorResultAtom from "../error-result/error-result.atom"; -import Dinero from "dinero.js"; import partTypeConverterAtom from "../part-type-converter/part-type-converter.atom"; export default function JobPartsGraphAtom({ job, @@ -36,7 +36,7 @@ export default function JobPartsGraphAtom({ if (loading) return ; if (!job) return ; - console.log("data", data); + return (
- {watcherStatus} +
+ {watcherStatus} {watcherError && }
); diff --git a/src/components/molecules/jobs-search-fields/jobs-search-fields.molecule.jsx b/src/components/molecules/jobs-search-fields/jobs-search-fields.molecule.jsx new file mode 100644 index 0000000..45765d0 --- /dev/null +++ b/src/components/molecules/jobs-search-fields/jobs-search-fields.molecule.jsx @@ -0,0 +1,38 @@ +import { SearchOutlined } from "@ant-design/icons"; +import { Button, DatePicker, Form, Input } from "antd"; +import React from "react"; +export default function JobsSearchFieldsMolecule({ callSearchQuery }) { + const [form] = Form.useForm(); + + const handleFinish = (values) => { + callSearchQuery({ + variables: { + search: values.search, + startDate: (values.dateRange && values.dateRange[0]) || null, + endDate: (values.dateRange && values.dateRange[1]) || null, + }, + }); + }; + + return ( +
+
+ + + + + + + +
+
+ ); +} diff --git a/src/components/molecules/shop-settings-form/shop-settings-form.molecule.jsx b/src/components/molecules/shop-settings-form/shop-settings-form.molecule.jsx index d900058..c06355e 100644 --- a/src/components/molecules/shop-settings-form/shop-settings-form.molecule.jsx +++ b/src/components/molecules/shop-settings-form/shop-settings-form.molecule.jsx @@ -1,4 +1,4 @@ -import { Button, Input, Form, Select, InputNumber } from "antd"; +import { Button, Input, Form, Select, InputNumber, Typography } from "antd"; import FormListMoveArrows from "../../atoms/form-list-move-arrows/form-list-move-arrows.atom"; import React from "react"; import LayoutFormRow from "../../atoms/layout-form-row/layout-form-row.atom"; @@ -7,6 +7,7 @@ import { DeleteFilled } from "@ant-design/icons"; export default function ShopSettingsFormMolecule({ form, saveLoading }) { return (
+ Shop Settings - - - - - + + +