Skip to content

Commit

Permalink
Merge upstream changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sync Fork committed Oct 11, 2023
1 parent c46429d commit a1ebac2
Show file tree
Hide file tree
Showing 82 changed files with 2,194 additions and 1,148 deletions.
3 changes: 1 addition & 2 deletions .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": ["@nhost-examples/sveltekit"]
"updateInternalDependencies": "patch"
}
5 changes: 5 additions & 0 deletions .changeset/violet-onions-swim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@nhost/apollo': patch
---

fix: apollo-integration: reset accessToken to null after sign-out
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
"eslint.workingDirectories": ["./dashboard"]
"eslint.workingDirectories": ["./dashboard"],
"typescript.tsdk": "node_modules/typescript/lib"
}
6 changes: 6 additions & 0 deletions dashboard/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @nhost/dashboard

## 0.20.23

### Patch Changes

- c01568a7d: chore(dashboard): show alert to update oauth providers

## 0.20.22

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion dashboard/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nhost/dashboard",
"version": "0.20.22",
"version": "0.20.23",
"private": true,
"scripts": {
"preinstall": "npx only-allow pnpm",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Alert } from '@/components/ui/v2/Alert';
import { Text } from '@/components/ui/v2/Text';
import { useCurrentWorkspaceAndProject } from '@/features/projects/common/hooks/useCurrentWorkspaceAndProject';

export default function DepricationNotice() {
const { currentProject } = useCurrentWorkspaceAndProject();

return (
!currentProject?.providersUpdated && (
<Alert severity="warning" className="grid place-content-center">
<Text color="warning" className="max-w-3xl text-sm">
On December 1st the old backend domain will cease to work. You need to
make sure your client is instantiated using the subdomain and region
and update your oauth2 settings. You can find more information{' '}
<a
target="_blank"
rel="noopener noreferrer"
className="underline"
href="https://github.com/nhost/nhost/discussions/2303"
>
here
</a>
.
</Text>
</Alert>
)
);
}
1 change: 1 addition & 0 deletions dashboard/src/components/common/DepricationNotice/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as ContactUs } from './DepricationNotice';
76 changes: 40 additions & 36 deletions dashboard/src/components/layout/SettingsLayout/SettingsLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import DepricationNotice from '@/components/common/DepricationNotice/DepricationNotice';
import type { ProjectLayoutProps } from '@/components/layout/ProjectLayout';
import { ProjectLayout } from '@/components/layout/ProjectLayout';
import type { SettingsSidebarProps } from '@/components/layout/SettingsSidebar';
Expand Down Expand Up @@ -45,44 +46,47 @@ export default function SettingsLayout({

<Box
sx={{ backgroundColor: 'background.default' }}
className="flex flex-col flex-auto w-full overflow-scroll overflow-x-hidden"
className="flex w-full flex-auto flex-col overflow-scroll overflow-x-hidden"
>
<RetryableErrorBoundary>
{hasGitRepo && (
<Alert
severity="warning"
className="grid grid-flow-row gap-2 place-content-center"
>
<Text color="warning" className="text-sm ">
As you have a connected repository, make sure to synchronize
your changes with{' '}
<code
className={twMerge(
'rounded-md px-2 py-px',
theme.palette.mode === 'dark'
? 'bg-brown text-copper'
: 'bg-slate-200 text-slate-700',
)}
>
nhost config pull
</code>{' '}
or they may be reverted with the next push.
<br />
If there are multiple projects linked to the same repository and
you only want these changes to apply to a subset of them, please
check out{' '}
<a
target="_blank"
rel="noopener noreferrer"
className="underline"
href="https://docs.nhost.io/cli/overlays"
>
docs.nhost.io/cli/overlays
</a>{' '}
for guidance.
</Text>
</Alert>
)}
<div className="flex flex-col space-y-2">
<DepricationNotice />
{hasGitRepo && (
<Alert
severity="warning"
className="grid grid-flow-row place-content-center gap-2"
>
<Text color="warning" className="text-sm ">
As you have a connected repository, make sure to synchronize
your changes with{' '}
<code
className={twMerge(
'rounded-md px-2 py-px',
theme.palette.mode === 'dark'
? 'bg-brown text-copper'
: 'bg-slate-200 text-slate-700',
)}
>
nhost config pull
</code>{' '}
or they may be reverted with the next push.
<br />
If there are multiple projects linked to the same repository
and you only want these changes to apply to a subset of them,
please check out{' '}
<a
target="_blank"
rel="noopener noreferrer"
className="underline"
href="https://docs.nhost.io/cli/overlays"
>
docs.nhost.io/cli/overlays
</a>{' '}
for guidance.
</Text>
</Alert>
)}
</div>
{children}
</RetryableErrorBoundary>
</Box>
Expand Down
100 changes: 100 additions & 0 deletions dashboard/src/components/settings/ProvidersUpdatedAlert.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import { useDialog } from '@/components/common/DialogProvider';
import { Alert } from '@/components/ui/v2/Alert';
import { Button } from '@/components/ui/v2/Button';
import { ArrowSquareOutIcon } from '@/components/ui/v2/icons/ArrowSquareOutIcon';
import { Link } from '@/components/ui/v2/Link';
import { Text } from '@/components/ui/v2/Text';
import { useCurrentWorkspaceAndProject } from '@/features/projects/common/hooks/useCurrentWorkspaceAndProject';
import { getToastStyleProps } from '@/utils/constants/settings';
import { useConfirmProvidersUpdatedMutation } from '@/utils/__generated__/graphql';
import { useTheme } from '@mui/material';
import { useState } from 'react';
import toast from 'react-hot-toast';

export default function ProvidersUpdatedAlert() {
const theme = useTheme();
const { openAlertDialog } = useDialog();
const [confirmed, setConfirmed] = useState(true);
const { currentProject } = useCurrentWorkspaceAndProject();

const [confirmProvidersUpdated] = useConfirmProvidersUpdatedMutation({
variables: { id: currentProject?.id },
});

async function handleSubmitConfirmation() {
const confirmProvidersUpdatedPromise = confirmProvidersUpdated();

await toast.promise(
confirmProvidersUpdatedPromise,
{
loading: 'Confirming...',
success: 'Your settings have been updated successfully.',
error: 'An error occurred while trying to confirm the message.',
},
getToastStyleProps(),
);

setConfirmed(false);
}

function handleOpenConfirmationDialog() {
openAlertDialog({
title: 'Confirm all providers updated?',
payload: (
<Text variant="subtitle1" component="span">
Please make sure to update all providers before continuing. Your
sign-in flows might break if you don&apos;t.
</Text>
),
props: {
onPrimaryAction: handleSubmitConfirmation,
},
});
}

if (!confirmed) {
return null;
}

return (
<Alert
severity="warning"
className="grid items-center grid-flow-row gap-2 p-4 place-items-center lg:grid-flow-col lg:place-content-between"
>
<div className="grid grid-flow-row gap-1 text-left">
<Text className="font-semibold">
Please update the Redirect URL for all providers being used
</Text>

<Text className="text-sm+">
We are deprecating your project&apos;s old DNS name in favor of
individual DNS names for each service. Please make sure to update your
providers to use the new auth specific URL under <b>Redirect URL</b>{' '}
before the 1st of February 2023.{' '}
<Link
href="https://github.com/nhost/nhost/discussions/1319"
target="_blank"
rel="noopener noreferrer"
underline="hover"
className="font-medium"
>
Read the discussion here.
<ArrowSquareOutIcon className="w-4 h-4 ml-1" />
</Link>
</Text>
</div>

<Button
variant="borderless"
className={
theme.palette.mode === 'dark'
? 'text-white hover:bg-brown'
: 'text-black hover:bg-orange-300'
}
onClick={handleOpenConfirmationDialog}
>
I have updated all Redirect URLs
</Button>
</Alert>
);
}
1 change: 1 addition & 0 deletions dashboard/src/components/settings/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as ProvidersUpdatedAlert } from './ProvidersUpdatedAlert';
5 changes: 5 additions & 0 deletions dashboard/src/gql/settings/confirmProvidersUpdated.gql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mutation confirmProvidersUpdated($id: uuid!) {
updateApp(pk_columns: { id: $id }, _set: { providersUpdated: true }) {
id
}
}
8 changes: 7 additions & 1 deletion dashboard/src/pages/[workspaceSlug]/[appSlug]/backups.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import DepricationNotice from '@/components/common/DepricationNotice/DepricationNotice';
import { Container } from '@/components/layout/Container';
import { ProjectLayout } from '@/components/layout/ProjectLayout';
import { RetryableErrorBoundary } from '@/components/presentational/RetryableErrorBoundary';
Expand Down Expand Up @@ -67,5 +68,10 @@ export default function BackupsPage() {
}

BackupsPage.getLayout = function getLayout(page: ReactElement) {
return <ProjectLayout>{page}</ProjectLayout>;
return (
<ProjectLayout>
<DepricationNotice />
{page}
</ProjectLayout>
);
};
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import DepricationNotice from '@/components/common/DepricationNotice/DepricationNotice';
import { InlineCode } from '@/components/presentational/InlineCode';
import { DataBrowserEmptyState } from '@/features/database/dataGrid/components/DataBrowserEmptyState';
import { DataBrowserLayout } from '@/features/database/dataGrid/components/DataBrowserLayout';
Expand Down Expand Up @@ -35,5 +36,10 @@ export default function DataBrowserDatabaseDetailsPage() {
DataBrowserDatabaseDetailsPage.getLayout = function getLayout(
page: ReactElement,
) {
return <DataBrowserLayout>{page}</DataBrowserLayout>;
return (
<DataBrowserLayout>
<DepricationNotice />
{page}
</DataBrowserLayout>
);
};
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import DepricationNotice from '@/components/common/DepricationNotice/DepricationNotice';
import { Container } from '@/components/layout/Container';
import { ProjectLayout } from '@/components/layout/ProjectLayout';
import type { DeploymentStatus } from '@/components/presentational/StatusCircle';
Expand Down Expand Up @@ -105,7 +106,7 @@ export default function DeploymentDetailsPage() {
<Text color="secondary">{relativeDateOfDeployment}</Text>
</div>
</div>
<div className=" flex items-center">
<div className="flex items-center ">
<Link
className="self-center font-mono font-medium"
target="_blank"
Expand Down Expand Up @@ -139,7 +140,7 @@ export default function DeploymentDetailsPage() {

{deployment.deploymentLogs.map((log) => (
<div key={log.id} className="flex font-mono">
<div className=" mr-2 flex-shrink-0">
<div className="mr-2 flex-shrink-0 ">
{format(parseISO(log.createdAt), 'HH:mm:ss')}:
</div>
<div className="break-all">{log.message}</div>
Expand All @@ -152,5 +153,10 @@ export default function DeploymentDetailsPage() {
}

DeploymentDetailsPage.getLayout = function getLayout(page: ReactElement) {
return <ProjectLayout>{page}</ProjectLayout>;
return (
<ProjectLayout>
<DepricationNotice />
{page}
</ProjectLayout>
);
};
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import DepricationNotice from '@/components/common/DepricationNotice/DepricationNotice';
import { useUI } from '@/components/common/UIProvider';
import { Container } from '@/components/layout/Container';
import { ProjectLayout } from '@/components/layout/ProjectLayout';
Expand Down Expand Up @@ -67,5 +68,10 @@ export default function DeploymentsPage() {
}

DeploymentsPage.getLayout = function getLayout(page: ReactElement) {
return <ProjectLayout>{page}</ProjectLayout>;
return (
<ProjectLayout>
<DepricationNotice />
{page}
</ProjectLayout>
);
};
2 changes: 2 additions & 0 deletions dashboard/src/pages/[workspaceSlug]/[appSlug]/graphql.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import DepricationNotice from '@/components/common/DepricationNotice/DepricationNotice';
import { ProjectLayout } from '@/components/layout/ProjectLayout';
import { LoadingScreen } from '@/components/presentational/LoadingScreen';
import { RetryableErrorBoundary } from '@/components/presentational/RetryableErrorBoundary';
Expand Down Expand Up @@ -351,6 +352,7 @@ GraphQLPage.getLayout = function getLayout(page: ReactElement) {
},
}}
>
<DepricationNotice />
{page}
</ProjectLayout>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import DepricationNotice from '@/components/common/DepricationNotice/DepricationNotice';
import { Container } from '@/components/layout/Container';
import { ProjectLayout } from '@/components/layout/ProjectLayout';
import { LoadingScreen } from '@/components/presentational/LoadingScreen';
Expand Down Expand Up @@ -114,5 +115,10 @@ export default function HasuraPage() {
}

HasuraPage.getLayout = function getLayout(page: ReactElement) {
return <ProjectLayout>{page}</ProjectLayout>;
return (
<ProjectLayout>
<DepricationNotice />
{page}
</ProjectLayout>
);
};
Loading

0 comments on commit a1ebac2

Please sign in to comment.