Skip to content

Commit

Permalink
Minimize right border widgets and increase tree pager size (#762)
Browse files Browse the repository at this point in the history
* Minimize right border widgets and increase tree pager size

* Automatic frontend build

---------

Co-authored-by: vin0401 <[email protected]>
  • Loading branch information
vin0401 and vin0401 authored Dec 2, 2024
1 parent 2477b68 commit a78a98e
Show file tree
Hide file tree
Showing 36 changed files with 1,898 additions and 1,895 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export interface TreeContextMenuProps {
export interface TreeProps {
nodeId: number
nodeApiHook: any
maxItemsPerNode: number
maxItemsPerNode?: number

renderNode: ElementType<TreeNodeProps>
renderNodeContent: ElementType<TreeNodeContentProps>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ interface NodeApiHookReturnType {
export const useNodeApiHook = (node: TreeNodeProps): NodeApiHookReturnType => {
const [additionalQueryParams, setAdditionalQueryParams] = useState<AssetTreeAdditionalTreeProps>()
const { maxItemsPerNode } = useContext(TreeContext)
const apiHookResult = useAssetGetTreeQuery({ parentId: parseInt(node.id), pageSize: maxItemsPerNode, page: 1, ...additionalQueryParams })
const apiHookResult = useAssetGetTreeQuery({ parentId: parseInt(node.id), pageSize: maxItemsPerNode!, page: 1, ...additionalQueryParams })

function dataTransformer (data: AssetGetTreeApiResponse): DataTransformerReturnType {
const nodes: TreeNodeProps[] = []
Expand Down
4 changes: 3 additions & 1 deletion assets/js/src/core/modules/asset/tree/tree-container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ import { useAssetHelper } from '@Pimcore/modules/asset/hooks/use-asset-helper'
import { SearchContainer } from './search/search-container'
import { withDraggable } from './node/with-draggable'
import { AssetTreeContextMenu } from '@Pimcore/modules/asset/tree/context-menu/context-menu'
import { useSettings } from '@Pimcore/modules/app/settings/hooks/use-settings'

export interface TreeContainerProps {
id: number
}

const TreeContainer = ({ id = 1, ...props }: TreeContainerProps): React.JSX.Element => {
const { openAsset } = useAssetHelper()
const { asset_tree_paging_limit: assetTreePagingLimit } = useSettings()

async function onSelect (node: TreeNodeProps): Promise<void> {
openAsset({
Expand All @@ -39,7 +41,7 @@ const TreeContainer = ({ id = 1, ...props }: TreeContainerProps): React.JSX.Elem
return (
<ElementTree
contextMenu={ AssetTreeContextMenu }
maxItemsPerNode={ 20 }
maxItemsPerNode={ assetTreePagingLimit }
nodeApiHook={ useNodeApiHook }
nodeId={ id }
onSelect={ onSelect }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ interface NodeApiHookReturnType {
export const useNodeApiHook = (node: TreeNodeProps): NodeApiHookReturnType => {
const [additionalQueryParams, setAdditionalQueryParams] = useState<DataObjectTreeAdditionalTreeProps>()
const { maxItemsPerNode } = useContext(TreeContext)
const apiHookResult = useDataObjectGetTreeQuery({ parentId: parseInt(node.id), pageSize: maxItemsPerNode, page: 1, ...additionalQueryParams })
const apiHookResult = useDataObjectGetTreeQuery({ parentId: parseInt(node.id), pageSize: maxItemsPerNode!, page: 1, ...additionalQueryParams })

function dataTransformer (data: DataObjectGetTreeApiResponse): DataTransformerReturnType {
const nodes: TreeNodeProps[] = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ import { withDraggable } from './node/with-draggable'
import { useDataObjectHelper } from '@Pimcore/modules/data-object/hooks/use-data-object-helper'
import { DataObjectTreeContextMenu } from '@Pimcore/modules/data-object/tree/context-menu/context-menu'
import { PagerContainer } from '@Pimcore/modules/element/tree/pager/pager-container'
import { useSettings } from '@Pimcore/modules/app/settings/hooks/use-settings'

export interface TreeContainerProps {
id: number
}

const TreeContainer = ({ id = 1, ...props }: TreeContainerProps): React.JSX.Element => {
const { openDataObject } = useDataObjectHelper()
const { object_tree_paging_limit: dataObjectTreePagingLimit } = useSettings()

async function onSelect (node: TreeNodeProps): Promise<void> {
openDataObject({
Expand All @@ -39,7 +41,7 @@ const TreeContainer = ({ id = 1, ...props }: TreeContainerProps): React.JSX.Elem
return (
<ElementTree
contextMenu={ DataObjectTreeContextMenu }
maxItemsPerNode={ 20 }
maxItemsPerNode={ dataObjectTreePagingLimit }
nodeApiHook={ useNodeApiHook }
nodeId={ id }
onSelect={ onSelect }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const SearchContainer = (props: SearchContainerProps): React.JSX.Element => {
const { maxItemsPerNode } = useContext(TreeContext)

useEffect(() => {
if (total > maxItemsPerNode) {
if (total > maxItemsPerNode!) {
setSearchActive(true)
}
}, [total])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ export const getInitialModelJson = (): IJsonModel => {
type: 'border',
location: 'right',
size: 315,
selected: 0,
children: [
{
type: 'tab',
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

12 changes: 0 additions & 12 deletions public/build/79481b09-af38-4167-a1b7-ca3e4ff27d99/entrypoints.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"entrypoints": {
"main": {
"js": [
"/bundles/pimcorestudioui/build/a9dd9b74-2494-4b03-b0c0-3f64db9c270f/main.js"
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"bundles/pimcorestudioui/build/a9dd9b74-2494-4b03-b0c0-3f64db9c270f/main.js": "/bundles/pimcorestudioui/build/a9dd9b74-2494-4b03-b0c0-3f64db9c270f/main.js"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"entrypoints": {
"vendor": {
"js": [
"/bundles/pimcorestudioui/build/b1a1958c-f83c-4d50-8960-85194601efc0/vendor.js"
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"bundles/pimcorestudioui/build/b1a1958c-f83c-4d50-8960-85194601efc0/vendor.js": "/bundles/pimcorestudioui/build/b1a1958c-f83c-4d50-8960-85194601efc0/vendor.js"
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions public/build/dcfe50aa-0543-4acf-af7b-3d293e0ea8a0/entrypoints.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"entrypoints": {
"core-dll": {
"css": [
"/bundles/pimcorestudioui/build/dcfe50aa-0543-4acf-af7b-3d293e0ea8a0/core-dll.css"
],
"js": [
"/bundles/pimcorestudioui/build/dcfe50aa-0543-4acf-af7b-3d293e0ea8a0/core-dll.js"
]
}
}
}
Loading

0 comments on commit a78a98e

Please sign in to comment.