Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
effect,
inject,
input,
linkedSignal,
OnInit,
signal,
untracked,
Expand Down Expand Up @@ -132,6 +131,7 @@ export class DotUvePaletteListComponent implements OnInit {
protected readonly $skipNextSearch = signal(false);
protected readonly $contextMenuItems = signal<MenuItem[]>([]);
protected readonly $isSearching = signal<boolean>(false);
protected readonly $shouldHideControls = signal<boolean>(true);
protected readonly $siteId = this.#globalStore.currentSiteId;
protected readonly $contenttypes = this.#paletteListStore.contenttypes;
protected readonly $contentlets = this.#paletteListStore.contentlets;
Expand All @@ -146,11 +146,6 @@ export class DotUvePaletteListComponent implements OnInit {
protected readonly $isFavoritesList = this.#paletteListStore.$isFavoritesList;
protected readonly status$ = toObservable(this.#paletteListStore.status);

protected readonly $shouldHideControls = linkedSignal({
source: this.$contenttypes,
computation: (contenttypes) => contenttypes.length === 0
});

/**
* Computed signal to determine the start index for the pagination.
* @returns The start index for the pagination.
Expand Down Expand Up @@ -292,7 +287,7 @@ export class DotUvePaletteListComponent implements OnInit {
* Handles the selection of a content type to view its contentlets.
* Store handles query building, filter reset, and page reset automatically.
*
* @param contentTypeName - The name of the content type to drill into
* @param selectedContentType - The name of the content type to drill into
*/
protected onSelectContentType(selectedContentType: string) {
this.#paletteListStore.getContentlets({ ...EMPTY_SEARCH_PARAMS, selectedContentType });
Expand Down Expand Up @@ -421,6 +416,7 @@ export class DotUvePaletteListComponent implements OnInit {
* @private
*/
#updateControlsVisibility() {
this.$shouldHideControls.set(false);
this.status$
.pipe(
filter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ export const DEFAULT_PER_PAGE = 30;

/**
* Base content types included in the Content tab.
* Filter excludes DotCMSBaseTypesContentTypes FORMs and HTMLPAGEs to keep the Palette UI focused on standard content.
*/
export const BASETYPES_FOR_CONTENT = [
DotCMSBaseTypesContentTypes.CONTENT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1911,6 +1911,8 @@ public final ResponseEntityPaginatedDataView getPagesContentTypes(@Context final
//Curated list of varNames ensures they belong into the passed BaseTypes
List<String> typeVarNames = contentTypes.stream()
.filter(contentType -> baseContentTypes.contains(contentType.baseType()))
// Excludes system contentTypes
.filter(contentType -> !contentType.system())
.map(ContentType::variable)
.collect(Collectors.toList());

Expand Down
3 changes: 0 additions & 3 deletions dotCMS/src/main/webapp/ext/uve/dot-uve.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,20 @@
import com.dotcms.contenttype.model.type.ContentType;
import com.dotcms.contenttype.model.type.PersonaContentType;
import com.dotcms.contenttype.transform.contenttype.JsonContentTypeTransformer;
import com.dotcms.datagen.ContainerDataGen;
import com.dotcms.datagen.ContentTypeDataGen;
import com.dotcms.datagen.FolderDataGen;
import com.dotcms.datagen.HTMLPageDataGen;
import com.dotcms.datagen.SiteDataGen;
import com.dotcms.datagen.TemplateDataGen;
import com.dotcms.datagen.TestUserUtils;
import com.dotcms.mock.request.MockAttributeRequest;
import com.dotcms.mock.request.MockHeaderRequest;
import com.dotcms.mock.request.MockHttpRequestIntegrationTest;
import com.dotcms.mock.request.MockSessionRequest;
import com.dotcms.rest.EmptyHttpResponse;
import com.dotcms.rest.InitDataObject;
import com.dotcms.rest.ResponseEntityPaginatedDataView;
import com.dotcms.rest.ResponseEntityView;
import com.dotcms.rest.RestUtilTest;
import com.dotcms.rest.WebResource;
Expand All @@ -37,6 +43,10 @@
import com.dotmarketing.business.PermissionAPI;
import com.dotmarketing.exception.DotDataException;
import com.dotmarketing.exception.DotSecurityException;
import com.dotmarketing.portlets.containers.model.Container;
import com.dotmarketing.portlets.folders.model.Folder;
import com.dotmarketing.portlets.htmlpageasset.model.HTMLPageAsset;
import com.dotmarketing.portlets.templates.model.Template;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.liferay.portal.model.User;
import com.liferay.portal.util.WebKeys;
Expand Down Expand Up @@ -536,10 +546,61 @@ public void testGetRecentBaseTypes_whenCommunity_excludeTypes(final TestCase tes
assertEquals(testCase.typesIncluded, types.stream().anyMatch(this::isEnterpriseBaseType));
}

private boolean isEnterpriseBaseType(final BaseContentTypesView baseContentTypesView) {
return baseContentTypesView.getName().equals(BaseContentType.FORM.name())
|| baseContentTypesView.getName().equals(BaseContentType.PERSONA.name());
}
private boolean isEnterpriseBaseType(final BaseContentTypesView baseContentTypesView) {
return baseContentTypesView.getName().equals(BaseContentType.FORM.name())
|| baseContentTypesView.getName().equals(BaseContentType.PERSONA.name());
}

/**
* Method to test: {@link ContentTypeResource#getPagesContentTypes}
* Given Scenario: A page whose container holds both a regular and a system content type
* ExpectedResult: System content types are excluded from the response; regular ones are included
*/
@Test
public void test_getPagesContentTypes_excludesSystemContentTypes() throws Exception {

final User adminUser = APILocator.getUserAPI().loadUserById("dotcms.org.1");

final ContentType regularContentType = new ContentTypeDataGen().nextPersisted();
final ContentType systemContentType = new ContentTypeDataGen().system(true).nextPersisted();

try {
final Container container = new ContainerDataGen()
.withContentType(regularContentType, "")
.withContentType(systemContentType, "")
.nextPersisted();
ContainerDataGen.publish(container);

final Template template = new TemplateDataGen()
.withContainer(container.getIdentifier())
.nextPersisted();
APILocator.getVersionableAPI().setLive(template);

final Host systemHost = APILocator.getHostAPI()
.findSystemHost(adminUser, false);
final Folder folder = new FolderDataGen().site(systemHost).nextPersisted();
final HTMLPageAsset page = new HTMLPageDataGen(folder, template).nextPersisted();
APILocator.getContentletAPI().publish(page, adminUser, false);

final ContentTypeResource resource = new ContentTypeResource();
final ResponseEntityPaginatedDataView response = resource.getPagesContentTypes(
getHttpRequest(), new EmptyHttpResponse(),
page.getIdentifier(), "-1", null, 1, 10, "name", "ASC", null, null);

@SuppressWarnings("unchecked") final List<Map<String, Object>> contentTypes = (List<Map<String, Object>>) response.getEntity();
final List<String> variables = contentTypes.stream()
.map(ct -> (String) ct.get(ContentTypesPaginator.VARIABLE))
.collect(Collectors.toList());

assertTrue("Regular content type should be included in the palette",
variables.contains(regularContentType.variable()));
assertFalse("System content type should be excluded from the palette",
variables.contains(systemContentType.variable()));
} finally {
ContentTypeDataGen.remove(regularContentType);
ContentTypeDataGen.remove(systemContentType);
}
}

private static class TestHashMap<K, V> extends HashMap<K, V> {
@Override
Expand Down
Loading