Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add grid refresh #827

Merged
merged 6 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions assets/js/src/core/assets/icons/refresh.inline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ export const useSubmitWorkflow = (workflowName: string): UseSubmitWorkflowReturn
actionType,
elementId: id,
elementType,
workflowName: _.snakeCase(workFlowName),
transition,
workflowId: _.snakeCase(workFlowName),
transitionId: _.snakeCase(transition),
workflowOptions: workFlowOptions
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { GridToolbarView } from './grid-toolbar-view'
import { Pagination } from '@Pimcore/components/pagination/pagination'
import { useTranslation } from 'react-i18next'
import { GridTools } from './tools/grid-tools'
import { eventBus } from '@Pimcore/lib/event-bus'
import { useElementContext } from '@Pimcore/modules/element/hooks/use-element-context'

interface GridToolbarContainerProps {
pager: {
Expand All @@ -29,9 +31,18 @@ interface GridToolbarContainerProps {
const GridToolbarContainer = (props: GridToolbarContainerProps): React.JSX.Element => {
const { pager } = props
const { t } = useTranslation()
const { id } = useElementContext()

const onRefresh = (): void => {
eventBus.publish({ identifier: { type: 'asset:listing:refresh', id } })
}

return (
<GridToolbarView
onRefresh={ () => {
onRefresh()
} }

renderPagination={ pager !== undefined && pager.total > 0
? (
<Pagination
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@

import React, { type ReactNode } from 'react'
import { Toolbar } from '@Pimcore/components/toolbar/toolbar'
import { Split } from '@Pimcore/components/split/split'
import { IconButton } from '@Pimcore/components/icon-button/icon-button'

export interface GridToolbarViewProps {
renderPagination?: ReactNode
renderTools?: ReactNode
onRefresh?: () => void
}

const GridToolbarView = (props: GridToolbarViewProps): React.JSX.Element => {
Expand All @@ -30,9 +33,16 @@ const GridToolbarView = (props: GridToolbarViewProps): React.JSX.Element => {
<div />
)}

{props.renderPagination !== undefined && (
<>{props.renderPagination}</>
)}
<Split dividerSize='small'>
<IconButton
icon={ { value: 'refresh' } }
onClick={ props.onRefresh }
/>

{props.renderPagination !== undefined && (
<>{props.renderPagination}</>
)}
</Split>
</Toolbar>
)
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

14 changes: 0 additions & 14 deletions public/build/275af731-bb93-4baa-9dd8-71fb20cbb614/entrypoints.json

This file was deleted.

Loading
Loading