diff options
author | Markus Hatvan <markus_hatvan@aon.at> | 2021-08-16 18:10:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-16 21:40:23 +0530 |
commit | 26a9dba22236bc22a7612107630282cfe02d20e0 (patch) | |
tree | 25af338b5a4b080a3bd2c60c500a34cafdff3581 | |
parent | chore: replace moment.js with day.js (#1804) (diff) | |
download | ferdium-app-26a9dba22236bc22a7612107630282cfe02d20e0.tar.gz ferdium-app-26a9dba22236bc22a7612107630282cfe02d20e0.tar.zst ferdium-app-26a9dba22236bc22a7612107630282cfe02d20e0.zip |
chore: update outdated node_modules (#1807)
- upgrade 'uuid', '@types/uuid', 'macos-version', 'normalize-url' and 'os-name' dependencies to latest
- updated 'macos-version' imports to named imports
-rw-r--r-- | package-lock.json | 147 | ||||
-rw-r--r-- | package.json | 10 | ||||
-rw-r--r-- | src/electron/macOSPermissions.js | 9 | ||||
-rw-r--r-- | src/helpers/userAgent-helpers.ts | 11 | ||||
-rw-r--r-- | src/internal-server/app/Controllers/Http/ServiceController.js | 6 | ||||
-rw-r--r-- | src/internal-server/app/Controllers/Http/UserController.js | 178 | ||||
-rw-r--r-- | src/internal-server/app/Controllers/Http/WorkspaceController.js | 57 | ||||
-rw-r--r-- | src/lib/Tray.js | 55 | ||||
-rw-r--r-- | src/webview/notifications.js | 19 | ||||
-rw-r--r-- | uidev/src/stories/input.stories.tsx | 66 | ||||
-rw-r--r-- | uidev/src/stories/select.stories.tsx | 31 | ||||
-rw-r--r-- | uidev/src/stories/textarea.stories.tsx | 25 | ||||
-rw-r--r-- | uidev/src/stories/toggle.stories.tsx | 46 |
13 files changed, 346 insertions, 314 deletions
diff --git a/package-lock.json b/package-lock.json index 8f302a8fe..4adabbe9b 100644 --- a/package-lock.json +++ b/package-lock.json | |||
@@ -104,6 +104,13 @@ | |||
104 | "ms": "^2.1.1", | 104 | "ms": "^2.1.1", |
105 | "resetable": "^1.0.3", | 105 | "resetable": "^1.0.3", |
106 | "uuid": "^3.3.2" | 106 | "uuid": "^3.3.2" |
107 | }, | ||
108 | "dependencies": { | ||
109 | "uuid": { | ||
110 | "version": "3.4.0", | ||
111 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", | ||
112 | "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" | ||
113 | } | ||
107 | } | 114 | } |
108 | }, | 115 | }, |
109 | "@adonisjs/bodyparser": { | 116 | "@adonisjs/bodyparser": { |
@@ -290,6 +297,11 @@ | |||
290 | "jsonfile": "^4.0.0", | 297 | "jsonfile": "^4.0.0", |
291 | "universalify": "^0.1.0" | 298 | "universalify": "^0.1.0" |
292 | } | 299 | } |
300 | }, | ||
301 | "uuid": { | ||
302 | "version": "3.4.0", | ||
303 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", | ||
304 | "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" | ||
293 | } | 305 | } |
294 | } | 306 | } |
295 | }, | 307 | }, |
@@ -304,6 +316,13 @@ | |||
304 | "node-csp": "^1.0.1", | 316 | "node-csp": "^1.0.1", |
305 | "node-guard": "^1.0.0", | 317 | "node-guard": "^1.0.0", |
306 | "uuid": "^3.3.2" | 318 | "uuid": "^3.3.2" |
319 | }, | ||
320 | "dependencies": { | ||
321 | "uuid": { | ||
322 | "version": "3.4.0", | ||
323 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", | ||
324 | "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" | ||
325 | } | ||
307 | } | 326 | } |
308 | }, | 327 | }, |
309 | "@adonisjs/validator": { | 328 | "@adonisjs/validator": { |
@@ -6733,9 +6752,9 @@ | |||
6733 | } | 6752 | } |
6734 | }, | 6753 | }, |
6735 | "@types/uuid": { | 6754 | "@types/uuid": { |
6736 | "version": "3.4.9", | 6755 | "version": "8.3.1", |
6737 | "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-3.4.9.tgz", | 6756 | "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.1.tgz", |
6738 | "integrity": "sha512-XDwyIlt/47l2kWLTzw/mtrpLdB+GPSskR2n/PIcPn+VYhVO77rGhRncIR5GPU0KRzXuqkDO+J5qqrG0Y8P6jzQ==", | 6757 | "integrity": "sha512-Y2mHTRAbqfFkpjldbkHGY8JIzRN6XqYRliG8/24FcHm2D2PwW24fl5xMRTVGdrb7iMrwCaIEbLWerGIkXuFWVg==", |
6739 | "dev": true | 6758 | "dev": true |
6740 | }, | 6759 | }, |
6741 | "@types/verror": { | 6760 | "@types/verror": { |
@@ -13939,18 +13958,18 @@ | |||
13939 | } | 13958 | } |
13940 | }, | 13959 | }, |
13941 | "execa": { | 13960 | "execa": { |
13942 | "version": "4.1.0", | 13961 | "version": "5.1.1", |
13943 | "resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz", | 13962 | "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", |
13944 | "integrity": "sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA==", | 13963 | "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", |
13945 | "requires": { | 13964 | "requires": { |
13946 | "cross-spawn": "^7.0.0", | 13965 | "cross-spawn": "^7.0.3", |
13947 | "get-stream": "^5.0.0", | 13966 | "get-stream": "^6.0.0", |
13948 | "human-signals": "^1.1.1", | 13967 | "human-signals": "^2.1.0", |
13949 | "is-stream": "^2.0.0", | 13968 | "is-stream": "^2.0.0", |
13950 | "merge-stream": "^2.0.0", | 13969 | "merge-stream": "^2.0.0", |
13951 | "npm-run-path": "^4.0.0", | 13970 | "npm-run-path": "^4.0.1", |
13952 | "onetime": "^5.1.0", | 13971 | "onetime": "^5.1.2", |
13953 | "signal-exit": "^3.0.2", | 13972 | "signal-exit": "^3.0.3", |
13954 | "strip-final-newline": "^2.0.0" | 13973 | "strip-final-newline": "^2.0.0" |
13955 | }, | 13974 | }, |
13956 | "dependencies": { | 13975 | "dependencies": { |
@@ -13965,12 +13984,9 @@ | |||
13965 | } | 13984 | } |
13966 | }, | 13985 | }, |
13967 | "get-stream": { | 13986 | "get-stream": { |
13968 | "version": "5.2.0", | 13987 | "version": "6.0.1", |
13969 | "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", | 13988 | "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", |
13970 | "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", | 13989 | "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==" |
13971 | "requires": { | ||
13972 | "pump": "^3.0.0" | ||
13973 | } | ||
13974 | }, | 13990 | }, |
13975 | "path-key": { | 13991 | "path-key": { |
13976 | "version": "3.1.1", | 13992 | "version": "3.1.1", |
@@ -16672,9 +16688,9 @@ | |||
16672 | } | 16688 | } |
16673 | }, | 16689 | }, |
16674 | "human-signals": { | 16690 | "human-signals": { |
16675 | "version": "1.1.1", | 16691 | "version": "2.1.0", |
16676 | "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", | 16692 | "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", |
16677 | "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==" | 16693 | "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==" |
16678 | }, | 16694 | }, |
16679 | "humanize-ms": { | 16695 | "humanize-ms": { |
16680 | "version": "1.2.1", | 16696 | "version": "1.2.1", |
@@ -19901,6 +19917,11 @@ | |||
19901 | "version": "2.0.0", | 19917 | "version": "2.0.0", |
19902 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", | 19918 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", |
19903 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" | 19919 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" |
19920 | }, | ||
19921 | "uuid": { | ||
19922 | "version": "3.4.0", | ||
19923 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", | ||
19924 | "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" | ||
19904 | } | 19925 | } |
19905 | } | 19926 | } |
19906 | }, | 19927 | }, |
@@ -20520,23 +20541,16 @@ | |||
20520 | } | 20541 | } |
20521 | }, | 20542 | }, |
20522 | "macos-release": { | 20543 | "macos-release": { |
20523 | "version": "2.5.0", | 20544 | "version": "3.0.0", |
20524 | "resolved": "https://registry.npmjs.org/macos-release/-/macos-release-2.5.0.tgz", | 20545 | "resolved": "https://registry.npmjs.org/macos-release/-/macos-release-3.0.0.tgz", |
20525 | "integrity": "sha512-EIgv+QZ9r+814gjJj0Bt5vSLJLzswGmSUbUpbi9AIr/fsN2IWFBl2NucV9PAiek+U1STK468tEkxmVYUtuAN3g==" | 20546 | "integrity": "sha512-y+uUjBt2D1YK0w8k0D19r6O8BYrCkSokWMaTJPvE68RjUOVYQmPXUD7Y4wGphM+/DEJNU+e46hl1lXOzPpvo+w==" |
20526 | }, | 20547 | }, |
20527 | "macos-version": { | 20548 | "macos-version": { |
20528 | "version": "5.2.1", | 20549 | "version": "6.0.0", |
20529 | "resolved": "https://registry.npmjs.org/macos-version/-/macos-version-5.2.1.tgz", | 20550 | "resolved": "https://registry.npmjs.org/macos-version/-/macos-version-6.0.0.tgz", |
20530 | "integrity": "sha512-OHJU8nTNxHYL1FQhD+nZawWgXKXAqDGr4kluLtaqKO4au3cR41y1mKuVShOU5U4rOYiuPanljq6oFGmV2B9DFA==", | 20551 | "integrity": "sha512-O2S8voA+pMfCHhBn/TIYDXzJ1qNHpPDU32oFxglKnVdJABiYYITt45oLkV9yhwA3E2FDwn3tQqUFrTsr1p3sBQ==", |
20531 | "requires": { | 20552 | "requires": { |
20532 | "semver": "^5.6.0" | 20553 | "semver": "^7.3.5" |
20533 | }, | ||
20534 | "dependencies": { | ||
20535 | "semver": { | ||
20536 | "version": "5.7.1", | ||
20537 | "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", | ||
20538 | "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" | ||
20539 | } | ||
20540 | } | 20554 | } |
20541 | }, | 20555 | }, |
20542 | "macroable": { | 20556 | "macroable": { |
@@ -22338,9 +22352,9 @@ | |||
22338 | "dev": true | 22352 | "dev": true |
22339 | }, | 22353 | }, |
22340 | "normalize-url": { | 22354 | "normalize-url": { |
22341 | "version": "6.1.0", | 22355 | "version": "7.0.1", |
22342 | "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", | 22356 | "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-7.0.1.tgz", |
22343 | "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==" | 22357 | "integrity": "sha512-WjLnBQVhYX5XRIectq7CEXgu7O13OB1vsj3rkVItD4c48G/JRD5dohJ1R5vVwZ5wI2/SJDNHfpdQ0Xsqbr1dhQ==" |
22344 | }, | 22358 | }, |
22345 | "normalize-version": { | 22359 | "normalize-version": { |
22346 | "version": "1.0.5", | 22360 | "version": "1.0.5", |
@@ -22970,12 +22984,12 @@ | |||
22970 | } | 22984 | } |
22971 | }, | 22985 | }, |
22972 | "os-name": { | 22986 | "os-name": { |
22973 | "version": "4.0.1", | 22987 | "version": "5.0.0", |
22974 | "resolved": "https://registry.npmjs.org/os-name/-/os-name-4.0.1.tgz", | 22988 | "resolved": "https://registry.npmjs.org/os-name/-/os-name-5.0.0.tgz", |
22975 | "integrity": "sha512-xl9MAoU97MH1Xt5K9ERft2YfCAoaO6msy1OBA0ozxEC0x0TmIoE6K3QvgJMMZA9yKGLmHXNY/YZoDbiGDj4zYw==", | 22989 | "integrity": "sha512-2NNINSnda99omAve/ayz0vIOwwS7fC1jNlutqxAcAsS8NXOGU3Rdku1lCm00fDNFdOMLd1YCVTNnfUsVs5471Q==", |
22976 | "requires": { | 22990 | "requires": { |
22977 | "macos-release": "^2.5.0", | 22991 | "macos-release": "^3.0.0", |
22978 | "windows-release": "^4.0.0" | 22992 | "windows-release": "^5.0.0" |
22979 | } | 22993 | } |
22980 | }, | 22994 | }, |
22981 | "os-tmpdir": { | 22995 | "os-tmpdir": { |
@@ -23409,6 +23423,14 @@ | |||
23409 | "normalize-url": "^6.1.0", | 23423 | "normalize-url": "^6.1.0", |
23410 | "parse-path": "^4.0.0", | 23424 | "parse-path": "^4.0.0", |
23411 | "protocols": "^1.4.0" | 23425 | "protocols": "^1.4.0" |
23426 | }, | ||
23427 | "dependencies": { | ||
23428 | "normalize-url": { | ||
23429 | "version": "6.1.0", | ||
23430 | "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", | ||
23431 | "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==", | ||
23432 | "dev": true | ||
23433 | } | ||
23412 | } | 23434 | } |
23413 | }, | 23435 | }, |
23414 | "parse5": { | 23436 | "parse5": { |
@@ -25557,6 +25579,11 @@ | |||
25557 | "version": "6.5.2", | 25579 | "version": "6.5.2", |
25558 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", | 25580 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", |
25559 | "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" | 25581 | "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" |
25582 | }, | ||
25583 | "uuid": { | ||
25584 | "version": "3.4.0", | ||
25585 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", | ||
25586 | "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" | ||
25560 | } | 25587 | } |
25561 | } | 25588 | } |
25562 | }, | 25589 | }, |
@@ -27522,6 +27549,12 @@ | |||
27522 | "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-1.0.0.tgz", | 27549 | "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-1.0.0.tgz", |
27523 | "integrity": "sha1-CnwOom06Oa+n4OvqnB/AvE2qAR0=", | 27550 | "integrity": "sha1-CnwOom06Oa+n4OvqnB/AvE2qAR0=", |
27524 | "dev": true | 27551 | "dev": true |
27552 | }, | ||
27553 | "uuid": { | ||
27554 | "version": "3.4.0", | ||
27555 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", | ||
27556 | "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", | ||
27557 | "dev": true | ||
27525 | } | 27558 | } |
27526 | } | 27559 | } |
27527 | }, | 27560 | }, |
@@ -27533,6 +27566,14 @@ | |||
27533 | "requires": { | 27566 | "requires": { |
27534 | "temp-dir": "^2.0.0", | 27567 | "temp-dir": "^2.0.0", |
27535 | "uuid": "^3.3.2" | 27568 | "uuid": "^3.3.2" |
27569 | }, | ||
27570 | "dependencies": { | ||
27571 | "uuid": { | ||
27572 | "version": "3.4.0", | ||
27573 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", | ||
27574 | "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", | ||
27575 | "dev": true | ||
27576 | } | ||
27536 | } | 27577 | } |
27537 | }, | 27578 | }, |
27538 | "terminal-link": { | 27579 | "terminal-link": { |
@@ -28790,9 +28831,9 @@ | |||
28790 | "dev": true | 28831 | "dev": true |
28791 | }, | 28832 | }, |
28792 | "uuid": { | 28833 | "uuid": { |
28793 | "version": "3.3.3", | 28834 | "version": "8.3.2", |
28794 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz", | 28835 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", |
28795 | "integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==" | 28836 | "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" |
28796 | }, | 28837 | }, |
28797 | "v8-compile-cache": { | 28838 | "v8-compile-cache": { |
28798 | "version": "2.3.0", | 28839 | "version": "2.3.0", |
@@ -29806,6 +29847,12 @@ | |||
29806 | "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.4.tgz", | 29847 | "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.4.tgz", |
29807 | "integrity": "sha512-hHUXGagefjN2iRrID63xckIvotOXOojhQKWIPUZ4mNUZ9nLZW+7FMNoE1lOkEhNWYsx/7ysGIuJYCiMAA9FnrA==", | 29848 | "integrity": "sha512-hHUXGagefjN2iRrID63xckIvotOXOojhQKWIPUZ4mNUZ9nLZW+7FMNoE1lOkEhNWYsx/7ysGIuJYCiMAA9FnrA==", |
29808 | "dev": true | 29849 | "dev": true |
29850 | }, | ||
29851 | "uuid": { | ||
29852 | "version": "3.4.0", | ||
29853 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", | ||
29854 | "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", | ||
29855 | "dev": true | ||
29809 | } | 29856 | } |
29810 | } | 29857 | } |
29811 | }, | 29858 | }, |
@@ -29968,11 +30015,11 @@ | |||
29968 | } | 30015 | } |
29969 | }, | 30016 | }, |
29970 | "windows-release": { | 30017 | "windows-release": { |
29971 | "version": "4.0.0", | 30018 | "version": "5.0.0", |
29972 | "resolved": "https://registry.npmjs.org/windows-release/-/windows-release-4.0.0.tgz", | 30019 | "resolved": "https://registry.npmjs.org/windows-release/-/windows-release-5.0.0.tgz", |
29973 | "integrity": "sha512-OxmV4wzDKB1x7AZaZgXMVsdJ1qER1ed83ZrTYd5Bwq2HfJVg3DJS8nqlAG4sMoJ7mu8cuRmLEYyU13BKwctRAg==", | 30020 | "integrity": "sha512-oiBC+rh4zgwD2E1WvsdcuaBlcNtO+bfoq4GT7sR36J8X+AZNJuXXf+5BjLflDqhEZty25SahBMYSEBhg/V8ikg==", |
29974 | "requires": { | 30021 | "requires": { |
29975 | "execa": "^4.0.2" | 30022 | "execa": "^5.1.1" |
29976 | } | 30023 | } |
29977 | }, | 30024 | }, |
29978 | "winreg": { | 30025 | "winreg": { |
diff --git a/package.json b/package.json index 7aa100668..3a448bae7 100644 --- a/package.json +++ b/package.json | |||
@@ -91,7 +91,7 @@ | |||
91 | "jss": "10.7.1", | 91 | "jss": "10.7.1", |
92 | "lodash": "4.17.21", | 92 | "lodash": "4.17.21", |
93 | "macos-notification-state": "1.3.5", | 93 | "macos-notification-state": "1.3.5", |
94 | "macos-version": "5.2.1", | 94 | "macos-version": "6.0.0", |
95 | "marked": "0.7.0", | 95 | "marked": "0.7.0", |
96 | "mime-types": "2.1.32", | 96 | "mime-types": "2.1.32", |
97 | "minimist": "1.2.5", | 97 | "minimist": "1.2.5", |
@@ -103,8 +103,8 @@ | |||
103 | "ms": "2.1.3", | 103 | "ms": "2.1.3", |
104 | "node-fetch": "2.6.1", | 104 | "node-fetch": "2.6.1", |
105 | "node-mac-permissions": "2.2.0", | 105 | "node-mac-permissions": "2.2.0", |
106 | "normalize-url": "6.1.0", | 106 | "normalize-url": "7.0.1", |
107 | "os-name": "4.0.1", | 107 | "os-name": "5.0.0", |
108 | "pretty-bytes": "5.6.0", | 108 | "pretty-bytes": "5.6.0", |
109 | "prop-types": "15.7.2", | 109 | "prop-types": "15.7.2", |
110 | "react": "16.14.0", | 110 | "react": "16.14.0", |
@@ -126,7 +126,7 @@ | |||
126 | "tar": "4.4.15", | 126 | "tar": "4.4.15", |
127 | "tslib": "2.3.1", | 127 | "tslib": "2.3.1", |
128 | "useragent-generator": "1.1.1-amkt-22079-finish.0", | 128 | "useragent-generator": "1.1.1-amkt-22079-finish.0", |
129 | "uuid": "3.3.3", | 129 | "uuid": "8.3.2", |
130 | "validator": "11.0.0", | 130 | "validator": "11.0.0", |
131 | "ws": "7.4.6" | 131 | "ws": "7.4.6" |
132 | }, | 132 | }, |
@@ -155,7 +155,7 @@ | |||
155 | "@types/react-dom": "16.9.13", | 155 | "@types/react-dom": "16.9.13", |
156 | "@types/route-parser": "0.1.3", | 156 | "@types/route-parser": "0.1.3", |
157 | "@types/tar": "4.0.5", | 157 | "@types/tar": "4.0.5", |
158 | "@types/uuid": "3.4.9", | 158 | "@types/uuid": "8.3.1", |
159 | "@typescript-eslint/eslint-plugin": "4.29.1", | 159 | "@typescript-eslint/eslint-plugin": "4.29.1", |
160 | "@typescript-eslint/parser": "4.29.1", | 160 | "@typescript-eslint/parser": "4.29.1", |
161 | "all-contributors-cli": "6.20.0", | 161 | "all-contributors-cli": "6.20.0", |
diff --git a/src/electron/macOSPermissions.js b/src/electron/macOSPermissions.js index 887af2903..fc2f9b72d 100644 --- a/src/electron/macOSPermissions.js +++ b/src/electron/macOSPermissions.js | |||
@@ -1,14 +1,17 @@ | |||
1 | import { systemPreferences, dialog } from 'electron'; | 1 | import { systemPreferences, dialog } from 'electron'; |
2 | import { pathExistsSync, mkdirSync, writeFileSync } from 'fs-extra'; | 2 | import { pathExistsSync, mkdirSync, writeFileSync } from 'fs-extra'; |
3 | import macosVersion from 'macos-version'; | 3 | import { isMacOSVersionGreaterThanOrEqualTo } from 'macos-version'; |
4 | import { dirname } from 'path'; | 4 | import { dirname } from 'path'; |
5 | import { askForScreenCaptureAccess } from 'node-mac-permissions'; | 5 | import { askForScreenCaptureAccess } from 'node-mac-permissions'; |
6 | import { userDataPath } from '../environment'; | 6 | import { userDataPath } from '../environment'; |
7 | 7 | ||
8 | const debug = require('debug')('Ferdi:macOSPermissions'); | 8 | const debug = require('debug')('Ferdi:macOSPermissions'); |
9 | 9 | ||
10 | const isExplicitScreenCapturePermissionReqd = macosVersion.isGreaterThanOrEqualTo('10.15'); | 10 | const isExplicitScreenCapturePermissionReqd = |
11 | debug(`Should check explicitly for screen-capture permissions: ${isExplicitScreenCapturePermissionReqd}`); | 11 | isMacOSVersionGreaterThanOrEqualTo('10.15'); |
12 | debug( | ||
13 | `Should check explicitly for screen-capture permissions: ${isExplicitScreenCapturePermissionReqd}`, | ||
14 | ); | ||
12 | 15 | ||
13 | const filePath = userDataPath('.has-app-requested-screen-capture-permissions'); | 16 | const filePath = userDataPath('.has-app-requested-screen-capture-permissions'); |
14 | 17 | ||
diff --git a/src/helpers/userAgent-helpers.ts b/src/helpers/userAgent-helpers.ts index 73c8bfd03..dea49ad7e 100644 --- a/src/helpers/userAgent-helpers.ts +++ b/src/helpers/userAgent-helpers.ts | |||
@@ -1,12 +1,17 @@ | |||
1 | import os from 'os'; | 1 | import os from 'os'; |
2 | import macosVersion from 'macos-version'; | 2 | import { macOSVersion } from 'macos-version'; |
3 | import { chrome } from 'useragent-generator'; | 3 | import { chrome } from 'useragent-generator'; |
4 | import { | 4 | import { |
5 | chromeVersion, isMac, isWindows, is64Bit, osArch, osRelease, | 5 | chromeVersion, |
6 | isMac, | ||
7 | isWindows, | ||
8 | is64Bit, | ||
9 | osArch, | ||
10 | osRelease, | ||
6 | } from '../environment'; | 11 | } from '../environment'; |
7 | 12 | ||
8 | function macOS() { | 13 | function macOS() { |
9 | const version = macosVersion() || ''; | 14 | const version = macOSVersion() || ''; |
10 | let cpuName = os.cpus()[0].model.split(' ')[0]; | 15 | let cpuName = os.cpus()[0].model.split(' ')[0]; |
11 | if (cpuName && cpuName.match(/\(/)) { | 16 | if (cpuName && cpuName.match(/\(/)) { |
12 | cpuName = cpuName.split('(')[0]; | 17 | cpuName = cpuName.split('(')[0]; |
diff --git a/src/internal-server/app/Controllers/Http/ServiceController.js b/src/internal-server/app/Controllers/Http/ServiceController.js index c76a287f7..dea5a888e 100644 --- a/src/internal-server/app/Controllers/Http/ServiceController.js +++ b/src/internal-server/app/Controllers/Http/ServiceController.js | |||
@@ -2,7 +2,7 @@ const Service = use('App/Models/Service'); | |||
2 | const { validateAll } = use('Validator'); | 2 | const { validateAll } = use('Validator'); |
3 | const Env = use('Env'); | 3 | const Env = use('Env'); |
4 | 4 | ||
5 | const uuid = require('uuid/v4'); | 5 | const { v4: uuid } = require('uuid'); |
6 | const path = require('path'); | 6 | const path = require('path'); |
7 | const fs = require('fs-extra'); | 7 | const fs = require('fs-extra'); |
8 | const { LOCAL_HOSTNAME } = require('../../../../config'); | 8 | const { LOCAL_HOSTNAME } = require('../../../../config'); |
@@ -156,9 +156,7 @@ class ServiceController { | |||
156 | id, | 156 | id, |
157 | name: service.name, | 157 | name: service.name, |
158 | ...newSettings, | 158 | ...newSettings, |
159 | iconUrl: `http://${hostname}:${port}/v1/icon/${ | 159 | iconUrl: `http://${hostname}:${port}/v1/icon/${newSettings.iconId}`, |
160 | newSettings.iconId | ||
161 | }`, | ||
162 | userId: 1, | 160 | userId: 1, |
163 | }, | 161 | }, |
164 | status: ['updated'], | 162 | status: ['updated'], |
diff --git a/src/internal-server/app/Controllers/Http/UserController.js b/src/internal-server/app/Controllers/Http/UserController.js index a3ad736fa..e387e39c4 100644 --- a/src/internal-server/app/Controllers/Http/UserController.js +++ b/src/internal-server/app/Controllers/Http/UserController.js | |||
@@ -1,41 +1,38 @@ | |||
1 | const User = use('App/Models/User'); | 1 | const User = use('App/Models/User'); |
2 | const Service = use('App/Models/Service'); | 2 | const Service = use('App/Models/Service'); |
3 | const Workspace = use('App/Models/Workspace'); | 3 | const Workspace = use('App/Models/Workspace'); |
4 | const { | 4 | const { validateAll } = use('Validator'); |
5 | validateAll, | ||
6 | } = use('Validator'); | ||
7 | 5 | ||
8 | const btoa = require('btoa'); | 6 | const btoa = require('btoa'); |
9 | const fetch = require('node-fetch'); | 7 | const fetch = require('node-fetch'); |
10 | const uuid = require('uuid/v4'); | 8 | const { v4: uuid } = require('uuid'); |
11 | const crypto = require('crypto'); | 9 | const crypto = require('crypto'); |
12 | const { DEFAULT_APP_SETTINGS } = require('../../../../environment'); | 10 | const { DEFAULT_APP_SETTINGS } = require('../../../../environment'); |
13 | 11 | ||
14 | const apiRequest = (url, route, method, auth) => new Promise((resolve, reject) => { | 12 | const apiRequest = (url, route, method, auth) => |
15 | const base = `${url}/v1/`; | 13 | new Promise((resolve, reject) => { |
16 | const user = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Ferdi/5.3.0-beta.1 Chrome/69.0.3497.128 Electron/4.2.4 Safari/537.36'; | 14 | const base = `${url}/v1/`; |
15 | const user = | ||
16 | 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Ferdi/5.3.0-beta.1 Chrome/69.0.3497.128 Electron/4.2.4 Safari/537.36'; | ||
17 | 17 | ||
18 | try { | 18 | try { |
19 | fetch(base + route, { | 19 | fetch(base + route, { |
20 | method, | 20 | method, |
21 | headers: { | 21 | headers: { |
22 | Authorization: `Bearer ${auth}`, | 22 | Authorization: `Bearer ${auth}`, |
23 | 'User-Agent': user, | 23 | 'User-Agent': user, |
24 | }, | 24 | }, |
25 | }) | 25 | }) |
26 | .then(data => data.json()) | 26 | .then(data => data.json()) |
27 | .then(json => resolve(json)); | 27 | .then(json => resolve(json)); |
28 | } catch (e) { | 28 | } catch (e) { |
29 | reject(); | 29 | reject(); |
30 | } | 30 | } |
31 | }); | 31 | }); |
32 | 32 | ||
33 | class UserController { | 33 | class UserController { |
34 | // Register a new user | 34 | // Register a new user |
35 | async signup({ | 35 | async signup({ request, response }) { |
36 | request, | ||
37 | response, | ||
38 | }) { | ||
39 | // Validate user input | 36 | // Validate user input |
40 | const validation = await validateAll(request.all(), { | 37 | const validation = await validateAll(request.all(), { |
41 | firstname: 'required', | 38 | firstname: 'required', |
@@ -52,15 +49,13 @@ class UserController { | |||
52 | 49 | ||
53 | return response.send({ | 50 | return response.send({ |
54 | message: 'Successfully created account', | 51 | message: 'Successfully created account', |
55 | token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJGZXJkaSBJbnRlcm5hbCBTZXJ2ZXIiLCJpYXQiOjE1NzEwNDAyMTUsImV4cCI6MjUzMzk1NDE3ODQ0LCJhdWQiOiJnZXRmZXJkaS5jb20iLCJzdWIiOiJmZXJkaUBsb2NhbGhvc3QiLCJ1c2VySWQiOiIxIn0.9_TWFGp6HROv8Yg82Rt6i1-95jqWym40a-HmgrdMC6M', | 52 | token: |
53 | 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJGZXJkaSBJbnRlcm5hbCBTZXJ2ZXIiLCJpYXQiOjE1NzEwNDAyMTUsImV4cCI6MjUzMzk1NDE3ODQ0LCJhdWQiOiJnZXRmZXJkaS5jb20iLCJzdWIiOiJmZXJkaUBsb2NhbGhvc3QiLCJ1c2VySWQiOiIxIn0.9_TWFGp6HROv8Yg82Rt6i1-95jqWym40a-HmgrdMC6M', | ||
56 | }); | 54 | }); |
57 | } | 55 | } |
58 | 56 | ||
59 | // Login using an existing user | 57 | // Login using an existing user |
60 | async login({ | 58 | async login({ request, response }) { |
61 | request, | ||
62 | response, | ||
63 | }) { | ||
64 | if (!request.header('Authorization')) { | 59 | if (!request.header('Authorization')) { |
65 | return response.status(401).send({ | 60 | return response.status(401).send({ |
66 | message: 'Please provide authorization', | 61 | message: 'Please provide authorization', |
@@ -70,17 +65,19 @@ class UserController { | |||
70 | 65 | ||
71 | return response.send({ | 66 | return response.send({ |
72 | message: 'Successfully logged in', | 67 | message: 'Successfully logged in', |
73 | token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJGZXJkaSBJbnRlcm5hbCBTZXJ2ZXIiLCJpYXQiOjE1NzEwNDAyMTUsImV4cCI6MjUzMzk1NDE3ODQ0LCJhdWQiOiJnZXRmZXJkaS5jb20iLCJzdWIiOiJmZXJkaUBsb2NhbGhvc3QiLCJ1c2VySWQiOiIxIn0.9_TWFGp6HROv8Yg82Rt6i1-95jqWym40a-HmgrdMC6M', | 68 | token: |
69 | 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJGZXJkaSBJbnRlcm5hbCBTZXJ2ZXIiLCJpYXQiOjE1NzEwNDAyMTUsImV4cCI6MjUzMzk1NDE3ODQ0LCJhdWQiOiJnZXRmZXJkaS5jb20iLCJzdWIiOiJmZXJkaUBsb2NhbGhvc3QiLCJ1c2VySWQiOiIxIn0.9_TWFGp6HROv8Yg82Rt6i1-95jqWym40a-HmgrdMC6M', | ||
74 | }); | 70 | }); |
75 | } | 71 | } |
76 | 72 | ||
77 | // Return information about the current user | 73 | // Return information about the current user |
78 | async me({ | 74 | async me({ response }) { |
79 | response, | ||
80 | }) { | ||
81 | const user = await User.find(1); | 75 | const user = await User.find(1); |
82 | 76 | ||
83 | const settings = typeof user.settings === 'string' ? JSON.parse(user.settings) : user.settings; | 77 | const settings = |
78 | typeof user.settings === 'string' | ||
79 | ? JSON.parse(user.settings) | ||
80 | : user.settings; | ||
84 | 81 | ||
85 | return response.send({ | 82 | return response.send({ |
86 | accountType: 'individual', | 83 | accountType: 'individual', |
@@ -94,14 +91,11 @@ class UserController { | |||
94 | isSubscriptionOwner: true, | 91 | isSubscriptionOwner: true, |
95 | lastname: 'Application', | 92 | lastname: 'Application', |
96 | locale: DEFAULT_APP_SETTINGS.fallbackLocale, | 93 | locale: DEFAULT_APP_SETTINGS.fallbackLocale, |
97 | ...settings || {}, | 94 | ...(settings || {}), |
98 | }); | 95 | }); |
99 | } | 96 | } |
100 | 97 | ||
101 | async updateMe({ | 98 | async updateMe({ request, response }) { |
102 | request, | ||
103 | response, | ||
104 | }) { | ||
105 | const user = await User.find(1); | 99 | const user = await User.find(1); |
106 | 100 | ||
107 | let settings = user.settings || {}; | 101 | let settings = user.settings || {}; |
@@ -132,16 +126,11 @@ class UserController { | |||
132 | locale: DEFAULT_APP_SETTINGS.fallbackLocale, | 126 | locale: DEFAULT_APP_SETTINGS.fallbackLocale, |
133 | ...newSettings, | 127 | ...newSettings, |
134 | }, | 128 | }, |
135 | status: [ | 129 | status: ['data-updated'], |
136 | 'data-updated', | ||
137 | ], | ||
138 | }); | 130 | }); |
139 | } | 131 | } |
140 | 132 | ||
141 | async import({ | 133 | async import({ request, response }) { |
142 | request, | ||
143 | response, | ||
144 | }) { | ||
145 | // Validate user input | 134 | // Validate user input |
146 | const validation = await validateAll(request.all(), { | 135 | const validation = await validateAll(request.all(), { |
147 | email: 'required|email', | 136 | email: 'required|email', |
@@ -149,7 +138,8 @@ class UserController { | |||
149 | server: 'required', | 138 | server: 'required', |
150 | }); | 139 | }); |
151 | if (validation.fails()) { | 140 | if (validation.fails()) { |
152 | let errorMessage = 'There was an error while trying to import your account:\n'; | 141 | let errorMessage = |
142 | 'There was an error while trying to import your account:\n'; | ||
153 | for (const message of validation.messages()) { | 143 | for (const message of validation.messages()) { |
154 | if (message.validation === 'required') { | 144 | if (message.validation === 'required') { |
155 | errorMessage += `- Please make sure to supply your ${message.field}\n`; | 145 | errorMessage += `- Please make sure to supply your ${message.field}\n`; |
@@ -162,16 +152,16 @@ class UserController { | |||
162 | return response.status(401).send(errorMessage); | 152 | return response.status(401).send(errorMessage); |
163 | } | 153 | } |
164 | 154 | ||
165 | const { | 155 | const { email, password, server } = request.all(); |
166 | email, | ||
167 | password, | ||
168 | server, | ||
169 | } = request.all(); | ||
170 | 156 | ||
171 | const hashedPassword = crypto.createHash('sha256').update(password).digest('base64'); | 157 | const hashedPassword = crypto |
158 | .createHash('sha256') | ||
159 | .update(password) | ||
160 | .digest('base64'); | ||
172 | 161 | ||
173 | const base = `${server}/v1/`; | 162 | const base = `${server}/v1/`; |
174 | const userAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Ferdi/5.3.0-beta.1 Chrome/69.0.3497.128 Electron/4.2.4 Safari/537.36'; | 163 | const userAgent = |
164 | 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Ferdi/5.3.0-beta.1 Chrome/69.0.3497.128 Electron/4.2.4 Safari/537.36'; | ||
175 | 165 | ||
176 | // Try to get an authentication token | 166 | // Try to get an authentication token |
177 | let token; | 167 | let token; |
@@ -188,7 +178,8 @@ class UserController { | |||
188 | const content = await rawResponse.json(); | 178 | const content = await rawResponse.json(); |
189 | 179 | ||
190 | if (!content.message || content.message !== 'Successfully logged in') { | 180 | if (!content.message || content.message !== 'Successfully logged in') { |
191 | const errorMessage = 'Could not login into Franz with your supplied credentials. Please check and try again'; | 181 | const errorMessage = |
182 | 'Could not login into Franz with your supplied credentials. Please check and try again'; | ||
192 | return response.status(401).send(errorMessage); | 183 | return response.status(401).send(errorMessage); |
193 | } | 184 | } |
194 | 185 | ||
@@ -210,7 +201,8 @@ class UserController { | |||
210 | return response.status(401).send(errorMessage); | 201 | return response.status(401).send(errorMessage); |
211 | } | 202 | } |
212 | if (!userInf) { | 203 | if (!userInf) { |
213 | const errorMessage = 'Could not get your user info from Franz. Please check your credentials or try again later'; | 204 | const errorMessage = |
205 | 'Could not get your user info from Franz. Please check your credentials or try again later'; | ||
214 | return response.status(401).send(errorMessage); | 206 | return response.status(401).send(errorMessage); |
215 | } | 207 | } |
216 | 208 | ||
@@ -225,9 +217,14 @@ class UserController { | |||
225 | let serviceId; | 217 | let serviceId; |
226 | do { | 218 | do { |
227 | serviceId = uuid(); | 219 | serviceId = uuid(); |
228 | } while ((await Service.query().where('serviceId', serviceId).fetch()).rows.length > 0); // eslint-disable-line no-await-in-loop | 220 | } while ( |
229 | 221 | // eslint-disable-next-line no-await-in-loop | |
230 | await Service.create({ // eslint-disable-line no-await-in-loop | 222 | (await Service.query().where('serviceId', serviceId).fetch()).rows |
223 | .length > 0 | ||
224 | ); | ||
225 | |||
226 | // eslint-disable-next-line no-await-in-loop | ||
227 | await Service.create({ | ||
231 | serviceId, | 228 | serviceId, |
232 | name: service.name, | 229 | name: service.name, |
233 | recipeId: service.recipeId, | 230 | recipeId: service.recipeId, |
@@ -249,11 +246,18 @@ class UserController { | |||
249 | let workspaceId; | 246 | let workspaceId; |
250 | do { | 247 | do { |
251 | workspaceId = uuid(); | 248 | workspaceId = uuid(); |
252 | } while ((await Workspace.query().where('workspaceId', workspaceId).fetch()).rows.length > 0); // eslint-disable-line no-await-in-loop | 249 | } while ( |
253 | 250 | // eslint-disable-next-line no-await-in-loop | |
254 | const services = workspace.services.map(service => serviceIdTranslation[service]); | 251 | (await Workspace.query().where('workspaceId', workspaceId).fetch()) |
255 | 252 | .rows.length > 0 | |
256 | await Workspace.create({ // eslint-disable-line no-await-in-loop | 253 | ); |
254 | |||
255 | const services = workspace.services.map( | ||
256 | service => serviceIdTranslation[service], | ||
257 | ); | ||
258 | |||
259 | // eslint-disable-next-line no-await-in-loop | ||
260 | await Workspace.create({ | ||
257 | workspaceId, | 261 | workspaceId, |
258 | name: workspace.name, | 262 | name: workspace.name, |
259 | order: workspace.order, | 263 | order: workspace.order, |
@@ -266,7 +270,9 @@ class UserController { | |||
266 | return response.status(401).send(errorMessage); | 270 | return response.status(401).send(errorMessage); |
267 | } | 271 | } |
268 | 272 | ||
269 | return response.send('Your account has been imported. You can now use your Franz account in Ferdi.'); | 273 | return response.send( |
274 | 'Your account has been imported. You can now use your Franz account in Ferdi.', | ||
275 | ); | ||
270 | } | 276 | } |
271 | 277 | ||
272 | // Account import/export | 278 | // Account import/export |
@@ -291,10 +297,7 @@ class UserController { | |||
291 | .send(exportData); | 297 | .send(exportData); |
292 | } | 298 | } |
293 | 299 | ||
294 | async importFerdi({ | 300 | async importFerdi({ request, response }) { |
295 | request, | ||
296 | response, | ||
297 | }) { | ||
298 | const validation = await validateAll(request.all(), { | 301 | const validation = await validateAll(request.all(), { |
299 | file: 'required', | 302 | file: 'required', |
300 | }); | 303 | }); |
@@ -306,7 +309,9 @@ class UserController { | |||
306 | try { | 309 | try { |
307 | file = JSON.parse(request.input('file')); | 310 | file = JSON.parse(request.input('file')); |
308 | } catch (e) { | 311 | } catch (e) { |
309 | return response.send('Could not import: Invalid file, could not read file'); | 312 | return response.send( |
313 | 'Could not import: Invalid file, could not read file', | ||
314 | ); | ||
310 | } | 315 | } |
311 | 316 | ||
312 | if (!file || !file.services || !file.workspaces) { | 317 | if (!file || !file.services || !file.workspaces) { |
@@ -322,9 +327,14 @@ class UserController { | |||
322 | let serviceId; | 327 | let serviceId; |
323 | do { | 328 | do { |
324 | serviceId = uuid(); | 329 | serviceId = uuid(); |
325 | } while ((await Service.query().where('serviceId', serviceId).fetch()).rows.length > 0); // eslint-disable-line no-await-in-loop | 330 | } while ( |
326 | 331 | // eslint-disable-next-line no-await-in-loop | |
327 | await Service.create({ // eslint-disable-line no-await-in-loop | 332 | (await Service.query().where('serviceId', serviceId).fetch()).rows |
333 | .length > 0 | ||
334 | ); | ||
335 | |||
336 | // eslint-disable-next-line no-await-in-loop | ||
337 | await Service.create({ | ||
328 | serviceId, | 338 | serviceId, |
329 | name: service.name, | 339 | name: service.name, |
330 | recipeId: service.recipeId, | 340 | recipeId: service.recipeId, |
@@ -344,13 +354,19 @@ class UserController { | |||
344 | let workspaceId; | 354 | let workspaceId; |
345 | do { | 355 | do { |
346 | workspaceId = uuid(); | 356 | workspaceId = uuid(); |
347 | } while ((await Workspace.query().where('workspaceId', workspaceId).fetch()).rows.length > 0); // eslint-disable-line no-await-in-loop | 357 | } while ( |
348 | 358 | // eslint-disable-next-line no-await-in-loop | |
349 | const services = (workspace.services && typeof (workspace.services) === 'object') ? | 359 | (await Workspace.query().where('workspaceId', workspaceId).fetch()) |
350 | workspace.services.map((service) => serviceIdTranslation[service]) : | 360 | .rows.length > 0 |
351 | []; | 361 | ); |
352 | 362 | ||
353 | await Workspace.create({ // eslint-disable-line no-await-in-loop | 363 | const services = |
364 | workspace.services && typeof workspace.services === 'object' | ||
365 | ? workspace.services.map(service => serviceIdTranslation[service]) | ||
366 | : []; | ||
367 | |||
368 | // eslint-disable-next-line no-await-in-loop | ||
369 | await Workspace.create({ | ||
354 | workspaceId, | 370 | workspaceId, |
355 | name: workspace.name, | 371 | name: workspace.name, |
356 | order: workspace.order, | 372 | order: workspace.order, |
diff --git a/src/internal-server/app/Controllers/Http/WorkspaceController.js b/src/internal-server/app/Controllers/Http/WorkspaceController.js index 4189fbcdd..f1a5ddf2b 100644 --- a/src/internal-server/app/Controllers/Http/WorkspaceController.js +++ b/src/internal-server/app/Controllers/Http/WorkspaceController.js | |||
@@ -1,16 +1,11 @@ | |||
1 | const Workspace = use('App/Models/Workspace'); | 1 | const Workspace = use('App/Models/Workspace'); |
2 | const { | 2 | const { validateAll } = use('Validator'); |
3 | validateAll, | ||
4 | } = use('Validator'); | ||
5 | 3 | ||
6 | const uuid = require('uuid/v4'); | 4 | const { v4: uuid } = require('uuid'); |
7 | 5 | ||
8 | class WorkspaceController { | 6 | class WorkspaceController { |
9 | // Create a new workspace for user | 7 | // Create a new workspace for user |
10 | async create({ | 8 | async create({ request, response }) { |
11 | request, | ||
12 | response, | ||
13 | }) { | ||
14 | // Validate user input | 9 | // Validate user input |
15 | const validation = await validateAll(request.all(), { | 10 | const validation = await validateAll(request.all(), { |
16 | name: 'required', | 11 | name: 'required', |
@@ -29,7 +24,10 @@ class WorkspaceController { | |||
29 | let workspaceId; | 24 | let workspaceId; |
30 | do { | 25 | do { |
31 | workspaceId = uuid(); | 26 | workspaceId = uuid(); |
32 | } while ((await Workspace.query().where('workspaceId', workspaceId).fetch()).rows.length > 0); // eslint-disable-line no-await-in-loop | 27 | } while ( |
28 | (await Workspace.query().where('workspaceId', workspaceId).fetch()).rows | ||
29 | .length > 0 | ||
30 | ); // eslint-disable-line no-await-in-loop | ||
33 | 31 | ||
34 | const order = (await Workspace.all()).rows.length; | 32 | const order = (await Workspace.all()).rows.length; |
35 | 33 | ||
@@ -50,11 +48,7 @@ class WorkspaceController { | |||
50 | }); | 48 | }); |
51 | } | 49 | } |
52 | 50 | ||
53 | async edit({ | 51 | async edit({ request, response, params }) { |
54 | request, | ||
55 | response, | ||
56 | params, | ||
57 | }) { | ||
58 | // Validate user input | 52 | // Validate user input |
59 | const validation = await validateAll(request.all(), { | 53 | const validation = await validateAll(request.all(), { |
60 | name: 'required', | 54 | name: 'required', |
@@ -69,20 +63,19 @@ class WorkspaceController { | |||
69 | } | 63 | } |
70 | 64 | ||
71 | const data = request.all(); | 65 | const data = request.all(); |
72 | const { | 66 | const { id } = params; |
73 | id, | ||
74 | } = params; | ||
75 | 67 | ||
76 | // Update data in database | 68 | // Update data in database |
77 | await (Workspace.query() | 69 | await Workspace.query() |
78 | .where('workspaceId', id)).update({ | 70 | .where('workspaceId', id) |
79 | name: data.name, | 71 | .update({ |
80 | services: JSON.stringify(data.services), | 72 | name: data.name, |
81 | }); | 73 | services: JSON.stringify(data.services), |
74 | }); | ||
82 | 75 | ||
83 | // Get updated row | 76 | // Get updated row |
84 | const workspace = (await Workspace.query() | 77 | const workspace = (await Workspace.query().where('workspaceId', id).fetch()) |
85 | .where('workspaceId', id).fetch()).rows[0]; | 78 | .rows[0]; |
86 | 79 | ||
87 | return response.send({ | 80 | return response.send({ |
88 | id: workspace.workspaceId, | 81 | id: workspace.workspaceId, |
@@ -111,13 +104,10 @@ class WorkspaceController { | |||
111 | }); | 104 | }); |
112 | } | 105 | } |
113 | 106 | ||
114 | const { | 107 | const { id } = params; |
115 | id, | ||
116 | } = params; | ||
117 | 108 | ||
118 | // Update data in database | 109 | // Update data in database |
119 | await (Workspace.query() | 110 | await Workspace.query().where('workspaceId', id).delete(); |
120 | .where('workspaceId', id)).delete(); | ||
121 | 111 | ||
122 | return response.send({ | 112 | return response.send({ |
123 | message: 'Successfully deleted workspace', | 113 | message: 'Successfully deleted workspace', |
@@ -125,9 +115,7 @@ class WorkspaceController { | |||
125 | } | 115 | } |
126 | 116 | ||
127 | // List all workspaces a user has created | 117 | // List all workspaces a user has created |
128 | async list({ | 118 | async list({ response }) { |
129 | response, | ||
130 | }) { | ||
131 | const workspaces = (await Workspace.all()).rows; | 119 | const workspaces = (await Workspace.all()).rows; |
132 | // Convert to array with all data Franz wants | 120 | // Convert to array with all data Franz wants |
133 | let workspacesArray = []; | 121 | let workspacesArray = []; |
@@ -136,7 +124,10 @@ class WorkspaceController { | |||
136 | id: workspace.workspaceId, | 124 | id: workspace.workspaceId, |
137 | name: workspace.name, | 125 | name: workspace.name, |
138 | order: workspace.order, | 126 | order: workspace.order, |
139 | services: typeof workspace.services === 'string' ? JSON.parse(workspace.services) : workspace.services, | 127 | services: |
128 | typeof workspace.services === 'string' | ||
129 | ? JSON.parse(workspace.services) | ||
130 | : workspace.services, | ||
140 | userId: 1, | 131 | userId: 1, |
141 | })); | 132 | })); |
142 | } | 133 | } |
diff --git a/src/lib/Tray.js b/src/lib/Tray.js index f5970f7e7..c629e212d 100644 --- a/src/lib/Tray.js +++ b/src/lib/Tray.js | |||
@@ -1,8 +1,14 @@ | |||
1 | import { | 1 | import { |
2 | app, Menu, nativeImage, nativeTheme, systemPreferences, Tray, ipcMain, | 2 | app, |
3 | Menu, | ||
4 | nativeImage, | ||
5 | nativeTheme, | ||
6 | systemPreferences, | ||
7 | Tray, | ||
8 | ipcMain, | ||
3 | } from 'electron'; | 9 | } from 'electron'; |
4 | import { join } from 'path'; | 10 | import { join } from 'path'; |
5 | import macosVersion from 'macos-version'; | 11 | import { isMacOSVersionGreaterThanOrEqualTo } from 'macos-version'; |
6 | import { isMac, isWindows, isLinux } from '../environment'; | 12 | import { isMac, isWindows, isLinux } from '../environment'; |
7 | 13 | ||
8 | const FILE_EXTENSION = isWindows ? 'ico' : 'png'; | 14 | const FILE_EXTENSION = isWindows ? 'ico' : 'png'; |
@@ -64,7 +70,9 @@ export default class TrayIcon { | |||
64 | 70 | ||
65 | if (appSettings.type === 'app') { | 71 | if (appSettings.type === 'app') { |
66 | const { isAppMuted } = appSettings.data; | 72 | const { isAppMuted } = appSettings.data; |
67 | this.trayMenuTemplate[1].label = isAppMuted ? 'Enable Notifications && Audio' : 'Disable Notifications && Audio'; | 73 | this.trayMenuTemplate[1].label = isAppMuted |
74 | ? 'Enable Notifications && Audio' | ||
75 | : 'Disable Notifications && Audio'; | ||
68 | this.trayMenu = Menu.buildFromTemplate(this.trayMenuTemplate); | 76 | this.trayMenu = Menu.buildFromTemplate(this.trayMenuTemplate); |
69 | if (isLinux) { | 77 | if (isLinux) { |
70 | this.trayIcon.setContextMenu(this.trayMenu); | 78 | this.trayIcon.setContextMenu(this.trayMenu); |
@@ -107,9 +115,12 @@ export default class TrayIcon { | |||
107 | } | 115 | } |
108 | 116 | ||
109 | if (isMac) { | 117 | if (isMac) { |
110 | this.themeChangeSubscriberId = systemPreferences.subscribeNotification('AppleInterfaceThemeChangedNotification', () => { | 118 | this.themeChangeSubscriberId = systemPreferences.subscribeNotification( |
111 | this._refreshIcon(); | 119 | 'AppleInterfaceThemeChangedNotification', |
112 | }); | 120 | () => { |
121 | this._refreshIcon(); | ||
122 | }, | ||
123 | ); | ||
113 | } | 124 | } |
114 | } | 125 | } |
115 | 126 | ||
@@ -149,7 +160,8 @@ export default class TrayIcon { | |||
149 | _getAssetFromIndicator(indicator) { | 160 | _getAssetFromIndicator(indicator) { |
150 | if (indicator === '•') { | 161 | if (indicator === '•') { |
151 | return INDICATOR_TRAY_INDIRECT; | 162 | return INDICATOR_TRAY_INDIRECT; |
152 | } if (indicator !== 0) { | 163 | } |
164 | if (indicator !== 0) { | ||
153 | return INDICATOR_TRAY_UNREAD; | 165 | return INDICATOR_TRAY_UNREAD; |
154 | } | 166 | } |
155 | return INDICATOR_TRAY_PLAIN; | 167 | return INDICATOR_TRAY_PLAIN; |
@@ -158,11 +170,16 @@ export default class TrayIcon { | |||
158 | _refreshIcon() { | 170 | _refreshIcon() { |
159 | if (!this.trayIcon) return; | 171 | if (!this.trayIcon) return; |
160 | 172 | ||
161 | this.trayIcon.setImage(this._getAsset('tray', this._getAssetFromIndicator(this.indicator))); | 173 | this.trayIcon.setImage( |
174 | this._getAsset('tray', this._getAssetFromIndicator(this.indicator)), | ||
175 | ); | ||
162 | 176 | ||
163 | if (isMac) { | 177 | if (isMac) { |
164 | this.trayIcon.setPressedImage( | 178 | this.trayIcon.setPressedImage( |
165 | this._getAsset('tray', `${this._getAssetFromIndicator(this.indicator)}-active`), | 179 | this._getAsset( |
180 | 'tray', | ||
181 | `${this._getAssetFromIndicator(this.indicator)}-active`, | ||
182 | ), | ||
166 | ); | 183 | ); |
167 | } | 184 | } |
168 | } | 185 | } |
@@ -170,12 +187,24 @@ export default class TrayIcon { | |||
170 | _getAsset(type, asset) { | 187 | _getAsset(type, asset) { |
171 | let { platform } = process; | 188 | let { platform } = process; |
172 | 189 | ||
173 | if (isMac && (nativeTheme.shouldUseDarkColors || macosVersion.isGreaterThanOrEqualTo('11'))) { | 190 | if ( |
191 | isMac && | ||
192 | (nativeTheme.shouldUseDarkColors || | ||
193 | isMacOSVersionGreaterThanOrEqualTo('11')) | ||
194 | ) { | ||
174 | platform = `${platform}-dark`; | 195 | platform = `${platform}-dark`; |
175 | } | 196 | } |
176 | 197 | ||
177 | return nativeImage.createFromPath(join( | 198 | return nativeImage.createFromPath( |
178 | __dirname, '..', 'assets', 'images', type, platform, `${asset}.${FILE_EXTENSION}`, | 199 | join( |
179 | )); | 200 | __dirname, |
201 | '..', | ||
202 | 'assets', | ||
203 | 'images', | ||
204 | type, | ||
205 | platform, | ||
206 | `${asset}.${FILE_EXTENSION}`, | ||
207 | ), | ||
208 | ); | ||
180 | } | 209 | } |
181 | } | 210 | } |
diff --git a/src/webview/notifications.js b/src/webview/notifications.js index 205a3220c..73cdb89d4 100644 --- a/src/webview/notifications.js +++ b/src/webview/notifications.js | |||
@@ -1,22 +1,25 @@ | |||
1 | import { ipcRenderer } from 'electron'; | 1 | import { ipcRenderer } from 'electron'; |
2 | import uuidV1 from 'uuid/v1'; | 2 | import { v1 as uuidV1 } from 'uuid'; |
3 | 3 | ||
4 | const debug = require('debug')('Ferdi:Notifications'); | 4 | const debug = require('debug')('Ferdi:Notifications'); |
5 | 5 | ||
6 | export class NotificationsHandler { | 6 | export class NotificationsHandler { |
7 | onNotify = (data) => data; | 7 | onNotify = data => data; |
8 | 8 | ||
9 | displayNotification(title, options) { | 9 | displayNotification(title, options) { |
10 | return new Promise((resolve) => { | 10 | return new Promise(resolve => { |
11 | debug('New notification', title, options); | 11 | debug('New notification', title, options); |
12 | 12 | ||
13 | const notificationId = uuidV1(); | 13 | const notificationId = uuidV1(); |
14 | 14 | ||
15 | ipcRenderer.sendToHost('notification', this.onNotify({ | 15 | ipcRenderer.sendToHost( |
16 | title, | 16 | 'notification', |
17 | options, | 17 | this.onNotify({ |
18 | notificationId, | 18 | title, |
19 | })); | 19 | options, |
20 | notificationId, | ||
21 | }), | ||
22 | ); | ||
20 | 23 | ||
21 | ipcRenderer.once(`notification-onclick:${notificationId}`, () => { | 24 | ipcRenderer.once(`notification-onclick:${notificationId}`, () => { |
22 | resolve(); | 25 | resolve(); |
diff --git a/uidev/src/stories/input.stories.tsx b/uidev/src/stories/input.stories.tsx index 889539266..4136cfd4d 100644 --- a/uidev/src/stories/input.stories.tsx +++ b/uidev/src/stories/input.stories.tsx | |||
@@ -1,5 +1,5 @@ | |||
1 | import React from 'react'; | 1 | import React from 'react'; |
2 | import uuid from 'uuid/v4'; | 2 | import { v4 as uuid } from 'uuid'; |
3 | 3 | ||
4 | import { Input } from '@meetfranz/forms'; | 4 | import { Input } from '@meetfranz/forms'; |
5 | import { storiesOf } from '../stores/stories'; | 5 | import { storiesOf } from '../stores/stories'; |
@@ -10,7 +10,8 @@ const defaultProps = () => { | |||
10 | label: 'Label', | 10 | label: 'Label', |
11 | id: `test-${id}`, | 11 | id: `test-${id}`, |
12 | name: `test-${id}`, | 12 | name: `test-${id}`, |
13 | onChange: (e: React.ChangeEvent<HTMLInputElement>) => console.log('changed event', e), | 13 | onChange: (e: React.ChangeEvent<HTMLInputElement>) => |
14 | console.log('changed event', e), | ||
14 | }; | 15 | }; |
15 | }; | 16 | }; |
16 | 17 | ||
@@ -21,44 +22,23 @@ const defaultPasswordProps = () => { | |||
21 | id: `test-${id}`, | 22 | id: `test-${id}`, |
22 | name: `test-${id}`, | 23 | name: `test-${id}`, |
23 | type: 'password', | 24 | type: 'password', |
24 | onChange: (e: React.ChangeEvent<HTMLInputElement>) => console.log('changed event', e), | 25 | onChange: (e: React.ChangeEvent<HTMLInputElement>) => |
26 | console.log('changed event', e), | ||
25 | }; | 27 | }; |
26 | }; | 28 | }; |
27 | 29 | ||
28 | storiesOf('Input') | 30 | storiesOf('Input') |
29 | .add('Basic', () => ( | 31 | .add('Basic', () => ( |
30 | <Input | 32 | <Input {...defaultProps()} placeholder="Placeholder text" /> |
31 | {...defaultProps()} | ||
32 | placeholder="Placeholder text" | ||
33 | /> | ||
34 | )) | ||
35 | .add('Without Label', () => ( | ||
36 | <Input | ||
37 | {...defaultProps()} | ||
38 | showLabel={false} | ||
39 | /> | ||
40 | )) | ||
41 | .add('Disabled', () => ( | ||
42 | <Input {...defaultProps()} disabled /> | ||
43 | )) | ||
44 | .add('With prefix', () => ( | ||
45 | <Input | ||
46 | {...defaultProps()} | ||
47 | prefix="https://" | ||
48 | /> | ||
49 | )) | 33 | )) |
34 | .add('Without Label', () => <Input {...defaultProps()} showLabel={false} />) | ||
35 | .add('Disabled', () => <Input {...defaultProps()} disabled />) | ||
36 | .add('With prefix', () => <Input {...defaultProps()} prefix="https://" />) | ||
50 | .add('With suffix', () => ( | 37 | .add('With suffix', () => ( |
51 | <Input | 38 | <Input {...defaultProps()} suffix=".meetfranz.com" /> |
52 | {...defaultProps()} | ||
53 | suffix=".meetfranz.com" | ||
54 | /> | ||
55 | )) | 39 | )) |
56 | .add('With pre-suffix', () => ( | 40 | .add('With pre-suffix', () => ( |
57 | <Input | 41 | <Input {...defaultProps()} prefix="https://" suffix=".meetfranz.com" /> |
58 | {...defaultProps()} | ||
59 | prefix="https://" | ||
60 | suffix=".meetfranz.com" | ||
61 | /> | ||
62 | )) | 42 | )) |
63 | .add('With error', () => ( | 43 | .add('With error', () => ( |
64 | <Input | 44 | <Input |
@@ -68,32 +48,16 @@ storiesOf('Input') | |||
68 | /> | 48 | /> |
69 | )) | 49 | )) |
70 | .add('Type number with min & max', () => ( | 50 | .add('Type number with min & max', () => ( |
71 | <Input | 51 | <Input {...defaultProps()} type="number" min={1} max={10} /> |
72 | {...defaultProps()} | ||
73 | type="number" | ||
74 | min={1} | ||
75 | max={10} | ||
76 | /> | ||
77 | )); | 52 | )); |
78 | 53 | ||
79 | storiesOf('Password') | 54 | storiesOf('Password') |
80 | .add('Basic', () => ( | 55 | .add('Basic', () => <Input {...defaultPasswordProps()} />) |
81 | <Input | ||
82 | {...defaultPasswordProps()} | ||
83 | /> | ||
84 | )) | ||
85 | .add('Show password toggle', () => ( | 56 | .add('Show password toggle', () => ( |
86 | <Input | 57 | <Input {...defaultPasswordProps()} showPasswordToggle /> |
87 | {...defaultPasswordProps()} | ||
88 | showPasswordToggle | ||
89 | /> | ||
90 | )) | 58 | )) |
91 | .add('Score password', () => ( | 59 | .add('Score password', () => ( |
92 | <Input | 60 | <Input {...defaultPasswordProps()} showPasswordToggle scorePassword /> |
93 | {...defaultPasswordProps()} | ||
94 | showPasswordToggle | ||
95 | scorePassword | ||
96 | /> | ||
97 | )) | 61 | )) |
98 | .add('Score password with error', () => ( | 62 | .add('Score password with error', () => ( |
99 | <Input | 63 | <Input |
diff --git a/uidev/src/stories/select.stories.tsx b/uidev/src/stories/select.stories.tsx index 51ec6ed88..93e072cd9 100644 --- a/uidev/src/stories/select.stories.tsx +++ b/uidev/src/stories/select.stories.tsx | |||
@@ -1,5 +1,5 @@ | |||
1 | import React from 'react'; | 1 | import React from 'react'; |
2 | import uuid from 'uuid/v4'; | 2 | import { v4 as uuid } from 'uuid'; |
3 | 3 | ||
4 | import { Select } from '@meetfranz/forms'; | 4 | import { Select } from '@meetfranz/forms'; |
5 | import { storiesOf } from '../stores/stories'; | 5 | import { storiesOf } from '../stores/stories'; |
@@ -282,35 +282,18 @@ const defaultProps = () => { | |||
282 | }, | 282 | }, |
283 | actionText: 'Select country', | 283 | actionText: 'Select country', |
284 | // defaultValue: 'AT', | 284 | // defaultValue: 'AT', |
285 | onChange: (e: React.ChangeEvent<HTMLInputElement>) => console.log('changed event', e), | 285 | onChange: (e: React.ChangeEvent<HTMLInputElement>) => |
286 | console.log('changed event', e), | ||
286 | }; | 287 | }; |
287 | }; | 288 | }; |
288 | 289 | ||
289 | storiesOf('Select') | 290 | storiesOf('Select') |
290 | .add('Basic', () => ( | 291 | .add('Basic', () => <Select {...defaultProps()} />) |
291 | <Select | ||
292 | {...defaultProps()} | ||
293 | /> | ||
294 | )) | ||
295 | .add('With preselection', () => ( | 292 | .add('With preselection', () => ( |
296 | <Select | 293 | <Select {...defaultProps()} defaultValue="AT" /> |
297 | {...defaultProps()} | ||
298 | defaultValue="AT" | ||
299 | /> | ||
300 | )) | ||
301 | .add('With search', () => ( | ||
302 | <Select | ||
303 | {...defaultProps()} | ||
304 | showSearch | ||
305 | /> | ||
306 | )) | ||
307 | .add('Disabled', () => ( | ||
308 | <Select | ||
309 | {...defaultProps()} | ||
310 | showSearch | ||
311 | disabled | ||
312 | /> | ||
313 | )) | 294 | )) |
295 | .add('With search', () => <Select {...defaultProps()} showSearch />) | ||
296 | .add('Disabled', () => <Select {...defaultProps()} showSearch disabled />) | ||
314 | .add('With error', () => ( | 297 | .add('With error', () => ( |
315 | <Select | 298 | <Select |
316 | {...defaultProps()} | 299 | {...defaultProps()} |
diff --git a/uidev/src/stories/textarea.stories.tsx b/uidev/src/stories/textarea.stories.tsx index 1ab21820b..09b9fef70 100644 --- a/uidev/src/stories/textarea.stories.tsx +++ b/uidev/src/stories/textarea.stories.tsx | |||
@@ -1,5 +1,5 @@ | |||
1 | import React from 'react'; | 1 | import React from 'react'; |
2 | import uuid from 'uuid/v4'; | 2 | import { v4 as uuid } from 'uuid'; |
3 | 3 | ||
4 | import { Textarea } from '@meetfranz/forms'; | 4 | import { Textarea } from '@meetfranz/forms'; |
5 | import { storiesOf } from '../stores/stories'; | 5 | import { storiesOf } from '../stores/stories'; |
@@ -11,7 +11,8 @@ const defaultProps = () => { | |||
11 | id: `test-${id}`, | 11 | id: `test-${id}`, |
12 | name: `test-${id}`, | 12 | name: `test-${id}`, |
13 | rows: 5, | 13 | rows: 5, |
14 | onChange: (e: React.ChangeEvent<HTMLInputElement>) => console.log('changed event', e), | 14 | onChange: (e: React.ChangeEvent<HTMLInputElement>) => |
15 | console.log('changed event', e), | ||
15 | }; | 16 | }; |
16 | }; | 17 | }; |
17 | 18 | ||
@@ -22,22 +23,8 @@ storiesOf('Textarea') | |||
22 | // placeholder="Placeholder text" | 23 | // placeholder="Placeholder text" |
23 | /> | 24 | /> |
24 | )) | 25 | )) |
25 | .add('10 rows', () => ( | 26 | .add('10 rows', () => <Textarea {...defaultProps()} rows={10} />) |
26 | <Textarea | ||
27 | {...defaultProps()} | ||
28 | rows={10} | ||
29 | /> | ||
30 | )) | ||
31 | .add('With error', () => ( | 27 | .add('With error', () => ( |
32 | <Textarea | 28 | <Textarea {...defaultProps()} error="This is a generic error message." /> |
33 | {...defaultProps()} | ||
34 | error="This is a generic error message." | ||
35 | /> | ||
36 | )) | 29 | )) |
37 | .add('Disabled', () => ( | 30 | .add('Disabled', () => <Textarea {...defaultProps()} rows={2} disabled />); |
38 | <Textarea | ||
39 | {...defaultProps()} | ||
40 | rows={2} | ||
41 | disabled | ||
42 | /> | ||
43 | )); | ||
diff --git a/uidev/src/stories/toggle.stories.tsx b/uidev/src/stories/toggle.stories.tsx index af6b282bc..f54e67596 100644 --- a/uidev/src/stories/toggle.stories.tsx +++ b/uidev/src/stories/toggle.stories.tsx | |||
@@ -1,7 +1,7 @@ | |||
1 | import { observable } from 'mobx'; | 1 | import { observable } from 'mobx'; |
2 | import { observer } from 'mobx-react'; | 2 | import { observer } from 'mobx-react'; |
3 | import React from 'react'; | 3 | import React from 'react'; |
4 | import uuid from 'uuid/v4'; | 4 | import { v4 as uuid } from 'uuid'; |
5 | 5 | ||
6 | import { Toggle } from '@meetfranz/forms'; | 6 | import { Toggle } from '@meetfranz/forms'; |
7 | import { storiesOf } from '../stores/stories'; | 7 | import { storiesOf } from '../stores/stories'; |
@@ -16,14 +16,17 @@ interface IStoreArgs { | |||
16 | error?: string; | 16 | error?: string; |
17 | } | 17 | } |
18 | 18 | ||
19 | const createStore = (args?: IStoreArgs) => observable({ id: `element-${uuid()}`, | 19 | const createStore = (args?: IStoreArgs) => |
20 | observable({ | ||
21 | id: `element-${uuid()}`, | ||
20 | name: 'toggle', | 22 | name: 'toggle', |
21 | label: 'Label', | 23 | label: 'Label', |
22 | value: true, | 24 | value: true, |
23 | checked: false, | 25 | checked: false, |
24 | disabled: false, | 26 | disabled: false, |
25 | error: '', | 27 | error: '', |
26 | ...args }); | 28 | ...args, |
29 | }); | ||
27 | 30 | ||
28 | const WithStoreToggle = observer(({ store }: { store: any }) => ( | 31 | const WithStoreToggle = observer(({ store }: { store: any }) => ( |
29 | <> | 32 | <> |
@@ -35,37 +38,40 @@ const WithStoreToggle = observer(({ store }: { store: any }) => ( | |||
35 | name={store.name} | 38 | name={store.name} |
36 | disabled={store.disabled} | 39 | disabled={store.disabled} |
37 | error={store.error} | 40 | error={store.error} |
38 | onChange={() => store.checked = !store.checked} | 41 | onChange={() => (store.checked = !store.checked)} |
39 | /> | 42 | /> |
40 | </> | 43 | </> |
41 | )); | 44 | )); |
42 | 45 | ||
43 | storiesOf('Toggle') | 46 | storiesOf('Toggle') |
44 | .add('Basic', () => ( | 47 | .add('Basic', () => <WithStoreToggle store={createStore()} />) |
45 | <WithStoreToggle store={createStore()} /> | ||
46 | )) | ||
47 | .add('Checked', () => ( | 48 | .add('Checked', () => ( |
48 | <WithStoreToggle store={createStore({ | 49 | <WithStoreToggle |
49 | checked: true, | 50 | store={createStore({ |
50 | })} | 51 | checked: true, |
52 | })} | ||
51 | /> | 53 | /> |
52 | )) | 54 | )) |
53 | .add('Disabled', () => ( | 55 | .add('Disabled', () => ( |
54 | <WithStoreToggle store={createStore({ | 56 | <WithStoreToggle |
55 | checked: true, | 57 | store={createStore({ |
56 | disabled: true, | 58 | checked: true, |
57 | })} | 59 | disabled: true, |
60 | })} | ||
58 | /> | 61 | /> |
59 | )) | 62 | )) |
60 | .add('Long label', () => ( | 63 | .add('Long label', () => ( |
61 | <WithStoreToggle store={createStore({ | 64 | <WithStoreToggle |
62 | label: 'Hello world, this is an insanely long label for this toggle. We need to make sure that it will be displayed correctly.', | 65 | store={createStore({ |
63 | })} | 66 | label: |
67 | 'Hello world, this is an insanely long label for this toggle. We need to make sure that it will be displayed correctly.', | ||
68 | })} | ||
64 | /> | 69 | /> |
65 | )) | 70 | )) |
66 | .add('With error', () => ( | 71 | .add('With error', () => ( |
67 | <WithStoreToggle store={createStore({ | 72 | <WithStoreToggle |
68 | error: 'Something went wrong', | 73 | store={createStore({ |
69 | })} | 74 | error: 'Something went wrong', |
75 | })} | ||
70 | /> | 76 | /> |
71 | )); | 77 | )); |