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

feat(edit content) #27289 : Add a button to the Content Type screen to enable the new edit mode #27333

Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6ee45a0
feat(edit content) #27289 : Add a button to the Content Type screen t…
jcastro-dotcms Jan 12, 2024
a8a7b18
Merge branch 'master' into issue-27289-add-button-to-Content-Type-scr…
jcastro-dotcms Jan 16, 2024
58fcb06
Implementing SonarQube feedback
jcastro-dotcms Jan 16, 2024
3590721
Merge branch 'master' into issue-27289-add-button-to-Content-Type-scr…
jcastro-dotcms Jan 16, 2024
701191a
Merge branch 'master' into issue-27289-add-button-to-Content-Type-scr…
jcastro-dotcms Jan 18, 2024
2c36bc7
Code Review feedback.
jcastro-dotcms Jan 18, 2024
ea418ab
progress
hmoreras Jan 18, 2024
eaa6884
filter view un edit content based on metadata only
hmoreras Jan 19, 2024
f99d89b
fix tests and add scenarios
hmoreras Jan 19, 2024
87a9432
clean up 1
hmoreras Jan 19, 2024
9717fd8
Merge branch 'master' into issue-27289-add-button-to-Content-Type-scr…
hmoreras Jan 19, 2024
3bae84a
traductions
hmoreras Jan 20, 2024
9eda5b5
labels fix
hmoreras Jan 20, 2024
9106800
Merge branch 'master' into issue-27289-add-button-to-Content-Type-scr…
fmontes Jan 22, 2024
4e9b8b7
merge master
hmoreras Jan 22, 2024
ad1b457
file format
hmoreras Jan 22, 2024
e230062
Merge branch 'master' into issue-27289-add-button-to-Content-Type-scr…
jcastro-dotcms Jan 22, 2024
3fc1517
Merge branch 'master' into issue-27289-add-button-to-Content-Type-scr…
jcastro-dotcms Jan 23, 2024
b0e3911
fix feedback
hmoreras Jan 23, 2024
8e3acfd
Merge branch 'master' into issue-27289-add-button-to-Content-Type-scr…
fmontes Jan 23, 2024
ffe1a3e
Merge branch 'master' into issue-27289-add-button-to-Content-Type-scr…
jcastro-dotcms Jan 24, 2024
2c7ae54
Merge branch 'master' into issue-27289-add-button-to-Content-Type-scr…
fmontes Jan 24, 2024
d1cfcb1
Fixing CLI Integration Test that was broken because of the addition o…
jcastro-dotcms Jan 26, 2024
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
236 changes: 165 additions & 71 deletions dotCMS/src/curl-test/ContentTypeResourceTests.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"info": {
"_postman_id": "4a7bb840-b421-4ff9-a020-4986dbd0dca1",
"_postman_id": "da18d7b4-3906-4765-8621-f8cf40de2482",
"name": "ContentType Resource",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "27636414"
"_exporter_id": "5403727"
},
"item": [
{
Expand Down Expand Up @@ -2821,80 +2821,174 @@
"response": []
}
]
}
],
"variable": [
{
"key": "contentTypeVariable",
"value": ""
},
{
"key": "contentTypeId",
"value": ""
},
{
"key": "contentType.columnDivider",
"value": ""
},
{
"key": "contentType.divider",
"value": ""
},
{
"key": "contentType.field1",
"value": ""
},
{
"key": "contentType.field2",
"value": ""
},
{
"key": "contentType.field3",
"value": ""
},
{
"key": "contentType.field4",
"value": ""
},
{
"key": "contentType.host",
"value": ""
},
{
"key": "contentType.workflow",
"value": ""
},
{
"key": "contentTypeID",
"value": ""
},
{
"key": "contentTypeVAR",
"value": ""
},
{
"key": "contentTypeFieldID",
"value": ""
},
{
"key": "contentTypeIdWithStoryBlock",
"value": ""
},
{
"key": "folder",
"value": ""
},
{
"key": "folder.identifier",
"value": ""
},
"name": "New metadata column",
"item": [
{
"name": "Create a test Content Type",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
"const typeName = \"test-type-\" + Math.floor(Math.random() * 100);",
"pm.collectionVariables.set(\"typeNameWithMetadata\", typeName);"
],
"type": "text/javascript"
}
},
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"HTTP Status code must be 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"Test Content Type created successfully\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.errors.length).to.eql(0, \"No errors should have been generated\");",
" pm.expect(jsonData.entity[0].metadata).to.not.eql(undefined, \"The 'metadata' field is missing\");",
" pm.expect(jsonData.entity[0].metadata.edit_mode).to.be.eql(true, \"The value of the 'edit_mode' attribute doesn't match the expected one\");",
" pm.collectionVariables.set(\"testContentTypeId\", jsonData.entity[0].id);",
"});",
""
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "username",
"value": "admin@dotcms.com",
"type": "string"
},
{
"key": "password",
"value": "admin",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"defaultType\": false,\n \"icon\": null,\n \"fixed\": false,\n \"system\": false,\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\": \"This is a test Content Type with a metadata field.\",\n \"host\": \"default\",\n \"name\": \"{{typeNameWithMetadata}}\",\n \"metadata\": {\n \"edit_mode\": true\n },\n \"systemActionMappings\": {\n \"NEW\": \"\"\n },\n \"workflow\": [\n \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{serverURL}}/api/v1/contenttype",
"host": [
"{{serverURL}}"
],
"path": [
"api",
"v1",
"contenttype"
]
}
},
"response": []
},
{
"name": "Update the test Content Type",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test('HTTP Status code must be 200', function () {",
" pm.response.to.have.status(200);",
"})",
"",
"pm.test(\"Test Content Type updated successfully\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.errors.length).to.eql(0, \"No errors should have been generated\");",
" pm.expect(jsonData.entity.metadata).to.not.eql(undefined, \"The 'metadata' field is missing\");",
" pm.expect(jsonData.entity.metadata.edit_mode).to.be.eql(true, \"The value of the 'edit_mode' attribute doesn't match the expected one\");",
" pm.expect(jsonData.entity.metadata.my_new_prop).to.be.eql(123, \"The value of the new 'my_new_prop' attribute doesn't match the expected one\");",
"});",
""
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "username",
"value": "admin@dotcms.com",
"type": "string"
},
{
"key": "password",
"value": "admin",
"type": "string"
}
]
},
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"defaultType\": false,\n \"icon\": \"event_note\",\n \"fixed\": false,\n \"system\": false,\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\": \"This is a test Content Type with a metadata field v2.\",\n \"host\": \"default\",\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"{{typeNameWithMetadata}}\",\n \"metadata\": {\n \"edit_mode\": true,\n \"my_new_prop\": 123\n },\n \"systemActionMappings\": {\n \"NEW\": \"\"\n },\n \"detailPage\": \"\",\n \"urlMapPattern\": \"\",\n \"id\": \"{{testContentTypeId}}\",\n \"workflow\": [\n \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{serverURL}}/api/v1/contenttype/id/{{testContentTypeId}}",
"host": [
"{{serverURL}}"
],
"path": [
"api",
"v1",
"contenttype",
"id",
"{{testContentTypeId}}"
]
}
},
"response": []
}
],
"description": "This test case verifies that dotCMS is properly handling the new `metadata` column that has been added to the `structure` table. Such a new column is meant to store different configuration properties and/or temporary information without the need to create a brand new column again."
}
],
"event": [
{
"key": "folder.hostId",
"value": ""
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
},
{
"key": "fieldTypesArr",
"value": ""
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
}
]
}
4 changes: 3 additions & 1 deletion dotCMS/src/integration-test/java/com/dotcms/MainSuite.java
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@
import com.dotmarketing.startup.runonce.Task231109AddPublishDateToContentletVersionInfoTest;
import com.dotmarketing.startup.runonce.Task240102AlterVarcharLengthOfRelationTypeTest;
import com.dotmarketing.startup.runonce.Task240111AddInodeAndIdentifierLeftIndexesTest;
import com.dotmarketing.startup.runonce.Task240112AddMetadataColumnToStructureTableTest;
import com.dotmarketing.util.HashBuilderTest;
import com.dotmarketing.util.ITConfigTest;
import com.dotmarketing.util.MaintenanceUtilTest;
Expand Down Expand Up @@ -670,7 +671,8 @@
Task240102AlterVarcharLengthOfRelationTypeTest.class,
Task240111AddInodeAndIdentifierLeftIndexesTest.class,
AnnouncementsHelperIntegrationTest.class,
RemoteAnnouncementsLoaderIntegrationTest.class
RemoteAnnouncementsLoaderIntegrationTest.class,
Task240112AddMetadataColumnToStructureTableTest.class
})

public class MainSuite {
Expand Down
6 changes: 4 additions & 2 deletions dotCMS/src/integration-test/java/com/dotcms/MainSuite2b.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,13 @@
import com.dotmarketing.startup.runonce.Task230328AddMarkedForDeletionColumnTest;
import com.dotmarketing.startup.runonce.Task230426AlterVarcharLengthOfLockedByColTest;
import com.dotmarketing.startup.runonce.Task230523CreateVariantFieldInContentletIntegrationTest;
import com.dotmarketing.startup.runonce.Task231109AddPublishDateToContentletVersionInfoTest;
import com.dotmarketing.startup.runonce.Task230701AddHashIndicesToWorkflowTablesTest;
import com.dotmarketing.startup.runonce.Task230707CreateSystemTableTest;
import com.dotmarketing.startup.runonce.Task230713IncreaseDisabledWysiwygColumnSizeTest;
import com.dotmarketing.startup.runonce.Task231109AddPublishDateToContentletVersionInfoTest;
import com.dotmarketing.startup.runonce.Task240102AlterVarcharLengthOfRelationTypeTest;
import com.dotmarketing.startup.runonce.Task240111AddInodeAndIdentifierLeftIndexesTest;
import com.dotmarketing.startup.runonce.Task240112AddMetadataColumnToStructureTableTest;
import com.dotmarketing.util.MaintenanceUtilTest;
import com.dotmarketing.util.ResourceCollectorUtilTest;
import com.dotmarketing.util.UtilMethodsITest;
Expand Down Expand Up @@ -329,7 +330,8 @@
Task240102AlterVarcharLengthOfRelationTypeTest.class,
Task240111AddInodeAndIdentifierLeftIndexesTest.class,
AnnouncementsHelperIntegrationTest.class,
RemoteAnnouncementsLoaderIntegrationTest.class
RemoteAnnouncementsLoaderIntegrationTest.class,
Task240112AddMetadataColumnToStructureTableTest.class
})

public class MainSuite2b {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.dotmarketing.startup.runonce;

import com.dotcms.util.IntegrationTestInitService;
import com.dotmarketing.exception.DotDataException;
import org.junit.BeforeClass;
import org.junit.Test;

import static org.junit.Assert.assertTrue;

/**
* Verifies that the {@link Task240112AddMetadataColumnToStructureTable} Upgrade Task works as
* expected.
*
* @author Jose Castro
* @since Jan 11th, 2024
*/
public class Task240112AddMetadataColumnToStructureTableTest {

@BeforeClass
public static void prepare() throws Exception {
IntegrationTestInitService.getInstance().init();
}

@Test
public void TestUpgradeTask() throws DotDataException {
final Task240112AddMetadataColumnToStructureTable task = new Task240112AddMetadataColumnToStructureTable();
task.executeUpgrade();
assertTrue(task.forceRun());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,28 @@
*/
public interface ContentTypeFactory {

String INODE_COLUMN = "inode";
String NAME_COLUMN = "name";
String DESCRIPTION_COLUMN = "description";
String DEFAULT_STRUCTURE_COLUMN = "default_structure";
String REVIEW_INTERVAL_COLUMN = "review_interval";
String REVIEWER_ROLE_COLUMN = "reviewer_role";
String PAGE_DETAIL_COLUMN = "page_detail";
String STRUCTURE_TYPE_COLUMN = "structuretype";
String SYSTEM_COLUMN = "system";
String FIXED_COLUMN = "fixed";
String VELOCITY_VAR_NAME_COLUMN = "velocity_var_name";
String URL_MAP_PATTERN_COLUMN = "url_map_pattern";
String HOST_COLUMN = "host";
String FOLDER_COLUMN = "folder";
String EXPIRE_DATE_VAR_COLUMN = "expire_date_var";
String PUBLISH_DATE_VAR_COLUMN = "publish_date_var";
String MOD_DATE_COLUMN = "mod_date";
String SORT_ORDER_COLUMN = "sort_order";
String ICON_COLUMN = "icon";
String MARKED_FOR_DELETION_COLUMN = "marked_for_deletion";
String METADATA_COLUMN = "metadata";

default ContentTypeFactory instance(){
return new ContentTypeFactoryImpl();
}
Expand Down Expand Up @@ -110,4 +132,5 @@ List<ContentType> find(final Collection<String> varNames, final String filter, f
* @return
*/
long countContentTypeAssignedToNotSystemWorkflow() throws DotDataException;

}
Loading
Loading