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 Jan 6, 2024
1 parent 9f7278f commit 8816194
Show file tree
Hide file tree
Showing 11 changed files with 173 additions and 65 deletions.
8 changes: 8 additions & 0 deletions dashboard/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @nhost/dashboard

## 1.3.2

### Patch Changes

- 174b4165b: chore: use env variables when running graphql codegen
- 7c977e714: chore: change `Allowed Roles` to `Default Allowed Roles`
- 46f028b9f: fix: remove hardcoded ai version setting

## 1.3.1

### 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": "1.3.1",
"version": "1.3.2",
"private": true,
"scripts": {
"preinstall": "npx only-allow pnpm",
Expand Down
112 changes: 74 additions & 38 deletions dashboard/src/features/ai/settings/components/AISettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Form } from '@/components/form/Form';
import { SettingsContainer } from '@/components/layout/SettingsContainer';
import { ActivityIndicator } from '@/components/ui/v2/ActivityIndicator';
import { Alert } from '@/components/ui/v2/Alert';
import { filterOptions } from '@/components/ui/v2/Autocomplete';
import { Box } from '@/components/ui/v2/Box';
import { InfoIcon } from '@/components/ui/v2/icons/InfoIcon';
import { Input } from '@/components/ui/v2/Input';
Expand Down Expand Up @@ -95,8 +94,8 @@ export default function AISettings() {
reValidateMode: 'onSubmit',
defaultValues: {
version: {
label: '0.1.0',
value: '0.1.0',
label: ai?.version ?? availableVersions?.at(0)?.label,
value: ai?.version ?? availableVersions?.at(0)?.value,
},
webhookSecret: '',
organization: '',
Expand All @@ -110,12 +109,17 @@ export default function AISettings() {
resolver: yupResolver(validationSchema),
});

const { register, formState, reset, watch } = form;
const { register, formState, reset, watch, setValue } = form;

const aiSettingsFormValues = watch();

useEffect(() => {
if (ai) {
reset({
version: { label: ai?.version, value: ai?.version },
version: {
label: ai?.version,
value: ai?.version,
},
webhookSecret: ai?.webhookSecret,
synchPeriodMinutes: ai?.autoEmbeddings?.synchPeriodMinutes,
apiKey: ai?.openai?.apiKey,
Expand All @@ -130,10 +134,27 @@ export default function AISettings() {
setAIServiceEnabled(!!ai);
}, [ai, reset]);

useEffect(() => {
if (
!loadingGraphiteVersionsData &&
availableVersions.length > 0 &&
!ai &&
!aiSettingsFormValues.version.value
) {
setValue('version', availableVersions?.at(0));
}
}, [
ai,
setValue,
availableVersions,
aiSettingsFormValues,
loadingGraphiteVersionsData,
]);

const toggleAIService = async (enabled: boolean) => {
setAIServiceEnabled(enabled);

if (!enabled) {
if (!enabled && ai) {
openDialog({
title: 'Confirm Disabling the AI service',
component: (
Expand Down Expand Up @@ -203,8 +224,6 @@ export default function AISettings() {
}
}

const aiSettingsFormValues = watch();

const getAIResourcesCost = () => {
const vCPUs = `${
aiSettingsFormValues.compute.cpu / RESOURCE_VCPU_MULTIPLIER
Expand Down Expand Up @@ -240,37 +259,54 @@ export default function AISettings() {
className="flex flex-col"
>
<Box className="space-y-4">
<Box className="space-y-2">
<Box className="flex flex-row items-center space-x-2">
<Text className="text-lg font-semibold">Version</Text>
<Tooltip title="Version of the service to use.">
<InfoIcon
aria-label="Info"
className="h-4 w-4"
color="primary"
/>
</Tooltip>
</Box>
<ControlledAutocomplete
id="version"
name="version"
filterOptions={(options, state) => {
if (state.inputValue === ai?.version) {
return options;
{availableVersions.length > 0 && (
<Box className="space-y-2">
<Box className="flex flex-row items-center space-x-2">
<Text className="text-lg font-semibold">Version</Text>
<Tooltip title="Version of the service to use.">
<InfoIcon
aria-label="Info"
className="h-4 w-4"
color="primary"
/>
</Tooltip>
</Box>
<ControlledAutocomplete
id="version"
name="version"
autoHighlight
isOptionEqualToValue={() => false}
filterOptions={(options, { inputValue }) => {
const inputValueLower = inputValue.toLowerCase();
const matched = [];
const otherOptions = [];

options.forEach((option) => {
const optionLabelLower = option.label.toLowerCase();

if (optionLabelLower.startsWith(inputValueLower)) {
matched.push(option);
} else {
otherOptions.push(option);
}
});

const result = [...matched, ...otherOptions];

return result;
}}
fullWidth
className="col-span-4"
options={availableVersions}
error={!!formState.errors?.version?.message}
helperText={formState.errors?.version?.message}
showCustomOption="auto"
customOptionLabel={(value) =>
`Use custom value: "${value}"`
}
return filterOptions(options, state);
}}
fullWidth
className="col-span-4"
options={availableVersions}
error={!!formState.errors?.version?.message}
helperText={formState.errors?.version?.message}
showCustomOption="auto"
customOptionLabel={(value) =>
`Use custom value: "${value}"`
}
/>
</Box>
/>
</Box>
)}

<Box className="space-y-2">
<Box className="flex flex-row items-center space-x-2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { ControlledAutocomplete } from '@/components/form/ControlledAutocomplete
import { Form } from '@/components/form/Form';
import { SettingsContainer } from '@/components/layout/SettingsContainer';
import { ActivityIndicator } from '@/components/ui/v2/ActivityIndicator';
import { filterOptions } from '@/components/ui/v2/Autocomplete';
import { useCurrentWorkspaceAndProject } from '@/features/projects/common/hooks/useCurrentWorkspaceAndProject';
import {
GetAuthenticationSettingsDocument,
Expand Down Expand Up @@ -134,12 +133,26 @@ export default function AuthServiceVersionSettings() {
<ControlledAutocomplete
id="version"
name="version"
filterOptions={(options, state) => {
if (state.inputValue === version) {
return options;
}
autoHighlight
isOptionEqualToValue={() => false}
filterOptions={(options, { inputValue }) => {
const inputValueLower = inputValue.toLowerCase();
const matched = [];
const otherOptions = [];

return filterOptions(options, state);
options.forEach((option) => {
const optionLabelLower = option.label.toLowerCase();

if (optionLabelLower.startsWith(inputValueLower)) {
matched.push(option);
} else {
otherOptions.push(option);
}
});

const result = [...matched, ...otherOptions];

return result;
}}
fullWidth
className="lg:col-span-2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { ControlledAutocomplete } from '@/components/form/ControlledAutocomplete
import { Form } from '@/components/form/Form';
import { SettingsContainer } from '@/components/layout/SettingsContainer';
import { ActivityIndicator } from '@/components/ui/v2/ActivityIndicator';
import { filterOptions } from '@/components/ui/v2/Autocomplete';
import { useCurrentWorkspaceAndProject } from '@/features/projects/common/hooks/useCurrentWorkspaceAndProject';
import {
GetPostgresSettingsDocument,
Expand Down Expand Up @@ -136,12 +135,26 @@ export default function DatabaseServiceVersionSettings() {
<ControlledAutocomplete
id="version"
name="version"
filterOptions={(options, state) => {
if (state.inputValue === version) {
return options;
}
autoHighlight
isOptionEqualToValue={() => false}
filterOptions={(options, { inputValue }) => {
const inputValueLower = inputValue.toLowerCase();
const matched = [];
const otherOptions = [];

return filterOptions(options, state);
options.forEach((option) => {
const optionLabelLower = option.label.toLowerCase();

if (optionLabelLower.startsWith(inputValueLower)) {
matched.push(option);
} else {
otherOptions.push(option);
}
});

const result = [...matched, ...otherOptions];

return result;
}}
fullWidth
className="lg:col-span-2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { ControlledAutocomplete } from '@/components/form/ControlledAutocomplete
import { Form } from '@/components/form/Form';
import { SettingsContainer } from '@/components/layout/SettingsContainer';
import { ActivityIndicator } from '@/components/ui/v2/ActivityIndicator';
import { filterOptions } from '@/components/ui/v2/Autocomplete';
import { useCurrentWorkspaceAndProject } from '@/features/projects/common/hooks/useCurrentWorkspaceAndProject';
import {
GetHasuraSettingsDocument,
Expand Down Expand Up @@ -136,12 +135,26 @@ export default function HasuraServiceVersionSettings() {
<ControlledAutocomplete
id="version"
name="version"
filterOptions={(options, state) => {
if (state.inputValue === version) {
return options;
}
autoHighlight
isOptionEqualToValue={() => false}
filterOptions={(options, { inputValue }) => {
const inputValueLower = inputValue.toLowerCase();
const matched = [];
const otherOptions = [];

return filterOptions(options, state);
options.forEach((option) => {
const optionLabelLower = option.label.toLowerCase();

if (optionLabelLower.startsWith(inputValueLower)) {
matched.push(option);
} else {
otherOptions.push(option);
}
});

const result = [...matched, ...otherOptions];

return result;
}}
fullWidth
className="lg:col-span-2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { ControlledAutocomplete } from '@/components/form/ControlledAutocomplete
import { Form } from '@/components/form/Form';
import { SettingsContainer } from '@/components/layout/SettingsContainer';
import { ActivityIndicator } from '@/components/ui/v2/ActivityIndicator';
import { filterOptions } from '@/components/ui/v2/Autocomplete';
import { useCurrentWorkspaceAndProject } from '@/features/projects/common/hooks/useCurrentWorkspaceAndProject';
import {
GetStorageSettingsDocument,
Expand Down Expand Up @@ -136,12 +135,26 @@ export default function StorageServiceVersionSettings() {
<ControlledAutocomplete
id="version"
name="version"
filterOptions={(options, state) => {
if (state.inputValue === version) {
return options;
}
autoHighlight
isOptionEqualToValue={() => false}
filterOptions={(options, { inputValue }) => {
const inputValueLower = inputValue.toLowerCase();
const matched = [];
const otherOptions = [];

return filterOptions(options, state);
options.forEach((option) => {
const optionLabelLower = option.label.toLowerCase();

if (optionLabelLower.startsWith(inputValueLower)) {
matched.push(option);
} else {
otherOptions.push(option);
}
});

const result = [...matched, ...otherOptions];

return result;
}}
fullWidth
className="lg:col-span-2"
Expand Down
6 changes: 6 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @nhost/docs

## 0.7.5

### Patch Changes

- 7c977e714: chore: change `Allowed Roles` to `Default Allowed Roles`

## 0.7.4

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nhost/docs",
"version": "0.7.4",
"version": "0.7.5",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
Expand Down
6 changes: 6 additions & 0 deletions packages/vue/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @nhost/vue

## 2.0.2

### Patch Changes

- 184c341f0: fix: include `ServiceUrls` in `NhostVueClientConstructorParams` interface

## 2.0.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/vue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nhost/vue",
"version": "2.0.1",
"version": "2.0.2",
"description": "Nhost Vue library",
"license": "MIT",
"keywords": [
Expand Down

0 comments on commit 8816194

Please sign in to comment.