Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
SSHOC
sshoc-marketplace-frontend
Commits
9f100984
Commit
9f100984
authored
Mar 03, 2021
by
Stefan Probst
Browse files
fix: use category labels
parent
8624c359
Changes
10
Hide whitespace changes
Inline
Side-by-side
src/components/item/DatasetCreateForm/DatasetCreateForm.tsx
View file @
9f100984
import
{
useRouter
}
from
'
next/router
'
import
{
useQueryClient
}
from
'
react-query
'
import
{
DatasetCore
,
DatasetDto
,
useCreateDataset
}
from
'
@/api/sshoc
'
import
type
{
DatasetCore
,
DatasetDto
}
from
'
@/api/sshoc
'
import
{
useCreateDataset
,
useGetItemCategories
}
from
'
@/api/sshoc
'
import
type
{
ItemCategory
}
from
'
@/api/sshoc/types
'
import
{
ActorsFormSection
}
from
'
@/components/item/ActorsFormSection/ActorsFormSection
'
...
...
@@ -29,6 +28,9 @@ export interface ItemFormProps<T> {
export
function
ItemForm
(
props
:
ItemFormProps
<
ItemFormValues
>
):
JSX
.
Element
{
const
{
category
,
initialValues
}
=
props
const
categories
=
useGetItemCategories
()
const
categoryLabel
=
categories
.
data
?.[
category
]
??
category
const
useItemMutation
=
useCreateDataset
const
toast
=
useToast
()
...
...
@@ -37,7 +39,7 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
const
queryClient
=
useQueryClient
()
const
create
=
useItemMutation
({
onSuccess
(
data
:
DatasetDto
)
{
toast
.
success
(
`Successfully
upd
ated
${
category
}
.`
)
toast
.
success
(
`Successfully
cre
ated
${
category
Label
}
.`
)
queryClient
.
invalidateQueries
({
queryKey
:
[
'
itemSearch
'
],
...
...
@@ -52,7 +54,7 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
router
.
push
({
pathname
:
`/
${
data
.
category
}
/
${
data
.
persistentId
}
`
})
},
onError
()
{
toast
.
error
(
`Failed to
upd
ate
${
category
}
.`
)
toast
.
error
(
`Failed to
cre
ate
${
category
Label
}
.`
)
},
})
...
...
src/components/item/DatasetEditForm/DatasetEditForm.tsx
View file @
9f100984
import
{
useRouter
}
from
'
next/router
'
import
{
useQueryClient
}
from
'
react-query
'
import
type
{
DatasetCore
,
DatasetDto
}
from
'
@/api/sshoc
'
import
{
useUpdateDataset
}
from
'
@/api/sshoc
'
import
{
useGetItemCategories
,
useUpdateDataset
}
from
'
@/api/sshoc
'
import
type
{
ItemCategory
}
from
'
@/api/sshoc/types
'
import
{
ActorsFormSection
}
from
'
@/components/item/ActorsFormSection/ActorsFormSection
'
...
...
@@ -31,6 +30,9 @@ export interface ItemFormProps<T> {
export
function
ItemForm
(
props
:
ItemFormProps
<
ItemFormValues
>
):
JSX
.
Element
{
const
{
id
,
category
,
initialValues
}
=
props
const
categories
=
useGetItemCategories
()
const
categoryLabel
=
categories
.
data
?.[
category
]
??
category
const
useItemMutation
=
useUpdateDataset
const
toast
=
useToast
()
...
...
@@ -39,7 +41,7 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
const
queryClient
=
useQueryClient
()
const
create
=
useItemMutation
({
onSuccess
(
data
:
DatasetDto
)
{
toast
.
success
(
`Successfully updated
${
category
}
.`
)
toast
.
success
(
`Successfully updated
${
category
Label
}
.`
)
queryClient
.
invalidateQueries
({
queryKey
:
[
'
itemSearch
'
],
...
...
@@ -54,7 +56,7 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
router
.
push
({
pathname
:
`/
${
data
.
category
}
/
${
data
.
persistentId
}
`
})
},
onError
()
{
toast
.
error
(
`Failed to update
${
category
}
.`
)
toast
.
error
(
`Failed to update
${
category
Label
}
.`
)
},
})
...
...
src/components/item/PublicationCreateForm/PublicationCreateForm.tsx
View file @
9f100984
import
{
useRouter
}
from
'
next/router
'
import
{
useQueryClient
}
from
'
react-query
'
import
type
{
PublicationCore
,
PublicationDto
}
from
'
@/api/sshoc
'
import
{
useCreatePublication
}
from
'
@/api/sshoc
'
import
{
useGetItemCategories
,
useCreatePublication
}
from
'
@/api/sshoc
'
import
type
{
ItemCategory
}
from
'
@/api/sshoc/types
'
import
{
ActorsFormSection
}
from
'
@/components/item/ActorsFormSection/ActorsFormSection
'
...
...
@@ -29,6 +28,9 @@ export interface ItemFormProps<T> {
export
function
ItemForm
(
props
:
ItemFormProps
<
ItemFormValues
>
):
JSX
.
Element
{
const
{
category
,
initialValues
}
=
props
const
categories
=
useGetItemCategories
()
const
categoryLabel
=
categories
.
data
?.[
category
]
??
category
const
useItemMutation
=
useCreatePublication
const
toast
=
useToast
()
...
...
@@ -37,7 +39,7 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
const
queryClient
=
useQueryClient
()
const
create
=
useItemMutation
({
onSuccess
(
data
:
PublicationDto
)
{
toast
.
success
(
`Successfully
upd
ated
${
category
}
.`
)
toast
.
success
(
`Successfully
cre
ated
${
category
Label
}
.`
)
queryClient
.
invalidateQueries
({
queryKey
:
[
'
itemSearch
'
],
...
...
@@ -52,7 +54,7 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
router
.
push
({
pathname
:
`/
${
data
.
category
}
/
${
data
.
persistentId
}
`
})
},
onError
()
{
toast
.
error
(
`Failed to
upd
ate
${
category
}
.`
)
toast
.
error
(
`Failed to
cre
ate
${
category
Label
}
.`
)
},
})
...
...
src/components/item/PublicationEditForm/PublicationEditForm.tsx
View file @
9f100984
import
{
useRouter
}
from
'
next/router
'
import
{
useQueryClient
}
from
'
react-query
'
import
type
{
PublicationCore
,
PublicationDto
}
from
'
@/api/sshoc
'
import
{
useUpdatePublication
}
from
'
@/api/sshoc
'
import
{
useUpdatePublication
,
useGetItemCategories
}
from
'
@/api/sshoc
'
import
type
{
ItemCategory
}
from
'
@/api/sshoc/types
'
import
{
ActorsFormSection
}
from
'
@/components/item/ActorsFormSection/ActorsFormSection
'
...
...
@@ -31,6 +30,9 @@ export interface ItemFormProps<T> {
export
function
ItemForm
(
props
:
ItemFormProps
<
ItemFormValues
>
):
JSX
.
Element
{
const
{
id
,
category
,
initialValues
}
=
props
const
categories
=
useGetItemCategories
()
const
categoryLabel
=
categories
.
data
?.[
category
]
??
category
const
useItemMutation
=
useUpdatePublication
const
toast
=
useToast
()
...
...
@@ -39,7 +41,7 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
const
queryClient
=
useQueryClient
()
const
create
=
useItemMutation
({
onSuccess
(
data
:
PublicationDto
)
{
toast
.
success
(
`Successfully updated
${
category
}
.`
)
toast
.
success
(
`Successfully updated
${
category
Label
}
.`
)
queryClient
.
invalidateQueries
({
queryKey
:
[
'
itemSearch
'
],
...
...
@@ -54,7 +56,7 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
router
.
push
({
pathname
:
`/
${
data
.
category
}
/
${
data
.
persistentId
}
`
})
},
onError
()
{
toast
.
error
(
`Failed to update
${
category
}
.`
)
toast
.
error
(
`Failed to update
${
category
Label
}
.`
)
},
})
...
...
src/components/item/ToolCreateForm/ToolCreateForm.tsx
View file @
9f100984
import
{
useRouter
}
from
'
next/router
'
import
{
useQueryClient
}
from
'
react-query
'
import
type
{
ToolCore
,
ToolDto
}
from
'
@/api/sshoc
'
import
{
useCreateTool
}
from
'
@/api/sshoc
'
import
{
useCreateTool
,
useGetItemCategories
}
from
'
@/api/sshoc
'
import
type
{
ItemCategory
}
from
'
@/api/sshoc/types
'
import
{
ActorsFormSection
}
from
'
@/components/item/ActorsFormSection/ActorsFormSection
'
...
...
@@ -28,6 +27,9 @@ export interface ItemFormProps<T> {
export
function
ItemForm
(
props
:
ItemFormProps
<
ItemFormValues
>
):
JSX
.
Element
{
const
{
category
,
initialValues
}
=
props
const
categories
=
useGetItemCategories
()
const
categoryLabel
=
categories
.
data
?.[
category
]
??
category
const
useItemMutation
=
useCreateTool
const
toast
=
useToast
()
...
...
@@ -36,7 +38,7 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
const
queryClient
=
useQueryClient
()
const
create
=
useItemMutation
({
onSuccess
(
data
:
ToolDto
)
{
toast
.
success
(
`Successfully
upd
ated
${
category
}
.`
)
toast
.
success
(
`Successfully
cre
ated
${
category
Label
}
.`
)
queryClient
.
invalidateQueries
({
queryKey
:
[
'
itemSearch
'
],
...
...
@@ -51,7 +53,7 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
router
.
push
({
pathname
:
`/
${
data
.
category
}
/
${
data
.
persistentId
}
`
})
},
onError
()
{
toast
.
error
(
`Failed to
upd
ate
${
category
}
.`
)
toast
.
error
(
`Failed to
cre
ate
${
category
Label
}
.`
)
},
})
...
...
src/components/item/ToolEditForm/ToolEditForm.tsx
View file @
9f100984
import
{
useRouter
}
from
'
next/router
'
import
{
useQueryClient
}
from
'
react-query
'
import
type
{
ToolCore
,
ToolDto
}
from
'
@/api/sshoc
'
import
{
useUpdateTool
}
from
'
@/api/sshoc
'
import
{
useUpdateTool
,
useGetItemCategories
}
from
'
@/api/sshoc
'
import
type
{
ItemCategory
}
from
'
@/api/sshoc/types
'
import
{
ActorsFormSection
}
from
'
@/components/item/ActorsFormSection/ActorsFormSection
'
...
...
@@ -30,6 +29,9 @@ export interface ItemFormProps<T> {
export
function
ItemForm
(
props
:
ItemFormProps
<
ItemFormValues
>
):
JSX
.
Element
{
const
{
id
,
category
,
initialValues
}
=
props
const
categories
=
useGetItemCategories
()
const
categoryLabel
=
categories
.
data
?.[
category
]
??
category
const
useItemMutation
=
useUpdateTool
const
toast
=
useToast
()
...
...
@@ -38,7 +40,7 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
const
queryClient
=
useQueryClient
()
const
create
=
useItemMutation
({
onSuccess
(
data
:
ToolDto
)
{
toast
.
success
(
`Successfully updated
${
category
}
.`
)
toast
.
success
(
`Successfully updated
${
category
Label
}
.`
)
queryClient
.
invalidateQueries
({
queryKey
:
[
'
itemSearch
'
],
...
...
@@ -53,7 +55,7 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
router
.
push
({
pathname
:
`/
${
data
.
category
}
/
${
data
.
persistentId
}
`
})
},
onError
()
{
toast
.
error
(
`Failed to update
${
category
}
.`
)
toast
.
error
(
`Failed to update
${
category
Label
}
.`
)
},
})
...
...
src/components/item/TrainingMaterialCreateForm/TrainingMaterialCreateForm.tsx
View file @
9f100984
import
{
useRouter
}
from
'
next/router
'
import
{
useQueryClient
}
from
'
react-query
'
import
type
{
TrainingMaterialCore
,
TrainingMaterialDto
}
from
'
@/api/sshoc
'
import
{
useCreateTrainingMaterial
}
from
'
@/api/sshoc
'
import
{
useCreateTrainingMaterial
,
useGetItemCategories
}
from
'
@/api/sshoc
'
import
type
{
ItemCategory
}
from
'
@/api/sshoc/types
'
import
{
ActorsFormSection
}
from
'
@/components/item/ActorsFormSection/ActorsFormSection
'
...
...
@@ -28,6 +27,9 @@ export interface ItemFormProps<T> {
export
function
ItemForm
(
props
:
ItemFormProps
<
ItemFormValues
>
):
JSX
.
Element
{
const
{
category
,
initialValues
}
=
props
const
categories
=
useGetItemCategories
()
const
categoryLabel
=
categories
.
data
?.[
category
]
??
category
const
useItemMutation
=
useCreateTrainingMaterial
const
toast
=
useToast
()
...
...
@@ -36,7 +38,7 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
const
queryClient
=
useQueryClient
()
const
create
=
useItemMutation
({
onSuccess
(
data
:
TrainingMaterialDto
)
{
toast
.
success
(
`Successfully
upd
ated
${
category
}
.`
)
toast
.
success
(
`Successfully
cre
ated
${
category
Label
}
.`
)
queryClient
.
invalidateQueries
({
queryKey
:
[
'
itemSearch
'
],
...
...
@@ -51,7 +53,7 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
router
.
push
({
pathname
:
`/
${
data
.
category
}
/
${
data
.
persistentId
}
`
})
},
onError
()
{
toast
.
error
(
`Failed to
upd
ate
${
category
}
.`
)
toast
.
error
(
`Failed to
cre
ate
${
category
Label
}
.`
)
},
})
...
...
src/components/item/TrainingMaterialEditForm/TrainingMaterialEditForm.tsx
View file @
9f100984
import
{
useRouter
}
from
'
next/router
'
import
{
useQueryClient
}
from
'
react-query
'
import
type
{
TrainingMaterialCore
,
TrainingMaterialDto
}
from
'
@/api/sshoc
'
import
{
useUpdateTrainingMaterial
}
from
'
@/api/sshoc
'
import
{
useUpdateTrainingMaterial
,
useGetItemCategories
}
from
'
@/api/sshoc
'
import
type
{
ItemCategory
}
from
'
@/api/sshoc/types
'
import
{
ActorsFormSection
}
from
'
@/components/item/ActorsFormSection/ActorsFormSection
'
...
...
@@ -30,6 +29,9 @@ export interface ItemFormProps<T> {
export
function
ItemForm
(
props
:
ItemFormProps
<
ItemFormValues
>
):
JSX
.
Element
{
const
{
id
,
category
,
initialValues
}
=
props
const
categories
=
useGetItemCategories
()
const
categoryLabel
=
categories
.
data
?.[
category
]
??
category
const
useItemMutation
=
useUpdateTrainingMaterial
const
toast
=
useToast
()
...
...
@@ -38,7 +40,7 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
const
queryClient
=
useQueryClient
()
const
create
=
useItemMutation
({
onSuccess
(
data
:
TrainingMaterialDto
)
{
toast
.
success
(
`Successfully updated
${
category
}
.`
)
toast
.
success
(
`Successfully updated
${
category
Label
}
.`
)
queryClient
.
invalidateQueries
({
queryKey
:
[
'
itemSearch
'
],
...
...
@@ -53,7 +55,7 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
router
.
push
({
pathname
:
`/
${
data
.
category
}
/
${
data
.
persistentId
}
`
})
},
onError
()
{
toast
.
error
(
`Failed to update
${
category
}
.`
)
toast
.
error
(
`Failed to update
${
category
Label
}
.`
)
},
})
...
...
src/components/item/WorkflowCreateForm/WorkflowCreateForm.tsx
View file @
9f100984
import
{
useRouter
}
from
'
next/router
'
import
{
useQueryClient
}
from
'
react-query
'
import
type
{
WorkflowCore
,
WorkflowDto
}
from
'
@/api/sshoc
'
import
{
useCreateWorkflow
}
from
'
@/api/sshoc
'
import
{
useCreateWorkflow
,
useGetItemCategories
}
from
'
@/api/sshoc
'
import
type
{
ItemCategory
}
from
'
@/api/sshoc/types
'
import
{
ActorsFormSection
}
from
'
@/components/item/ActorsFormSection/ActorsFormSection
'
...
...
@@ -28,6 +27,9 @@ export interface ItemFormProps<T> {
export
function
ItemForm
(
props
:
ItemFormProps
<
ItemFormValues
>
):
JSX
.
Element
{
const
{
category
,
initialValues
}
=
props
const
categories
=
useGetItemCategories
()
const
categoryLabel
=
categories
.
data
?.[
category
]
??
category
const
useItemMutation
=
useCreateWorkflow
const
toast
=
useToast
()
...
...
@@ -36,7 +38,7 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
const
queryClient
=
useQueryClient
()
const
create
=
useItemMutation
({
onSuccess
(
data
:
WorkflowDto
)
{
toast
.
success
(
`Successfully
upd
ated
${
category
}
.`
)
toast
.
success
(
`Successfully
cre
ated
${
category
Label
}
.`
)
queryClient
.
invalidateQueries
({
queryKey
:
[
'
itemSearch
'
],
...
...
@@ -51,7 +53,7 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
router
.
push
({
pathname
:
`/
${
data
.
category
}
/
${
data
.
persistentId
}
`
})
},
onError
()
{
toast
.
error
(
`Failed to
upd
ate
${
category
}
.`
)
toast
.
error
(
`Failed to
cre
ate
${
category
Label
}
.`
)
},
})
...
...
src/components/item/WorkflowEditForm/WorkflowEditForm.tsx
View file @
9f100984
import
{
useRouter
}
from
'
next/router
'
import
{
useQueryClient
}
from
'
react-query
'
import
type
{
WorkflowCore
,
WorkflowDto
}
from
'
@/api/sshoc
'
import
{
useUpdateWorkflow
}
from
'
@/api/sshoc
'
import
{
useUpdateWorkflow
,
useGetItemCategories
}
from
'
@/api/sshoc
'
import
type
{
ItemCategory
}
from
'
@/api/sshoc/types
'
import
{
ActorsFormSection
}
from
'
@/components/item/ActorsFormSection/ActorsFormSection
'
...
...
@@ -30,6 +29,9 @@ export interface ItemFormProps<T> {
export
function
ItemForm
(
props
:
ItemFormProps
<
ItemFormValues
>
):
JSX
.
Element
{
const
{
id
,
category
,
initialValues
}
=
props
const
categories
=
useGetItemCategories
()
const
categoryLabel
=
categories
.
data
?.[
category
]
??
category
const
useItemMutation
=
useUpdateWorkflow
const
toast
=
useToast
()
...
...
@@ -38,7 +40,7 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
const
queryClient
=
useQueryClient
()
const
create
=
useItemMutation
({
onSuccess
(
data
:
WorkflowDto
)
{
toast
.
success
(
`Successfully updated
${
category
}
.`
)
toast
.
success
(
`Successfully updated
${
category
Label
}
.`
)
queryClient
.
invalidateQueries
({
queryKey
:
[
'
itemSearch
'
],
...
...
@@ -53,7 +55,7 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
router
.
push
({
pathname
:
`/
${
data
.
category
}
/
${
data
.
persistentId
}
`
})
},
onError
()
{
toast
.
error
(
`Failed to update
${
category
}
.`
)
toast
.
error
(
`Failed to update
${
category
Label
}
.`
)
},
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment