From 4d7e1a8738cbea4cfca86bb24275c6932059efa4 Mon Sep 17 00:00:00 2001 From: Nicolas Molina Date: Wed, 22 May 2024 17:14:01 -0400 Subject: [PATCH 01/24] save --- core-web/yarn.lock | 67 +++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 37 deletions(-) diff --git a/core-web/yarn.lock b/core-web/yarn.lock index 5927a098103b..821fb9b0c933 100644 --- a/core-web/yarn.lock +++ b/core-web/yarn.lock @@ -10838,7 +10838,7 @@ debug@^3.1.0, debug@^3.2.7: dependencies: ms "^2.1.1" -debuglog@*, debuglog@^1.0.1: +debuglog@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492" integrity sha512-syBZ+rnAK3EgMsH2aYEOLUW7mZSY9Gb+0wUMCFsZvcmiz+HigA0LOcq/HoQqVuGG+EKykunc7QG2bzrponfaSw== @@ -13991,7 +13991,7 @@ import-local@^3.0.2: pkg-dir "^4.2.0" resolve-cwd "^3.0.0" -imurmurhash@*, imurmurhash@^0.1.4: +imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA== @@ -16082,11 +16082,6 @@ lodash-es@^4.17.21: resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee" integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw== -lodash._baseindexof@*: - version "3.1.0" - resolved "https://registry.yarnpkg.com/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz#fe52b53a1c6761e42618d654e4a25789ed61822c" - integrity sha512-bSYo8Pc/f0qAkr8fPJydpJjtrHiSynYfYBjtANIgXv5xEf1WlTC63dIDlgu0s9dmTvzRu1+JJTxcIAHe+sH0FQ== - lodash._baseuniq@~4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz#0ebb44e456814af7905c6212fa2c9b2d51b841e8" @@ -16095,33 +16090,11 @@ lodash._baseuniq@~4.6.0: lodash._createset "~4.0.0" lodash._root "~3.0.0" -lodash._bindcallback@*: - version "3.0.1" - resolved "https://registry.yarnpkg.com/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e" - integrity sha512-2wlI0JRAGX8WEf4Gm1p/mv/SZ+jLijpj0jyaE/AXeuQphzCgD8ZQW4oSpoN8JAopujOFGU3KMuq7qfHBWlGpjQ== - -lodash._cacheindexof@*: - version "3.0.2" - resolved "https://registry.yarnpkg.com/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz#3dc69ac82498d2ee5e3ce56091bafd2adc7bde92" - integrity sha512-S8dUjWr7SUT/X6TBIQ/OYoCHo1Stu1ZRy6uMUSKqzFnZp5G5RyQizSm6kvxD2Ewyy6AVfMg4AToeZzKfF99T5w== - -lodash._createcache@*: - version "3.1.2" - resolved "https://registry.yarnpkg.com/lodash._createcache/-/lodash._createcache-3.1.2.tgz#56d6a064017625e79ebca6b8018e17440bdcf093" - integrity sha512-ev5SP+iFpZOugyab/DEUQxUeZP5qyciVTlgQ1f4Vlw7VUcCD8fVnyIqVUEIaoFH9zjAqdgi69KiofzvVmda/ZQ== - dependencies: - lodash._getnative "^3.0.0" - lodash._createset@~4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26" integrity sha512-GTkC6YMprrJZCYU3zcqZj+jkXkrXzq3IPBcF/fIPpNEAB4hZEtXU8zp/RwKOvZl43NUmwDbyRk3+ZTbeRdEBXA== -lodash._getnative@*, lodash._getnative@^3.0.0: - version "3.9.1" - resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" - integrity sha512-RrL9VxMEPyDMHOd9uFbvMe8X55X16/cGM5IgOKgRElQZutpX89iS6vwl64duTV1/16w5JY7tuFNXqoekmh1EmA== - lodash._root@~3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/lodash._root/-/lodash._root-3.0.1.tgz#fba1c4524c19ee9a5f8136b4609f017cf4ded692" @@ -16197,11 +16170,6 @@ lodash.once@^4.0.0, lodash.once@^4.1.1: resolved "https://registry.yarnpkg.com/lodash.once/-/lodash.once-4.1.1.tgz#0dd3971213c7c56df880977d504c88fb471a97ac" integrity sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg== -lodash.restparam@*: - version "3.6.1" - resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805" - integrity sha512-L4/arjjuq4noiUJpt3yS6KIKDtJwNe2fIYgMqyYYKoeIfV1iEqvPwhCx23o+R9dzouGihDAPN1dTIRWa7zk8tw== - lodash.sortby@^4.7.0: version "4.7.0" resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" @@ -21911,7 +21879,7 @@ string-length@^4.0.1: char-regex "^1.0.2" strip-ansi "^6.0.0" -"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0": version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -21929,6 +21897,15 @@ string-width@^1.0.1: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" +"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + string-width@^2.0.0, string-width@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" @@ -22025,7 +22002,7 @@ stringify-package@^1.0.0, stringify-package@^1.0.1: resolved "https://registry.yarnpkg.com/stringify-package/-/stringify-package-1.0.1.tgz#e5aa3643e7f74d0f28628b72f3dad5cecfc3ba85" integrity sha512-sa4DUQsYciMP1xhKWGuFM04fB0LG/9DlluZoSVywUMRNvzid6XucHK0/90xGxRoHrAaROrcHK1aPKaijCtSrhg== -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -22053,6 +22030,13 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-ansi@^7.0.1: version "7.1.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" @@ -24002,7 +23986,7 @@ worker-farm@^1.6.0, worker-farm@^1.7.0: dependencies: errno "~0.1.7" -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -24037,6 +24021,15 @@ wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" From ce1e55962efd1eeea4c4f2ed3469004ff9851f9c Mon Sep 17 00:00:00 2001 From: Nicolas Molina Date: Thu, 30 May 2024 12:31:29 -0400 Subject: [PATCH 02/24] Use of new syntax and upgrade to prettier support for new syntax --- .../dot-edit-content-field.component.html | 159 +++++++++--------- core-web/package.json | 2 +- core-web/yarn.lock | 7 +- 3 files changed, 87 insertions(+), 81 deletions(-) diff --git a/core-web/libs/edit-content/src/lib/components/dot-edit-content-field/dot-edit-content-field.component.html b/core-web/libs/edit-content/src/lib/components/dot-edit-content-field/dot-edit-content-field.component.html index 0c2d394bbe75..2d50a66cbad6 100644 --- a/core-web/libs/edit-content/src/lib/components/dot-edit-content-field/dot-edit-content-field.component.html +++ b/core-web/libs/edit-content/src/lib/components/dot-edit-content-field/dot-edit-content-field.component.html @@ -6,82 +6,83 @@ >{{ field.name }} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -{{ field.hint }} +@switch (field.fieldType) { + @case (fieldTypes.SELECT) { + + } + @case (fieldTypes.RADIO) { + + } + @case (fieldTypes.TEXT) { + + } + @case (fieldTypes.TEXTAREA) { + + } + @case (fieldTypes.CHECKBOX) { + + } + @case (fieldTypes.MULTI_SELECT) { + + } + @case (calendarTypes.includes(field.fieldType) ? field.fieldType : '') { + + } + @case (fieldTypes.TAG) { + + } + @case (fieldTypes.JSON) { + + } + @case (fieldTypes.BINARY) { + + } + @case (fieldTypes.CUSTOM_FIELD) { + + } + @case (fieldTypes.BLOCK_EDITOR) { + + } + @case (fieldTypes.KEY_VALUE) { + + } + @case (fieldTypes.WYSIWYG) { + + } +} +@if (field.hint) { + {{ field.hint }} +} diff --git a/core-web/package.json b/core-web/package.json index 9eaa0c197c55..a65b84ee9851 100644 --- a/core-web/package.json +++ b/core-web/package.json @@ -253,7 +253,7 @@ "postcss-import": "14.1.0", "postcss-preset-env": "7.5.0", "postcss-url": "10.1.3", - "prettier": "^2.7.1", + "prettier": "^3.2.5", "prettier-plugin-organize-attributes": "^0.0.5", "protractor": "~7.0.0", "puppeteer": "~5.3.1", diff --git a/core-web/yarn.lock b/core-web/yarn.lock index 6fb595fc88d1..efe17490dad3 100644 --- a/core-web/yarn.lock +++ b/core-web/yarn.lock @@ -19697,11 +19697,16 @@ prettier-plugin-organize-attributes@^0.0.5: resolved "https://registry.yarnpkg.com/prettier-plugin-organize-attributes/-/prettier-plugin-organize-attributes-0.0.5.tgz#46e54533936fc42a3cff3d876a738a3f98df0360" integrity sha512-dSts16q8wd+oq8Zwk5mwmYXo1aN3B+ZkEJqx/ar5fedNHdOvx7S4XDMH/pNK7rmBW0bPXkp/kJX5gAANsWzh3A== -prettier@^2.7.1, prettier@^2.8.0: +prettier@^2.8.0: version "2.8.8" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== +prettier@^3.2.5: + version "3.2.5" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.2.5.tgz#e52bc3090586e824964a8813b09aba6233b28368" + integrity sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A== + pretty-bytes@^5.4.1: version "5.6.0" resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-5.6.0.tgz#356256f643804773c82f64723fe78c92c62beaeb" From d2094185da79b093c004aec2395219fdc9e05a22 Mon Sep 17 00:00:00 2001 From: Nicolas Molina Date: Thu, 30 May 2024 12:43:15 -0400 Subject: [PATCH 03/24] chore: add new type for host_folder type --- .../dot-edit-content-field.component.html | 3 +++ .../edit-content/src/lib/models/dot-edit-content-field.enum.ts | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/core-web/libs/edit-content/src/lib/components/dot-edit-content-field/dot-edit-content-field.component.html b/core-web/libs/edit-content/src/lib/components/dot-edit-content-field/dot-edit-content-field.component.html index 2d50a66cbad6..64bcb421c495 100644 --- a/core-web/libs/edit-content/src/lib/components/dot-edit-content-field/dot-edit-content-field.component.html +++ b/core-web/libs/edit-content/src/lib/components/dot-edit-content-field/dot-edit-content-field.component.html @@ -82,6 +82,9 @@ [field]="field" [attr.data-testId]="'field-' + field.variable" /> } + @case (fieldTypes.HOST_FOLDER) { +

Hello

+ } } @if (field.hint) { {{ field.hint }} diff --git a/core-web/libs/edit-content/src/lib/models/dot-edit-content-field.enum.ts b/core-web/libs/edit-content/src/lib/models/dot-edit-content-field.enum.ts index 7fc7ecfb8683..d69458aaff96 100644 --- a/core-web/libs/edit-content/src/lib/models/dot-edit-content-field.enum.ts +++ b/core-web/libs/edit-content/src/lib/models/dot-edit-content-field.enum.ts @@ -24,5 +24,6 @@ export enum FIELD_TYPES { CUSTOM_FIELD = 'Custom-Field', JSON = 'JSON-Field', KEY_VALUE = 'Key-Value', - WYSIWYG = 'WYSIWYG' + WYSIWYG = 'WYSIWYG', + HOST_FOLDER = 'Host-Folder' } From d3c5ff21a69091aa35adb8f411060f116761bc32 Mon Sep 17 00:00:00 2001 From: Nicolas Molina Date: Thu, 30 May 2024 13:29:02 -0400 Subject: [PATCH 04/24] chore: create new component for host folder field --- .../dot-edit-content-field.component.html | 4 +- .../fields/dot-edit-content-fields.module.ts | 7 +- ...t-content-host-folder-field.component.html | 6 + ...t-content-host-folder-field.component.scss | 0 ...ontent-host-folder-field.component.spec.ts | 152 ++++++++++++++++++ ...dit-content-host-folder-field.component.ts | 39 +++++ 6 files changed, 205 insertions(+), 3 deletions(-) create mode 100644 core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html create mode 100644 core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.scss create mode 100644 core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts create mode 100644 core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts diff --git a/core-web/libs/edit-content/src/lib/components/dot-edit-content-field/dot-edit-content-field.component.html b/core-web/libs/edit-content/src/lib/components/dot-edit-content-field/dot-edit-content-field.component.html index 64bcb421c495..785e1a647eab 100644 --- a/core-web/libs/edit-content/src/lib/components/dot-edit-content-field/dot-edit-content-field.component.html +++ b/core-web/libs/edit-content/src/lib/components/dot-edit-content-field/dot-edit-content-field.component.html @@ -83,7 +83,9 @@ [attr.data-testId]="'field-' + field.variable" /> } @case (fieldTypes.HOST_FOLDER) { -

Hello

+ } } @if (field.hint) { diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-fields.module.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-fields.module.ts index 42f186a479d5..ec42f3d8e267 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-fields.module.ts +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-fields.module.ts @@ -4,6 +4,7 @@ import { DotEditContentBinaryFieldComponent } from './dot-edit-content-binary-fi import { DotEditContentCalendarFieldComponent } from './dot-edit-content-calendar-field/dot-edit-content-calendar-field.component'; import { DotEditContentCheckboxFieldComponent } from './dot-edit-content-checkbox-field/dot-edit-content-checkbox-field.component'; import { DotEditContentCustomFieldComponent } from './dot-edit-content-custom-field/dot-edit-content-custom-field.component'; +import { DotEditContentHostFolderFieldComponent } from './dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component'; import { DotEditContentJsonFieldComponent } from './dot-edit-content-json-field/dot-edit-content-json-field.component'; import { DotEditContentMultiSelectFieldComponent } from './dot-edit-content-multi-select-field/dot-edit-content-multi-select-field.component'; import { DotEditContentRadioFieldComponent } from './dot-edit-content-radio-field/dot-edit-content-radio-field.component'; @@ -27,7 +28,8 @@ import { DotEditContentWYSIWYGFieldComponent } from './dot-edit-content-wysiwyg- DotEditContentBinaryFieldComponent, DotEditContentJsonFieldComponent, DotEditContentCustomFieldComponent, - DotEditContentWYSIWYGFieldComponent + DotEditContentWYSIWYGFieldComponent, + DotEditContentHostFolderFieldComponent ], exports: [ DotEditContentTextAreaComponent, @@ -41,7 +43,8 @@ import { DotEditContentWYSIWYGFieldComponent } from './dot-edit-content-wysiwyg- DotEditContentBinaryFieldComponent, DotEditContentJsonFieldComponent, DotEditContentCustomFieldComponent, - DotEditContentWYSIWYGFieldComponent + DotEditContentWYSIWYGFieldComponent, + DotEditContentHostFolderFieldComponent ] }) export class DotEditContentFieldsModule {} diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html new file mode 100644 index 000000000000..ea7f4751d29c --- /dev/null +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html @@ -0,0 +1,6 @@ + diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.scss b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.scss new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts new file mode 100644 index 000000000000..d7742fca0b57 --- /dev/null +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts @@ -0,0 +1,152 @@ +import { Spectator, createComponentFactory } from '@ngneat/spectator'; + +import { ControlContainer, FormGroupDirective } from '@angular/forms'; + +import { Dropdown } from 'primeng/dropdown'; + +import { DotEditContentSelectFieldComponent } from './dot-edit-content-host-folder-field.component'; + +import { + SELECT_FIELD_BOOLEAN_MOCK, + SELECT_FIELD_TEXT_MOCK, + createFormGroupDirectiveMock, + SELECT_FIELD_INTEGER_MOCK, + SELECT_FIELD_FLOAT_MOCK +} from '../../utils/mocks'; + +describe('DotEditContentSelectFieldComponent', () => { + let spectator: Spectator; + + const createComponent = createComponentFactory({ + component: DotEditContentSelectFieldComponent, + componentViewProviders: [ + { provide: ControlContainer, useValue: createFormGroupDirectiveMock() } + ], + providers: [FormGroupDirective], + detectChanges: false + }); + + beforeEach(() => { + spectator = createComponent(); + }); + + it('should set the first value to the control if no value or defaultValue', () => { + spectator.setInput('field', SELECT_FIELD_TEXT_MOCK); + spectator.component.formControl.setValue(null); + spectator.detectChanges(); + expect(spectator.component.formControl.value).toEqual('Test,1'); + + const spanElement = spectator.query('span.p-dropdown-label'); + expect(spanElement).toBeTruthy(); + expect(spanElement.textContent).toEqual('Option 1'); + }); + + it('should set the value from control to dropdown', () => { + spectator.setInput('field', SELECT_FIELD_TEXT_MOCK); + spectator.component.formControl.setValue('2'); + spectator.detectChanges(); + + const spanElement = spectator.query('span.p-dropdown-label'); + expect(spanElement).toBeTruthy(); + expect(spanElement.textContent).toEqual('Option 2'); + }); + + it('should set the key/value the same when bad formatting options passed', () => { + const SELECT_FIELD_INTEGER_MOCK_WITHOUT_VALUE_AND_LABEL = { + ...SELECT_FIELD_INTEGER_MOCK, + values: '1000' + }; + spectator.setInput('field', SELECT_FIELD_INTEGER_MOCK_WITHOUT_VALUE_AND_LABEL); + spectator.detectComponentChanges(); + + const expectedList = [ + { + label: '1000', + value: 1000 + } + ]; + expect(spectator.query(Dropdown).options).toEqual(expectedList); + }); + + describe('test DataType', () => { + it('should have options array as select with Text', () => { + const expectedList = [ + { + label: 'Option 1', + value: 'Test,1' + }, + { + label: 'Option 2', + value: '2' + }, + { + label: 'Option 3', + value: '3' + }, + { + label: '123-ad', + value: '123-ad' + }, + { + label: 'rules and weird code', + value: 'rules and weird code' + } + ]; + spectator.setInput('field', SELECT_FIELD_TEXT_MOCK); + spectator.detectComponentChanges(); + expect(spectator.query(Dropdown).options).toEqual(expectedList); + }); + + it('should have options array as select with Bool', () => { + const expectedList = [ + { + label: 'Truthy', + value: true + }, + { + label: 'Falsy', + value: false + } + ]; + spectator.setInput('field', SELECT_FIELD_BOOLEAN_MOCK); + spectator.detectComponentChanges(); + expect(spectator.query(Dropdown).options).toEqual(expectedList); + }); + + it('should have options array as select with Float', () => { + const expectedList = [ + { + label: 'One hundred point five', + value: 100.5 + }, + { + label: 'Three point five', + value: 10.3 + } + ]; + spectator.setInput('field', SELECT_FIELD_FLOAT_MOCK); + spectator.detectComponentChanges(); + expect(spectator.query(Dropdown).options).toEqual(expectedList); + }); + + it('should have options array as select with Integer', () => { + const expectedList = [ + { + label: 'One hundred', + value: 100 + }, + { + label: 'One thousand', + value: 1000 + }, + { + label: 'Ten thousand', + value: 10000 + } + ]; + spectator.setInput('field', SELECT_FIELD_INTEGER_MOCK); + spectator.detectComponentChanges(); + expect(spectator.query(Dropdown).options).toEqual(expectedList); + }); + }); +}); diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts new file mode 100644 index 000000000000..bb322134ac4b --- /dev/null +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts @@ -0,0 +1,39 @@ +import { ChangeDetectionStrategy, Component, Input, inject } from '@angular/core'; +import { AbstractControl, ControlContainer, ReactiveFormsModule } from '@angular/forms'; + +import { TreeSelectModule } from 'primeng/treeselect'; + +import { DotCMSContentTypeField } from '@dotcms/dotcms-models'; + +import { DotEditContentFieldSingleSelectableDataTypes } from '../../models/dot-edit-content-field.type'; + +@Component({ + selector: 'dot-edit-content-host-folder-field', + standalone: true, + imports: [TreeSelectModule, ReactiveFormsModule], + templateUrl: './dot-edit-content-host-folder-field.component.html', + styleUrls: ['./dot-edit-content-host-folder-field.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush, + viewProviders: [ + { + provide: ControlContainer, + useFactory: () => inject(ControlContainer, { skipSelf: true }) + } + ] +}) +export class DotEditContentHostFolderFieldComponent { + @Input() field!: DotCMSContentTypeField; + private readonly controlContainer = inject(ControlContainer); + + options = []; + + /** + * Returns the form control for the select field. + * @returns {AbstractControl} The form control for the select field. + */ + get formControl() { + return this.controlContainer.control.get( + this.field.variable + ) as AbstractControl; + } +} From 6523b415a0b3271ab6d249e5b0e054482343cdad Mon Sep 17 00:00:00 2001 From: Nicolas Molina Date: Thu, 30 May 2024 16:46:30 -0400 Subject: [PATCH 05/24] chore: add mock field --- ...t-content-host-folder-field.component.html | 2 +- ...dit-content-host-folder-field.component.ts | 45 +++++++++++++++++-- 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html index ea7f4751d29c..c27056cac3d8 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html @@ -1,6 +1,6 @@ diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts index bb322134ac4b..ff5e2fe372b9 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts @@ -1,12 +1,51 @@ -import { ChangeDetectionStrategy, Component, Input, inject } from '@angular/core'; +import { ChangeDetectionStrategy, Component, Input, inject, signal } from '@angular/core'; import { AbstractControl, ControlContainer, ReactiveFormsModule } from '@angular/forms'; +import { TreeNode } from 'primeng/api'; import { TreeSelectModule } from 'primeng/treeselect'; import { DotCMSContentTypeField } from '@dotcms/dotcms-models'; import { DotEditContentFieldSingleSelectableDataTypes } from '../../models/dot-edit-content-field.type'; +const files: TreeNode[] = [ + { + label: 'Documents', + data: 'Documents Folder', + expandedIcon: 'pi pi-folder-open', + collapsedIcon: 'pi pi-folder', + children: [ + { + label: 'Work', + data: 'Work Folder', + expandedIcon: 'pi pi-folder-open', + collapsedIcon: 'pi pi-folder', + children: [ + { + label: 'Expenses.doc', + icon: 'pi pi-file', + data: 'Expenses Document' + }, + { label: 'Resume.doc', icon: 'pi pi-file', data: 'Resume Document' } + ] + }, + { + label: 'Home', + data: 'Home Folder', + expandedIcon: 'pi pi-folder-open', + collapsedIcon: 'pi pi-folder', + children: [ + { + label: 'Invoices.txt', + icon: 'pi pi-file', + data: 'Invoices for this month' + } + ] + } + ] + } +]; + @Component({ selector: 'dot-edit-content-host-folder-field', standalone: true, @@ -25,13 +64,13 @@ export class DotEditContentHostFolderFieldComponent { @Input() field!: DotCMSContentTypeField; private readonly controlContainer = inject(ControlContainer); - options = []; + options = signal(files); /** * Returns the form control for the select field. * @returns {AbstractControl} The form control for the select field. */ - get formControl() { + get formControl(): AbstractControl { return this.controlContainer.control.get( this.field.variable ) as AbstractControl; From e06df39bdc67f9399b042413c676b44eda9f9dbe Mon Sep 17 00:00:00 2001 From: Nicolas Molina Date: Fri, 31 May 2024 11:36:04 -0400 Subject: [PATCH 06/24] chore(edit-content): creating init setup for unit test with the new site /folder field #28645 --- .../dot-edit-content-field.component.spec.ts | 2 + ...t-content-host-folder-field.component.html | 9 +- ...ontent-host-folder-field.component.spec.ts | 138 +----------------- ...dit-content-host-folder-field.component.ts | 49 ++++--- ...dit-content-host-folder-field.interface.ts | 6 + .../src/lib/pipes/truncate-path.pipe.ts | 16 ++ .../libs/edit-content/src/lib/utils/mocks.ts | 29 +++- 7 files changed, 93 insertions(+), 156 deletions(-) create mode 100644 core-web/libs/edit-content/src/lib/models/dot-edit-content-host-folder-field.interface.ts create mode 100644 core-web/libs/edit-content/src/lib/pipes/truncate-path.pipe.ts diff --git a/core-web/libs/edit-content/src/lib/components/dot-edit-content-field/dot-edit-content-field.component.spec.ts b/core-web/libs/edit-content/src/lib/components/dot-edit-content-field/dot-edit-content-field.component.spec.ts index 2b43a30a0cb3..5ceff64e2f54 100644 --- a/core-web/libs/edit-content/src/lib/components/dot-edit-content-field/dot-edit-content-field.component.spec.ts +++ b/core-web/libs/edit-content/src/lib/components/dot-edit-content-field/dot-edit-content-field.component.spec.ts @@ -23,6 +23,7 @@ import { DotEditContentBinaryFieldComponent } from '../../fields/dot-edit-conten import { DotEditContentCalendarFieldComponent } from '../../fields/dot-edit-content-calendar-field/dot-edit-content-calendar-field.component'; import { DotEditContentCheckboxFieldComponent } from '../../fields/dot-edit-content-checkbox-field/dot-edit-content-checkbox-field.component'; import { DotEditContentCustomFieldComponent } from '../../fields/dot-edit-content-custom-field/dot-edit-content-custom-field.component'; +import { DotEditContentHostFolderFieldComponent } from '../../fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component'; import { DotEditContentJsonFieldComponent } from '../../fields/dot-edit-content-json-field/dot-edit-content-json-field.component'; import { DotEditContentKeyValueComponent } from '../../fields/dot-edit-content-key-value/dot-edit-content-key-value.component'; import { DotEditContentMultiSelectFieldComponent } from '../../fields/dot-edit-content-multi-select-field/dot-edit-content-multi-select-field.component'; @@ -71,6 +72,7 @@ const FIELD_TYPES_COMPONENTS: Record | DotEditFieldTe [FIELD_TYPES.DATE]: DotEditContentCalendarFieldComponent, [FIELD_TYPES.DATE_AND_TIME]: DotEditContentCalendarFieldComponent, [FIELD_TYPES.TIME]: DotEditContentCalendarFieldComponent, + [FIELD_TYPES.HOST_FOLDER]: DotEditContentHostFolderFieldComponent, [FIELD_TYPES.TAG]: { component: DotEditContentTagFieldComponent, providers: [{ provide: DotEditContentService, useValue: { getTags: () => of([]) } }] diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html index c27056cac3d8..3d0d81573ee3 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html @@ -2,5 +2,12 @@ [formControlName]="field.variable" [options]="options()" [attr.aria-labelledby]="'field-' + field.variable" + [filter]="true" + [filterInputAutoFocus]="true" optionLabel="label" - optionValue="value" /> + optionValue="value" + (onNodeSelect)="onNodeSelect($event)"> + + {{ node.label | truncatePath }} + + diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts index d7742fca0b57..1ecf70cb2ed6 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts @@ -2,23 +2,15 @@ import { Spectator, createComponentFactory } from '@ngneat/spectator'; import { ControlContainer, FormGroupDirective } from '@angular/forms'; -import { Dropdown } from 'primeng/dropdown'; +import { DotEditContentHostFolderFieldComponent } from './dot-edit-content-host-folder-field.component'; -import { DotEditContentSelectFieldComponent } from './dot-edit-content-host-folder-field.component'; +import { createFormGroupDirectiveMock } from '../../utils/mocks'; -import { - SELECT_FIELD_BOOLEAN_MOCK, - SELECT_FIELD_TEXT_MOCK, - createFormGroupDirectiveMock, - SELECT_FIELD_INTEGER_MOCK, - SELECT_FIELD_FLOAT_MOCK -} from '../../utils/mocks'; - -describe('DotEditContentSelectFieldComponent', () => { - let spectator: Spectator; +describe('DotEditContentHostFolderFieldComponent', () => { + let spectator: Spectator; const createComponent = createComponentFactory({ - component: DotEditContentSelectFieldComponent, + component: DotEditContentHostFolderFieldComponent, componentViewProviders: [ { provide: ControlContainer, useValue: createFormGroupDirectiveMock() } ], @@ -30,123 +22,7 @@ describe('DotEditContentSelectFieldComponent', () => { spectator = createComponent(); }); - it('should set the first value to the control if no value or defaultValue', () => { - spectator.setInput('field', SELECT_FIELD_TEXT_MOCK); - spectator.component.formControl.setValue(null); - spectator.detectChanges(); - expect(spectator.component.formControl.value).toEqual('Test,1'); - - const spanElement = spectator.query('span.p-dropdown-label'); - expect(spanElement).toBeTruthy(); - expect(spanElement.textContent).toEqual('Option 1'); - }); - - it('should set the value from control to dropdown', () => { - spectator.setInput('field', SELECT_FIELD_TEXT_MOCK); - spectator.component.formControl.setValue('2'); - spectator.detectChanges(); - - const spanElement = spectator.query('span.p-dropdown-label'); - expect(spanElement).toBeTruthy(); - expect(spanElement.textContent).toEqual('Option 2'); - }); - - it('should set the key/value the same when bad formatting options passed', () => { - const SELECT_FIELD_INTEGER_MOCK_WITHOUT_VALUE_AND_LABEL = { - ...SELECT_FIELD_INTEGER_MOCK, - values: '1000' - }; - spectator.setInput('field', SELECT_FIELD_INTEGER_MOCK_WITHOUT_VALUE_AND_LABEL); - spectator.detectComponentChanges(); - - const expectedList = [ - { - label: '1000', - value: 1000 - } - ]; - expect(spectator.query(Dropdown).options).toEqual(expectedList); - }); - - describe('test DataType', () => { - it('should have options array as select with Text', () => { - const expectedList = [ - { - label: 'Option 1', - value: 'Test,1' - }, - { - label: 'Option 2', - value: '2' - }, - { - label: 'Option 3', - value: '3' - }, - { - label: '123-ad', - value: '123-ad' - }, - { - label: 'rules and weird code', - value: 'rules and weird code' - } - ]; - spectator.setInput('field', SELECT_FIELD_TEXT_MOCK); - spectator.detectComponentChanges(); - expect(spectator.query(Dropdown).options).toEqual(expectedList); - }); - - it('should have options array as select with Bool', () => { - const expectedList = [ - { - label: 'Truthy', - value: true - }, - { - label: 'Falsy', - value: false - } - ]; - spectator.setInput('field', SELECT_FIELD_BOOLEAN_MOCK); - spectator.detectComponentChanges(); - expect(spectator.query(Dropdown).options).toEqual(expectedList); - }); - - it('should have options array as select with Float', () => { - const expectedList = [ - { - label: 'One hundred point five', - value: 100.5 - }, - { - label: 'Three point five', - value: 10.3 - } - ]; - spectator.setInput('field', SELECT_FIELD_FLOAT_MOCK); - spectator.detectComponentChanges(); - expect(spectator.query(Dropdown).options).toEqual(expectedList); - }); - - it('should have options array as select with Integer', () => { - const expectedList = [ - { - label: 'One hundred', - value: 100 - }, - { - label: 'One thousand', - value: 1000 - }, - { - label: 'Ten thousand', - value: 10000 - } - ]; - spectator.setInput('field', SELECT_FIELD_INTEGER_MOCK); - spectator.detectComponentChanges(); - expect(spectator.query(Dropdown).options).toEqual(expectedList); - }); + it('should create the component', () => { + expect(spectator.component).toBeTruthy(); }); }); diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts index ff5e2fe372b9..db56764c62a6 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts @@ -1,4 +1,4 @@ -import { ChangeDetectionStrategy, Component, Input, inject, signal } from '@angular/core'; +import { ChangeDetectionStrategy, Component, Input, OnInit, inject, signal } from '@angular/core'; import { AbstractControl, ControlContainer, ReactiveFormsModule } from '@angular/forms'; import { TreeNode } from 'primeng/api'; @@ -7,40 +7,32 @@ import { TreeSelectModule } from 'primeng/treeselect'; import { DotCMSContentTypeField } from '@dotcms/dotcms-models'; import { DotEditContentFieldSingleSelectableDataTypes } from '../../models/dot-edit-content-field.type'; +import { TruncatePathPipe } from '../../pipes/truncate-path.pipe'; const files: TreeNode[] = [ { - label: 'Documents', - data: 'Documents Folder', + label: 'demo.dotcms.com', + data: 'demo.dotcms.com', expandedIcon: 'pi pi-folder-open', collapsedIcon: 'pi pi-folder', children: [ { - label: 'Work', - data: 'Work Folder', + label: 'demo.dotcms.com/activities', + data: 'activities', expandedIcon: 'pi pi-folder-open', collapsedIcon: 'pi pi-folder', children: [ { - label: 'Expenses.doc', - icon: 'pi pi-file', - data: 'Expenses Document' - }, - { label: 'Resume.doc', icon: 'pi pi-file', data: 'Resume Document' } + label: 'demo.dotcms.com/activities/themes', + data: 'themes', + icon: 'pi pi-folder-open' + } ] }, { - label: 'Home', - data: 'Home Folder', - expandedIcon: 'pi pi-folder-open', - collapsedIcon: 'pi pi-folder', - children: [ - { - label: 'Invoices.txt', - icon: 'pi pi-file', - data: 'Invoices for this month' - } - ] + label: 'demo.dotcms.com/home', + data: 'home', + icon: 'pi pi-folder-open' } ] } @@ -49,7 +41,7 @@ const files: TreeNode[] = [ @Component({ selector: 'dot-edit-content-host-folder-field', standalone: true, - imports: [TreeSelectModule, ReactiveFormsModule], + imports: [TreeSelectModule, ReactiveFormsModule, TruncatePathPipe], templateUrl: './dot-edit-content-host-folder-field.component.html', styleUrls: ['./dot-edit-content-host-folder-field.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, @@ -60,12 +52,17 @@ const files: TreeNode[] = [ } ] }) -export class DotEditContentHostFolderFieldComponent { +export class DotEditContentHostFolderFieldComponent implements OnInit { @Input() field!: DotCMSContentTypeField; private readonly controlContainer = inject(ControlContainer); options = signal(files); + ngOnInit() { + const options = this.options(); + this.formControl.patchValue(options[0].children[0]); + } + /** * Returns the form control for the select field. * @returns {AbstractControl} The form control for the select field. @@ -75,4 +72,10 @@ export class DotEditContentHostFolderFieldComponent { this.field.variable ) as AbstractControl; } + + /** + onNodeSelect(event: TreeNodeSelectEvent) { + console.log(event.node); + } + */ } diff --git a/core-web/libs/edit-content/src/lib/models/dot-edit-content-host-folder-field.interface.ts b/core-web/libs/edit-content/src/lib/models/dot-edit-content-host-folder-field.interface.ts new file mode 100644 index 000000000000..f16f2022b564 --- /dev/null +++ b/core-web/libs/edit-content/src/lib/models/dot-edit-content-host-folder-field.interface.ts @@ -0,0 +1,6 @@ +import { TreeNode } from 'primeng/api'; + +export interface TreeNodeSelectEvent { + originalEvent: Event; + node: TreeNode; +} diff --git a/core-web/libs/edit-content/src/lib/pipes/truncate-path.pipe.ts b/core-web/libs/edit-content/src/lib/pipes/truncate-path.pipe.ts new file mode 100644 index 000000000000..a3ac355f4212 --- /dev/null +++ b/core-web/libs/edit-content/src/lib/pipes/truncate-path.pipe.ts @@ -0,0 +1,16 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'truncatePath', + standalone: true +}) +export class TruncatePathPipe implements PipeTransform { + transform(value: string): string { + const split = value.split('/'); + if (split.length > 0) { + return split.pop(); + } + + return value; + } +} diff --git a/core-web/libs/edit-content/src/lib/utils/mocks.ts b/core-web/libs/edit-content/src/lib/utils/mocks.ts index 43c1e9ad46d4..62382888854b 100644 --- a/core-web/libs/edit-content/src/lib/utils/mocks.ts +++ b/core-web/libs/edit-content/src/lib/utils/mocks.ts @@ -563,6 +563,32 @@ export const WYSIWYG_MOCK: DotCMSContentTypeField = { variable: 'WYSIWYG' }; +export const HOST_FOLDER_FIELD_TEXT_MOCK = { + clazz: 'com.dotcms.contenttype.model.field.ImmutableHostFolderField', + contentTypeId: '40e0cb1b57b3b1b7ec34191e942316d5', + dataType: 'TEXT', + defaultValue: null, + fieldType: 'Host-Folder', + fieldTypeLabel: 'hostFolder', + fieldVariables: [], + fixed: false, + forceIncludeInApi: false, + iDate: 1697579843000, + hint: 'A hint Text', + id: 'a6f33b8941b6c06c8ab36e44c4bf6500', + indexed: false, + listed: false, + modDate: 1697661626000, + name: 'hostFolderNormal', + readOnly: false, + required: false, + searchable: false, + sortOrder: 3, + unique: false, + values: '', + variable: 'hostFolderNormal' +}; + export const FIELDS_MOCK: DotCMSContentTypeField[] = [ TEXT_FIELD_MOCK, TEXT_AREA_FIELD_MOCK, @@ -585,7 +611,8 @@ export const FIELDS_MOCK: DotCMSContentTypeField[] = [ CUSTOM_FIELD_MOCK, JSON_FIELD_MOCK, KEY_VALUE_MOCK, - WYSIWYG_MOCK + WYSIWYG_MOCK, + HOST_FOLDER_FIELD_TEXT_MOCK ]; export const FIELD_MOCK: DotCMSContentTypeField = TEXT_FIELD_MOCK; From 90af4d2bf163aae4e7c065b1d0b93b1650333db6 Mon Sep 17 00:00:00 2001 From: Nicolas Molina Date: Wed, 5 Jun 2024 12:25:17 -0400 Subject: [PATCH 07/24] chore(edit-content): get current data and build current tree #28645 --- core-web/demo.js | 110 +++++++++++++++ .../dot-edit-content-field.component.ts | 4 - .../dot-edit-content-form.component.ts | 4 +- .../components/dot-edit-content-form/utils.ts | 36 +++++ ...t-content-host-folder-field.component.html | 10 +- ...ontent-host-folder-field.component.spec.ts | 60 +++++++- ...dit-content-host-folder-field.component.ts | 129 +++++++++++------- ...dit-content-host-folder-field.interface.ts | 22 ++- .../src/lib/pipes/truncate-path.pipe.ts | 2 +- .../lib/services/dot-edit-content.service.ts | 102 ++++++++++++-- .../libs/edit-content/src/lib/utils/mocks.ts | 21 ++- 11 files changed, 413 insertions(+), 87 deletions(-) create mode 100644 core-web/demo.js create mode 100644 core-web/libs/edit-content/src/lib/components/dot-edit-content-form/utils.ts diff --git a/core-web/demo.js b/core-web/demo.js new file mode 100644 index 000000000000..d838e3adf7dc --- /dev/null +++ b/core-web/demo.js @@ -0,0 +1,110 @@ +const data = [ + { + path: 'nicotest/', + folders: [ + { + key: 'nicotest/level1/', + label: 'nicotest/level1/', + data: { + addChildrenAllowed: true, + hostName: 'nicotest', + path: '/level1/', + type: 'folder' + }, + expandedIcon: 'pi pi-folder-open', + collapsedIcon: 'pi pi-folder', + leaf: false + }, + { + key: 'nicotest/level1b/', + label: 'nicotest/level1b/', + data: { + addChildrenAllowed: true, + hostName: 'nicotest', + path: '/level1b/', + type: 'folder' + }, + expandedIcon: 'pi pi-folder-open', + collapsedIcon: 'pi pi-folder', + leaf: false + } + ] + }, + { + path: 'nicotest/level1/', + folders: [ + { + key: 'nicotest/level1/1-1/', + label: 'nicotest/level1/1-1/', + data: { + addChildrenAllowed: true, + hostName: 'nicotest', + path: '/level1/1-1/', + type: 'folder' + }, + expandedIcon: 'pi pi-folder-open', + collapsedIcon: 'pi pi-folder', + leaf: false + }, + { + key: 'nicotest/level1/1-2/', + label: 'nicotest/level1/1-2/', + data: { + addChildrenAllowed: true, + hostName: 'nicotest', + path: '/level1/1-2/', + type: 'folder' + }, + expandedIcon: 'pi pi-folder-open', + collapsedIcon: 'pi pi-folder', + leaf: false + } + ] + }, + { + path: 'nicotest/level1/1-2/', + folders: [ + { + key: 'nicotest/level1/1-2/1-3/', + label: 'nicotest/level1/1-2/1-3/', + data: { + addChildrenAllowed: true, + hostName: 'nicotest', + path: '/level1/1-2/1-3/', + type: 'folder' + }, + expandedIcon: 'pi pi-folder-open', + collapsedIcon: 'pi pi-folder', + leaf: false + } + ] + }, + { + path: 'nicotest/level1/1-2/1-3/', + folders: [] + } +]; +const response = data.reverse(); +const [mainNode] = response; +const rta = response.reduce( + (rta, node, index, array) => { + const next = array[index + 1]; + if (next) { + folder = next.folders.find((item) => item.key === node.path); + if (folder) { + folder.children = node.folders; + console.log(mainNode.path, folder.key); + if (mainNode.path === folder.key) { + rta.node = folder; + } + } + } + rta.tree = node; + return rta; + }, + { node: null, tree: null } +); + +const buildTree = (tree) => {}; + +console.log(JSON.stringify(rta, null, 2)); diff --git a/core-web/libs/edit-content/src/lib/components/dot-edit-content-field/dot-edit-content-field.component.ts b/core-web/libs/edit-content/src/lib/components/dot-edit-content-field/dot-edit-content-field.component.ts index 58cd844fc6cb..ec2233ffd7db 100644 --- a/core-web/libs/edit-content/src/lib/components/dot-edit-content-field/dot-edit-content-field.component.ts +++ b/core-web/libs/edit-content/src/lib/components/dot-edit-content-field/dot-edit-content-field.component.ts @@ -1,4 +1,3 @@ -import { NgIf, NgSwitch, NgSwitchCase } from '@angular/common'; import { ChangeDetectionStrategy, Component, HostBinding, Input, inject } from '@angular/core'; import { ControlContainer, ReactiveFormsModule } from '@angular/forms'; @@ -26,9 +25,6 @@ import { FIELD_TYPES } from '../../models/dot-edit-content-field.enum'; ], changeDetection: ChangeDetectionStrategy.OnPush, imports: [ - NgSwitch, - NgSwitchCase, - NgIf, ReactiveFormsModule, DotEditContentFieldsModule, DotFieldRequiredDirective, diff --git a/core-web/libs/edit-content/src/lib/components/dot-edit-content-form/dot-edit-content-form.component.ts b/core-web/libs/edit-content/src/lib/components/dot-edit-content-form/dot-edit-content-form.component.ts index 334e691c971a..d636ddf2ce40 100644 --- a/core-web/libs/edit-content/src/lib/components/dot-edit-content-form/dot-edit-content-form.component.ts +++ b/core-web/libs/edit-content/src/lib/components/dot-edit-content-form/dot-edit-content-form.component.ts @@ -23,6 +23,8 @@ import { DotMessageService } from '@dotcms/data-access'; import { DotCMSContentTypeField, DotCMSContentTypeLayoutTab } from '@dotcms/dotcms-models'; import { DotMessagePipe } from '@dotcms/ui'; +import { resolutionValue } from './utils'; + import { CALENDAR_FIELD_TYPES, FLATTENED_FIELD_TYPES @@ -104,7 +106,7 @@ export class DotEditContentFormComponent implements OnInit { private initializeFormControl(field: DotCMSContentTypeField): FormControl { const validators = []; - const value = this.formData.contentlet?.[field.variable] ?? field.defaultValue; + const value = resolutionValue[field.fieldType](this.formData.contentlet, field); if (field.required) validators.push(Validators.required); if (field.regexCheck) { diff --git a/core-web/libs/edit-content/src/lib/components/dot-edit-content-form/utils.ts b/core-web/libs/edit-content/src/lib/components/dot-edit-content-form/utils.ts new file mode 100644 index 000000000000..a46758e47284 --- /dev/null +++ b/core-web/libs/edit-content/src/lib/components/dot-edit-content-form/utils.ts @@ -0,0 +1,36 @@ +import { DotCMSContentTypeField, DotCMSContentlet } from '@dotcms/dotcms-models'; + +import { FIELD_TYPES } from '../../models/dot-edit-content-field.enum'; + +export type FnResolution = (contentlet: DotCMSContentlet, field: DotCMSContentTypeField) => string; + +const defaultResolutionFn: FnResolution = (contentlet, field) => + contentlet?.[field.variable] ?? field.defaultValue; + +export const resolutionValue: Record = { + [FIELD_TYPES.BINARY]: defaultResolutionFn, + [FIELD_TYPES.BLOCK_EDITOR]: defaultResolutionFn, + [FIELD_TYPES.CHECKBOX]: defaultResolutionFn, + [FIELD_TYPES.CUSTOM_FIELD]: defaultResolutionFn, + [FIELD_TYPES.DATE]: defaultResolutionFn, + [FIELD_TYPES.DATE_AND_TIME]: defaultResolutionFn, + [FIELD_TYPES.HOST_FOLDER]: (contentlet, field) => { + if (contentlet?.hostName && contentlet?.url) { + const path = `${contentlet?.hostName}${contentlet?.url}`; + + return path.slice(0, path.indexOf('/content')); + } + + return field.defaultValue ?? ''; + }, + [FIELD_TYPES.JSON]: defaultResolutionFn, + [FIELD_TYPES.KEY_VALUE]: defaultResolutionFn, + [FIELD_TYPES.MULTI_SELECT]: defaultResolutionFn, + [FIELD_TYPES.RADIO]: defaultResolutionFn, + [FIELD_TYPES.SELECT]: defaultResolutionFn, + [FIELD_TYPES.TAG]: defaultResolutionFn, + [FIELD_TYPES.TEXT]: defaultResolutionFn, + [FIELD_TYPES.TEXTAREA]: defaultResolutionFn, + [FIELD_TYPES.TIME]: defaultResolutionFn, + [FIELD_TYPES.WYSIWYG]: defaultResolutionFn +}; diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html index 3d0d81573ee3..f4ed67f25435 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html @@ -1,12 +1,10 @@ + selectionMode="single" + (onNodeSelect)="onNodeSelect($event)" + (onNodeExpand)="onNodeExpand($event)"> {{ node.label | truncatePath }} diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts index 1ecf70cb2ed6..7125810d1571 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts @@ -1,28 +1,80 @@ -import { Spectator, createComponentFactory } from '@ngneat/spectator'; +import { Spectator, createComponentFactory, mockProvider, SpyObject } from '@ngneat/spectator/jest'; +import { of } from 'rxjs'; import { ControlContainer, FormGroupDirective } from '@angular/forms'; +import { TreeNode } from 'primeng/api'; + import { DotEditContentHostFolderFieldComponent } from './dot-edit-content-host-folder-field.component'; -import { createFormGroupDirectiveMock } from '../../utils/mocks'; +import { DotEditContentService } from '../../services/dot-edit-content.service'; +import { HOST_FOLDER_FIELD_TEXT_MOCK, createFormGroupDirectiveMock } from '../../utils/mocks'; + +const files: TreeNode[] = [ + { + label: 'demo.dotcms.com', + data: 'demo.dotcms.com', + expandedIcon: 'pi pi-folder-open', + collapsedIcon: 'pi pi-folder', + children: [ + { + label: 'demo.dotcms.com/activities', + data: 'activities', + expandedIcon: 'pi pi-folder-open', + collapsedIcon: 'pi pi-folder', + children: [ + { + label: 'demo.dotcms.com/activities/themes', + data: 'themes', + icon: 'pi pi-folder-open' + } + ] + }, + { + label: 'demo.dotcms.com/home', + data: 'home', + icon: 'pi pi-folder-open' + } + ] + } +]; describe('DotEditContentHostFolderFieldComponent', () => { let spectator: Spectator; + let service: SpyObject; const createComponent = createComponentFactory({ component: DotEditContentHostFolderFieldComponent, componentViewProviders: [ { provide: ControlContainer, useValue: createFormGroupDirectiveMock() } ], - providers: [FormGroupDirective], + providers: [ + FormGroupDirective, + mockProvider(DotEditContentService, { + getSitesTreePath: jest.fn().mockReturnValue(of(files)) + }) + ], detectChanges: false }); beforeEach(() => { - spectator = createComponent(); + spectator = createComponent({ + props: { + field: { + ...HOST_FOLDER_FIELD_TEXT_MOCK + } + } + }); + service = spectator.inject(DotEditContentService); + spectator.detectChanges(); + }); + + afterEach(() => { + jest.resetAllMocks(); }); it('should create the component', () => { expect(spectator.component).toBeTruthy(); + expect(service.getSitesTreePath).toHaveBeenCalled(); }); }); diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts index db56764c62a6..bbbd83856955 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts @@ -1,42 +1,27 @@ -import { ChangeDetectionStrategy, Component, Input, OnInit, inject, signal } from '@angular/core'; -import { AbstractControl, ControlContainer, ReactiveFormsModule } from '@angular/forms'; +import { + ChangeDetectionStrategy, + Component, + Input, + OnInit, + ViewChild, + inject, + signal +} from '@angular/core'; +import { ControlContainer, FormControl, ReactiveFormsModule } from '@angular/forms'; -import { TreeNode } from 'primeng/api'; -import { TreeSelectModule } from 'primeng/treeselect'; +import { TreeSelect, TreeSelectModule } from 'primeng/treeselect'; +import { Site } from '@dotcms/dotcms-js'; import { DotCMSContentTypeField } from '@dotcms/dotcms-models'; import { DotEditContentFieldSingleSelectableDataTypes } from '../../models/dot-edit-content-field.type'; +import { + TreeNodeItem, + TreeNodeSelectEvent, + TreeNodeSelectItem +} from '../../models/dot-edit-content-host-folder-field.interface'; import { TruncatePathPipe } from '../../pipes/truncate-path.pipe'; - -const files: TreeNode[] = [ - { - label: 'demo.dotcms.com', - data: 'demo.dotcms.com', - expandedIcon: 'pi pi-folder-open', - collapsedIcon: 'pi pi-folder', - children: [ - { - label: 'demo.dotcms.com/activities', - data: 'activities', - expandedIcon: 'pi pi-folder-open', - collapsedIcon: 'pi pi-folder', - children: [ - { - label: 'demo.dotcms.com/activities/themes', - data: 'themes', - icon: 'pi pi-folder-open' - } - ] - }, - { - label: 'demo.dotcms.com/home', - data: 'home', - icon: 'pi pi-folder-open' - } - ] - } -]; +import { DotEditContentService } from '../../services/dot-edit-content.service'; @Component({ selector: 'dot-edit-content-host-folder-field', @@ -54,28 +39,76 @@ const files: TreeNode[] = [ }) export class DotEditContentHostFolderFieldComponent implements OnInit { @Input() field!: DotCMSContentTypeField; - private readonly controlContainer = inject(ControlContainer); + @ViewChild(TreeSelect) tree!: TreeSelect; + readonly #controlContainer = inject(ControlContainer); + readonly #editContentService = inject(DotEditContentService); - options = signal(files); + options = signal([]); + pathControl = new FormControl(); ngOnInit() { - const options = this.options(); - this.formControl.patchValue(options[0].children[0]); + this.#editContentService.getSitesTreePath().subscribe((options) => { + this.options.set(options); + this.getInitialValue(); + }); } - /** - * Returns the form control for the select field. - * @returns {AbstractControl} The form control for the select field. - */ - get formControl(): AbstractControl { - return this.controlContainer.control.get( + get formControl(): FormControl { + return this.#controlContainer.control.get( this.field.variable - ) as AbstractControl; + ) as FormControl; + } + + onNodeSelect(event: TreeNodeSelectEvent) { + this.formControl.setValue(event.node.label); + } + + onNodeExpand(event: TreeNodeSelectItem) { + if (!event.node.children) { + this.#editContentService.getFoldersTreeNode(event.node.label).subscribe((children) => { + if (children.length > 0) { + event.node.children = children; + } else { + event.node.leaf = true; + event.node.icon = 'pi pi-folder-open'; + } + + this.tree.cd.detectChanges(); + }); + } } - /** - onNodeSelect(event: TreeNodeSelectEvent) { - console.log(event.node); + getInitialValue() { + const value = this.formControl.value as string; + if (value) { + const split = value.split('/'); + const paths = split.reduce((array, item, index) => { + const prev = array[index - 1]; + let path = `${item}/`; + if (prev) { + path = `${prev}${path}`; + } + + array.push(path); + + return array; + }, []); + this.#editContentService.buildTreeByPaths(paths).subscribe((rta) => { + const sitePath = rta.tree.path.replace('/', ''); + this.options.update((options) => { + return options.map((item) => { + if (item.key === sitePath) { + return { + ...item, + children: [...rta.tree.folders] + }; + } + + return item; + }); + }); + this.pathControl.setValue(rta.node); + }); + } } - */ } diff --git a/core-web/libs/edit-content/src/lib/models/dot-edit-content-host-folder-field.interface.ts b/core-web/libs/edit-content/src/lib/models/dot-edit-content-host-folder-field.interface.ts index f16f2022b564..7396292f85e4 100644 --- a/core-web/libs/edit-content/src/lib/models/dot-edit-content-host-folder-field.interface.ts +++ b/core-web/libs/edit-content/src/lib/models/dot-edit-content-host-folder-field.interface.ts @@ -1,6 +1,24 @@ import { TreeNode } from 'primeng/api'; -export interface TreeNodeSelectEvent { +import { Site } from '@dotcms/dotcms-js'; + +export type TreeSiteData = Site & { type: 'site'; path: string }; + +export type TreeFolderData = DotFolder & { type: 'folder'; path: string }; + +export type TreeDataItems = TreeSiteData | TreeFolderData; + +export type TreeNodeItem = TreeNode; + +export type TreeNodeSelectItem = TreeNodeSelectEvent; + +export interface TreeNodeSelectEvent { originalEvent: Event; - node: TreeNode; + node: TreeNode; +} + +export interface DotFolder { + hostName: string; + path: string; + addChildrenAllowed: boolean; } diff --git a/core-web/libs/edit-content/src/lib/pipes/truncate-path.pipe.ts b/core-web/libs/edit-content/src/lib/pipes/truncate-path.pipe.ts index a3ac355f4212..0560155b6e79 100644 --- a/core-web/libs/edit-content/src/lib/pipes/truncate-path.pipe.ts +++ b/core-web/libs/edit-content/src/lib/pipes/truncate-path.pipe.ts @@ -6,7 +6,7 @@ import { Pipe, PipeTransform } from '@angular/core'; }) export class TruncatePathPipe implements PipeTransform { transform(value: string): string { - const split = value.split('/'); + const split = value.split('/').filter((item) => item !== ''); if (split.length > 0) { return split.pop(); } diff --git a/core-web/libs/edit-content/src/lib/services/dot-edit-content.service.ts b/core-web/libs/edit-content/src/lib/services/dot-edit-content.service.ts index 9c9847a18c73..e0133a98807a 100644 --- a/core-web/libs/edit-content/src/lib/services/dot-edit-content.service.ts +++ b/core-web/libs/edit-content/src/lib/services/dot-edit-content.service.ts @@ -1,18 +1,25 @@ -import { Observable } from 'rxjs'; +import { Observable, forkJoin } from 'rxjs'; import { HttpClient, HttpParams } from '@angular/common/http'; import { Injectable, inject } from '@angular/core'; import { map, pluck } from 'rxjs/operators'; -import { DotContentTypeService, DotWorkflowActionsFireService } from '@dotcms/data-access'; +import { + DotContentTypeService, + DotWorkflowActionsFireService, + DotSiteService +} from '@dotcms/data-access'; import { DotCMSContentType, DotCMSContentlet } from '@dotcms/dotcms-models'; +import { DotFolder, TreeNodeItem } from '../models/dot-edit-content-host-folder-field.interface'; + @Injectable() export class DotEditContentService { - private readonly dotContentTypeService = inject(DotContentTypeService); - private readonly dotWorkflowActionsFireService = inject(DotWorkflowActionsFireService); - private readonly http = inject(HttpClient); + readonly #dotContentTypeService = inject(DotContentTypeService); + readonly #siteService = inject(DotSiteService); + readonly #dotWorkflowActionsFireService = inject(DotWorkflowActionsFireService); + readonly #http = inject(HttpClient); /** * Retrieves the content by its ID. @@ -20,7 +27,7 @@ export class DotEditContentService { * @returns An observable of the DotCMSContentType object. */ getContentById(id: string): Observable { - return this.http.get(`/api/v1/content/${id}`).pipe(pluck('entity')); + return this.#http.get(`/api/v1/content/${id}`).pipe(pluck('entity')); } /** @@ -31,7 +38,7 @@ export class DotEditContentService { * @memberof DotEditContentService */ getContentType(idOrVar: string): Observable { - return this.dotContentTypeService.getContentType(idOrVar); + return this.#dotContentTypeService.getContentType(idOrVar); } /** @@ -42,7 +49,7 @@ export class DotEditContentService { getTags(name: string) { const params = new HttpParams().set('name', name); - return this.http.get('/api/v2/tags', { params }).pipe( + return this.#http.get('/api/v2/tags', { params }).pipe( pluck('entity'), map((res) => Object.values(res).map((obj) => obj.label)) ); @@ -54,6 +61,83 @@ export class DotEditContentService { * The type of the emitted contentlet is determined by the generic type parameter. */ saveContentlet(data: { [key: string]: string }): Observable { - return this.dotWorkflowActionsFireService.saveContentlet(data); + return this.#dotWorkflowActionsFireService.saveContentlet(data); + } + + /** + * Get data for site/folder field and tranform into TreeNode + * @returns files + */ + getSitesTreePath(): Observable { + return this.#siteService.getSites().pipe( + map((sites) => { + return sites.map((site) => ({ + key: site.hostname, + label: `${site.hostname}`, + data: { ...site, path: site.hostname, type: 'site' }, + expandedIcon: 'pi pi-folder-open', + collapsedIcon: 'pi pi-folder', + leaf: false + })); + }) + ); + } + + getFolders(path: string): Observable { + return this.#http.post('/api/v1/folder/byPath', { path }).pipe(pluck('entity')); + } + + getFoldersTreeNode(fullPath: string): Observable { + let path = fullPath.split('/').splice(1).join('/'); + path = path === '' ? '/' : `/${path}`; + + return this.getFolders(`//${fullPath}`).pipe( + map((folders) => { + return folders + .filter((folder) => folder.path !== path) + .map((folder) => ({ + key: `${folder.hostName}${folder.path}`, + label: `${folder.hostName}${folder.path}`, + data: { ...folder, path: folder.path, type: 'folder' }, + expandedIcon: 'pi pi-folder-open', + collapsedIcon: 'pi pi-folder', + leaf: false + })); + }) + ); + } + + buildTreeByPaths(paths: string[]) { + const requests = paths + .reverse() + .map((path) => + this.getFoldersTreeNode(path).pipe(map((folders) => ({ path, folders }))) + ); + + return forkJoin(requests).pipe( + map((response) => { + const [mainNode] = response; + + return response.reduce( + (rta, node, index, array) => { + const next = array[index + 1]; + if (next) { + const folder = next.folders.find((item) => item.key === node.path); + if (folder) { + folder.children = node.folders; + if (mainNode.path === folder.key) { + rta.node = folder; + } + } + } + + rta.tree = node; + + return rta; + }, + { tree: null, node: null } + ); + }) + ); } } diff --git a/core-web/libs/edit-content/src/lib/utils/mocks.ts b/core-web/libs/edit-content/src/lib/utils/mocks.ts index 62382888854b..591919819c37 100644 --- a/core-web/libs/edit-content/src/lib/utils/mocks.ts +++ b/core-web/libs/edit-content/src/lib/utils/mocks.ts @@ -565,28 +565,25 @@ export const WYSIWYG_MOCK: DotCMSContentTypeField = { export const HOST_FOLDER_FIELD_TEXT_MOCK = { clazz: 'com.dotcms.contenttype.model.field.ImmutableHostFolderField', - contentTypeId: '40e0cb1b57b3b1b7ec34191e942316d5', - dataType: 'TEXT', - defaultValue: null, + contentTypeId: '61226fd915b7f025da020fc1f5856ab7', + dataType: 'SYSTEM', fieldType: 'Host-Folder', - fieldTypeLabel: 'hostFolder', + fieldTypeLabel: 'Site or Folder', fieldVariables: [], fixed: false, forceIncludeInApi: false, - iDate: 1697579843000, - hint: 'A hint Text', - id: 'a6f33b8941b6c06c8ab36e44c4bf6500', - indexed: false, + iDate: 1717083750000, + id: 'b7c41ffd6b6bc1250f2fc85a3637471b', + indexed: true, listed: false, - modDate: 1697661626000, - name: 'hostFolderNormal', + modDate: 1717088310000, + name: 'Site Or Folder', readOnly: false, required: false, searchable: false, sortOrder: 3, unique: false, - values: '', - variable: 'hostFolderNormal' + variable: 'siteOrFolder' }; export const FIELDS_MOCK: DotCMSContentTypeField[] = [ From f56b6ddb4bdb4e965bc5695647a54995d9952435 Mon Sep 17 00:00:00 2001 From: Nicolas Molina Date: Wed, 5 Jun 2024 12:25:45 -0400 Subject: [PATCH 08/24] chore(edit-content): get current data and build current tree #28645 --- core-web/demo.js | 110 ------------------ ...DotLocaleConfirmationDialog.component.html | 2 +- 2 files changed, 1 insertion(+), 111 deletions(-) delete mode 100644 core-web/demo.js diff --git a/core-web/demo.js b/core-web/demo.js deleted file mode 100644 index d838e3adf7dc..000000000000 --- a/core-web/demo.js +++ /dev/null @@ -1,110 +0,0 @@ -const data = [ - { - path: 'nicotest/', - folders: [ - { - key: 'nicotest/level1/', - label: 'nicotest/level1/', - data: { - addChildrenAllowed: true, - hostName: 'nicotest', - path: '/level1/', - type: 'folder' - }, - expandedIcon: 'pi pi-folder-open', - collapsedIcon: 'pi pi-folder', - leaf: false - }, - { - key: 'nicotest/level1b/', - label: 'nicotest/level1b/', - data: { - addChildrenAllowed: true, - hostName: 'nicotest', - path: '/level1b/', - type: 'folder' - }, - expandedIcon: 'pi pi-folder-open', - collapsedIcon: 'pi pi-folder', - leaf: false - } - ] - }, - { - path: 'nicotest/level1/', - folders: [ - { - key: 'nicotest/level1/1-1/', - label: 'nicotest/level1/1-1/', - data: { - addChildrenAllowed: true, - hostName: 'nicotest', - path: '/level1/1-1/', - type: 'folder' - }, - expandedIcon: 'pi pi-folder-open', - collapsedIcon: 'pi pi-folder', - leaf: false - }, - { - key: 'nicotest/level1/1-2/', - label: 'nicotest/level1/1-2/', - data: { - addChildrenAllowed: true, - hostName: 'nicotest', - path: '/level1/1-2/', - type: 'folder' - }, - expandedIcon: 'pi pi-folder-open', - collapsedIcon: 'pi pi-folder', - leaf: false - } - ] - }, - { - path: 'nicotest/level1/1-2/', - folders: [ - { - key: 'nicotest/level1/1-2/1-3/', - label: 'nicotest/level1/1-2/1-3/', - data: { - addChildrenAllowed: true, - hostName: 'nicotest', - path: '/level1/1-2/1-3/', - type: 'folder' - }, - expandedIcon: 'pi pi-folder-open', - collapsedIcon: 'pi pi-folder', - leaf: false - } - ] - }, - { - path: 'nicotest/level1/1-2/1-3/', - folders: [] - } -]; -const response = data.reverse(); -const [mainNode] = response; -const rta = response.reduce( - (rta, node, index, array) => { - const next = array[index + 1]; - if (next) { - folder = next.folders.find((item) => item.key === node.path); - if (folder) { - folder.children = node.folders; - console.log(mainNode.path, folder.key); - if (mainNode.path === folder.key) { - rta.node = folder; - } - } - } - rta.tree = node; - return rta; - }, - { node: null, tree: null } -); - -const buildTree = (tree) => {}; - -console.log(JSON.stringify(rta, null, 2)); diff --git a/core-web/libs/portlets/dot-locales/portlet/src/lib/share/ui/DotLocaleConfirmationDialog/DotLocaleConfirmationDialog.component.html b/core-web/libs/portlets/dot-locales/portlet/src/lib/share/ui/DotLocaleConfirmationDialog/DotLocaleConfirmationDialog.component.html index a75c49568536..0da906e71bda 100644 --- a/core-web/libs/portlets/dot-locales/portlet/src/lib/share/ui/DotLocaleConfirmationDialog/DotLocaleConfirmationDialog.component.html +++ b/core-web/libs/portlets/dot-locales/portlet/src/lib/share/ui/DotLocaleConfirmationDialog/DotLocaleConfirmationDialog.component.html @@ -3,7 +3,7 @@
- +
From 78d08e45fbee9cb7e9562330ced39552955ae58e Mon Sep 17 00:00:00 2001 From: Nicolas Molina Date: Thu, 6 Jun 2024 11:37:55 -0400 Subject: [PATCH 09/24] chore(edit-content): avoid code smells #28645 --- .../components/dot-edit-content-form/utils.ts | 9 ++- ...t-content-host-folder-field.component.html | 2 +- ...ontent-host-folder-field.component.spec.ts | 39 ++--------- ...dit-content-host-folder-field.component.ts | 67 +++++++++++-------- ...dit-content-host-folder-field.interface.ts | 12 +--- .../lib/services/dot-edit-content.service.ts | 39 +++++++---- .../src/lib/utils/functions.util.ts | 33 +++++++++ .../libs/edit-content/src/lib/utils/mocks.ts | 31 +++++++++ 8 files changed, 144 insertions(+), 88 deletions(-) diff --git a/core-web/libs/edit-content/src/lib/components/dot-edit-content-form/utils.ts b/core-web/libs/edit-content/src/lib/components/dot-edit-content-form/utils.ts index a46758e47284..9d4b807df29f 100644 --- a/core-web/libs/edit-content/src/lib/components/dot-edit-content-form/utils.ts +++ b/core-web/libs/edit-content/src/lib/components/dot-edit-content-form/utils.ts @@ -2,12 +2,15 @@ import { DotCMSContentTypeField, DotCMSContentlet } from '@dotcms/dotcms-models' import { FIELD_TYPES } from '../../models/dot-edit-content-field.enum'; -export type FnResolution = (contentlet: DotCMSContentlet, field: DotCMSContentTypeField) => string; +export type FnResolutionValue = ( + contentlet: DotCMSContentlet, + field: DotCMSContentTypeField +) => string; -const defaultResolutionFn: FnResolution = (contentlet, field) => +const defaultResolutionFn: FnResolutionValue = (contentlet, field) => contentlet?.[field.variable] ?? field.defaultValue; -export const resolutionValue: Record = { +export const resolutionValue: Record = { [FIELD_TYPES.BINARY]: defaultResolutionFn, [FIELD_TYPES.BLOCK_EDITOR]: defaultResolutionFn, [FIELD_TYPES.CHECKBOX]: defaultResolutionFn, diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html index f4ed67f25435..1c3f9dd1af9a 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html @@ -1,8 +1,8 @@ diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts index 7125810d1571..c7b7ad013a68 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts @@ -3,41 +3,14 @@ import { of } from 'rxjs'; import { ControlContainer, FormGroupDirective } from '@angular/forms'; -import { TreeNode } from 'primeng/api'; - import { DotEditContentHostFolderFieldComponent } from './dot-edit-content-host-folder-field.component'; import { DotEditContentService } from '../../services/dot-edit-content.service'; -import { HOST_FOLDER_FIELD_TEXT_MOCK, createFormGroupDirectiveMock } from '../../utils/mocks'; - -const files: TreeNode[] = [ - { - label: 'demo.dotcms.com', - data: 'demo.dotcms.com', - expandedIcon: 'pi pi-folder-open', - collapsedIcon: 'pi pi-folder', - children: [ - { - label: 'demo.dotcms.com/activities', - data: 'activities', - expandedIcon: 'pi pi-folder-open', - collapsedIcon: 'pi pi-folder', - children: [ - { - label: 'demo.dotcms.com/activities/themes', - data: 'themes', - icon: 'pi pi-folder-open' - } - ] - }, - { - label: 'demo.dotcms.com/home', - data: 'home', - icon: 'pi pi-folder-open' - } - ] - } -]; +import { + HOST_FOLDER_FIELD_TEXT_MOCK, + TREE_SELECT_MOCK, + createFormGroupDirectiveMock +} from '../../utils/mocks'; describe('DotEditContentHostFolderFieldComponent', () => { let spectator: Spectator; @@ -51,7 +24,7 @@ describe('DotEditContentHostFolderFieldComponent', () => { providers: [ FormGroupDirective, mockProvider(DotEditContentService, { - getSitesTreePath: jest.fn().mockReturnValue(of(files)) + getSitesTreePath: jest.fn().mockReturnValue(of(TREE_SELECT_MOCK)) }) ], detectChanges: false diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts index bbbd83856955..18d8af6e3c7c 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts @@ -22,6 +22,7 @@ import { } from '../../models/dot-edit-content-host-folder-field.interface'; import { TruncatePathPipe } from '../../pipes/truncate-path.pipe'; import { DotEditContentService } from '../../services/dot-edit-content.service'; +import { createPaths } from '../../utils/functions.util'; @Component({ selector: 'dot-edit-content-host-folder-field', @@ -39,7 +40,7 @@ import { DotEditContentService } from '../../services/dot-edit-content.service'; }) export class DotEditContentHostFolderFieldComponent implements OnInit { @Input() field!: DotCMSContentTypeField; - @ViewChild(TreeSelect) tree!: TreeSelect; + @ViewChild(TreeSelect) treeSelect!: TreeSelect; readonly #controlContainer = inject(ControlContainer); readonly #editContentService = inject(DotEditContentService); @@ -60,12 +61,21 @@ export class DotEditContentHostFolderFieldComponent implements OnInit { } onNodeSelect(event: TreeNodeSelectEvent) { - this.formControl.setValue(event.node.label); + const label = event.node.label; + if (label) { + const split = label.split('/'); + if (split.length > 0) { + const site = split[0]; + const path = split.slice(1, split.length); + this.formControl.setValue(`${site}:/${path.join('/')}`); + } + } } onNodeExpand(event: TreeNodeSelectItem) { if (!event.node.children) { - this.#editContentService.getFoldersTreeNode(event.node.label).subscribe((children) => { + const { hostname, path } = event.node.data; + this.#editContentService.getFoldersTreeNode(hostname, path).subscribe((children) => { if (children.length > 0) { event.node.children = children; } else { @@ -73,7 +83,7 @@ export class DotEditContentHostFolderFieldComponent implements OnInit { event.node.icon = 'pi pi-folder-open'; } - this.tree.cd.detectChanges(); + this.treeSelect.cd.detectChanges(); }); } } @@ -81,34 +91,33 @@ export class DotEditContentHostFolderFieldComponent implements OnInit { getInitialValue() { const value = this.formControl.value as string; if (value) { - const split = value.split('/'); - const paths = split.reduce((array, item, index) => { - const prev = array[index - 1]; - let path = `${item}/`; - if (prev) { - path = `${prev}${path}`; - } - - array.push(path); + const hasPaths = value.includes('/'); + if (hasPaths) { + this.buildTreeByPaths(value); + } else { + const options = this.options(); + this.pathControl.setValue(options.find((item) => item.key === value)); + } + } + } - return array; - }, []); - this.#editContentService.buildTreeByPaths(paths).subscribe((rta) => { - const sitePath = rta.tree.path.replace('/', ''); - this.options.update((options) => { - return options.map((item) => { - if (item.key === sitePath) { - return { - ...item, - children: [...rta.tree.folders] - }; - } + private buildTreeByPaths(path: string) { + const paths = createPaths(path); + this.#editContentService.buildTreeByPaths(paths).subscribe((rta) => { + const sitePath = rta.tree.path; + this.options.update((options) => { + return options.map((item) => { + if (item.key === sitePath) { + return { + ...item, + children: [...rta.tree.folders] + }; + } - return item; - }); + return item; }); - this.pathControl.setValue(rta.node); }); - } + this.pathControl.setValue(rta.node); + }); } } diff --git a/core-web/libs/edit-content/src/lib/models/dot-edit-content-host-folder-field.interface.ts b/core-web/libs/edit-content/src/lib/models/dot-edit-content-host-folder-field.interface.ts index 7396292f85e4..3bf79a0ef3ff 100644 --- a/core-web/libs/edit-content/src/lib/models/dot-edit-content-host-folder-field.interface.ts +++ b/core-web/libs/edit-content/src/lib/models/dot-edit-content-host-folder-field.interface.ts @@ -1,16 +1,10 @@ import { TreeNode } from 'primeng/api'; -import { Site } from '@dotcms/dotcms-js'; +export type TreeNodeData = { type: 'site' | 'folder'; path: string; hostname: string }; -export type TreeSiteData = Site & { type: 'site'; path: string }; +export type TreeNodeItem = TreeNode; -export type TreeFolderData = DotFolder & { type: 'folder'; path: string }; - -export type TreeDataItems = TreeSiteData | TreeFolderData; - -export type TreeNodeItem = TreeNode; - -export type TreeNodeSelectItem = TreeNodeSelectEvent; +export type TreeNodeSelectItem = TreeNodeSelectEvent; export interface TreeNodeSelectEvent { originalEvent: Event; diff --git a/core-web/libs/edit-content/src/lib/services/dot-edit-content.service.ts b/core-web/libs/edit-content/src/lib/services/dot-edit-content.service.ts index e0133a98807a..7e9d74a94137 100644 --- a/core-web/libs/edit-content/src/lib/services/dot-edit-content.service.ts +++ b/core-web/libs/edit-content/src/lib/services/dot-edit-content.service.ts @@ -74,7 +74,11 @@ export class DotEditContentService { return sites.map((site) => ({ key: site.hostname, label: `${site.hostname}`, - data: { ...site, path: site.hostname, type: 'site' }, + data: { + hostname: site.hostname, + path: '', + type: 'site' + }, expandedIcon: 'pi pi-folder-open', collapsedIcon: 'pi pi-folder', leaf: false @@ -87,18 +91,23 @@ export class DotEditContentService { return this.#http.post('/api/v1/folder/byPath', { path }).pipe(pluck('entity')); } - getFoldersTreeNode(fullPath: string): Observable { - let path = fullPath.split('/').splice(1).join('/'); - path = path === '' ? '/' : `/${path}`; - - return this.getFolders(`//${fullPath}`).pipe( + getFoldersTreeNode(hostName: string, path: string): Observable { + return this.getFolders(`//${hostName}/${path}`).pipe( map((folders) => { return folders - .filter((folder) => folder.path !== path) + .filter((folder) => { + const checkPath = path === '' ? '/' : path; + + return folder.path !== checkPath; + }) .map((folder) => ({ - key: `${folder.hostName}${folder.path}`, + key: `${folder.hostName}${folder.path}`.replace('/', ''), label: `${folder.hostName}${folder.path}`, - data: { ...folder, path: folder.path, type: 'folder' }, + data: { + hostname: folder.hostName, + path: folder.path, + type: 'folder' + }, expandedIcon: 'pi pi-folder-open', collapsedIcon: 'pi pi-folder', leaf: false @@ -108,11 +117,15 @@ export class DotEditContentService { } buildTreeByPaths(paths: string[]) { - const requests = paths - .reverse() - .map((path) => - this.getFoldersTreeNode(path).pipe(map((folders) => ({ path, folders }))) + const requests = paths.reverse().map((path) => { + const split = path.split('/'); + const [hostName] = split; + const subPath = split.slice(1).join('/'); + + return this.getFoldersTreeNode(hostName, subPath).pipe( + map((folders) => ({ path, folders })) ); + }); return forkJoin(requests).pipe( map((response) => { diff --git a/core-web/libs/edit-content/src/lib/utils/functions.util.ts b/core-web/libs/edit-content/src/lib/utils/functions.util.ts index c743fe970bde..c54ca9c08456 100644 --- a/core-web/libs/edit-content/src/lib/utils/functions.util.ts +++ b/core-web/libs/edit-content/src/lib/utils/functions.util.ts @@ -177,3 +177,36 @@ export const stringToJson = (value: string) => { return isValidJson(value) ? JSON.parse(value) : {}; }; + +/** + * Converts a JSON string into a JavaScript object. + * Create all paths based in a Path + * + * @param {string} path - the path + * @return {string[]} - An arrray with all posibles pats + * + * @usageNotes + * + * ### Example + * + * ```ts + * const path = 'demo.com/level1/level2'; + * const paths = createPaths(path); + * console.log(paths); // ['demo.com', 'demo.com/level1', 'demo.com/level1/level2'] + * ``` + */ +export const createPaths = (path: string): string[] => { + const split = path.split('/'); + + return split.reduce((array, item, index) => { + const prev = array[index - 1]; + let path = `${item}/`; + if (prev) { + path = `${prev}${path}`; + } + + array.push(path); + + return array; + }, []); +}; diff --git a/core-web/libs/edit-content/src/lib/utils/mocks.ts b/core-web/libs/edit-content/src/lib/utils/mocks.ts index 591919819c37..82c5f2c749f7 100644 --- a/core-web/libs/edit-content/src/lib/utils/mocks.ts +++ b/core-web/libs/edit-content/src/lib/utils/mocks.ts @@ -7,6 +7,8 @@ import { ValidatorFn } from '@angular/forms'; +import { TreeNode } from 'primeng/api'; + import { DotCMSContentlet, DotCMSContentType, @@ -1155,3 +1157,32 @@ export const MockResizeObserver = class { // } }; + +export const TREE_SELECT_MOCK: TreeNode[] = [ + { + key: 'demo.dotcms.com', + label: 'demo.dotcms.com', + expandedIcon: 'pi pi-folder-open', + collapsedIcon: 'pi pi-folder', + children: [ + { + key: 'demo.dotcms.com/activities', + label: 'demo.dotcms.com/activities', + expandedIcon: 'pi pi-folder-open', + collapsedIcon: 'pi pi-folder', + children: [ + { + key: 'demo.dotcms.com/activities/themes', + label: 'demo.dotcms.com/activities/themes', + icon: 'pi pi-folder-open' + } + ] + }, + { + key: 'demo.dotcms.com/home', + label: 'demo.dotcms.com/home', + icon: 'pi pi-folder-open' + } + ] + } +]; From 17e473d39f70d80b1ee669f1b126e4111acbaa0f Mon Sep 17 00:00:00 2001 From: Nicolas Molina Date: Thu, 6 Jun 2024 11:41:23 -0400 Subject: [PATCH 10/24] chore(edit-content): apply format #28645 --- .../DotLocaleCreateEdit.component.html | 281 +++++++++--------- .../edit-ema-toolbar.component.html | 37 +-- .../src/lib/services/dot-page-api.service.ts | 6 +- .../src/lib/layout/column/column.component.ts | 4 +- .../layout/container/container.component.html | 42 +-- .../dotcms-layout/dotcms-layout.component.ts | 4 +- .../src/lib/layout/row/row.component.ts | 4 +- 7 files changed, 196 insertions(+), 182 deletions(-) diff --git a/core-web/libs/portlets/dot-locales/portlet/src/lib/dot-locales-list/components/dot-locale-create-edit/DotLocaleCreateEdit.component.html b/core-web/libs/portlets/dot-locales/portlet/src/lib/dot-locales-list/components/dot-locale-create-edit/DotLocaleCreateEdit.component.html index d5d64c331614..d69f1be4c254 100644 --- a/core-web/libs/portlets/dot-locales/portlet/src/lib/dot-locales-list/components/dot-locale-create-edit/DotLocaleCreateEdit.component.html +++ b/core-web/libs/portlets/dot-locales/portlet/src/lib/dot-locales-list/components/dot-locale-create-edit/DotLocaleCreateEdit.component.html @@ -3,151 +3,154 @@ [ngClass]="{ 'locale-add__edit-form': languageId?.value }" [formGroup]="form" (ngSubmit)="handleSubmit()"> - @if(languageId?.value){ - -
- - -
- -
- - - + @if (languageId?.value) { + +
+ - -
-
- - - - - -
- } @else { - -
- - - -
+
- @if (localeTypeDropdown.value == 1 ) { - -
- - - - {{ language.name }} - {{ language.code }} - - - {{ language.name }} - {{ language.code }} - - - {{ 'locales.language.hint' | dm }} -
-
- - - - {{ country.name }} - {{ country.code }} - - - {{ country.name }} - {{ country.code }} - - - {{ 'locales.country.hint' | dm }} -
-
- - - - - - {{ 'locale.id.standard.hint' | dm }} -
+
+ + + + + +
+
+ + + + + +
} @else { - -
- - - {{ 'locale.display.name.hint' | dm }} -
-
- - - {{ 'locale.id.hint' | dm }} -
+ +
+ + + +
- } } @if (showError | async){ - {{ - 'locale.error.message' | dm - }} + @if (localeTypeDropdown.value == 1) { + +
+ + + + {{ language.name }} - {{ language.code }} + + + {{ language.name }} - {{ language.code }} + + + {{ 'locales.language.hint' | dm }} +
+
+ + + + {{ country.name }} - {{ country.code }} + + + {{ country.name }} - {{ country.code }} + + + {{ 'locales.country.hint' | dm }} +
+
+ + + + + + {{ 'locale.id.standard.hint' | dm }} +
+ } @else { + +
+ + + {{ 'locale.display.name.hint' | dm }} +
+
+ + + {{ 'locale.id.hint' | dm }} +
+ } + } + @if (showError | async) { + {{ + 'locale.error.message' | dm + }} }
diff --git a/core-web/libs/portlets/edit-ema/portlet/src/lib/edit-ema-editor/components/edit-ema-toolbar/edit-ema-toolbar.component.html b/core-web/libs/portlets/edit-ema/portlet/src/lib/edit-ema-editor/components/edit-ema-toolbar/edit-ema-toolbar.component.html index 51eaa1c2ca05..78a2b10f8ba4 100644 --- a/core-web/libs/portlets/edit-ema/portlet/src/lib/edit-ema-editor/components/edit-ema-toolbar/edit-ema-toolbar.component.html +++ b/core-web/libs/portlets/edit-ema/portlet/src/lib/edit-ema-editor/components/edit-ema-toolbar/edit-ema-toolbar.component.html @@ -17,16 +17,19 @@ styleClass="p-button-text p-button-sm" data-testId="ema-preview" /> - @if(es.editorData.mode === editorMode.EDIT || es.editorData.mode === - editorMode.EDIT_VARIANT) { - - + @if ( + es.editorData.mode === editorMode.EDIT || + es.editorData.mode === editorMode.EDIT_VARIANT + ) { + } @@ -69,13 +72,13 @@ [inode]="es.editor.page.inode" (newPage)="handleNewPage($event)" /> - @if(es.editorData.page.isLocked && es.editorData.page.canLock) { - + @if (es.editorData.page.isLocked && es.editorData.page.canLock) { + }
diff --git a/core-web/libs/portlets/edit-ema/portlet/src/lib/services/dot-page-api.service.ts b/core-web/libs/portlets/edit-ema/portlet/src/lib/services/dot-page-api.service.ts index 1297d2392adc..7004a7168358 100644 --- a/core-web/libs/portlets/edit-ema/portlet/src/lib/services/dot-page-api.service.ts +++ b/core-web/libs/portlets/edit-ema/portlet/src/lib/services/dot-page-api.service.ts @@ -155,9 +155,9 @@ export class DotPageApiService { */ getFormIndetifier(containerId: string, formId: string): Observable { return this.http - .get<{ entity: { content: { idenfitier: string } } }>( - `/api/v1/containers/form/${formId}?containerId=${containerId}` - ) + .get<{ + entity: { content: { idenfitier: string } }; + }>(`/api/v1/containers/form/${formId}?containerId=${containerId}`) .pipe(pluck('entity', 'content', 'identifier')); } diff --git a/core-web/libs/sdk/angular/src/lib/layout/column/column.component.ts b/core-web/libs/sdk/angular/src/lib/layout/column/column.component.ts index 226fd9e26783..487fbf7a6eb1 100644 --- a/core-web/libs/sdk/angular/src/lib/layout/column/column.component.ts +++ b/core-web/libs/sdk/angular/src/lib/layout/column/column.component.ts @@ -9,8 +9,8 @@ import { ContainerComponent } from '../container/container.component'; standalone: true, imports: [ContainerComponent], template: ` - @for(container of column.containers; track $index) { - + @for (container of column.containers; track $index) { + } `, styleUrl: './column.component.css', diff --git a/core-web/libs/sdk/angular/src/lib/layout/container/container.component.html b/core-web/libs/sdk/angular/src/lib/layout/container/container.component.html index cbb02b0be8a3..480da151c45e 100644 --- a/core-web/libs/sdk/angular/src/lib/layout/container/container.component.html +++ b/core-web/libs/sdk/angular/src/lib/layout/container/container.component.html @@ -1,17 +1,25 @@ -@if ($isInsideEditor()) { @if($contentlets().length){ @for (contentlet of $contentlets(); track -$index) { - - - - -} } @else { This container is empty. } } @else { @for (contentlet of $contentlets(); track $index) { - -} } +@if ($isInsideEditor()) { + @if ($contentlets().length) { + @for (contentlet of $contentlets(); track $index) { + + + + } + } @else { + This container is empty. + } +} @else { + @for (contentlet of $contentlets(); track $index) { + + } +} diff --git a/core-web/libs/sdk/angular/src/lib/layout/dotcms-layout/dotcms-layout.component.ts b/core-web/libs/sdk/angular/src/lib/layout/dotcms-layout/dotcms-layout.component.ts index 3836051f0ab0..eb8a3faad773 100644 --- a/core-web/libs/sdk/angular/src/lib/layout/dotcms-layout/dotcms-layout.component.ts +++ b/core-web/libs/sdk/angular/src/lib/layout/dotcms-layout/dotcms-layout.component.ts @@ -29,9 +29,9 @@ import { RowComponent } from '../row/row.component'; selector: 'dotcms-layout', standalone: true, imports: [RowComponent], - template: `@for(row of pageAsset.layout.body.rows; track $index) { + template: `@for (row of pageAsset.layout.body.rows; track $index) { - }`, + }`, styleUrl: './dotcms-layout.component.css', changeDetection: ChangeDetectionStrategy.OnPush }) diff --git a/core-web/libs/sdk/angular/src/lib/layout/row/row.component.ts b/core-web/libs/sdk/angular/src/lib/layout/row/row.component.ts index dcbcfd51c078..6419800eadfa 100644 --- a/core-web/libs/sdk/angular/src/lib/layout/row/row.component.ts +++ b/core-web/libs/sdk/angular/src/lib/layout/row/row.component.ts @@ -7,9 +7,9 @@ import { ColumnComponent } from '../column/column.component'; selector: 'dotcms-row', standalone: true, imports: [ColumnComponent], - template: `@for(column of row.columns; track $index) { + template: `@for (column of row.columns; track $index) { - }`, + }`, styleUrl: './row.component.css', changeDetection: ChangeDetectionStrategy.OnPush }) From d4fd2f09e9964596dff43f98c1e449a36ce38e76 Mon Sep 17 00:00:00 2001 From: Nicolas Molina Date: Thu, 6 Jun 2024 12:09:10 -0400 Subject: [PATCH 11/24] chore(edit-content): sync with master and resolve conflicts #28645 --- .../src/lib/components/dot-edit-content-form/utils.ts | 3 ++- core-web/libs/edit-content/src/lib/utils/functions.util.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core-web/libs/edit-content/src/lib/components/dot-edit-content-form/utils.ts b/core-web/libs/edit-content/src/lib/components/dot-edit-content-form/utils.ts index 9d4b807df29f..bac24bd324d7 100644 --- a/core-web/libs/edit-content/src/lib/components/dot-edit-content-form/utils.ts +++ b/core-web/libs/edit-content/src/lib/components/dot-edit-content-form/utils.ts @@ -35,5 +35,6 @@ export const resolutionValue: Record = { [FIELD_TYPES.TEXT]: defaultResolutionFn, [FIELD_TYPES.TEXTAREA]: defaultResolutionFn, [FIELD_TYPES.TIME]: defaultResolutionFn, - [FIELD_TYPES.WYSIWYG]: defaultResolutionFn + [FIELD_TYPES.WYSIWYG]: defaultResolutionFn, + [FIELD_TYPES.CATEGORY]: defaultResolutionFn }; diff --git a/core-web/libs/edit-content/src/lib/utils/functions.util.ts b/core-web/libs/edit-content/src/lib/utils/functions.util.ts index c54ca9c08456..aa16c938a65b 100644 --- a/core-web/libs/edit-content/src/lib/utils/functions.util.ts +++ b/core-web/libs/edit-content/src/lib/utils/functions.util.ts @@ -192,7 +192,7 @@ export const stringToJson = (value: string) => { * ```ts * const path = 'demo.com/level1/level2'; * const paths = createPaths(path); - * console.log(paths); // ['demo.com', 'demo.com/level1', 'demo.com/level1/level2'] + * console.log(paths); // ['demo.com/', 'demo.com/level1/', 'demo.com/level1/level2/'] * ``` */ export const createPaths = (path: string): string[] => { From 45bbbc70bf964ec297fddffc7e9254dd29a7d102 Mon Sep 17 00:00:00 2001 From: Nicolas Molina Date: Thu, 6 Jun 2024 12:16:07 -0400 Subject: [PATCH 12/24] chore(edit-content): apply format #28645 --- .../dot-edit-content-host-folder-field.component.html | 4 ++-- core-web/package.json | 2 +- core-web/yarn.lock | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html index 1c3f9dd1af9a..e1ebfb3c6b5b 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html @@ -1,10 +1,10 @@ + (onNodeExpand)="onNodeExpand($event)" + selectionMode="single"> {{ node.label | truncatePath }} diff --git a/core-web/package.json b/core-web/package.json index a65b84ee9851..7699983f5678 100644 --- a/core-web/package.json +++ b/core-web/package.json @@ -253,7 +253,7 @@ "postcss-import": "14.1.0", "postcss-preset-env": "7.5.0", "postcss-url": "10.1.3", - "prettier": "^3.2.5", + "prettier": "^3.3.1", "prettier-plugin-organize-attributes": "^0.0.5", "protractor": "~7.0.0", "puppeteer": "~5.3.1", diff --git a/core-web/yarn.lock b/core-web/yarn.lock index 72d24a437f2a..3d699c7eccc1 100644 --- a/core-web/yarn.lock +++ b/core-web/yarn.lock @@ -8517,7 +8517,7 @@ autoprefixer@10.4.18: picocolors "^1.0.0" postcss-value-parser "^4.2.0" -autoprefixer@^10.4.0, autoprefixer@^10.4.16, autoprefixer@^10.4.6, autoprefixer@^10.4.9: +autoprefixer@^10.4.16, autoprefixer@^10.4.6, autoprefixer@^10.4.9: version "10.4.19" resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-10.4.19.tgz#ad25a856e82ee9d7898c59583c1afeb3fa65f89f" integrity sha512-BaENR2+zBZ8xXhM4pUaKUxlVdxZ0EZhjvbopwnXmxRUfqDmwSpC2lAi/QXvx7NRdPCo1WKEcEF6mV64si1z4Ew== @@ -19702,10 +19702,10 @@ prettier@^2.8.0: resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== -prettier@^3.2.5: - version "3.2.5" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.2.5.tgz#e52bc3090586e824964a8813b09aba6233b28368" - integrity sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A== +prettier@^3.3.1: + version "3.3.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.3.1.tgz#e68935518dd90bb7ec4821ba970e68f8de16e1ac" + integrity sha512-7CAwy5dRsxs8PHXT3twixW9/OEll8MLE0VRPCJyl7CkS6VHGPSlsVaWTiASPTyGyYRyApxlaWTzwUxVNrhcwDg== pretty-bytes@^5.4.1: version "5.6.0" From c470369a41d32accaf58c7291518355f35c23f5b Mon Sep 17 00:00:00 2001 From: Nicolas Molina Date: Thu, 6 Jun 2024 17:13:43 -0400 Subject: [PATCH 13/24] chore(edit-content): create unit tests #28645 --- .../dot-edit-content-field.component.spec.ts | 12 ++- ...ontent-host-folder-field.component.spec.ts | 72 ++++++++++++++-- .../lib/services/dot-edit-content.service.ts | 4 +- .../src/lib/utils/functions.util.spec.ts | 49 ++++++++++- .../src/lib/utils/functions.util.ts | 2 +- .../libs/edit-content/src/lib/utils/mocks.ts | 85 +++++++++++++++---- 6 files changed, 193 insertions(+), 31 deletions(-) diff --git a/core-web/libs/edit-content/src/lib/components/dot-edit-content-field/dot-edit-content-field.component.spec.ts b/core-web/libs/edit-content/src/lib/components/dot-edit-content-field/dot-edit-content-field.component.spec.ts index 1d620c20a0fe..4342280982f1 100644 --- a/core-web/libs/edit-content/src/lib/components/dot-edit-content-field/dot-edit-content-field.component.spec.ts +++ b/core-web/libs/edit-content/src/lib/components/dot-edit-content-field/dot-edit-content-field.component.spec.ts @@ -40,7 +40,8 @@ import { BINARY_FIELD_CONTENTLET, createFormGroupDirectiveMock, DOT_MESSAGE_SERVICE_MOCK, - FIELDS_MOCK + FIELDS_MOCK, + TREE_SELECT_MOCK } from '../../utils/mocks'; interface DotEditFieldTestBed { @@ -73,7 +74,14 @@ const FIELD_TYPES_COMPONENTS: Record | DotEditFieldTe [FIELD_TYPES.DATE]: DotEditContentCalendarFieldComponent, [FIELD_TYPES.DATE_AND_TIME]: DotEditContentCalendarFieldComponent, [FIELD_TYPES.TIME]: DotEditContentCalendarFieldComponent, - [FIELD_TYPES.HOST_FOLDER]: DotEditContentHostFolderFieldComponent, + [FIELD_TYPES.HOST_FOLDER]: { + component: DotEditContentHostFolderFieldComponent, + providers: [ + mockProvider(DotEditContentService, { + getSitesTreePath: jest.fn().mockReturnValue(of(TREE_SELECT_MOCK)) + }) + ] + }, [FIELD_TYPES.TAG]: { component: DotEditContentTagFieldComponent, providers: [{ provide: DotEditContentService, useValue: { getTags: () => of([]) } }] diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts index c7b7ad013a68..0f5ba858f9db 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts @@ -3,17 +3,21 @@ import { of } from 'rxjs'; import { ControlContainer, FormGroupDirective } from '@angular/forms'; +import { mockMatchMedia } from '@dotcms/utils-testing'; + import { DotEditContentHostFolderFieldComponent } from './dot-edit-content-host-folder-field.component'; import { DotEditContentService } from '../../services/dot-edit-content.service'; import { - HOST_FOLDER_FIELD_TEXT_MOCK, - TREE_SELECT_MOCK, + HOST_FOLDER_TEXT_MOCK, + TREE_SELECT_MOCK_NODE, + TREE_SELECT_SITES_MOCK, createFormGroupDirectiveMock } from '../../utils/mocks'; describe('DotEditContentHostFolderFieldComponent', () => { let spectator: Spectator; + let component: DotEditContentHostFolderFieldComponent; let service: SpyObject; const createComponent = createComponentFactory({ @@ -24,7 +28,7 @@ describe('DotEditContentHostFolderFieldComponent', () => { providers: [ FormGroupDirective, mockProvider(DotEditContentService, { - getSitesTreePath: jest.fn().mockReturnValue(of(TREE_SELECT_MOCK)) + getSitesTreePath: jest.fn().mockReturnValue(of(TREE_SELECT_SITES_MOCK)) }) ], detectChanges: false @@ -34,20 +38,70 @@ describe('DotEditContentHostFolderFieldComponent', () => { spectator = createComponent({ props: { field: { - ...HOST_FOLDER_FIELD_TEXT_MOCK + ...HOST_FOLDER_TEXT_MOCK } } }); service = spectator.inject(DotEditContentService); - spectator.detectChanges(); - }); - - afterEach(() => { - jest.resetAllMocks(); + component = spectator.component; + mockMatchMedia(); }); it('should create the component', () => { + spectator.detectChanges(); expect(spectator.component).toBeTruthy(); + }); + + it('should show options', () => { + spectator.detectChanges(); + const options = component.options(); + expect(service.getSitesTreePath).toHaveBeenCalled(); + expect(options).toBe(TREE_SELECT_SITES_MOCK); + expect(component.treeSelect.options).toBe(TREE_SELECT_SITES_MOCK); + }); + + describe('The init value with the root path', () => { + it('should show a root path', () => { + const rootPath = TREE_SELECT_SITES_MOCK[0].key; + component.formControl.setValue(rootPath); + spectator.detectChanges(); + const label = spectator.query('.p-treeselect-label'); + expect(label).toHaveText(rootPath); + }); + + it('should show the selected path in the tree', () => { + const rootPath = TREE_SELECT_SITES_MOCK[0].key; + component.formControl.setValue(rootPath); + spectator.detectChanges(); + + const triggerElement = spectator.query('.p-treeselect-trigger'); + spectator.click(triggerElement); + const labelElement = spectator.query('.p-treenode-content.p-highlight'); + expect(labelElement).toHaveText(rootPath); + }); + }); + + describe('The init value with the one levels', () => { + it('should show a path selected', () => { + service.buildTreeByPaths.mockReturnValue(of(TREE_SELECT_MOCK_NODE)); + const rootPath = 'demo.dotcms.com/level1/'; + component.formControl.setValue(rootPath); + spectator.detectChanges(); + const label = spectator.query('.p-treeselect-label'); + expect(label).toHaveText(rootPath); + }); + + it('should show the selected path in the tree', () => { + service.buildTreeByPaths.mockReturnValue(of(TREE_SELECT_MOCK_NODE)); + const rootPath = 'demo.dotcms.com/level1/'; + component.formControl.setValue(rootPath); + spectator.detectChanges(); + + const triggerElement = spectator.query('.p-treeselect-trigger'); + spectator.click(triggerElement); + const labelElement = spectator.query('.p-treenode-content.p-highlight'); + expect(labelElement).toHaveText('level1'); + }); }); }); diff --git a/core-web/libs/edit-content/src/lib/services/dot-edit-content.service.ts b/core-web/libs/edit-content/src/lib/services/dot-edit-content.service.ts index 7e9d74a94137..8b07a2b63002 100644 --- a/core-web/libs/edit-content/src/lib/services/dot-edit-content.service.ts +++ b/core-web/libs/edit-content/src/lib/services/dot-edit-content.service.ts @@ -101,7 +101,7 @@ export class DotEditContentService { return folder.path !== checkPath; }) .map((folder) => ({ - key: `${folder.hostName}${folder.path}`.replace('/', ''), + key: `${folder.hostName}${folder.path}`.replace(/[/]/g, ''), label: `${folder.hostName}${folder.path}`, data: { hostname: folder.hostName, @@ -123,7 +123,7 @@ export class DotEditContentService { const subPath = split.slice(1).join('/'); return this.getFoldersTreeNode(hostName, subPath).pipe( - map((folders) => ({ path, folders })) + map((folders) => ({ path: path.replace(/[/]/g, ''), folders })) ); }); diff --git a/core-web/libs/edit-content/src/lib/utils/functions.util.spec.ts b/core-web/libs/edit-content/src/lib/utils/functions.util.spec.ts index 6cf021567d04..5eeded8819a3 100644 --- a/core-web/libs/edit-content/src/lib/utils/functions.util.spec.ts +++ b/core-web/libs/edit-content/src/lib/utils/functions.util.spec.ts @@ -3,7 +3,7 @@ import { describe, expect, it } from '@jest/globals'; import { DotCMSContentTypeField, DotCMSContentTypeFieldVariable } from '@dotcms/dotcms-models'; import * as functionsUtil from './functions.util'; -import { getFieldVariablesParsed, isValidJson, stringToJson } from './functions.util'; +import { getFieldVariablesParsed, isValidJson, stringToJson, createPaths } from './functions.util'; import { CALENDAR_FIELD_TYPES, JSON_FIELD_MOCK, MULTIPLE_TABS_MOCK } from './mocks'; import { FLATTENED_FIELD_TYPES } from '../models/dot-edit-content-field.constant'; @@ -544,4 +544,51 @@ describe('Utils Functions', () => { expect(result).toEqual({}); }); }); + + describe('createPaths function', () => { + it('with the root path', () => { + const path = 'nico.demo.ts'; + const paths = createPaths(path); + expect(paths).toStrictEqual(['nico.demo.ts/']); + }); + + it('with a single level', () => { + const path = 'nico.demo.ts/demo'; + const paths = createPaths(path); + expect(paths).toStrictEqual(['nico.demo.ts/', 'nico.demo.ts/demo/']); + }); + + it('with a single level ending in slash', () => { + const path = 'nico.demo.ts/demo/'; + const paths = createPaths(path); + expect(paths).toStrictEqual(['nico.demo.ts/', 'nico.demo.ts/demo/']); + }); + + it('with two levels ', () => { + const path = 'nico.demo.ts/demo/demo2'; + const paths = createPaths(path); + expect(paths).toStrictEqual([ + 'nico.demo.ts/', + 'nico.demo.ts/demo/', + 'nico.demo.ts/demo/demo2/' + ]); + }); + + it('with three levels', () => { + const path = 'nico.demo.ts/demo/demo2/demo3'; + const paths = createPaths(path); + expect(paths).toStrictEqual([ + 'nico.demo.ts/', + 'nico.demo.ts/demo/', + 'nico.demo.ts/demo/demo2/', + 'nico.demo.ts/demo/demo2/demo3/' + ]); + }); + + it('with an empty path', () => { + const path = ''; + const paths = createPaths(path); + expect(paths).toStrictEqual([]); + }); + }); }); diff --git a/core-web/libs/edit-content/src/lib/utils/functions.util.ts b/core-web/libs/edit-content/src/lib/utils/functions.util.ts index aa16c938a65b..9819c0681600 100644 --- a/core-web/libs/edit-content/src/lib/utils/functions.util.ts +++ b/core-web/libs/edit-content/src/lib/utils/functions.util.ts @@ -196,7 +196,7 @@ export const stringToJson = (value: string) => { * ``` */ export const createPaths = (path: string): string[] => { - const split = path.split('/'); + const split = path.split('/').filter((item) => item !== ''); return split.reduce((array, item, index) => { const prev = array[index - 1]; diff --git a/core-web/libs/edit-content/src/lib/utils/mocks.ts b/core-web/libs/edit-content/src/lib/utils/mocks.ts index 47a041e26a5e..5e9bce005fb5 100644 --- a/core-web/libs/edit-content/src/lib/utils/mocks.ts +++ b/core-web/libs/edit-content/src/lib/utils/mocks.ts @@ -7,8 +7,6 @@ import { ValidatorFn } from '@angular/forms'; -import { TreeNode } from 'primeng/api'; - import { DotCMSContentlet, DotCMSContentType, @@ -20,6 +18,7 @@ import { MockDotMessageService } from '@dotcms/utils-testing'; import { FIELD_TYPES } from '../models/dot-edit-content-field.enum'; import { EditContentPayload } from '../models/dot-edit-content-form.interface'; +import { TreeNodeItem } from '../models/dot-edit-content-host-folder-field.interface'; /* FIELDS MOCK BY TYPE */ export const TEXT_FIELD_MOCK: DotCMSContentTypeField = { @@ -573,6 +572,7 @@ export const HOST_FOLDER_TEXT_MOCK = { fieldTypeLabel: 'Site or Folder', fieldVariables: [], fixed: false, + hint: 'A hint text', forceIncludeInApi: false, iDate: 1717083750000, id: 'b7c41ffd6b6bc1250f2fc85a3637471b', @@ -1186,31 +1186,84 @@ export const MockResizeObserver = class { } }; -export const TREE_SELECT_MOCK: TreeNode[] = [ +export const TREE_SELECT_SITES_MOCK: TreeNodeItem[] = [ + { + key: 'demo.dotcms.com', + label: 'demo.dotcms.com', + data: { + hostname: 'demo.dotcms.com', + path: '', + type: 'site' + }, + expandedIcon: 'pi pi-folder-open', + collapsedIcon: 'pi pi-folder' + }, + { + key: 'nico.dotcms.com', + label: 'nico.dotcms.com', + data: { + hostname: 'nico.dotcms.com', + path: '', + type: 'site' + }, + expandedIcon: 'pi pi-folder-open', + collapsedIcon: 'pi pi-folder' + } +]; + +export const TREE_SELECT_MOCK: TreeNodeItem[] = [ { key: 'demo.dotcms.com', label: 'demo.dotcms.com', + data: { + hostname: 'demo.dotcms.com', + path: '', + type: 'site' + }, expandedIcon: 'pi pi-folder-open', collapsedIcon: 'pi pi-folder', children: [ { - key: 'demo.dotcms.com/activities', - label: 'demo.dotcms.com/activities', + key: 'demo.dotcms.comlevel1', + label: 'demo.dotcms.com/level1/', + data: { + hostname: 'demo.dotcms.com', + path: '/level1/', + type: 'folder' + }, expandedIcon: 'pi pi-folder-open', - collapsedIcon: 'pi pi-folder', - children: [ - { - key: 'demo.dotcms.com/activities/themes', - label: 'demo.dotcms.com/activities/themes', - icon: 'pi pi-folder-open' - } - ] + collapsedIcon: 'pi pi-folder' }, { - key: 'demo.dotcms.com/home', - label: 'demo.dotcms.com/home', - icon: 'pi pi-folder-open' + key: 'demo.dotcms.comlevel2', + label: 'demo.dotcms.com/level2/', + data: { + hostname: 'demo.dotcms.com', + path: '/level2/', + type: 'folder' + }, + expandedIcon: 'pi pi-folder-open', + collapsedIcon: 'pi pi-folder' } ] + }, + { + key: 'nico.dotcms.com', + label: 'nico.dotcms.com', + data: { + hostname: 'nico.dotcms.com', + path: '', + type: 'site' + }, + expandedIcon: 'pi pi-folder-open', + collapsedIcon: 'pi pi-folder' } ]; + +export const TREE_SELECT_MOCK_NODE = { + node: { ...TREE_SELECT_MOCK[0].children[0] }, + tree: { + path: 'demo.dotcms.com', + folders: [...TREE_SELECT_MOCK[0].children] + } +}; From f290a24457fde95c40338a7ab7556385d64aba05 Mon Sep 17 00:00:00 2001 From: Nicolas Molina Date: Thu, 6 Jun 2024 17:40:39 -0400 Subject: [PATCH 14/24] chore(edit-content): apply format #28645 --- .../edit-ema-editor.component.html | 34 +++++++-------- .../layout/container/container.component.html | 41 ++++++++++++------- 2 files changed, 44 insertions(+), 31 deletions(-) diff --git a/core-web/libs/portlets/edit-ema/portlet/src/lib/edit-ema-editor/edit-ema-editor.component.html b/core-web/libs/portlets/edit-ema/portlet/src/lib/edit-ema-editor/edit-ema-editor.component.html index 9f61a15f203d..393f4d7ac414 100644 --- a/core-web/libs/portlets/edit-ema/portlet/src/lib/edit-ema-editor/edit-ema-editor.component.html +++ b/core-web/libs/portlets/edit-ema/portlet/src/lib/edit-ema-editor/edit-ema-editor.component.html @@ -20,7 +20,7 @@
- @if(es.editorData.canEditVariant && (es.editorData.mode === editorMode.EDIT || - es.editorData.mode === editorMode.EDIT_VARIANT)) { - - + @if ( + es.editorData.canEditVariant && + (es.editorData.mode === editorMode.EDIT || es.editorData.mode === editorMode.EDIT_VARIANT) + ) { + + } diff --git a/core-web/libs/sdk/angular/src/lib/layout/container/container.component.html b/core-web/libs/sdk/angular/src/lib/layout/container/container.component.html index d1839bb627e3..4cbd283bf0c7 100644 --- a/core-web/libs/sdk/angular/src/lib/layout/container/container.component.html +++ b/core-web/libs/sdk/angular/src/lib/layout/container/container.component.html @@ -1,15 +1,26 @@ -@if ($isInsideEditor()) { @if($contentlets().length){ @for (contentlet of $contentlets(); track -$index) { - - - - -} } @else { This container is empty. } } @else { @for (contentlet of $contentlets(); track $index) { - -} } \ No newline at end of file +@if ($isInsideEditor()) { + @if ($contentlets().length) { + @for (contentlet of $contentlets(); track $index) { + + + + } + } @else { + This container is empty. + } +} @else { + @for (contentlet of $contentlets(); track $index) { + + } +} From 367bbc4ec8950d95dc7e1c3b6acbf6223f01cf9e Mon Sep 17 00:00:00 2001 From: Nicolas Molina Date: Fri, 7 Jun 2024 07:17:07 -0400 Subject: [PATCH 15/24] chore(edit-content): unit test #28645 --- ...ontent-host-folder-field.component.spec.ts | 104 ++++++++++++++++++ ...dit-content-host-folder-field.component.ts | 45 ++++---- .../src/lib/pipes/truncate-path.pipe.ts | 5 +- .../src/lib/pipes/truncate-path.spec.ts | 36 ++++++ .../libs/edit-content/src/lib/utils/mocks.ts | 15 ++- 5 files changed, 177 insertions(+), 28 deletions(-) create mode 100644 core-web/libs/edit-content/src/lib/pipes/truncate-path.spec.ts diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts index 0f5ba858f9db..67619fc8facb 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts @@ -1,3 +1,4 @@ +import { createFakeEvent } from '@ngneat/spectator'; import { Spectator, createComponentFactory, mockProvider, SpyObject } from '@ngneat/spectator/jest'; import { of } from 'rxjs'; @@ -12,6 +13,7 @@ import { HOST_FOLDER_TEXT_MOCK, TREE_SELECT_MOCK_NODE, TREE_SELECT_SITES_MOCK, + TREE_SELECT_MOCK, createFormGroupDirectiveMock } from '../../utils/mocks'; @@ -44,6 +46,7 @@ describe('DotEditContentHostFolderFieldComponent', () => { }); service = spectator.inject(DotEditContentService); component = spectator.component; + component.formControl.setValue(null); mockMatchMedia(); }); @@ -104,4 +107,105 @@ describe('DotEditContentHostFolderFieldComponent', () => { expect(labelElement).toHaveText('level1'); }); }); + + describe('The init value with the two levels', () => { + it('should show a path selected', () => { + const mockResponse = { + ...TREE_SELECT_MOCK_NODE, + node: { ...TREE_SELECT_MOCK[0].children[0].children[0] } + }; + service.buildTreeByPaths.mockReturnValue(of(mockResponse)); + const rootPath = 'demo.dotcms.com/level1/child1/'; + component.formControl.setValue(rootPath); + spectator.detectChanges(); + const label = spectator.query('.p-treeselect-label'); + expect(label).toHaveText(rootPath); + }); + + it('should show the selected path in the tree', () => { + const mockResponse = { + ...TREE_SELECT_MOCK_NODE, + node: { ...TREE_SELECT_MOCK[0].children[0].children[0] } + }; + service.buildTreeByPaths.mockReturnValue(of(mockResponse)); + const rootPath = 'demo.dotcms.com/level1/child1/'; + component.formControl.setValue(rootPath); + spectator.detectChanges(); + + const triggerElement = spectator.query('.p-treeselect-trigger'); + spectator.click(triggerElement); + const labelElement = spectator.query('.p-treenode-content.p-highlight'); + expect(labelElement).toHaveText('child1'); + }); + }); + + describe('Select levels: onNodeSelect', () => { + it('should update the form value with the correct format with root path', () => { + spectator.detectChanges(); + const mockItem = { + originalEvent: createFakeEvent('input'), + node: { ...TREE_SELECT_MOCK[0] } + }; + component.onNodeSelect(mockItem); + const value = component.formControl.value; + expect(value).toBe('demo.dotcms.com:/'); + }); + + it('should update the form value with the correct format with one level', () => { + spectator.detectChanges(); + const mockItem = { + originalEvent: createFakeEvent('input'), + node: { ...TREE_SELECT_MOCK[0].children[0] } + }; + component.onNodeSelect(mockItem); + const value = component.formControl.value; + expect(value).toBe('demo.dotcms.com:/level1/'); + }); + + it('should update the form value with the correct format with two level', () => { + spectator.detectChanges(); + const mockItem = { + originalEvent: createFakeEvent('input'), + node: { ...TREE_SELECT_MOCK[0].children[0].children[0] } + }; + component.onNodeSelect(mockItem); + const value = component.formControl.value; + expect(value).toBe('demo.dotcms.com:/level1/child1/'); + }); + }); + + describe('Expand level: onNodeExpand', () => { + it('should update the form value with the correct format with root path', () => { + spectator.detectChanges(); + const mockItem = { + originalEvent: createFakeEvent('input'), + node: { ...TREE_SELECT_MOCK[0] } + }; + component.onNodeSelect(mockItem); + const value = component.formControl.value; + expect(value).toBe('demo.dotcms.com:/'); + }); + + it('should update the form value with the correct format with one level', () => { + spectator.detectChanges(); + const mockItem = { + originalEvent: createFakeEvent('input'), + node: { ...TREE_SELECT_MOCK[0].children[0] } + }; + component.onNodeSelect(mockItem); + const value = component.formControl.value; + expect(value).toBe('demo.dotcms.com:/level1/'); + }); + + it('should update the form value with the correct format with two level', () => { + spectator.detectChanges(); + const mockItem = { + originalEvent: createFakeEvent('input'), + node: { ...TREE_SELECT_MOCK[0].children[0].children[0] } + }; + component.onNodeSelect(mockItem); + const value = component.formControl.value; + expect(value).toBe('demo.dotcms.com:/level1/child1/'); + }); + }); }); diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts index 18d8af6e3c7c..a5d4ab2af653 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts @@ -11,13 +11,11 @@ import { ControlContainer, FormControl, ReactiveFormsModule } from '@angular/for import { TreeSelect, TreeSelectModule } from 'primeng/treeselect'; -import { Site } from '@dotcms/dotcms-js'; import { DotCMSContentTypeField } from '@dotcms/dotcms-models'; import { DotEditContentFieldSingleSelectableDataTypes } from '../../models/dot-edit-content-field.type'; import { TreeNodeItem, - TreeNodeSelectEvent, TreeNodeSelectItem } from '../../models/dot-edit-content-host-folder-field.interface'; import { TruncatePathPipe } from '../../pipes/truncate-path.pipe'; @@ -60,32 +58,33 @@ export class DotEditContentHostFolderFieldComponent implements OnInit { ) as FormControl; } - onNodeSelect(event: TreeNodeSelectEvent) { - const label = event.node.label; - if (label) { - const split = label.split('/'); - if (split.length > 0) { - const site = split[0]; - const path = split.slice(1, split.length); - this.formControl.setValue(`${site}:/${path.join('/')}`); - } + onNodeSelect(event: TreeNodeSelectItem) { + const data = event.node.data; + if (!data) { + return; } + + const path = `${data.hostname}:${data.path ? data.path : '/'}`; + this.formControl.setValue(path); } onNodeExpand(event: TreeNodeSelectItem) { - if (!event.node.children) { - const { hostname, path } = event.node.data; - this.#editContentService.getFoldersTreeNode(hostname, path).subscribe((children) => { - if (children.length > 0) { - event.node.children = children; - } else { - event.node.leaf = true; - event.node.icon = 'pi pi-folder-open'; - } - - this.treeSelect.cd.detectChanges(); - }); + const children = event.node.children; + if (children && children.length > 0) { + return; } + + const { hostname, path } = event.node.data; + this.#editContentService.getFoldersTreeNode(hostname, path).subscribe((children) => { + if (children.length > 0) { + event.node.children = children; + } else { + event.node.leaf = true; + event.node.icon = 'pi pi-folder-open'; + } + + this.treeSelect.cd.detectChanges(); + }); } getInitialValue() { diff --git a/core-web/libs/edit-content/src/lib/pipes/truncate-path.pipe.ts b/core-web/libs/edit-content/src/lib/pipes/truncate-path.pipe.ts index 0560155b6e79..8756d0b4ac87 100644 --- a/core-web/libs/edit-content/src/lib/pipes/truncate-path.pipe.ts +++ b/core-web/libs/edit-content/src/lib/pipes/truncate-path.pipe.ts @@ -7,10 +7,7 @@ import { Pipe, PipeTransform } from '@angular/core'; export class TruncatePathPipe implements PipeTransform { transform(value: string): string { const split = value.split('/').filter((item) => item !== ''); - if (split.length > 0) { - return split.pop(); - } - return value; + return split.pop(); } } diff --git a/core-web/libs/edit-content/src/lib/pipes/truncate-path.spec.ts b/core-web/libs/edit-content/src/lib/pipes/truncate-path.spec.ts new file mode 100644 index 000000000000..09085c8d8ded --- /dev/null +++ b/core-web/libs/edit-content/src/lib/pipes/truncate-path.spec.ts @@ -0,0 +1,36 @@ +import { createPipeFactory, SpectatorPipe } from '@ngneat/spectator'; + +import { TruncatePathPipe } from './truncate-path.pipe'; + +describe('TruncatePathPipe', () => { + let spectator: SpectatorPipe; + + const createPipe = createPipeFactory({ + pipe: TruncatePathPipe + }); + + it('should return just the path with root level', () => { + spectator = createPipe(`{{ 'demo.com' | truncatePath }}`); + expect(spectator.element).toHaveText('demo.com'); + }); + + it('should return just the path with one level', () => { + spectator = createPipe(`{{ 'demo.com/level1' | truncatePath }}`); + expect(spectator.element).toHaveText('level1'); + }); + + it('should return just the path with one level ending in slash', () => { + spectator = createPipe(`{{ 'demo.com/level1/' | truncatePath }}`); + expect(spectator.element).toHaveText('level1'); + }); + + it('should return just the path with two levels', () => { + spectator = createPipe(`{{ 'demo.com/level1/level2' | truncatePath }}`); + expect(spectator.element).toHaveText('level2'); + }); + + it('should return just the path with two levels ending in slash', () => { + spectator = createPipe(`{{ 'demo.com/level1/level2/' | truncatePath }}`); + expect(spectator.element).toHaveText('level2'); + }); +}); diff --git a/core-web/libs/edit-content/src/lib/utils/mocks.ts b/core-web/libs/edit-content/src/lib/utils/mocks.ts index 5e9bce005fb5..cb8039986f2b 100644 --- a/core-web/libs/edit-content/src/lib/utils/mocks.ts +++ b/core-web/libs/edit-content/src/lib/utils/mocks.ts @@ -1232,7 +1232,20 @@ export const TREE_SELECT_MOCK: TreeNodeItem[] = [ type: 'folder' }, expandedIcon: 'pi pi-folder-open', - collapsedIcon: 'pi pi-folder' + collapsedIcon: 'pi pi-folder', + children: [ + { + key: 'demo.dotcms.comlevel1child1', + label: 'demo.dotcms.com/level1/child1/', + data: { + hostname: 'demo.dotcms.com', + path: '/level1/child1/', + type: 'folder' + }, + expandedIcon: 'pi pi-folder-open', + collapsedIcon: 'pi pi-folder' + } + ] }, { key: 'demo.dotcms.comlevel2', From a9e75f18619d13e5628062e9cd29a650362855c5 Mon Sep 17 00:00:00 2001 From: Nicolas Molina Date: Fri, 7 Jun 2024 09:22:36 -0400 Subject: [PATCH 16/24] chore(edit-content): add loading in nodes #28645 --- ...ontent-host-folder-field.component.spec.ts | 74 ++++++++++++++----- ...dit-content-host-folder-field.component.ts | 18 ++--- 2 files changed, 64 insertions(+), 28 deletions(-) diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts index 67619fc8facb..698bac84f76c 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts @@ -175,37 +175,75 @@ describe('DotEditContentHostFolderFieldComponent', () => { }); describe('Expand level: onNodeExpand', () => { - it('should update the form value with the correct format with root path', () => { + it('should not call getFoldersTreeNode when it is a node with children', () => { spectator.detectChanges(); const mockItem = { - originalEvent: createFakeEvent('input'), - node: { ...TREE_SELECT_MOCK[0] } + originalEvent: createFakeEvent('select'), + node: { + ...TREE_SELECT_MOCK[0] + } }; - component.onNodeSelect(mockItem); - const value = component.formControl.value; - expect(value).toBe('demo.dotcms.com:/'); + component.onNodeExpand(mockItem); + expect(service.getFoldersTreeNode).not.toHaveBeenCalled(); }); - it('should update the form value with the correct format with one level', () => { + it('should not call getFoldersTreeNode when it is a node is loading', () => { spectator.detectChanges(); const mockItem = { - originalEvent: createFakeEvent('input'), - node: { ...TREE_SELECT_MOCK[0].children[0] } + originalEvent: createFakeEvent('select'), + node: { + ...TREE_SELECT_MOCK[0], + icon: 'spinner' + } }; - component.onNodeSelect(mockItem); - const value = component.formControl.value; - expect(value).toBe('demo.dotcms.com:/level1/'); + component.onNodeExpand(mockItem); + expect(service.getFoldersTreeNode).not.toHaveBeenCalled(); }); - it('should update the form value with the correct format with two level', () => { + it('should call getFoldersTreeNode when it is a node with no children', async () => { + const response = TREE_SELECT_MOCK[0].children; + service.getFoldersTreeNode.mockReturnValue(of(response)); spectator.detectChanges(); + + await spectator.fixture.whenStable(); + + const treeDetectChangesSpy = jest.spyOn(component.treeSelect.cd, 'detectChanges'); + const mockNode = { ...TREE_SELECT_SITES_MOCK[0] }; const mockItem = { - originalEvent: createFakeEvent('input'), - node: { ...TREE_SELECT_MOCK[0].children[0].children[0] } + originalEvent: createFakeEvent('select'), + node: mockNode }; - component.onNodeSelect(mockItem); - const value = component.formControl.value; - expect(value).toBe('demo.dotcms.com:/level1/child1/'); + component.onNodeExpand(mockItem); + const hostName = mockNode.data.hostname; + const path = mockNode.data.path; + expect(service.getFoldersTreeNode).toHaveBeenCalledWith(hostName, path); + expect(mockNode.children).toBe(response); + expect(mockNode.leaf).toBe(true); + expect(mockNode.icon).toBe('pi pi-folder-open'); + expect(treeDetectChangesSpy).toHaveBeenCalled(); + }); + + it('should call getFoldersTreeNode when it is a node with no children and empty response', async () => { + const response = []; + service.getFoldersTreeNode.mockReturnValue(of(response)); + spectator.detectChanges(); + + await spectator.fixture.whenStable(); + + const treeDetectChangesSpy = jest.spyOn(component.treeSelect.cd, 'detectChanges'); + const mockNode = { ...TREE_SELECT_SITES_MOCK[0] }; + const mockItem = { + originalEvent: createFakeEvent('select'), + node: mockNode + }; + component.onNodeExpand(mockItem); + const hostName = mockNode.data.hostname; + const path = mockNode.data.path; + expect(service.getFoldersTreeNode).toHaveBeenCalledWith(hostName, path); + expect(mockNode.children).toBe(response); + expect(mockNode.leaf).toBe(true); + expect(mockNode.icon).toBe('pi pi-folder-open'); + expect(treeDetectChangesSpy).toHaveBeenCalled(); }); }); }); diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts index a5d4ab2af653..4d0469ce8096 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts @@ -69,20 +69,18 @@ export class DotEditContentHostFolderFieldComponent implements OnInit { } onNodeExpand(event: TreeNodeSelectItem) { - const children = event.node.children; - if (children && children.length > 0) { + const { node } = event; + const { children, icon } = node; + if ((children && children.length > 0) || icon?.includes('spinner')) { return; } - const { hostname, path } = event.node.data; + const { hostname, path } = node.data; + node.icon = 'pi pi-spin pi-spinner'; this.#editContentService.getFoldersTreeNode(hostname, path).subscribe((children) => { - if (children.length > 0) { - event.node.children = children; - } else { - event.node.leaf = true; - event.node.icon = 'pi pi-folder-open'; - } - + node.leaf = true; + node.icon = 'pi pi-folder-open'; + node.children = children; this.treeSelect.cd.detectChanges(); }); } From f75b1a24278f532cd12b1248a5b0dc8660042c94 Mon Sep 17 00:00:00 2001 From: Nicolas Molina Date: Fri, 7 Jun 2024 09:47:19 -0400 Subject: [PATCH 17/24] chore(edit-content): add loading in nodes #28645 --- ...-edit-content-host-folder-field.component.html | 7 +++++++ ...ot-edit-content-host-folder-field.component.ts | 15 ++++++++++++--- ...ot-edit-content-host-folder-field.interface.ts | 2 ++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html index e1ebfb3c6b5b..703445fd7b3c 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html @@ -8,4 +8,11 @@ {{ node.label | truncatePath }} + + @if (sitesStatus() === 'loading') { + + } @else { + + } + diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts index 4d0469ce8096..4e617ee3c66a 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts @@ -15,6 +15,7 @@ import { DotCMSContentTypeField } from '@dotcms/dotcms-models'; import { DotEditContentFieldSingleSelectableDataTypes } from '../../models/dot-edit-content-field.type'; import { + StatusRequest, TreeNodeItem, TreeNodeSelectItem } from '../../models/dot-edit-content-host-folder-field.interface'; @@ -43,12 +44,20 @@ export class DotEditContentHostFolderFieldComponent implements OnInit { readonly #editContentService = inject(DotEditContentService); options = signal([]); + sitesStatus = signal('init'); pathControl = new FormControl(); ngOnInit() { - this.#editContentService.getSitesTreePath().subscribe((options) => { - this.options.set(options); - this.getInitialValue(); + this.sitesStatus.set('loading'); + this.#editContentService.getSitesTreePath().subscribe({ + next: (options) => { + this.options.set(options); + this.getInitialValue(); + this.sitesStatus.set('success'); + }, + error: () => { + this.sitesStatus.set('failed'); + } }); } diff --git a/core-web/libs/edit-content/src/lib/models/dot-edit-content-host-folder-field.interface.ts b/core-web/libs/edit-content/src/lib/models/dot-edit-content-host-folder-field.interface.ts index 3bf79a0ef3ff..5ad4838c2a92 100644 --- a/core-web/libs/edit-content/src/lib/models/dot-edit-content-host-folder-field.interface.ts +++ b/core-web/libs/edit-content/src/lib/models/dot-edit-content-host-folder-field.interface.ts @@ -4,6 +4,8 @@ export type TreeNodeData = { type: 'site' | 'folder'; path: string; hostname: st export type TreeNodeItem = TreeNode; +export type StatusRequest = 'init' | 'loading' | 'success' | 'failed'; + export type TreeNodeSelectItem = TreeNodeSelectEvent; export interface TreeNodeSelectEvent { From c6187aaa1251d422c3dcde85133e2180765fc3bf Mon Sep 17 00:00:00 2001 From: Nicolas Molina Date: Mon, 10 Jun 2024 14:26:27 -0400 Subject: [PATCH 18/24] chore(edit-content): resolve issues #28645 --- ...t-content-host-folder-field.component.html | 6 +--- ...dit-content-host-folder-field.component.ts | 12 ++++++- ...dit-content-host-folder-field.interface.ts | 8 +++++ .../src/lib/pipes/truncate-path.pipe.ts | 3 +- .../lib/services/dot-edit-content.service.ts | 34 +++++++++++++++++-- 5 files changed, 53 insertions(+), 10 deletions(-) diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html index d43020cd4bf3..c854a94fb0cf 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html @@ -9,10 +9,6 @@ {{ node.label | truncatePath }} - @if (sitesStatus() === 'loading') { - - } @else { - - } + diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts index ff83fd3e3f32..79084cd44fc6 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts @@ -1,9 +1,11 @@ +import { NgClass } from '@angular/common'; import { ChangeDetectionStrategy, Component, Input, OnInit, ViewChild, + computed, inject, signal } from '@angular/core'; @@ -26,7 +28,7 @@ import { createPaths } from '../../utils/functions.util'; @Component({ selector: 'dot-edit-content-host-folder-field', standalone: true, - imports: [TreeSelectModule, ReactiveFormsModule, TruncatePathPipe], + imports: [TreeSelectModule, ReactiveFormsModule, TruncatePathPipe, NgClass], templateUrl: './dot-edit-content-host-folder-field.component.html', styleUrls: ['./dot-edit-content-host-folder-field.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, @@ -46,6 +48,14 @@ export class DotEditContentHostFolderFieldComponent implements OnInit { options = signal([]); sitesStatus = signal('init'); pathControl = new FormControl(); + iconClasses = computed(() => { + const status = this.sitesStatus(); + + return { + 'pi-spin pi-spinner': status === 'loading', + 'pi-chevron-down': status !== 'loading' + }; + }); ngOnInit() { this.sitesStatus.set('loading'); diff --git a/core-web/libs/edit-content/src/lib/models/dot-edit-content-host-folder-field.interface.ts b/core-web/libs/edit-content/src/lib/models/dot-edit-content-host-folder-field.interface.ts index 5ad4838c2a92..0ed735cf1ef5 100644 --- a/core-web/libs/edit-content/src/lib/models/dot-edit-content-host-folder-field.interface.ts +++ b/core-web/libs/edit-content/src/lib/models/dot-edit-content-host-folder-field.interface.ts @@ -8,6 +8,14 @@ export type StatusRequest = 'init' | 'loading' | 'success' | 'failed'; export type TreeNodeSelectItem = TreeNodeSelectEvent; +export type CustomTreeNode = { + node: null | TreeNodeItem; + tree: { + path: 'string'; + folders: TreeNodeItem[]; + }; +}; + export interface TreeNodeSelectEvent { originalEvent: Event; node: TreeNode; diff --git a/core-web/libs/edit-content/src/lib/pipes/truncate-path.pipe.ts b/core-web/libs/edit-content/src/lib/pipes/truncate-path.pipe.ts index 8756d0b4ac87..732580272a02 100644 --- a/core-web/libs/edit-content/src/lib/pipes/truncate-path.pipe.ts +++ b/core-web/libs/edit-content/src/lib/pipes/truncate-path.pipe.ts @@ -2,7 +2,8 @@ import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'truncatePath', - standalone: true + standalone: true, + pure: true }) export class TruncatePathPipe implements PipeTransform { transform(value: string): string { diff --git a/core-web/libs/edit-content/src/lib/services/dot-edit-content.service.ts b/core-web/libs/edit-content/src/lib/services/dot-edit-content.service.ts index 8b07a2b63002..5e9c69ec5d15 100644 --- a/core-web/libs/edit-content/src/lib/services/dot-edit-content.service.ts +++ b/core-web/libs/edit-content/src/lib/services/dot-edit-content.service.ts @@ -12,7 +12,11 @@ import { } from '@dotcms/data-access'; import { DotCMSContentType, DotCMSContentlet } from '@dotcms/dotcms-models'; -import { DotFolder, TreeNodeItem } from '../models/dot-edit-content-host-folder-field.interface'; +import { + CustomTreeNode, + DotFolder, + TreeNodeItem +} from '../models/dot-edit-content-host-folder-field.interface'; @Injectable() export class DotEditContentService { @@ -66,7 +70,9 @@ export class DotEditContentService { /** * Get data for site/folder field and tranform into TreeNode - * @returns files + * + * @return {*} {Observable} + * @memberof DotEditContentService */ getSitesTreePath(): Observable { return this.#siteService.getSites().pipe( @@ -87,10 +93,25 @@ export class DotEditContentService { ); } + /** + * + * + * @param {string} path + * @return {*} {Observable} + * @memberof DotEditContentService + */ getFolders(path: string): Observable { return this.#http.post('/api/v1/folder/byPath', { path }).pipe(pluck('entity')); } + /** + * + * + * @param {string} hostName + * @param {string} path + * @return {*} {Observable} + * @memberof DotEditContentService + */ getFoldersTreeNode(hostName: string, path: string): Observable { return this.getFolders(`//${hostName}/${path}`).pipe( map((folders) => { @@ -116,7 +137,14 @@ export class DotEditContentService { ); } - buildTreeByPaths(paths: string[]) { + /** + * + * + * @param {string[]} paths + * @return {*} {Observable} + * @memberof DotEditContentService + */ + buildTreeByPaths(paths: string[]): Observable { const requests = paths.reverse().map((path) => { const split = path.split('/'); const [hostName] = split; From adabb3c6c594d2b4a59da71deb2105691384fd79 Mon Sep 17 00:00:00 2001 From: Nicolas Molina Date: Mon, 10 Jun 2024 14:38:12 -0400 Subject: [PATCH 19/24] chore(edit-content): add docs #28645 --- .../dotcms-webcomponents/src/components.d.ts | 16 ++++++++-------- ...t-edit-content-host-folder-field.component.ts | 6 ++++++ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/core-web/libs/dotcms-webcomponents/src/components.d.ts b/core-web/libs/dotcms-webcomponents/src/components.d.ts index 630bd01e4dee..249568674505 100644 --- a/core-web/libs/dotcms-webcomponents/src/components.d.ts +++ b/core-web/libs/dotcms-webcomponents/src/components.d.ts @@ -23,10 +23,10 @@ export namespace Components { */ "createAssetsText": string; "customUploadFiles": (props: { - files: File[], - onSuccess: () => void, - updateProgress: (progress: number) => void, - onError: (header: string, message: string) => void + files: File[]; + onSuccess: () => void; + updateProgress: (progress: number) => void; + onError: (header: string, message: string) => void; }) => Promise; /** * Labels to be shown in error dialog @@ -1674,10 +1674,10 @@ declare namespace LocalJSX { */ "createAssetsText"?: string; "customUploadFiles"?: (props: { - files: File[], - onSuccess: () => void, - updateProgress: (progress: number) => void, - onError: (header: string, message: string) => void + files: File[]; + onSuccess: () => void; + updateProgress: (progress: number) => void; + onError: (header: string, message: string) => void; }) => Promise; /** * Labels to be shown in error dialog diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts index 79084cd44fc6..62c1501ed7d5 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts @@ -25,6 +25,12 @@ import { TruncatePathPipe } from '../../pipes/truncate-path.pipe'; import { DotEditContentService } from '../../services/dot-edit-content.service'; import { createPaths } from '../../utils/functions.util'; +/** + * Component for editing content site or folder field. + * + * @export + * @class DotEditContentHostFolderFieldComponent + */ @Component({ selector: 'dot-edit-content-host-folder-field', standalone: true, From 67d03dc67d46abba0e1fa195dba53fbc232175d8 Mon Sep 17 00:00:00 2001 From: Nicolas Molina Date: Mon, 10 Jun 2024 14:41:58 -0400 Subject: [PATCH 20/24] chore(edit-content): fix error with types #28645 --- .../models/dot-edit-content-host-folder-field.interface.ts | 2 +- core-web/libs/edit-content/src/lib/utils/mocks.ts | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/core-web/libs/edit-content/src/lib/models/dot-edit-content-host-folder-field.interface.ts b/core-web/libs/edit-content/src/lib/models/dot-edit-content-host-folder-field.interface.ts index 0ed735cf1ef5..12ac30e731f8 100644 --- a/core-web/libs/edit-content/src/lib/models/dot-edit-content-host-folder-field.interface.ts +++ b/core-web/libs/edit-content/src/lib/models/dot-edit-content-host-folder-field.interface.ts @@ -11,7 +11,7 @@ export type TreeNodeSelectItem = TreeNodeSelectEvent; export type CustomTreeNode = { node: null | TreeNodeItem; tree: { - path: 'string'; + path: string; folders: TreeNodeItem[]; }; }; diff --git a/core-web/libs/edit-content/src/lib/utils/mocks.ts b/core-web/libs/edit-content/src/lib/utils/mocks.ts index cb8039986f2b..d94d3cffc211 100644 --- a/core-web/libs/edit-content/src/lib/utils/mocks.ts +++ b/core-web/libs/edit-content/src/lib/utils/mocks.ts @@ -18,7 +18,10 @@ import { MockDotMessageService } from '@dotcms/utils-testing'; import { FIELD_TYPES } from '../models/dot-edit-content-field.enum'; import { EditContentPayload } from '../models/dot-edit-content-form.interface'; -import { TreeNodeItem } from '../models/dot-edit-content-host-folder-field.interface'; +import { + CustomTreeNode, + TreeNodeItem +} from '../models/dot-edit-content-host-folder-field.interface'; /* FIELDS MOCK BY TYPE */ export const TEXT_FIELD_MOCK: DotCMSContentTypeField = { @@ -1273,7 +1276,7 @@ export const TREE_SELECT_MOCK: TreeNodeItem[] = [ } ]; -export const TREE_SELECT_MOCK_NODE = { +export const TREE_SELECT_MOCK_NODE: CustomTreeNode = { node: { ...TREE_SELECT_MOCK[0].children[0] }, tree: { path: 'demo.dotcms.com', From a7552364dbb0a9146c4f22529bb931d4520ab576 Mon Sep 17 00:00:00 2001 From: Nicolas Molina Date: Mon, 10 Jun 2024 15:01:07 -0400 Subject: [PATCH 21/24] chore(edit-content): use signals convention #28645 --- ...t-content-host-folder-field.component.html | 4 ++-- ...ontent-host-folder-field.component.spec.ts | 2 +- ...dit-content-host-folder-field.component.ts | 20 +++++++++---------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html index c854a94fb0cf..300716074d30 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.html @@ -2,13 +2,13 @@ (onNodeSelect)="onNodeSelect($event)" (onNodeExpand)="onNodeExpand($event)" [formControl]="pathControl" - [options]="options()" + [options]="$options()" [attr.aria-labelledby]="'field-' + field.variable" selectionMode="single"> {{ node.label | truncatePath }} - + diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts index 698bac84f76c..b5157849a825 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.spec.ts @@ -57,7 +57,7 @@ describe('DotEditContentHostFolderFieldComponent', () => { it('should show options', () => { spectator.detectChanges(); - const options = component.options(); + const options = component.$options(); expect(service.getSitesTreePath).toHaveBeenCalled(); expect(options).toBe(TREE_SELECT_SITES_MOCK); diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts index 62c1501ed7d5..ab3eaa63935f 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component.ts @@ -51,11 +51,11 @@ export class DotEditContentHostFolderFieldComponent implements OnInit { readonly #controlContainer = inject(ControlContainer); readonly #editContentService = inject(DotEditContentService); - options = signal([]); - sitesStatus = signal('init'); + $options = signal([]); + $sitesStatus = signal('init'); pathControl = new FormControl(); - iconClasses = computed(() => { - const status = this.sitesStatus(); + $iconClasses = computed(() => { + const status = this.$sitesStatus(); return { 'pi-spin pi-spinner': status === 'loading', @@ -64,15 +64,15 @@ export class DotEditContentHostFolderFieldComponent implements OnInit { }); ngOnInit() { - this.sitesStatus.set('loading'); + this.$sitesStatus.set('loading'); this.#editContentService.getSitesTreePath().subscribe({ next: (options) => { - this.options.set(options); + this.$options.set(options); this.setInitialValue(); - this.sitesStatus.set('success'); + this.$sitesStatus.set('success'); }, error: () => { - this.sitesStatus.set('failed'); + this.$sitesStatus.set('failed'); } }); } @@ -117,7 +117,7 @@ export class DotEditContentHostFolderFieldComponent implements OnInit { if (hasPaths) { this.buildTreeByPaths(value); } else { - const options = this.options(); + const options = this.$options(); this.pathControl.setValue(options.find((item) => item.key === value)); } } @@ -127,7 +127,7 @@ export class DotEditContentHostFolderFieldComponent implements OnInit { const paths = createPaths(path); this.#editContentService.buildTreeByPaths(paths).subscribe((rta) => { const sitePath = rta.tree.path; - this.options.update((options) => { + this.$options.update((options) => { return options.map((item) => { if (item.key === sitePath) { return { From 40d870f1b31f3d109963185f7b300270c43fb278 Mon Sep 17 00:00:00 2001 From: Nicolas Molina Date: Mon, 10 Jun 2024 15:21:11 -0400 Subject: [PATCH 22/24] chore(edit-content): fix error #28645 --- .../edit-content/src/lib/services/dot-edit-content.service.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core-web/libs/edit-content/src/lib/services/dot-edit-content.service.ts b/core-web/libs/edit-content/src/lib/services/dot-edit-content.service.ts index 5e9c69ec5d15..a8838dbb5f6a 100644 --- a/core-web/libs/edit-content/src/lib/services/dot-edit-content.service.ts +++ b/core-web/libs/edit-content/src/lib/services/dot-edit-content.service.ts @@ -113,7 +113,7 @@ export class DotEditContentService { * @memberof DotEditContentService */ getFoldersTreeNode(hostName: string, path: string): Observable { - return this.getFolders(`//${hostName}/${path}`).pipe( + return this.getFolders(`//${hostName}${path}`).pipe( map((folders) => { return folders .filter((folder) => { @@ -150,7 +150,7 @@ export class DotEditContentService { const [hostName] = split; const subPath = split.slice(1).join('/'); - return this.getFoldersTreeNode(hostName, subPath).pipe( + return this.getFoldersTreeNode(hostName, `/${subPath}`).pipe( map((folders) => ({ path: path.replace(/[/]/g, ''), folders })) ); }); From b578f82a3429e32e46d00c100d10bf07e5fd9c1a Mon Sep 17 00:00:00 2001 From: Nicolas Molina Date: Mon, 10 Jun 2024 15:31:54 -0400 Subject: [PATCH 23/24] chore(edit-content): apply format #28645 --- core-web/apps/dotcdn/src/app/app.component.ts | 5 +- .../apps/dotcdn/src/app/dotcdn.service.ts | 5 +- core-web/apps/dotcdn/src/index.html | 2 +- .../src/index.html | 2 +- .../apps/dotcms-block-editor/src/index.html | 2 +- .../api/services/guards/auth-guard.service.ts | 5 +- .../guards/public-auth-guard.service.ts | 5 +- ...-edit-page-state-controller.component.scss | 4 +- ...ate-additional-actions-iframe.component.ts | 5 +- ...t-page-state-controller-seo.component.scss | 4 +- .../dot-pages-listing-panel.component.ts | 5 +- .../dot-starter/dot-starter.component.ts | 5 +- .../dot-template-advanced.component.ts | 5 +- .../dot-template-create-edit.resolver.ts | 5 +- ...ent-type-field-dragabble-item.component.ts | 5 +- .../dot-layout-grid.model.ts | 5 +- .../dot-bulk-information.component.ts | 5 +- .../dot-global-message.component.ts | 5 +- .../dot-md-icon-selector.component.scss | 6 +- .../dot-page-selector.component.ts | 8 +-- .../dot-comment-and-assign-form.component.ts | 5 +- .../dot-create-persona-form.component.ts | 5 +- .../action-header.component.scss | 4 +- .../dot-listing-data-table.component.ts | 5 +- .../dot-nav-item/dot-nav-item.component.scss | 4 +- .../ai-image-prompt-form.component.ts | 4 +- .../asset-form/asset-form.extension.ts | 2 +- .../dot-external-asset.component.ts | 5 +- .../drag-handler/drag-handler.component.scss | 4 +- .../directives/editor/editor.directive.ts | 5 +- .../dot-experiments.service.ts | 72 +++++++++---------- .../dot-properties/dot-properties.service.ts | 11 +-- .../src/lib/dot-router/dot-router.service.ts | 5 +- .../dot-upload-file.service.ts | 5 +- .../dot-workflows-actions.service.ts | 6 +- .../libs/dot-layout-grid/src/lib/NgGrid.css | 20 ++++-- .../src/lib/services/GoogleMapService.ts | 5 +- .../src/lib/core/dotcms-config.service.ts | 5 +- .../src/lib/core/dotcms-events.service.ts | 5 +- .../core/util/models/dot-event-socket-url.ts | 5 +- .../libs/dotcms-scss/angular/_mixins.scss | 20 ++++-- .../libs/dotcms-scss/angular/_variables.scss | 7 +- .../dotcms-theme/components/_contextmenu.scss | 8 ++- .../dotcms-theme/components/_datatable.scss | 5 +- .../dotcms-theme/components/_dialog.scss | 11 ++- .../dotcms-theme/components/_galleria.scss | 5 +- .../dotcms-theme/components/_image.scss | 5 +- .../dotcms-theme/components/_inplace.scss | 6 +- .../components/_overlaypanel.scss | 5 +- .../dotcms-theme/components/_sidebar.scss | 5 +- .../dotcms-theme/components/_table.scss | 5 +- .../dotcms-theme/components/_tree.scss | 5 +- .../components/form/_inputswitch.scss | 39 +++++++--- .../components/form/_selectbutton.scss | 6 +- .../dotcms-theme/components/form/_slider.scss | 14 +++- .../components/form/_treeselect.scss | 9 ++- .../dotcms-theme/components/form/common.scss | 4 +- .../components/messages/_message.scss | 5 +- .../angular/dotcms-theme/utils/_password.scss | 4 +- core-web/libs/dotcms-scss/jsp/css/dotcms.css | 49 +++++++++---- .../jsp/scss/backend/dot-admin/_common.scss | 4 +- .../scss/backend/dot-admin/_dot-admin.scss | 4 +- .../components/_file-selector-tree.scss | 8 ++- .../jsp/scss/font-awesome-4.7.0/_path.scss | 3 +- core-web/libs/dotcms-scss/shared/_mixins.scss | 8 ++- .../dot-experiments-configuration-store.ts | 4 +- .../store/dot-experiments-reports-store.ts | 9 +-- .../template-builder-box.component.ts | 5 +- .../dot-binary-option-selector.component.scss | 4 +- .../dot-form-dialog.component.ts | 5 +- .../dot-avatar/dot-avatar.directive.ts | 5 +- 71 files changed, 389 insertions(+), 162 deletions(-) diff --git a/core-web/apps/dotcdn/src/app/app.component.ts b/core-web/apps/dotcdn/src/app/app.component.ts index b5f1bee924f7..609cdf97a975 100644 --- a/core-web/apps/dotcdn/src/app/app.component.ts +++ b/core-web/apps/dotcdn/src/app/app.component.ts @@ -33,7 +33,10 @@ export class AppComponent implements OnInit { chartHeight = '25rem'; options: CdnChartOptions; - constructor(private fb: UntypedFormBuilder, private dotCdnStore: DotCDNStore) {} + constructor( + private fb: UntypedFormBuilder, + private dotCdnStore: DotCDNStore + ) {} ngOnInit(): void { this.setChartOptions(); diff --git a/core-web/apps/dotcdn/src/app/dotcdn.service.ts b/core-web/apps/dotcdn/src/app/dotcdn.service.ts index 6ab59b08f551..90cd381909df 100644 --- a/core-web/apps/dotcdn/src/app/dotcdn.service.ts +++ b/core-web/apps/dotcdn/src/app/dotcdn.service.ts @@ -13,7 +13,10 @@ import { DotCDNStats, PurgeReturnData, PurgeUrlOptions } from './app.models'; providedIn: 'root' }) export class DotCDNService { - constructor(private coreWebService: CoreWebService, private siteService: SiteService) {} + constructor( + private coreWebService: CoreWebService, + private siteService: SiteService + ) {} /** * Request stats via Core Web Service diff --git a/core-web/apps/dotcdn/src/index.html b/core-web/apps/dotcdn/src/index.html index db2944cbd645..b9db502e31a5 100644 --- a/core-web/apps/dotcdn/src/index.html +++ b/core-web/apps/dotcdn/src/index.html @@ -1,4 +1,4 @@ - + diff --git a/core-web/apps/dotcms-binary-field-builder/src/index.html b/core-web/apps/dotcms-binary-field-builder/src/index.html index c548aedeff82..f898897c7b94 100644 --- a/core-web/apps/dotcms-binary-field-builder/src/index.html +++ b/core-web/apps/dotcms-binary-field-builder/src/index.html @@ -1,4 +1,4 @@ - + diff --git a/core-web/apps/dotcms-block-editor/src/index.html b/core-web/apps/dotcms-block-editor/src/index.html index 34634ef87587..dce10144bf60 100644 --- a/core-web/apps/dotcms-block-editor/src/index.html +++ b/core-web/apps/dotcms-block-editor/src/index.html @@ -1,4 +1,4 @@ - + diff --git a/core-web/apps/dotcms-ui/src/app/api/services/guards/auth-guard.service.ts b/core-web/apps/dotcms-ui/src/app/api/services/guards/auth-guard.service.ts index 1f040a04c9ae..997175345b65 100644 --- a/core-web/apps/dotcms-ui/src/app/api/services/guards/auth-guard.service.ts +++ b/core-web/apps/dotcms-ui/src/app/api/services/guards/auth-guard.service.ts @@ -13,7 +13,10 @@ import { LoginService } from '@dotcms/dotcms-js'; */ @Injectable() export class AuthGuardService implements CanActivate { - constructor(private dotRouterService: DotRouterService, private loginService: LoginService) {} + constructor( + private dotRouterService: DotRouterService, + private loginService: LoginService + ) {} canActivate(_route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable { return this.loginService.isLogin$.pipe( diff --git a/core-web/apps/dotcms-ui/src/app/api/services/guards/public-auth-guard.service.ts b/core-web/apps/dotcms-ui/src/app/api/services/guards/public-auth-guard.service.ts index b4132280284d..247981b74877 100644 --- a/core-web/apps/dotcms-ui/src/app/api/services/guards/public-auth-guard.service.ts +++ b/core-web/apps/dotcms-ui/src/app/api/services/guards/public-auth-guard.service.ts @@ -13,7 +13,10 @@ import { LoginService } from '@dotcms/dotcms-js'; */ @Injectable() export class PublicAuthGuardService implements CanActivate { - constructor(private router: DotRouterService, private loginService: LoginService) {} + constructor( + private router: DotRouterService, + private loginService: LoginService + ) {} /** * Guard checks is the User is logged in to redirect to the First Portlet otherwise approve the route request. diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/components/dot-edit-page-state-controller/dot-edit-page-state-controller.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/components/dot-edit-page-state-controller/dot-edit-page-state-controller.component.scss index 044d2bc4f0bd..4d34511ee256 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/components/dot-edit-page-state-controller/dot-edit-page-state-controller.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/components/dot-edit-page-state-controller/dot-edit-page-state-controller.component.scss @@ -43,7 +43,9 @@ p-inputSwitch { position: absolute; text-rendering: auto; top: 1px; - transition: transform $basic-speed ease-in, color $basic-speed ease-in; + transition: + transform $basic-speed ease-in, + color $basic-speed ease-in; } .p-inputswitch-checked .p-inputswitch-slider:after { diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/layout/components/dot-template-additional-actions/dot-legacy-template-additional-actions-iframe/dot-legacy-template-additional-actions-iframe.component.ts b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/layout/components/dot-template-additional-actions/dot-legacy-template-additional-actions-iframe/dot-legacy-template-additional-actions-iframe.component.ts index b809f4c50099..c30250a1e1fe 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/layout/components/dot-template-additional-actions/dot-legacy-template-additional-actions-iframe/dot-legacy-template-additional-actions-iframe.component.ts +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/layout/components/dot-template-additional-actions/dot-legacy-template-additional-actions-iframe/dot-legacy-template-additional-actions-iframe.component.ts @@ -14,7 +14,10 @@ import { DotMenuService } from '@dotcms/app/api/services/dot-menu.service'; export class DotLegacyTemplateAdditionalActionsComponent implements OnInit { url: Observable; - constructor(private route: ActivatedRoute, private dotMenuService: DotMenuService) {} + constructor( + private route: ActivatedRoute, + private dotMenuService: DotMenuService + ) {} ngOnInit(): void { this.url = this.route.params.pipe( diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/seo/components/dot-edit-page-state-controller-seo/dot-edit-page-state-controller-seo.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/seo/components/dot-edit-page-state-controller-seo/dot-edit-page-state-controller-seo.component.scss index 0ee3e24d0cac..9e5569ff16f6 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/seo/components/dot-edit-page-state-controller-seo/dot-edit-page-state-controller-seo.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/seo/components/dot-edit-page-state-controller-seo/dot-edit-page-state-controller-seo.component.scss @@ -39,7 +39,9 @@ p-inputSwitch { position: absolute; text-rendering: auto; top: 0; - transition: transform $basic-speed ease-in, color $basic-speed ease-in; + transition: + transform $basic-speed ease-in, + color $basic-speed ease-in; } .p-inputswitch-checked .p-inputswitch-slider:after { diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-pages/dot-pages-listing-panel/dot-pages-listing-panel.component.ts b/core-web/apps/dotcms-ui/src/app/portlets/dot-pages/dot-pages-listing-panel/dot-pages-listing-panel.component.ts index 93b2af2853e3..66ef83b4ba79 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-pages/dot-pages-listing-panel/dot-pages-listing-panel.component.ts +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-pages/dot-pages-listing-panel/dot-pages-listing-panel.component.ts @@ -46,7 +46,10 @@ export class DotPagesListingPanelComponent implements OnInit, OnDestroy, AfterVi draft: this.dotMessageService.get('Draft') }; - constructor(private store: DotPageStore, private dotMessageService: DotMessageService) {} + constructor( + private store: DotPageStore, + private dotMessageService: DotMessageService + ) {} ngOnInit() { this.store.actionMenuDomId$ diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-starter/dot-starter.component.ts b/core-web/apps/dotcms-ui/src/app/portlets/dot-starter/dot-starter.component.ts index 50eec4c4d9c6..085750bcc1af 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-starter/dot-starter.component.ts +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-starter/dot-starter.component.ts @@ -27,7 +27,10 @@ export class DotStarterComponent implements OnInit { showCreatePageLink: boolean; showCreateTemplateLink: boolean; - constructor(private route: ActivatedRoute, private dotAccountService: DotAccountService) {} + constructor( + private route: ActivatedRoute, + private dotAccountService: DotAccountService + ) {} ngOnInit() { this.userData$ = this.route.data.pipe( diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-templates/dot-template-create-edit/dot-template-advanced/dot-template-advanced.component.ts b/core-web/apps/dotcms-ui/src/app/portlets/dot-templates/dot-template-create-edit/dot-template-advanced/dot-template-advanced.component.ts index 02e8d6d81f2c..e18ac4ba75df 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-templates/dot-template-create-edit/dot-template-advanced/dot-template-advanced.component.ts +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-templates/dot-template-create-edit/dot-template-advanced/dot-template-advanced.component.ts @@ -55,7 +55,10 @@ export class DotTemplateAdvancedComponent implements OnInit, OnDestroy, OnChange actions: DotPortletToolbarActions; private destroy$: Subject = new Subject(); - constructor(private fb: UntypedFormBuilder, private dotMessageService: DotMessageService) {} + constructor( + private fb: UntypedFormBuilder, + private dotMessageService: DotMessageService + ) {} ngOnInit(): void { this.form = this.fb.group({ body: this.body }); diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-templates/dot-template-create-edit/resolvers/dot-template-create-edit.resolver.ts b/core-web/apps/dotcms-ui/src/app/portlets/dot-templates/dot-template-create-edit/resolvers/dot-template-create-edit.resolver.ts index d67e50704adb..f0153816d62e 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-templates/dot-template-create-edit/resolvers/dot-template-create-edit.resolver.ts +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-templates/dot-template-create-edit/resolvers/dot-template-create-edit.resolver.ts @@ -11,7 +11,10 @@ import { DotTemplate } from '@dotcms/dotcms-models'; @Injectable() export class DotTemplateCreateEditResolver implements Resolve { - constructor(private service: DotTemplatesService, private dotRouterService: DotRouterService) {} + constructor( + private service: DotTemplatesService, + private dotRouterService: DotRouterService + ) {} resolve(route: ActivatedRouteSnapshot, _state: RouterStateSnapshot): Observable { const inode = route.paramMap.get('inode'); diff --git a/core-web/apps/dotcms-ui/src/app/portlets/shared/dot-content-types-edit/components/fields/content-type-field-dragabble-item/content-type-field-dragabble-item.component.ts b/core-web/apps/dotcms-ui/src/app/portlets/shared/dot-content-types-edit/components/fields/content-type-field-dragabble-item/content-type-field-dragabble-item.component.ts index d930723899b9..5046e5f83fe7 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/shared/dot-content-types-edit/components/fields/content-type-field-dragabble-item/content-type-field-dragabble-item.component.ts +++ b/core-web/apps/dotcms-ui/src/app/portlets/shared/dot-content-types-edit/components/fields/content-type-field-dragabble-item/content-type-field-dragabble-item.component.ts @@ -47,7 +47,10 @@ export class ContentTypesFieldDragabbleItemComponent implements OnInit { fieldAttributesString: string; icon: string; - constructor(private dotMessageService: DotMessageService, public fieldService: FieldService) {} + constructor( + private dotMessageService: DotMessageService, + public fieldService: FieldService + ) {} ngOnInit(): void { this.fieldTypeLabel = this.field.fieldTypeLabel ? this.field.fieldTypeLabel : null; diff --git a/core-web/apps/dotcms-ui/src/app/shared/models/dot-edit-layout-designer/dot-layout-grid.model.ts b/core-web/apps/dotcms-ui/src/app/shared/models/dot-edit-layout-designer/dot-layout-grid.model.ts index 567e9763eefc..1a937b637164 100644 --- a/core-web/apps/dotcms-ui/src/app/shared/models/dot-edit-layout-designer/dot-layout-grid.model.ts +++ b/core-web/apps/dotcms-ui/src/app/shared/models/dot-edit-layout-designer/dot-layout-grid.model.ts @@ -35,7 +35,10 @@ const DEFAULT_CONFIG_FOR_NOT_EMPTY_GRID_TEMPLATE: Record = new Subject(); - constructor(private dotEventsService: DotEventsService, private cd: ChangeDetectorRef) {} + constructor( + private dotEventsService: DotEventsService, + private cd: ChangeDetectorRef + ) {} ngOnDestroy(): void { this.destroy$.next(true); diff --git a/core-web/apps/dotcms-ui/src/app/view/components/_common/dot-md-icon-selector/dot-md-icon-selector.component.scss b/core-web/apps/dotcms-ui/src/app/view/components/_common/dot-md-icon-selector/dot-md-icon-selector.component.scss index 4fe4046c2f43..fa470a931891 100644 --- a/core-web/apps/dotcms-ui/src/app/view/components/_common/dot-md-icon-selector/dot-md-icon-selector.component.scss +++ b/core-web/apps/dotcms-ui/src/app/view/components/_common/dot-md-icon-selector/dot-md-icon-selector.component.scss @@ -50,8 +50,10 @@ dot-material-icon-picker { .dot-material-icon__list { border: 0; - box-shadow: 0 5px 5px -3px $color-palette-black-op-20, - 0 8px 10px 1px $color-palette-black-op-10, 0 3px 14px 2px $color-palette-black-op-10; + box-shadow: + 0 5px 5px -3px $color-palette-black-op-20, + 0 8px 10px 1px $color-palette-black-op-10, + 0 3px 14px 2px $color-palette-black-op-10; color: $black; li:hover { diff --git a/core-web/apps/dotcms-ui/src/app/view/components/_common/dot-page-selector/dot-page-selector.component.ts b/core-web/apps/dotcms-ui/src/app/view/components/_common/dot-page-selector/dot-page-selector.component.ts index 61b31e5472c6..c9b5e30d6740 100644 --- a/core-web/apps/dotcms-ui/src/app/view/components/_common/dot-page-selector/dot-page-selector.component.ts +++ b/core-web/apps/dotcms-ui/src/app/view/components/_common/dot-page-selector/dot-page-selector.component.ts @@ -231,8 +231,8 @@ export class DotPageSelectorComponent implements ControlValueAccessor { return this.isSearchingForHost(query) ? SearchType.SITE : this.folderSearch - ? SearchType.FOLDER - : SearchType.PAGE; + ? SearchType.FOLDER + : SearchType.PAGE; } private getConditionalSearch(param: string): Observable { @@ -301,8 +301,8 @@ export class DotPageSelectorComponent implements ControlValueAccessor { return cleanedQuery.startsWith('//') ? cleanedQuery : cleanedQuery.length >= 3 - ? cleanedQuery - : ''; + ? cleanedQuery + : ''; } private cleanHost(query: string): string { diff --git a/core-web/apps/dotcms-ui/src/app/view/components/_common/forms/dot-comment-and-assign-form/dot-comment-and-assign-form.component.ts b/core-web/apps/dotcms-ui/src/app/view/components/_common/forms/dot-comment-and-assign-form/dot-comment-and-assign-form.component.ts index 77d138dc9fa4..835616fc7336 100644 --- a/core-web/apps/dotcms-ui/src/app/view/components/_common/forms/dot-comment-and-assign-form/dot-comment-and-assign-form.component.ts +++ b/core-web/apps/dotcms-ui/src/app/view/components/_common/forms/dot-comment-and-assign-form/dot-comment-and-assign-form.component.ts @@ -46,7 +46,10 @@ export class DotCommentAndAssignFormComponent private destroy$: Subject = new Subject(); - constructor(private dotRolesService: DotRolesService, public fb: UntypedFormBuilder) {} + constructor( + private dotRolesService: DotRolesService, + public fb: UntypedFormBuilder + ) {} ngOnInit() { if (this.data) { diff --git a/core-web/apps/dotcms-ui/src/app/view/components/dot-add-persona-dialog/dot-create-persona-form/dot-create-persona-form.component.ts b/core-web/apps/dotcms-ui/src/app/view/components/dot-add-persona-dialog/dot-create-persona-form/dot-create-persona-form.component.ts index 63f76edb51f8..693e3fb12c3d 100644 --- a/core-web/apps/dotcms-ui/src/app/view/components/dot-add-persona-dialog/dot-create-persona-form/dot-create-persona-form.component.ts +++ b/core-web/apps/dotcms-ui/src/app/view/components/dot-add-persona-dialog/dot-create-persona-form/dot-create-persona-form.component.ts @@ -24,7 +24,10 @@ export class DotCreatePersonaFormComponent implements OnInit, OnDestroy { private destroy$: Subject = new Subject(); - constructor(private fb: UntypedFormBuilder, private siteService: SiteService) {} + constructor( + private fb: UntypedFormBuilder, + private siteService: SiteService + ) {} ngOnInit() { this.initPersonaForm(); diff --git a/core-web/apps/dotcms-ui/src/app/view/components/dot-listing-data-table/action-header/action-header.component.scss b/core-web/apps/dotcms-ui/src/app/view/components/dot-listing-data-table/action-header/action-header.component.scss index de219cdce2b4..f847054abf67 100644 --- a/core-web/apps/dotcms-ui/src/app/view/components/dot-listing-data-table/action-header/action-header.component.scss +++ b/core-web/apps/dotcms-ui/src/app/view/components/dot-listing-data-table/action-header/action-header.component.scss @@ -51,7 +51,9 @@ color: $white; display: flex; transform: translateY(0px); - transition: transform 0.2s ease, visibility 0.2s ease; + transition: + transform 0.2s ease, + visibility 0.2s ease; visibility: hidden; } diff --git a/core-web/apps/dotcms-ui/src/app/view/components/dot-listing-data-table/dot-listing-data-table.component.ts b/core-web/apps/dotcms-ui/src/app/view/components/dot-listing-data-table/dot-listing-data-table.component.ts index b14caab7808e..703fc05e1a69 100644 --- a/core-web/apps/dotcms-ui/src/app/view/components/dot-listing-data-table/dot-listing-data-table.component.ts +++ b/core-web/apps/dotcms-ui/src/app/view/components/dot-listing-data-table/dot-listing-data-table.component.ts @@ -81,7 +81,10 @@ export class DotListingDataTableComponent implements OnInit { maxLinksPage: number; totalRecords: number; - constructor(public loggerService: LoggerService, public paginatorService: PaginatorService) { + constructor( + public loggerService: LoggerService, + public paginatorService: PaginatorService + ) { this.paginatorService.url = this.url; } diff --git a/core-web/apps/dotcms-ui/src/app/view/components/dot-navigation/components/dot-nav-item/dot-nav-item.component.scss b/core-web/apps/dotcms-ui/src/app/view/components/dot-navigation/components/dot-nav-item/dot-nav-item.component.scss index 94d90430ae85..a0ca086eec91 100644 --- a/core-web/apps/dotcms-ui/src/app/view/components/dot-navigation/components/dot-nav-item/dot-nav-item.component.scss +++ b/core-web/apps/dotcms-ui/src/app/view/components/dot-navigation/components/dot-nav-item/dot-nav-item.component.scss @@ -20,7 +20,9 @@ position: absolute; top: 0; transform: translateY(0); - transition: opacity $basic-speed ease, transform $basic-speed ease; + transition: + opacity $basic-speed ease, + transform $basic-speed ease; z-index: 9999; } } diff --git a/core-web/libs/block-editor/src/lib/extensions/ai-image-prompt/components/ai-image-prompt-form/ai-image-prompt-form.component.ts b/core-web/libs/block-editor/src/lib/extensions/ai-image-prompt/components/ai-image-prompt-form/ai-image-prompt-form.component.ts index 25423f99ec05..3dfa2e985e1c 100644 --- a/core-web/libs/block-editor/src/lib/extensions/ai-image-prompt/components/ai-image-prompt-form/ai-image-prompt-form.component.ts +++ b/core-web/libs/block-editor/src/lib/extensions/ai-image-prompt/components/ai-image-prompt-form/ai-image-prompt-form.component.ts @@ -199,7 +199,7 @@ export class AiImagePromptFormComponent implements OnChanges, OnInit { this.submitButtonLabel = isLoading ? 'block-editor.extension.ai-image.generating' : this.aiProcessedPrompt || this.value?.error - ? 'block-editor.extension.ai-image.regenerate' - : 'block-editor.extension.ai-image.generate'; + ? 'block-editor.extension.ai-image.regenerate' + : 'block-editor.extension.ai-image.generate'; } } diff --git a/core-web/libs/block-editor/src/lib/extensions/asset-form/asset-form.extension.ts b/core-web/libs/block-editor/src/lib/extensions/asset-form/asset-form.extension.ts index e8622c69e876..433bfe3510d2 100644 --- a/core-web/libs/block-editor/src/lib/extensions/asset-form/asset-form.extension.ts +++ b/core-web/libs/block-editor/src/lib/extensions/asset-form/asset-form.extension.ts @@ -193,7 +193,7 @@ export const BubbleAssetFormExtension = (viewContainerRef: ViewContainerRef) => onStart, onHide, onDestroy - } as RenderProps) + }) as RenderProps }) ]; } diff --git a/core-web/libs/block-editor/src/lib/extensions/asset-form/components/dot-external-asset/dot-external-asset.component.ts b/core-web/libs/block-editor/src/lib/extensions/asset-form/components/dot-external-asset/dot-external-asset.component.ts index 0c4a14a96ea4..11fb47fa19be 100644 --- a/core-web/libs/block-editor/src/lib/extensions/asset-form/components/dot-external-asset/dot-external-asset.component.ts +++ b/core-web/libs/block-editor/src/lib/extensions/asset-form/components/dot-external-asset/dot-external-asset.component.ts @@ -47,7 +47,10 @@ export class DotExternalAssetComponent { return this.form.controls.url?.invalid; } - constructor(private fb: FormBuilder, private cd: ChangeDetectorRef) { + constructor( + private fb: FormBuilder, + private cd: ChangeDetectorRef + ) { this.form = this.fb.group({ url: ['', [Validators.required, Validators.pattern(regexURL)]] }); diff --git a/core-web/libs/block-editor/src/lib/extensions/drag-handler/drag-handler.component.scss b/core-web/libs/block-editor/src/lib/extensions/drag-handler/drag-handler.component.scss index 16fef8dad952..68060db79a20 100644 --- a/core-web/libs/block-editor/src/lib/extensions/drag-handler/drag-handler.component.scss +++ b/core-web/libs/block-editor/src/lib/extensions/drag-handler/drag-handler.component.scss @@ -4,7 +4,9 @@ z-index: 1; opacity: 0; color: var(--color-palette-primary-800); - transition: opacity 250ms, top 150ms; + transition: + opacity 250ms, + top 150ms; pointer-events: none; &.visible { diff --git a/core-web/libs/block-editor/src/lib/shared/directives/editor/editor.directive.ts b/core-web/libs/block-editor/src/lib/shared/directives/editor/editor.directive.ts index ee5f44039b80..33ed26af87a1 100644 --- a/core-web/libs/block-editor/src/lib/shared/directives/editor/editor.directive.ts +++ b/core-web/libs/block-editor/src/lib/shared/directives/editor/editor.directive.ts @@ -27,7 +27,10 @@ import { Content, Editor, JSONContent } from '@tiptap/core'; export class EditorDirective implements OnInit, ControlValueAccessor, OnDestroy { @Input() editor!: Editor; - constructor(private el: ElementRef, private _renderer: Renderer2) {} + constructor( + private el: ElementRef, + private _renderer: Renderer2 + ) {} private onChange: (value: Content) => void = () => { /** */ diff --git a/core-web/libs/data-access/src/lib/dot-experiments/dot-experiments.service.ts b/core-web/libs/data-access/src/lib/dot-experiments/dot-experiments.service.ts index e99ee168e2d2..f5aecff2b32f 100644 --- a/core-web/libs/data-access/src/lib/dot-experiments/dot-experiments.service.ts +++ b/core-web/libs/data-access/src/lib/dot-experiments/dot-experiments.service.ts @@ -34,9 +34,9 @@ export class DotExperimentsService { */ healthCheck(): Observable { return this.http - .get>( - '/api/v1/experiments/health' - ) + .get< + DotCMSResponseExperiment<{ healthy: HealthStatusTypes }> + >('/api/v1/experiments/health') .pipe(pluck('entity', 'health')); } /** @@ -74,9 +74,9 @@ export class DotExperimentsService { */ getByStatus(pageId: string, status: DotExperimentStatus): Observable { return this.http - .get>( - `${API_ENDPOINT}?pageId=${pageId}&status=${status}` - ) + .get< + DotCMSResponseExperiment + >(`${API_ENDPOINT}?pageId=${pageId}&status=${status}`) .pipe(pluck('entity')); } @@ -100,9 +100,9 @@ export class DotExperimentsService { */ getResults(experimentId: string): Observable { return this.http - .get>( - `${API_ENDPOINT}/${experimentId}/results` - ) + .get< + DotCMSResponseExperiment + >(`${API_ENDPOINT}/${experimentId}/results`) .pipe(pluck('entity')); } @@ -114,10 +114,9 @@ export class DotExperimentsService { */ archive(experimentId: string): Observable { return this.http - .put>( - `${API_ENDPOINT}/${experimentId}/_archive`, - {} - ) + .put< + DotCMSResponseExperiment + >(`${API_ENDPOINT}/${experimentId}/_archive`, {}) .pipe(pluck('entity')); } @@ -141,10 +140,9 @@ export class DotExperimentsService { */ start(experimentId: string): Observable { return this.http - .post>( - `${API_ENDPOINT}/${experimentId}/_start`, - {} - ) + .post< + DotCMSResponseExperiment + >(`${API_ENDPOINT}/${experimentId}/_start`, {}) .pipe(pluck('entity')); } @@ -156,10 +154,9 @@ export class DotExperimentsService { */ stop(experimentId: string): Observable { return this.http - .post>( - `${API_ENDPOINT}/${experimentId}/_end`, - {} - ) + .post< + DotCMSResponseExperiment + >(`${API_ENDPOINT}/${experimentId}/_end`, {}) .pipe(pluck('entity')); } @@ -171,10 +168,9 @@ export class DotExperimentsService { */ cancelSchedule(experimentId: string): Observable { return this.http - .post>( - `${API_ENDPOINT}/scheduled/${experimentId}/_cancel`, - {} - ) + .post< + DotCMSResponseExperiment + >(`${API_ENDPOINT}/scheduled/${experimentId}/_cancel`, {}) .pipe(pluck('entity')); } @@ -210,10 +206,9 @@ export class DotExperimentsService { changes: { description: string } ): Observable { return this.http - .put>( - `${API_ENDPOINT}/${experimentId}/variants/${variantId}`, - changes - ) + .put< + DotCMSResponseExperiment + >(`${API_ENDPOINT}/${experimentId}/variants/${variantId}`, changes) .pipe(pluck('entity')); } @@ -227,9 +222,9 @@ export class DotExperimentsService { removeVariant(experimentId: string, variantId: string): Observable { return this.http - .delete>( - `${API_ENDPOINT}/${experimentId}/variants/${variantId}` - ) + .delete< + DotCMSResponseExperiment + >(`${API_ENDPOINT}/${experimentId}/variants/${variantId}`) .pipe(pluck('entity')); } @@ -242,10 +237,9 @@ export class DotExperimentsService { */ promoteVariant(experimentId: string, variantId: string): Observable { return this.http - .put>( - `/api/v1/experiments/${experimentId}/variants/${variantId}/_promote`, - {} - ) + .put< + DotCMSResponseExperiment + >(`/api/v1/experiments/${experimentId}/variants/${variantId}/_promote`, {}) .pipe(pluck('entity')); } @@ -342,9 +336,9 @@ export class DotExperimentsService { */ deleteGoal(experimentId: string, goalType: GoalsLevels): Observable { return this.http - .delete>( - `${API_ENDPOINT}/${experimentId}/goals/${goalType}` - ) + .delete< + DotCMSResponseExperiment + >(`${API_ENDPOINT}/${experimentId}/goals/${goalType}`) .pipe(pluck('entity')); } } diff --git a/core-web/libs/data-access/src/lib/dot-properties/dot-properties.service.ts b/core-web/libs/data-access/src/lib/dot-properties/dot-properties.service.ts index b907676f7769..603efddf53a3 100644 --- a/core-web/libs/data-access/src/lib/dot-properties/dot-properties.service.ts +++ b/core-web/libs/data-access/src/lib/dot-properties/dot-properties.service.ts @@ -76,11 +76,14 @@ export class DotPropertiesService { getFeatureFlags(keys: FeaturedFlags[]): Observable> { return this.getKeys(keys).pipe( map((flags) => { - return Object.entries(flags).reduce((acc, [key, value]) => { - acc[key] = value === 'true' ? true : value === 'false' ? false : value; + return Object.entries(flags).reduce( + (acc, [key, value]) => { + acc[key] = value === 'true' ? true : value === 'false' ? false : value; - return acc; - }, {} as Record); + return acc; + }, + {} as Record + ); }) ); } diff --git a/core-web/libs/data-access/src/lib/dot-router/dot-router.service.ts b/core-web/libs/data-access/src/lib/dot-router/dot-router.service.ts index f616611f91c8..e22ac95aa28e 100644 --- a/core-web/libs/data-access/src/lib/dot-router/dot-router.service.ts +++ b/core-web/libs/data-access/src/lib/dot-router/dot-router.service.ts @@ -24,7 +24,10 @@ export class DotRouterService { private _routeCanBeDeactivated = new BehaviorSubject(true); private _pageLeaveRequest = new Subject(); - constructor(private router: Router, private route: ActivatedRoute) { + constructor( + private router: Router, + private route: ActivatedRoute + ) { this._routeHistory.url = this.router.url; this.router.events .pipe(filter((event: Event) => event instanceof NavigationEnd)) diff --git a/core-web/libs/data-access/src/lib/dot-upload-file/dot-upload-file.service.ts b/core-web/libs/data-access/src/lib/dot-upload-file/dot-upload-file.service.ts index 856438adf157..59b962a07fcc 100644 --- a/core-web/libs/data-access/src/lib/dot-upload-file/dot-upload-file.service.ts +++ b/core-web/libs/data-access/src/lib/dot-upload-file/dot-upload-file.service.ts @@ -29,7 +29,10 @@ interface PublishContentProps { */ @Injectable() export class DotUploadFileService { - constructor(private http: HttpClient, private dotUploadService: DotUploadService) {} + constructor( + private http: HttpClient, + private dotUploadService: DotUploadService + ) {} publishContent({ data, diff --git a/core-web/libs/data-access/src/lib/dot-workflows-actions/dot-workflows-actions.service.ts b/core-web/libs/data-access/src/lib/dot-workflows-actions/dot-workflows-actions.service.ts index 9593bf040545..f873623ac7dd 100644 --- a/core-web/libs/data-access/src/lib/dot-workflows-actions/dot-workflows-actions.service.ts +++ b/core-web/libs/data-access/src/lib/dot-workflows-actions/dot-workflows-actions.service.ts @@ -59,9 +59,9 @@ export class DotWorkflowsActionsService { */ getDefaultActions(contentTypeId: string): Observable { return this.httpClient - .get>( - `${this.BASE_URL}/initialactions/contenttype/${contentTypeId}` - ) + .get< + DotCMSResponse<{ action: DotCMSWorkflowAction; scheme: DotCMSWorkflow }[]> + >(`${this.BASE_URL}/initialactions/contenttype/${contentTypeId}`) .pipe( pluck('entity'), map((res = []) => { diff --git a/core-web/libs/dot-layout-grid/src/lib/NgGrid.css b/core-web/libs/dot-layout-grid/src/lib/NgGrid.css index ff5d02feb6cf..6f50fbbc8951 100755 --- a/core-web/libs/dot-layout-grid/src/lib/NgGrid.css +++ b/core-web/libs/dot-layout-grid/src/lib/NgGrid.css @@ -6,10 +6,22 @@ .grid-item { background-color: #ffffff; - -webkit-transition: width 0.25s, height 0.25s, transform 0.5s; - -moz-transition: width 0.25s, height 0.25s, transform 0.5s; - -o-transition: width 0.25s, height 0.25s, transform 0.5s; - transition: width 0.25s, height 0.25s, transform 0.5s; + -webkit-transition: + width 0.25s, + height 0.25s, + transform 0.5s; + -moz-transition: + width 0.25s, + height 0.25s, + transform 0.5s; + -o-transition: + width 0.25s, + height 0.25s, + transform 0.5s; + transition: + width 0.25s, + height 0.25s, + transform 0.5s; overflow: hidden; } diff --git a/core-web/libs/dot-rules/src/lib/services/GoogleMapService.ts b/core-web/libs/dot-rules/src/lib/services/GoogleMapService.ts index 61a121c11a7f..139afdf2c1db 100644 --- a/core-web/libs/dot-rules/src/lib/services/GoogleMapService.ts +++ b/core-web/libs/dot-rules/src/lib/services/GoogleMapService.ts @@ -19,7 +19,10 @@ window['mapsApiReady'] = () => { export class GoogleMapService { mapsApi$: BehaviorSubject<{ ready: boolean; error?: any }>; private destroy$ = new Subject(); - constructor(private siteService: SiteService, private dotSiteService: DotSiteService) { + constructor( + private siteService: SiteService, + private dotSiteService: DotSiteService + ) { this.loadApi(this.siteService.currentSite.identifier).subscribe(); this.mapsApi$ = window['mapsApi$']; this.mapsApi$.subscribe(); diff --git a/core-web/libs/dotcms-js/src/lib/core/dotcms-config.service.ts b/core-web/libs/dotcms-js/src/lib/core/dotcms-config.service.ts index 9c7e78ee6736..741631bd5698 100644 --- a/core-web/libs/dotcms-js/src/lib/core/dotcms-config.service.ts +++ b/core-web/libs/dotcms-js/src/lib/core/dotcms-config.service.ts @@ -71,7 +71,10 @@ export class DotcmsConfigService { * * @param configParams - The configuration properties for the current instance. */ - constructor(private coreWebService: CoreWebService, private loggerService: LoggerService) { + constructor( + private coreWebService: CoreWebService, + private loggerService: LoggerService + ) { this.configUrl = 'v1/appconfiguration'; this.loadConfig(); } diff --git a/core-web/libs/dotcms-js/src/lib/core/dotcms-events.service.ts b/core-web/libs/dotcms-js/src/lib/core/dotcms-events.service.ts index ceebf97228b7..825a40324251 100644 --- a/core-web/libs/dotcms-js/src/lib/core/dotcms-events.service.ts +++ b/core-web/libs/dotcms-js/src/lib/core/dotcms-events.service.ts @@ -14,7 +14,10 @@ export class DotcmsEventsService { private subjects = []; private messagesSub: Subscription; - constructor(private dotEventsSocket: DotEventsSocket, private loggerService: LoggerService) {} + constructor( + private dotEventsSocket: DotEventsSocket, + private loggerService: LoggerService + ) {} /** * Close the socket diff --git a/core-web/libs/dotcms-js/src/lib/core/util/models/dot-event-socket-url.ts b/core-web/libs/dotcms-js/src/lib/core/util/models/dot-event-socket-url.ts index 188a21b2834e..9bcdb02e873d 100644 --- a/core-web/libs/dotcms-js/src/lib/core/util/models/dot-event-socket-url.ts +++ b/core-web/libs/dotcms-js/src/lib/core/util/models/dot-event-socket-url.ts @@ -4,7 +4,10 @@ * @export */ export class DotEventsSocketURL { - constructor(private url: string, private useSSL: boolean) {} + constructor( + private url: string, + private useSSL: boolean + ) {} /** * Return the web socket url to connect with the Event end point diff --git a/core-web/libs/dotcms-scss/angular/_mixins.scss b/core-web/libs/dotcms-scss/angular/_mixins.scss index fabb3a0ce922..c1e148b15563 100644 --- a/core-web/libs/dotcms-scss/angular/_mixins.scss +++ b/core-web/libs/dotcms-scss/angular/_mixins.scss @@ -22,15 +22,25 @@ @mixin box_shadow($level) { @if $level == 1 { - box-shadow: 0 1px 3px $color-palette-black-op-10, 0 1px 2px $color-palette-black-op-20; + box-shadow: + 0 1px 3px $color-palette-black-op-10, + 0 1px 2px $color-palette-black-op-20; } @else if $level == 2 { - box-shadow: 0 3px 6px $color-palette-black-op-10, 0 3px 6px $color-palette-black-op-20; + box-shadow: + 0 3px 6px $color-palette-black-op-10, + 0 3px 6px $color-palette-black-op-20; } @else if $level == 3 { - box-shadow: 0 10px 20px $color-palette-black-op-20, 0 6px 6px $color-palette-black-op-20; + box-shadow: + 0 10px 20px $color-palette-black-op-20, + 0 6px 6px $color-palette-black-op-20; } @else if $level == 4 { - box-shadow: 0 14px 28px $color-palette-black-op-20, 0 10px 10px $color-palette-black-op-20; + box-shadow: + 0 14px 28px $color-palette-black-op-20, + 0 10px 10px $color-palette-black-op-20; } @else if $level == 5 { - box-shadow: 0 19px 38px $color-palette-black-op-30, 0 15px 12px $color-palette-black-op-20; + box-shadow: + 0 19px 38px $color-palette-black-op-30, + 0 15px 12px $color-palette-black-op-20; } } diff --git a/core-web/libs/dotcms-scss/angular/_variables.scss b/core-web/libs/dotcms-scss/angular/_variables.scss index 501037a9b31a..8d5a03a29226 100644 --- a/core-web/libs/dotcms-scss/angular/_variables.scss +++ b/core-web/libs/dotcms-scss/angular/_variables.scss @@ -14,8 +14,11 @@ @use "../shared/mixins" as *; $input-border-color-hover: $color-palette-primary; -$input-inset-shadow: inset 0 0 0 1px $color-palette-primary, inset 0 0 0 1px $color-palette-primary, - inset 0 0 0 1px $color-palette-primary, inset 0 0 0 1px $color-palette-primary; +$input-inset-shadow: + inset 0 0 0 1px $color-palette-primary, + inset 0 0 0 1px $color-palette-primary, + inset 0 0 0 1px $color-palette-primary, + inset 0 0 0 1px $color-palette-primary; $input-border-color: $color-palette-gray-500; $input-border-color-focus: $color-palette-gray-500; $input-bg-color: $color-palette-gray-500; diff --git a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_contextmenu.scss b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_contextmenu.scss index 2ec63f6fc33a..108114d2078d 100644 --- a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_contextmenu.scss +++ b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_contextmenu.scss @@ -5,7 +5,9 @@ background: $white; color: $black; border: 0 none; - box-shadow: 0 2px 4px -1px $color-palette-black-op-20, 0 4px 5px 0 $color-palette-black-op-10, + box-shadow: + 0 2px 4px -1px $color-palette-black-op-20, + 0 4px 5px 0 $color-palette-black-op-10, 0 1px 10px 0 $color-palette-black-op-10; width: 12.5rem; } @@ -57,7 +59,9 @@ padding: $spacing-1 0; background: $white; border: 0 none; - box-shadow: 0 2px 4px -1px $color-palette-black-op-20, 0 4px 5px 0 $color-palette-black-op-10, + box-shadow: + 0 2px 4px -1px $color-palette-black-op-20, + 0 4px 5px 0 $color-palette-black-op-10, 0 1px 10px 0 $color-palette-black-op-10; } diff --git a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_datatable.scss b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_datatable.scss index 3eadef2d103f..178526b09711 100644 --- a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_datatable.scss +++ b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_datatable.scss @@ -135,7 +135,10 @@ border: 0 none; background: transparent; border-radius: 50%; - transition: background-color 0.2s, color 0.2s, box-shadow 0.2s; + transition: + background-color 0.2s, + color 0.2s, + box-shadow 0.2s; } .p-datatable .p-datatable-tbody > tr > td .p-row-toggler:enabled:hover, diff --git a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_dialog.scss b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_dialog.scss index 5099b3f8c4b7..469ec123d0cf 100644 --- a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_dialog.scss +++ b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_dialog.scss @@ -2,8 +2,10 @@ .p-dialog { border-radius: $border-radius-md; - box-shadow: 0 11px 15px -7px $color-palette-black-op-20, - 0 24px 38px 3px $color-palette-black-op-10, 0 9px 46px 8px $color-palette-black-op-10; + box-shadow: + 0 11px 15px -7px $color-palette-black-op-20, + 0 24px 38px 3px $color-palette-black-op-10, + 0 9px 46px 8px $color-palette-black-op-10; border: 0 none; overflow: auto; } @@ -29,7 +31,10 @@ border: 0 none; background: transparent; border-radius: 50%; - transition: background-color 0.2s, color 0.2s, box-shadow 0.2s; + transition: + background-color 0.2s, + color 0.2s, + box-shadow 0.2s; margin-right: $spacing-1; } diff --git a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_galleria.scss b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_galleria.scss index 69d14238d058..ae197563f903 100644 --- a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_galleria.scss +++ b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_galleria.scss @@ -7,7 +7,10 @@ color: $color-palette-gray-800; width: $spacing-6; height: $spacing-6; - transition: background-color $basic-speed, color $basic-speed, box-shadow $basic-speed; + transition: + background-color $basic-speed, + color $basic-speed, + box-shadow $basic-speed; border-radius: $border-radius-circular; margin: -$spacing-3 $spacing-1 0; z-index: 1; diff --git a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_image.scss b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_image.scss index 56d2a91d5c70..1ffafbaa9afa 100644 --- a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_image.scss +++ b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_image.scss @@ -27,7 +27,10 @@ width: 3rem; height: 3rem; border-radius: $border-radius-circular; - transition: background-color $basic-speed, color $basic-speed, box-shadow $basic-speed; + transition: + background-color $basic-speed, + color $basic-speed, + box-shadow $basic-speed; margin-right: $spacing-1; &:last-child { diff --git a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_inplace.scss b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_inplace.scss index fa5e90a239e6..749f7ee9648d 100644 --- a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_inplace.scss +++ b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_inplace.scss @@ -3,7 +3,11 @@ .p-inplace .p-inplace-display { padding: $spacing-3 $spacing-3; border-radius: $border-radius-xs; - transition: background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s, + transition: + background-color 0.2s, + border-color 0.2s, + color 0.2s, + box-shadow 0.2s, background-size 0.2s cubic-bezier(0.64, 0.09, 0.08, 1); } diff --git a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_overlaypanel.scss b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_overlaypanel.scss index f5d531a7f4a6..cd711d017716 100644 --- a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_overlaypanel.scss +++ b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_overlaypanel.scss @@ -17,7 +17,10 @@ color: $white; width: $spacing-5; height: $spacing-5; - transition: background-color 0.2s, color 0.2s, box-shadow 0.2s; + transition: + background-color 0.2s, + color 0.2s, + box-shadow 0.2s; border-radius: 50%; position: absolute; top: -$spacing-3; diff --git a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_sidebar.scss b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_sidebar.scss index b232cabc5f3b..527dcf22e57c 100644 --- a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_sidebar.scss +++ b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_sidebar.scss @@ -15,7 +15,10 @@ border: 0 none; background: transparent; border-radius: 50%; - transition: background-color 0.2s, color 0.2s, box-shadow 0.2s; + transition: + background-color 0.2s, + color 0.2s, + box-shadow 0.2s; } .p-sidebar .p-sidebar-header .p-sidebar-close:enabled:hover, .p-sidebar .p-sidebar-header .p-sidebar-icon:enabled:hover { diff --git a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_table.scss b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_table.scss index 01d46795b7c7..8eff51c7526c 100644 --- a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_table.scss +++ b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_table.scss @@ -187,7 +187,10 @@ $dot-table-cell-height: 1.25rem; border: 0 none; background: transparent; border-radius: 50%; - transition: background-color 0.2s, color 0.2s, box-shadow 0.2s; + transition: + background-color 0.2s, + color 0.2s, + box-shadow 0.2s; &:enabled:hover { color: $text-color-hover; diff --git a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_tree.scss b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_tree.scss index a3eedd4f615e..88d2b1441297 100644 --- a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_tree.scss +++ b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/_tree.scss @@ -26,7 +26,10 @@ border: 0 none; background: transparent; border-radius: 50%; - transition: background-color 0.2s, color 0.2s, box-shadow 0.2s; + transition: + background-color 0.2s, + color 0.2s, + box-shadow 0.2s; } .p-tree .p-tree-container .p-treenode .p-treenode-content .p-tree-toggler:enabled:hover { diff --git a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/form/_inputswitch.scss b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/form/_inputswitch.scss index fa64b14d971f..56caaf9be370 100644 --- a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/form/_inputswitch.scss +++ b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/form/_inputswitch.scss @@ -8,7 +8,11 @@ .p-inputswitch .p-inputswitch-slider { background: $input-bg-color; - transition: background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s, + transition: + background-color 0.2s, + border-color 0.2s, + color 0.2s, + box-shadow 0.2s, background-size 0.2s cubic-bezier(0.64, 0.09, 0.08, 1); border-radius: $spacing-1; } @@ -22,8 +26,10 @@ border-radius: 50%; transition-duration: 0.2s; transition-property: box-shadow transform; - box-shadow: 0px 3px 1px -2px $color-palette-black-op-20, - 0px 2px 2px 0px $color-palette-black-op-10, 0px 1px 5px 0px $color-palette-black-op-10; + box-shadow: + 0px 3px 1px -2px $color-palette-black-op-20, + 0px 2px 2px 0px $color-palette-black-op-10, + 0px 1px 5px 0px $color-palette-black-op-10; } .p-inputswitch.p-inputswitch-checked .p-inputswitch-slider:before { @@ -50,25 +56,36 @@ } .p-inputswitch:not(.p-disabled):hover .p-inputswitch-slider:before { - box-shadow: 0px 3px 1px -2px $color-palette-black-op-20, - 0px 2px 2px 0px $color-palette-black-op-10, 0px 1px 5px 0px $color-palette-black-op-10, + box-shadow: + 0px 3px 1px -2px $color-palette-black-op-20, + 0px 2px 2px 0px $color-palette-black-op-10, + 0px 1px 5px 0px $color-palette-black-op-10, 0 0 1px 10px rgba(0, 0, 0, 0.04); } .p-inputswitch.p-inputswitch-focus .p-inputswitch-slider:before, .p-inputswitch.p-inputswitch-focus:not(.p-disabled):hover .p-inputswitch-slider:before { - box-shadow: 0 0 1px 10px $color-palette-black-op-10, 0px 3px 1px -2px $color-palette-black-op-20, - 0px 2px 2px 0px $color-palette-black-op-10, 0px 1px 5px 0px $color-palette-black-op-10; + box-shadow: + 0 0 1px 10px $color-palette-black-op-10, + 0px 3px 1px -2px $color-palette-black-op-20, + 0px 2px 2px 0px $color-palette-black-op-10, + 0px 1px 5px 0px $color-palette-black-op-10; } .p-inputswitch.p-inputswitch-checked:not(.p-disabled):hover .p-inputswitch-slider:before { - box-shadow: 0 0 1px 10px rgba(63, 81, 181, 0.04), 0px 3px 1px -2px $color-palette-black-op-20, - 0px 2px 2px 0px $color-palette-black-op-10, 0px 1px 5px 0px $color-palette-black-op-10; + box-shadow: + 0 0 1px 10px rgba(63, 81, 181, 0.04), + 0px 3px 1px -2px $color-palette-black-op-20, + 0px 2px 2px 0px $color-palette-black-op-10, + 0px 1px 5px 0px $color-palette-black-op-10; } .p-inputswitch.p-inputswitch-checked.p-inputswitch-focus .p-inputswitch-slider:before, .p-inputswitch.p-inputswitch-checked.p-inputswitch-focus:not(.p-disabled):hover .p-inputswitch-slider:before { - box-shadow: 0 0 1px 10px rgba(63, 81, 181, 0.12), 0px 3px 1px -2px $color-palette-black-op-20, - 0px 2px 2px 0px $color-palette-black-op-10, 0px 1px 5px 0px $color-palette-black-op-10; + box-shadow: + 0 0 1px 10px rgba(63, 81, 181, 0.12), + 0px 3px 1px -2px $color-palette-black-op-20, + 0px 2px 2px 0px $color-palette-black-op-10, + 0px 1px 5px 0px $color-palette-black-op-10; } diff --git a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/form/_selectbutton.scss b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/form/_selectbutton.scss index 881d1ec45174..3556a8707ce2 100644 --- a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/form/_selectbutton.scss +++ b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/form/_selectbutton.scss @@ -4,7 +4,11 @@ background: transparent; border: 1px solid $input-border-color; color: $color-palette-gray-700; - transition: background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s, + transition: + background-color 0.2s, + border-color 0.2s, + color 0.2s, + box-shadow 0.2s, background-size 0.2s cubic-bezier(0.64, 0.09, 0.08, 1); text-transform: uppercase; } diff --git a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/form/_slider.scss b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/form/_slider.scss index d131e964f8a6..d7acb710a9a9 100644 --- a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/form/_slider.scss +++ b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/form/_slider.scss @@ -1,6 +1,10 @@ @use "variables" as *; -$slider-core-transition: background-color 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s; +$slider-core-transition: + background-color 0.2s, + color 0.2s, + border-color 0.2s, + box-shadow 0.2s; .p-slider { background: $color-palette-gray-300; @@ -43,13 +47,17 @@ $slider-core-transition: background-color 0.2s, color 0.2s, border-color 0.2s, b border-color: $color-palette-primary; } .p-slider.p-slider-animate.p-slider-horizontal .p-slider-handle { - transition: $slider-core-transition, left 0.2s; + transition: + $slider-core-transition, + left 0.2s; } .p-slider.p-slider-animate.p-slider-horizontal .p-slider-range { transition: width 0.2s; } .p-slider.p-slider-animate.p-slider-vertical .p-slider-handle { - transition: $slider-core-transition, bottom 0.2s; + transition: + $slider-core-transition, + bottom 0.2s; } .p-slider.p-slider-animate.p-slider-vertical .p-slider-range { transition: height 0.2s; diff --git a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/form/_treeselect.scss b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/form/_treeselect.scss index 407aebd44228..cc37f81a92e8 100644 --- a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/form/_treeselect.scss +++ b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/form/_treeselect.scss @@ -4,7 +4,10 @@ .p-treeselect { @extend #form-field-base; padding: 0; - transition: background-color $basic-speed, border-color $basic-speed, box-shadow $basic-speed; + transition: + background-color $basic-speed, + border-color $basic-speed, + box-shadow $basic-speed; &:not(.p-disabled) { &:hover { @@ -34,7 +37,9 @@ .p-treeselect-label { padding: $spacing-1 $spacing-2; - transition: background-color $basic-speed, border-color $basic-speed, + transition: + background-color $basic-speed, + border-color $basic-speed, box-shadow $basic-speed; &.p-placeholder { diff --git a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/form/common.scss b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/form/common.scss index 9a90df753fbf..473f495edee7 100644 --- a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/form/common.scss +++ b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/form/common.scss @@ -115,7 +115,9 @@ $select-border-size: 2px; width: $spacing-5; height: $spacing-5; border-radius: $border-radius-circular; - transition: color 0.15s, box-shadow 0.15s; + transition: + color 0.15s, + box-shadow 0.15s; :focus { outline: 0 none; diff --git a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/messages/_message.scss b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/messages/_message.scss index bb639216eda5..27595e09afcd 100644 --- a/core-web/libs/dotcms-scss/angular/dotcms-theme/components/messages/_message.scss +++ b/core-web/libs/dotcms-scss/angular/dotcms-theme/components/messages/_message.scss @@ -63,7 +63,10 @@ height: $spacing-5; border-radius: 50%; background: transparent; - transition: background-color 0.2s, color 0.2s, box-shadow 0.2s; + transition: + background-color 0.2s, + color 0.2s, + box-shadow 0.2s; } .p-message .p-message-close:hover { background: $color-palette-white-op-30; diff --git a/core-web/libs/dotcms-scss/angular/dotcms-theme/utils/_password.scss b/core-web/libs/dotcms-scss/angular/dotcms-theme/utils/_password.scss index cc31fd2a39f7..7b40bb85b4b1 100644 --- a/core-web/libs/dotcms-scss/angular/dotcms-theme/utils/_password.scss +++ b/core-web/libs/dotcms-scss/angular/dotcms-theme/utils/_password.scss @@ -4,7 +4,9 @@ background: $white; color: $black; border: 0 none; - box-shadow: 0 5px 5px -3px $color-palette-black-op-20, 0 8px 10px 1px $color-palette-black-op-10, + box-shadow: + 0 5px 5px -3px $color-palette-black-op-20, + 0 8px 10px 1px $color-palette-black-op-10, 0 3px 14px 2px $color-palette-black-op-10; border-radius: $border-radius-xs; } diff --git a/core-web/libs/dotcms-scss/jsp/css/dotcms.css b/core-web/libs/dotcms-scss/jsp/css/dotcms.css index e4e2deee0dcb..3dd0e7256363 100644 --- a/core-web/libs/dotcms-scss/jsp/css/dotcms.css +++ b/core-web/libs/dotcms-scss/jsp/css/dotcms.css @@ -4,7 +4,8 @@ @font-face { font-family: 'FontAwesome'; src: url('../fonts/fontawesome-webfont.eot?v=4.7.0'); - src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.7.0') format('embedded-opentype'), + src: + url('../fonts/fontawesome-webfont.eot?#iefix&v=4.7.0') format('embedded-opentype'), url('../fonts/fontawesome-webfont.woff2?v=4.7.0') format('woff2'), url('../fonts/fontawesome-webfont.woff?v=4.7.0') format('woff'), url('../fonts/fontawesome-webfont.ttf?v=4.7.0') format('truetype'), @@ -4827,11 +4828,13 @@ .dijitTitlePane { border-radius: 1px; - box-shadow: 0 1px 3px var(--color-palette-black-op-10), + box-shadow: + 0 1px 3px var(--color-palette-black-op-10), 0 1px 2px var(--color-palette-black-op-20); } .dijitTitlePaneHover { - box-shadow: 0 3px 6px var(--color-palette-black-op-10), + box-shadow: + 0 3px 6px var(--color-palette-black-op-10), 0 3px 6px var(--color-palette-black-op-20); } .dijitTitlePaneHover .dijitTitlePaneContentOuter { @@ -4888,7 +4891,8 @@ background-color: #ffffff; border-radius: 0px; border: none; - box-shadow: 0 3px 6px var(--color-palette-black-op-10), + box-shadow: + 0 3px 6px var(--color-palette-black-op-10), 0 3px 6px var(--color-palette-black-op-20); } .dijitDialogCloseIcon { @@ -4943,7 +4947,9 @@ color: #14151a; border: 0 none; border-radius: 0.375rem; - box-shadow: 0px 0px 4px rgba(20, 21, 26, 0.04), 0px 8px 16px rgba(20, 21, 26, 0.08); + box-shadow: + 0px 0px 4px rgba(20, 21, 26, 0.04), + 0px 8px 16px rgba(20, 21, 26, 0.08); padding: 0.5rem; margin-top: 0.5rem; } @@ -5522,7 +5528,9 @@ color: #14151a; border: 0 none; border-radius: 0.375rem; - box-shadow: 0px 0px 4px rgba(20, 21, 26, 0.04), 0px 8px 16px rgba(20, 21, 26, 0.08); + box-shadow: + 0px 0px 4px rgba(20, 21, 26, 0.04), + 0px 8px 16px rgba(20, 21, 26, 0.08); padding: 0.5rem; margin-top: 0.5rem; } @@ -6552,7 +6560,9 @@ select[multiple]:hover { } .tailerBody { - font-family: Andale Mono, monospace; + font-family: + Andale Mono, + monospace; font-size: 9pt; white-space: nowrap; } @@ -10910,7 +10920,8 @@ a.tag_higlighted { } .context-menu { - box-shadow: 0 3px 6px var(--color-palette-black-op-10), + box-shadow: + 0 3px 6px var(--color-palette-black-op-10), 0 3px 6px var(--color-palette-black-op-20); position: absolute; background: #ffffff; @@ -11061,7 +11072,8 @@ a.tag_higlighted { } .file-selector-tree__card { - box-shadow: 0 1px 3px var(--color-palette-black-op-10), + box-shadow: + 0 1px 3px var(--color-palette-black-op-10), 0 1px 2px var(--color-palette-black-op-20); cursor: pointer; display: flex; @@ -11072,7 +11084,8 @@ a.tag_higlighted { margin: 0.25rem; } .file-selector-tree__card:hover { - box-shadow: 0 3px 6px var(--color-palette-black-op-10), + box-shadow: + 0 3px 6px var(--color-palette-black-op-10), 0 3px 6px var(--color-palette-black-op-20); } .file-selector-tree__card .thumbnail { @@ -11640,7 +11653,9 @@ Resize Handle padding: 2px 6px 2px 4px; text-decoration: none; text-transform: uppercase; - transition: background-color 150ms ease, color 150ms ease; + transition: + background-color 150ms ease, + color 150ms ease; } .api-link:hover { background-color: var(--color-palette-secondary-500); @@ -11697,7 +11712,9 @@ Resize Handle font-style: normal; font-weight: 400; font-display: swap; - src: local(''), url('/dotAdmin/assets/Assistant-Regular.woff2') format('woff2'), + src: + local(''), + url('/dotAdmin/assets/Assistant-Regular.woff2') format('woff2'), url('/dotAdmin/assets/Assistant-Regular.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */ } @font-face { @@ -11705,7 +11722,9 @@ Resize Handle font-style: normal; font-weight: 500; font-display: swap; - src: local(''), url('/dotAdmin/assets/Assistant-SemiBold.woff2') format('woff2'), + src: + local(''), + url('/dotAdmin/assets/Assistant-SemiBold.woff2') format('woff2'), url('/dotAdmin/assets/Assistant-SemiBold.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */ } @font-face { @@ -11713,7 +11732,9 @@ Resize Handle font-style: normal; font-weight: 700; font-display: swap; - src: local(''), url('/dotAdmin/assets/Assistant-Bold.woff2') format('woff2'), + src: + local(''), + url('/dotAdmin/assets/Assistant-Bold.woff2') format('woff2'), url('/dotAdmin/assets/Assistant-Bold.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */ } @font-face { diff --git a/core-web/libs/dotcms-scss/jsp/scss/backend/dot-admin/_common.scss b/core-web/libs/dotcms-scss/jsp/scss/backend/dot-admin/_common.scss index 2b4b6f432aec..191004c0d1b4 100644 --- a/core-web/libs/dotcms-scss/jsp/scss/backend/dot-admin/_common.scss +++ b/core-web/libs/dotcms-scss/jsp/scss/backend/dot-admin/_common.scss @@ -35,7 +35,9 @@ padding: 2px 6px 2px 4px; text-decoration: none; text-transform: uppercase; - transition: background-color 150ms ease, color 150ms ease; + transition: + background-color 150ms ease, + color 150ms ease; &:hover { background-color: $color-palette-secondary-500; diff --git a/core-web/libs/dotcms-scss/jsp/scss/backend/dot-admin/_dot-admin.scss b/core-web/libs/dotcms-scss/jsp/scss/backend/dot-admin/_dot-admin.scss index 0e567d466520..af6fcfc888e6 100644 --- a/core-web/libs/dotcms-scss/jsp/scss/backend/dot-admin/_dot-admin.scss +++ b/core-web/libs/dotcms-scss/jsp/scss/backend/dot-admin/_dot-admin.scss @@ -88,7 +88,9 @@ z-index: -1; } .tailerBody { - font-family: Andale Mono, monospace; + font-family: + Andale Mono, + monospace; font-size: 9pt; white-space: nowrap; } diff --git a/core-web/libs/dotcms-scss/jsp/scss/backend/dot-admin/components/_file-selector-tree.scss b/core-web/libs/dotcms-scss/jsp/scss/backend/dot-admin/components/_file-selector-tree.scss index 3918ca46fd38..895e02166953 100644 --- a/core-web/libs/dotcms-scss/jsp/scss/backend/dot-admin/components/_file-selector-tree.scss +++ b/core-web/libs/dotcms-scss/jsp/scss/backend/dot-admin/components/_file-selector-tree.scss @@ -120,7 +120,9 @@ } .file-selector-tree__card { - box-shadow: 0 1px 3px $color-palette-black-op-10, 0 1px 2px $color-palette-black-op-20; + box-shadow: + 0 1px 3px $color-palette-black-op-10, + 0 1px 2px $color-palette-black-op-20; cursor: pointer; display: flex; flex-direction: column; @@ -130,7 +132,9 @@ margin: 0.25rem; &:hover { - box-shadow: 0 3px 6px $color-palette-black-op-10, 0 3px 6px $color-palette-black-op-20; + box-shadow: + 0 3px 6px $color-palette-black-op-10, + 0 3px 6px $color-palette-black-op-20; } .thumbnail { diff --git a/core-web/libs/dotcms-scss/jsp/scss/font-awesome-4.7.0/_path.scss b/core-web/libs/dotcms-scss/jsp/scss/font-awesome-4.7.0/_path.scss index c58e2f8ec24d..96857f456c64 100644 --- a/core-web/libs/dotcms-scss/jsp/scss/font-awesome-4.7.0/_path.scss +++ b/core-web/libs/dotcms-scss/jsp/scss/font-awesome-4.7.0/_path.scss @@ -4,7 +4,8 @@ @font-face { font-family: "FontAwesome"; src: url("#{$fa-font-path}/fontawesome-webfont.eot?v=#{$fa-version}"); - src: url("#{$fa-font-path}/fontawesome-webfont.eot?#iefix&v=#{$fa-version}") + src: + url("#{$fa-font-path}/fontawesome-webfont.eot?#iefix&v=#{$fa-version}") format("embedded-opentype"), url("#{$fa-font-path}/fontawesome-webfont.woff2?v=#{$fa-version}") format("woff2"), url("#{$fa-font-path}/fontawesome-webfont.woff?v=#{$fa-version}") format("woff"), diff --git a/core-web/libs/dotcms-scss/shared/_mixins.scss b/core-web/libs/dotcms-scss/shared/_mixins.scss index 5851afd9cc8e..472c07f653fe 100644 --- a/core-web/libs/dotcms-scss/shared/_mixins.scss +++ b/core-web/libs/dotcms-scss/shared/_mixins.scss @@ -4,7 +4,9 @@ font-style: normal; font-weight: $weight; font-display: swap; - src: local(""), url("/dotAdmin/assets/Assistant-#{$font-filename}.woff2") format("woff2"), + src: + local(""), + url("/dotAdmin/assets/Assistant-#{$font-filename}.woff2") format("woff2"), /* Chrome 26+, Opera 23+, Firefox 39+ */ url("/dotAdmin/assets/Assistant-#{$font-filename}.woff") format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */ } @@ -16,7 +18,9 @@ font-style: normal; font-weight: $weight; font-display: swap; - src: local(""), url("/dotAdmin/assets/RedHatMono-#{$font-filename}.woff2") format("woff2"), + src: + local(""), + url("/dotAdmin/assets/RedHatMono-#{$font-filename}.woff2") format("woff2"), /* Chrome 26+, Opera 23+, Firefox 39+ */ url("/dotAdmin/assets/RedHatMono-#{$font-filename}.woff") format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */ } diff --git a/core-web/libs/portlets/dot-experiments/portlet/src/lib/dot-experiments-configuration/store/dot-experiments-configuration-store.ts b/core-web/libs/portlets/dot-experiments/portlet/src/lib/dot-experiments-configuration/store/dot-experiments-configuration-store.ts index 28c6cff09904..663059585a99 100644 --- a/core-web/libs/portlets/dot-experiments/portlet/src/lib/dot-experiments-configuration/store/dot-experiments-configuration-store.ts +++ b/core-web/libs/portlets/dot-experiments/portlet/src/lib/dot-experiments-configuration/store/dot-experiments-configuration-store.ts @@ -1015,8 +1015,8 @@ export class DotExperimentsConfigurationStore extends ComponentStore = this.select(({ results }) => - BayesianNoWinnerStatus.includes(results?.bayesianResult?.suggestedWinner) - ? null - : results?.goals.primary.variants[results?.bayesianResult?.suggestedWinner] + readonly getSuggestedWinner$: Observable = this.select( + ({ results }) => + BayesianNoWinnerStatus.includes(results?.bayesianResult?.suggestedWinner) + ? null + : results?.goals.primary.variants[results?.bayesianResult?.suggestedWinner] ); readonly getPromotedVariant$: Observable = this.select(({ experiment }) => diff --git a/core-web/libs/template-builder/src/lib/components/template-builder/components/template-builder-box/template-builder-box.component.ts b/core-web/libs/template-builder/src/lib/components/template-builder/components/template-builder-box/template-builder-box.component.ts index f430c3f91e5f..3d83ef654a70 100644 --- a/core-web/libs/template-builder/src/lib/components/template-builder/components/template-builder-box/template-builder-box.component.ts +++ b/core-web/libs/template-builder/src/lib/components/template-builder/components/template-builder-box/template-builder-box.component.ts @@ -66,7 +66,10 @@ export class TemplateBuilderBoxComponent implements OnChanges { formControl = new FormControl(null); // used to programmatically set dropdown value, so that the same value can be selected twice consecutively protected readonly templateBuilderSizes = TemplateBuilderBoxSize; - constructor(private el: ElementRef, private dotMessage: DotMessageService) {} + constructor( + private el: ElementRef, + private dotMessage: DotMessageService + ) {} private _dropdownLabel: string | null = null; diff --git a/core-web/libs/ui/src/lib/components/dot-binary-option-selector/dot-binary-option-selector.component.scss b/core-web/libs/ui/src/lib/components/dot-binary-option-selector/dot-binary-option-selector.component.scss index a623703240d5..051b55e502c8 100644 --- a/core-web/libs/ui/src/lib/components/dot-binary-option-selector/dot-binary-option-selector.component.scss +++ b/core-web/libs/ui/src/lib/components/dot-binary-option-selector/dot-binary-option-selector.component.scss @@ -37,7 +37,9 @@ p { width: 145px; height: 145px; gap: $spacing-2; - transition: border-color $basic-speed ease, color $basic-speed ease; + transition: + border-color $basic-speed ease, + color $basic-speed ease; &:hover { color: $color-palette-gray-700; diff --git a/core-web/libs/ui/src/lib/components/dot-form-dialog/dot-form-dialog.component.ts b/core-web/libs/ui/src/lib/components/dot-form-dialog/dot-form-dialog.component.ts index 36299a7e87cf..a1caaee93823 100644 --- a/core-web/libs/ui/src/lib/components/dot-form-dialog/dot-form-dialog.component.ts +++ b/core-web/libs/ui/src/lib/components/dot-form-dialog/dot-form-dialog.component.ts @@ -42,7 +42,10 @@ export class DotFormDialogComponent implements OnInit, OnDestroy { @Output() cancel: EventEmitter = new EventEmitter(null); - constructor(private dynamicDialog: DynamicDialogRef, private el: ElementRef) {} + constructor( + private dynamicDialog: DynamicDialogRef, + private el: ElementRef + ) {} ngOnInit(): void { const content = document.querySelector('p-dynamicdialog .p-dialog-content'); diff --git a/core-web/libs/ui/src/lib/directives/dot-avatar/dot-avatar.directive.ts b/core-web/libs/ui/src/lib/directives/dot-avatar/dot-avatar.directive.ts index 61637e229eb6..2966798c429f 100644 --- a/core-web/libs/ui/src/lib/directives/dot-avatar/dot-avatar.directive.ts +++ b/core-web/libs/ui/src/lib/directives/dot-avatar/dot-avatar.directive.ts @@ -9,7 +9,10 @@ import { Avatar } from 'primeng/avatar'; export class DotAvatarDirective implements OnInit { @Input() text = 'Default'; - constructor(private avatar: Avatar, private cd: ChangeDetectorRef) { + constructor( + private avatar: Avatar, + private cd: ChangeDetectorRef + ) { this.avatar.shape = 'circle'; } From 860c52d9715508025599d648b68e8be03d8f91da Mon Sep 17 00:00:00 2001 From: Nicolas Molina Date: Mon, 10 Jun 2024 15:40:28 -0400 Subject: [PATCH 24/24] save --- core-web/yarn.lock | 72 ++++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 37 deletions(-) diff --git a/core-web/yarn.lock b/core-web/yarn.lock index a7796160ee37..3afd120a04fa 100644 --- a/core-web/yarn.lock +++ b/core-web/yarn.lock @@ -14059,7 +14059,7 @@ import-local@^3.0.2: pkg-dir "^4.2.0" resolve-cwd "^3.0.0" -imurmurhash@*, imurmurhash@^0.1.4: +imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA== @@ -16180,11 +16180,6 @@ lodash-es@^4.17.21: resolved "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee" integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw== -lodash._baseindexof@*: - version "3.1.0" - resolved "https://registry.npmjs.org/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz#fe52b53a1c6761e42618d654e4a25789ed61822c" - integrity sha512-bSYo8Pc/f0qAkr8fPJydpJjtrHiSynYfYBjtANIgXv5xEf1WlTC63dIDlgu0s9dmTvzRu1+JJTxcIAHe+sH0FQ== - lodash._baseuniq@~4.6.0: version "4.6.0" resolved "https://registry.npmjs.org/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz#0ebb44e456814af7905c6212fa2c9b2d51b841e8" @@ -16193,33 +16188,11 @@ lodash._baseuniq@~4.6.0: lodash._createset "~4.0.0" lodash._root "~3.0.0" -lodash._bindcallback@*: - version "3.0.1" - resolved "https://registry.npmjs.org/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e" - integrity sha512-2wlI0JRAGX8WEf4Gm1p/mv/SZ+jLijpj0jyaE/AXeuQphzCgD8ZQW4oSpoN8JAopujOFGU3KMuq7qfHBWlGpjQ== - -lodash._cacheindexof@*: - version "3.0.2" - resolved "https://registry.npmjs.org/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz#3dc69ac82498d2ee5e3ce56091bafd2adc7bde92" - integrity sha512-S8dUjWr7SUT/X6TBIQ/OYoCHo1Stu1ZRy6uMUSKqzFnZp5G5RyQizSm6kvxD2Ewyy6AVfMg4AToeZzKfF99T5w== - -lodash._createcache@*: - version "3.1.2" - resolved "https://registry.npmjs.org/lodash._createcache/-/lodash._createcache-3.1.2.tgz#56d6a064017625e79ebca6b8018e17440bdcf093" - integrity sha512-ev5SP+iFpZOugyab/DEUQxUeZP5qyciVTlgQ1f4Vlw7VUcCD8fVnyIqVUEIaoFH9zjAqdgi69KiofzvVmda/ZQ== - dependencies: - lodash._getnative "^3.0.0" - lodash._createset@~4.0.0: version "4.0.3" resolved "https://registry.npmjs.org/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26" integrity sha512-GTkC6YMprrJZCYU3zcqZj+jkXkrXzq3IPBcF/fIPpNEAB4hZEtXU8zp/RwKOvZl43NUmwDbyRk3+ZTbeRdEBXA== -lodash._getnative@*, lodash._getnative@^3.0.0: - version "3.9.1" - resolved "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" - integrity sha512-RrL9VxMEPyDMHOd9uFbvMe8X55X16/cGM5IgOKgRElQZutpX89iS6vwl64duTV1/16w5JY7tuFNXqoekmh1EmA== - lodash._root@~3.0.0: version "3.0.1" resolved "https://registry.npmjs.org/lodash._root/-/lodash._root-3.0.1.tgz#fba1c4524c19ee9a5f8136b4609f017cf4ded692" @@ -16295,11 +16268,6 @@ lodash.once@^4.0.0, lodash.once@^4.1.1: resolved "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz#0dd3971213c7c56df880977d504c88fb471a97ac" integrity sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg== -lodash.restparam@*: - version "3.6.1" - resolved "https://registry.npmjs.org/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805" - integrity sha512-L4/arjjuq4noiUJpt3yS6KIKDtJwNe2fIYgMqyYYKoeIfV1iEqvPwhCx23o+R9dzouGihDAPN1dTIRWa7zk8tw== - lodash.sortby@^4.7.0: version "4.7.0" resolved "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" @@ -19808,7 +19776,7 @@ prepend-http@^1.0.1: resolved "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc" integrity sha512-PhmXi5XmoyKw1Un4E+opM2KcsJInDvKyuOumcjjw3waw86ZNjHwVUOOWLc4bCzLdcKNaWBH9e99sbWzDQsVaYg== -"prettier-fallback@npm:prettier@^3", prettier@^3.3.1: +"prettier-fallback@npm:prettier@^3": version "3.3.1" resolved "https://registry.npmjs.org/prettier/-/prettier-3.3.1.tgz#e68935518dd90bb7ec4821ba970e68f8de16e1ac" integrity sha512-7CAwy5dRsxs8PHXT3twixW9/OEll8MLE0VRPCJyl7CkS6VHGPSlsVaWTiASPTyGyYRyApxlaWTzwUxVNrhcwDg== @@ -19823,6 +19791,11 @@ prettier@^2.8.0: resolved "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== +prettier@^3.3.1: + version "3.3.1" + resolved "https://registry.npmjs.org/prettier/-/prettier-3.3.1.tgz#e68935518dd90bb7ec4821ba970e68f8de16e1ac" + integrity sha512-7CAwy5dRsxs8PHXT3twixW9/OEll8MLE0VRPCJyl7CkS6VHGPSlsVaWTiASPTyGyYRyApxlaWTzwUxVNrhcwDg== + pretty-bytes@^5.4.1: version "5.6.0" resolved "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz#356256f643804773c82f64723fe78c92c62beaeb" @@ -22035,7 +22008,7 @@ string-length@^4.0.1: char-regex "^1.0.2" strip-ansi "^6.0.0" -"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0": version "4.2.3" resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -22053,6 +22026,15 @@ string-width@^1.0.1: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" +"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + string-width@^2.0.0, string-width@^2.1.1: version "2.1.1" resolved "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" @@ -22149,7 +22131,7 @@ stringify-package@^1.0.0, stringify-package@^1.0.1: resolved "https://registry.npmjs.org/stringify-package/-/stringify-package-1.0.1.tgz#e5aa3643e7f74d0f28628b72f3dad5cecfc3ba85" integrity sha512-sa4DUQsYciMP1xhKWGuFM04fB0LG/9DlluZoSVywUMRNvzid6XucHK0/90xGxRoHrAaROrcHK1aPKaijCtSrhg== -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": version "6.0.1" resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -22177,6 +22159,13 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-ansi@^7.0.1: version "7.1.0" resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" @@ -24192,7 +24181,7 @@ worker-farm@^1.6.0, worker-farm@^1.7.0: dependencies: errno "~0.1.7" -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -24227,6 +24216,15 @@ wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"