Admin Entity Folders
There is a new feature to allow admin users to separate entities of the same type into folders to easily organize them. The folders and entities within them can be moved around and reorganized.
Schema Changes
First add two new columns in the table BLC_ADMIN_SECTION
: FOLDERABLE
and FOLDERED_BY_DEFAULT
.
ALTER TABLE BLC_ADMIN_SECTION ADD COLUMN FOLDERABLE BOOLEAN;
ALTER TABLE BLC_ADMIN_SECTION ADD COLUMN FOLDERED_BY_DEFAULT BOOLEAN;
Then add two new tables BLC_ADMIN_FOLDER
and BLC_ADMIN_FOLDER_ITEM
CREATE TABLE `BLC_ADMIN_FOLDER` (
`ID` bigint(20) NOT NULL,
`COLOR` varchar(255) DEFAULT NULL,
`ENTITY_TYPE` varchar(255) DEFAULT NULL,
`NAME` varchar(255) DEFAULT NULL,
`ROOT` bit(1) DEFAULT NULL,
`PARENT_FOLDER` bigint(20) DEFAULT NULL,
PRIMARY KEY (`ID`),
KEY `FKauigh7hnysl901sqi6yiqxotf` (`PARENT_FOLDER`),
CONSTRAINT `FKauigh7hnysl901sqi6yiqxotf` FOREIGN KEY (`PARENT_FOLDER`) REFERENCES `BLC_ADMIN_FOLDER` (`ID`)
);
CREATE TABLE `BLC_ADMIN_FOLDER_ITEM` (
`ID` bigint(20) NOT NULL,
`ENTITY_ID` bigint(20) DEFAULT NULL,
`ENTITY_TYPE` varchar(255) DEFAULT NULL,
`ICON` varchar(255) DEFAULT NULL,
`PARENT_FOLDER` bigint(20) DEFAULT NULL,
PRIMARY KEY (`ID`),
KEY `FK5aks5cymyaef15hoj7bwfd5lr` (`PARENT_FOLDER`),
CONSTRAINT `FK5aks5cymyaef15hoj7bwfd5lr` FOREIGN KEY (`PARENT_FOLDER`) REFERENCES `BLC_ADMIN_FOLDER` (`ID`)
);
Enabling folders for an entity
If FOLDERED
is set to true, a new foldered view will be available where the entities can be moved into folders. If FOLDERED_BY_DEFAULT
is enabled, links to this AdminSection will immediately open the folder view instead of the flat entity list.
To enable foldering for any entity:
- Find the corresponding AdminSection for that entity in the table
BLC_ADMIN_SECTION
. - Set the
FOLDERABLE
column to true - Set
FOLDERED_BY_DEFAULT
to true if you want the default view to be the folders. This is optional.
If the admin is running, it will need to be restarted since the cache will most likely have a stale version of the AdminSection.
Accessing the folder view
If the AdminSection was set to show the folder view by default, clicking any link to that section will take you straight to the folder view. Otherwise, if the section was only marked folderable, a button will appear next to the filter button (as shown below) that will take you to the folder view.
Using Folders
When opening an entity in the folder view for the first time, no entities will be shown and only one folder will appear. This is because the folder view opens to the root folder by default.
Entities that haven't been assigned to a folder will appear in the "Unassigned" folder. The unassigned folder may not contain any folders within it and cannot be moved or deleted. Clicking on a folder will open that folder, and the entities inside will appear on the right hand side.
Both the folders and entities are shown with "multiselect" options, meaning that multiple items can be selected. With folder and/or entities selected, actions can be performed on them. These actions are discussed in the next section.
Actions
Creating a new folder
In the picture shown above, the icon on the left will create a new folder. A path can be specified, but it will default to the currently open folder. This action is not available when trying to create a folder within the Unassigned folder, and will not allow a path to be specified to the Unassigned folder.
Moving folders and entities
In the picture shown above, the icon in the middle allows folders and entities to be moved. This action is not available until folders or entities have been selected. Once they are selected, the action will ask for a destination path. If any folders are selected, the action will not allow them to be moved to the Unassigned folder, although entities alone may be moved there.
Unassigning entities and deleting folders
In the picture shown above, the last icon is used to both delete folders and send entities to Unassigned. Anything existing in the folders being deleted will be moved to unassigned. This action is not available until folders or entities have been selected and is also unavailable in the Unassigned folder.