Skip to content

Commit

Permalink
Add grid refresh (#827)
Browse files Browse the repository at this point in the history
* Add grid refresh

* Automatic frontend build

* Fix workflows

* Automatic frontend build

---------

Co-authored-by: vin0401 <[email protected]>
  • Loading branch information
vin0401 and vin0401 authored Dec 13, 2024
1 parent 334f26b commit 7d4a2a7
Show file tree
Hide file tree
Showing 43 changed files with 2,042 additions and 7,907 deletions.
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

0 comments on commit 7d4a2a7

Please sign in to comment.