Compare commits
539 Commits
@nhost/rea
...
@nhost/rea
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19818e2b59 | ||
|
|
b3eeec82ef | ||
|
|
34ff254696 | ||
|
|
1c4806bf51 | ||
|
|
2fb82ec97d | ||
|
|
0c994a9651 | ||
|
|
4713cecfc2 | ||
|
|
f79eebadbf | ||
|
|
ac174b5e51 | ||
|
|
dc9ddfc9ae | ||
|
|
3bdd9f570c | ||
|
|
94477be998 | ||
|
|
568577e8ca | ||
|
|
e93b06ab8f | ||
|
|
c75bf46ba1 | ||
|
|
63a1fd09b5 | ||
|
|
630d44ad6e | ||
|
|
d7db521974 | ||
|
|
90e4053f0a | ||
|
|
8e9d5d1b38 | ||
|
|
43c86fef14 | ||
|
|
6b97340cf4 | ||
|
|
1605756362 | ||
|
|
6437544384 | ||
|
|
b4dcd1996d | ||
|
|
7fb73dbb1b | ||
|
|
a66b11d245 | ||
|
|
912ed76c64 | ||
|
|
b47c0d1af7 | ||
|
|
b97ab2be2f | ||
|
|
f12cb666ff | ||
|
|
c3b2b1cd02 | ||
|
|
c0b71102d4 | ||
|
|
5f68ae95c4 | ||
|
|
2d1b7bb292 | ||
|
|
ee154d4eca | ||
|
|
58ef9bbe02 | ||
|
|
f3f35beefd | ||
|
|
d31330e6c0 | ||
|
|
c3dda79d95 | ||
|
|
7c1273725d | ||
|
|
70be0e1ab4 | ||
|
|
4f5870cfd7 | ||
|
|
623607476e | ||
|
|
1e232713d9 | ||
|
|
1ed647c4e9 | ||
|
|
b666a173b1 | ||
|
|
caba147b32 | ||
|
|
ca365fc8e7 | ||
|
|
d88cdedb26 | ||
|
|
1de08cecaf | ||
|
|
47bb997036 | ||
|
|
4e4d962f30 | ||
|
|
883fb82c77 | ||
|
|
c9f5634ac2 | ||
|
|
6ee9a589fb | ||
|
|
e2d733cf34 | ||
|
|
a0d7327c8d | ||
|
|
c7c8a20334 | ||
|
|
cca8de5805 | ||
|
|
8c065c42d6 | ||
|
|
210af3a3e8 | ||
|
|
fbb12a8079 | ||
|
|
77692ac40e | ||
|
|
2c2a42a8e8 | ||
|
|
a8466798a3 | ||
|
|
a45c0970bb | ||
|
|
9bf30a1ccc | ||
|
|
99d3d82c72 | ||
|
|
43acb3fb50 | ||
|
|
ba9ef13ba3 | ||
|
|
cea507a271 | ||
|
|
9130ab1230 | ||
|
|
27acdd6f56 | ||
|
|
dcdacd73ec | ||
|
|
9c9966a30f | ||
|
|
5a23e7a0a8 | ||
|
|
47500fac39 | ||
|
|
cbbf53c05b | ||
|
|
11bd011860 | ||
|
|
e3c0c47777 | ||
|
|
d825404b54 | ||
|
|
d46d77ee71 | ||
|
|
a292482705 | ||
|
|
8a4ca41172 | ||
|
|
fd3ce98600 | ||
|
|
04f36a0491 | ||
|
|
5e2ecb4d1e | ||
|
|
eca9e551e8 | ||
|
|
52ebbef762 | ||
|
|
82faa4ca0a | ||
|
|
d06a21764a | ||
|
|
8b54d290a5 | ||
|
|
4cfa6bbe1e | ||
|
|
614f213e26 | ||
|
|
4eebf51821 | ||
|
|
9a52298aa7 | ||
|
|
099eebe602 | ||
|
|
7cce8652e7 | ||
|
|
f2e2323801 | ||
|
|
4e16de6db2 | ||
|
|
798e591b1d | ||
|
|
b48bc034ca | ||
|
|
f57819230b | ||
|
|
3d8067ff7b | ||
|
|
0fa4b428a9 | ||
|
|
8c5864340e | ||
|
|
c131100af9 | ||
|
|
e363fef8cf | ||
|
|
d8072101c8 | ||
|
|
afbba531a1 | ||
|
|
4b6df8b9d6 | ||
|
|
a2af5a674d | ||
|
|
c33c1fd6b9 | ||
|
|
041d9b98e3 | ||
|
|
e4b4940397 | ||
|
|
be91f4ed2a | ||
|
|
ec6ba846cf | ||
|
|
a9e9fc4305 | ||
|
|
d8d8394b3b | ||
|
|
f051a121b2 | ||
|
|
c547b490e5 | ||
|
|
4f4449b855 | ||
|
|
6ed46ce2d4 | ||
|
|
bfb4c1a6cc | ||
|
|
776c8f9237 | ||
|
|
c0773d82e9 | ||
|
|
c46b1383f2 | ||
|
|
beed2eba21 | ||
|
|
70f9610041 | ||
|
|
e91de1088d | ||
|
|
ce1ee40dab | ||
|
|
bd7929f5ed | ||
|
|
2c8559a319 | ||
|
|
bd5ea5ee3a | ||
|
|
3538dbac39 | ||
|
|
03b5cda69a | ||
|
|
4329d04854 | ||
|
|
ca50c5ce0c | ||
|
|
a3271ed014 | ||
|
|
d4fc99a77c | ||
|
|
d90fcf3c24 | ||
|
|
ee70b226fc | ||
|
|
227ef968e6 | ||
|
|
430b37b2e1 | ||
|
|
124620c33e | ||
|
|
ce3ece1ad7 | ||
|
|
c81002622c | ||
|
|
35fa6bb043 | ||
|
|
a4469a5942 | ||
|
|
b8f11a13d7 | ||
|
|
1d1555593f | ||
|
|
001b3dccec | ||
|
|
6755dfb17b | ||
|
|
2ac90dfdec | ||
|
|
093f3906a4 | ||
|
|
6fb81a27ba | ||
|
|
9be41bf594 | ||
|
|
cbb1fc5bc8 | ||
|
|
99fcc36250 | ||
|
|
7e4a756cfe | ||
|
|
5bf61583e0 | ||
|
|
7eac17a1cb | ||
|
|
a41aeeb9ef | ||
|
|
e33df513ff | ||
|
|
323fd5cbe3 | ||
|
|
0ec3abf47c | ||
|
|
ffb3c426d3 | ||
|
|
889ee6589e | ||
|
|
ae19105302 | ||
|
|
730a482598 | ||
|
|
b00d261916 | ||
|
|
6e05ab4628 | ||
|
|
5223ee9353 | ||
|
|
c8c5ace7cc | ||
|
|
c6a4c28579 | ||
|
|
850a049ca2 | ||
|
|
eff3f0aefd | ||
|
|
2b1338f716 | ||
|
|
2b58c60747 | ||
|
|
1b2e3fbd1d | ||
|
|
6f4fdcf73f | ||
|
|
cb529dc60c | ||
|
|
68a449dbfc | ||
|
|
7d0c6d083a | ||
|
|
1353477da1 | ||
|
|
549c7cb7eb | ||
|
|
e131c12d5d | ||
|
|
8bb097c9a7 | ||
|
|
ea31e64a71 | ||
|
|
369b931689 | ||
|
|
e1ec5c1be2 | ||
|
|
9822a160d4 | ||
|
|
7c67a2c437 | ||
|
|
8e8884f4e1 | ||
|
|
9923be41ce | ||
|
|
3141ce5b68 | ||
|
|
9c22a616a7 | ||
|
|
6bc67e95a5 | ||
|
|
0f6074c16f | ||
|
|
c96d7ccdf2 | ||
|
|
fde7ac7c1c | ||
|
|
24ef6071cc | ||
|
|
bb993b6b03 | ||
|
|
89ca34be9a | ||
|
|
b66d095c95 | ||
|
|
0bad9ff4fa | ||
|
|
9a761f4fec | ||
|
|
253dd235ca | ||
|
|
991e8f2d15 | ||
|
|
e500e87022 | ||
|
|
bd6b55868a | ||
|
|
afb3fe490e | ||
|
|
c684d0307b | ||
|
|
eaebd2b028 | ||
|
|
f03ecd91a9 | ||
|
|
96f17c39b1 | ||
|
|
2d657b9c29 | ||
|
|
cb7c8c6398 | ||
|
|
4bf40995b5 | ||
|
|
ab5f704280 | ||
|
|
f65e4de955 | ||
|
|
7e0e4d05aa | ||
|
|
decb0b057c | ||
|
|
0954a44f84 | ||
|
|
700cbd9e47 | ||
|
|
3238543b08 | ||
|
|
fc79b890df | ||
|
|
211eb42af5 | ||
|
|
a7398451e3 | ||
|
|
4b4f0d0150 | ||
|
|
f37e2a23e2 | ||
|
|
3f8d68ffab | ||
|
|
f7e706724c | ||
|
|
f46d96bafc | ||
|
|
6b8acd35bd | ||
|
|
2832d7299f | ||
|
|
44c5b386c3 | ||
|
|
44ff6a059f | ||
|
|
1a4a061284 | ||
|
|
5a91c477f0 | ||
|
|
66f73d06a8 | ||
|
|
35d52aab87 | ||
|
|
8261743bd3 | ||
|
|
ddd41aae99 | ||
|
|
78555c7e85 | ||
|
|
01ded8ffff | ||
|
|
3c7cf92edf | ||
|
|
bb4301fd34 | ||
|
|
34cf1d79a0 | ||
|
|
9d4542b3db | ||
|
|
bb5dbdf5a3 | ||
|
|
2801b03bf4 | ||
|
|
8298d458d5 | ||
|
|
6e9b941b89 | ||
|
|
5dd25941e5 | ||
|
|
832210d8ad | ||
|
|
a09dad060c | ||
|
|
76b63debf0 | ||
|
|
e88684ff2a | ||
|
|
c8c8948755 | ||
|
|
17e9e5899e | ||
|
|
bd22c48131 | ||
|
|
095d6e918c | ||
|
|
89a239ff3a | ||
|
|
0131886011 | ||
|
|
340c014fe8 | ||
|
|
bc9c8b9456 | ||
|
|
c22b2621ba | ||
|
|
726746c4d3 | ||
|
|
c431570783 | ||
|
|
445d8ef449 | ||
|
|
0f4ea18e42 | ||
|
|
dae7c5d517 | ||
|
|
f673adea00 | ||
|
|
1c6f1e3b33 | ||
|
|
6593e8d3eb | ||
|
|
d1365ea516 | ||
|
|
72dbba7881 | ||
|
|
a3f3991d5a | ||
|
|
c71fe2cf72 | ||
|
|
24c5ed3ea4 | ||
|
|
2d9145f918 | ||
|
|
9a0ab5b887 | ||
|
|
1ddf704c5b | ||
|
|
6f4ee845c6 | ||
|
|
0368663dea | ||
|
|
76ce7d7b6e | ||
|
|
538bfbcb3e | ||
|
|
07b35d1e5f | ||
|
|
2200a0ed07 | ||
|
|
9219838127 | ||
|
|
df23d97126 | ||
|
|
43b68a79eb | ||
|
|
104f149369 | ||
|
|
01228583a0 | ||
|
|
93309dd851 | ||
|
|
2cc18dcb51 | ||
|
|
3b48a62790 | ||
|
|
8897dec056 | ||
|
|
324dda8309 | ||
|
|
ac845c6d92 | ||
|
|
cfcb97b8ee | ||
|
|
95f62bed07 | ||
|
|
892ad66ba1 | ||
|
|
f4af81020b | ||
|
|
0e4d8ff118 | ||
|
|
6999562b59 | ||
|
|
baec5bada7 | ||
|
|
4e56cfc628 | ||
|
|
d167121093 | ||
|
|
822e251b11 | ||
|
|
328c6bb486 | ||
|
|
bef8198cbf | ||
|
|
179313d8a2 | ||
|
|
54bc91923f | ||
|
|
c3ce004f46 | ||
|
|
a1ffad77eb | ||
|
|
77b12feb95 | ||
|
|
32d4670bbb | ||
|
|
1dc09942d2 | ||
|
|
3343a36358 | ||
|
|
de4d59da99 | ||
|
|
b755e9086c | ||
|
|
48866d0ee1 | ||
|
|
7d577a68b7 | ||
|
|
5b3b76bd41 | ||
|
|
7f7e7ea7d4 | ||
|
|
aaaf2dc9c5 | ||
|
|
fa9c1ea28c | ||
|
|
87eda76e2b | ||
|
|
982059e18e | ||
|
|
02c0586467 | ||
|
|
8a596f2a9e | ||
|
|
d6d2381598 | ||
|
|
284ef7e7f2 | ||
|
|
6d5c202da9 | ||
|
|
962563d6a0 | ||
|
|
8bf58ba26b | ||
|
|
0c175e7a11 | ||
|
|
70f2fbcfc2 | ||
|
|
d2c4ad3260 | ||
|
|
a9ca2c2946 | ||
|
|
d854dd74b1 | ||
|
|
6f0ac5706c | ||
|
|
9342937440 | ||
|
|
e89cd4e262 | ||
|
|
a05438352b | ||
|
|
78437959bb | ||
|
|
e1a7433adb | ||
|
|
0753e6529c | ||
|
|
e87a14a3fe | ||
|
|
b45aa420d9 | ||
|
|
1d76de3f60 | ||
|
|
e23cf74975 | ||
|
|
a3d01c4fad | ||
|
|
4cdcef9ef5 | ||
|
|
df894ef7e2 | ||
|
|
f7dd6a9fc6 | ||
|
|
2949ff0f62 | ||
|
|
9e37ca4cbc | ||
|
|
af57ccce0f | ||
|
|
5f44aefcc6 | ||
|
|
168616df38 | ||
|
|
1527b0a455 | ||
|
|
375e53a3f0 | ||
|
|
96e3ca5a32 | ||
|
|
0e570df9c5 | ||
|
|
1f4c67283e | ||
|
|
fc1c4861a3 | ||
|
|
74feaf6add | ||
|
|
8cd97206cc | ||
|
|
02197639f2 | ||
|
|
38b594aef9 | ||
|
|
f3a8886cd0 | ||
|
|
96f9278c8f | ||
|
|
8d76cf8d40 | ||
|
|
3e1fb974e4 | ||
|
|
9fe2ecd317 | ||
|
|
ada5309b49 | ||
|
|
08698f8246 | ||
|
|
f74871d872 | ||
|
|
0b56e31408 | ||
|
|
d8c45b452d | ||
|
|
c4e3e3f91f | ||
|
|
483fd6c7f4 | ||
|
|
ac37d7bcae | ||
|
|
9adf91ba87 | ||
|
|
d11f6eebb0 | ||
|
|
8a678fbc87 | ||
|
|
6411ec3ec3 | ||
|
|
5187fe76aa | ||
|
|
859f457e4a | ||
|
|
dc2b5b4429 | ||
|
|
b7645e7892 | ||
|
|
3f26056688 | ||
|
|
b1338246aa | ||
|
|
d04ccd600e | ||
|
|
d483ad5602 | ||
|
|
bcf3e6bc2c | ||
|
|
575ff4e9b5 | ||
|
|
2010638540 | ||
|
|
0346495a79 | ||
|
|
2babb0b6f3 | ||
|
|
1f293d0f0c | ||
|
|
af4c886437 | ||
|
|
c182b3ca4b | ||
|
|
d5344ed31f | ||
|
|
adeb2a6d90 | ||
|
|
921243e4d9 | ||
|
|
1c5178f5fb | ||
|
|
72ad9aa8ee | ||
|
|
1b45db8caf | ||
|
|
9ffb4d0295 | ||
|
|
e56340b792 | ||
|
|
814c6d997a | ||
|
|
7d7a352c33 | ||
|
|
53a704fc7d | ||
|
|
c23eddf33d | ||
|
|
d4147f4713 | ||
|
|
f375eaccf5 | ||
|
|
47f79ba9f3 | ||
|
|
2e010455cf | ||
|
|
7e63c822ec | ||
|
|
6a7801be93 | ||
|
|
7bc5bb857c | ||
|
|
c957039d75 | ||
|
|
96c4032424 | ||
|
|
ec70126b56 | ||
|
|
276b7d48c3 | ||
|
|
6925b0d510 | ||
|
|
6ff306c4e4 | ||
|
|
aa440fefe6 | ||
|
|
9fbafc6654 | ||
|
|
86b9f9040c | ||
|
|
b086175045 | ||
|
|
36db12297b | ||
|
|
e5885d9bad | ||
|
|
15c13f3bbe | ||
|
|
8d47cafd86 | ||
|
|
222f03725b | ||
|
|
10b786e5c6 | ||
|
|
aa8ae88d12 | ||
|
|
0f2c86b41a | ||
|
|
408cb6d10c | ||
|
|
4d882703f2 | ||
|
|
437dacaa9e | ||
|
|
088584e79d | ||
|
|
a4c76892dd | ||
|
|
00d278b2cc | ||
|
|
cb6b5faeb9 | ||
|
|
7c4c847b91 | ||
|
|
908887d8c5 | ||
|
|
a2d67bc2db | ||
|
|
1a6cd78254 | ||
|
|
6500629c4b | ||
|
|
add3c2c10e | ||
|
|
dd29b06260 | ||
|
|
490cb25a0f | ||
|
|
0df0dd741e | ||
|
|
2172946879 | ||
|
|
40e50f0e75 | ||
|
|
65cf0888b5 | ||
|
|
21833019ca | ||
|
|
b3171ba3e9 | ||
|
|
6f01f19d02 | ||
|
|
ce92b01eac | ||
|
|
e24a177434 | ||
|
|
56a52b6d48 | ||
|
|
92bfa8c723 | ||
|
|
2a52aaa4a6 | ||
|
|
8280a3e9d8 | ||
|
|
523f60bf68 | ||
|
|
19b11d4084 | ||
|
|
805bae1507 | ||
|
|
f6c014c06f | ||
|
|
c5794f4596 | ||
|
|
fc28817380 | ||
|
|
80bbd3a165 | ||
|
|
7a10617a72 | ||
|
|
f0b6dca1a5 | ||
|
|
5db20adc34 | ||
|
|
12dc41a517 | ||
|
|
768fd56891 | ||
|
|
8a508cb1cc | ||
|
|
34f6a8eef4 | ||
|
|
c9d2d31a9b | ||
|
|
68fb23a361 | ||
|
|
476139e528 | ||
|
|
6a850818a0 | ||
|
|
3970dbba0d | ||
|
|
8ee2166f0d | ||
|
|
e13500a185 | ||
|
|
411f574a51 | ||
|
|
7fc91b992e | ||
|
|
b840012be0 | ||
|
|
645c51a9dc | ||
|
|
0ce6f05539 | ||
|
|
8b1188af53 | ||
|
|
12b01f8dee | ||
|
|
60f4faf409 | ||
|
|
528dff3f1b | ||
|
|
d429fb4a3e | ||
|
|
816c916709 | ||
|
|
b7a2b8b537 | ||
|
|
261d8cf434 | ||
|
|
41f49bde76 | ||
|
|
65f685bdb2 | ||
|
|
f52a7f4aac | ||
|
|
e71b9903d9 | ||
|
|
325fd08aef | ||
|
|
3888704464 | ||
|
|
38e8a10a29 | ||
|
|
d8545eae12 | ||
|
|
3d5bfd87d2 | ||
|
|
e66c5626bd | ||
|
|
a227c6561e | ||
|
|
e885c159df | ||
|
|
09fcb74bef | ||
|
|
a089197197 | ||
|
|
34f843875b | ||
|
|
ca278a8c39 | ||
|
|
75603786e0 | ||
|
|
4e4e699b94 | ||
|
|
da31fa9fba | ||
|
|
95e2afaf47 | ||
|
|
958a56dde9 | ||
|
|
74cb15930e | ||
|
|
aa37a98424 | ||
|
|
11cbdda3a5 | ||
|
|
6d1f4adf10 | ||
|
|
ddbc50c15e | ||
|
|
b2cbf570a3 | ||
|
|
22b8e65031 | ||
|
|
63c94d2036 | ||
|
|
010df48c1e | ||
|
|
fdc11db93d | ||
|
|
cb4749f168 | ||
|
|
46a8fcf471 |
18
.github/CODEOWNERS
vendored
18
.github/CODEOWNERS
vendored
@@ -1,14 +1,14 @@
|
||||
# Documentation
|
||||
# https://help.github.com/en/articles/about-code-owners
|
||||
|
||||
/packages @plmercereau @szilarddoro
|
||||
/packages @szilarddoro
|
||||
/packages/docgen @szilarddoro
|
||||
/integrations/stripe-graphql-js @elitan
|
||||
/.github @plmercereau
|
||||
/dashboard/ @szilarddoro @guicurcio
|
||||
/docs/ @guicurcio @elitan
|
||||
/config/ @plmercereau @szilarddoro
|
||||
/examples/ @plmercereau
|
||||
/examples/codegen-react-apollo @elitan @plmercereau
|
||||
/examples/codegen-react-query @elitan @plmercereau
|
||||
/examples/react-apollo-crm @elitan @plmercereau
|
||||
/.github @szilarddoro
|
||||
/dashboard/ @szilarddoro
|
||||
/docs/ @elitan
|
||||
/config/ @szilarddoro
|
||||
/examples/ @szilarddoro
|
||||
/examples/codegen-react-apollo @elitan @szilarddoro
|
||||
/examples/codegen-react-query @elitan @szilarddoro
|
||||
/examples/react-apollo-crm @elitan @szilarddoro
|
||||
|
||||
@@ -23,9 +23,7 @@ runs:
|
||||
- uses: actions/cache@v3
|
||||
id: pnpm-cache
|
||||
with:
|
||||
path: |
|
||||
${{ steps.pnpm-cache-dir.outputs.dir }}
|
||||
~/.cache/Cypress
|
||||
path: ${{ steps.pnpm-cache-dir.outputs.dir }}
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
restore-keys: ${{ runner.os }}-node-
|
||||
- name: Use Node.js 16
|
||||
@@ -40,14 +38,14 @@ runs:
|
||||
- shell: bash
|
||||
name: Build packages
|
||||
if: ${{ inputs.BUILD == 'all' }}
|
||||
run: pnpm build:all
|
||||
run: pnpm run build:all
|
||||
env:
|
||||
TURBO_TOKEN: ${{ inputs.TURBO_TOKEN }}
|
||||
TURBO_TEAM: ${{ inputs.TURBO_TEAM }}
|
||||
- shell: bash
|
||||
name: Build everything in the monorepo
|
||||
if: ${{ inputs.BUILD == 'default' }}
|
||||
run: pnpm build
|
||||
run: pnpm run build
|
||||
env:
|
||||
TURBO_TOKEN: ${{ inputs.TURBO_TOKEN }}
|
||||
TURBO_TEAM: ${{ inputs.TURBO_TEAM }}
|
||||
|
||||
2
.github/workflows/changesets.yaml
vendored
2
.github/workflows/changesets.yaml
vendored
@@ -98,7 +98,7 @@ jobs:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
- name: Build and push to Docker Hub
|
||||
uses: docker/build-push-action@v3
|
||||
uses: docker/build-push-action@v4
|
||||
timeout-minutes: 60
|
||||
with:
|
||||
context: .
|
||||
|
||||
103
.github/workflows/ci.yaml
vendored
103
.github/workflows/ci.yaml
vendored
@@ -8,7 +8,6 @@ on:
|
||||
- '**.md'
|
||||
- 'LICENSE'
|
||||
pull_request:
|
||||
branches: [main]
|
||||
types: [opened, synchronize]
|
||||
paths-ignore:
|
||||
- 'assets/**'
|
||||
@@ -20,6 +19,11 @@ env:
|
||||
NEXT_PUBLIC_ENV: dev
|
||||
NEXT_TELEMETRY_DISABLED: 1
|
||||
NEXT_PUBLIC_NHOST_BACKEND_URL: http://localhost:1337
|
||||
NHOST_TEST_DASHBOARD_URL: ${{ vars.NHOST_TEST_DASHBOARD_URL }}
|
||||
NHOST_TEST_WORKSPACE_NAME: ${{ vars.NHOST_TEST_WORKSPACE_NAME }}
|
||||
NHOST_TEST_PROJECT_NAME: ${{ vars.NHOST_TEST_PROJECT_NAME }}
|
||||
NHOST_TEST_USER_EMAIL: ${{ secrets.NHOST_TEST_USER_EMAIL }}
|
||||
NHOST_TEST_USER_PASSWORD: ${{ secrets.NHOST_TEST_USER_PASSWORD }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -56,52 +60,11 @@ jobs:
|
||||
| xargs -I@ realpath --relative-to=$PWD @ \
|
||||
| xargs -I@ jq "if (.scripts.e2e | length) != 0 then {name: .name, path: \"@\"} else null end" @/package.json \
|
||||
| awk "!/null/" \
|
||||
| jq -c --slurp)
|
||||
| jq -c --slurp 'map(select(length > 0))')
|
||||
echo "matrix=$PACKAGES" >> $GITHUB_OUTPUT
|
||||
outputs:
|
||||
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||
|
||||
e2e:
|
||||
name: 'e2e (${{ matrix.package.path }})'
|
||||
needs: build
|
||||
if: ${{ needs.build.outputs.matrix != '[]' && needs.build.outputs.matrix != '' }}
|
||||
strategy:
|
||||
# * Don't cancel other matrices when one fails
|
||||
fail-fast: false
|
||||
matrix:
|
||||
package: ${{ fromJson(needs.build.outputs.matrix) }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
# * Install Node and dependencies. Package dependencies won't be downloaded again as they have been cached by the `build` job.
|
||||
- name: Install Node and dependencies
|
||||
uses: ./.github/actions/install-dependencies
|
||||
with:
|
||||
TURBO_TOKEN: ${{ env.TURBO_TOKEN }}
|
||||
TURBO_TEAM: ${{ env.TURBO_TEAM }}
|
||||
# * Install Nhost CLI if a `nhost/config.yaml` file is found
|
||||
- name: Install Nhost CLI
|
||||
if: hashFiles(format('{0}/nhost/config.yaml', matrix.package.path)) != ''
|
||||
uses: ./.github/actions/nhost-cli
|
||||
# * Run the `ci` script of the current package of the matrix. Dependencies build is cached by Turborepo
|
||||
- name: Run e2e test
|
||||
run: pnpm --filter="${{ matrix.package.name }}" run e2e
|
||||
- id: file-name
|
||||
if: ${{ failure() }}
|
||||
name: Tranform package name into a valid file name
|
||||
run: |
|
||||
PACKAGE_FILE_NAME=$(echo "${{ matrix.package.name }}" | sed 's/@//g; s/\//-/g')
|
||||
echo "fileName=$PACKAGE_FILE_NAME" >> $GITHUB_OUTPUT
|
||||
# * Run this step only if the previous step failed, and some Cypress screenshots/videos exist
|
||||
- name: Upload Cypress videos and screenshots
|
||||
if: ${{ failure() && hashFiles(format('{0}/cypress/screenshots/**', matrix.package.path), format('{0}/cypress/videos/**', matrix.package.path)) != ''}}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cypress-${{ steps.file-name.outputs.fileName }}
|
||||
path: |
|
||||
${{format('{0}/cypress/screenshots/**', matrix.package.path)}}
|
||||
${{format('{0}/cypress/videos/**', matrix.package.path)}}
|
||||
|
||||
unit:
|
||||
name: Unit tests
|
||||
needs: build
|
||||
@@ -142,3 +105,57 @@ jobs:
|
||||
# * Run every `lint` script in the workspace . Dependencies build is cached by Turborepo
|
||||
- name: Lint
|
||||
run: pnpm run lint:all
|
||||
|
||||
e2e:
|
||||
name: 'E2E (Package: ${{ matrix.package.path }})'
|
||||
needs: build
|
||||
if: ${{ needs.build.outputs.matrix != '[]' && needs.build.outputs.matrix != '' }}
|
||||
strategy:
|
||||
# * Don't cancel other matrices when one fails
|
||||
fail-fast: false
|
||||
matrix:
|
||||
package: ${{ fromJson(needs.build.outputs.matrix) }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
# * Install Node and dependencies. Package dependencies won't be downloaded again as they have been cached by the `build` job.
|
||||
- name: Install Node and dependencies
|
||||
uses: ./.github/actions/install-dependencies
|
||||
with:
|
||||
TURBO_TOKEN: ${{ env.TURBO_TOKEN }}
|
||||
TURBO_TEAM: ${{ env.TURBO_TEAM }}
|
||||
# * Install Nhost CLI if a `nhost/config.yaml` file is found
|
||||
- name: Install Nhost CLI
|
||||
if: hashFiles(format('{0}/nhost/config.yaml', matrix.package.path)) != ''
|
||||
uses: ./.github/actions/nhost-cli
|
||||
- name: Fetch Dashboard Preview URL
|
||||
id: fetch-dashboard-preview-url
|
||||
uses: zentered/vercel-preview-url@v1.1.9
|
||||
if: github.ref_name != 'main'
|
||||
env:
|
||||
VERCEL_TOKEN: ${{ secrets.DASHBOARD_VERCEL_DEPLOY_TOKEN }}
|
||||
GITHUB_REF: ${{ github.ref_name }}
|
||||
GITHUB_REPOSITORY: ${{ github.repository }}
|
||||
with:
|
||||
vercel_team_id: ${{ secrets.DASHBOARD_VERCEL_TEAM_ID }}
|
||||
vercel_project_id: ${{ secrets.DASHBOARD_STAGING_VERCEL_PROJECT_ID }}
|
||||
vercel_state: BUILDING,READY,INITIALIZING
|
||||
- name: Set Dashboard Preview URL
|
||||
if: steps.fetch-dashboard-preview-url.outputs.preview_url != ''
|
||||
run: echo "NHOST_TEST_DASHBOARD_URL=https://${{ steps.fetch-dashboard-preview-url.outputs.preview_url }}" >> $GITHUB_ENV
|
||||
# * Run the `ci` script of the current package of the matrix. Dependencies build is cached by Turborepo
|
||||
- name: Run e2e tests
|
||||
run: pnpm --filter="${{ matrix.package.name }}" run e2e
|
||||
- id: file-name
|
||||
if: ${{ failure() }}
|
||||
name: Transform package name into a valid file name
|
||||
run: |
|
||||
PACKAGE_FILE_NAME=$(echo "${{ matrix.package.name }}" | sed 's/@//g; s/\//-/g')
|
||||
echo "fileName=$PACKAGE_FILE_NAME" >> $GITHUB_OUTPUT
|
||||
# * Run this step only if the previous step failed, and Playwright generated a report
|
||||
- name: Upload Playwright Report
|
||||
if: ${{ failure() && hashFiles(format('{0}/playwright-report/**', matrix.package.path)) != ''}}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: playwright-${{ steps.file-name.outputs.fileName }}
|
||||
path: ${{format('{0}/playwright-report/**', matrix.package.path)}}
|
||||
|
||||
1
.github/workflows/dashboard.yaml
vendored
1
.github/workflows/dashboard.yaml
vendored
@@ -9,6 +9,7 @@ env:
|
||||
NEXT_PUBLIC_ENV: dev
|
||||
NEXT_TELEMETRY_DISABLED: 1
|
||||
NEXT_PUBLIC_NHOST_BACKEND_URL: http://localhost:1337
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
|
||||
89
.github/workflows/renovate.yaml
vendored
89
.github/workflows/renovate.yaml
vendored
@@ -1,89 +0,0 @@
|
||||
name: Renovate
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [main]
|
||||
types: [closed]
|
||||
paths-ignore:
|
||||
- 'assets/**'
|
||||
- '**.md'
|
||||
- 'LICENSE'
|
||||
env:
|
||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||
TURBO_TEAM: nhost
|
||||
|
||||
jobs:
|
||||
renovate-changeset:
|
||||
name: Add changeset
|
||||
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'renovate/')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.GH_PAT }}
|
||||
# * Install Node and dependencies. Package downloads will be cached for the next jobs.
|
||||
- name: Install Node and dependencies
|
||||
uses: ./.github/actions/install-dependencies
|
||||
with:
|
||||
TURBO_TOKEN: ${{ env.TURBO_TOKEN }}
|
||||
TURBO_TEAM: ${{ env.TURBO_TEAM }}
|
||||
BUILD: 'none'
|
||||
- name: Determine bumps
|
||||
id: bumps
|
||||
run: |
|
||||
LAST_NON_PR_SHA=$(git log --no-merges main origin/${{ github.head_ref }} --format=format:%h -- | head -2 | tail -1)
|
||||
echo "result<<EOF" >> $GITHUB_OUTPUT
|
||||
pnpm recursive list --depth -1 --parseable \
|
||||
--filter='!nhost-root' \
|
||||
--filter=[$LAST_NON_PR_SHA] \
|
||||
| xargs -I@ jq ".name" @/package.json \
|
||||
| sort \
|
||||
| uniq -u \
|
||||
| awk '$0=$0": patch"' \
|
||||
>> $GITHUB_OUTPUT
|
||||
echo 'EOF' >> $GITHUB_OUTPUT
|
||||
- name: Install dictionary
|
||||
if: steps.bumps.outputs.result != ''
|
||||
run: sudo apt-get install wbritish
|
||||
- name: Generate changeset file name
|
||||
id: file_name
|
||||
if: steps.bumps.outputs.result != ''
|
||||
run: |
|
||||
FILE_NAME=$(shuf -n 3 /usr/share/dict/words | tr '\n' '-' | sed 's/-$//' | sed 's/'"'"'s//g' | tr '[:upper:]' '[:lower:]')
|
||||
echo "result=./.changeset/${FILE_NAME}.md" >> $GITHUB_OUTPUT
|
||||
- name: Create changeset file
|
||||
if: steps.bumps.outputs.result != ''
|
||||
run: |
|
||||
cat <<EOF > ${{ steps.file_name.outputs.result }}
|
||||
---
|
||||
${{ steps.bumps.outputs.result }}
|
||||
---
|
||||
|
||||
${{ github.event.pull_request.title }}
|
||||
EOF
|
||||
- name: Create Pull Request
|
||||
id: cpr
|
||||
uses: peter-evans/create-pull-request@v4
|
||||
with:
|
||||
token: ${{ secrets.GH_PAT }}
|
||||
commit-message: ${{ github.event.pull_request.title }}
|
||||
branch: renovate-changesets
|
||||
delete-branch: true
|
||||
title: 'chore: create changesest from Renovate bumps'
|
||||
labels: |
|
||||
dependencies
|
||||
body: |
|
||||
This PR creates the changesets from the Renovate dependencies that have been merged to main.
|
||||
- name: Enable Pull Request Automerge
|
||||
if: steps.cpr.outputs.pull-request-operation == 'created'
|
||||
uses: peter-evans/enable-pull-request-automerge@v2
|
||||
with:
|
||||
token: ${{ secrets.GH_PAT }}
|
||||
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
|
||||
- name: Auto approve
|
||||
if: steps.cpr.outputs.pull-request-operation == 'created'
|
||||
uses: juliangruber/approve-pull-request-action@v2
|
||||
with:
|
||||
github-token: ${{ secrets.GH_PAT }}
|
||||
number: ${{ steps.cpr.outputs.pull-request-number }}
|
||||
@@ -23,8 +23,8 @@ module.exports = {
|
||||
'e2e/**/*.ts',
|
||||
'e2e/**/*.d.ts'
|
||||
],
|
||||
plugins: ['@typescript-eslint', 'cypress'],
|
||||
extends: ['plugin:cypress/recommended'],
|
||||
plugins: ['@typescript-eslint'],
|
||||
extends: [],
|
||||
parserOptions: {
|
||||
ecmaVersion: 2020,
|
||||
sourceType: 'module'
|
||||
|
||||
@@ -45,6 +45,9 @@
|
||||
"@nhost/docgen": [
|
||||
"../packages/docgen/src/index.ts"
|
||||
],
|
||||
"@nhost/graphql-js": [
|
||||
"../packages/graphql-js/src/index.ts"
|
||||
],
|
||||
"@nhost/hasura-auth-js": [
|
||||
"../packages/hasura-auth-js/src/index.ts"
|
||||
],
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import replace from '@rollup/plugin-replace'
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
|
||||
import { defineConfig } from 'vite'
|
||||
import dts from 'vite-plugin-dts'
|
||||
import tsconfigPaths from 'vite-tsconfig-paths'
|
||||
@@ -21,7 +20,9 @@ export default defineConfig({
|
||||
exclude: ['**/*.spec.ts', '**/*.test.ts', '**/tests/**'],
|
||||
entryRoot: 'src',
|
||||
// Was defaulting to true until version 1.7
|
||||
skipDiagnostics: true
|
||||
skipDiagnostics: true,
|
||||
// Was defaulting to true until version 2.0
|
||||
copyDtsFiles: true
|
||||
})
|
||||
],
|
||||
test: {
|
||||
@@ -61,7 +62,6 @@ export default defineConfig({
|
||||
'@apollo/client/utilities': '@apollo/client/utilities',
|
||||
'graphql-ws': 'graphql-ws',
|
||||
xstate: 'xstate',
|
||||
axios: 'axios',
|
||||
'js-cookie': 'Cookies',
|
||||
react: 'React',
|
||||
'react-dom': 'ReactDOM',
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
# General Environment Variables
|
||||
NEXT_PUBLIC_ENV=dev
|
||||
NEXT_PUBLIC_NHOST_HASURA_URL=http://localhost:9695
|
||||
NEXT_PUBLIC_NHOST_MIGRATIONS_URL=http://localhost:9693
|
||||
NEXT_PUBLIC_NHOST_BACKEND_URL=http://localhost:1337
|
||||
NEXT_PUBLIC_NHOST_PLATFORM=false
|
||||
|
||||
# Environment Variables for Self Hosting and Local Development
|
||||
NEXT_PUBLIC_NHOST_AUTH_URL=https://local.auth.nhost.run/v1
|
||||
NEXT_PUBLIC_NHOST_FUNCTIONS_URL=https://local.functions.nhost.run/v1
|
||||
NEXT_PUBLIC_NHOST_GRAPHQL_URL=https://local.graphql.nhost.run/v1
|
||||
NEXT_PUBLIC_NHOST_STORAGE_URL=https://local.storage.nhost.run/v1
|
||||
NEXT_PUBLIC_NHOST_HASURA_CONSOLE_URL=https://local.hasura.nhost.run
|
||||
NEXT_PUBLIC_NHOST_HASURA_MIGRATIONS_API_URL=https://local.hasura.nhost.run/v1/migrations
|
||||
NEXT_PUBLIC_NHOST_HASURA_API_URL=https://local.hasura.nhost.run
|
||||
|
||||
# Environment Variables when running the Nhost Dashboard against the Nhost Backend
|
||||
NEXT_PUBLIC_STRIPE_PK=<nhost_stripe_public_key>
|
||||
NEXT_PUBLIC_GITHUB_APP_INSTALL_URL=<github_app_install_url>
|
||||
NEXT_PUBLIC_ANALYTICS_WRITE_KEY=<analytics_write_key>
|
||||
|
||||
@@ -30,6 +30,7 @@ module.exports = {
|
||||
'error',
|
||||
{ ignoreTypeReferences: true },
|
||||
],
|
||||
'no-console': ['warn', { allow: ['error'] }],
|
||||
'no-shadow': 'off',
|
||||
'@typescript-eslint/no-shadow': 'error',
|
||||
'no-unused-vars': 'off',
|
||||
|
||||
6
dashboard/.gitignore
vendored
6
dashboard/.gitignore
vendored
@@ -49,4 +49,8 @@ tailwind.json
|
||||
.idea
|
||||
|
||||
# Do not ignore Logs page
|
||||
!src/**/logs*
|
||||
!src/**/logs*
|
||||
/test-results/
|
||||
/playwright-report/
|
||||
/playwright/.cache/
|
||||
storageState.json
|
||||
@@ -51,7 +51,7 @@ export const decorators = [
|
||||
(Story) => (
|
||||
<NhostApolloProvider
|
||||
fetchPolicy="cache-first"
|
||||
graphqlUrl="http://localhost:1337/v1/graphql"
|
||||
graphqlUrl="https://local.graphql.nhost.run/v1"
|
||||
>
|
||||
<Story />
|
||||
</NhostApolloProvider>
|
||||
|
||||
@@ -1,5 +1,211 @@
|
||||
# @nhost/dashboard
|
||||
|
||||
## 0.13.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- e93b06ab: fix(dashboard): remove left margin from workspace list on mobile
|
||||
- 1c4806bf: chore(deps): bump `sharp` to 0.32.0
|
||||
- @nhost/react-apollo@5.0.14
|
||||
- @nhost/nextjs@1.13.18
|
||||
|
||||
## 0.13.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 912ed76c: chore(dashboard): bump `@apollo/client` to 3.7.10
|
||||
- Updated dependencies [912ed76c]
|
||||
- @nhost/react-apollo@5.0.13
|
||||
|
||||
## 0.13.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 7c127372: chore(dashboard): bump `react-error-boundary` to v4
|
||||
|
||||
## 0.13.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 9130ab12: chore(dashboard): bump `yup` to v1 and `@hookform/resolvers` to v3
|
||||
|
||||
## 0.13.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 253dd235: using new mutation to create projects + refactor Create Project page.
|
||||
|
||||
## 0.13.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/react-apollo@5.0.12
|
||||
- @nhost/nextjs@1.13.17
|
||||
|
||||
## 0.13.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- b48bc034: fix(dashboard): disable new users
|
||||
- 798e591b: fix(dashboard): show correct date in data grid
|
||||
|
||||
## 0.13.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- bfb4c1a6: chore(dashboard): remove `useAxios` property
|
||||
- d8d8394b: Dashboard: allow to override hasura admin secret in docker
|
||||
- Updated dependencies [ce1ee40d]
|
||||
- @nhost/nextjs@1.13.16
|
||||
- @nhost/react-apollo@5.0.11
|
||||
|
||||
## 0.13.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- beed2eba: Fix docker entrypoint for dashboard
|
||||
- 2c8559a3: fix(dashboard): refresh project list after deleting a project
|
||||
- 4329d048: chore(dashboard): bump `graphiql` dependencies
|
||||
|
||||
## 0.13.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- cbb1fc5b: chore(dashboard): cleanup GraphQL operations
|
||||
|
||||
## 0.13.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 088584e7: feat(dashboard): add support for custom local subdomains
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 2ac90dfd: fix(dashboard): improve mobile responsive layout
|
||||
- Updated dependencies [f375eacc]
|
||||
- @nhost/nextjs@1.13.15
|
||||
- @nhost/react-apollo@5.0.10
|
||||
|
||||
## 0.12.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/react-apollo@5.0.9
|
||||
- @nhost/nextjs@1.13.14
|
||||
|
||||
## 0.12.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 2b1338f7: chore(dashboard): bump `turbo` to 1.8.3
|
||||
- 5223ee93: fix(dashboard): show correct deployment status on the main page
|
||||
- 850a049c: chore(deps): update docker/build-push-action action to v4
|
||||
- Updated dependencies [850a049c]
|
||||
- @nhost/nextjs@1.13.13
|
||||
- @nhost/react-apollo@5.0.8
|
||||
|
||||
## 0.12.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 4bf40995: chore(deps): bump `typescript` to `4.9.5`
|
||||
- 8bb097c9: chore(deps): bump `vitest`
|
||||
- 35d52aab: chore(deps): replace `cross-fetch` with `isomorphic-unfetch`
|
||||
- Updated dependencies [4bf40995]
|
||||
- Updated dependencies [8bb097c9]
|
||||
- Updated dependencies [35d52aab]
|
||||
- @nhost/react-apollo@5.0.7
|
||||
- @nhost/nextjs@1.13.12
|
||||
|
||||
## 0.12.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- c96d7ccd: fix(dashboard): fix docker builds
|
||||
|
||||
## 0.12.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- d1671210: feat(dashboard): use mimir to manage project configuration
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- f65e4de9: chore(deps): bump @graphql-codegen monorepo to v3
|
||||
|
||||
## 0.11.20
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 4b4f0d01: chore(dashboard): improve dialog management
|
||||
|
||||
## 0.11.19
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/react-apollo@5.0.6
|
||||
- @nhost/nextjs@1.13.11
|
||||
|
||||
## 0.11.18
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 01318860: fix(nhost-js): use correct URL for functions requests
|
||||
- Updated dependencies [01318860]
|
||||
- @nhost/react-apollo@5.0.5
|
||||
- @nhost/nextjs@1.13.10
|
||||
|
||||
## 0.11.17
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- f673adea: fix(dashboard): set correct Content-Type for user creation
|
||||
- 445d8ef4: chore(deps): bump `@nhost/react-apollo` to 5.0.4
|
||||
- 445d8ef4: chore(deps): bump `@nhost/nextjs` to 1.13.9
|
||||
- 0368663d: fix(dashboard): allow permission editing for auth and storage schemas
|
||||
- Updated dependencies [445d8ef4]
|
||||
- Updated dependencies [445d8ef4]
|
||||
- @nhost/react-apollo@5.0.4
|
||||
- @nhost/nextjs@1.13.9
|
||||
|
||||
## 0.11.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- b755e908: fix(dashboard): use correct date for last seen
|
||||
- 2d9145f9: chore(deps): revert GraphQL client
|
||||
- 1ddf704c: fix(dashboard): don't show false positive message for failed user creation
|
||||
- @nhost/react-apollo@5.0.3
|
||||
- @nhost/nextjs@1.13.8
|
||||
|
||||
## 0.11.15
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/react-apollo@5.0.2
|
||||
- @nhost/nextjs@1.13.7
|
||||
|
||||
## 0.11.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 2cc18dcb: fix(dashboard): prevent permission editor dropdown from being always open
|
||||
|
||||
## 0.11.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 3343a363: chore(dashboard): bump `@testing-library/react` to v14 and `@testing-library/dom` to v9
|
||||
- @nhost/react-apollo@5.0.1
|
||||
- @nhost/nextjs@1.13.6
|
||||
|
||||
## 0.11.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 87eda76e: chore(dashboard): bump `@types/react` to v18.0.28 and `@types/react-dom` to v18.0.11
|
||||
- 6f0ac570: feat(dashboard): show dashboard version in account menu
|
||||
|
||||
## 0.11.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -3,7 +3,7 @@ RUN apk add --no-cache libc6-compat
|
||||
RUN apk update
|
||||
WORKDIR /app
|
||||
|
||||
RUN yarn global add turbo@1.6.3
|
||||
RUN yarn global add turbo@1.8.3
|
||||
COPY . .
|
||||
RUN turbo prune --scope="@nhost/dashboard" --docker
|
||||
|
||||
@@ -11,7 +11,7 @@ FROM node:16-alpine AS builder
|
||||
ARG TURBO_TOKEN
|
||||
ARG TURBO_TEAM
|
||||
|
||||
RUN apk add --no-cache libc6-compat
|
||||
RUN apk add --no-cache libc6-compat python3 make g++
|
||||
RUN apk update
|
||||
WORKDIR /app
|
||||
|
||||
@@ -19,10 +19,15 @@ ENV NEXT_TELEMETRY_DISABLED 1
|
||||
ENV NEXT_PUBLIC_ENV dev
|
||||
ENV NEXT_PUBLIC_NHOST_PLATFORM false
|
||||
|
||||
# placeholders for ports, will be replaced on runtime by entrypoint script
|
||||
ENV NEXT_PUBLIC_NHOST_MIGRATIONS_PORT __NEXT_PUBLIC_NHOST_MIGRATIONS_PORT__
|
||||
ENV NEXT_PUBLIC_NHOST_HASURA_PORT __NEXT_PUBLIC_NHOST_HASURA_PORT__
|
||||
ENV NEXT_PUBLIC_NHOST_LOCAL_BACKEND_PORT __NEXT_PUBLIC_NHOST_LOCAL_BACKEND_PORT__
|
||||
# placeholders for URLs, will be replaced on runtime by entrypoint script
|
||||
ENV NEXT_PUBLIC_NHOST_ADMIN_SECRET __NEXT_PUBLIC_NHOST_ADMIN_SECRET__
|
||||
ENV NEXT_PUBLIC_NHOST_AUTH_URL __NEXT_PUBLIC_NHOST_AUTH_URL__
|
||||
ENV NEXT_PUBLIC_NHOST_FUNCTIONS_URL __NEXT_PUBLIC_NHOST_FUNCTIONS_URL__
|
||||
ENV NEXT_PUBLIC_NHOST_GRAPHQL_URL __NEXT_PUBLIC_NHOST_GRAPHQL_URL__
|
||||
ENV NEXT_PUBLIC_NHOST_STORAGE_URL __NEXT_PUBLIC_NHOST_STORAGE_URL__
|
||||
ENV NEXT_PUBLIC_NHOST_HASURA_CONSOLE_URL __NEXT_PUBLIC_NHOST_HASURA_CONSOLE_URL__
|
||||
ENV NEXT_PUBLIC_NHOST_HASURA_MIGRATIONS_API_URL __NEXT_PUBLIC_NHOST_HASURA_MIGRATIONS_API_URL__
|
||||
ENV NEXT_PUBLIC_NHOST_HASURA_API_URL __NEXT_PUBLIC_NHOST_HASURA_API_URL__
|
||||
|
||||
RUN yarn global add pnpm@7.17.0
|
||||
COPY .gitignore .gitignore
|
||||
|
||||
@@ -35,8 +35,17 @@ You can connect the Nhost Dashboard to your locally running backend by setting t
|
||||
```bash
|
||||
NEXT_PUBLIC_ENV=dev
|
||||
NEXT_PUBLIC_NHOST_PLATFORM=false
|
||||
NEXT_PUBLIC_NHOST_AUTH_URL=https://local.auth.nhost.run/v1
|
||||
NEXT_PUBLIC_NHOST_FUNCTIONS_URL=https://local.functions.nhost.run/v1
|
||||
NEXT_PUBLIC_NHOST_GRAPHQL_URL=https://local.graphql.nhost.run/v1
|
||||
NEXT_PUBLIC_NHOST_STORAGE_URL=https://local.storage.nhost.run/v1
|
||||
NEXT_PUBLIC_NHOST_HASURA_CONSOLE_URL=https://local.hasura.nhost.run
|
||||
NEXT_PUBLIC_NHOST_HASURA_MIGRATIONS_API_URL=https://local.hasura.nhost.run/v1/migrations
|
||||
NEXT_PUBLIC_NHOST_HASURA_API_URL=https://local.hasura.nhost.run
|
||||
```
|
||||
|
||||
This will connect the Nhost Dashboard to your locally running Nhost backend.
|
||||
|
||||
### Storybook
|
||||
|
||||
Components are documented using [Storybook](https://storybook.js.org/). To run Storybook, run the following command:
|
||||
@@ -45,20 +54,39 @@ Components are documented using [Storybook](https://storybook.js.org/). To run S
|
||||
pnpm storybook
|
||||
```
|
||||
|
||||
### Full list of environment variables
|
||||
### General Environment Variables
|
||||
|
||||
| Name | Description |
|
||||
| ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `NEXT_PUBLIC_ENV` | `dev`, `staging` or `prod`. Should be set to `dev` in most cases. |
|
||||
| `NEXT_PUBLIC_NHOST_PLATFORM` | This should be set to `false` to connect the Nhost Dashboard to a locally running Nhost backend. Setting this to `true` turns off local development. |
|
||||
| `NEXT_PUBLIC_NHOST_LOCAL_MIGRATIONS_PORT` | Custom port that was passed to the CLI. Used only if local development is enabled. Default: `9693` |
|
||||
| `NEXT_PUBLIC_NHOST_LOCAL_HASURA_PORT` | Custom port that was passed to the CLI. Used only if local development is enabled and `NEXT_PUBLIC_ENV` is `dev`. Default: `9695` |
|
||||
| `NEXT_PUBLIC_NHOST_LOCAL_BACKEND_PORT` | Custom port that was passed to the CLI. Used only if local development is enabled. Default: `1337` |
|
||||
| `NEXT_PUBLIC_NHOST_BACKEND_URL` | Backend URL. Not necessary for local development. |
|
||||
| `NEXT_PUBLIC_STRIPE_PK` | Stripe public key. Not necessary for local development. |
|
||||
| `NEXT_PUBLIC_GITHUB_APP_INSTALL_URL` | URL of the GitHub application. Not necessary for local development. |
|
||||
| `NEXT_PUBLIC_ANALYTICS_WRITE_KEY` | Analytics key. Not necessary for local development. |
|
||||
| `NEXT_PUBLIC_NHOST_BRAGI_WEBSOCKET` | URL of the Bragi websocket. Not necessary for local development. |
|
||||
| Name | Description |
|
||||
| -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `NEXT_PUBLIC_ENV` | `dev`, `staging` or `prod`. This should be set to `dev` in most cases. |
|
||||
| `NEXT_PUBLIC_NHOST_ADMIN_SECRET` | Admin secret for Hasura. Default: `nhost-admin-secret` |
|
||||
| `NEXT_PUBLIC_NHOST_PLATFORM` | This should be set to `false` to connect the Nhost Dashboard to a locally running or a self-hosted Nhost backend. Setting this to `true` will connect the Nhost Dashboard to the cloud environment. Default: `false` |
|
||||
|
||||
### Environment Variables for Local Development and Self-Hosting
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
|
||||
| `NEXT_PUBLIC_NHOST_AUTH_URL` | The URL of the Auth service. When working locally, point it to the Auth service started by the CLI. When self-hosting, point it to the self-hosted Auth service. |
|
||||
| `NEXT_PUBLIC_NHOST_FUNCTIONS_URL` | The URL of the Functions service. When working locally, point it to the Functions service started by the CLI. When self-hosting, point it to the self-hosted Functions service. |
|
||||
| `NEXT_PUBLIC_NHOST_GRAPHQL_URL` | The URL of the GraphQL service. When working locally, point it to the GraphQL service started by the CLI. When self-hosting, point it to the self-hosted GraphQL service. |
|
||||
| `NEXT_PUBLIC_NHOST_STORAGE_URL` | The URL of the Storage service. When working locally, point it to the Storage service started by the CLI. When self-hosting, point it to the self-hosted Storage service. |
|
||||
| `NEXT_PUBLIC_NHOST_HASURA_CONSOLE_URL` | The URL of the Hasura Console. When working locally, point it to the Hasura Console started by the CLI. When self-hosting, point it to the self-hosted Hasura Console. |
|
||||
| `NEXT_PUBLIC_NHOST_HASURA_MIGRATIONS_API_URL` | The URL of Hasura's Migrations service. When working locally, point it to the Migrations service started by the CLI. |
|
||||
| `NEXT_PUBLIC_NHOST_HASURA_API_URL` | The URL of Hasura's Schema and Metadata API. When working locally, point it to the Schema and Metadata API started by the CLI. When self-hosting, point it to the self-hosted Schema and Metadata API. |
|
||||
|
||||
### Other Environment Variables
|
||||
|
||||
| Name | Description |
|
||||
| --------------------------------------- | ------------------------------------------------------------------------------------------- |
|
||||
| `NEXT_PUBLIC_NHOST_BACKEND_URL` | Backend URL. This is only used if `NEXT_PUBLIC_NHOST_PLATFORM` is `true`. |
|
||||
| `NEXT_PUBLIC_STRIPE_PK` | Stripe public key. This is only used if `NEXT_PUBLIC_NHOST_PLATFORM` is `true`. |
|
||||
| `NEXT_PUBLIC_GITHUB_APP_INSTALL_URL` | URL of the GitHub application. This is only used if `NEXT_PUBLIC_NHOST_PLATFORM` is `true`. |
|
||||
| `NEXT_PUBLIC_ANALYTICS_WRITE_KEY` | Analytics key. This is only used if `NEXT_PUBLIC_NHOST_PLATFORM` is `true`. |
|
||||
| `NEXT_PUBLIC_NHOST_BRAGI_WEBSOCKET` | URL of the Bragi websocket. This is only used if `NEXT_PUBLIC_NHOST_PLATFORM` is `true`. |
|
||||
| `NEXT_PUBLIC_MAINTENANCE_ACTIVE` | Determines whether or not maintenance mode is active. |
|
||||
| `NEXT_PUBLIC_MAINTENANCE_END_DATE` | Date when maintenance mode will end. |
|
||||
| `NEXT_PUBLIC_MAINTENANCE_UNLOCK_SECRET` | Secret that can be used to bypass maintenance mode. |
|
||||
|
||||
## ESLint Rules
|
||||
|
||||
@@ -83,3 +111,21 @@ pnpm storybook
|
||||
| `@typescript-eslint/consistent-type-imports` | Enforces `import type { Type } from 'module'` syntax. It prevents false positive circular dependency errors. |
|
||||
| `@typescript-eslint/naming-convention` | Enforces a consistent naming convention. |
|
||||
| `no-restricted-imports` | Enforces absolute imports and consistent import paths for components from `src/components/ui` folder. |
|
||||
|
||||
### End-to-End Tests
|
||||
|
||||
End-to-end tests are written using [Playwright](https://playwright.dev/). To run the tests, run the following command:
|
||||
|
||||
```bash
|
||||
pnpm e2e
|
||||
```
|
||||
|
||||
Most of the tests require access to the Nhost test user. To run these tests, you need to set the following environment variables in `.env.test`:
|
||||
|
||||
```
|
||||
NHOST_TEST_DASHBOARD_URL=<test_dashboard_url>
|
||||
NHOST_TEST_USER_EMAIL=<test_user_email>
|
||||
NHOST_TEST_USER_PASSWORD=<test_user_password>
|
||||
NHOST_TEST_WORKSPACE_NAME=<test_workspace_name>
|
||||
NHOST_TEST_PROJECT_NAME=<test_project_name>
|
||||
```
|
||||
|
||||
@@ -1,15 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
set -euo pipefail
|
||||
|
||||
# read ports from env variables or use defaults
|
||||
NEXT_PUBLIC_NHOST_MIGRATIONS_PORT="${NEXT_PUBLIC_NHOST_MIGRATIONS_PORT:=9693}"
|
||||
NEXT_PUBLIC_NHOST_HASURA_PORT="${NEXT_PUBLIC_NHOST_HASURA_PORT:=9695}"
|
||||
NEXT_PUBLIC_NHOST_LOCAL_BACKEND_PORT="${NEXT_PUBLIC_NHOST_LOCAL_BACKEND_PORT:=1337}"
|
||||
# read URLs from env variables (with defaults)
|
||||
NEXT_PUBLIC_NHOST_ADMIN_SECRET="${NEXT_PUBLIC_NHOST_ADMIN_SECRET:-nhost-admin-secret}"
|
||||
NEXT_PUBLIC_NHOST_AUTH_URL="${NEXT_PUBLIC_NHOST_AUTH_URL:-http://localhost:1337/v1/auth}"
|
||||
NEXT_PUBLIC_NHOST_FUNCTIONS_URL="${NEXT_PUBLIC_NHOST_FUNCTIONS_URL:-http://localhost:1337/v1/functions}"
|
||||
NEXT_PUBLIC_NHOST_GRAPHQL_URL="${NEXT_PUBLIC_NHOST_GRAPHQL_URL:-http://localhost:1337/v1/graphql}"
|
||||
NEXT_PUBLIC_NHOST_STORAGE_URL="${NEXT_PUBLIC_NHOST_STORAGE_URL:-http://localhost:1337/v1/storage}"
|
||||
NEXT_PUBLIC_NHOST_HASURA_CONSOLE_URL="${NEXT_PUBLIC_NHOST_HASURA_CONSOLE_URL:-http://localhost:9695}"
|
||||
NEXT_PUBLIC_NHOST_HASURA_MIGRATIONS_API_URL="${NEXT_PUBLIC_NHOST_HASURA_MIGRATIONS_API_URL:-http://localhost:9693}"
|
||||
NEXT_PUBLIC_NHOST_HASURA_API_URL="${NEXT_PUBLIC_NHOST_HASURA_API_URL:-http://localhost:8080}"
|
||||
|
||||
# replace placeholders
|
||||
find dashboard -type f -exec sed -i "s/__NEXT_PUBLIC_NHOST_MIGRATIONS_PORT__/${NEXT_PUBLIC_NHOST_MIGRATIONS_PORT}/g" {} +
|
||||
find dashboard -type f -exec sed -i "s/__NEXT_PUBLIC_NHOST_HASURA_PORT__/${NEXT_PUBLIC_NHOST_HASURA_PORT}/g" {} +
|
||||
find dashboard -type f -exec sed -i "s/__NEXT_PUBLIC_NHOST_LOCAL_BACKEND_PORT__/${NEXT_PUBLIC_NHOST_LOCAL_BACKEND_PORT}/g" {} +
|
||||
find dashboard -type f -exec sed -i "s~__NEXT_PUBLIC_NHOST_ADMIN_SECRET__~${NEXT_PUBLIC_NHOST_ADMIN_SECRET}~g" {} +
|
||||
find dashboard -type f -exec sed -i "s~__NEXT_PUBLIC_NHOST_AUTH_URL__~${NEXT_PUBLIC_NHOST_AUTH_URL}~g" {} +
|
||||
find dashboard -type f -exec sed -i "s~__NEXT_PUBLIC_NHOST_FUNCTIONS_URL__~${NEXT_PUBLIC_NHOST_FUNCTIONS_URL}~g" {} +
|
||||
find dashboard -type f -exec sed -i "s~__NEXT_PUBLIC_NHOST_GRAPHQL_URL__~${NEXT_PUBLIC_NHOST_GRAPHQL_URL}~g" {} +
|
||||
find dashboard -type f -exec sed -i "s~__NEXT_PUBLIC_NHOST_STORAGE_URL__~${NEXT_PUBLIC_NHOST_STORAGE_URL}~g" {} +
|
||||
find dashboard -type f -exec sed -i "s~__NEXT_PUBLIC_NHOST_HASURA_CONSOLE_URL__~${NEXT_PUBLIC_NHOST_HASURA_CONSOLE_URL}~g" {} +
|
||||
find dashboard -type f -exec sed -i "s~__NEXT_PUBLIC_NHOST_HASURA_MIGRATIONS_API_URL__~${NEXT_PUBLIC_NHOST_HASURA_MIGRATIONS_API_URL}~g" {} +
|
||||
find dashboard -type f -exec sed -i "s~__NEXT_PUBLIC_NHOST_HASURA_API_URL__~${NEXT_PUBLIC_NHOST_HASURA_API_URL}~g" {} +
|
||||
|
||||
exec "$@"
|
||||
|
||||
93
dashboard/e2e/auth/user-management.test.ts
Normal file
93
dashboard/e2e/auth/user-management.test.ts
Normal file
@@ -0,0 +1,93 @@
|
||||
import {
|
||||
TEST_PROJECT_NAME,
|
||||
TEST_PROJECT_SLUG,
|
||||
TEST_WORKSPACE_SLUG,
|
||||
} from '@/e2e/env';
|
||||
import { openProject } from '@/e2e/utils';
|
||||
import type { Page } from '@playwright/test';
|
||||
import { expect, test } from '@playwright/test';
|
||||
|
||||
let page: Page;
|
||||
|
||||
test.describe.configure({ mode: 'serial' });
|
||||
|
||||
test.beforeAll(async ({ browser }) => {
|
||||
page = await browser.newPage();
|
||||
|
||||
await page.goto('/');
|
||||
|
||||
await openProject({
|
||||
page,
|
||||
projectName: TEST_PROJECT_NAME,
|
||||
workspaceSlug: TEST_WORKSPACE_SLUG,
|
||||
projectSlug: TEST_PROJECT_SLUG,
|
||||
});
|
||||
|
||||
await page
|
||||
.getByRole('navigation', { name: /main navigation/i })
|
||||
.getByRole('link', { name: /auth/i })
|
||||
.click();
|
||||
|
||||
await page.waitForURL(`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/users`);
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await page.close();
|
||||
});
|
||||
|
||||
test('should create a user', async () => {
|
||||
await expect(
|
||||
page.getByRole('heading', { name: /there are no users yet/i }),
|
||||
).toBeVisible();
|
||||
|
||||
await page
|
||||
.getByRole('button', { name: /create user/i })
|
||||
.first()
|
||||
.click();
|
||||
|
||||
await expect(page.getByRole('dialog')).toBeVisible();
|
||||
await expect(
|
||||
page.getByRole('heading', { name: /create user/i }),
|
||||
).toBeVisible();
|
||||
|
||||
await page
|
||||
.getByRole('textbox', { name: /email/i })
|
||||
.fill('testuser@example.com');
|
||||
await page.getByRole('textbox', { name: /password/i }).fill('test.password');
|
||||
await page.getByRole('button', { name: /create/i, exact: true }).click();
|
||||
|
||||
await expect(page.getByRole('dialog')).not.toBeVisible();
|
||||
|
||||
await expect(
|
||||
page.getByRole('button', { name: /view testuser@example.com/i }),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test('should delete a user', async () => {
|
||||
await expect(
|
||||
page.getByRole('button', { name: /view testuser@example.com/i }),
|
||||
).toBeVisible();
|
||||
|
||||
await page
|
||||
.getByRole('button', { name: /more options for testuser@example.com/i })
|
||||
.click();
|
||||
await page.getByRole('menuitem', { name: /delete user/i }).click();
|
||||
|
||||
await expect(page.getByRole('dialog')).toBeVisible();
|
||||
await expect(
|
||||
page.getByRole('heading', { name: /delete user/i }),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.getByText(
|
||||
/are you sure you want to delete the "testuser@example.com" user?/i,
|
||||
),
|
||||
).toBeVisible();
|
||||
|
||||
await page.getByRole('button', { name: /delete/i, exact: true }).click();
|
||||
|
||||
await expect(page.getByRole('dialog')).not.toBeVisible();
|
||||
|
||||
await expect(
|
||||
page.getByRole('heading', { name: /there are no users yet/i }),
|
||||
).toBeVisible();
|
||||
});
|
||||
276
dashboard/e2e/database/create-table.test.ts
Normal file
276
dashboard/e2e/database/create-table.test.ts
Normal file
@@ -0,0 +1,276 @@
|
||||
import {
|
||||
TEST_PROJECT_NAME,
|
||||
TEST_PROJECT_SLUG,
|
||||
TEST_WORKSPACE_SLUG,
|
||||
} from '@/e2e/env';
|
||||
import { openProject, prepareTable } from '@/e2e/utils';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import type { Page } from '@playwright/test';
|
||||
import { expect, test } from '@playwright/test';
|
||||
|
||||
let page: Page;
|
||||
|
||||
test.beforeAll(async ({ browser }) => {
|
||||
page = await browser.newPage();
|
||||
await page.goto('/');
|
||||
|
||||
await openProject({
|
||||
page,
|
||||
projectName: TEST_PROJECT_NAME,
|
||||
workspaceSlug: TEST_WORKSPACE_SLUG,
|
||||
projectSlug: TEST_PROJECT_SLUG,
|
||||
});
|
||||
|
||||
await page
|
||||
.getByRole('navigation', { name: /main navigation/i })
|
||||
.getByRole('link', { name: /database/i })
|
||||
.click();
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await page.close();
|
||||
});
|
||||
|
||||
test('should create a simple table', async () => {
|
||||
await page.getByRole('button', { name: /new table/i }).click();
|
||||
await expect(page.getByText(/create a new table/i)).toBeVisible();
|
||||
|
||||
const tableName = faker.random.word().toLowerCase();
|
||||
|
||||
await prepareTable({
|
||||
page,
|
||||
name: tableName,
|
||||
primaryKey: 'id',
|
||||
columns: [
|
||||
{ name: 'id', type: 'uuid', defaultValue: 'gen_random_uuid()' },
|
||||
{ name: 'title', type: 'text' },
|
||||
],
|
||||
});
|
||||
|
||||
// create table
|
||||
await page.getByRole('button', { name: /create/i }).click();
|
||||
|
||||
await page.waitForURL(
|
||||
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${tableName}`,
|
||||
);
|
||||
|
||||
await expect(
|
||||
page.getByRole('link', { name: tableName, exact: true }),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test('should create a table with unique constraints', async () => {
|
||||
await page.getByRole('button', { name: /new table/i }).click();
|
||||
await expect(page.getByText(/create a new table/i)).toBeVisible();
|
||||
|
||||
const tableName = faker.random.word().toLowerCase();
|
||||
|
||||
await prepareTable({
|
||||
page,
|
||||
name: tableName,
|
||||
primaryKey: 'id',
|
||||
columns: [
|
||||
{ name: 'id', type: 'uuid', defaultValue: 'gen_random_uuid()' },
|
||||
{ name: 'title', type: 'text', unique: true },
|
||||
{ name: 'isbn', type: 'text', unique: true },
|
||||
],
|
||||
});
|
||||
|
||||
// create table
|
||||
await page.getByRole('button', { name: /create/i }).click();
|
||||
|
||||
await page.waitForURL(
|
||||
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${tableName}`,
|
||||
);
|
||||
|
||||
await expect(
|
||||
page.getByRole('link', { name: tableName, exact: true }),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test('should create a table with nullable columns', async () => {
|
||||
await page.getByRole('button', { name: /new table/i }).click();
|
||||
await expect(page.getByText(/create a new table/i)).toBeVisible();
|
||||
|
||||
const tableName = faker.random.word().toLowerCase();
|
||||
|
||||
await prepareTable({
|
||||
page,
|
||||
name: tableName,
|
||||
primaryKey: 'id',
|
||||
columns: [
|
||||
{ name: 'id', type: 'uuid', defaultValue: 'gen_random_uuid()' },
|
||||
{ name: 'title', type: 'text', nullable: true },
|
||||
{ name: 'description', type: 'text', nullable: true },
|
||||
],
|
||||
});
|
||||
|
||||
// create table
|
||||
await page.getByRole('button', { name: /create/i }).click();
|
||||
|
||||
await page.waitForURL(
|
||||
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${tableName}`,
|
||||
);
|
||||
|
||||
await expect(
|
||||
page.getByRole('link', { name: tableName, exact: true }),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test('should create a table with an identity column', async () => {
|
||||
await page.getByRole('button', { name: /new table/i }).click();
|
||||
await expect(page.getByText(/create a new table/i)).toBeVisible();
|
||||
|
||||
const tableName = faker.random.word().toLowerCase();
|
||||
|
||||
await prepareTable({
|
||||
page,
|
||||
name: tableName,
|
||||
primaryKey: 'id',
|
||||
columns: [
|
||||
{ name: 'id', type: 'int4' },
|
||||
{ name: 'title', type: 'text', nullable: true },
|
||||
{ name: 'description', type: 'text', nullable: true },
|
||||
],
|
||||
});
|
||||
|
||||
await page.getByRole('button', { name: /identity/i }).click();
|
||||
await page.getByRole('option', { name: /id/i }).click();
|
||||
|
||||
// create table
|
||||
await page.getByRole('button', { name: /create/i }).click();
|
||||
|
||||
await page.waitForURL(
|
||||
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${tableName}`,
|
||||
);
|
||||
|
||||
await expect(
|
||||
page.getByRole('link', { name: tableName, exact: true }),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test('should create table with foreign key constraint', async () => {
|
||||
await page.getByRole('button', { name: /new table/i }).click();
|
||||
await expect(page.getByText(/create a new table/i)).toBeVisible();
|
||||
|
||||
const firstTableName = faker.random.word().toLowerCase();
|
||||
|
||||
await prepareTable({
|
||||
page,
|
||||
name: firstTableName,
|
||||
primaryKey: 'id',
|
||||
columns: [
|
||||
{ name: 'id', type: 'uuid', defaultValue: 'gen_random_uuid()' },
|
||||
{ name: 'name', type: 'text' },
|
||||
],
|
||||
});
|
||||
|
||||
// create table
|
||||
await page.getByRole('button', { name: /create/i }).click();
|
||||
|
||||
await page.waitForURL(
|
||||
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${firstTableName}`,
|
||||
);
|
||||
|
||||
await page.getByRole('button', { name: /new table/i }).click();
|
||||
await expect(page.getByText(/create a new table/i)).toBeVisible();
|
||||
|
||||
const secondTableName = faker.random.word().toLowerCase();
|
||||
|
||||
await prepareTable({
|
||||
page,
|
||||
name: secondTableName,
|
||||
primaryKey: 'id',
|
||||
columns: [
|
||||
{ name: 'id', type: 'uuid', defaultValue: 'gen_random_uuid()' },
|
||||
{ name: 'title', type: 'text' },
|
||||
{ name: 'author_id', type: 'uuid' },
|
||||
],
|
||||
});
|
||||
|
||||
await page.getByRole('button', { name: /add foreign key/i }).click();
|
||||
|
||||
// select column in current table
|
||||
await page
|
||||
.getByRole('button', { name: /column/i })
|
||||
.first()
|
||||
.click();
|
||||
await page.getByRole('option', { name: /author_id/i }).click();
|
||||
|
||||
// select reference schema
|
||||
await page.getByRole('button', { name: /schema/i }).click();
|
||||
await page.getByRole('option', { name: /public/i }).click();
|
||||
|
||||
// select reference table
|
||||
await page.getByRole('button', { name: /table/i }).click();
|
||||
await page.getByRole('option', { name: firstTableName, exact: true }).click();
|
||||
|
||||
// select reference column
|
||||
await page
|
||||
.getByRole('button', { name: /column/i })
|
||||
.nth(1)
|
||||
.click();
|
||||
await page.getByRole('option', { name: /id/i }).click();
|
||||
|
||||
await page.getByRole('button', { name: /add/i }).click();
|
||||
|
||||
await expect(
|
||||
page.getByText(`public.${firstTableName}.id`, { exact: true }),
|
||||
).toBeVisible();
|
||||
|
||||
// create table
|
||||
await page.getByRole('button', { name: /create/i }).click();
|
||||
|
||||
await page.waitForURL(
|
||||
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${secondTableName}`,
|
||||
);
|
||||
|
||||
await expect(
|
||||
page.getByRole('link', { name: secondTableName, exact: true }),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test('should not be able to create a table with a name that already exists', async () => {
|
||||
await page.getByRole('button', { name: /new table/i }).click();
|
||||
await expect(page.getByText(/create a new table/i)).toBeVisible();
|
||||
|
||||
const tableName = faker.random.word().toLowerCase();
|
||||
|
||||
await prepareTable({
|
||||
page,
|
||||
name: tableName,
|
||||
primaryKey: 'id',
|
||||
columns: [
|
||||
{ name: 'id', type: 'uuid', defaultValue: 'gen_random_uuid()' },
|
||||
{ name: 'name', type: 'text' },
|
||||
],
|
||||
});
|
||||
|
||||
// create table
|
||||
await page.getByRole('button', { name: /create/i }).click();
|
||||
|
||||
await page.waitForURL(
|
||||
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${tableName}`,
|
||||
);
|
||||
|
||||
await page.getByRole('button', { name: /new table/i }).click();
|
||||
await expect(page.getByText(/create a new table/i)).toBeVisible();
|
||||
|
||||
await prepareTable({
|
||||
page,
|
||||
name: tableName,
|
||||
primaryKey: 'id',
|
||||
columns: [
|
||||
{ name: 'id', type: 'uuid', defaultValue: 'gen_random_uuid()' },
|
||||
{ name: 'title', type: 'text' },
|
||||
{ name: 'author_id', type: 'uuid' },
|
||||
],
|
||||
});
|
||||
|
||||
// create table
|
||||
await page.getByRole('button', { name: /create/i }).click();
|
||||
|
||||
await expect(
|
||||
page.getByText(/error: a table with this name already exists/i),
|
||||
).toBeVisible();
|
||||
});
|
||||
191
dashboard/e2e/database/delete-table.test.ts
Normal file
191
dashboard/e2e/database/delete-table.test.ts
Normal file
@@ -0,0 +1,191 @@
|
||||
import {
|
||||
TEST_PROJECT_NAME,
|
||||
TEST_PROJECT_SLUG,
|
||||
TEST_WORKSPACE_SLUG,
|
||||
} from '@/e2e/env';
|
||||
import { openProject, prepareTable } from '@/e2e/utils';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import type { Page } from '@playwright/test';
|
||||
import { expect, test } from '@playwright/test';
|
||||
|
||||
let page: Page;
|
||||
|
||||
test.beforeAll(async ({ browser }) => {
|
||||
page = await browser.newPage();
|
||||
await page.goto('/');
|
||||
|
||||
await openProject({
|
||||
page,
|
||||
projectName: TEST_PROJECT_NAME,
|
||||
workspaceSlug: TEST_WORKSPACE_SLUG,
|
||||
projectSlug: TEST_PROJECT_SLUG,
|
||||
});
|
||||
|
||||
await page
|
||||
.getByRole('navigation', { name: /main navigation/i })
|
||||
.getByRole('link', { name: /database/i })
|
||||
.click();
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await page.close();
|
||||
});
|
||||
|
||||
test('should delete a table', async () => {
|
||||
const tableName = faker.random.word().toLowerCase();
|
||||
|
||||
await page.getByRole('button', { name: /new table/i }).click();
|
||||
|
||||
await prepareTable({
|
||||
page,
|
||||
name: tableName,
|
||||
primaryKey: 'id',
|
||||
columns: [
|
||||
{ name: 'id', type: 'uuid', defaultValue: 'gen_random_uuid()' },
|
||||
{ name: 'title', type: 'text' },
|
||||
],
|
||||
});
|
||||
|
||||
await page.getByRole('button', { name: /create/i }).click();
|
||||
|
||||
await page.waitForURL(
|
||||
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${tableName}`,
|
||||
);
|
||||
|
||||
const tableLink = page.getByRole('link', {
|
||||
name: tableName,
|
||||
exact: true,
|
||||
});
|
||||
|
||||
await tableLink.hover();
|
||||
await page
|
||||
.getByRole('listitem')
|
||||
.filter({ hasText: tableName })
|
||||
.getByRole('button')
|
||||
.click();
|
||||
|
||||
await page.getByRole('menuitem', { name: /delete table/i }).click();
|
||||
|
||||
await expect(
|
||||
page.getByRole('heading', { name: /delete table/i }),
|
||||
).toBeVisible();
|
||||
|
||||
await page.getByRole('button', { name: /delete/i }).click();
|
||||
|
||||
// navigate to next URL
|
||||
await page.waitForURL(
|
||||
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/**`,
|
||||
);
|
||||
|
||||
await expect(
|
||||
page.getByRole('link', { name: tableName, exact: true }),
|
||||
).not.toBeVisible();
|
||||
});
|
||||
|
||||
test('should not be able to delete a table if other tables have foreign keys referencing it', async () => {
|
||||
await page.getByRole('button', { name: /new table/i }).click();
|
||||
await expect(page.getByText(/create a new table/i)).toBeVisible();
|
||||
|
||||
const firstTableName = faker.random.word().toLowerCase();
|
||||
|
||||
await prepareTable({
|
||||
page,
|
||||
name: firstTableName,
|
||||
primaryKey: 'id',
|
||||
columns: [
|
||||
{ name: 'id', type: 'uuid', defaultValue: 'gen_random_uuid()' },
|
||||
{ name: 'name', type: 'text' },
|
||||
],
|
||||
});
|
||||
|
||||
// create table
|
||||
await page.getByRole('button', { name: /create/i }).click();
|
||||
|
||||
await page.waitForURL(
|
||||
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${firstTableName}`,
|
||||
);
|
||||
|
||||
await page.getByRole('button', { name: /new table/i }).click();
|
||||
await expect(page.getByText(/create a new table/i)).toBeVisible();
|
||||
|
||||
const secondTableName = faker.random.word().toLowerCase();
|
||||
|
||||
await prepareTable({
|
||||
page,
|
||||
name: secondTableName,
|
||||
primaryKey: 'id',
|
||||
columns: [
|
||||
{ name: 'id', type: 'uuid', defaultValue: 'gen_random_uuid()' },
|
||||
{ name: 'title', type: 'text' },
|
||||
{ name: 'author_id', type: 'uuid' },
|
||||
],
|
||||
});
|
||||
|
||||
await page.getByRole('button', { name: /add foreign key/i }).click();
|
||||
|
||||
// select column in current table
|
||||
await page
|
||||
.getByRole('button', { name: /column/i })
|
||||
.first()
|
||||
.click();
|
||||
await page.getByRole('option', { name: /author_id/i }).click();
|
||||
|
||||
// select reference schema
|
||||
await page.getByRole('button', { name: /schema/i }).click();
|
||||
await page.getByRole('option', { name: /public/i }).click();
|
||||
|
||||
// select reference table
|
||||
await page.getByRole('button', { name: /table/i }).click();
|
||||
await page.getByRole('option', { name: firstTableName, exact: true }).click();
|
||||
|
||||
// select reference column
|
||||
await page
|
||||
.getByRole('button', { name: /column/i })
|
||||
.nth(1)
|
||||
.click();
|
||||
await page.getByRole('option', { name: /id/i }).click();
|
||||
|
||||
await page.getByRole('button', { name: /add/i }).click();
|
||||
|
||||
await expect(
|
||||
page.getByText(`public.${firstTableName}.id`, { exact: true }),
|
||||
).toBeVisible();
|
||||
|
||||
// create table
|
||||
await page.getByRole('button', { name: /create/i }).click();
|
||||
|
||||
await page.waitForURL(
|
||||
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${secondTableName}`,
|
||||
);
|
||||
|
||||
await expect(
|
||||
page.getByRole('link', { name: secondTableName, exact: true }),
|
||||
).toBeVisible();
|
||||
|
||||
// try to delete the first table that is referenced by the second table
|
||||
const tableLink = page.getByRole('link', {
|
||||
name: firstTableName,
|
||||
exact: true,
|
||||
});
|
||||
|
||||
await tableLink.hover();
|
||||
await page
|
||||
.getByRole('listitem')
|
||||
.filter({ hasText: firstTableName })
|
||||
.getByRole('button')
|
||||
.click();
|
||||
|
||||
await page.getByRole('menuitem', { name: /delete table/i }).click();
|
||||
|
||||
await expect(
|
||||
page.getByRole('heading', { name: /delete table/i }),
|
||||
).toBeVisible();
|
||||
|
||||
await page.getByRole('button', { name: /delete/i }).click();
|
||||
|
||||
await expect(
|
||||
page.getByText(
|
||||
/constraint [a-zA-Z_]+ on table [a-zA-Z_]+ depends on table [a-zA-Z_]+/i,
|
||||
),
|
||||
).toBeVisible();
|
||||
});
|
||||
42
dashboard/e2e/env.ts
Normal file
42
dashboard/e2e/env.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import slugify from 'slugify';
|
||||
|
||||
/**
|
||||
* URL of the dashboard to test against.
|
||||
*/
|
||||
export const TEST_DASHBOARD_URL = process.env.NHOST_TEST_DASHBOARD_URL;
|
||||
|
||||
/**
|
||||
* Name of the workspace to test against.
|
||||
*/
|
||||
export const TEST_WORKSPACE_NAME = process.env.NHOST_TEST_WORKSPACE_NAME;
|
||||
|
||||
/**
|
||||
* Slugified name of the workspace to test against.
|
||||
*/
|
||||
export const TEST_WORKSPACE_SLUG = slugify(TEST_WORKSPACE_NAME, {
|
||||
lower: true,
|
||||
strict: true,
|
||||
});
|
||||
|
||||
/**
|
||||
* Name of the project to test against.
|
||||
*/
|
||||
export const TEST_PROJECT_NAME = process.env.NHOST_TEST_PROJECT_NAME;
|
||||
|
||||
/**
|
||||
* Slugified name of the project to test against.
|
||||
*/
|
||||
export const TEST_PROJECT_SLUG = slugify(TEST_PROJECT_NAME, {
|
||||
lower: true,
|
||||
strict: true,
|
||||
});
|
||||
|
||||
/**
|
||||
* Email of the test account to use.
|
||||
*/
|
||||
export const TEST_USER_EMAIL = process.env.NHOST_TEST_USER_EMAIL;
|
||||
|
||||
/**
|
||||
* Password of the test account to use.
|
||||
*/
|
||||
export const TEST_USER_PASSWORD = process.env.NHOST_TEST_USER_PASSWORD;
|
||||
109
dashboard/e2e/overview/overview.test.ts
Normal file
109
dashboard/e2e/overview/overview.test.ts
Normal file
@@ -0,0 +1,109 @@
|
||||
import {
|
||||
TEST_PROJECT_NAME,
|
||||
TEST_PROJECT_SLUG,
|
||||
TEST_WORKSPACE_NAME,
|
||||
TEST_WORKSPACE_SLUG,
|
||||
} from '@/e2e/env';
|
||||
import { openProject } from '@/e2e/utils';
|
||||
import type { Page } from '@playwright/test';
|
||||
import { expect, test } from '@playwright/test';
|
||||
|
||||
let page: Page;
|
||||
|
||||
test.beforeAll(async ({ browser }) => {
|
||||
page = await browser.newPage();
|
||||
|
||||
await page.goto('/');
|
||||
await openProject({
|
||||
page,
|
||||
projectName: TEST_PROJECT_NAME,
|
||||
workspaceSlug: TEST_WORKSPACE_SLUG,
|
||||
projectSlug: TEST_PROJECT_SLUG,
|
||||
});
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await page.close();
|
||||
});
|
||||
|
||||
test('should show a sidebar with menu items', async () => {
|
||||
const navLocator = page.getByRole('navigation', { name: /main navigation/i });
|
||||
await expect(navLocator).toBeVisible();
|
||||
await expect(navLocator.getByRole('list').getByRole('listitem')).toHaveCount(
|
||||
10,
|
||||
);
|
||||
await expect(
|
||||
navLocator.getByRole('link', { name: /overview/i }),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
navLocator.getByRole('link', { name: /database/i }),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
navLocator.getByRole('link', { name: /graphql/i }),
|
||||
).toBeVisible();
|
||||
await expect(navLocator.getByRole('link', { name: /hasura/i })).toBeVisible();
|
||||
await expect(navLocator.getByRole('link', { name: /auth/i })).toBeVisible();
|
||||
await expect(
|
||||
navLocator.getByRole('link', { name: /storage/i }),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
navLocator.getByRole('link', { name: /deployments/i }),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
navLocator.getByRole('link', { name: /backups/i }),
|
||||
).toBeVisible();
|
||||
await expect(navLocator.getByRole('link', { name: /logs/i })).toBeVisible();
|
||||
await expect(
|
||||
navLocator.getByRole('link', { name: /settings/i }),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test('should show a header with a logo, the workspace name, and the project name', async () => {
|
||||
await expect(
|
||||
page.getByRole('banner').getByRole('link', { name: TEST_WORKSPACE_NAME }),
|
||||
).toBeVisible();
|
||||
|
||||
await expect(
|
||||
page.getByRole('banner').getByRole('link', { name: TEST_PROJECT_NAME }),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test("should show the project's name, the Upgrade button and the Settings button", async () => {
|
||||
await expect(
|
||||
page.getByRole('heading', { name: TEST_PROJECT_NAME }),
|
||||
).toBeVisible();
|
||||
await expect(page.getByText(/free plan/i)).toBeVisible();
|
||||
await expect(page.getByRole('button', { name: /upgrade/i })).toBeVisible();
|
||||
await expect(
|
||||
page.getByRole('main').getByRole('link', { name: /settings/i }),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test("should show the project's region and subdomain", async () => {
|
||||
await expect(page.locator('p:has-text("Region") + div p').nth(0)).toHaveText(
|
||||
/frankfurt \(eu-central-1\)/i,
|
||||
);
|
||||
await expect(
|
||||
page.locator('p:has-text("Subdomain") + div p').nth(0),
|
||||
).toHaveText(/[a-z]{20}/i);
|
||||
});
|
||||
|
||||
test('should not have a GitHub repository connected', async () => {
|
||||
await expect(
|
||||
page.getByRole('button', { name: /connect to github/i }),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test('should show proper limits for the free project', async () => {
|
||||
// Limit for Database
|
||||
await expect(page.getByText(/of 500 MB/i)).toBeVisible();
|
||||
|
||||
// Limit for Storage
|
||||
await expect(page.getByText(/of 1 GB/i)).toBeVisible();
|
||||
|
||||
// Limit for Users
|
||||
await expect(page.getByText(/of 10000/i)).toBeVisible();
|
||||
|
||||
// Limit for Functions
|
||||
await expect(page.getByText(/of 10$/i, { exact: true })).toBeVisible();
|
||||
});
|
||||
113
dashboard/e2e/utils.ts
Normal file
113
dashboard/e2e/utils.ts
Normal file
@@ -0,0 +1,113 @@
|
||||
import type { Page } from '@playwright/test';
|
||||
|
||||
/**
|
||||
* Open a project by navigating to the project's overview page.
|
||||
*
|
||||
* @param page - The Playwright page object.
|
||||
* @param workspaceSlug - The slug of the workspace that contains the project.
|
||||
* @param projectSlug - The slug of the project to open.
|
||||
* @param projectName - The name of the project to open.
|
||||
* @returns A promise that resolves when the project is opened.
|
||||
*/
|
||||
export async function openProject({
|
||||
page,
|
||||
projectName,
|
||||
workspaceSlug,
|
||||
projectSlug,
|
||||
}: {
|
||||
page: Page;
|
||||
workspaceSlug: string;
|
||||
projectSlug: string;
|
||||
projectName: string;
|
||||
}) {
|
||||
await page.getByRole('link', { name: projectName }).click();
|
||||
await page.waitForURL(`/${workspaceSlug}/${projectSlug}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares a table by filling out the form.
|
||||
*
|
||||
* @param page - The Playwright page object.
|
||||
* @param name - The name of the table to create.
|
||||
* @param columns - The columns to create in the table.
|
||||
* @returns A promise that resolves when the table is prepared.
|
||||
*/
|
||||
export async function prepareTable({
|
||||
page,
|
||||
name: tableName,
|
||||
primaryKey,
|
||||
columns,
|
||||
}: {
|
||||
page: Page;
|
||||
name: string;
|
||||
primaryKey: string;
|
||||
columns: Array<{
|
||||
name: string;
|
||||
type: string;
|
||||
nullable?: boolean;
|
||||
unique?: boolean;
|
||||
defaultValue?: string;
|
||||
}>;
|
||||
}) {
|
||||
if (!columns.some(({ name }) => name === primaryKey)) {
|
||||
throw new Error('Primary key must be one of the columns.');
|
||||
}
|
||||
|
||||
await page.getByRole('textbox', { name: /name/i }).first().fill(tableName);
|
||||
|
||||
await Promise.all(
|
||||
columns.map(
|
||||
async (
|
||||
{ name: columnName, type, nullable, unique, defaultValue },
|
||||
index,
|
||||
) => {
|
||||
// set name
|
||||
await page.getByPlaceholder(/name/i).nth(index).fill(columnName);
|
||||
|
||||
// set type
|
||||
await page
|
||||
.getByRole('combobox', { name: /type/i })
|
||||
.nth(index)
|
||||
.fill(type);
|
||||
await page.getByRole('option', { name: type }).first().click();
|
||||
|
||||
// optionally set default value
|
||||
if (defaultValue) {
|
||||
await page
|
||||
.getByRole('combobox', { name: /default value/i })
|
||||
.first()
|
||||
.fill(defaultValue);
|
||||
await page
|
||||
.getByRole('option', { name: defaultValue })
|
||||
.first()
|
||||
.click();
|
||||
}
|
||||
|
||||
// optionally check unique
|
||||
if (unique) {
|
||||
await page
|
||||
.getByRole('checkbox', { name: /unique/i })
|
||||
.nth(index)
|
||||
.check();
|
||||
}
|
||||
|
||||
// optionally check nullable
|
||||
if (nullable) {
|
||||
await page
|
||||
.getByRole('checkbox', { name: /nullable/i })
|
||||
.nth(index)
|
||||
.check();
|
||||
}
|
||||
|
||||
// add new column if not last
|
||||
if (index < columns.length - 1) {
|
||||
await page.getByRole('button', { name: /add column/i }).click();
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
// select the first column as primary key
|
||||
await page.getByRole('button', { name: /primary key/i }).click();
|
||||
await page.getByRole('option', { name: primaryKey, exact: true }).click();
|
||||
}
|
||||
27
dashboard/global-setup.ts
Normal file
27
dashboard/global-setup.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { chromium } from '@playwright/test';
|
||||
import {
|
||||
TEST_DASHBOARD_URL,
|
||||
TEST_USER_EMAIL,
|
||||
TEST_USER_PASSWORD,
|
||||
} from './e2e/env';
|
||||
|
||||
async function globalSetup() {
|
||||
const browser = await chromium.launch();
|
||||
const page = await browser.newPage();
|
||||
|
||||
await page.goto(TEST_DASHBOARD_URL);
|
||||
await page.waitForURL(`${TEST_DASHBOARD_URL}/signin`);
|
||||
await page.getByRole('link', { name: /continue with email/i }).click();
|
||||
|
||||
await page.waitForURL(`${TEST_DASHBOARD_URL}/signin/email`);
|
||||
await page.getByLabel('Email').fill(TEST_USER_EMAIL);
|
||||
await page.getByLabel('Password').fill(TEST_USER_PASSWORD);
|
||||
await page.getByRole('button', { name: /sign in/i }).click();
|
||||
|
||||
await page.waitForURL(TEST_DASHBOARD_URL);
|
||||
await page.context().storageState({ path: 'storageState.json' });
|
||||
|
||||
await browser.close();
|
||||
}
|
||||
|
||||
export default globalSetup;
|
||||
@@ -1,5 +1,5 @@
|
||||
schema:
|
||||
- http://localhost:1337/v1/graphql:
|
||||
- https://local.graphql.nhost.run/v1:
|
||||
headers:
|
||||
x-hasura-admin-secret: nhost-admin-secret
|
||||
generates:
|
||||
|
||||
@@ -2,6 +2,7 @@ const path = require('path');
|
||||
const withBundleAnalyzer = require('@next/bundle-analyzer')({
|
||||
enabled: process.env.ANALYZE === 'true',
|
||||
});
|
||||
const { version } = require('./package.json');
|
||||
|
||||
module.exports = withBundleAnalyzer({
|
||||
reactStrictMode: true,
|
||||
@@ -10,6 +11,9 @@ module.exports = withBundleAnalyzer({
|
||||
experimental: {
|
||||
outputFileTracingRoot: path.join(__dirname, '../../'),
|
||||
},
|
||||
publicRuntimeConfig: {
|
||||
version,
|
||||
},
|
||||
eslint: {
|
||||
dirs: ['src'],
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/dashboard",
|
||||
"version": "0.11.11",
|
||||
"version": "0.13.10",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"preinstall": "npx only-allow pnpm",
|
||||
@@ -14,10 +14,11 @@
|
||||
"nhost:dev": "nhost dev -d",
|
||||
"format": "prettier --write \"src/**/*.{js,ts,tsx,jsx,json,md}\" --plugin-search-dir=.",
|
||||
"storybook": "start-storybook -p 6006 -s public",
|
||||
"build-storybook": "build-storybook"
|
||||
"build-storybook": "build-storybook",
|
||||
"e2e": "npx playwright@1.31.2 install --with-deps && playwright test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@apollo/client": "^3.7.3",
|
||||
"@apollo/client": "^3.7.10",
|
||||
"@codemirror/language": "^6.3.0",
|
||||
"@emotion/cache": "^11.10.5",
|
||||
"@emotion/react": "^11.10.5",
|
||||
@@ -25,11 +26,11 @@
|
||||
"@emotion/styled": "^11.10.5",
|
||||
"@fontsource/inter": "^4.5.14",
|
||||
"@fontsource/roboto-mono": "^4.5.8",
|
||||
"@graphiql/react": "^0.15.0",
|
||||
"@graphiql/toolkit": "^0.8.0",
|
||||
"@graphiql/react": "^0.17.0",
|
||||
"@graphiql/toolkit": "^0.8.2",
|
||||
"@headlessui/react": "^1.6.5",
|
||||
"@heroicons/react": "^1.0.6",
|
||||
"@hookform/resolvers": "^2.9.10",
|
||||
"@hookform/resolvers": "^3.0.0",
|
||||
"@mui/base": "^5.0.0-alpha.106",
|
||||
"@mui/material": "^5.10.14",
|
||||
"@mui/system": "^5.10.14",
|
||||
@@ -37,20 +38,18 @@
|
||||
"@nhost/nextjs": "workspace:*",
|
||||
"@nhost/react-apollo": "workspace:*",
|
||||
"@segment/snippet": "^4.15.3",
|
||||
"@stripe/react-stripe-js": "^1.10.0",
|
||||
"@stripe/react-stripe-js": "^2.0.0",
|
||||
"@stripe/stripe-js": "^1.35.0",
|
||||
"@tailwindcss/forms": "^0.5.3",
|
||||
"@tanstack/react-query": "^4.16.1",
|
||||
"@tanstack/react-table": "^8.5.30",
|
||||
"@tanstack/react-virtual": "^3.0.0-beta.23",
|
||||
"analytics-node": "^6.2.0",
|
||||
"axios": "^0.27.2",
|
||||
"bcryptjs": "^2.4.3",
|
||||
"clsx": "^1.2.1",
|
||||
"cross-fetch": "^3.1.5",
|
||||
"date-fns": "^2.29.3",
|
||||
"generate-password": "^1.7.0",
|
||||
"graphiql": "^2.2.0",
|
||||
"graphiql": "^2.4.0",
|
||||
"graphql": "^16.6.0",
|
||||
"graphql-request": "^4.3.0",
|
||||
"graphql-tag": "^2.12.6",
|
||||
@@ -64,31 +63,33 @@
|
||||
"prettysize": "^2.0.0",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
"react-error-boundary": "^3.1.4",
|
||||
"react-hook-form": "^7.39.5",
|
||||
"react-error-boundary": "^4.0.0",
|
||||
"react-hook-form": "^7.42.1",
|
||||
"react-hot-toast": "^2.4.0",
|
||||
"react-is": "18.2.0",
|
||||
"react-loading-skeleton": "^2.2.0",
|
||||
"react-merge-refs": "^1.1.0",
|
||||
"react-syntax-highlighter": "^15.4.5",
|
||||
"react-table": "^7.8.0",
|
||||
"sharp": "^0.31.2",
|
||||
"sharp": "^0.32.0",
|
||||
"slugify": "^1.6.5",
|
||||
"stripe": "^10.17.0",
|
||||
"tailwind-merge": "^1.8.0",
|
||||
"utility-types": "^3.10.0",
|
||||
"validator": "^13.7.0",
|
||||
"yup": "^0.32.11",
|
||||
"yup": "^1.0.2",
|
||||
"yup-password": "^0.2.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.20.2",
|
||||
"@graphql-codegen/cli": "^2.8.0",
|
||||
"@graphql-codegen/typescript": "^2.7.1",
|
||||
"@faker-js/faker": "^7.6.0",
|
||||
"@graphql-codegen/cli": "^3.0.0",
|
||||
"@graphql-codegen/typescript": "^3.0.0",
|
||||
"@graphql-codegen/typescript-graphql-request": "^4.5.1",
|
||||
"@graphql-codegen/typescript-operations": "^2.5.1",
|
||||
"@graphql-codegen/typescript-operations": "^3.0.0",
|
||||
"@graphql-codegen/typescript-react-apollo": "^3.3.1",
|
||||
"@next/bundle-analyzer": "^12.3.1",
|
||||
"@playwright/test": "^1.31.2",
|
||||
"@storybook/addon-actions": "^6.5.14",
|
||||
"@storybook/addon-essentials": "^6.5.14",
|
||||
"@storybook/addon-interactions": "^6.5.14",
|
||||
@@ -98,26 +99,28 @@
|
||||
"@storybook/manager-webpack5": "^6.5.14",
|
||||
"@storybook/react": "^6.5.14",
|
||||
"@storybook/testing-library": "^0.0.13",
|
||||
"@testing-library/dom": "^8.19.0",
|
||||
"@testing-library/dom": "^9.0.0",
|
||||
"@testing-library/jest-dom": "^5.16.5",
|
||||
"@testing-library/react": "^13.4.0",
|
||||
"@testing-library/react": "^14.0.0",
|
||||
"@testing-library/user-event": "^14.4.3",
|
||||
"@types/lodash.debounce": "^4.0.7",
|
||||
"@types/node": "^16.11.7",
|
||||
"@types/pluralize": "^0.0.29",
|
||||
"@types/react": "18.0.25",
|
||||
"@types/react-dom": "18.0.10",
|
||||
"@types/react": "18.0.28",
|
||||
"@types/react-dom": "18.0.11",
|
||||
"@types/react-table": "^7.7.12",
|
||||
"@types/testing-library__jest-dom": "^5.14.5",
|
||||
"@types/validator": "^13.7.10",
|
||||
"@typescript-eslint/eslint-plugin": "^5.43.0",
|
||||
"@typescript-eslint/parser": "^5.43.0",
|
||||
"@vitejs/plugin-react": "^3.0.0",
|
||||
"@vitest/coverage-c8": "^0.27.0",
|
||||
"@vitest/coverage-c8": "^0.29.0",
|
||||
"autoprefixer": "^10.4.13",
|
||||
"babel-loader": "^8.3.0",
|
||||
"babel-plugin-transform-remove-console": "^6.9.4",
|
||||
"csstype": "^3.0.10",
|
||||
"dotenv": "^16.0.3",
|
||||
"encoding": "^0.1.13",
|
||||
"eslint": "^8.28.0",
|
||||
"eslint-config-airbnb": "19.0.4",
|
||||
"eslint-config-airbnb-typescript": "^17.0.0",
|
||||
@@ -131,6 +134,7 @@
|
||||
"lint-staged": ">=13",
|
||||
"msw": "^1.0.1",
|
||||
"msw-storybook-addon": "^1.6.3",
|
||||
"node-fetch": "^3.3.0",
|
||||
"postcss": "^8.4.19",
|
||||
"prettier": "^2.7.1",
|
||||
"prettier-plugin-organize-imports": "^3.2.0",
|
||||
@@ -141,10 +145,9 @@
|
||||
"tailwindcss": "^3.1.2",
|
||||
"ts-node": "^10.9.1",
|
||||
"tsconfig-paths-webpack-plugin": "^4.0.0",
|
||||
"typescript": "^4.8.4",
|
||||
"vite": "^4.0.2",
|
||||
"vite-tsconfig-paths": "^4.0.3",
|
||||
"vitest": "^0.27.0",
|
||||
"vitest": "^0.29.0",
|
||||
"webpack": "^5.75.0"
|
||||
},
|
||||
"browserslist": {
|
||||
@@ -162,4 +165,4 @@
|
||||
"msw": {
|
||||
"workerDirectory": "public"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
32
dashboard/playwright.config.ts
Normal file
32
dashboard/playwright.config.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { defineConfig, devices } from '@playwright/test';
|
||||
|
||||
import dotenv from 'dotenv';
|
||||
import path from 'path';
|
||||
|
||||
dotenv.config({ path: path.resolve(__dirname, '.env.test') });
|
||||
|
||||
export default defineConfig({
|
||||
testDir: './e2e',
|
||||
timeout: 30 * 1000,
|
||||
expect: {
|
||||
timeout: 5000,
|
||||
},
|
||||
fullyParallel: true,
|
||||
forbidOnly: !!process.env.CI,
|
||||
retries: process.env.CI ? 2 : 0,
|
||||
workers: process.env.CI ? 1 : undefined,
|
||||
reporter: 'html',
|
||||
globalSetup: require.resolve('./global-setup'),
|
||||
use: {
|
||||
actionTimeout: 0,
|
||||
trace: 'on-first-retry',
|
||||
storageState: 'storageState.json',
|
||||
baseURL: process.env.NHOST_TEST_DASHBOARD_URL,
|
||||
},
|
||||
projects: [
|
||||
{
|
||||
name: 'chromium',
|
||||
use: { ...devices['Desktop Chrome'] },
|
||||
},
|
||||
],
|
||||
});
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 210 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.8 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 176 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 168 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 140 KiB |
@@ -1,6 +0,0 @@
|
||||
<svg width="200" height="200" viewBox="0 0 200 200" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="200" height="200" fill="white" fill-opacity="0.15"/>
|
||||
<rect width="200" height="200" fill="#263245" fill-opacity="0.08"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M71 84C71 67.9837 83.9837 55 100 55C116.016 55 129 67.9837 129 84C129 100.016 116.016 113 100 113C83.9837 113 71 100.016 71 84ZM100 49C80.67 49 65 64.67 65 84C65 97.6014 72.7585 109.391 84.0914 115.184C79.3584 116.509 74.7892 118.425 70.496 120.903C61.5257 126.08 54.0757 133.527 48.8946 142.495C48.0657 143.929 48.5568 145.764 49.9914 146.593C51.4261 147.422 53.261 146.931 54.0898 145.496C58.7443 137.44 65.4368 130.75 73.4952 126.099C81.5536 121.448 90.694 119 99.9982 119C109.302 119 118.443 121.449 126.501 126.1C134.559 130.751 141.252 137.441 145.906 145.497C146.735 146.932 148.57 147.423 150.004 146.594C151.439 145.765 151.93 143.93 151.101 142.496C145.92 133.527 138.471 126.081 129.5 120.903C125.208 118.426 120.639 116.509 115.907 115.185C127.241 109.392 135 97.6021 135 84C135 64.67 119.33 49 100 49Z" fill="white" fill-opacity="0.15"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M71 84C71 67.9837 83.9837 55 100 55C116.016 55 129 67.9837 129 84C129 100.016 116.016 113 100 113C83.9837 113 71 100.016 71 84ZM100 49C80.67 49 65 64.67 65 84C65 97.6014 72.7585 109.391 84.0914 115.184C79.3584 116.509 74.7892 118.425 70.496 120.903C61.5257 126.08 54.0757 133.527 48.8946 142.495C48.0657 143.929 48.5568 145.764 49.9914 146.593C51.4261 147.422 53.261 146.931 54.0898 145.496C58.7443 137.44 65.4368 130.75 73.4952 126.099C81.5536 121.448 90.694 119 99.9982 119C109.302 119 118.443 121.449 126.501 126.1C134.559 130.751 141.252 137.441 145.906 145.497C146.735 146.932 148.57 147.423 150.004 146.594C151.439 145.765 151.93 143.93 151.101 142.496C145.92 133.527 138.471 126.081 129.5 120.903C125.208 118.426 120.639 116.509 115.907 115.185C127.241 109.392 135 97.6021 135 84C135 64.67 119.33 49 100 49Z" fill="#263245" fill-opacity="0.25"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 2.0 KiB |
@@ -1,4 +1,7 @@
|
||||
import { useDeleteApplicationMutation } from '@/generated/graphql';
|
||||
import {
|
||||
GetOneUserDocument,
|
||||
useDeleteApplicationMutation,
|
||||
} from '@/generated/graphql';
|
||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||
import Button from '@/ui/v2/Button';
|
||||
import ArrowRightIcon from '@/ui/v2/icons/ArrowRightIcon';
|
||||
@@ -6,26 +9,39 @@ import Link from '@/ui/v2/Link';
|
||||
import Text from '@/ui/v2/Text';
|
||||
import { copy } from '@/utils/copy';
|
||||
import { getApplicationStatusString } from '@/utils/helpers';
|
||||
import { triggerToast } from '@/utils/toast';
|
||||
import getServerError from '@/utils/settings/getServerError';
|
||||
import { formatDistance } from 'date-fns';
|
||||
import { useRouter } from 'next/router';
|
||||
import { toast } from 'react-hot-toast';
|
||||
|
||||
export default function ApplicationInfo() {
|
||||
const { currentApplication } = useCurrentWorkspaceAndApplication();
|
||||
const [deleteApplication, { client }] = useDeleteApplicationMutation();
|
||||
const [deleteApplication] = useDeleteApplicationMutation({
|
||||
refetchQueries: [GetOneUserDocument],
|
||||
});
|
||||
const router = useRouter();
|
||||
|
||||
async function handleClickRemove() {
|
||||
await deleteApplication({
|
||||
variables: {
|
||||
appId: currentApplication.id,
|
||||
},
|
||||
});
|
||||
await router.push('/');
|
||||
await client.refetchQueries({
|
||||
include: ['getOneUser'],
|
||||
});
|
||||
triggerToast(`${currentApplication.name} deleted`);
|
||||
try {
|
||||
await toast.promise(
|
||||
deleteApplication({
|
||||
variables: {
|
||||
appId: currentApplication.id,
|
||||
},
|
||||
}),
|
||||
{
|
||||
loading: 'Deleting project...',
|
||||
success: 'The project has been deleted successfully.',
|
||||
error: getServerError(
|
||||
'An error occurred while deleting the project. Please try again.',
|
||||
),
|
||||
},
|
||||
);
|
||||
|
||||
await router.push('/');
|
||||
} catch {
|
||||
// Note: The toast will handle the error.
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import MaintenanceAlert from '@/components/common/MaintenanceAlert';
|
||||
import RetryableErrorBoundary from '@/components/common/RetryableErrorBoundary';
|
||||
import Container from '@/components/layout/Container';
|
||||
import { features } from '@/components/overview/features';
|
||||
@@ -52,6 +53,7 @@ export default function ApplicationLive() {
|
||||
|
||||
return (
|
||||
<Container>
|
||||
<MaintenanceAlert />
|
||||
<OverviewTopBar />
|
||||
|
||||
<div className="grid grid-cols-1 gap-12 pt-3 lg:grid-cols-3">
|
||||
|
||||
@@ -3,54 +3,81 @@ import { ChangePlanModal } from '@/components/applications/ChangePlanModal';
|
||||
import { StagingMetadata } from '@/components/applications/StagingMetadata';
|
||||
import { useDialog } from '@/components/common/DialogProvider';
|
||||
import Container from '@/components/layout/Container';
|
||||
import { useUpdateApplicationMutation } from '@/generated/graphql';
|
||||
import {
|
||||
GetOneUserDocument,
|
||||
useGetFreeAndActiveProjectsQuery,
|
||||
useUnpauseApplicationMutation,
|
||||
} from '@/generated/graphql';
|
||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||
import { ApplicationStatus } from '@/types/application';
|
||||
import { Modal } from '@/ui';
|
||||
import { Alert } from '@/ui/Alert';
|
||||
import ActivityIndicator from '@/ui/v2/ActivityIndicator';
|
||||
import Box from '@/ui/v2/Box';
|
||||
import Button from '@/ui/v2/Button';
|
||||
import Text from '@/ui/v2/Text';
|
||||
import { discordAnnounce } from '@/utils/discordAnnounce';
|
||||
import { triggerToast } from '@/utils/toast';
|
||||
import { updateOwnCache } from '@/utils/updateOwnCache';
|
||||
import { MAX_FREE_PROJECTS } from '@/utils/CONSTANTS';
|
||||
import { getToastStyleProps } from '@/utils/settings/settingsConstants';
|
||||
import type { ApolloError } from '@apollo/client';
|
||||
import { useUserData } from '@nhost/nextjs';
|
||||
import Image from 'next/image';
|
||||
import { useState } from 'react';
|
||||
import { toast } from 'react-hot-toast';
|
||||
import { RemoveApplicationModal } from './RemoveApplicationModal';
|
||||
|
||||
export default function ApplicationPaused() {
|
||||
const { openAlertDialog } = useDialog();
|
||||
const { currentWorkspace, currentApplication } =
|
||||
useCurrentWorkspaceAndApplication();
|
||||
const [changingApplicationStateLoading, setChangingApplicationStateLoading] =
|
||||
useState(false);
|
||||
const [updateApplication, { client }] = useUpdateApplicationMutation();
|
||||
const { id, email } = useUserData();
|
||||
const { id } = useUserData();
|
||||
const isOwner = currentWorkspace.members.some(
|
||||
({ userId, type }) => userId === id && type === 'owner',
|
||||
);
|
||||
const isPro = currentApplication.plan.name === 'Pro';
|
||||
const [showDeletingModal, setShowDeletingModal] = useState(false);
|
||||
const [unpauseApplication, { loading: changingApplicationStateLoading }] =
|
||||
useUnpauseApplicationMutation({
|
||||
refetchQueries: [GetOneUserDocument],
|
||||
});
|
||||
|
||||
const { data, loading } = useGetFreeAndActiveProjectsQuery({
|
||||
variables: { userId: id },
|
||||
fetchPolicy: 'cache-and-network',
|
||||
});
|
||||
|
||||
const numberOfFreeAndLiveProjects = data?.freeAndActiveProjects.length || 0;
|
||||
const wakeUpDisabled = numberOfFreeAndLiveProjects >= MAX_FREE_PROJECTS;
|
||||
|
||||
async function handleTriggerUnpausing() {
|
||||
setChangingApplicationStateLoading(true);
|
||||
try {
|
||||
await updateApplication({
|
||||
variables: {
|
||||
appId: currentApplication.id,
|
||||
app: {
|
||||
desiredState: ApplicationStatus.Live,
|
||||
await toast.promise(
|
||||
unpauseApplication({ variables: { appId: currentApplication.id } }),
|
||||
{
|
||||
loading: 'Starting the project...',
|
||||
success: `The project has been started successfully.`,
|
||||
error: (arg: ApolloError) => {
|
||||
// we need to get the internal error message from the GraphQL error
|
||||
const { internal } = arg.graphQLErrors[0]?.extensions || {};
|
||||
const { message } = (internal as Record<string, any>)?.error || {};
|
||||
|
||||
// we use the default Apollo error message if we can't find the
|
||||
// internal error message
|
||||
return (
|
||||
message ||
|
||||
arg.message ||
|
||||
'An error occurred while waking up the project. Please try again.'
|
||||
);
|
||||
},
|
||||
},
|
||||
});
|
||||
await updateOwnCache(client);
|
||||
discordAnnounce(
|
||||
`App ${currentApplication.name} (${email}) set to awake.`,
|
||||
getToastStyleProps(),
|
||||
);
|
||||
triggerToast(`${currentApplication.name} set to awake.`);
|
||||
} catch (e) {
|
||||
triggerToast(`Error trying to awake ${currentApplication.name}`);
|
||||
} catch {
|
||||
// Note: The toast will handle the error.
|
||||
}
|
||||
}
|
||||
|
||||
if (loading) {
|
||||
return <ActivityIndicator label="Loading user data..." delay={1000} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Modal
|
||||
@@ -65,7 +92,7 @@ export default function ApplicationPaused() {
|
||||
/>
|
||||
</Modal>
|
||||
|
||||
<Container className="mx-auto mt-20 grid max-w-sm grid-flow-row gap-2 text-center">
|
||||
<Container className="mx-auto mt-20 grid max-w-lg grid-flow-row gap-4 text-center">
|
||||
<div className="mx-auto flex w-centImage flex-col text-center">
|
||||
<Image
|
||||
src="/assets/PausedApp.svg"
|
||||
@@ -75,16 +102,18 @@ export default function ApplicationPaused() {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Text variant="h3" component="h1" className="mt-4">
|
||||
{currentApplication.name} is sleeping
|
||||
</Text>
|
||||
<Box className="grid grid-flow-row gap-1">
|
||||
<Text variant="h3" component="h1">
|
||||
{currentApplication.name} is sleeping
|
||||
</Text>
|
||||
|
||||
<Text className="mt-1">
|
||||
Projects on the free plan stop responding to API calls after 7 days of
|
||||
no traffic.
|
||||
</Text>
|
||||
<Text>
|
||||
Starter projects stop responding to API calls after 7 days of
|
||||
inactivity. Upgrade to Pro to avoid autosleep.
|
||||
</Text>
|
||||
</Box>
|
||||
|
||||
{!isPro && (
|
||||
<Box className="grid grid-flow-row gap-2">
|
||||
<Button
|
||||
className="mx-auto w-full max-w-[280px]"
|
||||
onClick={() => {
|
||||
@@ -101,32 +130,41 @@ export default function ApplicationPaused() {
|
||||
});
|
||||
}}
|
||||
>
|
||||
Upgrade to Pro to avoid autosleep
|
||||
</Button>
|
||||
)}
|
||||
|
||||
<div className="grid grid-flow-row gap-2">
|
||||
<Button
|
||||
variant="borderless"
|
||||
className="mx-auto w-full max-w-[280px]"
|
||||
loading={changingApplicationStateLoading}
|
||||
disabled={changingApplicationStateLoading}
|
||||
onClick={handleTriggerUnpausing}
|
||||
>
|
||||
Wake Up
|
||||
Upgrade to Pro
|
||||
</Button>
|
||||
|
||||
{isOwner && (
|
||||
<div className="grid grid-flow-row gap-2">
|
||||
<Button
|
||||
color="error"
|
||||
variant="borderless"
|
||||
className="mx-auto w-full max-w-[280px]"
|
||||
onClick={() => setShowDeletingModal(true)}
|
||||
loading={changingApplicationStateLoading}
|
||||
disabled={changingApplicationStateLoading || wakeUpDisabled}
|
||||
onClick={handleTriggerUnpausing}
|
||||
>
|
||||
Delete Project
|
||||
Wake Up
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{wakeUpDisabled && (
|
||||
<Alert severity="warning" className="mx-auto max-w-xs text-left">
|
||||
Note: Only one free project can be active at any given time.
|
||||
Please pause your active free project before unpausing{' '}
|
||||
{currentApplication.name}.
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
{isOwner && (
|
||||
<Button
|
||||
color="error"
|
||||
variant="borderless"
|
||||
className="mx-auto w-full max-w-[280px]"
|
||||
onClick={() => setShowDeletingModal(true)}
|
||||
>
|
||||
Delete Project
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</Box>
|
||||
|
||||
<StagingMetadata>
|
||||
<ApplicationInfo />
|
||||
</StagingMetadata>
|
||||
|
||||
@@ -32,12 +32,12 @@ function Plan({
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
className="my-4 grid w-full grid-flow-col items-center justify-between px-1"
|
||||
className="my-4 grid w-full grid-flow-col items-center justify-between gap-2 px-1"
|
||||
onClick={setPlan}
|
||||
tabIndex={-1}
|
||||
>
|
||||
<div className="grid grid-flow-row gap-y-0.5">
|
||||
<div className="flex flex-row items-center">
|
||||
<div className="grid grid-flow-col items-center justify-start gap-2">
|
||||
<Checkbox
|
||||
onChange={setPlan}
|
||||
checked={selectedPlanId === planId}
|
||||
@@ -47,12 +47,13 @@ function Plan({
|
||||
<Text
|
||||
variant="h3"
|
||||
component="p"
|
||||
className="ml-2 self-center font-medium"
|
||||
className="self-center text-left font-medium"
|
||||
>
|
||||
{currentPlan.price > price ? 'Downgrade' : 'Upgrade'} to {planName}
|
||||
</Text>
|
||||
</div>
|
||||
<Text variant="subtitle2" className="w-64 text-start">
|
||||
|
||||
<Text variant="subtitle2" className="w-full max-w-[256px] text-start">
|
||||
{planDescriptions[planName]}
|
||||
</Text>
|
||||
</div>
|
||||
@@ -142,7 +143,7 @@ export function ChangePlanModalWithData({ app, plans, close }: any) {
|
||||
};
|
||||
|
||||
return (
|
||||
<Box className="w-welcome rounded-lg p-6 text-left">
|
||||
<Box className="w-full max-w-xl rounded-lg p-6 text-left">
|
||||
<Modal
|
||||
showModal={paymentModal}
|
||||
close={closePaymentModal}
|
||||
|
||||
@@ -12,7 +12,7 @@ import generateAppServiceUrl, {
|
||||
defaultRemoteBackendSlugs,
|
||||
} from '@/utils/common/generateAppServiceUrl';
|
||||
import { copy } from '@/utils/copy';
|
||||
import { LOCAL_HASURA_URL } from '@/utils/env';
|
||||
import { getHasuraConsoleServiceUrl } from '@/utils/env';
|
||||
import Image from 'next/image';
|
||||
|
||||
interface HasuraDataProps {
|
||||
@@ -22,17 +22,15 @@ interface HasuraDataProps {
|
||||
export function HasuraData({ close }: HasuraDataProps) {
|
||||
const { currentApplication } = useCurrentWorkspaceAndApplication();
|
||||
const isPlatform = useIsPlatform();
|
||||
const projectAdminSecret = currentApplication?.config?.hasura.adminSecret;
|
||||
|
||||
if (
|
||||
!currentApplication?.subdomain ||
|
||||
!currentApplication?.hasuraGraphqlAdminSecret
|
||||
) {
|
||||
if (!currentApplication?.subdomain || !projectAdminSecret) {
|
||||
return <LoadingScreen />;
|
||||
}
|
||||
|
||||
const hasuraUrl =
|
||||
process.env.NEXT_PUBLIC_ENV === 'dev' || !isPlatform
|
||||
? `${LOCAL_HASURA_URL}/console`
|
||||
? `${getHasuraConsoleServiceUrl()}`
|
||||
: generateAppServiceUrl(
|
||||
currentApplication?.subdomain,
|
||||
currentApplication?.region.awsName,
|
||||
@@ -71,18 +69,11 @@ export function HasuraData({ close }: HasuraDataProps) {
|
||||
|
||||
<div className="col-span-1 grid grid-flow-col items-center justify-center gap-2 sm:col-span-2 sm:justify-end">
|
||||
<Text className="font-medium" variant="subtitle2">
|
||||
{Array(currentApplication.hasuraGraphqlAdminSecret.length)
|
||||
.fill('•')
|
||||
.join('')}
|
||||
{Array(projectAdminSecret.length).fill('•').join('')}
|
||||
</Text>
|
||||
|
||||
<IconButton
|
||||
onClick={() =>
|
||||
copy(
|
||||
currentApplication.hasuraGraphqlAdminSecret,
|
||||
'Hasura admin secret',
|
||||
)
|
||||
}
|
||||
onClick={() => copy(projectAdminSecret, 'Hasura admin secret')}
|
||||
variant="borderless"
|
||||
color="secondary"
|
||||
className="min-w-0 p-1"
|
||||
|
||||
@@ -6,7 +6,10 @@ import Divider from '@/ui/v2/Divider';
|
||||
import Text from '@/ui/v2/Text';
|
||||
import { discordAnnounce } from '@/utils/discordAnnounce';
|
||||
import { triggerToast } from '@/utils/toast';
|
||||
import { useDeleteApplicationMutation } from '@/utils/__generated__/graphql';
|
||||
import {
|
||||
GetOneUserDocument,
|
||||
useDeleteApplicationMutation,
|
||||
} from '@/utils/__generated__/graphql';
|
||||
import router from 'next/router';
|
||||
import { useState } from 'react';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
@@ -42,7 +45,9 @@ export function RemoveApplicationModal({
|
||||
description,
|
||||
className,
|
||||
}: RemoveApplicationModalProps) {
|
||||
const [deleteApplication, { client }] = useDeleteApplicationMutation();
|
||||
const [deleteApplication] = useDeleteApplicationMutation({
|
||||
refetchQueries: [GetOneUserDocument],
|
||||
});
|
||||
const [loadingRemove, setLoadingRemove] = useState(false);
|
||||
const { currentApplication } = useCurrentWorkspaceAndApplication();
|
||||
|
||||
@@ -73,9 +78,6 @@ export function RemoveApplicationModal({
|
||||
}
|
||||
close();
|
||||
await router.push('/');
|
||||
await client.refetchQueries({
|
||||
include: ['getOneUser'],
|
||||
});
|
||||
triggerToast(`${currentApplication.name} deleted`);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import DeploymentStatusMessage from '@/components/deployments/DeploymentStatusMessage';
|
||||
import { FindOldApps } from '@/components/home';
|
||||
import type { UserData } from '@/hooks/useGetAllUserWorkspacesAndApplications';
|
||||
import type { Application, ApplicationState } from '@/types/application';
|
||||
import type { ApplicationState } from '@/types/application';
|
||||
import { ApplicationStatus } from '@/types/application';
|
||||
import { Avatar } from '@/ui/Avatar';
|
||||
import StateBadge from '@/ui/StateBadge';
|
||||
import type { DeploymentStatus } from '@/ui/StatusCircle';
|
||||
import { StatusCircle } from '@/ui/StatusCircle';
|
||||
@@ -10,59 +10,11 @@ import Divider from '@/ui/v2/Divider';
|
||||
import Link from '@/ui/v2/Link';
|
||||
import List from '@/ui/v2/List';
|
||||
import { ListItem } from '@/ui/v2/ListItem';
|
||||
import Text from '@/ui/v2/Text';
|
||||
import { getApplicationStatusString } from '@/utils/helpers';
|
||||
import { formatDistance } from 'date-fns';
|
||||
import Image from 'next/image';
|
||||
import NavLink from 'next/link';
|
||||
import { Fragment } from 'react';
|
||||
|
||||
function ApplicationCreatedAt({ createdAt }: any) {
|
||||
return (
|
||||
<Text component="span" className="text-sm">
|
||||
created{' '}
|
||||
{formatDistance(new Date(createdAt), new Date(), {
|
||||
addSuffix: true,
|
||||
})}
|
||||
</Text>
|
||||
);
|
||||
}
|
||||
|
||||
function LastSuccessfulDeployment({ deployment }: any) {
|
||||
return (
|
||||
<span className="flex flex-row">
|
||||
<Avatar
|
||||
component="span"
|
||||
name={deployment.commitUserName}
|
||||
avatarUrl={deployment.commitUserAvatarUrl}
|
||||
className="mr-1 h-4 w-4 self-center"
|
||||
/>
|
||||
<Text component="span" className="self-center text-sm">
|
||||
{deployment.commitUserName} deployed{' '}
|
||||
{formatDistance(new Date(deployment.deploymentEndedAt), new Date(), {
|
||||
addSuffix: true,
|
||||
})}
|
||||
</Text>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
function CurrentDeployment({ deployment }: any) {
|
||||
return (
|
||||
<span className="flex flex-row">
|
||||
<Avatar
|
||||
component="span"
|
||||
name={deployment.commitUserName}
|
||||
avatarUrl={deployment.commitUserAvatarUrl}
|
||||
className="mr-1 h-4 w-4 self-center"
|
||||
/>
|
||||
<Text className="self-center text-sm">
|
||||
{deployment.commitUserName} updated just now
|
||||
</Text>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
export function checkStatusOfTheApplication(
|
||||
stateHistory: ApplicationState[] | [],
|
||||
) {
|
||||
@@ -103,7 +55,7 @@ export function RenderWorkspacesWithApps({
|
||||
}
|
||||
|
||||
const workspaceProjects = workspace.applications
|
||||
.filter((app: Application) =>
|
||||
.filter((app) =>
|
||||
app.name.toLowerCase().includes(query.toLowerCase()),
|
||||
)
|
||||
.sort((appA, appB) => {
|
||||
@@ -141,29 +93,26 @@ export function RenderWorkspacesWithApps({
|
||||
</NavLink>
|
||||
<List className="grid grid-flow-row border-y">
|
||||
{workspaceProjects.map((app, index) => {
|
||||
const isDeployingToProduction = app.deployments[0]
|
||||
? app.deployments[0].deploymentStatus === 'DEPLOYING'
|
||||
: false;
|
||||
const [latestDeployment] = app.deployments;
|
||||
|
||||
return (
|
||||
<Fragment key={app.slug}>
|
||||
<ListItem.Root
|
||||
secondaryAction={
|
||||
<div className="grid grid-flow-col gap-px">
|
||||
{app.deployments[0] && (
|
||||
{latestDeployment && (
|
||||
<div className="mr-2 flex self-center align-middle">
|
||||
<StatusCircle
|
||||
status={
|
||||
app.deployments[0]
|
||||
.deploymentStatus as DeploymentStatus
|
||||
latestDeployment.deploymentStatus as DeploymentStatus
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<StateBadge
|
||||
status={checkStatusOfTheApplication(
|
||||
app.appStates,
|
||||
)}
|
||||
state={checkStatusOfTheApplication(app.appStates)}
|
||||
desiredState={app.desiredState}
|
||||
title={getApplicationStatusString(
|
||||
checkStatusOfTheApplication(app.appStates),
|
||||
)}
|
||||
@@ -190,27 +139,10 @@ export function RenderWorkspacesWithApps({
|
||||
<ListItem.Text
|
||||
primary={app.name}
|
||||
secondary={
|
||||
<>
|
||||
{isDeployingToProduction && (
|
||||
<CurrentDeployment
|
||||
deployment={app.deployments[0]}
|
||||
/>
|
||||
)}
|
||||
|
||||
{!isDeployingToProduction &&
|
||||
app.deployments[0] && (
|
||||
<LastSuccessfulDeployment
|
||||
deployment={app.deployments[0]}
|
||||
/>
|
||||
)}
|
||||
|
||||
{!isDeployingToProduction &&
|
||||
!app.deployments[0] && (
|
||||
<ApplicationCreatedAt
|
||||
createdAt={app.createdAt}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
<DeploymentStatusMessage
|
||||
appCreatedAt={app.createdAt}
|
||||
deployment={latestDeployment}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</ListItem.Button>
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { PropsWithChildren } from 'react';
|
||||
export function StagingMetadata({ children }: PropsWithChildren<unknown>) {
|
||||
return (
|
||||
isDevOrStaging() && (
|
||||
<div className="mt-10">
|
||||
<div className="mx-auto mt-10 max-w-sm">
|
||||
<Box className="mx-auto flex flex-col rounded-md border p-5 text-center">
|
||||
<Status status={StatusEnum.Deploying}>Internal info</Status>
|
||||
{children}
|
||||
|
||||
@@ -33,11 +33,10 @@ export function UnlockFeatureByUpgrading({
|
||||
title: 'Upgrade your plan.',
|
||||
payload: <ChangePlanModal />,
|
||||
props: {
|
||||
PaperProps: { className: 'p-0' },
|
||||
PaperProps: { className: 'p-0 max-w-xl w-full' },
|
||||
hidePrimaryAction: true,
|
||||
hideSecondaryAction: true,
|
||||
hideTitle: true,
|
||||
maxWidth: 'lg',
|
||||
},
|
||||
});
|
||||
}}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||
import { useRemoteApplicationGQLClient } from '@/hooks/useRemoteApplicationGQLClient';
|
||||
import ActivityIndicator from '@/ui/v2/ActivityIndicator';
|
||||
import Option from '@/ui/v2/Option';
|
||||
@@ -18,10 +19,12 @@ export interface UserSelectProps {
|
||||
}
|
||||
|
||||
export function UserSelect({ onUserChange, ...props }: UserSelectProps) {
|
||||
const { currentApplication } = useCurrentWorkspaceAndApplication();
|
||||
const userApplicationClient = useRemoteApplicationGQLClient();
|
||||
const { data, loading, error } = useRemoteAppGetUsersCustomQuery({
|
||||
client: userApplicationClient,
|
||||
variables: { where: {}, limit: 250, offset: 0 },
|
||||
skip: !currentApplication,
|
||||
});
|
||||
|
||||
if (loading) {
|
||||
@@ -36,8 +39,6 @@ export function UserSelect({ onUserChange, ...props }: UserSelectProps) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
const { users } = data;
|
||||
|
||||
return (
|
||||
<Select
|
||||
{...props}
|
||||
@@ -57,7 +58,7 @@ export function UserSelect({ onUserChange, ...props }: UserSelectProps) {
|
||||
return;
|
||||
}
|
||||
|
||||
const user: RemoteAppGetUsersCustomQuery['users'][0] = users.find(
|
||||
const user: RemoteAppGetUsersCustomQuery['users'][0] = data?.users.find(
|
||||
({ id }) => id === userId,
|
||||
);
|
||||
|
||||
@@ -68,7 +69,7 @@ export function UserSelect({ onUserChange, ...props }: UserSelectProps) {
|
||||
>
|
||||
<Option value="admin">Admin</Option>
|
||||
|
||||
{users.map(({ id, displayName, email, phoneNumber }) => (
|
||||
{data?.users.map(({ id, displayName, email, phoneNumber }) => (
|
||||
<Option key={id} value={id}>
|
||||
{displayName || email || phoneNumber || id}
|
||||
</Option>
|
||||
|
||||
@@ -22,7 +22,9 @@ import {
|
||||
import { loadStripe } from '@stripe/stripe-js';
|
||||
import React, { useState } from 'react';
|
||||
|
||||
const stripePromise = loadStripe(process.env.NEXT_PUBLIC_STRIPE_PK!);
|
||||
const stripePromise = process.env.NEXT_PUBLIC_STRIPE_PK
|
||||
? loadStripe(process.env.NEXT_PUBLIC_STRIPE_PK)
|
||||
: null;
|
||||
|
||||
type AddPaymentMethodFormProps = {
|
||||
close: () => void;
|
||||
@@ -74,7 +76,8 @@ function AddPaymentMethodForm({
|
||||
|
||||
if (createPaymentMethodError) {
|
||||
throw new Error(
|
||||
createPaymentMethodError.message || 'Unknown error occurred.',
|
||||
createPaymentMethodError.message ||
|
||||
'An unknown error occurred. Please try again.',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -88,7 +91,10 @@ function AddPaymentMethodForm({
|
||||
);
|
||||
|
||||
if (attachPaymentMethodError) {
|
||||
throw Error((attachPaymentMethodError as any).response.data);
|
||||
throw new Error(
|
||||
(attachPaymentMethodError as any)?.response?.data ||
|
||||
'An unknown error occurred. Please try again.',
|
||||
);
|
||||
}
|
||||
|
||||
// update workspace with new country code in database
|
||||
@@ -149,7 +155,7 @@ function AddPaymentMethodForm({
|
||||
};
|
||||
|
||||
return (
|
||||
<Box className="w-modal2 px-6 pt-6 pb-6 text-left rounded-lg">
|
||||
<Box className="w-modal2 rounded-lg px-6 pt-6 pb-6 text-left">
|
||||
<div className="flex flex-col">
|
||||
<form onSubmit={handleSubmit}>
|
||||
<Text className="text-center text-lg font-medium">
|
||||
@@ -201,7 +207,7 @@ function AddPaymentMethodForm({
|
||||
|
||||
type BillingPaymentMethodFormProps = {
|
||||
close: () => void;
|
||||
onPaymentMethodAdded?: () => Promise<void>;
|
||||
onPaymentMethodAdded?: (e?: any) => Promise<void>;
|
||||
workspaceId: string;
|
||||
};
|
||||
|
||||
|
||||
@@ -52,7 +52,9 @@ function ControlledAutocomplete(
|
||||
|
||||
return (
|
||||
<Autocomplete
|
||||
inputValue={typeof field.value === 'string' ? field.value : undefined}
|
||||
inputValue={
|
||||
typeof field.value !== 'object' ? field.value.toString() : undefined
|
||||
}
|
||||
{...props}
|
||||
{...field}
|
||||
ref={mergeRefs([field.ref, ref])}
|
||||
|
||||
@@ -46,7 +46,7 @@ export default function DataGridDateCell<TData extends object>({
|
||||
: undefined;
|
||||
|
||||
const { year, month, day, hour, minute, second } = getDateComponents(date, {
|
||||
adjustTimezone: specificType === 'timetz' || specificType === 'timestamptz',
|
||||
adjustTimezone: ['date', 'timetz', 'timestamptz'].includes(specificType),
|
||||
});
|
||||
|
||||
const { inputRef, focusCell, isEditing, cancelEditCell } =
|
||||
|
||||
@@ -205,7 +205,7 @@ export default function DataGridPreviewCell<TData extends object>({
|
||||
}
|
||||
|
||||
const { presignedUrl } = await appClient.storage
|
||||
.setAdminSecret(currentApplication.hasuraGraphqlAdminSecret)
|
||||
.setAdminSecret(currentApplication.config?.hasura.adminSecret)
|
||||
.getPresignedUrl({ fileId: id });
|
||||
|
||||
if (!presignedUrl) {
|
||||
|
||||
@@ -1,31 +1,8 @@
|
||||
import type { DialogFormProps } from '@/types/common';
|
||||
import type { CommonDialogProps } from '@/ui/v2/Dialog';
|
||||
import type { ReactNode } from 'react';
|
||||
import type { ReactElement, ReactNode } from 'react';
|
||||
import { createContext } from 'react';
|
||||
|
||||
/**
|
||||
* Available dialog types.
|
||||
*/
|
||||
export type DialogType =
|
||||
| 'EDIT_WORKSPACE_NAME'
|
||||
| 'CREATE_RECORD'
|
||||
| 'CREATE_COLUMN'
|
||||
| 'EDIT_COLUMN'
|
||||
| 'CREATE_TABLE'
|
||||
| 'EDIT_TABLE'
|
||||
| 'EDIT_PERMISSIONS'
|
||||
| 'CREATE_FOREIGN_KEY'
|
||||
| 'EDIT_FOREIGN_KEY'
|
||||
| 'CREATE_ROLE'
|
||||
| 'EDIT_ROLE'
|
||||
| 'CREATE_USER'
|
||||
| 'CREATE_PERMISSION_VARIABLE'
|
||||
| 'EDIT_PERMISSION_VARIABLE'
|
||||
| 'CREATE_ENVIRONMENT_VARIABLE'
|
||||
| 'EDIT_ENVIRONMENT_VARIABLE'
|
||||
| 'EDIT_USER'
|
||||
| 'EDIT_USER_PASSWORD'
|
||||
| 'EDIT_JWT_SECRET';
|
||||
|
||||
export interface DialogConfig<TPayload = unknown> {
|
||||
/**
|
||||
* Title of the dialog.
|
||||
@@ -41,21 +18,36 @@ export interface DialogConfig<TPayload = unknown> {
|
||||
payload?: TPayload;
|
||||
}
|
||||
|
||||
export interface OpenDialogOptions {
|
||||
/**
|
||||
* Title of the dialog.
|
||||
*/
|
||||
title: ReactNode;
|
||||
/**
|
||||
* Component to render inside the dialog skeleton.
|
||||
*/
|
||||
component: ReactElement<{
|
||||
location?: 'drawer' | 'dialog';
|
||||
onCancel?: () => void;
|
||||
onSubmit?: (args?: any) => Promise<any> | void;
|
||||
}>;
|
||||
/**
|
||||
* Props to pass to the root dialog component.
|
||||
*/
|
||||
props?: Partial<CommonDialogProps>;
|
||||
}
|
||||
|
||||
export interface DialogContextProps {
|
||||
/**
|
||||
* Call this function to open a dialog.
|
||||
* Call this function to open a dialog. It will automatically apply the
|
||||
* necessary functionality to the dialog.
|
||||
*/
|
||||
openDialog: <TPayload = unknown>(
|
||||
type: DialogType,
|
||||
config?: DialogConfig<TPayload>,
|
||||
) => void;
|
||||
openDialog: (options: OpenDialogOptions) => void;
|
||||
/**
|
||||
* Call this function to open a drawer.
|
||||
* Call this function to open a drawer. It will automatically apply the
|
||||
* necessary functionality to the drawer.
|
||||
*/
|
||||
openDrawer: <TPayload = unknown>(
|
||||
type: DialogType,
|
||||
config?: DialogConfig<TPayload>,
|
||||
) => void;
|
||||
openDrawer: (options: OpenDialogOptions) => void;
|
||||
/**
|
||||
* Call this function to open an alert dialog.
|
||||
*/
|
||||
@@ -87,7 +79,7 @@ export interface DialogContextProps {
|
||||
*/
|
||||
onDirtyStateChange: (
|
||||
isDirty: boolean,
|
||||
location?: 'drawer' | 'dialog',
|
||||
location?: DialogFormProps['location'],
|
||||
) => void;
|
||||
/**
|
||||
* Call this function to open a dirty confirmation dialog.
|
||||
|
||||
@@ -1,30 +1,12 @@
|
||||
import RetryableErrorBoundary from '@/components/common/RetryableErrorBoundary';
|
||||
import CreateForeignKeyForm from '@/components/dataBrowser/CreateForeignKeyForm';
|
||||
import EditForeignKeyForm from '@/components/dataBrowser/EditForeignKeyForm';
|
||||
import EditWorkspaceNameForm from '@/components/home/EditWorkspaceNameForm';
|
||||
import CreateEnvironmentVariableForm from '@/components/settings/environmentVariables/CreateEnvironmentVariableForm';
|
||||
import EditEnvironmentVariableForm from '@/components/settings/environmentVariables/EditEnvironmentVariableForm';
|
||||
import EditJwtSecretForm from '@/components/settings/environmentVariables/EditJwtSecretForm';
|
||||
import CreatePermissionVariableForm from '@/components/settings/permissions/CreatePermissionVariableForm';
|
||||
import EditPermissionVariableForm from '@/components/settings/permissions/EditPermissionVariableForm';
|
||||
import CreateRoleForm from '@/components/settings/roles/CreateRoleForm';
|
||||
import EditRoleForm from '@/components/settings/roles/EditRoleForm';
|
||||
import CreateUserForm from '@/components/users/CreateUserForm';
|
||||
import EditUserForm from '@/components/users/EditUserForm';
|
||||
import EditUserPasswordForm from '@/components/users/EditUserPasswordForm';
|
||||
import ActivityIndicator from '@/ui/v2/ActivityIndicator';
|
||||
import AlertDialog from '@/ui/v2/AlertDialog';
|
||||
import { BaseDialog } from '@/ui/v2/Dialog';
|
||||
import Drawer from '@/ui/v2/Drawer';
|
||||
import dynamic from 'next/dynamic';
|
||||
import { useRouter } from 'next/router';
|
||||
import type {
|
||||
BaseSyntheticEvent,
|
||||
DetailedHTMLProps,
|
||||
HTMLProps,
|
||||
PropsWithChildren,
|
||||
} from 'react';
|
||||
import type { BaseSyntheticEvent, PropsWithChildren } from 'react';
|
||||
import {
|
||||
cloneElement,
|
||||
isValidElement,
|
||||
useCallback,
|
||||
useEffect,
|
||||
useMemo,
|
||||
@@ -33,7 +15,7 @@ import {
|
||||
useState,
|
||||
} from 'react';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
import type { DialogConfig, DialogType } from './DialogContext';
|
||||
import type { DialogConfig, OpenDialogOptions } from './DialogContext';
|
||||
import DialogContext from './DialogContext';
|
||||
import {
|
||||
alertDialogReducer,
|
||||
@@ -41,67 +23,11 @@ import {
|
||||
drawerReducer,
|
||||
} from './dialogReducers';
|
||||
|
||||
function LoadingComponent({
|
||||
className,
|
||||
...props
|
||||
}: DetailedHTMLProps<HTMLProps<HTMLDivElement>, HTMLDivElement> = {}) {
|
||||
return (
|
||||
<div
|
||||
{...props}
|
||||
className={twMerge(
|
||||
'grid items-center justify-center px-6 py-4',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
<ActivityIndicator
|
||||
circularProgressProps={{ className: 'w-5 h-5' }}
|
||||
label="Loading form..."
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const CreateRecordForm = dynamic(
|
||||
() => import('@/components/dataBrowser/CreateRecordForm'),
|
||||
{ ssr: false, loading: () => LoadingComponent() },
|
||||
);
|
||||
|
||||
const CreateColumnForm = dynamic(
|
||||
() => import('@/components/dataBrowser/CreateColumnForm'),
|
||||
{ ssr: false, loading: () => LoadingComponent() },
|
||||
);
|
||||
|
||||
const EditColumnForm = dynamic(
|
||||
() => import('@/components/dataBrowser/EditColumnForm'),
|
||||
{ ssr: false, loading: () => LoadingComponent() },
|
||||
);
|
||||
|
||||
const CreateTableForm = dynamic(
|
||||
() => import('@/components/dataBrowser/CreateTableForm'),
|
||||
{ ssr: false, loading: () => LoadingComponent() },
|
||||
);
|
||||
|
||||
const EditTableForm = dynamic(
|
||||
() => import('@/components/dataBrowser/EditTableForm'),
|
||||
{ ssr: false, loading: () => LoadingComponent() },
|
||||
);
|
||||
|
||||
const EditPermissionsForm = dynamic(
|
||||
() => import('@/components/dataBrowser/EditPermissionsForm'),
|
||||
{ ssr: false, loading: () => LoadingComponent() },
|
||||
);
|
||||
|
||||
function DialogProvider({ children }: PropsWithChildren<unknown>) {
|
||||
const router = useRouter();
|
||||
|
||||
const [
|
||||
{
|
||||
open: dialogOpen,
|
||||
activeDialogType,
|
||||
dialogProps,
|
||||
title: dialogTitle,
|
||||
payload: dialogPayload,
|
||||
},
|
||||
{ open: dialogOpen, title: dialogTitle, activeDialog, dialogProps },
|
||||
dialogDispatch,
|
||||
] = useReducer(dialogReducer, {
|
||||
open: false,
|
||||
@@ -110,10 +36,9 @@ function DialogProvider({ children }: PropsWithChildren<unknown>) {
|
||||
const [
|
||||
{
|
||||
open: drawerOpen,
|
||||
activeDialogType: activeDrawerType,
|
||||
dialogProps: drawerProps,
|
||||
title: drawerTitle,
|
||||
payload: drawerPayload,
|
||||
activeDialog: activeDrawer,
|
||||
dialogProps: drawerProps,
|
||||
},
|
||||
drawerDispatch,
|
||||
] = useReducer(drawerReducer, {
|
||||
@@ -136,12 +61,9 @@ function DialogProvider({ children }: PropsWithChildren<unknown>) {
|
||||
const isDialogDirty = useRef(false);
|
||||
const [showDirtyConfirmation, setShowDirtyConfirmation] = useState(false);
|
||||
|
||||
const openDialog = useCallback(
|
||||
<TConfig,>(type: DialogType, config?: DialogConfig<TConfig>) => {
|
||||
dialogDispatch({ type: 'OPEN_DIALOG', payload: { type, config } });
|
||||
},
|
||||
[],
|
||||
);
|
||||
const openDialog = useCallback((options: OpenDialogOptions) => {
|
||||
dialogDispatch({ type: 'OPEN_DIALOG', payload: options });
|
||||
}, []);
|
||||
|
||||
const closeDialog = useCallback(() => {
|
||||
dialogDispatch({ type: 'HIDE_DIALOG' });
|
||||
@@ -152,12 +74,9 @@ function DialogProvider({ children }: PropsWithChildren<unknown>) {
|
||||
dialogDispatch({ type: 'CLEAR_DIALOG_CONTENT' });
|
||||
}, []);
|
||||
|
||||
const openDrawer = useCallback(
|
||||
<TConfig,>(type: DialogType, config?: DialogConfig<TConfig>) => {
|
||||
drawerDispatch({ type: 'OPEN_DRAWER', payload: { type, config } });
|
||||
},
|
||||
[],
|
||||
);
|
||||
const openDrawer = useCallback((options: OpenDialogOptions) => {
|
||||
drawerDispatch({ type: 'OPEN_DRAWER', payload: options });
|
||||
}, []);
|
||||
|
||||
const closeDrawer = useCallback(() => {
|
||||
drawerDispatch({ type: 'HIDE_DRAWER' });
|
||||
@@ -228,9 +147,6 @@ function DialogProvider({ children }: PropsWithChildren<unknown>) {
|
||||
[closeDialog, openDirtyConfirmation],
|
||||
);
|
||||
|
||||
// We are coupling this logic with the location of the dialog content which is
|
||||
// not ideal. We shoule figure out a better logic for tracking the dirty
|
||||
// state in the future.
|
||||
const onDirtyStateChange = useCallback(
|
||||
(dirty: boolean, location: 'drawer' | 'dialog' = 'drawer') => {
|
||||
if (location === 'dialog') {
|
||||
@@ -271,25 +187,6 @@ function DialogProvider({ children }: PropsWithChildren<unknown>) {
|
||||
],
|
||||
);
|
||||
|
||||
const sharedDialogProps = {
|
||||
...dialogPayload,
|
||||
onSubmit: async (values: any) => {
|
||||
await dialogPayload?.onSubmit?.(values);
|
||||
|
||||
closeDialog();
|
||||
},
|
||||
onCancel: closeDialogWithDirtyGuard,
|
||||
};
|
||||
|
||||
const sharedDrawerProps = {
|
||||
onSubmit: async () => {
|
||||
await drawerPayload?.onSubmit();
|
||||
|
||||
closeDrawer();
|
||||
},
|
||||
onCancel: closeDrawerWithDirtyGuard,
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
function handleCloseDrawerAndDialog() {
|
||||
if (isDrawerDirty.current || isDialogDirty.current) {
|
||||
@@ -367,56 +264,20 @@ function DialogProvider({ children }: PropsWithChildren<unknown>) {
|
||||
<RetryableErrorBoundary
|
||||
errorMessageProps={{ className: 'pt-0 pb-5 px-6' }}
|
||||
>
|
||||
{activeDialogType === 'EDIT_WORKSPACE_NAME' && (
|
||||
<EditWorkspaceNameForm {...sharedDialogProps} />
|
||||
)}
|
||||
|
||||
{activeDialogType === 'CREATE_FOREIGN_KEY' && (
|
||||
<CreateForeignKeyForm {...sharedDialogProps} />
|
||||
)}
|
||||
|
||||
{activeDialogType === 'EDIT_FOREIGN_KEY' && (
|
||||
<EditForeignKeyForm {...sharedDialogProps} />
|
||||
)}
|
||||
|
||||
{activeDialogType === 'CREATE_ROLE' && (
|
||||
<CreateRoleForm {...sharedDialogProps} />
|
||||
)}
|
||||
|
||||
{activeDialogType === 'EDIT_ROLE' && (
|
||||
<EditRoleForm {...sharedDialogProps} />
|
||||
)}
|
||||
|
||||
{activeDialogType === 'CREATE_USER' && (
|
||||
<CreateUserForm {...sharedDialogProps} />
|
||||
)}
|
||||
|
||||
{activeDialogType === 'CREATE_PERMISSION_VARIABLE' && (
|
||||
<CreatePermissionVariableForm {...sharedDialogProps} />
|
||||
)}
|
||||
|
||||
{activeDialogType === 'EDIT_PERMISSION_VARIABLE' && (
|
||||
<EditPermissionVariableForm {...sharedDialogProps} />
|
||||
)}
|
||||
|
||||
{activeDialogType === 'CREATE_ENVIRONMENT_VARIABLE' && (
|
||||
<CreateEnvironmentVariableForm {...sharedDialogProps} />
|
||||
)}
|
||||
|
||||
{activeDialogType === 'EDIT_ENVIRONMENT_VARIABLE' && (
|
||||
<EditEnvironmentVariableForm {...sharedDialogProps} />
|
||||
)}
|
||||
|
||||
{activeDialogType === 'EDIT_USER_PASSWORD' && (
|
||||
<EditUserPasswordForm
|
||||
{...sharedDialogProps}
|
||||
user={sharedDialogProps?.user}
|
||||
/>
|
||||
)}
|
||||
|
||||
{activeDialogType === 'EDIT_JWT_SECRET' && (
|
||||
<EditJwtSecretForm {...sharedDialogProps} />
|
||||
)}
|
||||
{isValidElement(activeDialog)
|
||||
? cloneElement(activeDialog, {
|
||||
...activeDialog.props,
|
||||
location: 'dialog',
|
||||
onSubmit: async (values?: any) => {
|
||||
await activeDialog?.props?.onSubmit?.(values);
|
||||
closeDialog();
|
||||
},
|
||||
onCancel: () => {
|
||||
activeDialog?.props?.onCancel?.();
|
||||
closeDialogWithDirtyGuard();
|
||||
},
|
||||
})
|
||||
: null}
|
||||
</RetryableErrorBoundary>
|
||||
</BaseDialog>
|
||||
|
||||
@@ -436,51 +297,20 @@ function DialogProvider({ children }: PropsWithChildren<unknown>) {
|
||||
}}
|
||||
>
|
||||
<RetryableErrorBoundary>
|
||||
{activeDrawerType === 'CREATE_RECORD' && (
|
||||
<CreateRecordForm
|
||||
{...sharedDrawerProps}
|
||||
columns={drawerPayload?.columns}
|
||||
/>
|
||||
)}
|
||||
|
||||
{activeDrawerType === 'CREATE_COLUMN' && (
|
||||
<CreateColumnForm {...sharedDrawerProps} />
|
||||
)}
|
||||
|
||||
{activeDrawerType === 'EDIT_COLUMN' && (
|
||||
<EditColumnForm
|
||||
{...sharedDrawerProps}
|
||||
column={drawerPayload?.column}
|
||||
/>
|
||||
)}
|
||||
|
||||
{activeDrawerType === 'CREATE_TABLE' && (
|
||||
<CreateTableForm
|
||||
{...sharedDrawerProps}
|
||||
schema={drawerPayload?.schema}
|
||||
/>
|
||||
)}
|
||||
|
||||
{activeDrawerType === 'EDIT_TABLE' && (
|
||||
<EditTableForm
|
||||
{...sharedDrawerProps}
|
||||
table={drawerPayload?.table}
|
||||
schema={drawerPayload?.schema}
|
||||
/>
|
||||
)}
|
||||
|
||||
{activeDrawerType === 'EDIT_PERMISSIONS' && (
|
||||
<EditPermissionsForm
|
||||
{...sharedDrawerProps}
|
||||
disabled={drawerPayload?.disabled}
|
||||
schema={drawerPayload?.schema}
|
||||
table={drawerPayload?.table}
|
||||
/>
|
||||
)}
|
||||
|
||||
{activeDrawerType === 'EDIT_USER' && (
|
||||
<EditUserForm {...sharedDrawerProps} {...drawerPayload} />
|
||||
)}
|
||||
{isValidElement(activeDrawer)
|
||||
? cloneElement(activeDrawer, {
|
||||
...activeDrawer.props,
|
||||
location: 'drawer',
|
||||
onSubmit: async (values?: any) => {
|
||||
await activeDrawer?.props?.onSubmit?.(values);
|
||||
closeDrawer();
|
||||
},
|
||||
onCancel: () => {
|
||||
activeDrawer?.props?.onCancel?.();
|
||||
closeDrawerWithDirtyGuard();
|
||||
},
|
||||
})
|
||||
: null}
|
||||
</RetryableErrorBoundary>
|
||||
</Drawer>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { CommonDialogProps } from '@/ui/v2/Dialog';
|
||||
import type { ReactNode } from 'react';
|
||||
import type { DialogConfig, DialogType } from './DialogContext';
|
||||
import type { ReactElement, ReactNode } from 'react';
|
||||
import type { DialogConfig, OpenDialogOptions } from './DialogContext';
|
||||
|
||||
export interface DialogState {
|
||||
/**
|
||||
@@ -12,9 +12,13 @@ export interface DialogState {
|
||||
*/
|
||||
open?: boolean;
|
||||
/**
|
||||
* Type of the currently active dialog.
|
||||
* Component to render inside the dialog skeleton.
|
||||
*/
|
||||
activeDialogType?: DialogType;
|
||||
activeDialog?: ReactElement<{
|
||||
location?: 'drawer' | 'dialog';
|
||||
onCancel?: () => void;
|
||||
onSubmit?: (args?: any) => Promise<any> | void;
|
||||
}>;
|
||||
/**
|
||||
* Props passed to the currently active dialog.
|
||||
*/
|
||||
@@ -27,10 +31,7 @@ export interface DialogState {
|
||||
}
|
||||
|
||||
export type DialogAction =
|
||||
| {
|
||||
type: 'OPEN_DIALOG';
|
||||
payload: { type: DialogType; config?: DialogConfig };
|
||||
}
|
||||
| { type: 'OPEN_DIALOG'; payload: OpenDialogOptions }
|
||||
| { type: 'HIDE_DIALOG' }
|
||||
| { type: 'CLEAR_DIALOG_CONTENT' };
|
||||
|
||||
@@ -50,10 +51,9 @@ export function dialogReducer(
|
||||
return {
|
||||
...state,
|
||||
open: true,
|
||||
activeDialogType: action.payload?.type,
|
||||
dialogProps: action.payload.config?.props,
|
||||
title: action.payload.config?.title,
|
||||
payload: action.payload.config?.payload,
|
||||
title: action.payload.title,
|
||||
activeDialog: action.payload.component,
|
||||
dialogProps: action.payload.props,
|
||||
};
|
||||
case 'HIDE_DIALOG':
|
||||
return {
|
||||
@@ -64,8 +64,7 @@ export function dialogReducer(
|
||||
return {
|
||||
...state,
|
||||
title: undefined,
|
||||
payload: undefined,
|
||||
activeDialogType: undefined,
|
||||
activeDialog: undefined,
|
||||
dialogProps: undefined,
|
||||
};
|
||||
default:
|
||||
@@ -74,10 +73,7 @@ export function dialogReducer(
|
||||
}
|
||||
|
||||
export type DrawerAction =
|
||||
| {
|
||||
type: 'OPEN_DRAWER';
|
||||
payload: { type: DialogType; config?: DialogConfig };
|
||||
}
|
||||
| { type: 'OPEN_DRAWER'; payload: OpenDialogOptions }
|
||||
| { type: 'HIDE_DRAWER' }
|
||||
| { type: 'CLEAR_DRAWER_CONTENT' };
|
||||
|
||||
@@ -97,10 +93,9 @@ export function drawerReducer(
|
||||
return {
|
||||
...state,
|
||||
open: true,
|
||||
activeDialogType: action.payload?.type,
|
||||
dialogProps: action.payload.config?.props,
|
||||
title: action.payload.config?.title,
|
||||
payload: action.payload.config?.payload,
|
||||
title: action.payload.title,
|
||||
activeDialog: action.payload.component,
|
||||
dialogProps: action.payload.props,
|
||||
};
|
||||
case 'HIDE_DRAWER':
|
||||
return {
|
||||
@@ -111,8 +106,7 @@ export function drawerReducer(
|
||||
return {
|
||||
...state,
|
||||
title: undefined,
|
||||
payload: undefined,
|
||||
activeDialogType: undefined,
|
||||
activeDialog: undefined,
|
||||
dialogProps: undefined,
|
||||
};
|
||||
default:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { BoxProps } from '@/ui/v2/Box';
|
||||
import Box from '@/ui/v2/Box';
|
||||
import type { KeyboardEvent } from 'react';
|
||||
import { useRef } from 'react';
|
||||
import { useFormContext } from 'react-hook-form';
|
||||
|
||||
export interface FormProps extends BoxProps {
|
||||
@@ -11,6 +12,7 @@ export interface FormProps extends BoxProps {
|
||||
}
|
||||
|
||||
export default function Form({ onSubmit, onKeyDown, ...props }: FormProps) {
|
||||
const formRef = useRef<HTMLDivElement>();
|
||||
const {
|
||||
handleSubmit,
|
||||
formState: { isSubmitting },
|
||||
@@ -25,6 +27,15 @@ export default function Form({ onSubmit, onKeyDown, ...props }: FormProps) {
|
||||
return;
|
||||
}
|
||||
|
||||
const submitButton = Array.from(
|
||||
formRef.current.getElementsByTagName('button'),
|
||||
).find((item) => item.type === 'submit');
|
||||
|
||||
// Disabling submit if the submit button is disabled
|
||||
if (submitButton?.disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
handleSubmit(onSubmit)(event);
|
||||
@@ -35,6 +46,7 @@ export default function Form({ onSubmit, onKeyDown, ...props }: FormProps) {
|
||||
// so keyboard events must be handled on the form element itself.
|
||||
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
||||
<Box
|
||||
ref={formRef}
|
||||
component="form"
|
||||
{...props}
|
||||
onKeyDown={(event) => {
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import ActivityIndicator from '@/ui/v2/ActivityIndicator';
|
||||
import type { BoxProps } from '@/ui/v2/Box';
|
||||
import Box from '@/ui/v2/Box';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
|
||||
export interface FormActivityIndicatorProps extends BoxProps {}
|
||||
|
||||
export default function FormActivityIndicator({
|
||||
className,
|
||||
...props
|
||||
}: FormActivityIndicatorProps) {
|
||||
return (
|
||||
<Box
|
||||
{...props}
|
||||
className={twMerge(
|
||||
'grid items-center justify-center px-6 py-4',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
<ActivityIndicator
|
||||
circularProgressProps={{ className: 'w-5 h-5' }}
|
||||
label="Loading form..."
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './FormActivityIndicator';
|
||||
export { default } from './FormActivityIndicator';
|
||||
@@ -1,9 +1,9 @@
|
||||
import Breadcrumbs from '@/components/common/Breadcrumbs';
|
||||
import FeedbackForm from '@/components/common/FeedbackForm';
|
||||
import LocalAccountMenu from '@/components/common/LocalAccountMenu';
|
||||
import Logo from '@/components/common/Logo';
|
||||
import MobileNav from '@/components/common/MobileNav';
|
||||
import NavLink from '@/components/common/NavLink';
|
||||
import ThemeSwitcher from '@/components/common/ThemeSwitcher';
|
||||
import { AccountMenu } from '@/components/dashboard/AccountMenu';
|
||||
import useIsPlatform from '@/hooks/common/useIsPlatform';
|
||||
import Box from '@/ui/v2/Box';
|
||||
@@ -23,6 +23,7 @@ export default function Header({ className, ...props }: HeaderProps) {
|
||||
|
||||
return (
|
||||
<Box
|
||||
component="header"
|
||||
className={twMerge(
|
||||
'z-40 grid w-full transform-gpu grid-flow-col items-center justify-between gap-2 border-b-1 px-4 py-3',
|
||||
className,
|
||||
@@ -73,7 +74,7 @@ export default function Header({ className, ...props }: HeaderProps) {
|
||||
Docs
|
||||
</NavLink>
|
||||
|
||||
{isPlatform ? <AccountMenu /> : <ThemeSwitcher className="w-52" />}
|
||||
{isPlatform ? <AccountMenu /> : <LocalAccountMenu />}
|
||||
</div>
|
||||
|
||||
<MobileNav className="sm:hidden" />
|
||||
|
||||
@@ -38,6 +38,12 @@ function IconLink(
|
||||
: [icon.props?.sx]),
|
||||
{
|
||||
color: (theme) => {
|
||||
if (props.disabled) {
|
||||
return theme.palette.mode === 'dark'
|
||||
? 'text.secondary'
|
||||
: 'text.primary';
|
||||
}
|
||||
|
||||
if (active) {
|
||||
return 'primary.main';
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
import ThemeSwitcher from '@/components/common/ThemeSwitcher';
|
||||
import { Dropdown } from '@/ui/v2/Dropdown';
|
||||
import IconButton from '@/ui/v2/IconButton';
|
||||
import UserIcon from '@/ui/v2/icons/UserIcon';
|
||||
import Text from '@/ui/v2/Text';
|
||||
import getConfig from 'next/config';
|
||||
|
||||
export default function LocalAccountMenu() {
|
||||
const { publicRuntimeConfig } = getConfig();
|
||||
|
||||
return (
|
||||
<Dropdown.Root className="justify-self-center">
|
||||
<Dropdown.Trigger hideChevron asChild>
|
||||
<IconButton
|
||||
variant="borderless"
|
||||
color="secondary"
|
||||
className="h-7 w-7 rounded-full"
|
||||
sx={{
|
||||
backgroundColor: (theme) => `${theme.palette.grey[300]} !important`,
|
||||
}}
|
||||
>
|
||||
<UserIcon className="h-4 w-4" />
|
||||
</IconButton>
|
||||
</Dropdown.Trigger>
|
||||
|
||||
<Dropdown.Content
|
||||
PaperProps={{
|
||||
className: 'mt-1 p-6 grid grid-flow-row gap-4 w-full max-w-xs',
|
||||
}}
|
||||
>
|
||||
<ThemeSwitcher label="Theme" />
|
||||
|
||||
<Text className="text-center text-xs" color="disabled">
|
||||
Dashboard Version: {publicRuntimeConfig?.version || 'n/a'}
|
||||
</Text>
|
||||
</Dropdown.Content>
|
||||
</Dropdown.Root>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from './LocalAccountMenu';
|
||||
@@ -0,0 +1,46 @@
|
||||
import { useUI } from '@/context/UIContext';
|
||||
import { Alert } from '@/ui/Alert';
|
||||
|
||||
export default function MaintenanceAlert() {
|
||||
const { maintenanceActive, maintenanceEndDate } = useUI();
|
||||
|
||||
if (!maintenanceActive) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const dateTimeFormat = Intl.DateTimeFormat(undefined, {
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
second: '2-digit',
|
||||
day: '2-digit',
|
||||
month: '2-digit',
|
||||
year: 'numeric',
|
||||
timeZoneName: 'short',
|
||||
});
|
||||
|
||||
const parts = dateTimeFormat.formatToParts(maintenanceEndDate);
|
||||
|
||||
const year = parts.find((part) => part.type === 'year')?.value;
|
||||
const month = parts.find((part) => part.type === 'month')?.value;
|
||||
const day = parts.find((part) => part.type === 'day')?.value;
|
||||
const hour = parts.find((part) => part.type === 'hour')?.value;
|
||||
const minute = parts.find((part) => part.type === 'minute')?.value;
|
||||
const timeZone = parts.find((part) => part.type === 'timeZoneName')?.value;
|
||||
|
||||
return (
|
||||
<Alert severity="warning" className="mt-4">
|
||||
<p>
|
||||
We're currently doing maintenance on our infrastructure. Project
|
||||
creation and project settings are temporarily disabled during the
|
||||
maintenance period.
|
||||
</p>
|
||||
|
||||
{maintenanceEndDate && (
|
||||
<p>
|
||||
Maintenance is expected to be completed at {year}-{month}-{day} {hour}
|
||||
:{minute} {timeZone}.
|
||||
</p>
|
||||
)}
|
||||
</Alert>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from './MaintenanceAlert';
|
||||
@@ -20,6 +20,7 @@ import type { ListItemButtonProps } from '@/ui/v2/ListItem';
|
||||
import { ListItem } from '@/ui/v2/ListItem';
|
||||
import Text from '@/ui/v2/Text';
|
||||
import { useSignOut } from '@nhost/nextjs';
|
||||
import getConfig from 'next/config';
|
||||
import { useRouter } from 'next/router';
|
||||
import type { ReactNode } from 'react';
|
||||
import { cloneElement, Fragment, isValidElement, useState } from 'react';
|
||||
@@ -89,6 +90,7 @@ export default function MobileNav({ className, ...props }: MobileNavProps) {
|
||||
const { signOut } = useSignOut();
|
||||
const { setUserContext } = useUserDataContext();
|
||||
const router = useRouter();
|
||||
const { publicRuntimeConfig } = getConfig();
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -256,6 +258,10 @@ export default function MobileNav({ className, ...props }: MobileNavProps) {
|
||||
</ListItem.Button>
|
||||
</ListItem.Root>
|
||||
</List>
|
||||
|
||||
<Text className="text-center text-xs" color="secondary">
|
||||
Dashboard Version: {publicRuntimeConfig?.version || 'n/a'}
|
||||
</Text>
|
||||
</section>
|
||||
)}
|
||||
</Drawer>
|
||||
|
||||
@@ -21,6 +21,13 @@ export default function ThemeSwitcher({
|
||||
|
||||
onChange?.(event, value);
|
||||
}}
|
||||
slotProps={{
|
||||
listbox: { className: 'min-w-0 w-full' },
|
||||
popper: {
|
||||
disablePortal: false,
|
||||
className: 'z-[10000] w-[270px] w-full',
|
||||
},
|
||||
}}
|
||||
>
|
||||
<Option value="light">Light</Option>
|
||||
<Option value="dark">Dark</Option>
|
||||
|
||||
@@ -10,6 +10,7 @@ import Text from '@/ui/v2/Text';
|
||||
import { nhost } from '@/utils/nhost';
|
||||
import { useApolloClient } from '@apollo/client';
|
||||
import { useUserData } from '@nhost/nextjs';
|
||||
import getConfig from 'next/config';
|
||||
import { useRouter } from 'next/router';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
@@ -24,23 +25,10 @@ function AccountMenuContent({
|
||||
const router = useRouter();
|
||||
const client = useApolloClient();
|
||||
const { handleClose } = useDropdown();
|
||||
const { publicRuntimeConfig } = getConfig();
|
||||
|
||||
return (
|
||||
<Box className="relative grid w-account grid-flow-row gap-5 p-6">
|
||||
<Button
|
||||
variant="borderless"
|
||||
color="secondary"
|
||||
className="absolute top-6 right-4 grid grid-flow-col items-center gap-px self-start font-medium"
|
||||
onClick={async () => {
|
||||
await nhost.auth.signOut();
|
||||
router.push('/signin');
|
||||
await client.resetStore();
|
||||
}}
|
||||
endIcon={<PowerIcon className="mr-1 h-4 w-4" />}
|
||||
>
|
||||
Sign Out
|
||||
</Button>
|
||||
|
||||
<Box className="relative grid w-full grid-flow-row gap-5 p-6">
|
||||
<div className="grid grid-flow-row justify-center">
|
||||
<Avatar
|
||||
className="mx-auto mb-2 h-16 w-16 rounded-full"
|
||||
@@ -72,9 +60,26 @@ function AccountMenuContent({
|
||||
<Button color="error" disabled>
|
||||
Remove Account
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
variant="outlined"
|
||||
color="secondary"
|
||||
onClick={async () => {
|
||||
await nhost.auth.signOut();
|
||||
router.push('/signin');
|
||||
await client.resetStore();
|
||||
}}
|
||||
endIcon={<PowerIcon className="mr-1 h-4 w-4" />}
|
||||
>
|
||||
Sign Out
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<ThemeSwitcher label="Theme" fullWidth />
|
||||
<ThemeSwitcher label="Theme" />
|
||||
|
||||
<Text className="text-center text-xs" color="disabled">
|
||||
Dashboard Version: {publicRuntimeConfig?.version || 'n/a'}
|
||||
</Text>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
@@ -107,7 +112,7 @@ export function AccountMenu() {
|
||||
/>
|
||||
</Dropdown.Trigger>
|
||||
|
||||
<Dropdown.Content PaperProps={{ className: 'mt-1' }}>
|
||||
<Dropdown.Content PaperProps={{ className: 'mt-1 max-w-xs w-full' }}>
|
||||
<AccountMenuContent
|
||||
onChangePasswordClick={() => setChangePasswordModal(true)}
|
||||
/>
|
||||
|
||||
@@ -3,6 +3,7 @@ import ControlledCheckbox from '@/components/common/ControlledCheckbox';
|
||||
import { useDialog } from '@/components/common/DialogProvider';
|
||||
import Form from '@/components/common/Form';
|
||||
import InlineCode from '@/components/common/InlineCode';
|
||||
import type { DialogFormProps } from '@/types/common';
|
||||
import type { ColumnType, DatabaseColumn } from '@/types/dataBrowser';
|
||||
import Box from '@/ui/v2/Box';
|
||||
import Button from '@/ui/v2/Button';
|
||||
@@ -22,7 +23,7 @@ import ForeignKeyEditor from './ForeignKeyEditor';
|
||||
|
||||
export type BaseColumnFormValues = DatabaseColumn;
|
||||
|
||||
export interface BaseColumnFormProps {
|
||||
export interface BaseColumnFormProps extends DialogFormProps {
|
||||
/**
|
||||
* Function to be called when the form is submitted.
|
||||
*/
|
||||
@@ -60,6 +61,7 @@ export default function BaseColumnForm({
|
||||
onSubmit: handleExternalSubmit,
|
||||
onCancel,
|
||||
submitButtonText = 'Save',
|
||||
location,
|
||||
}: BaseColumnFormProps) {
|
||||
const { onDirtyStateChange } = useDialog();
|
||||
|
||||
@@ -91,8 +93,8 @@ export default function BaseColumnForm({
|
||||
const isDirty = Object.keys(dirtyFields).length > 0;
|
||||
|
||||
useEffect(() => {
|
||||
onDirtyStateChange(isDirty, 'drawer');
|
||||
}, [isDirty, onDirtyStateChange]);
|
||||
onDirtyStateChange(isDirty, location);
|
||||
}, [isDirty, location, onDirtyStateChange]);
|
||||
|
||||
return (
|
||||
<Form
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useDialog } from '@/components/common/DialogProvider';
|
||||
import type { BaseForeignKeyFormValues } from '@/components/dataBrowser/BaseForeignKeyForm';
|
||||
import CreateForeignKeyForm from '@/components/dataBrowser/CreateForeignKeyForm';
|
||||
import EditForeignKeyForm from '@/components/dataBrowser/EditForeignKeyForm';
|
||||
import type { DatabaseColumn } from '@/types/dataBrowser';
|
||||
import Box from '@/ui/v2/Box';
|
||||
import Button from '@/ui/v2/Button';
|
||||
@@ -29,7 +30,7 @@ const ForeignKeyEditorInput = forwardRef(
|
||||
) => {
|
||||
const { openDialog } = useDialog();
|
||||
const { setValue } = useFormContext();
|
||||
const column = useWatch<Partial<DatabaseColumn>>();
|
||||
const column = useWatch() as DatabaseColumn;
|
||||
const { foreignKeyRelation } = column;
|
||||
|
||||
if (!column.foreignKeyRelation) {
|
||||
@@ -39,8 +40,8 @@ const ForeignKeyEditorInput = forwardRef(
|
||||
className="py-1"
|
||||
disabled={!column.name || !column.type}
|
||||
ref={ref}
|
||||
onClick={() =>
|
||||
openDialog('CREATE_FOREIGN_KEY', {
|
||||
onClick={() => {
|
||||
openDialog({
|
||||
title: (
|
||||
<span className="grid grid-flow-row">
|
||||
<span>Add a Foreign Key Relation</span>
|
||||
@@ -51,16 +52,18 @@ const ForeignKeyEditorInput = forwardRef(
|
||||
</Text>
|
||||
</span>
|
||||
),
|
||||
payload: {
|
||||
selectedColumn: column.name,
|
||||
availableColumns: [column],
|
||||
onSubmit: (values: BaseForeignKeyFormValues) => {
|
||||
setValue('foreignKeyRelation', values);
|
||||
onCreateSubmit();
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
component: (
|
||||
<CreateForeignKeyForm
|
||||
selectedColumn={column.name}
|
||||
availableColumns={[column]}
|
||||
onSubmit={(values) => {
|
||||
setValue('foreignKeyRelation', values);
|
||||
onCreateSubmit();
|
||||
}}
|
||||
/>
|
||||
),
|
||||
});
|
||||
}}
|
||||
>
|
||||
Add Foreign Key
|
||||
</Button>
|
||||
@@ -86,20 +89,22 @@ const ForeignKeyEditorInput = forwardRef(
|
||||
<div className="grid grid-flow-col">
|
||||
<Button
|
||||
ref={ref}
|
||||
onClick={() =>
|
||||
openDialog('EDIT_FOREIGN_KEY', {
|
||||
onClick={() => {
|
||||
openDialog({
|
||||
title: 'Edit Foreign Key Relation',
|
||||
payload: {
|
||||
foreignKeyRelation,
|
||||
availableColumns: [column],
|
||||
selectedColumn: column.name,
|
||||
onSubmit: (values: BaseForeignKeyFormValues) => {
|
||||
setValue('foreignKeyRelation', values);
|
||||
onEditSubmit();
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
component: (
|
||||
<EditForeignKeyForm
|
||||
foreignKeyRelation={foreignKeyRelation}
|
||||
selectedColumn={column.name}
|
||||
availableColumns={[column]}
|
||||
onSubmit={(values) => {
|
||||
setValue('foreignKeyRelation', values);
|
||||
onEditSubmit();
|
||||
}}
|
||||
/>
|
||||
),
|
||||
});
|
||||
}}
|
||||
variant="borderless"
|
||||
className="min-w-[initial] py-1 px-2"
|
||||
>
|
||||
|
||||
@@ -2,6 +2,7 @@ import ControlledSelect from '@/components/common/ControlledSelect';
|
||||
import { useDialog } from '@/components/common/DialogProvider';
|
||||
import Form from '@/components/common/Form';
|
||||
import useDatabaseQuery from '@/hooks/dataBrowser/useDatabaseQuery';
|
||||
import type { DialogFormProps } from '@/types/common';
|
||||
import type { DatabaseColumn, ForeignKeyRelation } from '@/types/dataBrowser';
|
||||
import Box from '@/ui/v2/Box';
|
||||
import Button from '@/ui/v2/Button';
|
||||
@@ -23,7 +24,7 @@ export interface BaseForeignKeyFormValues extends ForeignKeyRelation {
|
||||
disableOriginColumn?: boolean;
|
||||
}
|
||||
|
||||
export interface BaseForeignKeyFormProps {
|
||||
export interface BaseForeignKeyFormProps extends DialogFormProps {
|
||||
/**
|
||||
* Available columns in the table.
|
||||
*/
|
||||
@@ -64,6 +65,7 @@ export function BaseForeignKeyForm({
|
||||
onSubmit: handleExternalSubmit,
|
||||
onCancel,
|
||||
submitButtonText = 'Save',
|
||||
location,
|
||||
}: BaseForeignKeyFormProps) {
|
||||
const { onDirtyStateChange } = useDialog();
|
||||
|
||||
@@ -86,8 +88,8 @@ export function BaseForeignKeyForm({
|
||||
const isDirty = Object.keys(dirtyFields).length > 0;
|
||||
|
||||
useEffect(() => {
|
||||
onDirtyStateChange(isDirty, 'dialog');
|
||||
}, [isDirty, onDirtyStateChange]);
|
||||
onDirtyStateChange(isDirty, location);
|
||||
}, [isDirty, location, onDirtyStateChange]);
|
||||
|
||||
return (
|
||||
<Form
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useDialog } from '@/components/common/DialogProvider';
|
||||
import Form from '@/components/common/Form';
|
||||
import DatabaseRecordInputGroup from '@/components/dataBrowser/DatabaseRecordInputGroup';
|
||||
import type { DialogFormProps } from '@/types/common';
|
||||
import type {
|
||||
ColumnInsertOptions,
|
||||
DataBrowserGridColumn,
|
||||
@@ -10,7 +11,7 @@ import Button from '@/ui/v2/Button';
|
||||
import { useEffect } from 'react';
|
||||
import { useFormContext } from 'react-hook-form';
|
||||
|
||||
export interface BaseRecordFormProps {
|
||||
export interface BaseRecordFormProps extends DialogFormProps {
|
||||
/**
|
||||
* The columns of the table.
|
||||
*/
|
||||
@@ -36,6 +37,7 @@ export default function BaseRecordForm({
|
||||
onSubmit: handleExternalSubmit,
|
||||
onCancel,
|
||||
submitButtonText = 'Save',
|
||||
location,
|
||||
}: BaseRecordFormProps) {
|
||||
const { onDirtyStateChange } = useDialog();
|
||||
const { requiredColumns, optionalColumns } = columns.reduce(
|
||||
@@ -70,8 +72,8 @@ export default function BaseRecordForm({
|
||||
const isDirty = Object.keys(dirtyFields).length > 0;
|
||||
|
||||
useEffect(() => {
|
||||
onDirtyStateChange(isDirty, 'drawer');
|
||||
}, [isDirty, onDirtyStateChange]);
|
||||
onDirtyStateChange(isDirty, location);
|
||||
}, [isDirty, location, onDirtyStateChange]);
|
||||
|
||||
// Stores columns in a map to have constant time lookup. This is necessary
|
||||
// for tables with many columns.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useDialog } from '@/components/common/DialogProvider';
|
||||
import Form from '@/components/common/Form';
|
||||
import { baseColumnValidationSchema } from '@/components/dataBrowser/BaseColumnForm';
|
||||
import type { DialogFormProps } from '@/types/common';
|
||||
import type { DatabaseTable, ForeignKeyRelation } from '@/types/dataBrowser';
|
||||
import Box from '@/ui/v2/Box';
|
||||
import Button from '@/ui/v2/Button';
|
||||
@@ -30,7 +31,7 @@ export interface BaseTableFormValues
|
||||
foreignKeyRelations?: ForeignKeyRelation[];
|
||||
}
|
||||
|
||||
export interface BaseTableFormProps {
|
||||
export interface BaseTableFormProps extends DialogFormProps {
|
||||
/**
|
||||
* Function to be called when the form is submitted.
|
||||
*/
|
||||
@@ -99,7 +100,9 @@ function NameInput() {
|
||||
function FormFooter({
|
||||
onCancel,
|
||||
submitButtonText,
|
||||
}: Pick<BaseTableFormProps, 'onCancel' | 'submitButtonText'>) {
|
||||
location,
|
||||
}: Pick<BaseTableFormProps, 'onCancel' | 'submitButtonText'> &
|
||||
Pick<DialogFormProps, 'location'>) {
|
||||
const { onDirtyStateChange } = useDialog();
|
||||
const { isSubmitting, dirtyFields } = useFormState();
|
||||
|
||||
@@ -108,8 +111,8 @@ function FormFooter({
|
||||
const isDirty = Object.keys(dirtyFields).length > 0;
|
||||
|
||||
useEffect(() => {
|
||||
onDirtyStateChange(isDirty, 'drawer');
|
||||
}, [isDirty, onDirtyStateChange]);
|
||||
onDirtyStateChange(isDirty, location);
|
||||
}, [isDirty, location, onDirtyStateChange]);
|
||||
|
||||
return (
|
||||
<Box className="grid flex-shrink-0 grid-flow-col justify-between gap-3 border-t-1 p-2">
|
||||
@@ -135,6 +138,7 @@ function FormFooter({
|
||||
}
|
||||
|
||||
export default function BaseTableForm({
|
||||
location,
|
||||
onSubmit: handleExternalSubmit,
|
||||
onCancel,
|
||||
submitButtonText = 'Save',
|
||||
@@ -168,7 +172,11 @@ export default function BaseTableForm({
|
||||
<ForeignKeyEditorSection />
|
||||
</div>
|
||||
|
||||
<FormFooter onCancel={onCancel} submitButtonText={submitButtonText} />
|
||||
<FormFooter
|
||||
onCancel={onCancel}
|
||||
submitButtonText={submitButtonText}
|
||||
location={location}
|
||||
/>
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { useDialog } from '@/components/common/DialogProvider';
|
||||
import type { BaseForeignKeyFormValues } from '@/components/dataBrowser/BaseForeignKeyForm';
|
||||
import CreateForeignKeyForm from '@/components/dataBrowser/CreateForeignKeyForm';
|
||||
import EditForeignKeyForm from '@/components/dataBrowser/EditForeignKeyForm';
|
||||
import type { DatabaseColumn, ForeignKeyRelation } from '@/types/dataBrowser';
|
||||
import Button from '@/ui/v2/Button';
|
||||
import PlusIcon from '@/ui/v2/icons/PlusIcon';
|
||||
@@ -68,18 +70,19 @@ export default function ForeignKeyEditorSection() {
|
||||
onEdit={() => {
|
||||
const primaryKeyIndex = getValues('primaryKeyIndex');
|
||||
|
||||
openDialog('EDIT_FOREIGN_KEY', {
|
||||
openDialog({
|
||||
title: 'Edit Foreign Key Relation',
|
||||
payload: {
|
||||
foreignKeyRelation: fields[index],
|
||||
availableColumns: columns.map((column, columnIndex) =>
|
||||
columnIndex === primaryKeyIndex
|
||||
? { ...column, isPrimary: true }
|
||||
: column,
|
||||
),
|
||||
onSubmit: (values: BaseForeignKeyFormValues) =>
|
||||
handleEdit(values, index),
|
||||
},
|
||||
component: (
|
||||
<EditForeignKeyForm
|
||||
foreignKeyRelation={fields[index] as ForeignKeyRelation}
|
||||
availableColumns={columns.map((column, columnIndex) =>
|
||||
columnIndex === primaryKeyIndex
|
||||
? { ...column, isPrimary: true }
|
||||
: column,
|
||||
)}
|
||||
onSubmit={(values) => handleEdit(values, index)}
|
||||
/>
|
||||
),
|
||||
});
|
||||
}}
|
||||
onDelete={() => remove(index)}
|
||||
@@ -105,7 +108,7 @@ export default function ForeignKeyEditorSection() {
|
||||
onClick={() => {
|
||||
const primaryKeyIndex = getValues('primaryKeyIndex');
|
||||
|
||||
openDialog('CREATE_FOREIGN_KEY', {
|
||||
openDialog({
|
||||
title: (
|
||||
<span className="grid grid-flow-row">
|
||||
<span>Add a Foreign Key Relation</span>
|
||||
@@ -116,14 +119,16 @@ export default function ForeignKeyEditorSection() {
|
||||
</Text>
|
||||
</span>
|
||||
),
|
||||
payload: {
|
||||
availableColumns: columns.map((column, index) =>
|
||||
index === primaryKeyIndex
|
||||
? { ...column, isPrimary: true }
|
||||
: column,
|
||||
),
|
||||
onSubmit: handleCreate,
|
||||
},
|
||||
component: (
|
||||
<CreateForeignKeyForm
|
||||
availableColumns={columns.map((column, index) =>
|
||||
index === primaryKeyIndex
|
||||
? { ...column, isPrimary: true }
|
||||
: column,
|
||||
)}
|
||||
onSubmit={handleCreate}
|
||||
/>
|
||||
),
|
||||
});
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import customClaimsQuery from '@/utils/msw/mocks/graphql/customClaimsQuery';
|
||||
import permissionVariablesQuery from '@/utils/msw/mocks/graphql/permissionVariablesQuery';
|
||||
import hasuraMetadataQuery from '@/utils/msw/mocks/rest/hasuraMetadataQuery';
|
||||
import tableQuery from '@/utils/msw/mocks/rest/tableQuery';
|
||||
import { render, screen } from '@/utils/testUtils';
|
||||
@@ -6,7 +6,11 @@ import { setupServer } from 'msw/node';
|
||||
import { test, vi } from 'vitest';
|
||||
import ColumnAutocomplete from './ColumnAutocomplete';
|
||||
|
||||
const server = setupServer(tableQuery, hasuraMetadataQuery, customClaimsQuery);
|
||||
const server = setupServer(
|
||||
tableQuery,
|
||||
hasuraMetadataQuery,
|
||||
permissionVariablesQuery,
|
||||
);
|
||||
|
||||
beforeAll(() => server.listen({ onUnhandledRequest: 'warn' }));
|
||||
afterEach(() => server.resetHandlers());
|
||||
|
||||
@@ -15,11 +15,11 @@ import { useRouter } from 'next/router';
|
||||
import { FormProvider, useForm } from 'react-hook-form';
|
||||
|
||||
export interface CreateColumnFormProps
|
||||
extends Pick<BaseColumnFormProps, 'onCancel'> {
|
||||
extends Pick<BaseColumnFormProps, 'onCancel' | 'location'> {
|
||||
/**
|
||||
* Function to be called when the form is submitted.
|
||||
*/
|
||||
onSubmit?: () => Promise<void>;
|
||||
onSubmit?: (args?: any) => Promise<any>;
|
||||
}
|
||||
|
||||
export default function CreateColumnForm({
|
||||
|
||||
@@ -13,7 +13,10 @@ import { useState } from 'react';
|
||||
import { FormProvider, useForm } from 'react-hook-form';
|
||||
|
||||
export interface CreateForeignKeyFormProps
|
||||
extends Pick<BaseForeignKeyFormProps, 'onCancel' | 'availableColumns'> {
|
||||
extends Pick<
|
||||
BaseForeignKeyFormProps,
|
||||
'onCancel' | 'availableColumns' | 'location'
|
||||
> {
|
||||
/**
|
||||
* Column selected by default.
|
||||
*/
|
||||
@@ -21,7 +24,7 @@ export interface CreateForeignKeyFormProps
|
||||
/**
|
||||
* Function to be called when the form is submitted.
|
||||
*/
|
||||
onSubmit?: (values: BaseForeignKeyFormValues) => Promise<void>;
|
||||
onSubmit?: (values: BaseForeignKeyFormValues) => Promise<void> | void;
|
||||
}
|
||||
|
||||
export default function CreateForeignKeyForm({
|
||||
@@ -51,9 +54,7 @@ export default function CreateForeignKeyForm({
|
||||
setError(undefined);
|
||||
|
||||
try {
|
||||
if (onSubmit) {
|
||||
await onSubmit(values);
|
||||
}
|
||||
await onSubmit?.(values);
|
||||
} catch (submitError) {
|
||||
if (submitError && submitError instanceof Error) {
|
||||
setError(submitError);
|
||||
|
||||
@@ -10,11 +10,11 @@ import { yupResolver } from '@hookform/resolvers/yup';
|
||||
import { FormProvider, useForm } from 'react-hook-form';
|
||||
|
||||
export interface CreateRecordFormProps
|
||||
extends Pick<BaseRecordFormProps, 'columns' | 'onCancel'> {
|
||||
extends Pick<BaseRecordFormProps, 'columns' | 'onCancel' | 'location'> {
|
||||
/**
|
||||
* Function to be called when the form is submitted.
|
||||
*/
|
||||
onSubmit?: () => Promise<void>;
|
||||
onSubmit?: (args?: any) => Promise<any>;
|
||||
}
|
||||
|
||||
export default function CreateRecordForm({
|
||||
|
||||
@@ -17,7 +17,7 @@ import { useRouter } from 'next/router';
|
||||
import { FormProvider, useForm } from 'react-hook-form';
|
||||
|
||||
export interface CreateTableFormProps
|
||||
extends Pick<BaseTableFormProps, 'onCancel'> {
|
||||
extends Pick<BaseTableFormProps, 'onCancel' | 'location'> {
|
||||
/**
|
||||
* Schema where the table should be created.
|
||||
*/
|
||||
@@ -25,7 +25,7 @@ export interface CreateTableFormProps
|
||||
/**
|
||||
* Function to be called when the form is submitted.
|
||||
*/
|
||||
onSubmit?: () => Promise<void>;
|
||||
onSubmit?: (args?: any) => Promise<any>;
|
||||
}
|
||||
|
||||
export default function CreateTableForm({
|
||||
|
||||
@@ -5,6 +5,7 @@ import DataGridDateCell from '@/components/common/DataGridDateCell';
|
||||
import DataGridNumericCell from '@/components/common/DataGridNumericCell';
|
||||
import DataGridTextCell from '@/components/common/DataGridTextCell';
|
||||
import { useDialog } from '@/components/common/DialogProvider';
|
||||
import FormActivityIndicator from '@/components/common/FormActivityIndicator';
|
||||
import InlineCode from '@/components/common/InlineCode';
|
||||
import DataBrowserEmptyState from '@/components/dataBrowser/DataBrowserEmptyState';
|
||||
import DataBrowserGridControls from '@/components/dataBrowser/DataBrowserGridControls';
|
||||
@@ -28,9 +29,25 @@ import {
|
||||
} from '@/utils/dataBrowser/postgresqlConstants';
|
||||
import { isSchemaLocked } from '@/utils/dataBrowser/schemaHelpers';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import dynamic from 'next/dynamic';
|
||||
import { useRouter } from 'next/router';
|
||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||
|
||||
const CreateColumnForm = dynamic(
|
||||
() => import('@/components/dataBrowser/CreateColumnForm'),
|
||||
{ ssr: false, loading: () => <FormActivityIndicator /> },
|
||||
);
|
||||
|
||||
const EditColumnForm = dynamic(
|
||||
() => import('@/components/dataBrowser/EditColumnForm'),
|
||||
{ ssr: false, loading: () => <FormActivityIndicator /> },
|
||||
);
|
||||
|
||||
const CreateRecordForm = dynamic(
|
||||
() => import('@/components/dataBrowser/CreateRecordForm'),
|
||||
{ ssr: false, loading: () => <FormActivityIndicator /> },
|
||||
);
|
||||
|
||||
export interface DataBrowserGridProps extends Partial<DataGridProps<any>> {}
|
||||
|
||||
export function createDataGridColumn(
|
||||
@@ -273,33 +290,36 @@ export default function DataBrowserGrid({
|
||||
const memoizedData = useMemo(() => rows, [rows]);
|
||||
|
||||
async function handleInsertRowClick() {
|
||||
openDrawer('CREATE_RECORD', {
|
||||
openDrawer({
|
||||
title: 'Insert a New Row',
|
||||
payload: {
|
||||
columns: memoizedColumns,
|
||||
onSubmit: refetch,
|
||||
},
|
||||
component: (
|
||||
<CreateRecordForm
|
||||
// TODO: Create proper typings for data browser columns
|
||||
columns={memoizedColumns as unknown as DataBrowserGridColumn[]}
|
||||
onSubmit={refetch}
|
||||
/>
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
async function handleInsertColumnClick() {
|
||||
openDrawer('CREATE_COLUMN', {
|
||||
openDrawer({
|
||||
title: 'Insert a New Column',
|
||||
payload: {
|
||||
onSubmit: refetch,
|
||||
},
|
||||
component: <CreateColumnForm onSubmit={refetch} />,
|
||||
});
|
||||
}
|
||||
|
||||
async function handleEditColumnClick(
|
||||
column: DataBrowserGridColumn<NormalizedQueryDataRow>,
|
||||
) {
|
||||
openDrawer('EDIT_COLUMN', {
|
||||
openDrawer({
|
||||
title: 'Edit Column',
|
||||
payload: {
|
||||
column,
|
||||
onSubmit: () => queryClient.refetchQueries([currentTablePath]),
|
||||
},
|
||||
component: (
|
||||
<EditColumnForm
|
||||
column={column}
|
||||
onSubmit={() => queryClient.refetchQueries([currentTablePath])}
|
||||
/>
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useDialog } from '@/components/common/DialogProvider';
|
||||
import FormActivityIndicator from '@/components/common/FormActivityIndicator';
|
||||
import InlineCode from '@/components/common/InlineCode';
|
||||
import NavLink from '@/components/common/NavLink';
|
||||
import RetryableErrorBoundary from '@/components/common/RetryableErrorBoundary';
|
||||
@@ -31,11 +32,36 @@ import Select from '@/ui/v2/Select';
|
||||
import Text from '@/ui/v2/Text';
|
||||
import { isSchemaLocked } from '@/utils/dataBrowser/schemaHelpers';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import dynamic from 'next/dynamic';
|
||||
import Image from 'next/image';
|
||||
import { useRouter } from 'next/router';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
|
||||
const CreateTableForm = dynamic(
|
||||
() => import('@/components/dataBrowser/CreateTableForm'),
|
||||
{
|
||||
ssr: false,
|
||||
loading: () => <FormActivityIndicator />,
|
||||
},
|
||||
);
|
||||
|
||||
const EditTableForm = dynamic(
|
||||
() => import('@/components/dataBrowser/EditTableForm'),
|
||||
{
|
||||
ssr: false,
|
||||
loading: () => <FormActivityIndicator />,
|
||||
},
|
||||
);
|
||||
|
||||
const EditPermissionsForm = dynamic(
|
||||
() => import('@/components/dataBrowser/EditPermissionsForm'),
|
||||
{
|
||||
ssr: false,
|
||||
loading: () => <FormActivityIndicator />,
|
||||
},
|
||||
);
|
||||
|
||||
export interface DataBrowserSidebarProps extends Omit<BoxProps, 'children'> {
|
||||
/**
|
||||
* Function to be called when a sidebar item is clicked.
|
||||
@@ -200,7 +226,7 @@ function DataBrowserSidebarContent({
|
||||
table: string,
|
||||
disabled?: boolean,
|
||||
) {
|
||||
openDrawer('EDIT_PERMISSIONS', {
|
||||
openDrawer({
|
||||
title: (
|
||||
<span className="inline-grid grid-flow-col items-center gap-2">
|
||||
Permissions
|
||||
@@ -208,22 +234,18 @@ function DataBrowserSidebarContent({
|
||||
<Chip label="Preview" size="small" color="info" component="span" />
|
||||
</span>
|
||||
),
|
||||
component: (
|
||||
<EditPermissionsForm
|
||||
disabled={disabled}
|
||||
schema={schema}
|
||||
table={table}
|
||||
/>
|
||||
),
|
||||
props: {
|
||||
PaperProps: {
|
||||
className: 'lg:w-[65%] lg:max-w-7xl',
|
||||
},
|
||||
},
|
||||
payload: {
|
||||
onSubmit: async () => {
|
||||
await queryClient.refetchQueries([
|
||||
`${dataSourceSlug}.${schema}.${table}`,
|
||||
]);
|
||||
await refetch();
|
||||
},
|
||||
disabled,
|
||||
schema,
|
||||
table,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -296,9 +318,11 @@ function DataBrowserSidebarContent({
|
||||
endIcon={<PlusIcon />}
|
||||
className="mt-1 w-full justify-between px-2"
|
||||
onClick={() => {
|
||||
openDrawer('CREATE_TABLE', {
|
||||
openDrawer({
|
||||
title: 'Create a New Table',
|
||||
payload: { onSubmit: refetch, schema: selectedSchema },
|
||||
component: (
|
||||
<CreateTableForm onSubmit={refetch} schema={selectedSchema} />
|
||||
),
|
||||
});
|
||||
|
||||
onSidebarItemClick();
|
||||
@@ -328,69 +352,68 @@ function DataBrowserSidebarContent({
|
||||
className="group"
|
||||
key={tablePath}
|
||||
secondaryAction={
|
||||
!isSelectedSchemaLocked && (
|
||||
<Dropdown.Root
|
||||
id="table-management-menu"
|
||||
onOpen={() => setSidebarMenuTable(tablePath)}
|
||||
onClose={() => setSidebarMenuTable(undefined)}
|
||||
<Dropdown.Root
|
||||
id="table-management-menu"
|
||||
onOpen={() => setSidebarMenuTable(tablePath)}
|
||||
onClose={() => setSidebarMenuTable(undefined)}
|
||||
>
|
||||
<Dropdown.Trigger
|
||||
asChild
|
||||
hideChevron
|
||||
disabled={tablePath === removableTable}
|
||||
>
|
||||
<Dropdown.Trigger
|
||||
asChild
|
||||
hideChevron
|
||||
disabled={tablePath === removableTable}
|
||||
<IconButton
|
||||
variant="borderless"
|
||||
color={isSelected ? 'primary' : 'secondary'}
|
||||
className={twMerge(
|
||||
!isSelected &&
|
||||
'opacity-0 group-focus-within:opacity-100 group-hover:opacity-100 group-active:opacity-100',
|
||||
)}
|
||||
>
|
||||
<IconButton
|
||||
variant="borderless"
|
||||
color={isSelected ? 'primary' : 'secondary'}
|
||||
className={twMerge(
|
||||
!isSelected &&
|
||||
'opacity-0 group-focus-within:opacity-100 group-hover:opacity-100 group-active:opacity-100',
|
||||
)}
|
||||
<DotsHorizontalIcon />
|
||||
</IconButton>
|
||||
</Dropdown.Trigger>
|
||||
|
||||
<Dropdown.Content menu PaperProps={{ className: 'w-52' }}>
|
||||
{isGitHubConnected ? (
|
||||
<Dropdown.Item
|
||||
className="grid grid-flow-col items-center gap-2 p-2 text-sm+ font-medium"
|
||||
onClick={() =>
|
||||
handleEditPermissionClick(
|
||||
table.table_schema,
|
||||
table.table_name,
|
||||
true,
|
||||
)
|
||||
}
|
||||
>
|
||||
<DotsHorizontalIcon />
|
||||
</IconButton>
|
||||
</Dropdown.Trigger>
|
||||
<UsersIcon
|
||||
className="h-4 w-4"
|
||||
sx={{ color: 'text.secondary' }}
|
||||
/>
|
||||
|
||||
<Dropdown.Content
|
||||
menu
|
||||
PaperProps={{ className: 'w-52' }}
|
||||
>
|
||||
{isGitHubConnected ? (
|
||||
<Dropdown.Item
|
||||
className="grid grid-flow-col items-center gap-2 p-2 text-sm+ font-medium"
|
||||
onClick={() =>
|
||||
handleEditPermissionClick(
|
||||
table.table_schema,
|
||||
table.table_name,
|
||||
true,
|
||||
)
|
||||
}
|
||||
>
|
||||
<UsersIcon
|
||||
className="h-4 w-4"
|
||||
sx={{ color: 'text.secondary' }}
|
||||
/>
|
||||
|
||||
<span>View Permissions</span>
|
||||
</Dropdown.Item>
|
||||
) : (
|
||||
[
|
||||
<span>View Permissions</span>
|
||||
</Dropdown.Item>
|
||||
) : (
|
||||
[
|
||||
!isSelectedSchemaLocked && (
|
||||
<Dropdown.Item
|
||||
key="edit-table"
|
||||
className="grid grid-flow-col items-center gap-2 p-2 text-sm+ font-medium"
|
||||
onClick={() =>
|
||||
openDrawer('EDIT_TABLE', {
|
||||
openDrawer({
|
||||
title: 'Edit Table',
|
||||
payload: {
|
||||
onSubmit: async () => {
|
||||
await queryClient.refetchQueries([
|
||||
`${dataSourceSlug}.${table.table_schema}.${table.table_name}`,
|
||||
]);
|
||||
await refetch();
|
||||
},
|
||||
schema: table.table_schema,
|
||||
table,
|
||||
},
|
||||
component: (
|
||||
<EditTableForm
|
||||
onSubmit={async () => {
|
||||
await queryClient.refetchQueries([
|
||||
`${dataSourceSlug}.${table.table_schema}.${table.table_name}`,
|
||||
]);
|
||||
await refetch();
|
||||
}}
|
||||
schema={table.table_schema}
|
||||
table={table}
|
||||
/>
|
||||
),
|
||||
})
|
||||
}
|
||||
>
|
||||
@@ -400,32 +423,38 @@ function DataBrowserSidebarContent({
|
||||
/>
|
||||
|
||||
<span>Edit Table</span>
|
||||
</Dropdown.Item>,
|
||||
</Dropdown.Item>
|
||||
),
|
||||
!isSelectedSchemaLocked && (
|
||||
<Divider
|
||||
key="edit-table-separator"
|
||||
component="li"
|
||||
/>,
|
||||
<Dropdown.Item
|
||||
key="edit-permissions"
|
||||
className="grid grid-flow-col items-center gap-2 p-2 text-sm+ font-medium"
|
||||
onClick={() =>
|
||||
handleEditPermissionClick(
|
||||
table.table_schema,
|
||||
table.table_name,
|
||||
)
|
||||
}
|
||||
>
|
||||
<UsersIcon
|
||||
className="h-4 w-4"
|
||||
sx={{ color: 'text.secondary' }}
|
||||
/>
|
||||
/>
|
||||
),
|
||||
<Dropdown.Item
|
||||
key="edit-permissions"
|
||||
className="grid grid-flow-col items-center gap-2 p-2 text-sm+ font-medium"
|
||||
onClick={() =>
|
||||
handleEditPermissionClick(
|
||||
table.table_schema,
|
||||
table.table_name,
|
||||
)
|
||||
}
|
||||
>
|
||||
<UsersIcon
|
||||
className="h-4 w-4"
|
||||
sx={{ color: 'text.secondary' }}
|
||||
/>
|
||||
|
||||
<span>Edit Permissions</span>
|
||||
</Dropdown.Item>,
|
||||
<span>Edit Permissions</span>
|
||||
</Dropdown.Item>,
|
||||
!isSelectedSchemaLocked && (
|
||||
<Divider
|
||||
key="edit-permissions-separator"
|
||||
component="li"
|
||||
/>,
|
||||
/>
|
||||
),
|
||||
!isSelectedSchemaLocked && (
|
||||
<Dropdown.Item
|
||||
key="delete-table"
|
||||
className="grid grid-flow-col items-center gap-2 p-2 text-sm+ font-medium"
|
||||
@@ -443,12 +472,12 @@ function DataBrowserSidebarContent({
|
||||
/>
|
||||
|
||||
<span>Delete Table</span>
|
||||
</Dropdown.Item>,
|
||||
]
|
||||
)}
|
||||
</Dropdown.Content>
|
||||
</Dropdown.Root>
|
||||
)
|
||||
</Dropdown.Item>
|
||||
),
|
||||
]
|
||||
)}
|
||||
</Dropdown.Content>
|
||||
</Dropdown.Root>
|
||||
}
|
||||
>
|
||||
<ListItem.Button
|
||||
@@ -518,7 +547,7 @@ export default function DataBrowserSidebar({
|
||||
document.removeEventListener('keydown', closeSidebarWhenEscapeIsPressed);
|
||||
}, []);
|
||||
|
||||
if (isPlatform && !currentApplication?.hasuraGraphqlAdminSecret) {
|
||||
if (isPlatform && !currentApplication?.config?.hasura.adminSecret) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import { useRouter } from 'next/router';
|
||||
import { FormProvider, useForm } from 'react-hook-form';
|
||||
|
||||
export interface EditColumnFormProps
|
||||
extends Pick<BaseColumnFormProps, 'onCancel'> {
|
||||
extends Pick<BaseColumnFormProps, 'onCancel' | 'location'> {
|
||||
/**
|
||||
* Column to be edited.
|
||||
*/
|
||||
|
||||
@@ -14,7 +14,10 @@ import { useState } from 'react';
|
||||
import { FormProvider, useForm } from 'react-hook-form';
|
||||
|
||||
export interface EditForeignKeyFormProps
|
||||
extends Pick<BaseForeignKeyFormProps, 'onCancel' | 'availableColumns'> {
|
||||
extends Pick<
|
||||
BaseForeignKeyFormProps,
|
||||
'onCancel' | 'availableColumns' | 'location'
|
||||
> {
|
||||
/**
|
||||
* Foreign key relation to be edited.
|
||||
*/
|
||||
@@ -26,7 +29,7 @@ export interface EditForeignKeyFormProps
|
||||
/**
|
||||
* Function to be called when the form is submitted.
|
||||
*/
|
||||
onSubmit?: (values: BaseForeignKeyFormValues) => Promise<void>;
|
||||
onSubmit?: (values: BaseForeignKeyFormValues) => Promise<void> | void;
|
||||
}
|
||||
|
||||
export default function EditForeignKeyForm({
|
||||
@@ -57,9 +60,7 @@ export default function EditForeignKeyForm({
|
||||
setError(undefined);
|
||||
|
||||
try {
|
||||
if (onSubmit) {
|
||||
await onSubmit(values);
|
||||
}
|
||||
await onSubmit?.(values);
|
||||
} catch (submitError) {
|
||||
if (submitError && submitError instanceof Error) {
|
||||
setError(submitError);
|
||||
|
||||
@@ -3,6 +3,7 @@ import useMetadataQuery from '@/hooks/dataBrowser/useMetadataQuery';
|
||||
import useTableQuery from '@/hooks/dataBrowser/useTableQuery';
|
||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||
import { useRemoteApplicationGQLClient } from '@/hooks/useRemoteApplicationGQLClient';
|
||||
import type { DialogFormProps } from '@/types/common';
|
||||
import type {
|
||||
DatabaseAccessLevel,
|
||||
DatabaseAction,
|
||||
@@ -30,7 +31,7 @@ import { twMerge } from 'tailwind-merge';
|
||||
import RolePermissionEditorForm from './RolePermissionEditorForm';
|
||||
import RolePermissionsRow from './RolePermissionsRow';
|
||||
|
||||
export interface EditPermissionsFormProps {
|
||||
export interface EditPermissionsFormProps extends DialogFormProps {
|
||||
/**
|
||||
* Determines whether the form is disabled or not.
|
||||
*/
|
||||
@@ -54,6 +55,7 @@ export default function EditPermissionsForm({
|
||||
schema,
|
||||
table,
|
||||
onCancel,
|
||||
location,
|
||||
}: EditPermissionsFormProps) {
|
||||
const [role, setRole] = useState<string>();
|
||||
const [action, setAction] = useState<DatabaseAction>();
|
||||
@@ -181,6 +183,7 @@ export default function EditPermissionsForm({
|
||||
|
||||
return (
|
||||
<RolePermissionEditorForm
|
||||
location={location}
|
||||
resourceVersion={metadata?.resourceVersion}
|
||||
disabled={disabled}
|
||||
schema={schema}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useDialog } from '@/components/common/DialogProvider';
|
||||
import Form from '@/components/common/Form';
|
||||
import HighlightedText from '@/components/common/HighlightedText';
|
||||
import useManagePermissionMutation from '@/hooks/dataBrowser/useManagePermissionMutation';
|
||||
import type { DialogFormProps } from '@/types/common';
|
||||
import type {
|
||||
DatabaseAction,
|
||||
HasuraMetadataPermission,
|
||||
@@ -13,6 +14,7 @@ import Button from '@/ui/v2/Button';
|
||||
import Text from '@/ui/v2/Text';
|
||||
import convertToHasuraPermissions from '@/utils/dataBrowser/convertToHasuraPermissions';
|
||||
import convertToRuleGroup from '@/utils/dataBrowser/convertToRuleGroup';
|
||||
import getServerError from '@/utils/settings/getServerError';
|
||||
import { getToastStyleProps } from '@/utils/settings/settingsConstants';
|
||||
import { yupResolver } from '@hookform/resolvers/yup';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
@@ -72,7 +74,7 @@ export interface RolePermissionEditorFormValues {
|
||||
computedFields?: string[];
|
||||
}
|
||||
|
||||
export interface RolePermissionEditorFormProps {
|
||||
export interface RolePermissionEditorFormProps extends DialogFormProps {
|
||||
/**
|
||||
* Determines whether or not the form is disabled.
|
||||
*/
|
||||
@@ -169,6 +171,7 @@ export default function RolePermissionEditorForm({
|
||||
onCancel,
|
||||
permission,
|
||||
disabled,
|
||||
location,
|
||||
}: RolePermissionEditorFormProps) {
|
||||
const queryClient = useQueryClient();
|
||||
const {
|
||||
@@ -214,8 +217,8 @@ export default function RolePermissionEditorForm({
|
||||
const isDirty = Object.keys(dirtyFields).length > 0;
|
||||
|
||||
useEffect(() => {
|
||||
onDirtyStateChange(isDirty, 'drawer');
|
||||
}, [isDirty, onDirtyStateChange]);
|
||||
onDirtyStateChange(isDirty, location);
|
||||
}, [isDirty, location, onDirtyStateChange]);
|
||||
|
||||
async function handleSubmit(values: RolePermissionEditorFormValues) {
|
||||
const managePermissionPromise = managePermission({
|
||||
@@ -245,7 +248,7 @@ export default function RolePermissionEditorForm({
|
||||
: permission?.check,
|
||||
backend_only: values.backendOnly,
|
||||
computed_fields:
|
||||
permission?.computed_fields.length > 0
|
||||
permission?.computed_fields?.length > 0
|
||||
? permission?.computed_fields
|
||||
: null,
|
||||
},
|
||||
@@ -256,12 +259,12 @@ export default function RolePermissionEditorForm({
|
||||
{
|
||||
loading: 'Saving permission...',
|
||||
success: 'Permission has been saved successfully.',
|
||||
error: 'An error occurred while saving the permission.',
|
||||
error: getServerError('An error occurred while saving the permission.'),
|
||||
},
|
||||
getToastStyleProps(),
|
||||
);
|
||||
|
||||
onDirtyStateChange(false, 'drawer');
|
||||
onDirtyStateChange(false, location);
|
||||
onSubmit?.();
|
||||
}
|
||||
|
||||
@@ -270,7 +273,7 @@ export default function RolePermissionEditorForm({
|
||||
openDirtyConfirmation({
|
||||
props: {
|
||||
onPrimaryAction: () => {
|
||||
onDirtyStateChange(false, 'drawer');
|
||||
onDirtyStateChange(false, location);
|
||||
onCancel?.();
|
||||
},
|
||||
},
|
||||
@@ -295,12 +298,14 @@ export default function RolePermissionEditorForm({
|
||||
{
|
||||
loading: 'Deleting permission...',
|
||||
success: 'Permission has been deleted successfully.',
|
||||
error: 'An error occurred while deleting the permission.',
|
||||
error: getServerError(
|
||||
'An error occurred while deleting the permission.',
|
||||
),
|
||||
},
|
||||
getToastStyleProps(),
|
||||
);
|
||||
|
||||
onDirtyStateChange(false, 'drawer');
|
||||
onDirtyStateChange(false, location);
|
||||
onSubmit?.();
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ import XIcon from '@/ui/v2/icons/XIcon';
|
||||
import InputLabel from '@/ui/v2/InputLabel';
|
||||
import Option from '@/ui/v2/Option';
|
||||
import Text from '@/ui/v2/Text';
|
||||
import getPermissionVariablesArray from '@/utils/settings/getPermissionVariablesArray';
|
||||
import { useGetAppCustomClaimsQuery } from '@/utils/__generated__/graphql';
|
||||
import getAllPermissionVariables from '@/utils/settings/getAllPermissionVariables';
|
||||
import { useGetRolesPermissionsQuery } from '@/utils/__generated__/graphql';
|
||||
import { useTheme } from '@mui/material';
|
||||
import clsx from 'clsx';
|
||||
import { useFieldArray, useFormContext, useWatch } from 'react-hook-form';
|
||||
@@ -51,8 +51,8 @@ export default function ColumnPresetsSection({
|
||||
} = useTableQuery([`default.${schema}.${table}`], { schema, table });
|
||||
|
||||
const { currentApplication } = useCurrentWorkspaceAndApplication();
|
||||
const { data: customClaimsData } = useGetAppCustomClaimsQuery({
|
||||
variables: { id: currentApplication?.id },
|
||||
const { data: permissionVariablesData } = useGetRolesPermissionsQuery({
|
||||
variables: { appId: currentApplication?.id },
|
||||
skip: !currentApplication?.id,
|
||||
});
|
||||
const {
|
||||
@@ -74,8 +74,8 @@ export default function ColumnPresetsSection({
|
||||
throw tableError;
|
||||
}
|
||||
|
||||
const permissionVariableOptions = getPermissionVariablesArray(
|
||||
customClaimsData?.app?.authJwtCustomClaims,
|
||||
const permissionVariableOptions = getAllPermissionVariables(
|
||||
permissionVariablesData?.config?.auth?.session?.accessToken?.customClaims,
|
||||
).map(({ key }) => ({
|
||||
label: `X-Hasura-${key}`,
|
||||
value: `X-Hasura-${key}`,
|
||||
@@ -136,7 +136,7 @@ export default function ColumnPresetsSection({
|
||||
disableClearable={false}
|
||||
clearIcon={
|
||||
<XIcon
|
||||
className="w-4 h-4 mt-px"
|
||||
className="mt-px h-4 w-4"
|
||||
sx={{ color: theme.palette.text.primary }}
|
||||
/>
|
||||
}
|
||||
@@ -187,7 +187,7 @@ export default function ColumnPresetsSection({
|
||||
disabled={disabled}
|
||||
variant="outlined"
|
||||
color="secondary"
|
||||
className="shrink-0 grow-0 flex-[40px]"
|
||||
className="flex-[40px] shrink-0 grow-0"
|
||||
onClick={() => {
|
||||
if (fields.length === 1) {
|
||||
remove(index);
|
||||
@@ -199,7 +199,7 @@ export default function ColumnPresetsSection({
|
||||
remove(index);
|
||||
}}
|
||||
>
|
||||
<XIcon className="w-4 h-4" />
|
||||
<XIcon className="h-4 w-4" />
|
||||
</IconButton>
|
||||
</div>
|
||||
))}
|
||||
|
||||
@@ -6,6 +6,7 @@ import Input from '@/ui/v2/Input';
|
||||
import Radio from '@/ui/v2/Radio';
|
||||
import RadioGroup from '@/ui/v2/RadioGroup';
|
||||
import Text from '@/ui/v2/Text';
|
||||
import type { FocusEvent } from 'react';
|
||||
import { useState } from 'react';
|
||||
import { useFormContext } from 'react-hook-form';
|
||||
import PermissionSettingsSection from './PermissionSettingsSection';
|
||||
@@ -130,7 +131,13 @@ export default function RowPermissionsSection({
|
||||
|
||||
{action === 'select' && (
|
||||
<Input
|
||||
{...register('limit')}
|
||||
{...register('limit', {
|
||||
onBlur: (event: FocusEvent<HTMLInputElement>) => {
|
||||
if (!event.target.value) {
|
||||
setValue('limit', null);
|
||||
}
|
||||
},
|
||||
})}
|
||||
disabled={disabled}
|
||||
id="limit"
|
||||
type="number"
|
||||
|
||||
@@ -39,14 +39,17 @@ const ruleGroupSchema = Yup.object().shape({
|
||||
|
||||
const baseValidationSchema = Yup.object().shape({
|
||||
filter: ruleGroupSchema.nullable().required('Please select a filter type.'),
|
||||
columns: Yup.array().of(Yup.string()).nullable(true),
|
||||
columns: Yup.array().of(Yup.string()).nullable(),
|
||||
});
|
||||
|
||||
const selectValidationSchema = baseValidationSchema.shape({
|
||||
limit: Yup.number().min(0, 'Limit must not be negative.').nullable(true),
|
||||
allowAggregations: Yup.boolean().nullable(true),
|
||||
queryRootFields: Yup.array().of(Yup.string()).nullable(true),
|
||||
subscriptionRootFields: Yup.array().of(Yup.string()).nullable(true),
|
||||
limit: Yup.number()
|
||||
.label('Limit')
|
||||
.min(0, 'Limit must not be negative.')
|
||||
.nullable(),
|
||||
allowAggregations: Yup.boolean().nullable(),
|
||||
queryRootFields: Yup.array().of(Yup.string()).nullable(),
|
||||
subscriptionRootFields: Yup.array().of(Yup.string()).nullable(),
|
||||
});
|
||||
|
||||
const columnPresetSchema = Yup.object().shape({
|
||||
@@ -85,17 +88,17 @@ const columnPresetSchema = Yup.object().shape({
|
||||
});
|
||||
|
||||
const insertValidationSchema = baseValidationSchema.shape({
|
||||
backendOnly: Yup.boolean().nullable(true),
|
||||
columnPresets: Yup.array().of(columnPresetSchema).nullable(true),
|
||||
backendOnly: Yup.boolean().nullable(),
|
||||
columnPresets: Yup.array().of(columnPresetSchema).nullable(),
|
||||
});
|
||||
|
||||
const updateValidationSchema = baseValidationSchema.shape({
|
||||
backendOnly: Yup.boolean().nullable(true),
|
||||
columnPresets: Yup.array().of(columnPresetSchema).nullable(true),
|
||||
backendOnly: Yup.boolean().nullable(),
|
||||
columnPresets: Yup.array().of(columnPresetSchema).nullable(),
|
||||
});
|
||||
|
||||
const deleteValidationSchema = baseValidationSchema.shape({
|
||||
columnPresets: Yup.array().of(columnPresetSchema).nullable(true),
|
||||
columnPresets: Yup.array().of(columnPresetSchema).nullable(),
|
||||
});
|
||||
|
||||
const validationSchemas: Record<DatabaseAction, Yup.ObjectSchema<any>> = {
|
||||
|
||||
@@ -23,7 +23,7 @@ import { useEffect, useState } from 'react';
|
||||
import { FormProvider, useForm } from 'react-hook-form';
|
||||
|
||||
export interface EditTableFormProps
|
||||
extends Pick<BaseTableFormProps, 'onCancel'> {
|
||||
extends Pick<BaseTableFormProps, 'onCancel' | 'location'> {
|
||||
/**
|
||||
* Schema where the table is located.
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@ import Form from '@/components/common/Form';
|
||||
import type { RuleGroup } from '@/types/dataBrowser';
|
||||
import Button from '@/ui/v2/Button';
|
||||
import Text from '@/ui/v2/Text';
|
||||
import customClaimsQuery from '@/utils/msw/mocks/graphql/customClaimsQuery';
|
||||
import permissionVariablesQuery from '@/utils/msw/mocks/graphql/permissionVariablesQuery';
|
||||
import hasuraMetadataQuery from '@/utils/msw/mocks/rest/hasuraMetadataQuery';
|
||||
import tableQuery from '@/utils/msw/mocks/rest/tableQuery';
|
||||
import type { ComponentMeta, ComponentStory } from '@storybook/react';
|
||||
@@ -36,7 +36,7 @@ const defaultParameters = {
|
||||
},
|
||||
},
|
||||
msw: {
|
||||
handlers: [tableQuery, hasuraMetadataQuery, customClaimsQuery],
|
||||
handlers: [tableQuery, hasuraMetadataQuery, permissionVariablesQuery],
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -6,11 +6,12 @@ import ColumnAutocomplete from '@/components/dataBrowser/ColumnAutocomplete';
|
||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||
import type { HasuraOperator } from '@/types/dataBrowser';
|
||||
import ActivityIndicator from '@/ui/v2/ActivityIndicator';
|
||||
import type { AutocompleteOption } from '@/ui/v2/Autocomplete';
|
||||
import type { InputProps } from '@/ui/v2/Input';
|
||||
import { inputClasses } from '@/ui/v2/Input';
|
||||
import Option from '@/ui/v2/Option';
|
||||
import getPermissionVariablesArray from '@/utils/settings/getPermissionVariablesArray';
|
||||
import { useGetAppCustomClaimsQuery } from '@/utils/__generated__/graphql';
|
||||
import getAllPermissionVariables from '@/utils/settings/getAllPermissionVariables';
|
||||
import { useGetRolesPermissionsQuery } from '@/utils/__generated__/graphql';
|
||||
import { useController, useFormContext, useWatch } from 'react-hook-form';
|
||||
import useRuleGroupEditor from './useRuleGroupEditor';
|
||||
|
||||
@@ -116,8 +117,8 @@ export default function RuleValueInput({
|
||||
data,
|
||||
loading,
|
||||
error: customClaimsError,
|
||||
} = useGetAppCustomClaimsQuery({
|
||||
variables: { id: currentApplication?.id },
|
||||
} = useGetRolesPermissionsQuery({
|
||||
variables: { appId: currentApplication?.id },
|
||||
skip: !isHasuraInput || !currentApplication?.id,
|
||||
});
|
||||
|
||||
@@ -199,8 +200,8 @@ export default function RuleValueInput({
|
||||
);
|
||||
}
|
||||
|
||||
const availableHasuraPermissionVariables = getPermissionVariablesArray(
|
||||
data?.app?.authJwtCustomClaims,
|
||||
const availableHasuraPermissionVariables = getAllPermissionVariables(
|
||||
data?.config?.auth?.session?.accessToken?.customClaims,
|
||||
).map(({ key }) => ({
|
||||
value: `X-Hasura-${key}`,
|
||||
label: `X-Hasura-${key}`,
|
||||
@@ -211,12 +212,13 @@ export default function RuleValueInput({
|
||||
<ControlledAutocomplete
|
||||
disabled={disabled}
|
||||
freeSolo={!isHasuraInput}
|
||||
autoSelect={!isHasuraInput}
|
||||
autoHighlight={isHasuraInput}
|
||||
open
|
||||
isOptionEqualToValue={(option, value) => {
|
||||
if (typeof value === 'string') {
|
||||
return option.value.toLowerCase() === (value as string).toLowerCase();
|
||||
isOptionEqualToValue={(
|
||||
option,
|
||||
value: string | number | AutocompleteOption<string>,
|
||||
) => {
|
||||
if (typeof value !== 'object') {
|
||||
return option.value.toLowerCase() === value?.toString().toLowerCase();
|
||||
}
|
||||
|
||||
return option.value.toLowerCase() === value.value.toLowerCase();
|
||||
|
||||
@@ -10,6 +10,7 @@ import ArrowCounterclockwiseIcon from '@/ui/v2/icons/ArrowCounterclockwiseIcon';
|
||||
import ChevronRightIcon from '@/ui/v2/icons/ChevronRightIcon';
|
||||
import { ListItem } from '@/ui/v2/ListItem';
|
||||
import Tooltip from '@/ui/v2/Tooltip';
|
||||
import getServerError from '@/utils/settings/getServerError';
|
||||
import { getToastStyleProps } from '@/utils/settings/settingsConstants';
|
||||
import type { DeploymentRowFragment } from '@/utils/__generated__/graphql';
|
||||
import { useInsertDeploymentMutation } from '@/utils/__generated__/graphql';
|
||||
@@ -58,12 +59,12 @@ export default function DeploymentListItem({
|
||||
return (
|
||||
<ListItem.Root>
|
||||
<ListItem.Button
|
||||
className="grid grid-flow-col items-center justify-between gap-2 rounded-none px-2 py-2"
|
||||
className="grid grid-flow-col items-center justify-between gap-2 rounded-none p-2"
|
||||
component={NavLink}
|
||||
href={`/${currentWorkspace.slug}/${currentApplication.slug}/deployments/${deployment.id}`}
|
||||
aria-label={commitMessage || 'No commit message'}
|
||||
>
|
||||
<div className="flex cursor-pointer flex-row items-center justify-center space-x-2 self-center">
|
||||
<div className="grid grid-flow-col items-center justify-center gap-2 self-center">
|
||||
<ListItem.Avatar>
|
||||
<Avatar
|
||||
name={deployment.commitUserName}
|
||||
@@ -84,7 +85,7 @@ export default function DeploymentListItem({
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-flow-col items-center gap-2">
|
||||
<div className="grid grid-flow-col items-center justify-end gap-2">
|
||||
{showRedeploy && (
|
||||
<Tooltip
|
||||
title={
|
||||
@@ -122,7 +123,9 @@ export default function DeploymentListItem({
|
||||
{
|
||||
loading: 'Scheduling deployment...',
|
||||
success: 'Deployment has been scheduled successfully.',
|
||||
error: 'An error occurred when scheduling deployment.',
|
||||
error: getServerError(
|
||||
'An error occurred when scheduling deployment.',
|
||||
),
|
||||
},
|
||||
getToastStyleProps(),
|
||||
);
|
||||
@@ -139,16 +142,16 @@ export default function DeploymentListItem({
|
||||
)}
|
||||
|
||||
{isLive && (
|
||||
<div className="flex w-12 justify-end">
|
||||
<div className="hidden w-12 justify-end sm:flex">
|
||||
<Chip size="small" color="success" label="Live" />
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="w-16 text-right font-mono text-sm- font-medium">
|
||||
<div className="hidden w-16 text-right font-mono text-sm- font-medium sm:block">
|
||||
{deployment.commitSHA.substring(0, 7)}
|
||||
</div>
|
||||
|
||||
<div className="w-[80px] text-right font-mono text-sm- font-medium">
|
||||
<div className="text-right font-mono text-sm- font-medium sm:w-20">
|
||||
<AppDeploymentDuration
|
||||
startedAt={deployment.deploymentStartedAt}
|
||||
endedAt={deployment.deploymentEndedAt}
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
import type { Deployment } from '@/types/application';
|
||||
import { render, screen } from '@/utils/testUtils';
|
||||
import { test, vi } from 'vitest';
|
||||
import DeploymentStatusMessage from './DeploymentStatusMessage';
|
||||
|
||||
const defaultDeployment: Deployment = {
|
||||
id: 'de305d54-75b4-431b-adb2-eb6b9e546013',
|
||||
commitUserName: 'john.doe',
|
||||
commitUserAvatarUrl: 'https://example.com/avatar.png',
|
||||
deploymentStartedAt: '2023-02-24T12:00:00.000Z',
|
||||
deploymentEndedAt: null,
|
||||
deploymentStatus: 'SCHEDULED',
|
||||
commitSHA: '1234567890',
|
||||
commitMessage: 'Update README.md',
|
||||
};
|
||||
|
||||
beforeAll(() => {
|
||||
vi.useFakeTimers();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
test('should render the avatar of the user who deployed the application', () => {
|
||||
render(
|
||||
<DeploymentStatusMessage
|
||||
deployment={defaultDeployment}
|
||||
appCreatedAt="2023-02-24"
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(
|
||||
screen.getByRole('img', {
|
||||
name: `Avatar of ${defaultDeployment.commitUserName}`,
|
||||
}),
|
||||
).toHaveAttribute(
|
||||
'style',
|
||||
`background-image: url(${defaultDeployment.commitUserAvatarUrl});`,
|
||||
);
|
||||
});
|
||||
|
||||
test('should render "updated just now" when the deployment is in progress and has not ended', () => {
|
||||
render(
|
||||
<DeploymentStatusMessage
|
||||
deployment={defaultDeployment}
|
||||
appCreatedAt="2023-02-24"
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(screen.getByText(/updated just now/i)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('should render "updated just now" when the deployment\'s status is DEPLOYED, but it doesn\'t have an end date for some reason', () => {
|
||||
render(
|
||||
<DeploymentStatusMessage
|
||||
deployment={{
|
||||
...defaultDeployment,
|
||||
deploymentStatus: 'DEPLOYED',
|
||||
deploymentEndedAt: null,
|
||||
}}
|
||||
appCreatedAt="2023-02-24"
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(screen.getByText(/updated just now/i)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('should render "deployed 1 day ago" when the deployment has ended', () => {
|
||||
vi.setSystemTime(new Date('2023-02-25T12:25:00.000Z'));
|
||||
|
||||
render(
|
||||
<DeploymentStatusMessage
|
||||
deployment={{
|
||||
...defaultDeployment,
|
||||
deploymentStatus: 'DEPLOYED',
|
||||
deploymentEndedAt: '2023-02-24T12:15:00.000Z',
|
||||
}}
|
||||
appCreatedAt="2023-02-24"
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(screen.getByText(/deployed 1 day ago/i)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('should render "created 1 day ago" if the application does not have a deployment', () => {
|
||||
vi.setSystemTime(new Date('2023-02-25T12:25:00.000Z'));
|
||||
|
||||
render(
|
||||
<DeploymentStatusMessage deployment={null} appCreatedAt="2023-02-24" />,
|
||||
);
|
||||
|
||||
expect(screen.getByText(/created 1 day ago/i)).toBeInTheDocument();
|
||||
});
|
||||
@@ -0,0 +1,73 @@
|
||||
import type { Deployment } from '@/types/application';
|
||||
import { Avatar } from '@/ui/Avatar';
|
||||
import Text from '@/ui/v2/Text';
|
||||
import formatDistance from 'date-fns/formatDistance';
|
||||
|
||||
export interface DeploymentStatusMessageProps {
|
||||
/**
|
||||
* The deployment to render the status message for.
|
||||
*/
|
||||
deployment: Partial<Deployment>;
|
||||
/**
|
||||
* The date the application was created.
|
||||
*/
|
||||
appCreatedAt: string;
|
||||
}
|
||||
|
||||
export default function DeploymentStatusMessage({
|
||||
deployment,
|
||||
appCreatedAt,
|
||||
}: DeploymentStatusMessageProps) {
|
||||
const isDeployingToProduction = [
|
||||
'SCHEDULED',
|
||||
'PENDING',
|
||||
'DEPLOYING',
|
||||
].includes(deployment?.deploymentStatus);
|
||||
|
||||
if (
|
||||
isDeployingToProduction ||
|
||||
(deployment && !deployment.deploymentEndedAt)
|
||||
) {
|
||||
return (
|
||||
<span className="flex flex-row">
|
||||
<Avatar
|
||||
component="span"
|
||||
name={deployment.commitUserName}
|
||||
avatarUrl={deployment.commitUserAvatarUrl}
|
||||
className="mr-1 h-4 w-4 self-center"
|
||||
/>
|
||||
<Text component="span" className="self-center text-sm">
|
||||
{deployment.commitUserName} updated just now
|
||||
</Text>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
if (!isDeployingToProduction && deployment?.deploymentEndedAt) {
|
||||
return (
|
||||
<span className="grid grid-flow-col">
|
||||
<Avatar
|
||||
component="span"
|
||||
name={deployment.commitUserName}
|
||||
avatarUrl={deployment.commitUserAvatarUrl}
|
||||
className="mr-1 h-4 w-4 self-center"
|
||||
/>
|
||||
<Text component="span" className="self-center truncate text-sm">
|
||||
{deployment.commitUserName} deployed{' '}
|
||||
{formatDistance(new Date(deployment.deploymentEndedAt), new Date(), {
|
||||
addSuffix: true,
|
||||
})}
|
||||
</Text>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Text component="span" className="text-sm">
|
||||
created{' '}
|
||||
{formatDistance(new Date(appCreatedAt), new Date(), {
|
||||
addSuffix: true,
|
||||
})}
|
||||
</Text>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './DeploymentStatusMessage';
|
||||
export { default } from './DeploymentStatusMessage';
|
||||
@@ -12,6 +12,7 @@ import useBuckets from '@/hooks/useBuckets';
|
||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||
import useFiles from '@/hooks/useFiles';
|
||||
import useFilesAggregate from '@/hooks/useFilesAggregate';
|
||||
import { getHasuraAdminSecret } from '@/utils/env';
|
||||
import { showLoadingToast, triggerToast } from '@/utils/toast';
|
||||
import type { Files } from '@/utils/__generated__/graphql';
|
||||
import { Order_By as OrderBy } from '@/utils/__generated__/graphql';
|
||||
@@ -261,8 +262,8 @@ export default function FilesDataGrid(props: FilesDataGridProps) {
|
||||
const { fileMetadata, error: fileError } = await appClient.storage
|
||||
.setAdminSecret(
|
||||
process.env.NEXT_PUBLIC_ENV === 'dev'
|
||||
? 'nhost-admin-secret'
|
||||
: currentApplication.hasuraGraphqlAdminSecret,
|
||||
? getHasuraAdminSecret()
|
||||
: currentApplication.config?.hasura.adminSecret,
|
||||
)
|
||||
.upload({
|
||||
file,
|
||||
@@ -277,7 +278,7 @@ export default function FilesDataGrid(props: FilesDataGridProps) {
|
||||
}
|
||||
|
||||
if (fileError) {
|
||||
throw fileError;
|
||||
throw new Error(fileError.message);
|
||||
}
|
||||
|
||||
triggerToast(`File has been uploaded successfully (${fileMetadata?.id})`);
|
||||
|
||||
@@ -12,6 +12,7 @@ import Button from '@/ui/v2/Button';
|
||||
import Chip from '@/ui/v2/Chip';
|
||||
import type { InputProps } from '@/ui/v2/Input';
|
||||
import Input from '@/ui/v2/Input';
|
||||
import { getHasuraAdminSecret } from '@/utils/env';
|
||||
import { triggerToast } from '@/utils/toast';
|
||||
import type { Files } from '@/utils/__generated__/graphql';
|
||||
import type { PropsWithoutRef } from 'react';
|
||||
@@ -71,8 +72,8 @@ export default function FilesDataGridControls({
|
||||
try {
|
||||
const storageWithAdminSecret = appClient.storage.setAdminSecret(
|
||||
process.env.NEXT_PUBLIC_ENV === 'dev'
|
||||
? 'nhost-admin-secret'
|
||||
: currentApplication.hasuraGraphqlAdminSecret,
|
||||
? getHasuraAdminSecret()
|
||||
: currentApplication.config?.hasura.adminSecret,
|
||||
);
|
||||
|
||||
// note: this is not an optimal solution, but we don't have a better way
|
||||
@@ -120,7 +121,7 @@ export default function FilesDataGridControls({
|
||||
{...props}
|
||||
>
|
||||
{numberOfSelectedFiles > 0 ? (
|
||||
<div className="mx-auto h-[40px] grid grid-flow-col justify-start items-center gap-2">
|
||||
<div className="mx-auto grid h-[40px] grid-flow-col items-center justify-start gap-2">
|
||||
<Chip
|
||||
color="info"
|
||||
size="small"
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import { useDialog } from '@/components/common/DialogProvider';
|
||||
import Form from '@/components/common/Form';
|
||||
import type { DialogFormProps } from '@/types/common';
|
||||
import Button from '@/ui/v2/Button';
|
||||
import Input from '@/ui/v2/Input';
|
||||
import { slugifyString } from '@/utils/helpers';
|
||||
import getServerError from '@/utils/settings/getServerError';
|
||||
import { getToastStyleProps } from '@/utils/settings/settingsConstants';
|
||||
import {
|
||||
refetchGetOneUserQuery,
|
||||
@@ -11,11 +14,12 @@ import {
|
||||
import { yupResolver } from '@hookform/resolvers/yup';
|
||||
import { useUserData } from '@nhost/nextjs';
|
||||
import { useRouter } from 'next/router';
|
||||
import { useEffect } from 'react';
|
||||
import { FormProvider, useForm } from 'react-hook-form';
|
||||
import { toast } from 'react-hot-toast';
|
||||
import * as Yup from 'yup';
|
||||
|
||||
export interface EditWorkspaceNameFormProps {
|
||||
export interface EditWorkspaceNameFormProps extends DialogFormProps {
|
||||
/**
|
||||
* The current workspace name if this is an edit operation.
|
||||
*/
|
||||
@@ -44,14 +48,7 @@ export interface EditWorkspaceNameFormProps {
|
||||
onCancel?: VoidFunction;
|
||||
}
|
||||
|
||||
export interface EditWorkspaceNameFormValues {
|
||||
/**
|
||||
* New workspace name.
|
||||
*/
|
||||
newWorkspaceName: string;
|
||||
}
|
||||
|
||||
const validationSchema = Yup.object().shape({
|
||||
const validationSchema = Yup.object({
|
||||
newWorkspaceName: Yup.string()
|
||||
.required('Workspace name is required.')
|
||||
.min(4, 'The new Workspace name must be at least 4 characters.')
|
||||
@@ -71,14 +68,20 @@ const validationSchema = Yup.object().shape({
|
||||
),
|
||||
});
|
||||
|
||||
export default function EditWorkspaceName({
|
||||
export type EditWorkspaceNameFormValues = Yup.InferType<
|
||||
typeof validationSchema
|
||||
>;
|
||||
|
||||
export default function EditWorkspaceNameForm({
|
||||
disabled,
|
||||
onSubmit,
|
||||
onCancel,
|
||||
currentWorkspaceName,
|
||||
currentWorkspaceId,
|
||||
submitButtonText = 'Create',
|
||||
location,
|
||||
}: EditWorkspaceNameFormProps) {
|
||||
const { onDirtyStateChange } = useDialog();
|
||||
const currentUser = useUserData();
|
||||
const [insertWorkspace, { client }] = useInsertWorkspaceMutation();
|
||||
const [updateWorkspaceName] = useUpdateWorkspaceMutation({
|
||||
@@ -105,6 +108,10 @@ export default function EditWorkspaceName({
|
||||
} = form;
|
||||
const isDirty = Object.keys(dirtyFields).length > 0;
|
||||
|
||||
useEffect(() => {
|
||||
onDirtyStateChange(isDirty, location);
|
||||
}, [isDirty, location, onDirtyStateChange]);
|
||||
|
||||
async function handleSubmit({
|
||||
newWorkspaceName,
|
||||
}: EditWorkspaceNameFormValues) {
|
||||
@@ -112,6 +119,8 @@ export default function EditWorkspaceName({
|
||||
|
||||
try {
|
||||
if (currentWorkspaceId) {
|
||||
onDirtyStateChange(false, location);
|
||||
|
||||
// In this bit of code we spread the props of the current path (e.g. /workspace/...) and add one key-value pair: `mutating: true`.
|
||||
// We want to indicate that the currently we're in the process of running a mutation state that will affect the routing behaviour of the website
|
||||
// i.e. redirecting to 404 if there's no workspace/project with that slug.
|
||||
@@ -133,7 +142,9 @@ export default function EditWorkspaceName({
|
||||
{
|
||||
loading: 'Updating workspace name...',
|
||||
success: 'Workspace name has been updated successfully.',
|
||||
error: 'An error occurred while updating the workspace name.',
|
||||
error: getServerError(
|
||||
'An error occurred while updating the workspace name.',
|
||||
),
|
||||
},
|
||||
getToastStyleProps(),
|
||||
);
|
||||
@@ -160,7 +171,9 @@ export default function EditWorkspaceName({
|
||||
{
|
||||
loading: 'Creating new workspace...',
|
||||
success: 'The new workspace has been created successfully.',
|
||||
error: 'An error occurred while creating the new workspace.',
|
||||
error: getServerError(
|
||||
'An error occurred while creating the new workspace.',
|
||||
),
|
||||
},
|
||||
getToastStyleProps(),
|
||||
);
|
||||
@@ -186,6 +199,9 @@ export default function EditWorkspaceName({
|
||||
include: ['getOneUser'],
|
||||
});
|
||||
|
||||
// The form has been submitted, it's not dirty anymore
|
||||
onDirtyStateChange(false, location);
|
||||
|
||||
await router.push(slug);
|
||||
onSubmit?.();
|
||||
}
|
||||
@@ -194,9 +210,9 @@ export default function EditWorkspaceName({
|
||||
<FormProvider {...form}>
|
||||
<Form
|
||||
onSubmit={handleSubmit}
|
||||
className="flex flex-col content-between flex-auto pt-2 pb-6 overflow-hidden"
|
||||
className="flex flex-auto flex-col content-between overflow-hidden pt-2 pb-6"
|
||||
>
|
||||
<div className="flex-auto px-6 overflow-y-auto">
|
||||
<div className="flex-auto overflow-y-auto px-6">
|
||||
<Input
|
||||
{...register('newWorkspaceName')}
|
||||
error={Boolean(errors.newWorkspaceName?.message)}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { useUI } from '@/context/UIContext';
|
||||
import Button from '@/ui/v2/Button';
|
||||
import PlusCircleIcon from '@/ui/v2/icons/PlusCircleIcon';
|
||||
import SearchIcon from '@/ui/v2/icons/SearchIcon';
|
||||
@@ -11,6 +12,8 @@ interface IndexHeaderAppsProps {
|
||||
}
|
||||
|
||||
export function IndexHeaderApps({ query, setQuery }: IndexHeaderAppsProps) {
|
||||
const { maintenanceActive } = useUI();
|
||||
|
||||
return (
|
||||
<div className="mx-auto mb-6 grid w-full grid-flow-col place-content-between items-center py-2">
|
||||
<Text variant="h2" component="h1" className="hidden md:block">
|
||||
@@ -36,6 +39,7 @@ export function IndexHeaderApps({ query, setQuery }: IndexHeaderAppsProps) {
|
||||
variant="outlined"
|
||||
color="secondary"
|
||||
startIcon={<PlusCircleIcon />}
|
||||
disabled={maintenanceActive}
|
||||
>
|
||||
New Project
|
||||
</Button>
|
||||
|
||||
@@ -58,16 +58,19 @@ export function InviteAnnounce() {
|
||||
error: null,
|
||||
loading: true,
|
||||
});
|
||||
const res = await nhost.functions.call('/accept-workspace-invite', {
|
||||
workspaceMemberInviteId: invite.id,
|
||||
isAccepted: true,
|
||||
});
|
||||
const { res, error: acceptError } = await nhost.functions.call(
|
||||
'/accept-workspace-invite',
|
||||
{
|
||||
workspaceMemberInviteId: invite.id,
|
||||
isAccepted: true,
|
||||
},
|
||||
);
|
||||
|
||||
if (res?.res?.status !== 200) {
|
||||
if (res?.status !== 200) {
|
||||
triggerToast('An error occurred when trying to accept the invitation.');
|
||||
|
||||
return setSubmitState({
|
||||
error: res.error,
|
||||
error: new Error(acceptError.message),
|
||||
loading: false,
|
||||
});
|
||||
}
|
||||
@@ -90,21 +93,20 @@ export function InviteAnnounce() {
|
||||
error: null,
|
||||
});
|
||||
|
||||
const res = await nhost.functions.call(
|
||||
const { error: ignoreError } = await nhost.functions.call(
|
||||
'/accept-workspace-invite',
|
||||
{
|
||||
workspaceMemberInviteId: inviteId,
|
||||
isAccepted: false,
|
||||
},
|
||||
{ useAxios: false },
|
||||
);
|
||||
|
||||
if (res?.error) {
|
||||
if (ignoreError) {
|
||||
triggerToast('An error occurred when trying to ignore the invitation.');
|
||||
|
||||
setIgnoreState({
|
||||
loading: false,
|
||||
error: new Error(res.error.message),
|
||||
error: new Error(ignoreError.message),
|
||||
});
|
||||
|
||||
return;
|
||||
|
||||
@@ -7,7 +7,7 @@ import Link from 'next/link';
|
||||
|
||||
export default function Sidebar() {
|
||||
return (
|
||||
<div className="grid grid-flow-row gap-8 mt-2 ml-10 w-full md:grid md:w-workspaceSidebar content-start">
|
||||
<div className="mt-2 grid w-full grid-flow-row content-start gap-8 md:ml-10 md:grid md:w-workspaceSidebar">
|
||||
<WorkspaceSection />
|
||||
<Resources />
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { UserDataProvider } from '@/context/workspace1-context';
|
||||
import type { Application } from '@/types/application';
|
||||
import type { Project } from '@/types/application';
|
||||
import { ApplicationStatus } from '@/types/application';
|
||||
import type { Workspace } from '@/types/workspace';
|
||||
import nhostGraphQLLink from '@/utils/msw/mocks/graphql/nhostGraphQLLink';
|
||||
import { render, screen, waitForElementToBeRemoved } from '@/utils/testUtils';
|
||||
import { graphql, rest } from 'msw';
|
||||
import { rest } from 'msw';
|
||||
import { setupServer } from 'msw/node';
|
||||
import { afterAll, beforeAll, vi } from 'vitest';
|
||||
import OverviewDeployments from '.';
|
||||
@@ -36,12 +37,11 @@ vi.mock('next/router', () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
const mockApplication: Application = {
|
||||
const mockApplication: Project = {
|
||||
id: '1',
|
||||
name: 'Test Application',
|
||||
slug: 'test-application',
|
||||
appStates: [],
|
||||
hasuraGraphqlAdminSecret: 'nhost-admin-secret',
|
||||
subdomain: '',
|
||||
isProvisioned: true,
|
||||
region: {
|
||||
@@ -56,6 +56,14 @@ const mockApplication: Application = {
|
||||
featureFlags: [],
|
||||
providersUpdated: true,
|
||||
githubRepository: { fullName: 'test/git-project' },
|
||||
repositoryProductionBranch: null,
|
||||
nhostBaseFolder: null,
|
||||
plan: null,
|
||||
config: {
|
||||
hasura: {
|
||||
adminSecret: 'nhost-admin-secret',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const mockWorkspace: Workspace = {
|
||||
@@ -66,13 +74,11 @@ const mockWorkspace: Workspace = {
|
||||
applications: [mockApplication],
|
||||
};
|
||||
|
||||
const mockGraphqlLink = graphql.link('http://localhost:1337/v1/graphql');
|
||||
|
||||
const server = setupServer(
|
||||
rest.get('http://localhost:1337/v1/graphql', (req, res, ctx) =>
|
||||
rest.get('https://local.graphql.nhost.run/v1', (_req, res, ctx) =>
|
||||
res(ctx.status(200)),
|
||||
),
|
||||
mockGraphqlLink.operation(async (req, res, ctx) =>
|
||||
nhostGraphQLLink.operation(async (_req, res, ctx) =>
|
||||
res(
|
||||
ctx.data({
|
||||
deployments: [],
|
||||
@@ -136,7 +142,7 @@ test('should render an empty state when GitHub is connected, but there are no de
|
||||
|
||||
test('should render a list of deployments', async () => {
|
||||
server.use(
|
||||
mockGraphqlLink.operation(async (req, res, ctx) => {
|
||||
nhostGraphQLLink.operation(async (req, res, ctx) => {
|
||||
const requestPayload = await req.json();
|
||||
|
||||
if (requestPayload.operationName === 'ScheduledOrPendingDeploymentsSub') {
|
||||
@@ -186,7 +192,7 @@ test('should render a list of deployments', async () => {
|
||||
|
||||
test('should disable redeployments if a deployment is already in progress', async () => {
|
||||
server.use(
|
||||
mockGraphqlLink.operation(async (req, res, ctx) => {
|
||||
nhostGraphQLLink.operation(async (req, res, ctx) => {
|
||||
const requestPayload = await req.json();
|
||||
|
||||
if (requestPayload.operationName === 'ScheduledOrPendingDeploymentsSub') {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import useGitHubModal from '@/components/applications/github/useGitHubModal';
|
||||
import DeploymentListItem from '@/components/deployments/DeploymentListItem';
|
||||
import GithubIcon from '@/components/icons/GithubIcon';
|
||||
import { useUI } from '@/context/UIContext';
|
||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||
import ActivityIndicator from '@/ui/v2/ActivityIndicator';
|
||||
import Box from '@/ui/v2/Box';
|
||||
@@ -75,7 +76,7 @@ function OverviewDeploymentList() {
|
||||
|
||||
if (!deployments?.length) {
|
||||
return (
|
||||
<Box className="grid grid-flow-row items-center justify-items-center gap-5 overflow-hidden rounded-lg border-1 py-12 px-48 shadow-sm">
|
||||
<Box className="grid grid-flow-row items-center justify-items-center gap-5 overflow-hidden rounded-lg border-1 py-12 px-4 shadow-sm">
|
||||
<RocketIcon
|
||||
strokeWidth={1}
|
||||
className="h-10 w-10"
|
||||
@@ -85,7 +86,7 @@ function OverviewDeploymentList() {
|
||||
<Text className="text-center font-medium" variant="h3">
|
||||
No Deployments
|
||||
</Text>
|
||||
<Text variant="subtitle1" className="text-center">
|
||||
<Text variant="subtitle1" className="max-w-md text-center">
|
||||
We'll deploy changes automatically when you push to the
|
||||
deployment branch in your connected GitHub repository
|
||||
</Text>
|
||||
@@ -146,6 +147,7 @@ function OverviewDeploymentList() {
|
||||
export default function OverviewDeployments() {
|
||||
const { currentApplication } = useCurrentWorkspaceAndApplication();
|
||||
const { openGitHubModal } = useGitHubModal();
|
||||
const { maintenanceActive } = useUI();
|
||||
|
||||
const { githubRepository } = currentApplication || {};
|
||||
|
||||
@@ -164,14 +166,14 @@ export default function OverviewDeployments() {
|
||||
<div className="flex flex-col">
|
||||
<OverviewDeploymentsTopBar />
|
||||
|
||||
<Box className="grid grid-flow-row items-center justify-items-center gap-5 rounded-lg border-1 py-12 px-48 shadow-sm">
|
||||
<Box className="grid grid-flow-row items-center justify-items-center gap-5 rounded-lg border-1 py-12 px-4 shadow-sm">
|
||||
<RocketIcon strokeWidth={1} className="h-10 w-10" />
|
||||
|
||||
<div className="grid grid-flow-row gap-1">
|
||||
<Text className="text-center font-medium" variant="h3">
|
||||
No Deployments
|
||||
</Text>
|
||||
<Text variant="subtitle1" className="text-center">
|
||||
<Text variant="subtitle1" className="max-w-sm text-center">
|
||||
Connect your project with a GitHub repository to create your first
|
||||
deployment
|
||||
</Text>
|
||||
@@ -183,6 +185,7 @@ export default function OverviewDeployments() {
|
||||
color="primary"
|
||||
className="w-full"
|
||||
onClick={openGitHubModal}
|
||||
disabled={maintenanceActive}
|
||||
>
|
||||
<GithubIcon className="mr-1.5 h-4 w-4 self-center" />
|
||||
Connect to GitHub
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import GithubIcon from '@/components/icons/GithubIcon';
|
||||
import { useUI } from '@/context/UIContext';
|
||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||
import Box from '@/ui/v2/Box';
|
||||
import Button from '@/ui/v2/Button';
|
||||
@@ -8,6 +9,7 @@ import NavLink from 'next/link';
|
||||
export default function OverviewRepository() {
|
||||
const { currentWorkspace, currentApplication } =
|
||||
useCurrentWorkspaceAndApplication();
|
||||
const { maintenanceActive } = useUI();
|
||||
|
||||
return (
|
||||
<div>
|
||||
@@ -28,6 +30,7 @@ export default function OverviewRepository() {
|
||||
color="secondary"
|
||||
className="w-full border-1 hover:border-1"
|
||||
startIcon={<GithubIcon />}
|
||||
disabled={maintenanceActive}
|
||||
>
|
||||
Connect to GitHub
|
||||
</Button>
|
||||
@@ -39,7 +42,7 @@ export default function OverviewRepository() {
|
||||
sx={{ backgroundColor: 'grey.200' }}
|
||||
>
|
||||
<Box
|
||||
className="grid grid-flow-col gap-1.5 ml-2"
|
||||
className="ml-2 grid grid-flow-col gap-1.5"
|
||||
sx={{ backgroundColor: 'transparent' }}
|
||||
>
|
||||
<GithubIcon className="h-4 w-4 self-center" />
|
||||
@@ -52,7 +55,11 @@ export default function OverviewRepository() {
|
||||
href={`/${currentWorkspace.slug}/${currentApplication.slug}/settings/git`}
|
||||
passHref
|
||||
>
|
||||
<Button variant="borderless" size="small">
|
||||
<Button
|
||||
variant="borderless"
|
||||
size="small"
|
||||
disabled={maintenanceActive}
|
||||
>
|
||||
Edit
|
||||
</Button>
|
||||
</NavLink>
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { ChangePlanModal } from '@/components/applications/ChangePlanModal';
|
||||
|
||||
import { useDialog } from '@/components/common/DialogProvider';
|
||||
import { useUI } from '@/context/UIContext';
|
||||
import useIsPlatform from '@/hooks/common/useIsPlatform';
|
||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||
import Box from '@/ui/v2/Box';
|
||||
import Button from '@/ui/v2/Button';
|
||||
import Chip from '@/ui/v2/Chip';
|
||||
import CogIcon from '@/ui/v2/icons/CogIcon';
|
||||
@@ -16,6 +17,7 @@ export default function OverviewTopBar() {
|
||||
useCurrentWorkspaceAndApplication();
|
||||
const isPro = !currentApplication?.plan?.isFree;
|
||||
const { openAlertDialog } = useDialog();
|
||||
const { maintenanceActive } = useUI();
|
||||
|
||||
if (!isPlatform) {
|
||||
return (
|
||||
@@ -41,9 +43,9 @@ export default function OverviewTopBar() {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex flex-row place-content-between items-center py-5">
|
||||
<div className="flex flex-row items-center space-x-2">
|
||||
<div className="grid grid-flow-col items-center gap-2">
|
||||
<div className="grid items-center gap-4 pb-5 md:grid-flow-col md:place-content-between md:py-5">
|
||||
<div className="grid items-center gap-2 md:grid-flow-col">
|
||||
<div className="grid grid-flow-col items-center justify-start gap-2">
|
||||
<div className="h-10 w-10 overflow-hidden rounded-lg">
|
||||
<Image
|
||||
src="/logos/new.svg"
|
||||
@@ -58,43 +60,44 @@ export default function OverviewTopBar() {
|
||||
</Text>
|
||||
</div>
|
||||
|
||||
{isPro ? (
|
||||
<Chip
|
||||
className="self-center font-medium"
|
||||
size="small"
|
||||
label="Pro Plan"
|
||||
color="primary"
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
<Box className="grid grid-flow-col items-center justify-start gap-2">
|
||||
{isPro ? (
|
||||
<Chip
|
||||
className="self-center font-medium"
|
||||
size="small"
|
||||
label="Free Plan"
|
||||
color="default"
|
||||
variant="filled"
|
||||
label="Pro Plan"
|
||||
color="primary"
|
||||
/>
|
||||
<Button
|
||||
variant="borderless"
|
||||
className="mr-2"
|
||||
onClick={() => {
|
||||
openAlertDialog({
|
||||
title: 'Upgrade your plan.',
|
||||
payload: <ChangePlanModal />,
|
||||
props: {
|
||||
PaperProps: { className: 'p-0' },
|
||||
hidePrimaryAction: true,
|
||||
hideSecondaryAction: true,
|
||||
hideTitle: true,
|
||||
maxWidth: 'lg',
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
Upgrade
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
) : (
|
||||
<>
|
||||
<Chip
|
||||
className="self-center font-medium"
|
||||
size="small"
|
||||
label="Free Plan"
|
||||
color="default"
|
||||
variant="filled"
|
||||
/>
|
||||
<Button
|
||||
variant="borderless"
|
||||
className="mr-2"
|
||||
onClick={() => {
|
||||
openAlertDialog({
|
||||
title: 'Upgrade your plan.',
|
||||
payload: <ChangePlanModal />,
|
||||
props: {
|
||||
PaperProps: { className: 'p-0 max-w-xl w-full' },
|
||||
hidePrimaryAction: true,
|
||||
hideSecondaryAction: true,
|
||||
hideTitle: true,
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
Upgrade
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</Box>
|
||||
</div>
|
||||
<Link
|
||||
href={`/${currentWorkspace.slug}/${currentApplication.slug}/settings/general`}
|
||||
@@ -104,6 +107,7 @@ export default function OverviewTopBar() {
|
||||
endIcon={<CogIcon className="h-4 w-4" />}
|
||||
variant="outlined"
|
||||
color="secondary"
|
||||
disabled={maintenanceActive}
|
||||
>
|
||||
Settings
|
||||
</Button>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user