Compare commits

...

4 Commits

Author SHA1 Message Date
github-actions[bot]
7b25c37c26 chore: update versions (#2569)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @nhost/dashboard@1.8.2

### Patch Changes

- 6df4f02: fix: use custom error toast and show correct message when
sending an invite

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-02-29 13:10:09 +01:00
Hassan Ben Jobrane
6df4f02e95 fix(dashboard): show correct message when sending invite fails (#2567) 2024-02-29 12:52:25 +01:00
github-actions[bot]
aaae98f019 chore: update versions (#2559)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @nhost/docs@2.6.0

### Minor Changes

-   dc23dc0: fix: docs run references

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-02-25 23:02:36 -01:00
Nuno Pato
dc23dc0f49 fix: docs run references (#2558) 2024-02-25 22:47:38 -01:00
11 changed files with 65 additions and 47 deletions

View File

@@ -1,5 +1,11 @@
# @nhost/dashboard
## 1.8.2
### Patch Changes
- 6df4f02: fix: use custom error toast and show correct message when sending an invite
## 1.8.1
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/dashboard",
"version": "1.8.1",
"version": "1.8.2",
"private": true,
"scripts": {
"preinstall": "npx only-allow pnpm",

View File

@@ -5,7 +5,7 @@ import { XIcon } from '@/components/ui/v2/icons/XIcon';
import { useCurrentWorkspaceAndProject } from '@/features/projects/common/hooks/useCurrentWorkspaceAndProject';
import { getToastBackgroundColor } from '@/utils/constants/settings';
import { copy } from '@/utils/copy';
import { ApolloError } from '@apollo/client';
import type { ApolloError } from '@apollo/client';
import { useUserData } from '@nhost/nextjs';
import { AnimatePresence, motion } from 'framer-motion';
import { useRouter } from 'next/router';
@@ -27,10 +27,11 @@ const getInternalErrorMessage = (
return null;
}
if (error instanceof ApolloError) {
const internalError = error.graphQLErrors?.[0]?.extensions?.internal as
| { error: { message: string } }
| undefined;
if (error.name === 'ApolloError') {
// @ts-ignore
const internalError = error.graphQLErrors?.[0]?.extensions?.internal as {
error: { message: string };
};
return internalError?.error?.message || null;
}
@@ -42,7 +43,7 @@ const getInternalErrorMessage = (
};
const errorToObject = (error: ApolloError | Error) => {
if (error instanceof ApolloError) {
if (error.name === 'ApolloError') {
return error;
}

View File

@@ -7,7 +7,7 @@ import { useIsCurrentUserOwner } from '@/features/projects/common/hooks/useIsCur
import { PendingWorkspaceMemberInvitation } from '@/features/projects/workspaces/components/PendingWorkspaceMemberInvitation';
import { WorkspaceMember } from '@/features/projects/workspaces/components/WorkspaceMember';
import { discordAnnounce } from '@/utils/discordAnnounce';
import { getErrorMessage } from '@/utils/getErrorMessage';
import { execPromiseWithErrorToast } from '@/utils/execPromiseWithErrorToast';
import { triggerToast } from '@/utils/toast';
import {
refetchGetWorkspaceMembersQuery,
@@ -52,38 +52,42 @@ function WorkspaceMemberInviteForm({
return;
}
try {
await insertWorkspaceMemberInvite({
variables: {
workspaceMemberInvite: {
workspaceId: currentWorkspace.id,
email,
memberType: 'member',
await execPromiseWithErrorToast(
async () => {
await insertWorkspaceMemberInvite({
variables: {
workspaceMemberInvite: {
workspaceId: currentWorkspace.id,
email,
memberType: 'member',
},
},
},
});
triggerToast(
`Invite to join workspace ${currentWorkspace.name} sent to ${email}.`,
);
} catch (error) {
await discordAnnounce(
`Error trying to invite to ${email} to ${currentWorkspace.name} ${error.message}`,
);
if (
error.message ===
'Foreign key violation. insert or update on table "workspace_member_invites" violates foreign key constraint "workspace_member_invites_email_fkey"'
) {
setWorkspaceInviteError(
'You can only invite users that are already registered at Nhost. Ask the person to register an account, then invite them again.',
});
triggerToast(
`Invite to join workspace ${currentWorkspace.name} sent to ${email}.`,
);
},
{
loadingMessage: 'Sending invite...',
successMessage: 'The invite has been sent successfully.',
errorMessage: `Error trying to invite to ${email} to ${currentWorkspace.name}`,
onError: async (error) => {
await discordAnnounce(
`Error trying to invite to ${email} to ${currentWorkspace.name} ${error.message}`,
);
return;
}
setWorkspaceInviteError(getErrorMessage(error, 'invite'));
return;
}
if (
error.message ===
'Foreign key violation. insert or update on table "workspace_member_invites" violates foreign key constraint "workspace_member_invites_email_fkey"'
) {
setWorkspaceInviteError(
'You can only invite users that are already registered at Nhost. Ask the person to register an account, then invite them again.',
);
}
},
},
);
setEmail('');
};
@@ -130,8 +134,8 @@ export default function WorkspaceMembers() {
});
return (
<div className="mx-auto mt-18 max-w-3xl font-display">
<div className="mb-2 grid grid-flow-row gap-1">
<div className="max-w-3xl mx-auto mt-18 font-display">
<div className="grid grid-flow-row gap-1 mb-2">
<Text variant="h3">Members</Text>
<Text color="secondary" className="text-sm">
People in this workspace can manage all projects listed above.

View File

@@ -29,6 +29,7 @@ export default async function execPromiseWithErrorToast(
const result = await call();
toast.dismiss(loadingToastId);
toast.success(successMessage, {
style: toastStyle.style,
...toastStyle.success,

View File

@@ -1,5 +1,11 @@
# @nhost/docs
## 2.6.0
### Minor Changes
- dc23dc0: fix: docs run references
## 2.5.0
### Minor Changes

View File

@@ -9,7 +9,7 @@ If you are using the Nhost CLI for local development, as of [v0.12.0](https://gi
<Steps>
<Step title="Configuring the Service">
Follow the steps highlighed in the ["Enabling Service"](enabling-service) guide and don't forget to add the relevant secrets to your `.secrets` file.
Follow the steps highlighed in the [Enabling Service](enabling-service) guide and don't forget to add the relevant secrets to your `.secrets` file.
</Step>
<Step title="Start nhost">
Run `nhost up`:

View File

@@ -46,11 +46,11 @@ capacity=1
</Tab>
</Tabs>
<Info>Head to [CLI & CI deployments](/run/ci) for more details on how to deploy using a configuration file.</Info>
<Info>Head to [CLI & CI deployments](/guides/run/cli-deployments) for more details on how to deploy using a configuration file.</Info>
The `name` of the service is used as an identifier and to generate URLs when exposing the service to the Internet. You can use any container image publicly available or you can push your own to the [Nhost registry](/run/registry).
The `name` of the service is used as an identifier and to generate URLs when exposing the service to the Internet. You can use any container image publicly available or you can push your own to the [Nhost registry](/guides/run/registry).
All environment variables set here are exclusive to this service and will not be shared with other services or with the Nhost stack. If you are using a configuration file secrets are supported.
For more details about the `Ports` section head to [networking](/run/networking). You can also head to [resources](/run/resources) for more information about replicas, compute, and storage.
For more details about the `Ports` section head to [networking](/guides/run/networking). You can also head to [resources](/guides/run/resources) for more information about replicas, compute, and storage.

View File

@@ -12,11 +12,11 @@ Then on `New Service`:
![click on New Service](/images/guides/run/getting_started_2.png)
Now you can fill your [service configuration](/run/configuration):
Now you can fill your [service configuration](/guides/run/configuration):
![click on New Service](/images/guides/run/getting_started_3.png)
As you configure the `Ports` section you can take note of the generated URL. You can find more information about this section under [Networking](/run/networking).
As you configure the `Ports` section you can take note of the generated URL. You can find more information about this section under [Networking](/guides/run/networking).
![copy the URL](/images/guides/run/getting_started_4.png)

View File

@@ -76,7 +76,7 @@ To pause a service, simply set its number of replicas to `0`:
<Tab title="dashboard">
![pausing a service](/img/run/resources_3.png)
![pausing a service](/images/guides/run/resources_3.png)
</Tab>
<Tab title="toml">

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/docs",
"version": "2.5.0",
"version": "2.6.0",
"private": true,
"scripts": {
"start": "mintlify dev"