@mongoosejs/studio 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/backend/actions/Model/deleteDocument.js +31 -0
  2. package/backend/actions/Model/getDocument.js +11 -1
  3. package/backend/actions/Model/getDocuments.js +25 -4
  4. package/backend/actions/Model/index.js +1 -0
  5. package/backend/helpers/removeSpecifiedPaths.js +9 -0
  6. package/frontend/public/images/delete.svg +25 -0
  7. package/frontend/public/images/edit.svg +5 -0
  8. package/frontend/public/images/logo.svg +160 -0
  9. package/frontend/public/images/save.svg +21 -0
  10. package/frontend/public/images/success.png +0 -0
  11. package/frontend/public/index.html +1 -0
  12. package/frontend/public/style.css +38 -1
  13. package/frontend/public/vanillatoasts/vanillatoasts.css +125 -0
  14. package/frontend/src/api.js +6 -2
  15. package/frontend/src/document/document.css +4 -0
  16. package/frontend/src/document/document.html +6 -3
  17. package/frontend/src/document/document.js +25 -1
  18. package/frontend/src/edit-date/edit-date.html +3 -0
  19. package/frontend/src/edit-date/edit-date.js +9 -0
  20. package/frontend/src/edit-number/edit-number.html +3 -0
  21. package/frontend/src/edit-number/edit-number.js +20 -0
  22. package/frontend/src/export-query-results/export-query-results.js +6 -3
  23. package/frontend/src/index.js +3 -0
  24. package/frontend/src/list-default/list-default.css +0 -0
  25. package/frontend/src/list-default/list-default.html +6 -2
  26. package/frontend/src/list-default/list-default.js +30 -1
  27. package/frontend/src/list-string/list-string.css +4 -0
  28. package/frontend/src/list-string/list-string.html +4 -0
  29. package/frontend/src/list-string/list-string.js +43 -0
  30. package/frontend/src/list-subdocument/list-subdocument.html +1 -1
  31. package/frontend/src/list-subdocument/list-subdocument.js +4 -1
  32. package/frontend/src/modal/modal.css +8 -0
  33. package/frontend/src/models/models.css +8 -2
  34. package/frontend/src/models/models.html +11 -2
  35. package/frontend/src/models/models.js +40 -21
  36. package/frontend/src/navbar/navbar.css +3 -3
  37. package/frontend/src/navbar/navbar.html +2 -2
  38. package/mongoose.js +20 -0
  39. package/package.json +9 -7
  40. package/scripts/stratos.js +22 -0
  41. package/stargate.js +26 -0
  42. package/stratos.js +20 -0
  43. package/tv.js +20 -0
  44. package/zevo.js +20 -0
  45. package/frontend/public/app.js +0 -4012
  46. package/test.js +0 -264
@@ -0,0 +1,31 @@
1
+ 'use strict';
2
+
3
+ const Archetype = require('archetype');
4
+
5
+ const DeleteDocumentParams = new Archetype({
6
+ model: {
7
+ $type: 'string',
8
+ $required: true
9
+ },
10
+ documentId: {
11
+ $type: 'string',
12
+ $required: true
13
+ }
14
+ }).compile('DeleteDocumentParams');
15
+
16
+ module.exports = ({ db }) => async function DeleteDocument(params) {
17
+ const { model, documentId } = new DeleteDocumentParams(params);
18
+
19
+ const Model = db.models[model];
20
+ if (Model == null) {
21
+ throw new Error(`Model ${model} not found`);
22
+ }
23
+
24
+ const doc = await Model.
25
+ deleteOne({_id: documentId}).
26
+ setOptions({ sanitizeFilter: true }).
27
+ orFail();
28
+ console.log('what is doc', doc);
29
+
30
+ return { doc };
31
+ };
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const Archetype = require('archetype');
4
+ const removeSpecifiedPaths = require('../../helpers/removeSpecifiedPaths');
4
5
 
5
6
  const GetDocumentParams = new Archetype({
6
7
  model: {
@@ -25,6 +26,15 @@ module.exports = ({ db }) => async function getDocument(params) {
25
26
  findById(documentId).
26
27
  setOptions({ sanitizeFilter: true }).
27
28
  orFail();
29
+ let schemaPaths = {};
30
+ for (const path of Object.keys(Model.schema.paths)) {
31
+ schemaPaths[path] = {
32
+ instance: Model.schema.paths[path].instance,
33
+ path,
34
+ options: Model.schema.paths[path].options
35
+ };
36
+ }
37
+ removeSpecifiedPaths(schemaPaths, '.$*');
28
38
 
29
- return { doc, schemaPaths: Model.schema.paths };
39
+ return { doc, schemaPaths };
30
40
  };
@@ -1,6 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  const Archetype = require('archetype');
4
+ const removeSpecifiedPaths = require('../../helpers/removeSpecifiedPaths');
5
+ const EJSON = require('ejson');
4
6
 
5
7
  const GetDocumentsParams = new Archetype({
6
8
  model: {
@@ -19,13 +21,19 @@ const GetDocumentsParams = new Archetype({
19
21
  },
20
22
  filter: {
21
23
  $type: Archetype.Any
24
+ },
25
+ sort: {
26
+ $type: Archetype.Any
22
27
  }
23
28
  }).compile('GetDocumentsParams');
24
29
 
25
30
  module.exports = ({ db }) => async function getDocuments(params) {
26
31
  params = new GetDocumentsParams(params);
27
32
  let { filter } = params;
28
- const { model, limit, skip } = params;
33
+ if (filter != null && Object.keys(filter).length > 0) {
34
+ filter = EJSON.parse(filter);
35
+ }
36
+ const { model, limit, skip, sort } = params;
29
37
 
30
38
  const Model = db.models[model];
31
39
  if (Model == null) {
@@ -38,10 +46,23 @@ module.exports = ({ db }) => async function getDocuments(params) {
38
46
 
39
47
  const docs = await Model.
40
48
  find(filter == null ? {} : filter).
41
- setOptions({ sanitizeFilter: true }).
42
49
  limit(limit).
43
50
  skip(skip).
44
- sort({ _id: -1 });
51
+ sort(sort == null ? { _id: -1 } : sort );
52
+
53
+ let schemaPaths = {};
54
+ for (const path of Object.keys(Model.schema.paths)) {
55
+ schemaPaths[path] = {
56
+ instance: Model.schema.paths[path].instance,
57
+ path,
58
+ options: Model.schema.paths[path].options
59
+ };
60
+ }
61
+ removeSpecifiedPaths(schemaPaths, '.$*');
62
+
63
+ const numDocuments = filter == null ?
64
+ await Model.estimatedDocumentCount() :
65
+ await Model.countDocuments(filter);
45
66
 
46
- return { docs, schemaPaths: Model.schema.paths };
67
+ return { docs, schemaPaths, numDocs: numDocuments };
47
68
  };
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ exports.deleteDocument = require('./deleteDocument');
3
4
  exports.exportQueryResults = require('./exportQueryResults');
4
5
  exports.getDocument = require('./getDocument');
5
6
  exports.getDocuments = require('./getDocuments');
@@ -0,0 +1,9 @@
1
+
2
+
3
+ module.exports = function removeSpecifiedPaths(obj, paths) {
4
+ for (const key in obj) {
5
+ if (key.includes(paths)) {
6
+ delete obj[key];
7
+ }
8
+ }
9
+ }
@@ -0,0 +1,25 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
3
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <svg fill="#ffffff" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
5
+ width="800px" height="800px" viewBox="0 0 482.428 482.429"
6
+ xml:space="preserve">
7
+ <g>
8
+ <g>
9
+ <path d="M381.163,57.799h-75.094C302.323,25.316,274.686,0,241.214,0c-33.471,0-61.104,25.315-64.85,57.799h-75.098
10
+ c-30.39,0-55.111,24.728-55.111,55.117v2.828c0,23.223,14.46,43.1,34.83,51.199v260.369c0,30.39,24.724,55.117,55.112,55.117
11
+ h210.236c30.389,0,55.111-24.729,55.111-55.117V166.944c20.369-8.1,34.83-27.977,34.83-51.199v-2.828
12
+ C436.274,82.527,411.551,57.799,381.163,57.799z M241.214,26.139c19.037,0,34.927,13.645,38.443,31.66h-76.879
13
+ C206.293,39.783,222.184,26.139,241.214,26.139z M375.305,427.312c0,15.978-13,28.979-28.973,28.979H136.096
14
+ c-15.973,0-28.973-13.002-28.973-28.979V170.861h268.182V427.312z M410.135,115.744c0,15.978-13,28.979-28.973,28.979H101.266
15
+ c-15.973,0-28.973-13.001-28.973-28.979v-2.828c0-15.978,13-28.979,28.973-28.979h279.897c15.973,0,28.973,13.001,28.973,28.979
16
+ V115.744z"/>
17
+ <path d="M171.144,422.863c7.218,0,13.069-5.853,13.069-13.068V262.641c0-7.216-5.852-13.07-13.069-13.07
18
+ c-7.217,0-13.069,5.854-13.069,13.07v147.154C158.074,417.012,163.926,422.863,171.144,422.863z"/>
19
+ <path d="M241.214,422.863c7.218,0,13.07-5.853,13.07-13.068V262.641c0-7.216-5.854-13.07-13.07-13.07
20
+ c-7.217,0-13.069,5.854-13.069,13.07v147.154C228.145,417.012,233.996,422.863,241.214,422.863z"/>
21
+ <path d="M311.284,422.863c7.217,0,13.068-5.853,13.068-13.068V262.641c0-7.216-5.852-13.07-13.068-13.07
22
+ c-7.219,0-13.07,5.854-13.07,13.07v147.154C298.213,417.012,304.067,422.863,311.284,422.863z"/>
23
+ </g>
24
+ </g>
25
+ </svg>
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="100" height="100">
3
+ <path fill="#ffffff" d="M77.926,94.924H8.217C6.441,94.924,5,93.484,5,91.706V21.997c0-1.777,1.441-3.217,3.217-3.217h34.854 c1.777,0,3.217,1.441,3.217,3.217s-1.441,3.217-3.217,3.217H11.435v63.275h63.274V56.851c0-1.777,1.441-3.217,3.217-3.217 c1.777,0,3.217,1.441,3.217,3.217v34.855C81.144,93.484,79.703,94.924,77.926,94.924z"/>
4
+ <path fill="#ffffff" d="M94.059,16.034L84.032,6.017c-1.255-1.255-3.292-1.255-4.547,0l-9.062,9.073L35.396,50.116 c-0.29,0.29-0.525,0.633-0.686,1.008l-7.496,17.513c-0.526,1.212-0.247,2.617,0.676,3.539c0.622,0.622,1.437,0.944,2.274,0.944 c0.429,0,0.858-0.086,1.276-0.257l17.513-7.496c0.375-0.161,0.719-0.397,1.008-0.686l35.026-35.026l9.073-9.062 C95.314,19.326,95.314,17.289,94.059,16.034z M36.286,63.79l2.928-6.821l3.893,3.893L36.286,63.79z M46.925,58.621l-5.469-5.469 L73.007,21.6l5.47,5.469L46.925,58.621z M81.511,24.034l-5.469-5.469l5.716-5.716l5.469,5.459L81.511,24.034z"/>
5
+ </svg>
@@ -0,0 +1,160 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 27.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 1380.95654 757.40125" style="enable-background:new 0 0 1380.95654 757.40125;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#880000;}
7
+ .st1{fill:#666666;}
8
+ .st2{fill:#4D4D4D;}
9
+ .st3{fill:#333333;}
10
+ </style>
11
+ <g id="Layer_1">
12
+ </g>
13
+ <g id="Layer_3">
14
+ </g>
15
+ <g id="Layer_2">
16
+ <g id="g10" transform="matrix(2,0,0,-2,-340,1000)">
17
+ <g id="g12" transform="translate(439.8999,245.333)">
18
+ <path id="path14" class="st0" d="M18.239-48.58955L-4.05665-13.96412v-61.98937h43.28808l1.4898,1.52618v60.4632L18.239-48.58955
19
+ z"/>
20
+ </g>
21
+ <g id="g16">
22
+ <g>
23
+ <g id="g18">
24
+ <g id="g24" transform="translate(662.1133,391.8979)">
25
+ <path id="path26" class="st0" d="M3.32237-58.42808c-8.45835-0.63062-16.9363-1.28363-25.41145-1.33308
26
+ c-5.21663-0.02985-10.5228,0.65115-15.64054,1.71555c-6.46667,1.34613-11.90159,4.55055-15.09948,10.80453
27
+ c-0.47576,0.92634-2.06818,1.45995-3.25013,1.81257c-4.16808,1.23885-8.38279,2.31819-12.59191,3.87515
28
+ c1.46461,0.11008,2.93015,0.32277,4.39196,0.30785c3.58783-0.03545,7.21577,0.13247,10.74856-0.34143
29
+ c6.45641-0.8657,12.86151-2.12695,19.28527-3.24173c3.66059-0.63622,7.34077-1.209,10.97151-1.98982
30
+ c6.88927-1.48233,13.75427-3.07661,20.62208-4.6541c4.53843-1.04202,9.06659-2.12135,13.59382-3.21748 M4.97262-104.28902
31
+ c-10.54892-3.25106-21.21539-6.17561-31.58799-9.91644c-6.49372-2.34245-12.59564-5.8118-18.7694-8.97983
32
+ c-5.38267-2.75944-7.28667-7.47137-6.62619-13.32143c0.42632-3.75854,0.94127-7.50682,1.27896-11.31854
33
+ c-2.7585,4.07013-4.79589,8.47235-5.99277,13.26358c-0.24628,0.99071-0.48043,1.98515-0.68753,2.9852
34
+ c-0.81533,3.9022,1.34893,6.33141,4.17553,8.44716c5.50115,4.11863,11.49299,7.36223,17.99697,9.51997
35
+ c8.11226,2.6932,16.24971,5.38081,24.51962,7.51615c5.82579,1.50192,11.88946,2.07378,17.84305,3.08221
36
+ c1.09892,0.18845,2.18012,0.4851,3.26972,0.72951c0.03638-0.14925,0.0737-0.29945,0.11194-0.44871
37
+ C8.66027-103.24701,6.80105-103.72464,4.97262-104.28902 M-143.77763-62.54858
38
+ c-0.17351-0.16978-0.34982-0.3377-0.52521-0.50562c-4.70355,3.43017-9.80821,5.98438-15.40172,7.46578
39
+ c-0.15672-0.15206-0.30971-0.30412-0.46271-0.45711c4.81456-5.64201,9.63005-11.28403,14.65544-17.16859
40
+ c-3.36487,1.10079-6.49654,2.12695-9.62912,3.15218c-0.13341-0.15765-0.26494-0.31624-0.39926-0.4739
41
+ c3.79027-6.24464,8.72514-11.67023,13.42963-17.92981c-8.17943,4.64478-15.39893,9.71774-22.138,15.48103
42
+ c-9.25037,7.91169-17.3197,16.83555-23.36473,27.46283c-2.48984,4.3789-4.68768,8.90893-5.15785,14.0332
43
+ c-0.10542,1.1437-0.01399,2.35364,0.25281,3.47029c0.43378,1.81257,2.15401,2.64936,3.91992,2.10083
44
+ c9.70186-3.01598,19.23769-6.43309,28.16248-11.39131c8.4481-4.69328,16.09392-10.40433,22.6716-17.50908
45
+ c0.26587-0.28732,0.46271-0.63808,0.82933-1.15303c-5.15039,2.34711-10.0377,4.57294-14.92596,6.79971
46
+ c-0.16512-0.20243-0.3293-0.4058-0.49628-0.60917C-149.49615-54.03612-146.6369-58.29281-143.77763-62.54858
47
+ M-437.97949-114.15322c-0.12128-0.32931,0.25748-0.65301,0.3862-0.97858c2.01129,0.42259,4.00482,0.97485,6.03571,1.24911
48
+ c0.52985,0.06997,1.05972,0.13714,1.59052,0.20803c7.49469,2.67081,15.17224,4.76884,23.09979,5.88643
49
+ c11.20471,1.57748,22.82086,3.67179,34.25696,3.61021c10.86612-0.05504,21.85812-1.71928,32.49008-3.55238
50
+ c2.98239-0.51308,5.91068-1.20154,8.797-2.01314c7.76706-1.74354,15.06586-4.85374,21.62585-9.05726
51
+ c0.47293-0.22575,0.93286-0.47483,1.40118-0.71178c9.32684-4.39383,17.54453-10.8577,24.03357-18.77686
52
+ c1.18756-1.31441,3.2576-2.6848,4.31827-4.12329c2.23517-2.63724,3.29956-5.44704,7.03107-8.39212v40.23106h46.53168
53
+ l21.75739-40.1471l21.82175,40.1471h47.95432v-77.75585l7.93781,5.23434c0,0,8.7037,23.14082,49.02805,26.39003
54
+ l46.21823,1.49446c-7.12901,14.75711-7.10289,14.75711-3.66526,19.20877c3.40405,4.40501,29.65788,7.2932,34.2756,10.04797
55
+ l67.44388,13.6078c0.15858,0.51868,0.33863-0.27799,0.68659-0.16885c1.67824,0.52894,3.41711,0.86198,5.8146,1.42636
56
+ l15.25246,3.7119c0.99258,0.55879,2.17452,0.77988,3.26878,1.15863c7.12715,2.47398,13.35967,5.66067,16.80849,13.25425
57
+ c3.35835,7.39768,7.85572,14.26922,9.48638,22.40573c0.51402,2.5738,0.07089,4.81082-1.78645,6.66071
58
+ c-2.24728,2.23703-5.14572,3.19789-8.12998,3.97311c-9.74292,3.99922-19.45039,8.0936-29.27261,11.89132
59
+ c-6.03848,2.33591-12.23369,4.27442-18.39997,6.25957c-6.10099,1.9637-12.23649,3.81731-18.38785,5.61496
60
+ c-5.66627,1.65771-11.36705,3.19882-17.06037,4.75205c-5.55432,1.51499-11.10118,3.07381-16.69096,4.447
61
+ c-6.51238,1.60081-13.06954,3.0253-19.60898,4.51977c-4.96661,1.13531-9.91457,2.34991-14.9045,3.3658
62
+ c-5.43398,1.10639-10.90248,2.05792-16.36538,3.01971c-6.97789,1.22673-13.94085,2.58685-20.95792,3.54212
63
+ c-8.47328,1.15303-17.00067,1.89933-25.49727,2.9003c-14.2263,1.6773-28.48991,2.12695-42.76194,1.03642
64
+ c-5.05803-0.38621-10.04797-1.66797-15.06776-2.53928c5.31737-2.73238,10.57877-4.94236,15.76834-7.30812
65
+ c5.22034-2.37976,10.08715-5.36215,14.55654-8.96211c-5.84818,2.2389-11.53776,4.82108-17.40273,6.91539
66
+ c-12.24022,4.36957-24.69313,7.99845-37.62553,9.74852c-6.32582,0.85544-12.63576,1.67637-18.95598-0.10728
67
+ c-6.40604-1.80791-8.21768-4.18487-8.79793-10.61329c-0.96085-10.65527,2.24542-20.53812,6.504-30.06741
68
+ c6.35007-14.20951,15.60509-26.31353,27.43951-36.4352c9.06192-7.75311,19.11642-13.86342,30.22319-18.21994
69
+ c3.16338-1.24072,6.35753-2.40588,9.53488-3.60648c-0.07182-0.24721-0.14366-0.49162-0.21549-0.73977
70
+ c-6.08979,1.66798-12.3335,2.91803-18.23206,5.09908c-10.43231,3.85556-19.76103,9.74572-28.2959,16.89899
71
+ c-9.52649,7.98632-17.44379,17.31971-23.32834,28.25577c-6.24464,11.604-9.81848,24.00281-9.94722,37.27292"/>
72
+ </g>
73
+ <g id="g28" transform="translate(189.0308,331.666)">
74
+ <path id="path30" class="st0" d="M35.07922-54.38486c0,0,108.1843,104.48172,231.81882,91.51479"/>
75
+ </g>
76
+ </g>
77
+ </g>
78
+ </g>
79
+ </g>
80
+ <path d="M910.44434,240.67862c-0.69855-0.4843-1.40643-0.96866-2.16089-1.46236c0.05591-0.37253,0.05591-0.75446-0.02795-1.16428
81
+ c-5.30914-33.51277-9.20251-67.30496-17.6319-100.2589c-7.41418-29.05125-24.66425-52.15066-44.64337-73.86225
82
+ c-37.47137-40.72208-87.53564-61.43703-142.9649-55.48519c-0.13483,0-0.26123,0.02689-0.39532,0.05389l-0.00208-0.0083
83
+ c-43.02283,4.6784-84.13074,22.47747-106.4704,60.98484c-13.77789,23.74829-19.72913,54.22363-23.9458,80.94751
84
+ c-5.0769,32.29448,5.64105,61.35942,10.01276,92.87825c-1.43842,3.75107-0.94482,7.38951,0.08459,12.02925
85
+ c3.59607,16.21764,4.01917,28.10591-2.45386,44.14027c-0.16919,0.47961-0.25385,0.90268-0.32434,1.35385
86
+ c-0.3808,0.52191-0.77563,1.00134-1.17041,1.53726c-14.21521,20.82916-3.92053,51.06467,5.76776,71.30151
87
+ c11.88837,24.74957,32.29437,49.73901,50.93781,69.72205c15.82281,16.90878,36.44043,29.93936,58.08759,37.87888
88
+ c1.87555,0.71921,3.84991,1.32568,5.8526,1.918c0.74725,0.57812,1.72034,0.97311,2.94727,0.97311c0.25378,0,0.54999,0,0.81805,0
89
+ c14.2998,3.31393,30.24951,2.86261,42.71588-4.78073c0.12695-0.07056,0.2962-0.11285,0.4231-0.18347
90
+ c12.6358-3.70877,23.43811-9.97021,30.79956-20.30737c3.94879-3.28571,7.77045-6.57162,11.39484-9.7587
91
+ c1.26923-1.14233,2.43958-2.27057,3.56781-3.42691c10.50391-12.71146,15.89227-25.56201,18.14447-37.66217
92
+ c0.21387-1.61664,0.40076-3.23834,0.513-4.87061c0.07782-0.03391,0.15546-0.0762,0.23328-0.10825
93
+ c0.49231-4.11667,0.64459-8.12631,0.53021-11.99557c-0.24908,0.1821-0.48438,0.38937-0.73523,0.56818
94
+ c0.28882-0.20642,0.49908-0.49478,0.72894-0.76288c-0.49994-15.67526-5.2793-29.00677-8.87903-37.50125
95
+ c-7.41663-17.5014-28.47382-54.19104-28.47382-54.19104c-13.35498-19.53168-29.54443-37.13138-48.10315-50.44409
96
+ c-14.44073-10.3793-54.94287-26.68175-72.76819-12.45233c-2.59491-2.91919-5.24603-6.00761-8.29218-9.23714
97
+ c-2.03076-2.12943-4.34357-3.39861-6.7691-4.13191c-2.86285-39.38786-15.03326-79.43864-6.68457-118.75597
98
+ c1.07178-5.07681,2.49615-9.88579,4.24475-14.48324c22.90222-14.63821,47.41217-24.04443,74.88354-23.91753
99
+ c2.17224,0.0104,4.32281,0.12677,6.46179,0.29516l-0.00293-0.01183c26.66455,2.1159,50.71191,16.11444,70.82928,33.09311
100
+ c19.62518,16.54218,27.10449,42.96679,33.27057,66.79275c5.25323,20.55656,14.65137,40.10728,16.76569,62.22871
101
+ c-4.862,2.25404-9.46326,5.29984-13.68268,9.29564c8.13141,0.86621,16.26276,1.72311,24.37555,2.71976
102
+ c14.36261-3.67915,25.15784-1.18294,32.83282,5.03905c0,0,0-0.00932,0.00934,0c5.36499,0.95935,10.73932,1.93733,16.10437,2.89673
103
+ c-1.86285-2.75705-3.97723-5.19739-6.29645-7.33966c5.11353,2.41237,10.04077,5.25328,14.66998,8.28973
104
+ c0.3446,0.23286,0.68921,0.45639,1.03387,0.70784c6.56659,1.15503,13.12384,2.33789,19.67175,3.61395
105
+ C921.25824,248.76341,915.89325,244.54407,910.44434,240.67862z"/>
106
+ <path class="st1" d="M906.60687,249.76004c-2.72913-0.4843-5.44885-0.96866-8.17792-1.4437
107
+ c-0.40985-0.07454-0.8197-0.149-1.22949-0.21422c-1.86285-2.75705-3.97723-5.19739-6.29645-7.33966
108
+ c5.11353,2.41237,10.04077,5.25328,14.66998,8.28973C905.9176,249.28506,906.26221,249.50859,906.60687,249.76004z"/>
109
+ <path class="st2" d="M881.08575,245.2054c-8.17798-1.46234-16.3559-2.85948-24.57111-3.97722
110
+ c-2.74768-0.37259-5.50476-0.72653-8.26172-1.06183C862.61554,236.4872,873.41077,238.98341,881.08575,245.2054z"/>
111
+ <g>
112
+ <g>
113
+ <path class="st2" d="M26.86355,456.58997H13.56502V133.23695h322.66196v13.32674H26.86355V456.58997z"/>
114
+ </g>
115
+ </g>
116
+ <g>
117
+ <path class="st2" d="M1367.39148,749.96136h-322.66199v-13.34088h309.36353V426.59424h13.29846V749.96136z"/>
118
+ </g>
119
+ <path class="st2" d="M594.15912,262.94635c17.98047-5.03455,34.91754-12.73444,52.02362-20.19452
120
+ c-5.54224-6.37433-11.25366-11.78963-18.69971-11.04214c-8.99738,0.9025-18.91125,3.08841-26.90729,7.48834
121
+ c-8.98315,4.93571-10.67548,7.43184-7.8974,17.24707C593.28485,258.64508,593.76428,260.81696,594.15912,262.94635z"/>
122
+ <path class="st1" d="M735.5072,269.1232c-11.83191-10.68967-25.10229-20.49069-40.88287-24.29832
123
+ c-7.99603-1.94612-25.87787-6.67047-34.80463-1.26921c4.24487,3.97687,9.11023,7.43184,15.89337,10.12544
124
+ c19.89838,7.84087,37.47003,19.67278,50.35962,36.9481c15.56903,20.85739,25.76501,45.57895,38.00586,68.42477
125
+ c10.97156,20.4624,24.04443,44.53513,22.56372,68.56555c-0.15503,2.52438-0.4231,4.94992-0.77563,7.24872
126
+ c0.3808-0.69113,0.95905-1.29745,1.88977-1.77689c0.53583-0.26807,1.05768-0.52191,1.60773-0.77576
127
+ c16.06244-23.17004,13.50995-51.05042,2.12939-78.94498C779.06927,322.95184,759.98877,291.29208,735.5072,269.1232z"/>
128
+ <path class="st2" d="M633.94196,287.01907c-20.67413,0.9025-47.77893,7.67163-51.69922,31.87128
129
+ c-4.04749,24.77789,8.61639,50.57117,22.64832,70.258c22.16888,31.15207,46.46722,64.46194,82.90784,79.6925
130
+ c0.38074-0.0423,0.77557-0.08463,1.18457-0.0423c7.91144,0.57806,16.7113,3.92032,25.32788,5.72549
131
+ c6.79724,0,13.79211-0.23981,20.57532-1.19864c2.56665-1.0719,5.11914-2.22824,7.68585-3.52573
132
+ c1.3396-1.04346,2.72168-2.12939,3.97681-3.39859c23.32526-23.88947,4.89343-47.00317-3.96277-72.24646
133
+ C725.95984,346.51688,690.84497,287.08963,633.94196,287.01907z"/>
134
+ <path class="st1" d="M743.91211,342.1452c-8.40491-16.66901-15.69592-34.63547-28.09192-48.92102
135
+ c-15.37152-17.67032-32.78796-24.38309-53.0954-34.52258c-3.66663-1.80515-6.89606-4.93588-10.05499-8.39102
136
+ c-0.23962,0.15518-0.57812,0.35268-0.88849,0.50769c-18.60089,8.09485-36.99042,16.61264-56.62091,21.95737
137
+ c0.14099,5.06281-0.42303,10.08331-1.52307,15.11786c11.70502-7.24875,25.97656-9.91409,40.30463-10.56274
138
+ c72.17584,0.08463,100.52161,75.71564,125.27124,130.78522c7.5166,16.69727,11.08447,32.91492,5.72552,47.62372
139
+ c1.84747-1.39612,3.63843-2.7782,5.41528-4.17435c7.84106-13.5946,8.16528-31.138,3.3988-46.67874
140
+ C766.88483,382.42154,754.4325,362.93201,743.91211,342.1452z"/>
141
+ <path class="st2" d="M836.80438,94.7757c-21.78815-33.08413-59.85046-56.32475-99.19604-61.7683
142
+ c-9.89886-1.3611-19.65198-1.357-29.01886-0.10398c-27.22363,3.64175-51.13849,17.97854-65.52338,41.1559
143
+ c22.97351-12.05291,47.42474-17.9645,71.50391-16.70766c24.802,1.29464,49.20923,10.19551,71.198,27.89095
144
+ c22.40851,18.06512,34.49432,40.81207,41.86975,68.33996c4.03339,15.03305,7.44611,30.19321,12.69214,44.83147
145
+ c3.18726,8.79985,5.45764,17.61374,6.54358,26.49825c8.75757-2.10129,18.00879-2.00249,27.17517-0.22559
146
+ C864.995,181.32196,861.62463,132.42902,836.80438,94.7757z"/>
147
+ <path class="st2" d="M809.80719,408.03665c0.31183-1.67624,0.54968-3.33383,0.74634-4.97885
148
+ c-0.07788,0.03207-0.15552,0.07437-0.2334,0.10825C810.20795,404.79834,810.02106,406.42007,809.80719,408.03665z"/>
149
+ <path class="st3" d="M811.08368,391.06226c-0.00201-0.06509-0.00433-0.12973-0.00629-0.19467
150
+ c-0.22986,0.26807-0.44012,0.55643-0.729,0.76285C810.5993,391.45163,810.83459,391.24438,811.08368,391.06226z"/>
151
+ <path class="st1" d="M884.13196,151.97491c-7.1922-30.34822-20.25104-54.28003-41.41864-77.29507
152
+ C807.37274,36.27906,761.66705,11.8256,708.078,17.56528c-1.04626,0.11256-2.09668,0.2643-3.14478,0.3909
153
+ c-40.97919,4.94742-83.03308,20.72183-102.27039,59.925c-11.52161,23.49446-19.33435,53.40556-21.5907,79.43848
154
+ c-2.3269,26.45612,5.09094,50.66977,9.40625,76.19502c10.15369-7.50241,25.90613-10.98561,37.00464-11.52159
155
+ c0.18329,0,0.3667,0,0.52173-0.02826c-3.49731-45.45186-20.20856-95.74091,0.14111-139.2749
156
+ c16.04303-34.35546,43.71246-54.88514,78.06879-59.49498c8.9812-1.2051,18.41254-1.33847,28.22064-0.32723
157
+ c39.06366,4.08978,80.1579,25.6381,103.83582,57.17107c31.80066,42.30711,35.11481,97.47552,46.31201,147.45422
158
+ c4.45642,1.48071,8.88446,3.37051,13.11517,5.49989C893.65106,205.94466,890.44977,178.6001,884.13196,151.97491z"/>
159
+ </g>
160
+ </svg>
@@ -0,0 +1,21 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
3
+ <svg fill="#ffffff" height="800px" width="800px" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
4
+ viewBox="0 0 486 486" xml:space="preserve">
5
+ <g>
6
+ <g>
7
+ <path d="M473.7,485.75c6.8,0,12.3-5.5,12.3-12.3v-359.8c0-3.6-1.6-7-4.3-9.3L363,2.85c-0.2-0.2-0.4-0.3-0.6-0.4
8
+ c-0.3-0.2-0.5-0.4-0.8-0.6c-0.4-0.2-0.7-0.4-1.1-0.6c-0.3-0.1-0.6-0.3-0.9-0.4c-0.4-0.2-0.9-0.3-1.3-0.4c-0.3-0.1-0.6-0.2-0.9-0.2
9
+ c-0.8-0.1-1.5-0.2-2.3-0.2H12.3C5.5,0.05,0,5.55,0,12.35v461.3c0,6.8,5.5,12.3,12.3,12.3h461.4V485.75z M384.5,461.25h-283v-184.1
10
+ c0-3.7,3-6.6,6.6-6.6h269.8c3.7,0,6.6,3,6.6,6.6V461.25z M161.8,24.45h180.9v127.8c0,0.8-0.6,1.4-1.4,1.4h-178
11
+ c-0.8,0-1.4-0.7-1.4-1.4V24.45H161.8z M24.6,24.45h112.8v127.8c0,14.3,11.6,25.9,25.9,25.9h178c14.3,0,25.9-11.6,25.9-25.9V38.75
12
+ l94.2,80.6v341.9H409v-184.1c0-17.2-14-31.1-31.1-31.1H108.1c-17.2,0-31.1,14-31.1,31.1v184.2H24.6V24.45z"/>
13
+ <path d="M227.4,77.65h53.8v32.6c0,6.8,5.5,12.3,12.3,12.3s12.3-5.5,12.3-12.3v-44.8c0-6.8-5.5-12.3-12.3-12.3h-66.1
14
+ c-6.8,0-12.3,5.5-12.3,12.3S220.7,77.65,227.4,77.65z"/>
15
+ <path d="M304.5,322.85h-123c-6.8,0-12.3,5.5-12.3,12.3s5.5,12.3,12.3,12.3h123c6.8,0,12.3-5.5,12.3-12.3
16
+ S311.3,322.85,304.5,322.85z"/>
17
+ <path d="M304.5,387.75h-123c-6.8,0-12.3,5.5-12.3,12.3s5.5,12.3,12.3,12.3h123c6.8,0,12.3-5.5,12.3-12.3
18
+ S311.3,387.75,304.5,387.75z"/>
19
+ </g>
20
+ </g>
21
+ </svg>
@@ -8,6 +8,7 @@
8
8
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans"/>
9
9
  <link rel="stylesheet" type="text/css" href="style.css"/>
10
10
  <link rel="stylesheet" href="https://unpkg.com/prismjs@1.29.0/themes/prism.css"/>
11
+ <link rel="stylesheet" href="vanillatoasts/vanillatoasts.css">
11
12
  <script src="https://unpkg.com/vue@3.x"></script>
12
13
  <script src="https://unpkg.com/vue-router@4.0.10"></script>
13
14
  </head>
@@ -31,4 +31,41 @@ button.green {
31
31
  button.grey {
32
32
  color: black;
33
33
  background-color: #ddd;
34
- }
34
+ }
35
+
36
+ button.red {
37
+ background-color: red;
38
+ }
39
+
40
+ .tooltip {
41
+ position: relative;
42
+ display: inline-block;
43
+ }
44
+
45
+ /* Tooltip text */
46
+ .tooltip .tooltiptext {
47
+ visibility: hidden;
48
+ width: 120px;
49
+ background-color: black;
50
+ color: #fff;
51
+ text-align: center;
52
+ padding: 5px 0px;
53
+ border-radius: 6px;
54
+ top: 100%;
55
+ left: 50%;
56
+ margin-left: -60px; /* Use half of the width (120/2 = 60), to center the tooltip */
57
+
58
+ /* Position the tooltip text - see examples below! */
59
+ position: absolute;
60
+ z-index: 1;
61
+ }
62
+
63
+ /* Show the tooltip text when you mouse over the tooltip container */
64
+
65
+ .tooltip:hover .tooltiptext {
66
+ visibility: visible;
67
+ }
68
+
69
+ .tooltiptextchild {
70
+ margin: 5px;
71
+ }
@@ -0,0 +1,125 @@
1
+ #vanillatoasts-container {
2
+ position: fixed;
3
+ width: 320px;
4
+ font-family: 'Helvetica';
5
+ pointer-events: none;
6
+ }
7
+ .toasts-top-right{
8
+ top: 0;
9
+ right: 0;
10
+ }
11
+ .toasts-top-left{
12
+ left:0;
13
+ top:0;
14
+ }
15
+ .toasts-bottom-left{
16
+ left: 0;
17
+ bottom:0;
18
+ }
19
+ .toasts-bottom-right{
20
+ bottom:0;
21
+ right: 0;
22
+ }
23
+ .toasts-top-center{
24
+ left: 0;
25
+ top: 0;
26
+ bottom: 0;
27
+ right: 0;
28
+ margin: auto;
29
+ }
30
+ .toasts-bottom-center{
31
+ bottom:0;
32
+ left: 50%;
33
+ transform: translateX(-50%);
34
+ }
35
+ .vanillatoasts-toast {
36
+ position: relative;
37
+ padding: 20px 17px;
38
+ margin: 20px;
39
+ border-radius: 10px;
40
+ background: #F5F5F5;
41
+ cursor: pointer;
42
+ box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
43
+ animation-duration: .3s;
44
+ animation-name: VanillaToasts;
45
+ animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
46
+ pointer-events: all;
47
+ }
48
+
49
+ .vanillatoasts-fadeOut {
50
+ animation-name: VanillaToastsFadeOut;
51
+ animation-duration: .3s;
52
+ animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
53
+ animation-fill-mode: forwards;
54
+ }
55
+
56
+ #vanillatoasts-container p,
57
+ #vanillatoasts-container h4 {
58
+ margin: 3px 0!important;
59
+ }
60
+
61
+ .vanillatoasts-title {
62
+ font-weight: 700;
63
+ font-size: 15px;
64
+ margin-bottom: 10px;
65
+ }
66
+
67
+ .vanillatoasts-text {
68
+ font-size: 14px;
69
+ color: #777;
70
+ }
71
+
72
+ .vanillatoasts-icon {
73
+ position: absolute;
74
+ top: 5px;
75
+ left: -40px;
76
+ width: 50px;
77
+ height: 50px;
78
+ border-radius: 100%;
79
+ box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
80
+ background: #FFF;
81
+ }
82
+
83
+ .vanillatoasts-toast a, .vanillatoasts-toast a:hover {
84
+ color: #549EDB !important;
85
+ text-decoration: none !important;
86
+ }
87
+
88
+ /** toast types */
89
+ .vanillatoasts-success {
90
+ border-bottom: 2px solid #51C625;
91
+ }
92
+
93
+ .vanillatoasts-warning {
94
+ border-bottom: 2px solid #DB9215;
95
+ }
96
+
97
+ .vanillatoasts-error {
98
+ border-bottom: 2px solid #DB2B1D;
99
+ }
100
+
101
+ .vanillatoasts-info {
102
+ border-bottom: 2px solid #27ABDB;
103
+ }
104
+
105
+ @keyframes VanillaToasts {
106
+ from {
107
+ transform: translate3d(400px, 0, 0);;
108
+ opacity: 0;
109
+ }
110
+ to {
111
+ transform: translate3d(0, 0, 0);
112
+ opacity: 1;
113
+ }
114
+ }
115
+
116
+ @keyframes VanillaToastsFadeOut {
117
+ from {
118
+ transform: translate3d(0, 0, 0);
119
+ opacity: 1;
120
+ }
121
+ to {
122
+ transform: translate3d(400px, 0, 0);
123
+ opacity: 0;
124
+ }
125
+ }
@@ -8,6 +8,9 @@ const client = axios.create({
8
8
 
9
9
  if (config__isLambda) {
10
10
  exports.Model = {
11
+ deleteDocument(params) {
12
+ return client.post('', { action: 'Model.deleteDocument', ...params}).then(res => res.data);
13
+ },
11
14
  exportQueryResults(params) {
12
15
  return client.post('', { action: 'Model.exportQueryResults', ...params }).then(res => res.data);
13
16
  },
@@ -26,10 +29,11 @@ if (config__isLambda) {
26
29
  };
27
30
  } else {
28
31
  exports.Model = {
32
+ deleteDocument: function (params) {
33
+ return client.post('/Model/deleteDocument', params).then(res => res.data);
34
+ },
29
35
  exportQueryResults(params) {
30
36
  const anchor = document.createElement('a');
31
- console.log('K', config__baseURL)
32
- console.log('G', config__baseURL + '/Model/exportQueryResults?' + (new URLSearchParams(params)).toString());
33
37
  anchor.href = config__baseURL + '/Model/exportQueryResults?' + (new URLSearchParams(params)).toString();
34
38
  anchor.target = '_blank';
35
39
  anchor.download = 'export.csv';
@@ -36,4 +36,8 @@
36
36
 
37
37
  .document .document-menu .right button:not(:last-child) {
38
38
  margin-right: 0.5em;
39
+ }
40
+
41
+ .document button img {
42
+ height: 1em;
39
43
  }
@@ -8,13 +8,16 @@
8
8
 
9
9
  <div class="right">
10
10
  <button v-if="!editting" @click="editting = true">
11
- &#x270E; Edit
11
+ <img src="images/edit.svg" /> Edit
12
12
  </button>
13
13
  <button v-if="editting" class="grey" @click="editting = false">
14
14
  &times; Cancel
15
15
  </button>
16
16
  <button v-if="editting" class="green" @click="save">
17
- &check; Save
17
+ <img src="images/save.svg" /> Save
18
+ </button>
19
+ <button class="red" @click="remove">
20
+ <img src="images/delete.svg" /> Delete
18
21
  </button>
19
22
  </div>
20
23
  </div>
@@ -23,7 +26,7 @@
23
26
  <div class="path-key">
24
27
  {{path.path}}
25
28
  <span class="path-type">
26
- ({{path.instance.toLowerCase()}})
29
+ ({{(path.instance || 'unknown').toLowerCase()}})
27
30
  </span>
28
31
  </div>
29
32
  <div v-if="editting && path.path !== '_id'">
@@ -2,6 +2,7 @@
2
2
 
3
3
  const api = require('../api');
4
4
  const template = require('./document.html');
5
+ const vanillatoast = require('vanillatoasts');
5
6
 
6
7
  const appendCSS = require('../appendCSS');
7
8
 
@@ -39,7 +40,13 @@ module.exports = app => app.component('document', {
39
40
  }
40
41
  return 'detail-default';
41
42
  },
42
- getEditComponentForPath() {
43
+ getEditComponentForPath(path) {
44
+ if (path.instance == 'Date') {
45
+ return 'edit-date';
46
+ }
47
+ if (path.instance == 'Number') {
48
+ return 'edit-number';
49
+ }
43
50
  return 'edit-default';
44
51
  },
45
52
  getEditValueForPath({ path }) {
@@ -58,6 +65,23 @@ module.exports = app => app.component('document', {
58
65
  this.document = doc;
59
66
  this.changes = {};
60
67
  this.editting = false;
68
+ },
69
+ async remove() {
70
+ const { doc } = await api.Model.deleteDocument({
71
+ model: this.model,
72
+ documentId: this.document._id
73
+ });
74
+ if (doc.acknowledged) {
75
+ this.editting = false;
76
+ this.document = {};
77
+ vanillatoast.create({
78
+ title: 'Document Deleted!',
79
+ type: 'success',
80
+ timeout: 3000,
81
+ positionClass: 'bottomRight'
82
+ });
83
+ this.$router.push({ path: `/model/${this.model}`});
84
+ }
61
85
  }
62
86
  }
63
87
  });
@@ -0,0 +1,3 @@
1
+ <div>
2
+ <input type="datetime-local" :value="value" @input="$emit('input', $event.target.value)">
3
+ </div>
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ const template = require('./edit-date.html');
4
+
5
+ module.exports = app => app.component('edit-date', {
6
+ template: template,
7
+ props: ['value'],
8
+ emits: ['input']
9
+ });
@@ -0,0 +1,3 @@
1
+ <div>
2
+ <input type="number" :value="value" @input="$emit('input', $event.target.value)">
3
+ </div>