Dear Gitlab users, due to maintenance reasons, Gitlab will not be available on Thursday 30.09.2021 from 5:00 pm to approximately 5:30 pm.

Commit b28a9410 authored by Stefan Probst's avatar Stefan Probst
Browse files

feat: add item draft screens

parent dc090d27
Pipeline #207509 passed with stages
in 10 minutes and 51 seconds
......@@ -55,10 +55,10 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
onSuccess(data: DatasetDto) {
toast.success(
`Successfully ${
isAllowedToPublish
? 'published'
: data.status === 'draft'
data.status === 'draft'
? 'saved as draft'
: isAllowedToPublish
? 'published'
: 'submitted'
} ${categoryLabel}.`,
)
......@@ -72,6 +72,11 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
// queryClient.invalidateQueries({
// queryKey: ['getDataset', { id: data.persistentId }],
// })
if (data.status === 'draft') {
queryClient.invalidateQueries({
queryKey: ['getMyDraftItems'],
})
}
/**
* if the item is published (i.e. submitted as admin), redirect to details page.
......
......@@ -57,10 +57,10 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
onSuccess(data: DatasetDto) {
toast.success(
`Successfully ${
isAllowedToPublish
? 'published'
: data.status === 'draft'
data.status === 'draft'
? 'saved as draft'
: isAllowedToPublish
? 'published'
: 'submitted'
} ${categoryLabel}.`,
)
......@@ -74,6 +74,11 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
queryClient.invalidateQueries({
queryKey: ['getDataset', { id: data.persistentId }],
})
if (data.status === 'draft') {
queryClient.invalidateQueries({
queryKey: ['getMyDraftItems'],
})
}
/**
* if the item is published (i.e. submitted as admin), redirect to details page.
......
......@@ -55,10 +55,10 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
onSuccess(data: PublicationDto) {
toast.success(
`Successfully ${
isAllowedToPublish
? 'published'
: data.status === 'draft'
data.status === 'draft'
? 'saved as draft'
: isAllowedToPublish
? 'published'
: 'submitted'
} ${categoryLabel}.`,
)
......@@ -72,6 +72,11 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
// queryClient.invalidateQueries({
// queryKey: ['getPublication', { id: data.persistentId }],
// })
if (data.status === 'draft') {
queryClient.invalidateQueries({
queryKey: ['getMyDraftItems'],
})
}
/**
* if the item is published (i.e. submitted as admin), redirect to details page.
......
......@@ -57,10 +57,10 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
onSuccess(data: PublicationDto) {
toast.success(
`Successfully ${
isAllowedToPublish
? 'published'
: data.status === 'draft'
data.status === 'draft'
? 'saved as draft'
: isAllowedToPublish
? 'published'
: 'submitted'
} ${categoryLabel}.`,
)
......@@ -74,6 +74,11 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
queryClient.invalidateQueries({
queryKey: ['getPublication', { id: data.persistentId }],
})
if (data.status === 'draft') {
queryClient.invalidateQueries({
queryKey: ['getMyDraftItems'],
})
}
/**
* if the item is published (i.e. submitted as admin), redirect to details page.
......
......@@ -53,10 +53,10 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
onSuccess(data: ToolDto) {
toast.success(
`Successfully ${
isAllowedToPublish
? 'published'
: data.status === 'draft'
data.status === 'draft'
? 'saved as draft'
: isAllowedToPublish
? 'published'
: 'submitted'
} ${categoryLabel}.`,
)
......@@ -70,6 +70,11 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
// queryClient.invalidateQueries({
// queryKey: ['getTool', { id: data.persistentId }],
// })
if (data.status === 'draft') {
queryClient.invalidateQueries({
queryKey: ['getMyDraftItems'],
})
}
/**
* if the item is published (i.e. submitted as admin), redirect to details page.
......
......@@ -55,10 +55,10 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
onSuccess(data: ToolDto) {
toast.success(
`Successfully ${
isAllowedToPublish
? 'published'
: data.status === 'draft'
data.status === 'draft'
? 'saved as draft'
: isAllowedToPublish
? 'published'
: 'submitted'
} ${categoryLabel}.`,
)
......@@ -72,6 +72,11 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
queryClient.invalidateQueries({
queryKey: ['getTool', { id: data.persistentId }],
})
if (data.status === 'draft') {
queryClient.invalidateQueries({
queryKey: ['getMyDraftItems'],
})
}
/**
* if the item is published (i.e. submitted as admin), redirect to details page.
......
......@@ -53,10 +53,10 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
onSuccess(data: TrainingMaterialDto) {
toast.success(
`Successfully ${
isAllowedToPublish
? 'published'
: data.status === 'draft'
data.status === 'draft'
? 'saved as draft'
: isAllowedToPublish
? 'published'
: 'submitted'
} ${categoryLabel}.`,
)
......@@ -70,6 +70,11 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
// queryClient.invalidateQueries({
// queryKey: ['getTrainingMaterial', { id: data.persistentId }],
// })
if (data.status === 'draft') {
queryClient.invalidateQueries({
queryKey: ['getMyDraftItems'],
})
}
/**
* if the item is published (i.e. submitted as admin), redirect to details page.
......
......@@ -55,10 +55,10 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
onSuccess(data: TrainingMaterialDto) {
toast.success(
`Successfully ${
isAllowedToPublish
? 'published'
: data.status === 'draft'
data.status === 'draft'
? 'saved as draft'
: isAllowedToPublish
? 'published'
: 'submitted'
} ${categoryLabel}.`,
)
......@@ -72,6 +72,11 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
queryClient.invalidateQueries({
queryKey: ['getTrainingMaterial', { id: data.persistentId }],
})
if (data.status === 'draft') {
queryClient.invalidateQueries({
queryKey: ['getMyDraftItems'],
})
}
/**
* if the item is published (i.e. submitted as admin), redirect to details page.
......
......@@ -99,10 +99,10 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
function onSuccess(data: WorkflowDto) {
toast.success(
`Successfully ${
isAllowedToPublish
? 'published'
: data.status === 'draft'
data.status === 'draft'
? 'saved as draft'
: isAllowedToPublish
? 'published'
: 'submitted'
} ${categoryLabel}.`,
)
......@@ -116,6 +116,11 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
// queryClient.invalidateQueries({
// queryKey: ['getWorkflow', { workflowId: data.persistentId }],
// })
if (data.status === 'draft') {
queryClient.invalidateQueries({
queryKey: ['getMyDraftItems'],
})
}
/**
* if the item is published (i.e. submitted as admin), redirect to details page.
......
......@@ -113,10 +113,10 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
function onSuccess(data: WorkflowDto) {
toast.success(
`Successfully ${
isAllowedToPublish
? 'published'
: data.status === 'draft'
data.status === 'draft'
? 'saved as draft'
: isAllowedToPublish
? 'published'
: 'submitted'
} ${categoryLabel}.`,
)
......@@ -130,6 +130,11 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
queryClient.invalidateQueries({
queryKey: ['getWorkflow', { workflowId: data.persistentId }],
})
if (data.status === 'draft') {
queryClient.invalidateQueries({
queryKey: ['getMyDraftItems'],
})
}
/**
* if the item is published (i.e. submitted as admin), redirect to details page.
......
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44.736 52.968" fill="currentColor"><path d="M38.04 11.337l.009-.009-.045-.045c-.022-.023-.043-.045-.066-.066L27.095.374l-.005.005a1.294 1.294 0 00-.914-.38H1.296a1.3 1.3 0 00-1.3 1.3v46.218a.033.033 0 010 .009 1.316 1.316 0 001.312 1.312H16.98a1.761 1.761 0 001.75-1.76 1.713 1.713 0 00-.257-.862 1.739 1.739 0 00-1.5-.9H3.525V3.524h20.849v9.241a1.021 1.021 0 001.018 1.018h9.447v10.636a1.762 1.762 0 103.524 0V12.17a1.291 1.291 0 00-.323-.833zm-10.324-.576V6.34l4.526 4.421z"/><path d="M27.786 22.787h-17a1.433 1.433 0 01-1.429-1.429 1.433 1.433 0 011.429-1.429h17a1.433 1.433 0 011.429 1.429 1.433 1.433 0 01-1.429 1.429zm0 6.713h-17a1.433 1.433 0 01-1.429-1.429 1.433 1.433 0 011.429-1.43h17a1.433 1.433 0 011.429 1.429 1.433 1.433 0 01-1.429 1.43zm-10.485 6.714h-6.619a1.433 1.433 0 01-1.429-1.429 1.433 1.433 0 011.429-1.429h6.619a1.433 1.433 0 011.431 1.428 1.433 1.433 0 01-1.431 1.43zm26.685 13.523a23.388 23.388 0 00-3.756-1.645c-2.2-.747-3.295-1.009-3.295-2.328s-.278-1.274.454-2.064a4.738 4.738 0 00.967-2.048 3.015 3.015 0 01.528-1.406 3.491 3.491 0 00.439-1.493c0-.323.116-.849-.321-.878a7.422 7.422 0 00.086-2.842c-.29-1.2-.787-3.379-4.7-3.6-3.91.219-4.408 2.4-4.7 3.6a7.422 7.422 0 00.086 2.842c-.437.029-.321.555-.321.878a3.491 3.491 0 00.439 1.493 3.015 3.015 0 01.528 1.406 4.738 4.738 0 00.966 2.051c.732.79.454.746.454 2.064s-1.1 1.581-3.295 2.328a23.389 23.389 0 00-3.756 1.645 1.634 1.634 0 00-.75 1.36v1.871h20.697v-1.874a1.634 1.634 0 00-.75-1.36z"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 43.565 52.289" fill="currentColor"><path d="M41.406 39.8h-6.012v-6.012a2.159 2.159 0 10-4.318 0V39.8h-6.013a2.159 2.159 0 100 4.318h6.012v6.009a2.159 2.159 0 104.318 0v-6.009h6.012a2.159 2.159 0 100-4.318zM27.724 23.43h-16.69a1.407 1.407 0 01-1.4-1.4 1.407 1.407 0 011.4-1.4h16.69a1.407 1.407 0 011.4 1.4 1.407 1.407 0 01-1.4 1.4zm0 6.593h-16.69a1.407 1.407 0 01-1.404-1.4 1.407 1.407 0 011.4-1.4h16.69a1.407 1.407 0 011.4 1.4 1.407 1.407 0 01-1.396 1.4zM17.43 36.617h-6.5a1.407 1.407 0 01-1.4-1.4 1.407 1.407 0 011.4-1.4h6.5a1.407 1.407 0 011.4 1.4 1.407 1.407 0 01-1.4 1.4z"/><path d="M37.35 11.132l.009-.009-.044-.044a.996.996 0 00-.065-.065L26.603.368l-.005.005a1.271 1.271 0 00-.9-.373H1.272A1.276 1.276 0 00-.002 1.272v45.384a.032.032 0 010 .009 1.292 1.292 0 001.29 1.288h15.384a1.729 1.729 0 001.718-1.73 1.682 1.682 0 00-.252-.846 1.707 1.707 0 00-1.478-.884H3.46V3.46h20.471v9.073a1 1 0 001 1h9.276v10.443a1.73 1.73 0 103.46 0V11.95a1.268 1.268 0 00-.317-.818zm-10.138-.561V6.223l4.444 4.345z"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 45.739 52.668" fill="currentColor"><path d="M37.745 11.249l.009-.009-.045-.044a.996.996 0 00-.065-.065L26.884.371l-.005.005a1.284 1.284 0 00-.907-.377H1.285A1.289 1.289 0 00-.001 1.285v45.863a.033.033 0 010 .009 1.306 1.306 0 001.3 1.3h15.549a1.747 1.747 0 001.737-1.746 1.7 1.7 0 00-.255-.855 1.725 1.725 0 00-1.493-.893H3.499V3.497h20.687v9.173a1.013 1.013 0 001.01 1.01h9.374v10.55a1.75 1.75 0 103.5 0V12.076a1.281 1.281 0 00-.325-.827zm-10.246-.567V6.291l4.491 4.391z"/><path d="M27.569 22.614H10.703a1.422 1.422 0 01-1.416-1.422 1.422 1.422 0 011.418-1.418h16.864a1.422 1.422 0 011.418 1.418 1.422 1.422 0 01-1.418 1.422zm0 6.657H10.703a1.422 1.422 0 01-1.416-1.418 1.422 1.422 0 011.418-1.418h16.864a1.422 1.422 0 011.418 1.418 1.422 1.422 0 01-1.418 1.418zm-10.402 6.662h-6.568a1.422 1.422 0 01-1.418-1.418 1.422 1.422 0 011.418-1.418h6.567a1.422 1.422 0 011.418 1.418 1.422 1.422 0 01-1.417 1.418zm18.07.763v3.922a1.158 1.158 0 01-.512.944c-.027.023-.044.054-.074.074l-5.39 3.562a.982.982 0 01-1.083-1.638l4.7-3.109v-3.755a1.177 1.177 0 012.355 0zm10.5 4.338a11.634 11.634 0 11-11.632-11.633 11.634 11.634 0 0111.634 11.633zm-3.069 0a8.59 8.59 0 00-8.565-8.565 8.565 8.565 0 100 17.13 8.59 8.59 0 008.567-8.565z"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 45.5 50.051" fill="currentColor"><path d="M27.509 22.922H10.616a1.425 1.425 0 01-1.42-1.42 1.425 1.425 0 011.42-1.42h16.893a1.425 1.425 0 011.42 1.42 1.425 1.425 0 01-1.42 1.42zm0 6.672H10.616a1.425 1.425 0 01-1.42-1.42 1.425 1.425 0 011.42-1.42h16.893a1.425 1.425 0 011.42 1.42 1.425 1.425 0 01-1.42 1.42zm-10.42 6.671h-6.578a1.425 1.425 0 01-1.42-1.42 1.425 1.425 0 011.42-1.42h6.578a1.425 1.425 0 011.42 1.42 1.425 1.425 0 01-1.42 1.42zm27.423-5.066a2.37 2.37 0 00-3.3.55l-8.952 12.54-5.826-4.742a2.362 2.362 0 10-2.971 3.674l6.168 5.013 1.467 1.158.154.121c.024.019.054.023.079.041s.024.032.042.045a.622.622 0 00.154.069 3.213 3.213 0 00.571.254c.023.008.044.024.068.03h.024a1.415 1.415 0 00.867.047 2.284 2.284 0 001.426-.763.486.486 0 00.093-.077.185.185 0 00.02-.038c.024-.03.05-.043.073-.075l10.393-14.552a2.369 2.369 0 00-.55-3.295z"/><path d="M37.804 11.267l.009-.009-.045-.044a1.345 1.345 0 00-.065-.066L26.927.372l-.005.005A1.286 1.286 0 0026.014 0H1.287A1.291 1.291 0 00-.001 1.287v45.935a.033.033 0 010 .009 1.308 1.308 0 001.3 1.3h15.576a1.75 1.75 0 001.739-1.749 1.7 1.7 0 00-.255-.856 1.728 1.728 0 00-1.5-.895H3.499V3.502h20.719v9.184a1.014 1.014 0 001.012 1.012h9.389v10.57a1.751 1.751 0 103.5 0V12.095a1.283 1.283 0 00-.315-.828zm-10.261-.568v-4.4l4.5 4.4z"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40.811 50.629" fill="currentColor"><path d="M23.551 32.73c0-1.735 3.864-3.142 8.63-3.142s8.63 1.407 8.63 3.142-3.864 3.145-8.63 3.145-8.63-1.409-8.63-3.145zm8.63 4.458c-4.587 0-8.354-1.142-8.63-2.787v3.3c0 1.735 3.864 3.142 8.63 3.142s8.63-1.407 8.63-3.142v-3.3c-.276 1.645-4.043 2.787-8.63 2.787zm0 4.934c-4.587 0-8.354-1.142-8.63-2.787v3.3c0 1.735 3.864 3.142 8.63 3.142s8.63-1.407 8.63-3.142v-3.3c-.276 1.645-4.043 2.787-8.63 2.787zm0 4.849c-4.587 0-8.354-1.142-8.63-2.787v3.3c0 1.735 3.864 3.142 8.63 3.142s8.63-1.407 8.63-3.142v-3.3c-.276 1.645-4.043 2.791-8.63 2.791z"/><path d="M35.388 10.547l.008-.008-.042-.041c-.02-.022-.04-.041-.061-.061L25.207.348a1.2 1.2 0 00-.85-.353H1.205A1.209 1.209 0 000 1.21v42.996a.031.031 0 010 .008 1.224 1.224 0 001.22 1.221h14.579a1.638 1.638 0 001.628-1.637 1.593 1.593 0 00-.239-.8 1.618 1.618 0 00-1.4-.837H3.279V3.279h19.4v8.6a.95.95 0 00.947.947h8.789v9.891a1.64 1.64 0 103.279 0v-11.4a1.2 1.2 0 00-.306-.77zm-9.6-.532V5.899l4.211 4.117z"/><path d="M25.849 21.2H10.035a1.334 1.334 0 01-1.33-1.33 1.334 1.334 0 011.33-1.33h15.814a1.334 1.334 0 011.33 1.33 1.334 1.334 0 01-1.33 1.33zm0 6.245H10.035a1.334 1.334 0 01-1.33-1.33 1.334 1.334 0 011.33-1.33h15.814a1.334 1.334 0 011.33 1.33 1.334 1.334 0 01-1.33 1.33zm-9.754 6.246H9.938a1.334 1.334 0 01-1.33-1.33 1.334 1.334 0 011.33-1.33h6.157a1.334 1.334 0 011.33 1.33 1.334 1.334 0 01-1.33 1.33z"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 54.475 39.844" fill="currentColor"><path d="M36.524 29.148c0-1.784.376-1.724-.614-2.793a6.41 6.41 0 01-1.307-2.775 4.645 4.645 0 00-.343-1.234l-.024-.016a8.434 8.434 0 00-.363-.653 4.728 4.728 0 01-.6-2.02c0-.437-.157-1.149.438-1.188a10.049 10.049 0 01-.12-3.845c.4-1.625 1.067-4.6 6.422-4.875h.012c5.354.277 6.026 3.25 6.422 4.875a10.05 10.05 0 01-.12 3.845c.6.039.438.752.438 1.188a4.729 4.729 0 01-.595 2.02c-.161.274-.27.458-.363.653l-.024.016a4.634 4.634 0 00-.343 1.234 6.412 6.412 0 01-1.307 2.775c-.99 1.069-.614 1.009-.614 2.793s1.486 2.139 4.459 3.15a37.231 37.231 0 015.652 2.533 2.228 2.228 0 01.809 2.048c-.007.21.026.411.03.608h.001v2.357h-12.1v-4.533c.043-3.3-3.473-4.895-3.473-4.895l-2.4-1.09c.011-.06.027-.115.027-.178zm.375 4.719a43.272 43.272 0 00-6.952-3.044c-4.064-1.382-6.1-1.867-6.1-4.307s-.514-2.357.839-3.818a8.765 8.765 0 001.787-3.795 5.577 5.577 0 01.977-2.6 6.458 6.458 0 00.811-2.762c0-.6.215-1.571-.594-1.625a13.73 13.73 0 00.159-5.257C27.298 4.448 26.378.406 19.147 0c-7.235.406-8.155 4.445-8.691 6.657a13.73 13.73 0 00.159 5.257c-.809.054-.594 1.028-.594 1.625a6.458 6.458 0 00.811 2.762 5.577 5.577 0 01.977 2.6 8.765 8.765 0 001.787 3.795c1.354 1.461.839 1.379.839 3.818s-2.032 2.925-6.1 4.307a43.272 43.272 0 00-6.949 3.044 3.023 3.023 0 00-1.387 2.516v3.467h38.287v-3.465a3.023 3.023 0 00-1.387-2.516z"/></svg>
\ No newline at end of file
......@@ -288,6 +288,18 @@ function AuthButton() {
className="top-full text-primary-500"
popoverRef={ref}
>
<Menu.Item>
{({ active }) => (
<MenuAction
highlighted={active}
onClick={() => {
router.push({ pathname: '/account' })
}}
>
My account
</MenuAction>
)}
</Menu.Item>
<Menu.Item>
{({ active }) => (
<MenuAction highlighted={active} onClick={onSignOut}>
......
import ProtectedScreen from '@/modules/auth/ProtectedScreen'
import DraftItemsScreen from '@/screens/account/DraftItemsScreen'
/**
* My draft items.
*/
export default function DraftItemsPage(): JSX.Element {
return (
<ProtectedScreen>
<DraftItemsScreen />
</ProtectedScreen>
)
}
import ProtectedScreen from '@/modules/auth/ProtectedScreen'
import AccountScreen from '@/screens/account/AccountScreen'
/**
* My account.
*/
export default function AccountPage(): JSX.Element {
return (
<ProtectedScreen>
<AccountScreen />
</ProtectedScreen>
)
}
import ProtectedScreen from '@/modules/auth/ProtectedScreen'
import DatasetEditDraftScreen from '@/screens/item/dataset/DatasetDraftEditScreen'
/**
* Edit draft dataset page.
*/
export default function DatasetDraftEditPage(): JSX.Element {
return (
<ProtectedScreen>
<DatasetEditDraftScreen />
</ProtectedScreen>
)
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment