diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index c47306639f5d..8779e9e347b8 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -27,7 +27,7 @@ jobs: runs-on: ubuntu-20.04 name: SonarQube steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - uses: sonarsource/sonarqube-scan-action@master diff --git a/.github/workflows/release-process.yml b/.github/workflows/release-process.yml index 0e0bef1d2495..61d85b849fd7 100644 --- a/.github/workflows/release-process.yml +++ b/.github/workflows/release-process.yml @@ -67,9 +67,6 @@ jobs: steps: - name: Checkout core uses: actions/checkout@v3 - with: - token: ${{ secrets.CICD_GITHUB_TOKEN }} - submodules: recursively - name: Set Common Vars run: | if [[ "${{ github.event_name }}" == "pull_request" ]]; then @@ -90,6 +87,7 @@ jobs: RELEASE_NAME="${{ github.event.release.name }}" if [[ -n "${RELEASE_NAME}" && "${RELEASE_NAME^^}" =~ [[:blank:]].?LTS$ ]]; then + IS_LTS=true RELEASE_LABEL=lts fi if [[ "${IS_RELEASE}" == 'true' && "${IS_LTS}" != 'true' ]]; then diff --git a/.prettierignore b/.prettierignore index c281736db338..d3e92553e7c1 100644 --- a/.prettierignore +++ b/.prettierignore @@ -19,5 +19,6 @@ core-web/.storybook core-web/karma_html core-web/docs core-web/.angular -core-web/*.md +core-web/**/*.md +core-web/**/*.d.ts core-web/decorate-angular-cli.js diff --git a/core-web/README.MD b/core-web/README.MD index e32186502e29..138f41db0105 100644 --- a/core-web/README.MD +++ b/core-web/README.MD @@ -1,21 +1,22 @@ -[![Publish to NPM](https://github.com/dotCMS/core-web/actions/workflows/publish.yml/badge.svg)](https://github.com/dotCMS/core-web/actions/workflows/publish.yml) -[![DotCMS/core-web Tests](https://github.com/dotCMS/core-web/actions/workflows/main.yml/badge.svg)](https://github.com/dotCMS/core-web/actions/workflows/main.yml) - # DotCMS Frontend -This repository contains the frontend infrastructure for the DotCMS admin system, includes the main app and all the internal libraries. +This folder contains the frontend infrastructure for the DotCMS admin system, includes the main app and all the internal libraries. ## Content -| Name | Type | Location | Build with | Description | -| -------------------------------------------------------------------------------------------------- | ---- | ---------------------------- | ---------- | -------------------------------------------- | -| [dotcms-ui](https://github.com/dotCMS/core-web/tree/master/apps/dotcms-ui) | app | `apps/dotcms-ui` | Angular | Main UI application | -| [dotcms](https://github.com/dotCMS/core-web/tree/master/libs/dotcms) | lib | `libs/dotcms` | Typescript | JavaScript SDK for DotCMS API's | -| [dot-layout-grid](https://github.com/dotCMS/core-web/tree/master/libs/dot-layout-grid) | lib | `libs/dot-layout-grid` | Angular | Components for layout editor | -| [dot-rules](https://github.com/dotCMS/core-web/tree/master/libs/dot-rules) | lib | `libs/dot-rules` | Angular | Components and services for rules | -| [dotcms-field-elements](https://github.com/dotCMS/core-web/tree/master/libs/dotcms-field-elements) | lib | `libs/dotcms-field-elements` | Stenciljs | Web components for form builder (deprecated) | -| [dotcms-js](https://github.com/dotCMS/core-web/tree/master/libs/dotcms-js) | lib | `libs/dotcms-js` | Angular | Angular @injectables for DotCMS API | -| [dotcms-models](https://github.com/dotCMS/core-web/tree/master/libs/dotcms-models) | lib | `libs/dotcms-models` | Typescript | DotCMS interfaces and types | +| Name | Type | Location | Build with | Description | +| -------------------------------------------------------------------------------------------------- | ---- | ---------------------------- | ---------- | ----------------------------------------------------------- | +| [dotcms-ui](https://github.com/dotCMS/core-web/tree/master/apps/dotcms-ui) | app | `apps/dotcms-ui` | Angular | Main UI application | +| [dotcdn](https://github.com/dotCMS/core-web/tree/master/apps/dotcdn) | app | `apps/dotcdn` | Angular | App for the dotCDN plugin | +| [dotcms-block-editor](https://github.com/dotCMS/core-web/tree/master/apps/dotcms-block-editor) | app | `apps/dotcms-block-editor` | Angular | App to build de block-editor as a Web Component | +| [dotcms](https://github.com/dotCMS/core-web/tree/master/libs/dotcms) | lib | `libs/dotcms` | Typescript | JavaScript SDK for DotCMS API's | +| [dot-layout-grid](https://github.com/dotCMS/core-web/tree/master/libs/dot-layout-grid) | lib | `libs/dot-layout-grid` | Angular | Components for layout editor | +| [block-editor](https://github.com/dotCMS/core-web/tree/master/libs/block-editor) | lib | `libs/block-editor` | TitTap | Block editor components | +| [dot-rules](https://github.com/dotCMS/core-web/tree/master/libs/dot-rules) | lib | `libs/dot-rules` | Angular | Components and services for rules | +| [dotcms-field-elements](https://github.com/dotCMS/core-web/tree/master/libs/dotcms-field-elements) | lib | `libs/dotcms-field-elements` | Stenciljs | Web components for form builder (deprecated) | +| [dotcms-js](https://github.com/dotCMS/core-web/tree/master/libs/dotcms-js) | lib | `libs/dotcms-js` | Angular | Angular @injectables for DotCMS API | +| [dotcms-models](https://github.com/dotCMS/core-web/tree/master/libs/dotcms-models) | lib | `libs/dotcms-models` | Typescript | DotCMS interfaces and types | +| [dotcms-scss](https://github.com/dotCMS/core-web/tree/master/libs/dotcms-scss) | lib | `libs/dotcms-scss` | SCSS | SCSS shared files for theme Angular PrimeNG and Dijit Theme | ## NX Monorepo diff --git a/core-web/apps/dotcdn/project.json b/core-web/apps/dotcdn/project.json index 57bd9a5d0ffa..5e84313e298e 100644 --- a/core-web/apps/dotcdn/project.json +++ b/core-web/apps/dotcdn/project.json @@ -15,14 +15,14 @@ "tsConfig": "apps/dotcdn/tsconfig.app.json", "assets": ["apps/dotcdn/src/favicon.ico", "apps/dotcdn/src/assets"], "styles": [ - "libs/dot-primeng-theme-styles/src/scss/styles.scss", + "libs/dotcms-scss/angular/styles.scss", "node_modules/primeicons/primeicons.css", "node_modules/primeflex/primeflex.css", "node_modules/primeng/resources/primeng.min.css", "apps/dotcdn/src/styles.scss" ], "stylePreprocessorOptions": { - "includePaths": ["libs/dot-primeng-theme-styles/src/scss"] + "includePaths": ["libs/dotcms-scss/angular"] }, "scripts": ["node_modules/chart.js/dist/chart.js"], "vendorChunk": true, @@ -95,7 +95,7 @@ "jestConfig": "apps/dotcdn/jest.config.ts", "passWithNoTests": true, "styles": [ - "libs/dot-primeng-theme-styles/src/scss/styles.scss", + "libs/dotcms-scss/angular/styles.scss", "node_modules/primeicons/primeicons.css", "node_modules/primeflex/primeflex.css", "node_modules/primeng/resources/primeng.min.css", @@ -103,7 +103,7 @@ ], "assets": ["apps/dotcdn/src/favicon.ico", "apps/dotcdn/src/assets"], "stylePreprocessorOptions": { - "includePaths": ["libs/dot-primeng-theme-styles/src/scss"] + "includePaths": ["libs/dotcms-scss/angular"] }, "scripts": ["node_modules/chart.js/dist/Chart.js"] } diff --git a/core-web/apps/dotcdn/src/app/app.component.scss b/core-web/apps/dotcdn/src/app/app.component.scss index 43e57e96d699..f5d287b6c17e 100644 --- a/core-web/apps/dotcdn/src/app/app.component.scss +++ b/core-web/apps/dotcdn/src/app/app.component.scss @@ -46,7 +46,7 @@ h1 { } .dot-cdn__col { - color: $brand-primary; + color: $color-palette-primary; margin-bottom: $spacing-3; display: grid; column-gap: $spacing-3; @@ -59,7 +59,7 @@ h1 { .dot-cdn__stats-label { text-transform: uppercase; color: gray; - font-size: $font-size-small; + font-size: $font-size-sm; grid-column: 1/3; display: inline-block; } @@ -74,7 +74,7 @@ h1 { margin-bottom: $spacing-0; } .dot-cdn__tab-domain small { - color: $gray; + color: $color-palette-gray-700; } .dot-cdn__tab-domain p { @@ -83,7 +83,7 @@ h1 { .dot-cdn__tab-content-label { margin: 0; - font-size: $font-size-large; + font-size: $font-size-lg; } .dot-cdn__tab-content__row:first-child { diff --git a/core-web/apps/dotcms-block-editor/project.json b/core-web/apps/dotcms-block-editor/project.json index f8b69a83e0d0..e0400ee36d01 100644 --- a/core-web/apps/dotcms-block-editor/project.json +++ b/core-web/apps/dotcms-block-editor/project.json @@ -24,7 +24,7 @@ } ], "stylePreprocessorOptions": { - "includePaths": ["libs/dot-primeng-theme-styles/src/scss"] + "includePaths": ["libs/dotcms-scss/angular"] }, "allowedCommonJsDependencies": ["lodash.isequal"], "vendorChunk": true, diff --git a/core-web/apps/dotcms-ui/project.json b/core-web/apps/dotcms-ui/project.json index 6c3f2ffb002c..5e5af650f783 100644 --- a/core-web/apps/dotcms-ui/project.json +++ b/core-web/apps/dotcms-ui/project.json @@ -35,14 +35,15 @@ } ], "styles": [ - "libs/dot-primeng-theme-styles/src/scss/styles.scss", + "libs/dotcms-scss/angular/styles.scss", + "node_modules/primeicons/primeicons.css", "node_modules/primeicons/primeicons.css", "node_modules/primeflex/primeflex.css", "node_modules/primeng/resources/primeng.min.css" ], "scripts": [], "stylePreprocessorOptions": { - "includePaths": ["libs/dot-primeng-theme-styles/src/scss"] + "includePaths": ["libs/dotcms-scss/angular"] }, "vendorChunk": true, "extractLicenses": false, @@ -119,10 +120,10 @@ "tsConfig": "apps/dotcms-ui/tsconfig.spec.json", "karmaConfig": "apps/dotcms-ui/karma.conf.js", "polyfills": "apps/dotcms-ui/src/polyfills.ts", - "styles": ["libs/dot-primeng-theme-styles/src/scss/styles.scss"], + "styles": ["libs/dotcms-scss/angular/styles.scss"], "scripts": [], "stylePreprocessorOptions": { - "includePaths": ["libs/dot-primeng-theme-styles/src/scss"] + "includePaths": ["libs/dotcms-scss/angular"] } }, "configurations": { diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-configuration-detail/dot-apps-configuration-detail-form/dot-apps-configuration-detail-form.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-configuration-detail/dot-apps-configuration-detail-form/dot-apps-configuration-detail-form.component.scss index 6780a1364d46..cc9acc965e2d 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-configuration-detail/dot-apps-configuration-detail-form/dot-apps-configuration-detail-form.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-configuration-detail/dot-apps-configuration-detail-form/dot-apps-configuration-detail-form.component.scss @@ -6,7 +6,7 @@ } textarea { - font-family: $code-text; + font-family: $font-code; max-height: 21.5rem; overflow: auto !important; } @@ -21,12 +21,12 @@ input, textarea { - font-size: $font-size-large; + font-size: $font-size-lg; width: 100%; } dot-icon { - color: $brand-primary; + color: $color-palette-primary; margin-left: $spacing-1; vertical-align: middle; } @@ -38,7 +38,7 @@ } p-checkbox label { - font-size: $font-size-large; + font-size: $font-size-lg; } p-checkbox.required label:before, diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-configuration-detail/dot-apps-configuration-detail.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-configuration-detail/dot-apps-configuration-detail.component.scss index 29737eb881d7..9d31a7ada275 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-configuration-detail/dot-apps-configuration-detail.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-configuration-detail/dot-apps-configuration-detail.component.scss @@ -1,7 +1,7 @@ @use "variables" as *; :host { - background: $gray-bg; + background: $color-palette-gray-200; box-shadow: $md-shadow-4; display: flex; height: 100%; @@ -24,11 +24,11 @@ } .dot-apps-configuration-detail__host-name { - border-bottom: 1px solid $gray-lighter; + border-bottom: 1px solid $color-palette-gray-300; color: $black; display: flex; justify-content: space-between; - font-size: $font-size-large; + font-size: $font-size-lg; font-weight: $font-weight-semi-bold; padding: $spacing-3; diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-configuration-header/dot-apps-configuration-header.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-configuration-header/dot-apps-configuration-header.component.scss index 7d5bc509c255..e130bfb1b7a7 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-configuration-header/dot-apps-configuration-header.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-configuration-header/dot-apps-configuration-header.component.scss @@ -2,7 +2,7 @@ :host { background-color: $white; - border-bottom: 1px solid $gray-lighter; + border-bottom: 1px solid $color-palette-gray-300; display: flex; padding: $spacing-4 $spacing-4 $spacing-4 0; position: sticky; @@ -31,15 +31,15 @@ color: $black; cursor: pointer; display: inline-block; - font-size: $font-size-xx-large; + font-size: $font-size-xxl; font-weight: bold; margin: 0; } .dot-apps-configuration__service-key { - color: $gray; + color: $color-palette-gray-700; display: inline-block; - font-size: $font-size-large; + font-size: $font-size-lg; margin-left: $spacing-3; display: flex; align-items: center; @@ -50,7 +50,7 @@ } .dot-apps-configuration__configurations { - color: $gray; + color: $color-palette-gray-700; display: block; margin-bottom: $spacing-3; margin-top: $spacing-1; @@ -71,7 +71,7 @@ .dot-apps-configuration__description__link_show-more { background-color: $white; cursor: pointer; - font-size: $font-size-large; + font-size: $font-size-lg; padding-left: $spacing-1; position: absolute; bottom: 0; diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-configuration/dot-apps-configuration-list/dot-apps-configuration-item/dot-apps-configuration-item.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-configuration/dot-apps-configuration-list/dot-apps-configuration-item/dot-apps-configuration-item.component.scss index c82129b4cae9..07bf63c43d02 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-configuration/dot-apps-configuration-list/dot-apps-configuration-item/dot-apps-configuration-item.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-configuration/dot-apps-configuration-list/dot-apps-configuration-item/dot-apps-configuration-item.component.scss @@ -1,7 +1,7 @@ @use "variables" as *; :host { - border: 1px solid $gray-lighter; + border: 1px solid $color-palette-gray-300; cursor: pointer; display: flex; margin-right: $spacing-3; @@ -19,7 +19,7 @@ margin-right: $spacing-3; text-align: end; width: 100%; - color: $brand-primary; + color: $color-palette-primary; } dot-icon { @@ -37,7 +37,7 @@ } .dot-apps-configuration-list__host-key { - color: $gray; + color: $color-palette-gray-700; display: flex; flex-grow: 1; align-items: center; diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-configuration/dot-apps-configuration-list/dot-apps-configuration-list.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-configuration/dot-apps-configuration-list/dot-apps-configuration-list.component.scss index 0659a212895f..66593e7e2ebe 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-configuration/dot-apps-configuration-list/dot-apps-configuration-list.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-configuration/dot-apps-configuration-list/dot-apps-configuration-list.component.scss @@ -10,8 +10,8 @@ dot-apps-configuration-item { overflow: auto; &.dot-apps-configuration-item__not-configured { - background-color: $gray-bg; - color: $gray; + background-color: $color-palette-gray-200; + color: $color-palette-gray-700; &:hover { background-color: transparent; diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-configuration/dot-apps-configuration.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-configuration/dot-apps-configuration.component.scss index 138f2f0591a5..556dc192fb3b 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-configuration/dot-apps-configuration.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-configuration/dot-apps-configuration.component.scss @@ -1,7 +1,7 @@ @use "variables" as *; :host { - background: $gray-bg; + background: $color-palette-gray-200; box-shadow: $md-shadow-4; display: flex; height: 100%; @@ -38,12 +38,12 @@ } .dot-apps-configuration__add-configurations-title { - font-size: $font-size-xx-large; + font-size: $font-size-xxl; font-weight: bold; } .dot-apps-configuration__add-configurations-description { - font-size: $font-size-large; + font-size: $font-size-lg; margin-bottom: $spacing-9; margin-top: $spacing-4; } diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-list/dot-apps-card/dot-apps-card.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-list/dot-apps-card/dot-apps-card.component.scss index 904ca39a3ec8..5b230437315d 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-list/dot-apps-card/dot-apps-card.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-list/dot-apps-card/dot-apps-card.component.scss @@ -1,11 +1,10 @@ @use "variables" as *; -@import "mixins"; :host { - box-shadow: $md-shadow-2; + box-shadow: $md-shadow-4; display: block; transition: box-shadow $basic-speed ease-in; - border-radius: $border-radius-md; + border-radius: $border-radius-sm; &:hover { box-shadow: $md-shadow-3; @@ -14,7 +13,7 @@ } .dot-apps-card__disabled { - background-color: $gray-bg; + background-color: $color-palette-gray-200; display: block; height: 100%; @@ -40,16 +39,16 @@ ::ng-deep { .p-card { - background: $gray-bg; + background: $color-palette-gray-200; } .avatar__img { filter: grayscale(1); } .p-widget-content { - background-color: $gray-bg; + background-color: $color-palette-gray-200; } .dot-apps-card__name { - color: $gray; + color: $color-palette-gray-700; } } } @@ -69,7 +68,7 @@ dot-avatar { color: $black; display: block; flex: 1; - font-size: $font-size-large; + font-size: $font-size-lg; font-weight: bold; height: $spacing-3; line-height: $spacing-3; @@ -83,16 +82,16 @@ dot-avatar { dot-icon { bottom: 0; - color: $brand-primary; + color: $color-palette-primary; position: absolute; right: 0; } } .dot-apps-card__configurations { - color: $gray; + color: $color-palette-gray-700; display: block; - font-size: $font-size-medium; + font-size: $font-size-md; line-height: $spacing-3; margin-top: $spacing-1; margin-right: $spacing-4; @@ -100,7 +99,7 @@ dot-avatar { ::ng-deep { p-card { - border-radius: $border-radius-md; + border-radius: $border-radius-sm; } .p-card { @@ -108,7 +107,7 @@ dot-avatar { height: 100%; .p-card-body { - color: $gray; + color: $color-palette-gray-700; .p-card-content > p { line-height: 1.5rem; diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-list/dot-apps-list.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-list/dot-apps-list.component.scss index 26693af66eda..825e3f0a8ea5 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-list/dot-apps-list.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps-list/dot-apps-list.component.scss @@ -6,7 +6,7 @@ } .dot-apps__header { - border-bottom: 1px solid $gray-light; + border-bottom: 1px solid $color-palette-gray-200; display: flex; justify-content: space-between; padding: 0 $spacing-4 $spacing-4; diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-categories/dot-categories-list/dot-categories-list.component.html b/core-web/apps/dotcms-ui/src/app/portlets/dot-categories/dot-categories-list/dot-categories-list.component.html index c0199dc06848..ba10e0e986df 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-categories/dot-categories-list/dot-categories-list.component.html +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-categories/dot-categories-list/dot-categories-list.component.html @@ -24,7 +24,7 @@ (onHeaderCheckboxToggle)="handleRowCheck($event)" (onFilter)="handleFilter()" selectionMode="checkbox" - loadingIcon="fa fa-circle-o-notch fa-spin" + loadingIcon="pi pi-spin pi-spinner" dataKey="categoryId" > diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-categories/dot-categories-list/dot-categories-list.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-categories/dot-categories-list/dot-categories-list.component.scss index 70ddbe966380..3e9a6ebe82af 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-categories/dot-categories-list/dot-categories-list.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-categories/dot-categories-list/dot-categories-list.component.scss @@ -19,6 +19,6 @@ dot-portlet-base { display: flex; justify-content: center; font-size: $spacing-9; - font-size: $font-size-xx-large; + font-size: $font-size-xxl; } } diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-containers/container-list/container-list.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-containers/container-list/container-list.component.scss index cf3002d39e76..8c421494aea8 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-containers/container-list/container-list.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-containers/container-list/container-list.component.scss @@ -19,7 +19,7 @@ } .container-listing__path { - color: $gray-light; + color: $color-palette-gray-500; } dot-content-type-selector { diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-containers/dot-container-create/dot-container-code/dot-add-variable/dot-add-variable.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-containers/dot-container-create/dot-container-code/dot-add-variable/dot-add-variable.component.scss index db184aefbf19..8357477e5a46 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-containers/dot-container-create/dot-container-code/dot-add-variable/dot-add-variable.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-containers/dot-container-create/dot-container-code/dot-add-variable/dot-add-variable.component.scss @@ -8,7 +8,7 @@ .dot-add-variable-list__item { h3 { - font-size: $font-size-medium; + font-size: $font-size-md; margin: 0; } @@ -17,7 +17,7 @@ } small { - color: $gray; + color: $color-palette-gray-700; } } diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-containers/dot-container-create/dot-container-code/dot-container-code.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-containers/dot-container-create/dot-container-code/dot-container-code.component.scss index 03f8b24a8649..de06d5e6294d 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-containers/dot-container-create/dot-container-code/dot-container-code.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-containers/dot-container-create/dot-container-code/dot-container-code.component.scss @@ -13,16 +13,16 @@ } .dot-container-code__empty-content-title { - font-size: $font-size-medium; + font-size: $font-size-md; } .dot-container-code__empty-content-subtitle { - font-size: $font-size-small; + font-size: $font-size-sm; } .dot-container-code__content-tab-container ::ng-deep { dot-icon { - color: $brand-primary; + color: $color-palette-primary; } .p-tabview { @@ -54,14 +54,14 @@ width: $tabView-scroll-btn-width; border: 1px solid $input-border-color; border-left: none; - background: $gray-bg; + background: $color-palette-gray-200; } .p-tabview-nav-prev { width: $tabView-scroll-btn-width; border: 1px solid $input-border-color; border-right: none; - background: $gray-bg; + background: $color-palette-gray-200; } .p-tabview .p-tabview-nav { diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-containers/dot-container-create/dot-container-properties/dot-container-properties.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-containers/dot-container-create/dot-container-properties/dot-container-properties.component.scss index efae5b5606d6..c5cda76f86f7 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-containers/dot-container-create/dot-container-properties/dot-container-properties.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-containers/dot-container-create/dot-container-properties/dot-container-properties.component.scss @@ -31,7 +31,7 @@ .dot-container-properties__title-text { display: inline-block; padding-right: $spacing-2; - font-size: $font-size-large; + font-size: $font-size-lg; } .dot-container-properties__max-contents-input { @@ -41,7 +41,7 @@ .p-button-info.dot-container-properties__button-clear, .p-button-info.dot-container-properties__button-clear:hover { - background-color: $gray; + background-color: $color-palette-gray-700; color: $white; padding: 0.82rem $spacing-3; } diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-block-editor-sidebar/dot-block-editor-sidebar.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-block-editor-sidebar/dot-block-editor-sidebar.component.scss index 2e6412eb9dc4..899363b4e67a 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-block-editor-sidebar/dot-block-editor-sidebar.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-block-editor-sidebar/dot-block-editor-sidebar.component.scss @@ -1,4 +1,4 @@ -@use "libs/dot-primeng-theme-styles/src/scss/variables" as *; +@use "variables" as *; :host { .container { diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-edit-page-info/dot-edit-page-info.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-edit-page-info/dot-edit-page-info.component.scss index 613debdfbe3b..249c8631f404 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-edit-page-info/dot-edit-page-info.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-edit-page-info/dot-edit-page-info.component.scss @@ -9,7 +9,7 @@ h2 { margin: 0 $spacing-3 0 0; align-self: center; - color: $body-font-color; - font-size: $font-size-xx-large; + color: $font-color-base; + font-size: $font-size-xxl; font-weight: normal; } diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-favorite-page/dot-favorite-page.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-favorite-page/dot-favorite-page.component.scss index 6afa46438d9a..d91a0a415497 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-favorite-page/dot-favorite-page.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-favorite-page/dot-favorite-page.component.scss @@ -1,4 +1,4 @@ -@use "libs/dot-primeng-theme-styles/src/scss/variables" as *; +@use "variables" as *; :host { display: block; @@ -29,7 +29,7 @@ } .dot-favorite-dialog__image-container { - border: 1px solid $gray-lighter; + border: 1px solid $color-palette-gray-300; display: block; text-align: center; @@ -44,7 +44,7 @@ min-height: 353px; img { - border: 1px solid $gray-lighter; + border: 1px solid $color-palette-gray-300; height: 353px; object-fit: contain; width: 100%; diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-palette/dot-palette-content-type/dot-palette-content-type.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-palette/dot-palette-content-type/dot-palette-content-type.component.scss index 375f306a1bae..417b95941a33 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-palette/dot-palette-content-type/dot-palette-content-type.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-palette/dot-palette-content-type/dot-palette-content-type.component.scss @@ -1,4 +1,4 @@ -@use "libs/dot-primeng-theme-styles/src/scss/variables" as *; +@use "variables" as *; :host { width: $content-palette-width; @@ -6,7 +6,7 @@ display: flex; flex-direction: column; padding: $spacing-1; - border-left: 1px solid $gray-lighter; + border-left: 1px solid $color-palette-gray-300; background: $white; transition: all $basic-speed ease-in-out; height: 100%; @@ -21,7 +21,7 @@ overflow: hidden auto; div { - border: 1px solid $gray-lighter; + border: 1px solid $color-palette-gray-300; color: $black; cursor: grab; overflow: hidden; @@ -30,11 +30,11 @@ text-align: center; &:hover { - background: $gray-bg; + background: $color-palette-gray-200; } p { - font-size: $font-size-small; + font-size: $font-size-sm; margin: $spacing-1 0 0; overflow: hidden; text-align: center; @@ -46,7 +46,7 @@ .arrow { background-color: transparent; border: none; - color: $gray; + color: $color-palette-gray-700; cursor: pointer; padding: 0; position: absolute; @@ -66,5 +66,3 @@ padding: $spacing-1 0; margin: $spacing-4; } - - diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-palette/dot-palette-contentlets/dot-palette-contentlets.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-palette/dot-palette-contentlets/dot-palette-contentlets.component.scss index f481cc7b958c..9831d50c2d62 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-palette/dot-palette-contentlets/dot-palette-contentlets.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-palette/dot-palette-contentlets/dot-palette-contentlets.component.scss @@ -1,8 +1,8 @@ -@use "libs/dot-primeng-theme-styles/src/scss/variables" as *; +@use "variables" as *; :host { background: $white; - border-left: 1px solid $gray-lighter; + border-left: 1px solid $color-palette-gray-300; display: flex; flex-direction: column; height: 100%; @@ -28,7 +28,7 @@ text-align: center; &:hover { - background: $gray-bg; + background: $color-palette-gray-200; } img { @@ -40,7 +40,7 @@ p { align-self: center; display: -webkit-box; - font-size: $font-size-small; + font-size: $font-size-sm; margin: 0 0 0 $spacing-1; overflow: hidden; text-align: left; @@ -48,7 +48,6 @@ -webkit-line-clamp: 2; -webkit-box-orient: vertical; } - } p-paginator { diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-palette/dot-palette-input-filter/dot-palette-input-filter.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-palette/dot-palette-input-filter/dot-palette-input-filter.component.scss index 81bcd45c2ff9..82d3a68df289 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-palette/dot-palette-input-filter/dot-palette-input-filter.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-palette/dot-palette-input-filter/dot-palette-input-filter.component.scss @@ -1,8 +1,8 @@ -@use "libs/dot-primeng-theme-styles/src/scss/variables" as *; +@use "variables" as *; :host { display: flex; - color: $gray; + color: $color-palette-gray-700; position: sticky; align-self: flex-start; margin-bottom: $spacing-3; diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-palette/store/dot-palette.store.spec.ts b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-palette/store/dot-palette.store.spec.ts index 6531fcdc8e87..82a60972be2e 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-palette/store/dot-palette.store.spec.ts +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-palette/store/dot-palette.store.spec.ts @@ -233,7 +233,7 @@ describe('DotPaletteStore', () => { lang: '1', filter: '', offset: '0', - query: '+contentType: product' + query: '+contentType: product +deleted: false' }); expect(data.contentlets).toEqual([ contentletProductDataMock diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-palette/store/dot-palette.store.ts b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-palette/store/dot-palette.store.ts index 33b58eff2341..d114619906c9 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-palette/store/dot-palette.store.ts +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/components/dot-palette/store/dot-palette.store.ts @@ -195,7 +195,7 @@ export class DotPaletteStore extends ComponentStore { lang: languageId || '1', filter: filter || '', offset: (event && event.first.toString()) || '0', - query: `+contentType: ${this.contentTypeVarName}` + query: `+contentType: ${this.contentTypeVarName} +deleted: false` }) .pipe(take(1)) .subscribe((response: ESContent) => { diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/components/dot-edit-page-state-controller/components/dot-edit-page-lock-info/dot-edit-page-lock-info.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/components/dot-edit-page-state-controller/components/dot-edit-page-lock-info/dot-edit-page-lock-info.component.scss index 5dad5778590f..5be490ba0af9 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/components/dot-edit-page-state-controller/components/dot-edit-page-lock-info/dot-edit-page-lock-info.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/components/dot-edit-page-state-controller/components/dot-edit-page-lock-info/dot-edit-page-lock-info.component.scss @@ -2,8 +2,8 @@ @import "mixins"; :host { - font-size: $font-size-small; - color: $gray; + font-size: $font-size-sm; + color: $color-palette-gray-700; } .page-info { 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 e479d3f6dbf2..04b81ad898d2 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 @@ -18,7 +18,7 @@ display: flex; .p-button-label { - color: $dark; + color: $black; } } } @@ -32,7 +32,7 @@ p-inputSwitch { ::ng-deep { .p-inputswitch-slider:after { @include md-icon; - color: $brand-primary; + color: $color-palette-primary; content: "lock_open"; font-size: 13px; left: 3px; diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/components/dot-edit-page-toolbar/dot-edit-page-toolbar.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/components/dot-edit-page-toolbar/dot-edit-page-toolbar.component.scss index dbfc1596883b..5d46e9ce0ff9 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/components/dot-edit-page-toolbar/dot-edit-page-toolbar.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/components/dot-edit-page-toolbar/dot-edit-page-toolbar.component.scss @@ -15,6 +15,6 @@ ::ng-deep { .dot-favorite-page-highlight i { - color: $brand-primary; + color: $color-palette-primary; } } diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/components/dot-whats-changed/dot-whats-changed.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/components/dot-whats-changed/dot-whats-changed.component.scss index 0ac220cd1e35..25a665b93a73 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/components/dot-whats-changed/dot-whats-changed.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/components/dot-whats-changed/dot-whats-changed.component.scss @@ -17,6 +17,6 @@ .whats-changed__empty-state { text-align: center; margin-top: $spacing-9; - font-size: $font-size-xx-large; + font-size: $font-size-xxl; } } diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/dot-edit-content.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/dot-edit-content.component.scss index 372ee942ea2c..ccde65fd1e82 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/dot-edit-content.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/dot-edit-content.component.scss @@ -2,7 +2,7 @@ @import "mixins"; :host { - background-color: $gray-bg; + background-color: $color-palette-gray-200; display: flex; flex-direction: column; width: 100%; @@ -12,14 +12,14 @@ dot-whats-changed, .dot-edit__iframe { background: $white; - border-radius: $border-radius; + border-radius: $border-radius-xs; box-shadow: $md-shadow-4; flex-grow: 1; overflow: hidden; } .dot-edit__page-wrapper { - background-color: $gray-bg; + background-color: $color-palette-gray-200; height: 100%; max-width: 100%; padding: $spacing-5; @@ -58,15 +58,15 @@ dot-whats-changed, flex-grow: 1; display: flex; flex-direction: column; - border: solid 1px $gray-lighter; + border: solid 1px $color-palette-gray-300; .dot-edit__page-wrapper--deviced & { flex-grow: 0; border-radius: 10px; border: 2px solid #ddd; box-shadow: 4px 4px 15px rgba(0, 0, 0, 0.1); - background: rgba($white_rgb, 1); - background: linear-gradient(135deg, rgba($white_rgb, 1) 0%, rgba(240, 240, 240, 1) 100%); + background: $white; + background: linear-gradient(135deg, $white 0%, rgba(240, 240, 240, 1) 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#f0f0f0', GradientType=1); margin: 0 auto; padding: 0 10px; @@ -96,8 +96,8 @@ dot-whats-changed, 135deg, rgba(242, 239, 242, 1) 0%, rgba(242, 239, 242, 1) 9%, - rgba($white_rgb, 1) 76%, - rgba($white_rgb, 1) 100% + $white 76%, + $white 100% ); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f2eff2', endColorstr='#ffffff', GradientType=1); } @@ -146,7 +146,7 @@ dot-whats-changed, position: absolute; background: $white; top: 134px; - border: 1px solid $gray-lighter; + border: 1px solid $color-palette-gray-300; border-radius: 6px 0 0 6px; cursor: pointer; z-index: 2; diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/dot-edit-content.component.ts b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/dot-edit-content.component.ts index a8cebb98fb24..6db7c7576e37 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/dot-edit-content.component.ts +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/dot-edit-content.component.ts @@ -346,7 +346,7 @@ export class DotEditContentComponent implements OnInit, OnDestroy { .get({ itemsPerPage: 10, offset: '0', - query: `+contentType:DotFavoritePage +DotFavoritePage.url_dotraw:${pageUrl}` + query: `+contentType:DotFavoritePage +deleted:false +working:true +DotFavoritePage.url_dotraw:${pageUrl}` }) .pipe(take(1)) .subscribe((response: ESContent) => { diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/services/dot-page-state/dot-page-state.service.spec.ts b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/services/dot-page-state/dot-page-state.service.spec.ts index b12ba63b6f8e..84c27afdfff8 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/services/dot-page-state/dot-page-state.service.spec.ts +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/services/dot-page-state/dot-page-state.service.spec.ts @@ -134,6 +134,12 @@ describe('DotPageStateService', () => { }, {} ]); + + expect(dotESContentService.get).toHaveBeenCalledWith({ + itemsPerPage: 10, + offset: '0', + query: `+contentType:DotFavoritePage +deleted:false +working:true +DotFavoritePage.url_dotraw:/an/url/test?&language_id=1&device_inode=` + }); }); }); diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/services/dot-page-state/dot-page-state.service.ts b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/services/dot-page-state/dot-page-state.service.ts index aebd64bf6db2..f175861770b8 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/services/dot-page-state/dot-page-state.service.ts +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/services/dot-page-state/dot-page-state.service.ts @@ -215,7 +215,7 @@ export class DotPageStateService { .get({ itemsPerPage: 10, offset: '0', - query: `+contentType:DotFavoritePage +DotFavoritePage.url_dotraw:${urlParam}` + query: `+contentType:DotFavoritePage +deleted:false +working:true +DotFavoritePage.url_dotraw:${urlParam}` }) .pipe( take(1), diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/main/dot-edit-page-nav/dot-edit-page-nav.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/main/dot-edit-page-nav/dot-edit-page-nav.component.scss index 1f299d70e0f7..d8b1570a7d0f 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/main/dot-edit-page-nav/dot-edit-page-nav.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/main/dot-edit-page-nav/dot-edit-page-nav.component.scss @@ -4,8 +4,8 @@ $nav-size: 80px; :host { - background-color: $gray-bg; - border-left: solid 1px $gray-lighter; + background-color: $color-palette-gray-200; + border-left: solid 1px $color-palette-gray-300; display: flex; flex-shrink: 0; order: 2; @@ -26,10 +26,10 @@ $nav-size: 80px; } &.edit-page-variant-mode { - background-color: $color-primary-300; + background-color: $color-palette-primary-300; a:hover { - background-color: $color-primary-100; + background-color: $color-palette-primary-100; } } } @@ -41,7 +41,7 @@ $nav-size: 80px; .edit-page-nav__item { align-items: center; - color: $gray-dark; + color: $color-palette-gray-800; display: flex; flex-direction: column; font-size: 11px; @@ -56,7 +56,7 @@ $nav-size: 80px; } &:hover { - background-color: $gray-bg; + background-color: $color-palette-gray-200; } & > .fa { @@ -76,10 +76,10 @@ $nav-size: 80px; background-color: $white; color: $black; pointer-events: none; - border-bottom: 1px solid $gray-lighter; + border-bottom: 1px solid $color-palette-gray-300; border-top: 1px solid transparent; } .edit-page-nav li:not(:first-child) .edit-page-nav__item--active { - border-color: $gray-lighter; + border-color: $color-palette-gray-300; } diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-goal-select/dot-experiments-configuration-goal-select.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-goal-select/dot-experiments-configuration-goal-select.component.scss index 45b3104fe94c..4be900b9b87c 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-goal-select/dot-experiments-configuration-goal-select.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-goal-select/dot-experiments-configuration-goal-select.component.scss @@ -10,16 +10,16 @@ label { font-weight: $font-weight-bold; margin-bottom: $spacing-0; - font-size: $font-size-medium; + font-size: $font-size-md; } p { margin: $spacing-0; - color: $color-gray-500; + color: $color-palette-gray-500; } input { - border-color: $color-gray-300; + border-color: $color-palette-gray-300; } } } diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-goal-select/dot-experiments-configuration-goal-select.component.spec.ts b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-goal-select/dot-experiments-configuration-goal-select.component.spec.ts index 5d2eb6dda99d..d0d2b8f40b17 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-goal-select/dot-experiments-configuration-goal-select.component.spec.ts +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-goal-select/dot-experiments-configuration-goal-select.component.spec.ts @@ -76,8 +76,9 @@ describe('DotExperimentsConfigurationGoalSelectComponent', () => { spectator.detectChanges(); }); - it('should have a form', () => { + it('should have a form & autofocus', () => { expect(spectator.query(byTestId('select-goal-form'))).toExist(); + expect(spectator.query(byTestId('goal-name-input'))).toHaveAttribute('dotAutofocus'); }); it('should have rendered BOUCE_RATE and REACH_PAGE options items', () => { diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-goal-select/dot-experiments-configuration-goal-select.component.ts b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-goal-select/dot-experiments-configuration-goal-select.component.ts index 4b758034e298..251fc4b69985 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-goal-select/dot-experiments-configuration-goal-select.component.ts +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-goal-select/dot-experiments-configuration-goal-select.component.ts @@ -20,6 +20,7 @@ import { SidebarModule } from 'primeng/sidebar'; import { takeUntil } from 'rxjs/operators'; import { DotFieldValidationMessageModule } from '@components/_common/dot-field-validation-message/dot-file-validation-message.module'; +import { DotAutofocusModule } from '@directives/dot-autofocus/dot-autofocus.module'; import { ComponentStatus, GOAL_TYPES, @@ -51,6 +52,7 @@ import { DotSidebarHeaderComponent } from '@shared/dot-sidebar-header/dot-sideba DotSidebarDirective, DotExperimentsOptionsModule, DotDropdownDirective, + DotAutofocusModule, //PrimeNg SidebarModule, ButtonModule, diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-goals/dot-experiments-configuration-goals.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-goals/dot-experiments-configuration-goals.component.scss index 8f8999f6bd46..ea3c3dac8b86 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-goals/dot-experiments-configuration-goals.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-goals/dot-experiments-configuration-goals.component.scss @@ -6,7 +6,7 @@ h3 { } h2 { - font-size: $font-size-large; + font-size: $font-size-lg; font-weight: $font-weight-bold; text-transform: uppercase; margin-bottom: $spacing-3; @@ -14,15 +14,15 @@ h2 { h3 { font-weight: $font-weight-regular-bold; - font-size: $font-size-medium; + font-size: $font-size-md; } :host ::ng-deep { dot-icon { - color: $gray-light; + color: $color-palette-gray-500; &.isDone { - color: $success; + color: $color-accessible-text-green; } } @@ -32,7 +32,7 @@ h3 { button { .p-button-icon { - color: $color-primary-500; + color: $color-palette-primary-500; } } } diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-items-count/dot-experiments-configuration-items-count.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-items-count/dot-experiments-configuration-items-count.component.scss index 936527494454..c9782d67cc3c 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-items-count/dot-experiments-configuration-items-count.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-items-count/dot-experiments-configuration-items-count.component.scss @@ -1,8 +1,8 @@ @use "variables" as *; :host { - font-size: $font-size-small; - color: $gray-dark; + font-size: $font-size-sm; + color: $color-palette-gray-800; padding-right: $spacing-1; font-weight: $font-weight-bold; } diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-scheduling-add/dot-experiments-configuration-scheduling-add.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-scheduling-add/dot-experiments-configuration-scheduling-add.component.scss index 258cf96a4d23..1bf9916d5a25 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-scheduling-add/dot-experiments-configuration-scheduling-add.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-scheduling-add/dot-experiments-configuration-scheduling-add.component.scss @@ -6,7 +6,7 @@ label { font-weight: $font-weight-bold; margin-bottom: $spacing-3; - font-size: $font-size-large; + font-size: $font-size-lg; } ::ng-deep .p-calendar { diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-scheduling/dot-experiments-configuration-scheduling.component.html b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-scheduling/dot-experiments-configuration-scheduling.component.html index 8c3a292eac4d..58192e4e08b1 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-scheduling/dot-experiments-configuration-scheduling.component.html +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-scheduling/dot-experiments-configuration-scheduling.component.html @@ -1,8 +1,15 @@ -

+

{{ 'experiments.configure.scheduling.name' | dm }} + +

diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-scheduling/dot-experiments-configuration-scheduling.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-scheduling/dot-experiments-configuration-scheduling.component.scss index 3a585e701b39..96202f496a62 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-scheduling/dot-experiments-configuration-scheduling.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-scheduling/dot-experiments-configuration-scheduling.component.scss @@ -2,7 +2,7 @@ h2 { margin: 0; - font-size: $font-size-large; + font-size: $font-size-lg; font-weight: $font-weight-bold; text-transform: uppercase; } @@ -10,3 +10,13 @@ h2 { .scheduling-setup-date-spacing { margin: 0 $spacing-1; } + +:host ::ng-deep { + dot-icon { + color: $color-palette-gray-500; + + &.isDone { + color: $color-accessible-text-green; + } + } +} diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-scheduling/dot-experiments-configuration-scheduling.component.spec.ts b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-scheduling/dot-experiments-configuration-scheduling.component.spec.ts index d4283b9eabbb..431a5ded696d 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-scheduling/dot-experiments-configuration-scheduling.component.spec.ts +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-scheduling/dot-experiments-configuration-scheduling.component.spec.ts @@ -82,6 +82,7 @@ describe('DotExperimentsConfigurationSchedulingComponent', () => { 'When the experiment start' ); expect(spectator.query(byTestId('scheduling-setup-button'))).toContainText('Setup'); + expect(spectator.query(byTestId('schedule-step-done'))).not.toHaveClass('isDone'); }); it('should open sidebar on button click', () => { @@ -110,4 +111,13 @@ describe('DotExperimentsConfigurationSchedulingComponent', () => { expect(spectator.query(byTestId('scheduling-setup-button'))).toHaveAttribute('disabled'); expect(spectator.query(Tooltip).disabled).toEqual(false); }); + + it('should set indicator in green', () => { + dotExperimentsService.getById.and.returnValue(of(getExperimentMock(0))); + + store.loadExperiment(EXPERIMENT_MOCK.id); + spectator.detectChanges(); + + expect(spectator.query(byTestId('schedule-step-done'))).toHaveClass('isDone'); + }); }); diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-scheduling/dot-experiments-configuration-scheduling.component.ts b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-scheduling/dot-experiments-configuration-scheduling.component.ts index 960fbd28dd59..a051f8ca7e62 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-scheduling/dot-experiments-configuration-scheduling.component.ts +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-scheduling/dot-experiments-configuration-scheduling.component.ts @@ -16,6 +16,7 @@ import { RangeOfDateAndTime, StepStatus } from '@dotcms/dotcms-models'; +import { DotIconModule } from '@dotcms/ui'; import { DotMessagePipeModule } from '@pipes/dot-message/dot-message-pipe.module'; import { DotExperimentsConfigurationSchedulingAddComponent } from '@portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-scheduling-add/dot-experiments-configuration-scheduling-add.component'; import { DotExperimentsConfigurationStore } from '@portlets/dot-experiments/dot-experiments-configuration/store/dot-experiments-configuration-store'; @@ -28,6 +29,7 @@ import { DotDynamicDirective } from '@portlets/shared/directives/dot-dynamic.dir CommonModule, DotDynamicDirective, DotMessagePipeModule, + DotIconModule, // PrimeNg CardModule, ButtonModule, @@ -65,7 +67,7 @@ export class DotExperimentsConfigurationSchedulingComponent { } private handleSidebar(status: StepStatus) { - if (status && status.isOpen) { + if (status && status.isOpen && status.status != ComponentStatus.SAVING) { this.loadSidebarComponent(status); } else { this.removeSidebarComponent(); @@ -73,7 +75,7 @@ export class DotExperimentsConfigurationSchedulingComponent { } private loadSidebarComponent(status: StepStatus): void { - if (status && status.isOpen && status.status != ComponentStatus.SAVING) { + if (this.shouldLoadSidebar(status)) { this.sidebarHost.viewContainerRef.clear(); this.componentRef = this.sidebarHost.viewContainerRef.createComponent( @@ -87,4 +89,8 @@ export class DotExperimentsConfigurationSchedulingComponent { this.sidebarHost.viewContainerRef.clear(); } } + + private shouldLoadSidebar(status: StepStatus): boolean { + return status && status.isOpen && status.status != ComponentStatus.SAVING; + } } diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-targeting/dot-experiments-configuration-targeting.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-targeting/dot-experiments-configuration-targeting.component.scss index 4ae5cd017bf2..fbd79b2d7d49 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-targeting/dot-experiments-configuration-targeting.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-targeting/dot-experiments-configuration-targeting.component.scss @@ -2,7 +2,7 @@ h2 { margin: 0; - font-size: $font-size-large; + font-size: $font-size-lg; font-weight: $font-weight-bold; text-transform: uppercase; } diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic-allocation-add/dot-experiments-configuration-traffic-allocation-add.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic-allocation-add/dot-experiments-configuration-traffic-allocation-add.component.scss index bc0b997833a7..3a1b25dcf98d 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic-allocation-add/dot-experiments-configuration-traffic-allocation-add.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic-allocation-add/dot-experiments-configuration-traffic-allocation-add.component.scss @@ -3,7 +3,7 @@ h5 { font-weight: $font-weight-bold; margin: 0; - font-size: $font-size-large; + font-size: $font-size-lg; } .experiment-traffic-allocation-add__form-wrapper { @@ -11,7 +11,7 @@ h5 { label { font-weight: $font-weight-bold; - font-size: $font-size-large; + font-size: $font-size-lg; } p { diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic-allocation-add/dot-experiments-configuration-traffic-allocation-add.component.spec.ts b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic-allocation-add/dot-experiments-configuration-traffic-allocation-add.component.spec.ts index ab217c213ddd..0b0013bf6f26 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic-allocation-add/dot-experiments-configuration-traffic-allocation-add.component.spec.ts +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic-allocation-add/dot-experiments-configuration-traffic-allocation-add.component.spec.ts @@ -63,7 +63,7 @@ describe('DotExperimentsConfigurationTrafficAllocationAddComponent', () => { store.loadExperiment(EXPERIMENT_MOCK.id); store.setSidebarStatus({ - experimentStep: ExperimentSteps.TRAFFIC, + experimentStep: ExperimentSteps.TRAFFIC_LOAD, isOpen: true }); spectator.detectChanges(); diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic-split-add/dot-experiments-configuration-traffic-split-add.component.html b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic-split-add/dot-experiments-configuration-traffic-split-add.component.html index b15b88697d3e..0b949e7a120f 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic-split-add/dot-experiments-configuration-traffic-split-add.component.html +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic-split-add/dot-experiments-configuration-traffic-split-add.component.html @@ -57,6 +57,7 @@ [maxFractionDigits]="2" [min]="0" [max]="100" + (onInput)="checkControl(i, $event.value)" formControlName="weight" mode="decimal" > diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic-split-add/dot-experiments-configuration-traffic-split-add.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic-split-add/dot-experiments-configuration-traffic-split-add.component.scss index 13cce8187af5..b9d0890da497 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic-split-add/dot-experiments-configuration-traffic-split-add.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic-split-add/dot-experiments-configuration-traffic-split-add.component.scss @@ -11,7 +11,7 @@ label { font-weight: $font-weight-bold; margin-bottom: $spacing-3; - font-size: $font-size-large; + font-size: $font-size-lg; } p-radioButton { @@ -32,8 +32,8 @@ margin-bottom: $spacing-2; &.experiment-traffic-split__variants-header { - font-size: $font-size-large; - color: $gray; + font-size: $font-size-lg; + color: $color-palette-gray-700; text-transform: uppercase; font-weight: $font-weight-bold; } diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic-split-add/dot-experiments-configuration-traffic-split-add.component.spec.ts b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic-split-add/dot-experiments-configuration-traffic-split-add.component.spec.ts index cfae065b71e8..45e07b857923 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic-split-add/dot-experiments-configuration-traffic-split-add.component.spec.ts +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic-split-add/dot-experiments-configuration-traffic-split-add.component.spec.ts @@ -15,7 +15,11 @@ import { RadioButton, RadioButtonModule } from 'primeng/radiobutton'; import { Sidebar } from 'primeng/sidebar'; import { DotMessageService } from '@dotcms/data-access'; -import { ExperimentSteps, TrafficProportionTypes } from '@dotcms/dotcms-models'; +import { + DEFAULT_VARIANT_NAME, + ExperimentSteps, + TrafficProportionTypes +} from '@dotcms/dotcms-models'; import { MockDotMessageService } from '@dotcms/utils-testing'; import { DotExperimentsConfigurationStore } from '@portlets/dot-experiments/dot-experiments-configuration/store/dot-experiments-configuration-store'; import { DotExperimentsService } from '@portlets/dot-experiments/shared/services/dot-experiments.service'; @@ -63,7 +67,7 @@ describe('DotExperimentsConfigurationTrafficSplitAddComponent', () => { dotExperimentsService.getById.and.returnValue(of({ ...EXPERIMENT_MOCK })); store.loadExperiment(EXPERIMENT_MOCK.id); store.setSidebarStatus({ - experimentStep: ExperimentSteps.TRAFFIC, + experimentStep: ExperimentSteps.TRAFFICS_SPLIT, isOpen: true }); spectator.detectChanges(); @@ -78,7 +82,7 @@ describe('DotExperimentsConfigurationTrafficSplitAddComponent', () => { expect(spectator.queryAll(InputNumber).length).toEqual(0); expect(variantsWeight[0]).toContainText('50'); expect(variantsWeight[1]).toContainText('50'); - expect(variantsName[0]).toContainText('DEFAULT'); + expect(variantsName[0]).toContainText(DEFAULT_VARIANT_NAME); expect(variantsName[1]).toContainText('variant a'); }); diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic-split-add/dot-experiments-configuration-traffic-split-add.component.ts b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic-split-add/dot-experiments-configuration-traffic-split-add.component.ts index fa57da9ade05..fda2cdcebdad 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic-split-add/dot-experiments-configuration-traffic-split-add.component.ts +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic-split-add/dot-experiments-configuration-traffic-split-add.component.ts @@ -117,6 +117,20 @@ export class DotExperimentsConfigurationTrafficSplitAddComponent implements OnIn }); } + /** + * This is needed because a current bug in primeng + * https://github.com/primefaces/primeng/pull/11093 + * @param {number} arrayIndex + * @param {number} value + * @returns void + * @memberof DotExperimentsConfigurationTrafficSplitAddComponent + */ + checkControl(arrayIndex: number, value: number): void { + ( + (this.form.get('variants') as FormArray).controls[arrayIndex] as FormGroup + ).controls.weight.setValue(value); + } + private initForm() { this.vm$.pipe(take(1)).subscribe((data) => { this.form = this.fb.group({ diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic/dot-experiments-configuration-traffic.component.html b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic/dot-experiments-configuration-traffic.component.html index dcfe07f14c8c..add05e88f863 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic/dot-experiments-configuration-traffic.component.html +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic/dot-experiments-configuration-traffic.component.html @@ -1,12 +1,19 @@ -

+

{{ 'experiments.configure.traffic.name' | dm }} +

- +
{{ @@ -32,36 +39,6 @@

- -
-
- {{ - 'experiments.configure.traffic.split.name' | dm - }} -
-
- -
-
-
diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic/dot-experiments-configuration-traffic.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic/dot-experiments-configuration-traffic.component.scss index 64c510f9d421..19a73bc74cc6 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic/dot-experiments-configuration-traffic.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic/dot-experiments-configuration-traffic.component.scss @@ -2,20 +2,17 @@ h2 { margin: 0; - font-size: $font-size-large; + font-size: $font-size-lg; font-weight: 500; text-transform: uppercase; } -:host ::ng-deep p-card .p-card-content { - .card-load { - border-bottom-left-radius: 0; - border-bottom-right-radius: 0; - border-bottom: 0; - } +:host ::ng-deep { + dot-icon { + color: $color-palette-gray-500; - .card-split { - border-top-left-radius: 0; - border-top-right-radius: 0; + &.isDone { + color: $color-accessible-text-green; + } } } diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic/dot-experiments-configuration-traffic.component.spec.ts b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic/dot-experiments-configuration-traffic.component.spec.ts index 041b5fdcf46e..0493bc30e3e3 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic/dot-experiments-configuration-traffic.component.spec.ts +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic/dot-experiments-configuration-traffic.component.spec.ts @@ -15,6 +15,7 @@ import { Tooltip } from 'primeng/tooltip'; import { DotMessageService } from '@dotcms/data-access'; import { DotExperimentStatusList, ExperimentSteps } from '@dotcms/dotcms-models'; import { MockDotMessageService } from '@dotcms/utils-testing'; +import { DotExperimentsConfigurationTrafficSplitAddComponent } from '@portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic-split-add/dot-experiments-configuration-traffic-split-add.component'; import { DotExperimentsConfigurationStore } from '@portlets/dot-experiments/dot-experiments-configuration/store/dot-experiments-configuration-store'; import { DotExperimentsService } from '@portlets/dot-experiments/shared/services/dot-experiments.service'; import { getExperimentMock } from '@portlets/dot-experiments/test/mocks'; @@ -67,18 +68,37 @@ describe('DotExperimentsConfigurationTrafficComponent', () => { }); it('should render split and allocation rows', () => { - expect(spectator.queryAll(Card).length).toEqual(3); + expect(spectator.queryAll(Card).length).toEqual(2); expect(spectator.query(byTestId('traffic-card-title'))).toHaveText('Traffic'); expect(spectator.query(byTestId('traffic-allocation-button'))).toExist(); - expect(spectator.query(byTestId('traffic-split-title'))).toHaveText('Split'); - expect(spectator.query(byTestId('traffic-split-change-button'))).toExist(); + expect(spectator.query(byTestId('traffic-step-done'))).toHaveClass('isDone'); + }); + + it('should render indicator in gray', () => { + dotExperimentsService.getById.and.returnValue( + of({ ...EXPERIMENT_MOCK, ...{ trafficAllocation: null } }) + ); + + store.loadExperiment(EXPERIMENT_MOCK.id); + spectator.detectChanges(); + + expect(spectator.query(byTestId('traffic-step-done'))).not.toHaveClass('isDone'); }); it('should open sidebar of traffic allocation', () => { spyOn(store, 'openSidebar'); spectator.click(byTestId('traffic-allocation-button')); - expect(store.openSidebar).toHaveBeenCalledOnceWith(ExperimentSteps.TRAFFIC); + expect(store.openSidebar).toHaveBeenCalledOnceWith(ExperimentSteps.TRAFFIC_LOAD); + }); + + it('should open sidebar of traffic split', () => { + //tested this way because the sidebar is called from variant component + store.setSidebarStatus({ + experimentStep: ExperimentSteps.TRAFFICS_SPLIT, + isOpen: true + }); + expect(spectator.query(DotExperimentsConfigurationTrafficSplitAddComponent)).toExist(); }); it('should disable tooltip if is on draft', () => { @@ -98,9 +118,7 @@ describe('DotExperimentsConfigurationTrafficComponent', () => { spectator.detectChanges(); expect(spectator.query(byTestId('traffic-allocation-button'))).toHaveAttribute('disabled'); - expect(spectator.query(byTestId('traffic-split-change-button'))).toHaveAttribute( - 'disabled' - ); + expect(spectator.query(Tooltip).disabled).toEqual(false); }); }); diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic/dot-experiments-configuration-traffic.component.ts b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic/dot-experiments-configuration-traffic.component.ts index c4b4d3077d25..9409740c6ec4 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic/dot-experiments-configuration-traffic.component.ts +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-traffic/dot-experiments-configuration-traffic.component.ts @@ -10,8 +10,8 @@ import { TooltipModule } from 'primeng/tooltip'; import { tap } from 'rxjs/operators'; import { - ExperimentSteps, ComponentStatus, + ExperimentSteps, StepStatus, TrafficProportion, TrafficProportionTypes @@ -23,11 +23,6 @@ import { DotExperimentsConfigurationTrafficSplitAddComponent } from '@portlets/d import { DotExperimentsConfigurationStore } from '@portlets/dot-experiments/dot-experiments-configuration/store/dot-experiments-configuration-store'; import { DotDynamicDirective } from '@portlets/shared/directives/dot-dynamic.directive'; -enum TrafficConfig { - ALLOCATION = 'ALLOCATION', - SPLIT = 'SPLIT' -} - @Component({ selector: 'dot-experiments-configuration-traffic', standalone: true, @@ -63,7 +58,6 @@ export class DotExperimentsConfigurationTrafficComponent { | DotExperimentsConfigurationTrafficAllocationAddComponent | DotExperimentsConfigurationTrafficSplitAddComponent >; - private trafficConfig: TrafficConfig; constructor( private readonly dotExperimentsConfigurationStore: DotExperimentsConfigurationStore @@ -75,22 +69,11 @@ export class DotExperimentsConfigurationTrafficComponent { * @memberof DotExperimentsConfigurationTrafficComponent */ changeTrafficAllocation() { - this.trafficConfig = TrafficConfig.ALLOCATION; - this.dotExperimentsConfigurationStore.openSidebar(ExperimentSteps.TRAFFIC); - } - - /** - * Open sidebar to set Traffic Proportion - * @returns void - * @memberof DotExperimentsConfigurationTrafficComponent - */ - changeTrafficProportion() { - this.trafficConfig = TrafficConfig.SPLIT; - this.dotExperimentsConfigurationStore.openSidebar(ExperimentSteps.TRAFFIC); + this.dotExperimentsConfigurationStore.openSidebar(ExperimentSteps.TRAFFIC_LOAD); } private handleSidebar(status: StepStatus) { - if (status && status.isOpen) { + if (status && status.isOpen && status.status != ComponentStatus.SAVING) { this.loadSidebarComponent(status); } else { this.removeSidebarComponent(); @@ -98,18 +81,15 @@ export class DotExperimentsConfigurationTrafficComponent { } private loadSidebarComponent(status: StepStatus): void { - if (status && status.isOpen && status.status != ComponentStatus.SAVING) { - this.sidebarHost.viewContainerRef.clear(); - - this.componentRef = - this.trafficConfig == TrafficConfig.SPLIT - ? this.sidebarHost.viewContainerRef.createComponent( - DotExperimentsConfigurationTrafficSplitAddComponent - ) - : this.sidebarHost.viewContainerRef.createComponent( - DotExperimentsConfigurationTrafficAllocationAddComponent - ); - } + this.sidebarHost.viewContainerRef.clear(); + this.componentRef = + status.experimentStep == ExperimentSteps.TRAFFICS_SPLIT + ? this.sidebarHost.viewContainerRef.createComponent( + DotExperimentsConfigurationTrafficSplitAddComponent + ) + : this.sidebarHost.viewContainerRef.createComponent( + DotExperimentsConfigurationTrafficAllocationAddComponent + ); } private removeSidebarComponent() { diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-variants-add/dot-experiments-configuration-variants-add.component.html b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-variants-add/dot-experiments-configuration-variants-add.component.html index 3a069bcfbf2b..e49ae6bb7e3a 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-variants-add/dot-experiments-configuration-variants-add.component.html +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-variants-add/dot-experiments-configuration-variants-add.component.html @@ -1,53 +1,55 @@ - - + + + -
-
-
- - - -
-
-
-
+
+
+
+ + + +
+
+
+
- - - + + + +
diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-variants-add/dot-experiments-configuration-variants-add.component.spec.ts b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-variants-add/dot-experiments-configuration-variants-add.component.spec.ts index 462dca7a50c1..a0155cfc152c 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-variants-add/dot-experiments-configuration-variants-add.component.spec.ts +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-variants-add/dot-experiments-configuration-variants-add.component.spec.ts @@ -1,4 +1,5 @@ import { byTestId, createComponentFactory, mockProvider, Spectator } from '@ngneat/spectator'; +import { of } from 'rxjs'; import { CommonModule } from '@angular/common'; import { ReactiveFormsModule } from '@angular/forms'; @@ -11,8 +12,12 @@ import { SidebarModule } from 'primeng/sidebar'; import { DotFieldValidationMessageModule } from '@components/_common/dot-field-validation-message/dot-file-validation-message.module'; import { DotMessageService } from '@dotcms/data-access'; +import { ComponentStatus, ExperimentSteps } from '@dotcms/dotcms-models'; import { MockDotMessageService } from '@dotcms/utils-testing'; +import { DotExperimentsConfigurationStore } from '@portlets/dot-experiments/dot-experiments-configuration/store/dot-experiments-configuration-store'; +import { DotExperimentsService } from '@portlets/dot-experiments/shared/services/dot-experiments.service'; import { DotSidebarDirective } from '@portlets/shared/directives/dot-sidebar.directive'; +import { DotHttpErrorManagerService } from '@services/dot-http-error-manager/dot-http-error-manager.service'; import { DotSidebarHeaderComponent } from '@shared/dot-sidebar-header/dot-sidebar-header.component'; import { DotExperimentsConfigurationVariantsAddComponent } from './dot-experiments-configuration-variants-add.component'; @@ -24,6 +29,7 @@ const messageServiceMock = new MockDotMessageService({ describe('DotExperimentsConfigurationVariantsAddComponent', () => { let spectator: Spectator; + let store: DotExperimentsConfigurationStore; const createComponent = createComponentFactory({ imports: [ @@ -40,6 +46,9 @@ describe('DotExperimentsConfigurationVariantsAddComponent', () => { ], component: DotExperimentsConfigurationVariantsAddComponent, providers: [ + DotExperimentsConfigurationStore, + mockProvider(DotExperimentsService), + mockProvider(DotHttpErrorManagerService), { provide: DotMessageService, useValue: messageServiceMock @@ -50,16 +59,31 @@ describe('DotExperimentsConfigurationVariantsAddComponent', () => { beforeEach(() => { spectator = createComponent({ - props: { isSidebarOpen: true } + detectChanges: false }); + + store = spectator.inject(DotExperimentsConfigurationStore); + + spectator.component.vm$ = of({ + experimentId: '1', + trafficProportion: null, + status: { + status: ComponentStatus.IDLE, + isOpen: true, + experimentStep: ExperimentSteps.VARIANTS + }, + isExperimentADraft: true + }); + + spectator.detectChanges(); }); it('should have a form', () => { expect(spectator.query(byTestId('new-variant-form'))).toExist(); }); - it('should call saveForm() on add button click and form valid', () => { - let formValuesOutput; + it('should saveForm when form is valid', () => { + spyOn(store, 'addVariant'); const formValues = { name: 'name' @@ -74,11 +98,9 @@ describe('DotExperimentsConfigurationVariantsAddComponent', () => { expect(submitButton).toContainText('Add'); expect(spectator.component.form.valid).toBeTrue(); - spectator.output('formValues').subscribe((result) => (formValuesOutput = result)); - spectator.click(submitButton); - expect(formValuesOutput).toEqual(formValues); + expect(store.addVariant).toHaveBeenCalledWith({ name: 'name', experimentId: '1' }); }); it('should disable submit button if the form is invalid', () => { diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-variants-add/dot-experiments-configuration-variants-add.component.ts b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-variants-add/dot-experiments-configuration-variants-add.component.ts index 7c271d2130a7..daa32e948ed4 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-variants-add/dot-experiments-configuration-variants-add.component.ts +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-variants-add/dot-experiments-configuration-variants-add.component.ts @@ -1,12 +1,7 @@ +import { Observable } from 'rxjs'; + import { CommonModule } from '@angular/common'; -import { - ChangeDetectionStrategy, - Component, - EventEmitter, - Input, - OnInit, - Output -} from '@angular/core'; +import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms'; import { ButtonModule } from 'primeng/button'; @@ -15,8 +10,9 @@ import { SidebarModule } from 'primeng/sidebar'; import { DotFieldValidationMessageModule } from '@components/_common/dot-field-validation-message/dot-file-validation-message.module'; import { DotAutofocusModule } from '@directives/dot-autofocus/dot-autofocus.module'; -import { DotExperiment } from '@dotcms/dotcms-models'; +import { ComponentStatus, StepStatus, TrafficProportion } from '@dotcms/dotcms-models'; import { DotMessagePipeModule } from '@pipes/dot-message/dot-message-pipe.module'; +import { DotExperimentsConfigurationStore } from '@portlets/dot-experiments/dot-experiments-configuration/store/dot-experiments-configuration-store'; import { DotSidebarDirective } from '@portlets/shared/directives/dot-sidebar.directive'; import { DotSidebarHeaderComponent } from '@shared/dot-sidebar-header/dot-sidebar-header.component'; @@ -43,39 +39,46 @@ import { DotSidebarHeaderComponent } from '@shared/dot-sidebar-header/dot-sideba changeDetection: ChangeDetectionStrategy.OnPush }) export class DotExperimentsConfigurationVariantsAddComponent implements OnInit { - @Input() - isSaving = false; - - @Input() - isSidebarOpen: boolean; - - /** - * Emit when the sidebar is closed - */ - @Output() - closedSidebar = new EventEmitter(); - - /** - * Emit a valid form values - */ - @Output() - formValues = new EventEmitter>(); + stepStatus = ComponentStatus; form: FormGroup; - saveForm(): void { - const formValues = this.form.value as Pick; - this.formValues.emit(formValues); - this.closedSidebarEvent(); - } + vm$: Observable<{ + experimentId: string; + trafficProportion: TrafficProportion; + status: StepStatus; + isExperimentADraft: boolean; + }> = this.dotExperimentsConfigurationStore.variantsStepVm$; + + constructor( + private readonly dotExperimentsConfigurationStore: DotExperimentsConfigurationStore + ) {} ngOnInit(): void { this.initForm(); } - closedSidebarEvent() { + /** + * Save variant + * @param {string} experimentId + * @returns void + * @memberof DotExperimentsConfigurationVariantsAddComponent + */ + saveVariant(experimentId: string) { + this.dotExperimentsConfigurationStore.addVariant({ + name: this.form.value.name, + experimentId + }); this.form.reset(); - this.closedSidebar.emit(true); + } + + /** + * Close sidebar + * @returns void + * @memberof DotExperimentsConfigurationVariantsAddComponent + */ + closeSidebar() { + this.dotExperimentsConfigurationStore.closeSidebar(); } private initForm() { diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-variants/dot-experiments-configuration-variants.component.html b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-variants/dot-experiments-configuration-variants.component.html index 67ed309a02f1..49461d554531 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-variants/dot-experiments-configuration-variants.component.html +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-variants/dot-experiments-configuration-variants.component.html @@ -5,21 +5,27 @@

{{ 'experiments.configure.variants.name' | dm }}

- +
@@ -50,6 +56,7 @@

- - + + + diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-variants/dot-experiments-configuration-variants.component.scss b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-variants/dot-experiments-configuration-variants.component.scss index 4946a5b9c9a3..f6ed6d3cb70e 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-variants/dot-experiments-configuration-variants.component.scss +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-variants/dot-experiments-configuration-variants.component.scss @@ -2,17 +2,17 @@ h2 { margin: 0; - font-size: $font-size-large; + font-size: $font-size-lg; font-weight: $font-weight-bold; } .variant-name dot-icon { display: inline; - color: $brand-primary; + color: $color-palette-primary; } .separator { - color: $gray-lighter; + color: $color-palette-gray-300; } button { @@ -21,10 +21,10 @@ button { :host ::ng-deep { dot-icon { - color: $gray-light; + color: $color-palette-gray-500; &.isDone { - color: $success; + color: $color-accessible-text-green; } } @@ -36,14 +36,14 @@ button { } &.first .p-card { - border-top-right-radius: $border-radius-md; - border-top-left-radius: $border-radius-md; + border-top-right-radius: $border-radius-sm; + border-top-left-radius: $border-radius-sm; } &.last .p-card { - border-bottom-right-radius: $border-radius-md; - border-bottom-left-radius: $border-radius-md; - border: 1px solid $gray-lighter; + border-bottom-right-radius: $border-radius-sm; + border-bottom-left-radius: $border-radius-sm; + border: 1px solid $color-palette-gray-300; } } diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-variants/dot-experiments-configuration-variants.component.spec.ts b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-variants/dot-experiments-configuration-variants.component.spec.ts index 09db766d267a..639b5ed21003 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-variants/dot-experiments-configuration-variants.component.spec.ts +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-variants/dot-experiments-configuration-variants.component.spec.ts @@ -7,23 +7,24 @@ import { } from '@ngneat/spectator'; import { of } from 'rxjs'; -import { MessageService } from 'primeng/api'; +import { ActivatedRoute, Router } from '@angular/router'; + +import { ConfirmationService, MessageService } from 'primeng/api'; import { ButtonModule } from 'primeng/button'; import { Card, CardModule } from 'primeng/card'; +import { ConfirmPopup, ConfirmPopupModule } from 'primeng/confirmpopup'; import { Inplace, InplaceModule } from 'primeng/inplace'; import { Tooltip, TooltipModule } from 'primeng/tooltip'; import { DotCopyButtonComponent } from '@components/dot-copy-button/dot-copy-button.component'; import { DotCopyButtonModule } from '@components/dot-copy-button/dot-copy-button.module'; -import { DotMessageService } from '@dotcms/data-access'; +import { DotMessagePipe } from '@dotcms/app/view/pipes'; +import { DotMessageService, DotSessionStorageService } from '@dotcms/data-access'; import { - ComponentStatus, DEFAULT_VARIANT_ID, DEFAULT_VARIANT_NAME, DotExperimentStatusList, - ExperimentSteps, - SIDEBAR_STATUS, - Variant + ExperimentSteps } from '@dotcms/dotcms-models'; import { MockDotMessageService } from '@dotcms/utils-testing'; import { DotExperimentsConfigurationVariantsAddComponent } from '@portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-variants-add/dot-experiments-configuration-variants-add.component'; @@ -39,9 +40,21 @@ const messageServiceMock = new MockDotMessageService({ 'experiments.configure.variants.view': 'view', 'experiments.action.edit': 'edit', 'experiments.configure.variants.delete': 'delete', - 'experiments.configure.variants.add': 'Add new variant' + 'experiments.configure.variants.add': 'Add new variant', + 'experiments.configure.scheduling.start': 'When the experiment start', + 'experiments.configure.variant.delete.confirm': 'Are you sure you want to delete this variant?', + delete: 'Delete', + 'dot.common.dialog.reject': 'Cancel' }); +const ActivatedRouteMock = { + snapshot: { + params: { + experimentId: 'test' + } + } +}; + const EXPERIMENT_MOCK = getExperimentMock(0); const EXPERIMENT_MOCK_2 = getExperimentMock(2); @@ -49,8 +62,9 @@ describe('DotExperimentsConfigurationVariantsComponent', () => { let spectator: Spectator; let store: DotExperimentsConfigurationStore; let dotExperimentsService: SpyObject; + let router: Router; - let configurationVariantsAddComponent: DotExperimentsConfigurationVariantsAddComponent; + let dotSessionStorageService: DotSessionStorageService; const createComponent = createComponentFactory({ imports: [ @@ -59,18 +73,27 @@ describe('DotExperimentsConfigurationVariantsComponent', () => { InplaceModule, DotExperimentsConfigurationVariantsAddComponent, DotCopyButtonModule, - TooltipModule + TooltipModule, + ConfirmPopupModule ], component: DotExperimentsConfigurationVariantsComponent, providers: [ DotExperimentsConfigurationStore, + ConfirmationService, + DotMessagePipe, { provide: DotMessageService, useValue: messageServiceMock }, + { + provide: ActivatedRoute, + useValue: ActivatedRouteMock + }, mockProvider(DotExperimentsService), mockProvider(MessageService), - mockProvider(DotHttpErrorManagerService) + mockProvider(DotHttpErrorManagerService), + mockProvider(DotSessionStorageService), + mockProvider(Router) ] }); @@ -80,6 +103,10 @@ describe('DotExperimentsConfigurationVariantsComponent', () => { }); store = spectator.inject(DotExperimentsConfigurationStore); + router = spectator.inject(Router); + + dotSessionStorageService = spectator.inject(DotSessionStorageService); + dotExperimentsService = spectator.inject(DotExperimentsService); dotExperimentsService.getById.and.returnValue(of(EXPERIMENT_MOCK)); @@ -89,17 +116,10 @@ describe('DotExperimentsConfigurationVariantsComponent', () => { describe('should render', () => { it('a DEFAULT variant', () => { - const variantsVm = { - variants: [{ id: DEFAULT_VARIANT_ID, name: DEFAULT_VARIANT_NAME, weight: 100 }] - }; - - spectator.setInput(variantsVm); - spectator.detectChanges(); - expect(spectator.queryAll(byTestId('variant-name')).length).toBe(1); expect(spectator.query(byTestId('variant-weight'))).toHaveText( - variantsVm.variants[0].weight + '.00% weight' + EXPERIMENT_MOCK.trafficProportion.variants[0].weight + '.00% weight' ); expect(spectator.query(byTestId('variant-preview-button'))).toExist(); @@ -107,34 +127,35 @@ describe('DotExperimentsConfigurationVariantsComponent', () => { }); it('should load the variant(s)', () => { - const variantsVm = { - variants: [ - { id: '0000000', name: DEFAULT_VARIANT_NAME, weight: 33.33, url: 'link1' }, - { id: '1111111', name: 'b', weight: 33.33, url: 'link2' }, - { id: '2222222', name: 'c', weight: 33.33, url: 'link3' } - ] - }; - - spectator.setInput(variantsVm); + const variants = [ + { + id: '0000000', + name: DEFAULT_VARIANT_NAME, + weight: 33.33, + url: 'link1' + }, + { id: '1111111', name: 'b', weight: 33.33, url: 'link2' }, + { id: '2222222', name: 'c', weight: 33.33, url: 'link3' } + ]; - spectator.detectComponentChanges(); + loadExperiment(EXPERIMENT_MOCK, variants); expect(spectator.query(byTestId('variant-title-step-done'))).toHaveClass('isDone'); expect(spectator.queryAll(Card).length).toBe(4); const variantsName = spectator.queryAll(byTestId('variant-name')); - expect(variantsName[0]).toContainText(variantsVm.variants[0].name); - expect(variantsName[1]).toContainText(variantsVm.variants[1].name); - expect(variantsName[2]).toContainText(variantsVm.variants[2].name); + expect(variantsName[0]).toContainText(variants[0].name); + expect(variantsName[1]).toContainText(variants[1].name); + expect(variantsName[2]).toContainText(variants[2].name); expect(spectator.queryAll(DotCopyButtonComponent).length).toBe(3); expect(spectator.queryAll(Inplace).length).toBe(2); const variantsWeight = spectator.queryAll(byTestId('variant-weight')); - expect(variantsWeight[0]).toContainText(variantsVm.variants[0].weight.toString()); - expect(variantsWeight[1]).toContainText(variantsVm.variants[1].weight.toString()); - expect(variantsWeight[2]).toContainText(variantsVm.variants[2].weight.toString()); + expect(variantsWeight[0]).toContainText(variants[0].weight.toString()); + expect(variantsWeight[1]).toContainText(variants[1].weight.toString()); + expect(variantsWeight[2]).toContainText(variants[2].weight.toString()); const variantsViewButton = spectator.queryAll( byTestId('variant-preview-button') @@ -167,87 +188,65 @@ describe('DotExperimentsConfigurationVariantsComponent', () => { }); describe('interactions', () => { - const variantsVm = { - variants: [ - { - id: DEFAULT_VARIANT_ID, - name: DEFAULT_VARIANT_NAME, - weight: 33.33, - url: 'link1' - }, - { id: '1111111', name: 'b', weight: 33.33, url: 'link2' } - ] - }; + const variants = [ + { + id: DEFAULT_VARIANT_ID, + name: DEFAULT_VARIANT_NAME, + weight: 33.33, + url: 'link1' + }, + { id: '1111111', name: 'test', weight: 33.33, url: 'link2' } + ]; beforeEach(() => { - spectator.setInput(variantsVm); - - spectator.detectChanges(); - configurationVariantsAddComponent = spectator.query( - DotExperimentsConfigurationVariantsAddComponent - ); + loadExperiment(EXPERIMENT_MOCK, variants); }); - it('should sidebarStatusChanged emit OPEN when add new variant button is enable and clicked', () => { - let output; - spectator.output('sidebarStatusChanged').subscribe((result) => (output = result)); - - const addButton = spectator.query(byTestId('variant-add-button')) as HTMLButtonElement; + it('should open sideBar to add a variant ', () => { + spyOn(store, 'openSidebar'); + spectator.click(byTestId('variant-add-button')); - expect(addButton.disabled).not.toBe(true); - spectator.click(addButton); - expect(output).toEqual(SIDEBAR_STATUS.OPEN); + expect(store.openSidebar).toHaveBeenCalledWith(ExperimentSteps.VARIANTS); }); - it('should goToEditPage emit a variant and mode(preview) when View button is clicked', () => { - let output; - spectator.output('goToEditPage').subscribe((result) => (output = result)); - - const viewButton = spectator.query( - byTestId('variant-preview-button') - ) as HTMLButtonElement; + it('should open sideBar to edit the variant weight ', () => { + spyOn(store, 'openSidebar'); + spectator.click(byTestId('variant-weight')); - expect(viewButton.disabled).not.toBe(true); - spectator.click(viewButton); + expect(store.openSidebar).toHaveBeenCalledWith(ExperimentSteps.TRAFFICS_SPLIT); + }); - expect(output).toEqual({ variant: variantsVm.variants[0], mode: 'preview' }); + it('should goToEditPage emit a variant and mode(preview) when View button is clicked', () => { + spectator.click(byTestId('variant-preview-button')); + + expect(dotSessionStorageService.setVariationId).toHaveBeenCalledWith(variants[0].id); + expect(router.navigate).toHaveBeenCalledWith(['edit-page/content'], { + queryParams: { + editPageTab: 'preview', + variantName: variants[0].id, + experimentId: 'test' + }, + queryParamsHandling: 'merge' + }); }); it('should goToEditPage emit a variant and mode(edit) when edit button is clicked', () => { - let output; - spectator.output('goToEditPage').subscribe((result) => (output = result)); - - const viewButton = spectator.query( - byTestId('variant-edit-button') - ) as HTMLButtonElement; - - expect(viewButton.disabled).not.toBe(true); - spectator.click(viewButton); - - expect(output).toEqual({ variant: variantsVm.variants[1], mode: 'edit' }); + spectator.click(byTestId('variant-edit-button')); + + expect(dotSessionStorageService.setVariationId).toHaveBeenCalledWith(variants[1].id); + expect(router.navigate).toHaveBeenCalledWith(['edit-page/content'], { + queryParams: { + editPageTab: 'edit', + variantName: variants[1].id, + experimentId: 'test' + }, + queryParamsHandling: 'merge' + }); }); it('should edit output emit the new name', () => { - spectator.component.vm$ = of({ - status: { - status: ComponentStatus.IDLE, - isOpen: false, - experimentStep: ExperimentSteps.GOAL - }, - isExperimentADraft: true - }); + spyOn(store, 'editVariant'); const newVariantName = 'new name'; - const variants: Variant[] = [ - { id: '1', name: DEFAULT_VARIANT_NAME, weight: 50, url: 'url' }, - { id: '2', name: 'to edit', weight: 50, url: 'url' } - ]; - - let output; - spectator.output('edit').subscribe((result) => (output = result)); - - spectator.setInput({ - variants - }); spectator.query(Inplace).activate(); @@ -262,35 +261,19 @@ describe('DotExperimentsConfigurationVariantsComponent', () => { spectator.detectComponentChanges(); expect(viewButton.disabled).not.toBe(true); - spectator.detectComponentChanges(); spectator.click(viewButton); spectator.detectComponentChanges(); - expect(output).toEqual({ ...variants[1], name: newVariantName }); + expect(store.editVariant).toHaveBeenCalledWith({ + data: { ...variants[1], name: newVariantName }, + experimentId: EXPERIMENT_MOCK.id + }); }); it('should save when press enter', () => { - spyOn(spectator.component, 'editVariantName'); - - spectator.component.vm$ = of({ - status: { - status: ComponentStatus.IDLE, - isOpen: false, - experimentStep: ExperimentSteps.GOAL - }, - isExperimentADraft: true - }); - - const variants: Variant[] = [ - { id: '1', name: DEFAULT_VARIANT_NAME, weight: 50, url: 'url' }, - { id: '2', name: 'to edit', weight: 50, url: 'url' } - ]; - - spectator.setInput({ - variants - }); + spyOn(store, 'editVariant'); spectator.query(Inplace).activate(); @@ -304,60 +287,25 @@ describe('DotExperimentsConfigurationVariantsComponent', () => { spectator.detectComponentChanges(); - expect(spectator.component.editVariantName).toHaveBeenCalledWith( - 'new value', - variants[1] - ); - }); - - it('should the button of save show loading when is SAVING', () => { - spectator.query(Inplace).activate(); - - spectator.component.vm$ = of({ - status: { - status: ComponentStatus.SAVING, - isOpen: false, - experimentStep: ExperimentSteps.GOAL - }, - isExperimentADraft: true + expect(store.editVariant).toHaveBeenCalledWith({ + data: { ...variants[1], name: 'new value' }, + experimentId: EXPERIMENT_MOCK.id }); - - spectator.detectComponentChanges(); - const viewButton = spectator.query( - byTestId('variant-save-name-btn') - ) as HTMLButtonElement; - - expect(viewButton).toHaveClass('p-disabled p-button-loading'); }); - it('should delete a variant', () => { - let output; - spectator.output('delete').subscribe((result) => (output = result)); - - const deleteButtons = spectator.queryAll( - byTestId('variant-delete-button') - ) as HTMLButtonElement[]; - - expect(deleteButtons[0].disabled).toBe(true); - expect(deleteButtons[1].disabled).not.toBe(true); - spectator.click(deleteButtons[1]); + it('should confirm before delete a variant', () => { + spyOn(store, 'deleteVariant'); - expect(output).toEqual({ - $event: new PointerEvent('click'), - variant: variantsVm.variants[1] - }); - }); + const button = spectator.queryLast(byTestId('variant-delete-button')); - it('should emit a the form values when when save', () => { - let output; - const variantForm = { name: 'Variant Name' }; - spectator.output('save').subscribe((result) => (output = result)); + spectator.click(button); - configurationVariantsAddComponent.form.patchValue(variantForm); - configurationVariantsAddComponent.saveForm(); - spectator.detectChanges(); + spectator.query(ConfirmPopup).accept(); - expect(output).toEqual(variantForm); + expect(store.deleteVariant).toHaveBeenCalledWith({ + experimentId: '111', + variant: variants[1] + }); }); it('should disable tooltip if is on draft', () => { @@ -398,7 +346,7 @@ describe('DotExperimentsConfigurationVariantsComponent', () => { expect(enableTooltips.length).toEqual(4); }); - it('should view button on all variants when experiment is nos on draft', () => { + it('should view button on all variants when experiment is not on draft', () => { dotExperimentsService.getById.and.returnValue( of({ ...EXPERIMENT_MOCK_2, @@ -417,4 +365,19 @@ describe('DotExperimentsConfigurationVariantsComponent', () => { expect(variantsViewButton.length).toBe(2); }); }); + + function loadExperiment(mock, variants) { + dotExperimentsService.getById.and.returnValue( + of({ + ...mock, + trafficProportion: { + ...mock.trafficProportion, + variants: variants + } + }) + ); + + store.loadExperiment(mock.id); + spectator.detectComponentChanges(); + } }); diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-variants/dot-experiments-configuration-variants.component.ts b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-variants/dot-experiments-configuration-variants.component.ts index 81cf75fd773b..f04a8aa83718 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-variants/dot-experiments-configuration-variants.component.ts +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-variants/dot-experiments-configuration-variants.component.ts @@ -1,26 +1,33 @@ import { Observable } from 'rxjs'; import { CommonModule } from '@angular/common'; -import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core'; +import { ChangeDetectionStrategy, Component, ComponentRef, ViewChild } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { ConfirmationService } from 'primeng/api'; import { ButtonModule } from 'primeng/button'; import { CardModule } from 'primeng/card'; +import { ConfirmPopupModule } from 'primeng/confirmpopup'; import { InplaceModule } from 'primeng/inplace'; import { InputTextModule } from 'primeng/inputtext'; import { TooltipModule } from 'primeng/tooltip'; +import { tap } from 'rxjs/operators'; + import { UiDotIconButtonModule } from '@components/_common/dot-icon-button/dot-icon-button.module'; import { UiDotIconButtonTooltipModule } from '@components/_common/dot-icon-button-tooltip/dot-icon-button-tooltip.module'; import { DotCopyButtonModule } from '@components/dot-copy-button/dot-copy-button.module'; +import { DotMessagePipe } from '@dotcms/app/view/pipes'; +import { DotSessionStorageService } from '@dotcms/data-access'; import { ComponentStatus, DEFAULT_VARIANT_NAME, - DotExperiment, EditPageTabs, ExperimentSteps, MAX_VARIANTS_ALLOWED, SIDEBAR_STATUS, StepStatus, + TrafficProportion, Variant } from '@dotcms/dotcms-models'; import { DotIconModule } from '@dotcms/ui'; @@ -28,6 +35,7 @@ import { DotMessagePipeModule } from '@pipes/dot-message/dot-message-pipe.module import { DotExperimentsConfigurationItemsCountComponent } from '@portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-items-count/dot-experiments-configuration-items-count.component'; import { DotExperimentsConfigurationVariantsAddComponent } from '@portlets/dot-experiments/dot-experiments-configuration/components/dot-experiments-configuration-variants-add/dot-experiments-configuration-variants-add.component'; import { DotExperimentsConfigurationStore } from '@portlets/dot-experiments/dot-experiments-configuration/store/dot-experiments-configuration-store'; +import { DotDynamicDirective } from '@portlets/shared/directives/dot-dynamic.directive'; @Component({ selector: 'dot-experiments-configuration-variants', @@ -41,47 +49,145 @@ import { DotExperimentsConfigurationStore } from '@portlets/dot-experiments/dot- DotExperimentsConfigurationVariantsAddComponent, DotCopyButtonModule, DotExperimentsConfigurationItemsCountComponent, + DotDynamicDirective, //PrimeNg CardModule, InplaceModule, ButtonModule, InputTextModule, - TooltipModule + TooltipModule, + ConfirmPopupModule ], templateUrl: './dot-experiments-configuration-variants.component.html', styleUrls: ['./dot-experiments-configuration-variants.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush }) export class DotExperimentsConfigurationVariantsComponent { - vm$: Observable<{ status: StepStatus; isExperimentADraft: boolean }> = - this.dotExperimentsConfigurationStore.variantsStepVm$; + vm$: Observable<{ + experimentId: string; + trafficProportion: TrafficProportion; + status: StepStatus; + isExperimentADraft: boolean; + }> = this.dotExperimentsConfigurationStore.variantsStepVm$.pipe( + tap(({ status }) => this.handleSidebar(status)) + ); + statusList = ComponentStatus; sidebarStatusList = SIDEBAR_STATUS; maxVariantsAllowed = MAX_VARIANTS_ALLOWED; defaultVariantName = DEFAULT_VARIANT_NAME; experimentStepName = ExperimentSteps.VARIANTS; - @Input() variants: Variant[]; - @Output() sidebarStatusChanged = new EventEmitter(); - @Output() delete = new EventEmitter<{ $event: MouseEvent; variant: Variant }>(); - @Output() edit = new EventEmitter>(); - @Output() save = new EventEmitter>(); - @Output() goToEditPage = new EventEmitter<{ variant: Variant; mode: EditPageTabs }>(); + @ViewChild(DotDynamicDirective, { static: true }) sidebarHost!: DotDynamicDirective; + + private componentRef: ComponentRef; constructor( - private readonly dotExperimentsConfigurationStore: DotExperimentsConfigurationStore + private readonly dotExperimentsConfigurationStore: DotExperimentsConfigurationStore, + private readonly confirmationService: ConfirmationService, + private readonly dotMessagePipe: DotMessagePipe, + private readonly dotSessionStorageService: DotSessionStorageService, + private readonly router: Router, + private readonly route: ActivatedRoute ) {} /** * Edit the name of the selected variant * @param {string} newVariantName * @param {Variant} variant + * @param {string} experimentId + * @memberof DotExperimentsConfigurationVariantsComponent + */ + editVariantName(newVariantName: string, variant: Variant, experimentId: string) { + this.dotExperimentsConfigurationStore.editVariant({ + data: { + ...variant, + name: newVariantName + }, + experimentId + }); + } + + /** + * Open sidebar to Add a new Variant + * @returns void + * @memberof DotExperimentsConfigurationVariantsComponent + */ + addVariant() { + this.dotExperimentsConfigurationStore.openSidebar(ExperimentSteps.VARIANTS); + } + + /** + * Open sidebar to set Traffic Proportion + * @returns void + * @memberof DotExperimentsConfigurationVariantsComponent + */ + changeTrafficProportion() { + this.dotExperimentsConfigurationStore.openSidebar(ExperimentSteps.TRAFFICS_SPLIT); + } + + /** + * Delete a specific variant + * @param {{ $event: MouseEvent; variant: Variant }} event + * @param {string} experimentId + * @returns void + * @memberof DotExperimentsConfigurationVariantsComponent + */ + deleteVariant(event: { $event: MouseEvent; variant: Variant }, experimentId: string) { + this.confirmationService.confirm({ + target: event.$event.target, + message: this.dotMessagePipe.transform('experiments.configure.variant.delete.confirm'), + icon: 'pi pi-exclamation-triangle', + acceptLabel: this.dotMessagePipe.transform('delete'), + rejectLabel: this.dotMessagePipe.transform('dot.common.dialog.reject'), + accept: () => { + this.dotExperimentsConfigurationStore.deleteVariant({ + experimentId, + variant: event.variant + }); + } + }); + } + + /** + * Go to Edit Page / Content, set the VariantId to SessionStorage + * @param {Variant} variant + * @param {EditPageTabs} mode + * @returns void + * @memberof DotExperimentsConfigurationVariantsComponent */ - editVariantName(newVariantName: string, variant: Variant) { - this.edit.emit({ - ...variant, - name: newVariantName + goToEditPageVariant(variant: Variant, mode: EditPageTabs) { + this.dotSessionStorageService.setVariationId(variant.id); + this.router.navigate(['edit-page/content'], { + queryParams: { + editPageTab: mode, + variantName: variant.id, + experimentId: this.route.snapshot.params.experimentId + }, + queryParamsHandling: 'merge' }); } + + private handleSidebar(status: StepStatus) { + if (status && status.isOpen && status.status != ComponentStatus.SAVING) { + this.loadSidebarComponent(); + } else { + this.removeSidebarComponent(); + } + } + + private loadSidebarComponent(): void { + this.sidebarHost.viewContainerRef.clear(); + this.componentRef = + this.sidebarHost.viewContainerRef.createComponent( + DotExperimentsConfigurationVariantsAddComponent + ); + } + + private removeSidebarComponent() { + if (this.componentRef) { + this.sidebarHost.viewContainerRef.clear(); + } + } } diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/dot-experiments-configuration.component.html b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/dot-experiments-configuration.component.html index c4a700038ec2..e4ce8ed8106e 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/dot-experiments-configuration.component.html +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-experiments/dot-experiments-configuration/dot-experiments-configuration.component.html @@ -1,16 +1,12 @@ -
- - - +
-