Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Remove 2 already deleted files

Joshen Limda27ca91ce61
diff --git a/studio/components/interfaces/Database/Backups/PITRBackupSelection/PITRBackupSelection.tsx b/studio/components/interfaces/Database/Backups/PITRBackupSelection/PITRBackupSelection.tsx
deleted file mode 100644
index 043714ee9aa..00000000000
--- a/studio/components/interfaces/Database/Backups/PITRBackupSelection/PITRBackupSelection.tsx
+++ /dev/null
@@ -1,303 +0,0 @@
-import dayjs from 'dayjs'
-import Link from 'next/link'
-import { FC, FormEvent, useState } from 'react'
-import { useRouter } from 'next/router'
-import { PermissionAction } from '@supabase/shared-types/out/constants'
-import { IconSearch, IconInfo, Input, Listbox, Popover, Button, Modal, IconAlertCircle } from 'ui'
-
-import { post } from 'lib/common/fetch'
-import { API_URL, PROJECT_STATUS } from 'lib/constants'
-import { useStore, checkPermissions } from 'hooks'
-import Loading from 'components/ui/Loading'
-import ConfirmationModal from 'components/ui/ConfirmationModal'
-
-import BackupsError from '../BackupsError'
-import BackupsEmpty from '../BackupsEmpty'
-import { ALL_TIMEZONES } from './PITRBackupSelection.constants'
-import {
- getClientTimezone,
- getTimezoneOffsetText,
- convertTimeStringtoUnixS,
-} from './PITRBackupSelection.utils'
-import InformationBox from 'components/ui/InformationBox'
-
-interface Props {}
-
-const PITRBackupSelection: FC<Props> = () => {
- const router = useRouter()
- const { app, ui, backups } = useStore()
-
- const projectId = ui.selectedProject?.id ?? -1
- const projectRef = ui.selectedProject?.ref ?? 'default'
-
- const canTriggerPhysicalBackups = checkPermissions(
- PermissionAction.INFRA_EXECUTE,
- 'queue_job.restore.prepare'
- )
-
- const [searchString, setSearchString] = useState<string>('')
- const [selectedTimezone, setSelectedTimezone] = useState<any>(getClientTimezone())
- const [showConfirmation, setShowConfirmation] = useState<boolean>(false)
-
- const [errors, setErrors] = useState<any>()
- const [recoveryPoint, setRecoveryPoint] = useState<string>()
-
- const { configuration } = backups
-
- if (backups.isLoading) {
- return <Loading />
- } else if (backups.error) {
- return <BackupsError />
- }
-
- const hasPhysicalBackups =
- configuration.physicalBackupData.earliestPhysicalBackupDateUnix !== null &&
- configuration.physicalBackupData.latestPhysicalBackupDateUnix !== null &&
- configuration.physicalBackupData.earliestPhysicalBackupDateUnix !==
- configuration.physicalBackupData.latestPhysicalBackupDateUnix
-
- if (!configuration.walg_enabled) {
- return (
- <div className="block w-full rounded border border-gray-400 border-opacity-50 bg-gray-300 p-3">
- <div className="flex space-x-3">
- <IconInfo size={20} strokeWidth={1.5} />
- <p className="text-sm">
- Point in time backups is an Enterprise feature. Reach out to us{' '}
- <Link href={`/support/new?ref=${projectRef}&category=sales`}>
- <a className="text-brand-900">here</a>
- </Link>{' '}
- if you're interested!
- </p>
- </div>
- </div>
- )
- } else if (!hasPhysicalBackups) {
- return <BackupsEmpty />
- }
-
- const timezoneOptions =
- searchString.length > 0
- ? ALL_TIMEZONES.map((option) => option.text).filter((option) =>
- option.toLowerCase().includes(searchString.toLowerCase())
- )
- : ALL_TIMEZONES.map((option) => option.text)
-
- const earliestAvailableBackup = dayjs
- .unix(configuration.physicalBackupData.earliestPhysicalBackupDateUnix)
- .tz(selectedTimezone.utc[0])
- .format('YYYY-MM-DDTHH:mm:ss')
-
- const latestAvailableBackup = dayjs
- .unix(configuration.physicalBackupData.latestPhysicalBackupDateUnix)
- .tz(selectedTimezone.utc[0])
- .format('YYYY-MM-DDTHH:mm:ss')
-
- const onSubmit = (e: FormEvent<HTMLFormElement>) => {
- e.preventDefault()
-
- // Validation
- if (!recoveryPoint) {
- setErrors({ recoveryPoint: 'Please enter a date to recover your project from' })
- } else {
- const recoveryTimeTargetUnix = convertTimeStringtoUnixS(recoveryPoint, selectedTimezone)
- const { earliestPhysicalBackupDateUnix, latestPhysicalBackupDateUnix } =
- configuration.physicalBackupData
-
- const isOutOfRange =
- recoveryTimeTargetUnix < earliestPhysicalBackupDateUnix ||
- recoveryTimeTargetUnix > latestPhysicalBackupDateUnix
-
- if (isOutOfRange) {
- setErrors({
- recoveryPoint: 'Selected date is out of range for available points of recovery',
- })
- } else {
- setErrors(undefined)
- setShowConfirmation(true)
- }
- }
- }
-
- const onConfirmRestore = async () => {
- if (!recoveryPoint) return
-
- const recoveryTimeTargetUnix = convertTimeStringtoUnixS(recoveryPoint, selectedTimezone)
- const { error } = await post(`${API_URL}/database/${projectRef}/backups/pitr`, {
- recovery_time_target_unix: recoveryTimeTargetUnix,
- })
-
- if (error) {
- ui.setNotification({
- error,
- category: 'error',
- message: `Point in time recovery for project failed`,
- })
- setShowConfirmation(false)
- } else {
- setTimeout(() => {
- setShowConfirmation(false)
- app.onProjectStatusUpdated(projectId, PROJECT_STATUS.RESTORING)
- ui.setNotification({
- category: 'success',
- message: `Restoring database back to ${dayjs(recoveryPoint).format(
- 'DD MMM YYYY, HH:mm:ss'
- )} (
- ${getTimezoneOffsetText(selectedTimezone)})`,
- })
- router.push(`/project/${projectRef}`)
- }, 3000)
- }
- }
-
- return (
- <div className="space-y-6">
- {!canTriggerPhysicalBackups && (
- <InformationBox
- icon={<IconAlertCircle className="text-scale-1100" strokeWidth={2} />}
- title="You need additional permissions to trigger a scheduled backup"
- />
- )}
- <form onSubmit={onSubmit}>
- <div className="space-y-4">
- <div className="space-y-4 rounded border border-gray-400 border-opacity-50 bg-gray-300 py-3">
- <div className="space-y-4 py-2">
- <div className="flex justify-between space-x-8">
- <p className="w-2/5 pl-4 text-sm">Select timezone</p>
- <div className="w-3/5 px-4">
- <Listbox
- value={selectedTimezone.text}
- onChange={(text) => {
- const selectedTimezone = ALL_TIMEZONES.find((option) => option.text === text)
- setSelectedTimezone(selectedTimezone)
- }}
- onBlur={() => setSearchString('')}
- >
- <div
- className={[
- 'fixed top-0 flex w-full items-center',
- 'rounded-t-md border-b border-gray-600 bg-gray-500',
- 'mb-4 space-x-2 px-4 py-2',
- ].join(' ')}
- style={{ zIndex: 1 }}
- >
- <IconSearch size={14} />
- <input
- autoFocus
- className="w-72 bg-transparent text-sm placeholder-scale-1000 outline-none"
- value={searchString}
- placeholder={''}
- onChange={(e: FormEvent<HTMLInputElement>) =>
- setSearchString(e.currentTarget.value)
- }
- />
- </div>
- {/* Whitespace to shift listbox options down for searchfield */}
- <div className="h-8" />
- {timezoneOptions.map((option) => {
- return (
- <Listbox.Option key={option} label={option} value={option}>
- <div>{option}</div>
- </Listbox.Option>
- )
- })}
- {timezoneOptions.length === 0 && (
- <Listbox.Option disabled key="no-results" label="" value="">
- No timezones found
- </Listbox.Option>
- )}
- </Listbox>
- </div>
- </div>
- <div className="flex justify-between space-x-8">
- <div className="w-2/5 space-y-2 pl-4">
- <p className="text-sm">Earliest point of recovery</p>
- </div>
- <div className="w-3/5">
- <Input
- readOnly
- disabled
- step={1}
- type="datetime-local"
- className="px-4"
- value={earliestAvailableBackup}
- />
- </div>
- </div>
- <div className="flex justify-between space-x-8">
- <div className="w-2/5 space-y-2 pl-4">
- <p className="text-sm">Latest point of recovery</p>
- </div>
- <div className="w-3/5">
- <Input
- readOnly
- disabled
- step={1}
- type="datetime-local"
- className="px-4"
- value={latestAvailableBackup}
- />
- </div>
- </div>
- </div>
- <Popover.Seperator />
- <div className="flex justify-between space-x-8 py-2">
- <div className="w-2/5 space-y-2 pl-4">
- <p className="text-sm">Recovery point</p>
- <p className="text-sm text-scale-1100">
- Select a date and time that you would like to restore your project to
- </p>
- </div>
- <div className="w-3/5">
- <Input
- step={1}
- type="datetime-local"
- error={errors?.recoveryPoint}
- className="px-4"
- onChange={(e) => {
- setErrors(undefined)
- setRecoveryPoint(e.target.value)
- }}
- />
- </div>
- </div>
- <Popover.Seperator />
- <div className="flex items-center justify-end px-4">
- <Button type="default" htmlType="submit">
- Restore
- </Button>
- </div>
- </div>
- </div>
- </form>
- <ConfirmationModal
- visible={showConfirmation}
- size="medium"
- header="Confirm to restore"
- children={
- <Modal.Content>
- <div className="space-y-2 py-4">
- <div className="space-y-1">
- <p className="text-sm text-scale-1100">
- Are you sure you want to restore your database from:
- </p>
- <p className="text-sm text-scale-1200">
- {dayjs(recoveryPoint).format('DD MMM YYYY, HH:mm:ss')} (
- {getTimezoneOffsetText(selectedTimezone)})?
- </p>
- </div>
- <p className="text-sm text-scale-1100">
- This will destroy any new data written since this backup was made.
- </p>
- </div>
- </Modal.Content>
- }
- buttonLabel="Restore"
- buttonLoadingLabel="Restoring"
- onSelectCancel={() => setShowConfirmation(false)}
- onSelectConfirm={onConfirmRestore}
- />
- </div>
- )
-}
-
-export default PITRBackupSelection
diff --git a/studio/components/interfaces/Home/NewProjectPanel/GetStartedPanel.tsx b/studio/components/interfaces/Home/NewProjectPanel/GetStartedPanel.tsx
deleted file mode 100644
index 33adcb7b06d..00000000000
--- a/studio/components/interfaces/Home/NewProjectPanel/GetStartedPanel.tsx
+++ /dev/null
@@ -1,116 +0,0 @@
-import { FC } from 'react'
-import Link from 'next/link'
-import { useRouter } from 'next/router'
-import { Button, IconDatabase, IconKey, IconArchive } from 'ui'
-import Panel from 'components/ui/Panel'
-
-interface Props {}
-
-const GetStartedPanel: FC<Props> = ({}) => {
- const router = useRouter()
- const { ref } = router.query
- return (
- <>
- <div className="flex flex-col space-y-6">
- <div>
- <div className="flex h-full flex-col justify-between space-y-6">
- <div className="space-y-2">
- <h3 className="text-xl text-scale-1200">Welcome to your new project</h3>
- <p className="text-base text-scale-1000 lg:max-w-lg">
- Your project has been deployed on its own instance, with its own url and API all set
- up and ready to use.
- </p>
- </div>
- </div>
- </div>
-
- <div className="grid grid-cols-1 lg:grid-cols-3 lg:gap-8">
- <Panel>
- <Panel.Content className=" flex flex-col space-y-4 lg:h-40">
- <div className="flex items-center space-x-3">
- <div className="rounded bg-scale-600 p-1.5 text-scale-1000 shadow-sm">
- <IconDatabase strokeWidth={2} size={16} />
- </div>
- <h5>Database</h5>
- </div>
- <div className="flex flex-grow">
- <p className="text-sm text-scale-1000">
- Supabase is built on top of Postgres, an extremely scalable Relational Database.
- </p>
- </div>
- <div className="space-x-2">
- <Link href={`/project/${ref}/editor`}>
- <a>
- <Button type="default">Table editor</Button>
- </a>
- </Link>
- <Link href={`/project/${ref}/sql`}>
- <a>
- <Button type="default">SQL editor</Button>
- </a>
- </Link>
- <a href="https://supabase.com/docs/guides/database" target="_blank">
- <Button type="text">Documentation</Button>
- </a>
- </div>
- </Panel.Content>
- </Panel>
-
- <Panel className="">
- <Panel.Content className=" flex flex-col space-y-4 lg:h-40">
- <div className="flex items-center space-x-3">
- <div className="rounded bg-scale-600 p-1.5 text-scale-1000 shadow-sm">
- <IconKey strokeWidth={2} size={16} />
- </div>
- <h5>Auth</h5>
- </div>
- <div className="flex flex-grow">
- <p className="text-sm text-scale-1000">
- Supabase makes it simple to manage your users.
- </p>
- </div>
- <div className="space-x-2">
- <Link href={`/project/${ref}/auth/users`}>
- <a>
- <Button type="default">Try Auth</Button>
- </a>
- </Link>
- <a href="https://supabase.com/docs/guides/auth" target="_blank">
- <Button type="text">Documentation</Button>
- </a>
- </div>
- </Panel.Content>
- </Panel>
-
- <Panel>
- <Panel.Content className=" flex flex-col space-y-4 lg:h-40">
- <div className="flex items-center space-x-3">
- <div className="rounded bg-scale-600 p-1.5 text-scale-1000 shadow-sm">
- <IconArchive strokeWidth={2} size={16} />
- </div>
- <h5>Storage</h5>
- </div>
- <div className="flex flex-grow">
- <p className="text-sm text-scale-1000">
- Store and serve large files from multiple buckets.
- </p>
- </div>
- <div className="space-x-2">
- <Link href={`/project/${ref}/storage/buckets`}>
- <a>
- <Button type="default">Try Storage</Button>
- </a>
- </Link>
- <a href="https://supabase.com/docs/guides/storage" target="_blank">
- <Button type="text">Documentation</Button>
- </a>
- </div>
- </Panel.Content>
- </Panel>
- </div>
- </div>
- </>
- )
-}
-
-export default GetStartedPanel