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 Sep 22, 2023
1 parent 08de6f1 commit b60aeef
Show file tree
Hide file tree
Showing 11 changed files with 791 additions and 135 deletions.
9 changes: 9 additions & 0 deletions dashboard/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @nhost/dashboard

## 0.20.16

### Patch Changes

- df5b4302c: chore(dashboard): remove run feature flag
- bf4a1f6c2: feat(dashboard): fetch auth, postgres, hasura and storage versions from dashboard
- 34fc08ca7: fix(dashboard/run): show correct private registry in service details
- 885d10620: chore(dashboard): change feedback to contact us

## 0.20.15

### 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.15",
"version": "0.20.16",
"private": true,
"scripts": {
"preinstall": "npx only-allow pnpm",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import { filterOptions } from '@/components/ui/v2/Autocomplete';
import { useCurrentWorkspaceAndProject } from '@/features/projects/common/hooks/useCurrentWorkspaceAndProject';
import {
GetAuthenticationSettingsDocument,
Software_Type_Enum,
useGetAuthenticationSettingsQuery,
useGetSoftwareVersionsQuery,
useUpdateConfigMutation,
} from '@/generated/graphql';
import { getToastStyleProps } from '@/utils/constants/settings';
Expand All @@ -28,15 +30,6 @@ export type AuthServiceVersionFormValues = Yup.InferType<
typeof validationSchema
>;

const AVAILABLE_AUTH_VERSIONS = [
'0.21.2',
'0.20.1',
'0.20.0',
'0.19.3',
'0.19.2',
'0.19.1',
];

export default function AuthServiceVersionSettings() {
const { maintenanceActive } = useUI();
const { currentProject } = useCurrentWorkspaceAndProject();
Expand All @@ -49,9 +42,16 @@ export default function AuthServiceVersionSettings() {
fetchPolicy: 'cache-only',
});

const { data: authVersionsData } = useGetSoftwareVersionsQuery({
variables: {
software: Software_Type_Enum.Auth,
},
});

const { version } = data?.config?.auth || {};
const versions = authVersionsData?.softwareVersions || [];
const availableVersions = Array.from(
new Set(AVAILABLE_AUTH_VERSIONS).add(version),
new Set(versions.map((el) => el.version)).add(version),
)
.sort()
.reverse()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import { filterOptions } from '@/components/ui/v2/Autocomplete';
import { useCurrentWorkspaceAndProject } from '@/features/projects/common/hooks/useCurrentWorkspaceAndProject';
import {
GetPostgresSettingsDocument,
Software_Type_Enum,
useGetPostgresSettingsQuery,
useGetSoftwareVersionsQuery,
useUpdateConfigMutation,
} from '@/generated/graphql';
import { getToastStyleProps } from '@/utils/constants/settings';
Expand All @@ -30,15 +32,6 @@ export type DatabaseServiceVersionFormValues = Yup.InferType<
typeof validationSchema
>;

const AVAILABLE_POSTGRES_VERSIONS = [
'14.6-20230705-1',
'14.6-20230613-1',
'14.6-20230525',
'14.6-20230406-2',
'14.6-20230406-1',
'14.6-20230404',
];

export default function DatabaseServiceVersionSettings() {
const { maintenanceActive } = useUI();
const { currentProject } = useCurrentWorkspaceAndProject();
Expand All @@ -51,9 +44,16 @@ export default function DatabaseServiceVersionSettings() {
fetchPolicy: 'cache-only',
});

const { data: databaseVersionsData } = useGetSoftwareVersionsQuery({
variables: {
software: Software_Type_Enum.PostgreSql,
},
});

const { version } = data?.config?.postgres || {};
const databaseVersions = databaseVersionsData?.softwareVersions || [];
const availableVersions = Array.from(
new Set(AVAILABLE_POSTGRES_VERSIONS).add(version),
new Set(databaseVersions.map((el) => el.version)).add(version),
)
.sort()
.reverse()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import { filterOptions } from '@/components/ui/v2/Autocomplete';
import { useCurrentWorkspaceAndProject } from '@/features/projects/common/hooks/useCurrentWorkspaceAndProject';
import {
GetHasuraSettingsDocument,
Software_Type_Enum,
useGetHasuraSettingsQuery,
useGetSoftwareVersionsQuery,
useUpdateConfigMutation,
} from '@/generated/graphql';
import { getToastStyleProps } from '@/utils/constants/settings';
Expand All @@ -30,16 +32,6 @@ export type HasuraServiceVersionFormValues = Yup.InferType<
typeof validationSchema
>;

const AVAILABLE_HASURA_VERSIONS = [
'v2.29.0-ce',
'v2.28.2-ce',
'v2.27.0-ce',
'v2.25.1-ce',
'v2.25.0-ce',
'v2.24.1-ce',
'v2.15.2',
];

export default function HasuraServiceVersionSettings() {
const { maintenanceActive } = useUI();
const { currentProject, refetch: refetchWorkspaceAndProject } =
Expand All @@ -53,9 +45,16 @@ export default function HasuraServiceVersionSettings() {
fetchPolicy: 'cache-only',
});

const { data: hasuraVersionsData } = useGetSoftwareVersionsQuery({
variables: {
software: Software_Type_Enum.Hasura,
},
});

const { version } = data?.config?.hasura || {};
const versions = hasuraVersionsData?.softwareVersions || [];
const availableVersions = Array.from(
new Set(AVAILABLE_HASURA_VERSIONS).add(version),
new Set(versions.map((el) => el.version)).add(version),
)
.sort()
.reverse()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import type { SvgIconProps } from '@/components/ui/v2/icons/SvgIcon';
import { UserIcon } from '@/components/ui/v2/icons/UserIcon';
import { useCurrentWorkspaceAndProject } from '@/features/projects/common/hooks/useCurrentWorkspaceAndProject';
import { useIsPlatform } from '@/features/projects/common/hooks/useIsPlatform';
import { useHypertune } from '@/hooks/useHypertune';
import type { ReactElement } from 'react';

export interface ProjectRoute {
Expand Down Expand Up @@ -58,26 +57,8 @@ export interface ProjectRoute {
export default function useProjectRoutes() {
const isPlatform = useIsPlatform();
const { maintenanceActive } = useUI();
const {
currentWorkspace,
currentProject,
loading: currentProjectLoading,
} = useCurrentWorkspaceAndProject();

const hypertune = useHypertune();

const enableServices =
currentWorkspace &&
hypertune
.root({
context: {
workSpace: {
id: currentWorkspace.id,
},
},
})
.enableServices({})
.get(false);
const { currentProject, loading: currentProjectLoading } =
useCurrentWorkspaceAndProject();

const nhostRoutes: ProjectRoute[] = [
{
Expand Down Expand Up @@ -118,7 +99,7 @@ export default function useProjectRoutes() {
},
];

let allRoutes: ProjectRoute[] = [
const allRoutes: ProjectRoute[] = [
{
relativePath: '/',
exact: true,
Expand Down Expand Up @@ -156,18 +137,14 @@ export default function useProjectRoutes() {
label: 'Storage',
icon: <StorageIcon />,
},
];

if (enableServices) {
allRoutes.push({
{
relativePath: '/services',
exact: false,
label: 'Run',
icon: <ServicesIcon />,
});
}

allRoutes = [...allRoutes, ...nhostRoutes];
},
...nhostRoutes,
];

return {
nhostRoutes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ export default function ServiceForm({
component: (
<ServiceDetailsDialog
serviceID={detailsServiceId}
image={formValues.image}
subdomain={detailsServiceSubdomain}
ports={formValues.ports}
/>
Expand Down Expand Up @@ -345,7 +344,7 @@ export default function ServiceForm({
<Tooltip title="Name of the service, must be unique per project.">
<InfoIcon
aria-label="Info"
className="w-4 h-4"
className="h-4 w-4"
color="primary"
/>
</Tooltip>
Expand Down Expand Up @@ -385,7 +384,7 @@ export default function ServiceForm({
>
<InfoIcon
aria-label="Info"
className="w-4 h-4"
className="h-4 w-4"
color="primary"
/>
</Tooltip>
Expand Down Expand Up @@ -416,7 +415,7 @@ export default function ServiceForm({
<Tooltip title="Command to run when to start the service. This is optional as the image may already have a baked-in command.">
<InfoIcon
aria-label="Info"
className="w-4 h-4"
className="h-4 w-4"
color="primary"
/>
</Tooltip>
Expand Down Expand Up @@ -460,7 +459,7 @@ export default function ServiceForm({
{createServiceFormError && (
<Alert
severity="error"
className="grid items-center justify-between grid-flow-col px-4 py-3"
className="grid grid-flow-col items-center justify-between px-4 py-3"
>
<span className="text-left">
<strong>Error:</strong> {createServiceFormError.message}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@ export interface ServiceDetailsDialogProps {
subdomain: string;

/**
* The image of the service
*/
image: string;

/**
* The image of the service
* The service ports
* We use partial here because `port` is set as required in ConfigRunServicePort
*/
ports: Partial<ConfigRunServicePort>[];
Expand All @@ -31,7 +26,6 @@ export interface ServiceDetailsDialogProps {
export default function ServiceDetailsDialog({
serviceID,
subdomain,
image,
ports,
}: ServiceDetailsDialogProps) {
const { currentProject } = useCurrentWorkspaceAndProject();
Expand All @@ -50,10 +44,7 @@ export default function ServiceDetailsDialog({
<Text color="secondary">Private registry</Text>
<InfoCard
title=""
value={
image ||
`registry.${currentProject.region.awsName}.${currentProject.region.domain}/${serviceID}`
}
value={`registry.${currentProject.region.awsName}.${currentProject.region.domain}/${serviceID}`}
/>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { filterOptions } from '@/components/ui/v2/Autocomplete';
import { useCurrentWorkspaceAndProject } from '@/features/projects/common/hooks/useCurrentWorkspaceAndProject';
import {
GetStorageSettingsDocument,
Software_Type_Enum,
useGetSoftwareVersionsQuery,
useGetStorageSettingsQuery,
useUpdateConfigMutation,
} from '@/generated/graphql';
Expand All @@ -30,8 +32,6 @@ export type StorageServiceVersionFormValues = Yup.InferType<
typeof validationSchema
>;

const AVAILABLE_STORAGE_VERSIONS = ['0.3.5', '0.3.4', '0.3.3', '0.3.2'];

export default function StorageServiceVersionSettings() {
const { maintenanceActive } = useUI();
const { currentProject } = useCurrentWorkspaceAndProject();
Expand All @@ -44,9 +44,16 @@ export default function StorageServiceVersionSettings() {
fetchPolicy: 'cache-only',
});

const { data: storageVersionsData } = useGetSoftwareVersionsQuery({
variables: {
software: Software_Type_Enum.Storage,
},
});

const { version } = data?.config?.storage || {};
const versions = storageVersionsData?.softwareVersions || [];
const availableVersions = Array.from(
new Set(AVAILABLE_STORAGE_VERSIONS).add(version),
new Set(versions.map((el) => el.version)).add(version),
)
.sort()
.reverse()
Expand Down
9 changes: 9 additions & 0 deletions dashboard/src/gql/platform/getSoftwareVersions.gql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
query getSoftwareVersions($software: software_type_enum!) {
softwareVersions(
where: { software: { _eq: $software } }
order_by: { version: desc }
) {
version
software
}
}
Loading

0 comments on commit b60aeef

Please sign in to comment.