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
a89421d9
Commit
a89421d9
authored
Apr 20, 2022
by
Stefan Probst
Browse files
fix: update edit button on item version page to draft workaround
parent
a2a3bcbc
Pipeline
#291219
passed with stages
in 13 minutes and 19 seconds
Changes
14
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
src/components/item/DatasetVersionControls.tsx
View file @
a89421d9
import
{
ItemVersionControls
}
from
'
@/components/item/ItemVersionControls
'
import
type
{
Dataset
}
from
'
@/data/sshoc/api/dataset
'
import
type
{
ItemStatus
}
from
'
@/data/sshoc/api/item
'
export
interface
DatasetVersionControlsProps
{
persistentId
:
Dataset
[
'
persistentId
'
]
status
:
ItemStatus
versionId
:
Dataset
[
'
id
'
]
}
export
function
DatasetVersionControls
(
props
:
DatasetVersionControlsProps
):
JSX
.
Element
{
const
{
persistentId
,
versionId
}
=
props
const
{
persistentId
,
status
,
versionId
}
=
props
return
(
<
ItemVersionControls
category
=
"dataset"
persistentId
=
{
persistentId
}
versionId
=
{
versionId
}
/>
<
ItemVersionControls
category
=
"dataset"
persistentId
=
{
persistentId
}
status
=
{
status
}
versionId
=
{
versionId
}
/>
)
}
src/components/item/ItemControls.tsx
View file @
a89421d9
...
...
@@ -93,10 +93,13 @@ function EditItemMenuButton(props: EditItemMenuButtonProps): JSX.Element {
)
:
null
}
{
draft
.
data
!=
null
&&
draft
.
data
.
status
===
'
draft
'
?
(
<
LinkButton
href
=
{
itemRoutes
.
ItemEditVersionPage
(
category
)({
persistentId
,
versionId
:
draft
.
data
.
id
,
})
}
href
=
{
itemRoutes
.
ItemEditVersionPage
(
category
)(
{
persistentId
,
versionId
:
draft
.
data
.
id
,
},
{
draft
:
true
},
)
}
color
=
"secondary"
size
=
"xs"
>
...
...
src/components/item/ItemVersionControls.tsx
View file @
a89421d9
...
...
@@ -2,7 +2,7 @@ import { useRouter } from 'next/router'
import
{
LinkButton
}
from
'
@/components/common/LinkButton
'
import
css
from
'
@/components/item/ItemVersionControls.module.css
'
import
type
{
Item
,
ItemCategory
}
from
'
@/data/sshoc/api/item
'
import
type
{
Item
,
ItemCategory
,
ItemStatus
}
from
'
@/data/sshoc/api/item
'
import
{
useDeleteDatasetVersion
}
from
'
@/data/sshoc/hooks/dataset
'
import
{
useDeletePublicationVersion
}
from
'
@/data/sshoc/hooks/publication
'
import
{
useDeleteToolVersion
}
from
'
@/data/sshoc/hooks/tool-or-service
'
...
...
@@ -18,11 +18,12 @@ import { Button } from '@/lib/core/ui/Button/Button'
export
interface
ItemVersionControlsProps
{
category
:
ItemCategory
persistentId
:
Item
[
'
persistentId
'
]
status
:
ItemStatus
versionId
:
Item
[
'
id
'
]
}
export
function
ItemVersionControls
(
props
:
ItemVersionControlsProps
):
JSX
.
Element
{
const
{
category
,
persistentId
,
versionId
}
=
props
const
{
category
,
persistentId
,
status
,
versionId
}
=
props
const
{
t
}
=
useI18n
<
'
common
'
>
()
...
...
@@ -30,11 +31,14 @@ export function ItemVersionControls(props: ItemVersionControlsProps): JSX.Elemen
<
AccessControl
>
<
div
className
=
{
css
[
'
container
'
]
}
>
<
LinkButton
href
=
{
itemRoutes
.
ItemEditVersionPage
(
category
)({
persistentId
,
versionId
})
}
href
=
{
itemRoutes
.
ItemEditVersionPage
(
category
)(
{
persistentId
,
versionId
},
{
draft
:
status
===
'
draft
'
?
true
:
undefined
},
)
}
color
=
"secondary"
size
=
"xs"
>
{
t
([
'
common
'
,
'
controls
'
,
'
edit
'
])
}
{
t
([
'
common
'
,
'
controls
'
,
'
edit
-version
'
])
}
</
LinkButton
>
<
LinkButton
...
...
src/components/item/PublicationVersionControls.tsx
View file @
a89421d9
import
{
ItemVersionControls
}
from
'
@/components/item/ItemVersionControls
'
import
type
{
ItemStatus
}
from
'
@/data/sshoc/api/item
'
import
type
{
Publication
}
from
'
@/data/sshoc/api/publication
'
export
interface
PublicationVersionControlsProps
{
persistentId
:
Publication
[
'
persistentId
'
]
status
:
ItemStatus
versionId
:
Publication
[
'
id
'
]
}
export
function
PublicationVersionControls
(
props
:
PublicationVersionControlsProps
):
JSX
.
Element
{
const
{
persistentId
,
versionId
}
=
props
const
{
persistentId
,
status
,
versionId
}
=
props
return
(
<
ItemVersionControls
category
=
"publication"
persistentId
=
{
persistentId
}
versionId
=
{
versionId
}
/>
<
ItemVersionControls
category
=
"publication"
persistentId
=
{
persistentId
}
status
=
{
status
}
versionId
=
{
versionId
}
/>
)
}
src/components/item/ToolOrServiceVersionControls.tsx
View file @
a89421d9
import
{
ItemVersionControls
}
from
'
@/components/item/ItemVersionControls
'
import
type
{
ItemStatus
}
from
'
@/data/sshoc/api/item
'
import
type
{
Tool
}
from
'
@/data/sshoc/api/tool-or-service
'
export
interface
ToolOrServiceVersionControlsProps
{
persistentId
:
Tool
[
'
persistentId
'
]
status
:
ItemStatus
versionId
:
Tool
[
'
id
'
]
}
export
function
ToolOrServiceVersionControls
(
props
:
ToolOrServiceVersionControlsProps
,
):
JSX
.
Element
{
const
{
persistentId
,
versionId
}
=
props
const
{
persistentId
,
status
,
versionId
}
=
props
return
(
<
ItemVersionControls
category
=
"tool-or-service"
persistentId
=
{
persistentId
}
status
=
{
status
}
versionId
=
{
versionId
}
/>
)
...
...
src/components/item/TrainingMaterialVersionControls.tsx
View file @
a89421d9
import
{
ItemVersionControls
}
from
'
@/components/item/ItemVersionControls
'
import
type
{
ItemStatus
}
from
'
@/data/sshoc/api/item
'
import
type
{
TrainingMaterial
}
from
'
@/data/sshoc/api/training-material
'
export
interface
TrainingMaterialVersionControlsProps
{
persistentId
:
TrainingMaterial
[
'
persistentId
'
]
status
:
ItemStatus
versionId
:
TrainingMaterial
[
'
id
'
]
}
export
function
TrainingMaterialVersionControls
(
props
:
TrainingMaterialVersionControlsProps
,
):
JSX
.
Element
{
const
{
persistentId
,
versionId
}
=
props
const
{
persistentId
,
status
,
versionId
}
=
props
return
(
<
ItemVersionControls
category
=
"training-material"
persistentId
=
{
persistentId
}
status
=
{
status
}
versionId
=
{
versionId
}
/>
)
...
...
src/components/item/WorkflowVersionControls.tsx
View file @
a89421d9
import
{
ItemVersionControls
}
from
'
@/components/item/ItemVersionControls
'
import
type
{
ItemStatus
}
from
'
@/data/sshoc/api/item
'
import
type
{
Workflow
}
from
'
@/data/sshoc/api/workflow
'
export
interface
WorkflowVersionControlsProps
{
persistentId
:
Workflow
[
'
persistentId
'
]
status
:
ItemStatus
versionId
:
Workflow
[
'
id
'
]
}
export
function
WorkflowVersionControls
(
props
:
WorkflowVersionControlsProps
):
JSX
.
Element
{
const
{
persistentId
,
versionId
}
=
props
const
{
persistentId
,
status
,
versionId
}
=
props
return
(
<
ItemVersionControls
category
=
"workflow"
persistentId
=
{
persistentId
}
versionId
=
{
versionId
}
/>
<
ItemVersionControls
category
=
"workflow"
persistentId
=
{
persistentId
}
status
=
{
status
}
versionId
=
{
versionId
}
/>
)
}
src/dictionaries/common/en.ts
View file @
a89421d9
...
...
@@ -246,6 +246,7 @@ export const dictionary: Dictionary = {
controls
:
{
history
:
'
History
'
,
edit
:
'
Edit
'
,
'
edit-version
'
:
'
Edit this version
'
,
'
edit-latest-draft
'
:
'
Edit latest draft
'
,
'
edit-latest-suggestion
'
:
'
Edit latest suggestion
'
,
delete
:
'
Delete
'
,
...
...
src/dictionaries/common/index.ts
View file @
a89421d9
...
...
@@ -225,6 +225,7 @@ export interface Dictionary {
controls: {
history: string
edit: string
'
edit
-
version
'
: string
'
edit
-
latest
-
draft
'
: string
'
edit
-
latest
-
suggestion
'
: string
delete: string
...
...
src/pages/dataset/[persistentId]/version/[versionId]/index.page.tsx
View file @
a89421d9
...
...
@@ -169,7 +169,11 @@ export default function DatasetVersionPage(props: DatasetVersionPage.Props): JSX
</
ItemTitle
>
</
ScreenHeader
>
<
ItemHeader
>
<
DatasetVersionControls
persistentId
=
{
dataset
.
persistentId
}
versionId
=
{
dataset
.
id
}
/>
<
DatasetVersionControls
persistentId
=
{
dataset
.
persistentId
}
status
=
{
dataset
.
status
}
versionId
=
{
dataset
.
id
}
/>
<
ItemDescription
description
=
{
dataset
.
description
}
/>
</
ItemHeader
>
<
ItemInfo
>
...
...
src/pages/publication/[persistentId]/version/[versionId]/index.page.tsx
View file @
a89421d9
...
...
@@ -169,6 +169,7 @@ export default function PublicationVersionPage(props: PublicationVersionPage.Pro
<
ItemHeader
>
<
PublicationVersionControls
persistentId
=
{
publication
.
persistentId
}
status
=
{
publication
.
status
}
versionId
=
{
publication
.
id
}
/>
<
ItemDescription
description
=
{
publication
.
description
}
/>
...
...
src/pages/tool-or-service/[persistentId]/version/[versionId]/index.page.tsx
View file @
a89421d9
...
...
@@ -171,6 +171,7 @@ export default function ToolOrServiceVersionPage(
<
ItemHeader
>
<
ToolOrServiceVersionControls
persistentId
=
{
toolOrService
.
persistentId
}
status
=
{
toolOrService
.
status
}
versionId
=
{
toolOrService
.
id
}
/>
<
ItemDescription
description
=
{
toolOrService
.
description
}
/>
...
...
src/pages/training-material/[persistentId]/version/[versionId]/index.page.tsx
View file @
a89421d9
...
...
@@ -176,6 +176,7 @@ export default function TrainingMaterialVersionPage(
<
ItemHeader
>
<
TrainingMaterialVersionControls
persistentId
=
{
trainingMaterial
.
persistentId
}
status
=
{
trainingMaterial
.
status
}
versionId
=
{
trainingMaterial
.
id
}
/>
<
ItemDescription
description
=
{
trainingMaterial
.
description
}
/>
...
...
src/pages/workflow/[persistentId]/version/[versionId]/index.page.tsx
View file @
a89421d9
...
...
@@ -167,7 +167,11 @@ export default function WorkflowVersionPage(props: WorkflowVersionPage.Props): J
</
ItemTitle
>
</
ScreenHeader
>
<
ItemHeader
>
<
WorkflowVersionControls
persistentId
=
{
workflow
.
persistentId
}
versionId
=
{
workflow
.
id
}
/>
<
WorkflowVersionControls
persistentId
=
{
workflow
.
persistentId
}
status
=
{
workflow
.
status
}
versionId
=
{
workflow
.
id
}
/>
<
ItemDescription
description
=
{
workflow
.
description
}
/>
</
ItemHeader
>
<
ItemInfo
>
...
...
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