Compare commits
4 Commits
@nhost/rea
...
@nhost/das
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b25c37c26 | ||
|
|
6df4f02e95 | ||
|
|
aaae98f019 | ||
|
|
dc23dc0f49 |
@@ -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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/dashboard",
|
||||
"version": "1.8.1",
|
||||
"version": "1.8.2",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"preinstall": "npx only-allow pnpm",
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -29,6 +29,7 @@ export default async function execPromiseWithErrorToast(
|
||||
const result = await call();
|
||||
|
||||
toast.dismiss(loadingToastId);
|
||||
|
||||
toast.success(successMessage, {
|
||||
style: toastStyle.style,
|
||||
...toastStyle.success,
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @nhost/docs
|
||||
|
||||
## 2.6.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- dc23dc0: fix: docs run references
|
||||
|
||||
## 2.5.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -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`:
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -12,11 +12,11 @@ Then on `New Service`:
|
||||
|
||||

|
||||
|
||||
Now you can fill your [service configuration](/run/configuration):
|
||||
Now you can fill your [service configuration](/guides/run/configuration):
|
||||
|
||||

|
||||
|
||||
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).
|
||||
|
||||

|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ To pause a service, simply set its number of replicas to `0`:
|
||||
<Tab title="dashboard">
|
||||
|
||||
|
||||

|
||||

|
||||
|
||||
</Tab>
|
||||
<Tab title="toml">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/docs",
|
||||
"version": "2.5.0",
|
||||
"version": "2.6.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "mintlify dev"
|
||||
|
||||
Reference in New Issue
Block a user