Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cli crud #524

Open
wants to merge 466 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
466 commits
Select commit Hold shift + click to select a range
38208d4
Refactor module.js, devide into modules and change path
Werter12 Jun 22, 2018
2e61a6c
Change module.js
Werter12 Jun 22, 2018
5f7a0ee
Change validation for select inputs, add domainSchema error computing…
Werter12 Jun 25, 2018
2a069f7
Change computeDomainValidationErrors function
Werter12 Jun 29, 2018
5924be4
Fix table unknown onRow props warning
Werter12 Jun 29, 2018
875b923
Fix CellSelectInput for bootstrap
Werter12 Jun 29, 2018
3d281f1
Update domain validation version
Werter12 Jun 29, 2018
305cc62
Add Switch, InputNumber field for native form
Werter12 Jun 29, 2018
c52933d
Move commonGraphql file generation place
Werter12 Jul 2, 2018
1f503df
Refactor generating graphql fragment
tv-dm Jul 2, 2018
21fbf15
Rename commonGraphql file and fix all imports according to the new fi…
tv-dm Jul 3, 2018
c203353
Return back default values
tv-dm Jul 3, 2018
4c0de4d
Add and change native components for Form fields
Werter12 Jul 3, 2018
5061b4d
Change native componets style flow and add polyfill for setPrototypeO…
Werter12 Jul 3, 2018
213b9eb
Fix import in native RenderSelectQuery
Werter12 Jul 3, 2018
4c42244
Add Android Datepicker for date type field
Werter12 Jul 3, 2018
0c2e3a0
Add default option for native Select component
Werter12 Jul 3, 2018
9b5ee34
Refactor functions createGeneratedContainersFile, deleteModuleFromGen…
tv-dm Jul 4, 2018
3705548
Add DatePicker for IOS and Android, change styles for native select i…
Werter12 Jul 4, 2018
8ef4f34
Add bottom border for switch field
Werter12 Jul 4, 2018
3a75922
Update generatedSchemas.js after creating new module
tv-dm Jul 4, 2018
3d01b4f
Add ability to delete strings with non default exports
tv-dm Jul 4, 2018
24aa83a
Replace dynamic import schema
tv-dm Jul 4, 2018
0672d79
Delete unused code
tv-dm Jul 4, 2018
78ffc60
Order dependencies
tv-dm Jul 4, 2018
f09addd
Merge remote-tracking branch 'origin/cli-crud' into cli-crud
tv-dm Jul 4, 2018
fbac9a3
Fix domainValidator on client
Werter12 Jul 4, 2018
240cfda
Place constructor after propTypes in Datepickers
Werter12 Jul 4, 2018
689d137
Add generetedSchemas file
tv-dm Jul 4, 2018
d5d432e
Merge remote-tracking branch 'origin/cli-crud' into cli-crud
tv-dm Jul 4, 2018
25f2dd8
fix pagination - wip
mitjade Jul 5, 2018
306c595
Add validate function for mobile formik component
Werter12 Jul 5, 2018
28a5228
Add validation of domain-schema for mobile and add error displaying f…
Werter12 Jul 5, 2018
36ea790
Comment validate in native formik to wait for domain-schema/validatio…
Werter12 Jul 5, 2018
1d611f0
Revert "fix pagination - wip"
mitjade Jul 6, 2018
192d001
Updated version apollo-client for common, deleted polyfill
Werter12 Jul 6, 2018
98e2e13
Update domain-schema/validation version
Werter12 Jul 6, 2018
eda8cb2
Add errors displaying for bootstrap fields, fix bootsrap datepicker
Werter12 Jul 6, 2018
b379e61
Refactor functions createGeneratedContainersFile, deleteModuleFromGen…
tv-dm Jul 3, 2018
631c522
Fix logic in the regenerateGraphqlFragment function
tv-dm Jul 6, 2018
73e2a5c
Add subscription on adding item to the crud cli templates
tv-dm Jul 12, 2018
fdf593f
Refactor RenderDate component bootstrap
Werter12 Jul 12, 2018
caf91af
Add logic for rollback migration to the deleteModule
tv-dm Jul 16, 2018
6109cce
Add knex-migrate dependency
tv-dm Jul 16, 2018
14f3827
Fix regular expression in the deleteFromFileWithExports function
tv-dm Jul 16, 2018
5e6ab3e
Refactor bootstrap and antd components according to code review
Werter12 Jul 15, 2018
96e3625
Change bootstrap renderSelect components
Werter12 Jul 16, 2018
f8e1d15
Tiny changes for bootstrap renderSelect components
Werter12 Jul 17, 2018
1114dec
Fix renderSelect default option
Werter12 Jul 19, 2018
0cd6228
Refactor antd-ui RenderNumber
Werter12 Jul 20, 2018
d825297
Refactor RenderDate, RenderSwitch, RenderField antd-ui componets, rem…
Werter12 Jul 20, 2018
f9b2cfd
Refactor antd and bootsrap components. Remove redundant handleBlur fu…
Werter12 Jul 23, 2018
dfb12db
Replace formik on domain-schema/formik in FormView. Fix render numbe…
Werter12 Jul 23, 2018
fe52b2f
Add generate Formik function
Werter12 Jul 23, 2018
6c0b4d5
Fix pagiantion: wrong __typename being generated
mitjade Jul 23, 2018
ca84bde
Add cli-crud core functionality
Werter12 Jul 23, 2018
fe7cd96
Add generated containers file
Werter12 Jul 23, 2018
b9a5fad
Add domain-schema dependencies
Werter12 Jul 23, 2018
a7a7630
Fix pagiantion: wrong __typename being generated
mitjade Jul 23, 2018
a380e0c
Create commandInvoker, split addCrud and addModule
Werter12 Jul 24, 2018
5921d22
Add runCommand to CommandInvoker and change require in addCrud
Werter12 Jul 25, 2018
dc7f9ed
Update addModule index.js file changing, get rid of client module cre…
Werter12 Jul 25, 2018
88c7731
Refactor addModule. Reduce read and write file operations
Werter12 Jul 25, 2018
dc427ae
Fix tablePrefix generating. Divide renameFiles function
Werter12 Jul 25, 2018
c5ee744
Init delete module command
Werter12 Jul 25, 2018
a591425
Refactor deleteModule. Reduce read and write file operations and add …
Werter12 Jul 26, 2018
4798deb
Add domain-schema/knex dependency
Werter12 Jul 26, 2018
577e2b6
Add reading index file no matter what extension it has
Werter12 Jul 26, 2018
c9d5087
Add absent types to graphql template
Werter12 Jul 27, 2018
2a6d4ad
Fix babel class compilation issue, after running migrate command
Werter12 Jul 27, 2018
ec74a4b
Add -m option for deletemodule command to delete migration and seeds
Werter12 Jul 27, 2018
efe807b
Add sub command deleteMigrations. Add config for repeated paths
Werter12 Jul 27, 2018
6f37efd
Add sub command add migration. Replace hardcoded paths on paths from …
Werter12 Jul 27, 2018
91cb235
Replace paths in deleteMigrations function. Delete console.logs. Rena…
Werter12 Jul 27, 2018
9185223
Delete unnecessary files. Make small changes to addCrud and deleteMod…
Werter12 Jul 27, 2018
02067b9
Fix base path
Werter12 Jul 30, 2018
2f501e6
Add new dependencies
Werter12 Jul 31, 2018
6364aa7
Add crud and helpers from cli-crud
Werter12 Jul 31, 2018
9d9af2b
Refactor selectBy and getSelectFields functions
Werter12 Jul 31, 2018
f77ccb8
Refactor getList ordering and filtering, getPaginated, getTotal funct…
Werter12 Jul 31, 2018
7533456
Merge branch 'master' into add-delete-crud-cli-server-database
lyzhovnik Sep 10, 2018
ee04e55
Resolve version conflicts in yarn.lock for shelljs lib
lyzhovnik Sep 10, 2018
2d404c6
Update cli templates to the latest structure
lyzhovnik Sep 10, 2018
4d366e0
Merge branch 'master' into cli-crud
mitjade Sep 13, 2018
ab545f2
cli: fix addmodule, deletemodule
mitjade Sep 13, 2018
97bef03
merge crud commands into new cli
mitjade Sep 18, 2018
5ad9841
Merge branch 'master' into cli-crud
mitjade Sep 18, 2018
fc328e2
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Sep 18, 2018
a0bd29b
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Sep 18, 2018
a842a10
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Sep 19, 2018
7ed626b
schema - noIdSuffix: allow no ‘id’ suffix in related fields
mitjade Sep 19, 2018
89a1a6b
crud: fix get total if filter applied
mitjade Sep 19, 2018
53c297a
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Sep 19, 2018
ccd5891
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Sep 19, 2018
fe2c353
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Sep 19, 2018
05e58d6
navigation: Rename from GPlayground to GraphiQL
mitjade Sep 19, 2018
a282129
fix elsint error
mitjade Sep 19, 2018
cba8aff
fix crud generation
mitjade Sep 19, 2018
ad69238
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Sep 19, 2018
a6496d8
remame files to .ts if possible
mitjade Sep 19, 2018
1e598ad
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Sep 20, 2018
cd8e2f4
runPrettier on generated containers and schemas
mitjade Sep 20, 2018
87562e8
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Sep 20, 2018
9d38764
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Sep 20, 2018
64689cc
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Sep 25, 2018
a2e7332
fix crud refactoring regressions + small fixes
mitjade Sep 25, 2018
24669f9
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Sep 25, 2018
40a1bd0
fix crud refactoring regressions + small fixes
mitjade Sep 25, 2018
004daa2
add render select filter boolean
mitjade Sep 26, 2018
e1dc2e5
fix filter by boolean
mitjade Sep 26, 2018
c02551c
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Sep 26, 2018
9f8369f
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Sep 26, 2018
ad8ebdf
fix merge problems
mitjade Sep 26, 2018
9301efd
create bootstrap render select filter boolean
mitjade Sep 26, 2018
cbb6e76
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Sep 27, 2018
7962cc0
convert resolvers to ts
mitjade Sep 27, 2018
2acfb3d
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Sep 27, 2018
05b8d4e
move client crud helper functions
mitjade Sep 28, 2018
9c80ec1
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Sep 28, 2018
f74fd09
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Sep 28, 2018
3a1c57d
remove eslint disable
mitjade Sep 28, 2018
d7a86e5
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Sep 28, 2018
8b53f15
fix merge conflict
mitjade Sep 28, 2018
34201de
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Sep 28, 2018
a4af374
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Sep 28, 2018
ff26663
fix boolean filter
mitjade Sep 28, 2018
e84d384
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Oct 3, 2018
c70a583
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Oct 3, 2018
56c7645
merge with master
mitjade Oct 9, 2018
cef3301
fix sortable funcionality
mitjade Oct 9, 2018
946d272
merge with master
mitjade Oct 9, 2018
13e9137
fix edit form
mitjade Oct 9, 2018
c6797f6
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Oct 10, 2018
0e65010
update packages, fix cli crud templates
mitjade Oct 10, 2018
92108e9
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Oct 11, 2018
fcb7f8a
resolve merge conflicts
mitjade Oct 11, 2018
115b39e
fix merge conflicts
mitjade Oct 12, 2018
bb54498
fix merge conflicts
mitjade Oct 12, 2018
8303f9a
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Oct 12, 2018
fb01110
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Oct 12, 2018
583941a
small fixes
mitjade Oct 15, 2018
24fcd59
remove console logs
mitjade Oct 16, 2018
0bc902f
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Oct 18, 2018
ee72a24
crud: add in and contains to filters, small fixes, add editor scope, …
mitjade Oct 18, 2018
4507775
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Oct 18, 2018
1d3bd4a
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Oct 18, 2018
3904bcd
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Oct 18, 2018
4a4423d
changes scope order
mitjade Oct 18, 2018
375dbd6
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Oct 18, 2018
0d5084c
filter by string: contains
mitjade Oct 18, 2018
9ce8ebe
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Oct 18, 2018
67d2553
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Oct 18, 2018
a5f21fe
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Oct 23, 2018
b6c2b3b
sql crud: fix where in
mitjade Oct 23, 2018
7add526
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Oct 23, 2018
a24a631
update validation, small fixes
mitjade Oct 23, 2018
2dc8f76
sql crud: fix where in
mitjade Oct 23, 2018
5b25ca7
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Oct 23, 2018
a7d05a0
antd: fix render select query
mitjade Oct 23, 2018
adba505
fix removeEmpty missing schema var
mitjade Oct 23, 2018
ece2f78
merge with master
mitjade Oct 24, 2018
211ab1b
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Oct 24, 2018
de3beda
small fix
mitjade Oct 26, 2018
ea1e3dd
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Oct 26, 2018
8e43942
add updateMany funconality for one to one relations, add updateschema…
mitjade Oct 26, 2018
18e4ed6
merge with master
mitjade Oct 29, 2018
b0295d4
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Oct 29, 2018
b0b4eb0
list view: show one-to-one fields in batch update
mitjade Oct 29, 2018
4d42370
small fix
mitjade Oct 29, 2018
17c2ad5
small fix
mitjade Oct 29, 2018
e12e4f7
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Nov 9, 2018
77ac977
update yarn lock
mitjade Nov 9, 2018
b345307
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Nov 9, 2018
8f43b64
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Nov 9, 2018
eef7b28
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Nov 9, 2018
d722914
merge with master
mitjade Nov 9, 2018
cb66c59
add rowClassName to crud ListVew
mitjade Nov 9, 2018
794f299
fix update schema
mitjade Nov 15, 2018
5ea4e8c
crud: update to latest
mitjade Nov 16, 2018
29980fa
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Nov 16, 2018
cd1b504
crud: update to latest
mitjade Nov 16, 2018
a5bec93
load next 25, 50, 100, all, change limit
mitjade Nov 19, 2018
976facb
small fix
mitjade Nov 19, 2018
2fb9277
update to latest cli-crud
mitjade Nov 22, 2018
ff00752
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Nov 22, 2018
25a5a58
Add package name to `package.json`
mitjade Nov 23, 2018
b09c06a
fix comments
mitjade Nov 23, 2018
5535f8e
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Nov 23, 2018
e534dc4
Merge branch 'add-package-name' into add-delete-crud-cli-server-database
mitjade Nov 23, 2018
d8fd47e
update addcrud
mitjade Nov 23, 2018
64b83f9
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Dec 12, 2018
8f3f224
small fixes
mitjade Dec 12, 2018
7074f5a
Merge branch 'master' into cli-crud
mitjade Jan 30, 2019
d0e02af
reorder package file
mitjade Jan 30, 2019
7d2f6de
addCrud wip
mitjade Jan 30, 2019
fc3d05e
remove log and replace with console.log for now, to fix __DEV__ not b…
mitjade Jan 31, 2019
29a2553
fix cli addCrud, and updateSchema
mitjade Jan 31, 2019
f50a569
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Jan 31, 2019
db7d5f5
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Jan 31, 2019
49d5466
merge with master
mitjade Feb 1, 2019
7453699
small cleanup
mitjade Feb 1, 2019
c1e9937
marged with add-delete-crud-cli-server-database
mitjade Feb 1, 2019
8f1f157
small fixes
mitjade Feb 1, 2019
7d64bb0
cli: small fixes
mitjade Feb 1, 2019
9a3518e
update client template paths for crud
mitjade Feb 1, 2019
886b40c
move crud libs to modules, wip
mitjade Feb 4, 2019
da8f0f6
crud common components move to new structure, wip
mitjade Feb 5, 2019
c6c53d8
move generatedSchemas
mitjade Feb 5, 2019
fc51509
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Feb 5, 2019
5b4c4de
fix link problems
mitjade Feb 5, 2019
422d8a9
fix links
mitjade Feb 5, 2019
d6804a0
fix links
mitjade Feb 5, 2019
7d6e171
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Feb 5, 2019
0855ca4
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Feb 5, 2019
9de07fd
merge crud funcionality
mitjade Feb 5, 2019
e4bd9de
merge latest
mitjade Feb 7, 2019
9b83085
crud templates: update
mitjade Feb 7, 2019
1741373
small fixes
mitjade Feb 15, 2019
dc97260
merge with master
mitjade Feb 18, 2019
d1cb199
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Feb 18, 2019
133475c
merge latest changes
mitjade Mar 11, 2019
5e5003f
merge latest
mitjade Mar 11, 2019
186ef30
remove unused function
mitjade Mar 11, 2019
b7825c4
merge with master
mitjade Mar 11, 2019
78ba078
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Jul 15, 2019
45031d2
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Jul 15, 2019
544668c
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Jul 16, 2019
8a69ab8
remove uneeded dep
mitjade Jul 16, 2019
387e3ad
update to latest
mitjade Jul 16, 2019
9a1e44c
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Jul 16, 2019
ebcafd7
yarn.lock
mitjade Jul 19, 2019
d4b6479
fix styles less
mitjade Jul 19, 2019
d8a8680
latest changes
mitjade Jul 19, 2019
4e2d9a7
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Aug 23, 2019
4faa198
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Aug 23, 2019
f4a6cb6
commit yarn lock
mitjade Aug 23, 2019
d246678
merge with master
mitjade Aug 26, 2019
b6a089e
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Aug 26, 2019
29ca5c1
compose from `@gplapp/core-common`
mitjade Aug 26, 2019
53372d0
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Aug 28, 2019
b2846d4
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Aug 28, 2019
2aa8506
merge master
mitjade Dec 17, 2019
e1fdf64
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Dec 24, 2019
34bf7f9
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Dec 24, 2019
046add7
update crud engine
mitjade Dec 24, 2019
7dc71e3
Merge branch 'master' into add-delete-crud-cli-server-database
mitjade Jan 14, 2020
771151f
Merge branch 'add-delete-crud-cli-server-database' into cli-crud
mitjade Jan 14, 2020
3dd3f8c
fix error on ssr loading true
mitjade Jan 23, 2020
9a507dd
fix styles error
mitjade Feb 25, 2020
093a4cd
merge with project
mitjade Feb 26, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/tools/templates/crud/client/graphql/*
**/tools/templates/crud/server/*.graphql
15 changes: 12 additions & 3 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,17 @@
"author": "SysGears INC",
"license": "MIT",
"dependencies": {
"@fortawesome/fontawesome": "^1.1.3",
"@domain-schema/core": "^0.0.34",
"@domain-schema/validation": "^0.0.36",
"@domain-schema/formik": "^0.0.34",
"@fortawesome/fontawesome": "^1.1.8",
"@fortawesome/fontawesome-free-brands": "^5.0.6",
"@fortawesome/fontawesome-free-webfonts": "^1.0.9",
"@fortawesome/react-fontawesome": "0.0.18",
"antd": "^3.3.3",
"apollo-cache-inmemory": "^1.1.12",
"apollo-cache-router": "^1.1.6",
"apollo-client": "^2.3.1",
"apollo-client": "^2.3.4",
"apollo-link": "^1.0.6",
"apollo-link-batch-http": "1.2.2",
"apollo-link-context": "^1.0.7",
Expand All @@ -60,21 +64,26 @@
"filesize": "^3.5.11",
"formik": "^1.0.2",
"graphql": "^0.13.0",
"graphql-iso-date": "^3.3.0",
"graphql-iso-date": "^3.5.0",
"graphql-tag": "^2.6.0",
"history": "^4.7.2",
"humps": "^2.0.1",
"i18next": "^11.2.3",
"i18next-browser-languagedetector": "^2.1.0",
"immutability-helper": "^2.6.2",
"jwt-decode": "^2.2.0",
"lodash": "^4.17.4",
"minilog": "^3.1.0",
"moment": "^2.20.1",
"prop-types": "^15.6.0",
"react": "16.3.1",
"react-apollo": "^2.1.4",
"react-art": "^16.3.2",
"react-cookie": "^2.2.0",
"react-datepicker": "^1.5.0",
"react-debounce-input": "^3.1.0",
"react-dnd": "^2.5.4",
"react-dnd-html5-backend": "^2.5.4",
"react-dom": "^16.2.0",
"react-dropzone": "^4.2.3",
"react-ga": "^2.3.5",
Expand Down
42 changes: 42 additions & 0 deletions packages/client/src/modules/common/components/crud/EditView.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import React from 'react';
import PropTypes from 'prop-types';
import { StyleSheet, Text, View } from 'react-native';

import FormView from './FormView';

const EditView = ({ loading, data, navigation, schema, updateEntry, createEntry }) => {
let dataObj = data;

if (!dataObj && navigation.state) {
dataObj = navigation.state.params.data;
}

if (loading && !dataObj) {
return (
<View style={styles.container}>
<Text>Loading...</Text>
</View>
);
} else {
return (
<FormView data={dataObj ? dataObj : {}} schema={schema} updateEntry={updateEntry} createEntry={createEntry} />
);
}
};

EditView.propTypes = {
loading: PropTypes.bool.isRequired,
data: PropTypes.object,
navigation: PropTypes.object.isRequired
};

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center'
}
});

export default EditView;
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import React from 'react';
import PropTypes from 'prop-types';
import Helmet from 'react-helmet';
import { Link } from 'react-router-dom';

import { PageLayout } from '../web';
import FormView from './FormView';
import settings from '../../../../../../../settings';

class EditView extends React.PureComponent {
static propTypes = {
loading: PropTypes.bool.isRequired,
data: PropTypes.object,
title: PropTypes.string.isRequired,
link: PropTypes.string.isRequired
};

renderMetaData = title => (
<Helmet
title={`${settings.app.name} - Edit ${title}`}
meta={[
{
name: 'description',
content: `${settings.app.name} - Edit ${title} example page`
}
]}
/>
);

render() {
const { loading, data, title, link } = this.props;

if (loading && !data) {
return (
<PageLayout>
{this.renderMetaData(title)}
<div className="text-center">Loading...</div>
</PageLayout>
);
} else {
return (
<PageLayout>
{this.renderMetaData(title)}
<Link id="back-button" to={`/${link}`}>
Back
</Link>
<h2>
{data ? 'Edit' : 'Create'} {title}
</h2>
<FormView {...this.props} />
</PageLayout>
);
}
}
}

export default EditView;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default () => {};
120 changes: 120 additions & 0 deletions packages/client/src/modules/common/components/crud/FilterView.web.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Formik } from 'formik';
import { DebounceInput } from 'react-debounce-input';

import { hasRole } from '../../../user/containers/Auth';
import { Form, FormItem, Input, Row, Col, Button, Icon } from '../web';
import { createFormFields } from '../../util';
import { mapFormPropsToValues, pickInputFields } from '../../../../utils/crud';

const formItemLayout = {
labelCol: {
xs: { span: 24 },
sm: { span: 8 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
}
};

class FilterView extends React.PureComponent {
static propTypes = {
schema: PropTypes.object.isRequired,
searchText: PropTypes.string,
onFilterChange: PropTypes.func.isRequired,
customFields: PropTypes.object,
currentUser: PropTypes.object,
currentUserLoading: PropTypes.bool
};

state = {
expand: false
};

toggle = () => {
const { expand } = this.state;
this.setState({ expand: !expand });
};

handleSearch = e => {
const { onFilterChange } = this.props;
onFilterChange({ searchText: e.target.value });
};

render() {
const { schema, onFilterChange, customFields, currentUser } = this.props;
const { expand } = this.state;

const showFilter =
customFields === null
? false
: customFields && customFields.role
? !!hasRole(customFields.role, currentUser)
: true;

if (!showFilter) {
return null;
}

return (
<Formik
initialValues={mapFormPropsToValues({ schema, formType: 'filter' })}
onSubmit={values => {
onFilterChange(pickInputFields({ schema, values, formType: 'filter' }));
}}
onReset={(values, formikBag) => {
formikBag.resetForm();
onFilterChange({});
}}
render={({ values, handleChange, handleBlur, handleSubmit, handleReset }) => (
<Form className="ant-advanced-search-form bootstrap-advanced-search-form" onSubmit={handleSubmit}>
<Row>
<Col span={8}>
<FormItem label="Find" {...formItemLayout}>
<DebounceInput
minLength={2}
debounceTimeout={300}
placeholder="Search ..."
element={Input}
onChange={this.handleSearch}
/>
</FormItem>
</Col>
<Col span={16} style={{ textAlign: 'right' }}>
<Button type="primary" htmlType="submit">
Search
</Button>
<Button style={{ marginLeft: 8 }} onClick={handleReset}>
Clear
</Button>
<a style={{ marginLeft: 8, fontSize: 12 }} onClick={this.toggle}>
Advanced{' '}
<Icon
type={this.state.expand ? 'up' : 'down'}
className={this.state.expand ? 'fas fa-chevron-up' : 'fas fa-chevron-down'}
/>
</a>
</Col>
</Row>
<Row gutter={24} style={{ display: expand ? 'block' : 'none' }}>
{createFormFields({
handleChange,
handleBlur,
schema,
values,
formItemLayout,
prefix: '',
customFields,
formType: 'filter'
})}
</Row>
</Form>
)}
/>
);
}
}

export default FilterView;
43 changes: 43 additions & 0 deletions packages/client/src/modules/common/components/crud/FormView.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Formik } from 'formik';
//import DomainValidator from '@domain-schema/validation';

import { onSubmit, mapFormPropsToValues } from '../../../../utils/crud';
import { createFormFields } from '../../util';
import { FormView, Button } from '../native';
//import { computeDomainValidationErrors } from '../../../../../../common/validation';

const Form = ({ schema, data: { node }, updateEntry, createEntry }) => {
// const domainValidator = new DomainValidator();
return (
<Formik
initialValues={mapFormPropsToValues({ schema, data: node })}
/* validate={values => {
let rawErrors = domainValidator.validate(schema, values);
return computeDomainValidationErrors(rawErrors);
}}*/
onSubmit={async values => {
let title = node && node.__typename ? node.__typename : 'Model',
data = node || null;

await onSubmit({ schema, values, updateEntry, createEntry, title, data });
}}
render={({ handleSubmit, values, setFieldValue, setFieldTouched }) => (
<FormView>
{createFormFields(schema, values, setFieldValue, setFieldTouched)}
<Button onPress={handleSubmit}>Save</Button>
</FormView>
)}
/>
);
};

Form.propTypes = {
schema: PropTypes.object.isRequired,
data: PropTypes.object,
updateEntry: PropTypes.func.isRequired,
createEntry: PropTypes.func.isRequired
};

export default Form;
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react';
import PropTypes from 'prop-types';
import { onSubmit } from '../../../../utils/crud';
import generateFormik from '../../generateFormik';

const FormView = ({ schema, updateEntry, createEntry, title, data }) => {
const Formik = generateFormik(schema);
return (
<Formik
values={data ? data.node : null}
onSubmit={async values => {
await onSubmit({ schema, values, updateEntry, createEntry, title, data: data ? data.node : null });
}}
/>
);
};

FormView.propTypes = {
updateEntry: PropTypes.func.isRequired,
schema: PropTypes.object.isRequired,
createEntry: PropTypes.func.isRequired,
title: PropTypes.string.isRequired,
data: PropTypes.object
};

export default FormView;
Loading