Compare commits

..

8 Commits

Author SHA1 Message Date
Nuno Pato
c22b2621ba Merge pull request #1661 from nhost/changeset-release/main
chore: update versions
2023-02-23 20:33:34 -01:00
github-actions[bot]
726746c4d3 chore: update versions 2023-02-23 19:19:03 +00:00
Nuno Pato
c431570783 Merge pull request #1662 from nhost/fix/file-upload
fix(hasura-storage-js): fix forbidden error
2023-02-23 18:17:47 -01:00
Szilárd Dóró
445d8ef449 fix(hasura-storage-js): fix forbidden error 2023-02-23 18:16:22 +01:00
Szilárd Dóró
0f4ea18e42 Merge pull request #1655 from nhost/feat/auth-storage-permissions
fix(dashboard): allow permission editing for auth and storage schemas
2023-02-23 15:22:05 +01:00
Szilárd Dóró
dae7c5d517 Merge pull request #1660 from nhost/fix/user-creation-content-type
fix(dashboard): set correct Content-Type for user creation
2023-02-23 14:38:16 +01:00
Szilárd Dóró
f673adea00 fix(dashboard): set correct Content-Type for user creation 2023-02-23 12:50:00 +01:00
Szilárd Dóró
0368663dea fix(dashboard): allow permission editing for auth and storage schemas
fixes #1555
2023-02-22 19:59:20 +01:00
46 changed files with 317 additions and 116 deletions

View File

@@ -1,5 +1,18 @@
# @nhost/dashboard
## 0.11.17
### Patch Changes
- f673adea: fix(dashboard): set correct Content-Type for user creation
- 445d8ef4: chore(deps): bump `@nhost/react-apollo` to 5.0.4
- 445d8ef4: chore(deps): bump `@nhost/nextjs` to 1.13.9
- 0368663d: fix(dashboard): allow permission editing for auth and storage schemas
- Updated dependencies [445d8ef4]
- Updated dependencies [445d8ef4]
- @nhost/react-apollo@5.0.4
- @nhost/nextjs@1.13.9
## 0.11.16
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/dashboard",
"version": "0.11.16",
"version": "0.11.17",
"private": true,
"scripts": {
"preinstall": "npx only-allow pnpm",

View File

@@ -52,7 +52,9 @@ function ControlledAutocomplete(
return (
<Autocomplete
inputValue={typeof field.value === 'string' ? field.value : undefined}
inputValue={
typeof field.value !== 'object' ? field.value.toString() : undefined
}
{...props}
{...field}
ref={mergeRefs([field.ref, ref])}

View File

@@ -328,53 +328,50 @@ function DataBrowserSidebarContent({
className="group"
key={tablePath}
secondaryAction={
!isSelectedSchemaLocked && (
<Dropdown.Root
id="table-management-menu"
onOpen={() => setSidebarMenuTable(tablePath)}
onClose={() => setSidebarMenuTable(undefined)}
<Dropdown.Root
id="table-management-menu"
onOpen={() => setSidebarMenuTable(tablePath)}
onClose={() => setSidebarMenuTable(undefined)}
>
<Dropdown.Trigger
asChild
hideChevron
disabled={tablePath === removableTable}
>
<Dropdown.Trigger
asChild
hideChevron
disabled={tablePath === removableTable}
<IconButton
variant="borderless"
color={isSelected ? 'primary' : 'secondary'}
className={twMerge(
!isSelected &&
'opacity-0 group-focus-within:opacity-100 group-hover:opacity-100 group-active:opacity-100',
)}
>
<IconButton
variant="borderless"
color={isSelected ? 'primary' : 'secondary'}
className={twMerge(
!isSelected &&
'opacity-0 group-focus-within:opacity-100 group-hover:opacity-100 group-active:opacity-100',
)}
<DotsHorizontalIcon />
</IconButton>
</Dropdown.Trigger>
<Dropdown.Content menu PaperProps={{ className: 'w-52' }}>
{isGitHubConnected ? (
<Dropdown.Item
className="grid grid-flow-col items-center gap-2 p-2 text-sm+ font-medium"
onClick={() =>
handleEditPermissionClick(
table.table_schema,
table.table_name,
true,
)
}
>
<DotsHorizontalIcon />
</IconButton>
</Dropdown.Trigger>
<UsersIcon
className="h-4 w-4"
sx={{ color: 'text.secondary' }}
/>
<Dropdown.Content
menu
PaperProps={{ className: 'w-52' }}
>
{isGitHubConnected ? (
<Dropdown.Item
className="grid grid-flow-col items-center gap-2 p-2 text-sm+ font-medium"
onClick={() =>
handleEditPermissionClick(
table.table_schema,
table.table_name,
true,
)
}
>
<UsersIcon
className="h-4 w-4"
sx={{ color: 'text.secondary' }}
/>
<span>View Permissions</span>
</Dropdown.Item>
) : (
[
<span>View Permissions</span>
</Dropdown.Item>
) : (
[
!isSelectedSchemaLocked && (
<Dropdown.Item
key="edit-table"
className="grid grid-flow-col items-center gap-2 p-2 text-sm+ font-medium"
@@ -400,32 +397,38 @@ function DataBrowserSidebarContent({
/>
<span>Edit Table</span>
</Dropdown.Item>,
</Dropdown.Item>
),
!isSelectedSchemaLocked && (
<Divider
key="edit-table-separator"
component="li"
/>,
<Dropdown.Item
key="edit-permissions"
className="grid grid-flow-col items-center gap-2 p-2 text-sm+ font-medium"
onClick={() =>
handleEditPermissionClick(
table.table_schema,
table.table_name,
)
}
>
<UsersIcon
className="h-4 w-4"
sx={{ color: 'text.secondary' }}
/>
/>
),
<Dropdown.Item
key="edit-permissions"
className="grid grid-flow-col items-center gap-2 p-2 text-sm+ font-medium"
onClick={() =>
handleEditPermissionClick(
table.table_schema,
table.table_name,
)
}
>
<UsersIcon
className="h-4 w-4"
sx={{ color: 'text.secondary' }}
/>
<span>Edit Permissions</span>
</Dropdown.Item>,
<span>Edit Permissions</span>
</Dropdown.Item>,
!isSelectedSchemaLocked && (
<Divider
key="edit-permissions-separator"
component="li"
/>,
/>
),
!isSelectedSchemaLocked && (
<Dropdown.Item
key="delete-table"
className="grid grid-flow-col items-center gap-2 p-2 text-sm+ font-medium"
@@ -443,12 +446,12 @@ function DataBrowserSidebarContent({
/>
<span>Delete Table</span>
</Dropdown.Item>,
]
)}
</Dropdown.Content>
</Dropdown.Root>
)
</Dropdown.Item>
),
]
)}
</Dropdown.Content>
</Dropdown.Root>
}
>
<ListItem.Button

View File

@@ -245,7 +245,7 @@ export default function RolePermissionEditorForm({
: permission?.check,
backend_only: values.backendOnly,
computed_fields:
permission?.computed_fields.length > 0
permission?.computed_fields?.length > 0
? permission?.computed_fields
: null,
},

View File

@@ -6,6 +6,7 @@ import Input from '@/ui/v2/Input';
import Radio from '@/ui/v2/Radio';
import RadioGroup from '@/ui/v2/RadioGroup';
import Text from '@/ui/v2/Text';
import type { FocusEvent } from 'react';
import { useState } from 'react';
import { useFormContext } from 'react-hook-form';
import PermissionSettingsSection from './PermissionSettingsSection';
@@ -130,7 +131,13 @@ export default function RowPermissionsSection({
{action === 'select' && (
<Input
{...register('limit')}
{...register('limit', {
onBlur: (event: FocusEvent<HTMLInputElement>) => {
if (!event.target.value) {
setValue('limit', null);
}
},
})}
disabled={disabled}
id="limit"
type="number"

View File

@@ -43,7 +43,10 @@ const baseValidationSchema = Yup.object().shape({
});
const selectValidationSchema = baseValidationSchema.shape({
limit: Yup.number().min(0, 'Limit must not be negative.').nullable(true),
limit: Yup.number()
.label('Limit')
.min(0, 'Limit must not be negative.')
.nullable(true),
allowAggregations: Yup.boolean().nullable(true),
queryRootFields: Yup.array().of(Yup.string()).nullable(true),
subscriptionRootFields: Yup.array().of(Yup.string()).nullable(true),

View File

@@ -6,6 +6,7 @@ import ColumnAutocomplete from '@/components/dataBrowser/ColumnAutocomplete';
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
import type { HasuraOperator } from '@/types/dataBrowser';
import ActivityIndicator from '@/ui/v2/ActivityIndicator';
import type { AutocompleteOption } from '@/ui/v2/Autocomplete';
import type { InputProps } from '@/ui/v2/Input';
import { inputClasses } from '@/ui/v2/Input';
import Option from '@/ui/v2/Option';
@@ -211,11 +212,13 @@ export default function RuleValueInput({
<ControlledAutocomplete
disabled={disabled}
freeSolo={!isHasuraInput}
autoSelect={!isHasuraInput}
autoHighlight={isHasuraInput}
isOptionEqualToValue={(option, value) => {
if (typeof value === 'string') {
return option.value.toLowerCase() === (value as string).toLowerCase();
isOptionEqualToValue={(
option,
value: string | number | AutocompleteOption<string>,
) => {
if (typeof value !== 'object') {
return option.value.toLowerCase() === value?.toString().toLowerCase();
}
return option.value.toLowerCase() === value.value.toLowerCase();

View File

@@ -222,9 +222,9 @@ function Autocomplete(
inputValue: inputValue || '',
getOptionLabel: props.getOptionLabel
? props.getOptionLabel
: (option) => {
if (typeof option === 'string') {
return option;
: (option: string | number | AutocompleteOption<string>) => {
if (typeof option !== 'object') {
return option.toString();
}
return option.label ?? option.dropdownLabel;
@@ -284,33 +284,46 @@ function Autocomplete(
}}
PopperComponent={AutocompletePopper}
popupIcon={<ChevronDownIcon sx={{ width: 12, height: 12 }} />}
getOptionLabel={(option) => {
if (typeof option === 'string') {
return option;
getOptionLabel={(
option: string | number | AutocompleteOption<string>,
) => {
if (!option) {
return '';
}
if (typeof option !== 'object') {
return option.toString();
}
return option.label ?? option.dropdownLabel;
}}
isOptionEqualToValue={(option, value) => {
isOptionEqualToValue={(
option,
value: string | number | AutocompleteOption<string>,
) => {
if (!value) {
return false;
}
if (typeof value === 'string') {
return option.value === value;
if (typeof value !== 'object') {
return option.value.toString() === value.toString();
}
return option.value === value.value && option.custom === value.custom;
}}
renderTags={(value, getTagProps) =>
value.map((option, index) => (
<StyledTag
deleteIcon={<XIcon />}
size="small"
label={typeof option === 'string' ? option : option.value}
{...getTagProps({ index })}
/>
))
value.map(
(option: string | number | AutocompleteOption<string>, index) => (
<StyledTag
deleteIcon={<XIcon />}
size="small"
label={
typeof option !== 'object' ? option.toString() : option.value
}
{...getTagProps({ index })}
/>
),
)
}
renderGroup={({ group, key, children }) =>
group ? (
@@ -323,9 +336,12 @@ function Autocomplete(
<div key={key}>{children}</div>
)
}
renderOption={(optionProps, option) => {
if (typeof option === 'string') {
return <OptionBase {...optionProps}>{option}</OptionBase>;
renderOption={(
optionProps,
option: string | number | AutocompleteOption<string>,
) => {
if (typeof option !== 'object') {
return <OptionBase {...optionProps}>{option.toString()}</OptionBase>;
}
return (

View File

@@ -81,6 +81,7 @@ export default function CreateUserForm({
await toast.promise(
fetch(signUpUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email, password }),
}).then(async (res) => {
const data = await res.json();

View File

@@ -1,5 +1,17 @@
# @nhost-examples/codegen-react-apollo
## 0.1.6
### Patch Changes
- 445d8ef4: chore(deps): bump `@nhost/react` to 2.0.3
- 445d8ef4: chore(deps): bump `@nhost/react-apollo` to 5.0.4
- Updated dependencies [445d8ef4]
- Updated dependencies [445d8ef4]
- Updated dependencies [445d8ef4]
- @nhost/react-apollo@5.0.4
- @nhost/react@2.0.3
## 0.1.5
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost-examples/codegen-react-apollo",
"version": "0.1.5",
"version": "0.1.6",
"private": true,
"scripts": {
"codegen": "graphql-codegen",

View File

@@ -1,5 +1,13 @@
# @nhost-examples/codegen-react-query
## 0.1.6
### Patch Changes
- 445d8ef4: chore(deps): bump `@nhost/react` to 2.0.3
- Updated dependencies [445d8ef4]
- @nhost/react@2.0.3
## 0.1.5
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost-examples/codegen-react-query",
"version": "0.1.5",
"version": "0.1.6",
"private": true,
"scripts": {
"codegen": "graphql-codegen",

View File

@@ -1,5 +1,15 @@
# @nhost-examples/react-urql
## 0.0.3
### Patch Changes
- 445d8ef4: chore(deps): bump `@nhost/react` to 2.0.3
- Updated dependencies [445d8ef4]
- Updated dependencies [445d8ef4]
- @nhost/react-urql@2.0.3
- @nhost/react@2.0.3
## 0.0.2
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "@nhost-examples/codegen-react-urql",
"private": true,
"version": "0.0.2",
"version": "0.0.3",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",

View File

@@ -1,5 +1,13 @@
# @nhost-examples/multi-tenant-one-to-many
## 1.0.2
### Patch Changes
- 445d8ef4: chore(deps): bump `@nhost/nhost-js` version to 2.0.3
- Updated dependencies [445d8ef4]
- @nhost/nhost-js@2.0.3
## 1.0.1
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "@nhost-examples/multi-tenant-one-to-many",
"private": true,
"version": "1.0.1",
"version": "1.0.2",
"description": "",
"main": "index.js",
"scripts": {},

View File

@@ -1,5 +1,19 @@
# @nhost-examples/nextjs
## 0.1.6
### Patch Changes
- 445d8ef4: chore(deps): bump `@nhost/react` to 2.0.3
- 445d8ef4: chore(deps): bump `@nhost/react-apollo` to 5.0.4
- 445d8ef4: chore(deps): bump `@nhost/nextjs` to 1.13.9
- Updated dependencies [445d8ef4]
- Updated dependencies [445d8ef4]
- Updated dependencies [445d8ef4]
- @nhost/react-apollo@5.0.4
- @nhost/nextjs@1.13.9
- @nhost/react@2.0.3
## 0.1.5
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost-examples/nextjs",
"version": "0.1.5",
"version": "0.1.6",
"private": true,
"scripts": {
"dev": "next dev",

View File

@@ -1,5 +1,17 @@
# @nhost-examples/react-apollo
## 0.1.8
### Patch Changes
- 445d8ef4: chore(deps): bump `@nhost/react` to 2.0.3
- 445d8ef4: chore(deps): bump `@nhost/react-apollo` to 5.0.4
- Updated dependencies [445d8ef4]
- Updated dependencies [445d8ef4]
- Updated dependencies [445d8ef4]
- @nhost/react-apollo@5.0.4
- @nhost/react@2.0.3
## 0.1.7
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost-examples/react-apollo",
"version": "0.1.7",
"version": "0.1.8",
"private": true,
"dependencies": {
"@apollo/client": "^3.6.9",

View File

@@ -1,5 +1,13 @@
# @nhost-examples/react-gqty
## 0.0.5
### Patch Changes
- 445d8ef4: chore(deps): bump `@nhost/react` to 2.0.3
- Updated dependencies [445d8ef4]
- @nhost/react@2.0.3
## 0.0.4
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "@nhost-examples/react-gqty",
"private": true,
"version": "0.0.4",
"version": "0.0.5",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,14 @@
# @nhost-examples/vue-apollo
## 0.0.6
### Patch Changes
- 445d8ef4: chore(deps): bump `@nhost/apollo` to 5.0.3
- Updated dependencies [445d8ef4]
- @nhost/apollo@5.0.3
- @nhost/vue@1.13.9
## 0.0.5
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "@nhost-examples/vue-apollo",
"private": true,
"version": "0.0.5",
"version": "0.0.6",
"scripts": {
"dev": "vite",
"build": "vite build",

View File

@@ -1,5 +1,14 @@
# @nhost-examples/vue-quickstart
## 0.0.5
### Patch Changes
- 445d8ef4: chore(deps): bump `@nhost/apollo` to 5.0.3
- Updated dependencies [445d8ef4]
- @nhost/apollo@5.0.3
- @nhost/vue@1.13.9
## 0.0.4
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost-examples/vue-quickstart",
"version": "0.0.4",
"version": "0.0.5",
"private": true,
"scripts": {
"build": "vite build",

View File

@@ -1,5 +1,13 @@
# @nhost/apollo
## 5.0.3
### Patch Changes
- 445d8ef4: chore(deps): bump `@nhost/nhost-js` version to 2.0.3
- Updated dependencies [445d8ef4]
- @nhost/nhost-js@2.0.3
## 5.0.2
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/apollo",
"version": "5.0.2",
"version": "5.0.3",
"description": "Nhost Apollo Client library",
"license": "MIT",
"keywords": [

View File

@@ -1,5 +1,15 @@
# @nhost/react-apollo
## 5.0.4
### Patch Changes
- 445d8ef4: chore(deps): bump `@nhost/react` to 2.0.3
- 445d8ef4: chore(deps): bump `@nhost/apollo` to 5.0.3
- Updated dependencies [445d8ef4]
- @nhost/apollo@5.0.3
- @nhost/react@2.0.3
## 5.0.3
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/react-apollo",
"version": "5.0.3",
"version": "5.0.4",
"description": "Nhost React Apollo client",
"license": "MIT",
"keywords": [

View File

@@ -1,5 +1,13 @@
# @nhost/react-urql
## 2.0.3
### Patch Changes
- 445d8ef4: chore(deps): bump `@nhost/react` to 2.0.3
- Updated dependencies [445d8ef4]
- @nhost/react@2.0.3
## 2.0.2
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/react-urql",
"version": "2.0.2",
"version": "2.0.3",
"description": "Nhost React URQL client",
"license": "MIT",
"keywords": [

View File

@@ -1,5 +1,11 @@
# @nhost/hasura-storage-js
## 2.0.1
### Patch Changes
- 445d8ef4: fix(hasura-storage-js): fix forbidden error when uploading
## 2.0.0
### Major Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/hasura-storage-js",
"version": "2.0.0",
"version": "2.0.1",
"description": "Hasura-storage client",
"license": "MIT",
"keywords": [

View File

@@ -28,7 +28,7 @@ export class HasuraStorageApi {
return fetchUpload(this.url, formData, {
accessToken: this.accessToken,
adminSecret: this.accessToken,
adminSecret: this.adminSecret,
bucketId: params.bucketId,
fileId: params.id,
name: params.name

View File

@@ -81,7 +81,6 @@ export const fetchUpload = async (
}
// * Browser environment: XMLHttpRequest is available
return new Promise((resolve) => {
console.log('NOOOOOOO')
let xhr = new XMLHttpRequest()
xhr.responseType = 'json'

View File

@@ -1,5 +1,13 @@
# @nhost/nextjs
## 1.13.9
### Patch Changes
- 445d8ef4: chore(deps): bump `@nhost/react` to 2.0.3
- Updated dependencies [445d8ef4]
- @nhost/react@2.0.3
## 1.13.8
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/nextjs",
"version": "1.13.8",
"version": "1.13.9",
"description": "Nhost NextJS library",
"license": "MIT",
"keywords": [

View File

@@ -1,5 +1,13 @@
# @nhost/nhost-js
## 2.0.3
### Patch Changes
- 445d8ef4: chore(nhost-js): bump `@nhost/hasura-storage-js` to 2.0.1
- Updated dependencies [445d8ef4]
- @nhost/hasura-storage-js@2.0.1
## 2.0.2
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/nhost-js",
"version": "2.0.2",
"version": "2.0.3",
"description": "Nhost JavaScript SDK",
"license": "MIT",
"keywords": [

View File

@@ -1,5 +1,13 @@
# @nhost/react
## 2.0.3
### Patch Changes
- 445d8ef4: chore(deps): bump `@nhost/nhost-js` version to 2.0.3
- Updated dependencies [445d8ef4]
- @nhost/nhost-js@2.0.3
## 2.0.2
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/react",
"version": "2.0.2",
"version": "2.0.3",
"description": "Nhost React library",
"license": "MIT",
"keywords": [

View File

@@ -1,5 +1,13 @@
# @nhost/vue
## 1.13.9
### Patch Changes
- 445d8ef4: chore(deps): bump `@nhost/nhost-js` version to 2.0.3
- Updated dependencies [445d8ef4]
- @nhost/nhost-js@2.0.3
## 1.13.8
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/vue",
"version": "1.13.8",
"version": "1.13.9",
"description": "Nhost Vue library",
"license": "MIT",
"keywords": [