From 0e8a186fe711bd3bc4fe631f98ccf35459b4c94c Mon Sep 17 00:00:00 2001 From: Vadim73i <55870906+Vadim73i@users.noreply.github.com> Date: Mon, 27 Jun 2022 18:55:09 +0400 Subject: [PATCH 01/23] EPMRPP-77870 || Launch description (#3154) * EPMRPP-77870 || Launch description * EPMRPP-77870 || code review 1 --- .../main/absRelTime/absRelTime.scss | 2 +- .../gridRow/checkboxCell/checkboxCell.jsx | 7 +++- .../gridRow/checkboxCell/checkboxCell.scss | 1 + .../gridBody/gridRow/gridCell/gridCell.jsx | 4 ++ .../main/grid/gridBody/gridRow/gridRow.jsx | 40 ++++++++++++++++++- .../main/grid/gridBody/gridRow/gridRow.scss | 21 ++++++++++ .../tables/launchesTable/launchesTable.jsx | 34 +++++++++++----- .../tables/launchesTable/launchesTable.scss | 14 +++++++ .../attributesBlock/attributesBlock.scss | 1 + .../pages/inside/common/itemInfo/itemInfo.jsx | 5 ++- .../inside/common/itemInfo/itemInfo.scss | 2 +- .../launchSuiteGrid/launchSuiteGrid.jsx | 16 +++++--- .../launchSuiteGrid/launchSuiteGrid.scss | 22 +++++++++- 13 files changed, 148 insertions(+), 21 deletions(-) diff --git a/app/src/components/main/absRelTime/absRelTime.scss b/app/src/components/main/absRelTime/absRelTime.scss index e930a76af6..f0f3398eb6 100644 --- a/app/src/components/main/absRelTime/absRelTime.scss +++ b/app/src/components/main/absRelTime/absRelTime.scss @@ -16,7 +16,7 @@ .abs-rel-time { display: inline-block; - min-height: 38px; + min-height: 40px; cursor: pointer; font-family: $FONT-REGULAR; font-size: 13px; diff --git a/app/src/components/main/grid/gridBody/gridRow/checkboxCell/checkboxCell.jsx b/app/src/components/main/grid/gridBody/gridRow/checkboxCell/checkboxCell.jsx index 66bc9ad71d..502ecc2840 100644 --- a/app/src/components/main/grid/gridBody/gridRow/checkboxCell/checkboxCell.jsx +++ b/app/src/components/main/grid/gridBody/gridRow/checkboxCell/checkboxCell.jsx @@ -25,10 +25,11 @@ export const CheckboxCell = ({ className, value, customProps: { selected, onChange, disabled }, + rowSpan, }) => ( -
+ onChange(value)} disabled={disabled} /> -
+ ); CheckboxCell.propTypes = { className: PropTypes.string, @@ -38,8 +39,10 @@ CheckboxCell.propTypes = { disabled: PropTypes.bool, onChange: PropTypes.func, }), + rowSpan: PropTypes.number, }; CheckboxCell.defaultProps = { className: '', customProps: {}, + rowSpan: 1, }; diff --git a/app/src/components/main/grid/gridBody/gridRow/checkboxCell/checkboxCell.scss b/app/src/components/main/grid/gridBody/gridRow/checkboxCell/checkboxCell.scss index 7702ee426c..76966c31d2 100644 --- a/app/src/components/main/grid/gridBody/gridRow/checkboxCell/checkboxCell.scss +++ b/app/src/components/main/grid/gridBody/gridRow/checkboxCell/checkboxCell.scss @@ -18,6 +18,7 @@ width: 1%; padding-top: 30px; padding-right: 20px; + height: 100%; @media (max-width: $SCREEN_SM_MAX) { display: none; diff --git a/app/src/components/main/grid/gridBody/gridRow/gridCell/gridCell.jsx b/app/src/components/main/grid/gridBody/gridRow/gridCell/gridCell.jsx index 5f05ee8a95..5f7ad469b3 100644 --- a/app/src/components/main/grid/gridBody/gridRow/gridCell/gridCell.jsx +++ b/app/src/components/main/grid/gridBody/gridRow/gridCell/gridCell.jsx @@ -45,6 +45,7 @@ export class GridCell extends PureComponent { refFunction: PropTypes.func, expanded: PropTypes.bool, toggleExpand: PropTypes.func, + rowSpan: PropTypes.number, }; static defaultProps = { @@ -56,6 +57,7 @@ export class GridCell extends PureComponent { refFunction: () => {}, expanded: false, toggleExpand: () => {}, + rowSpan: 1, }; render() { @@ -70,6 +72,7 @@ export class GridCell extends PureComponent { customProps, expanded, toggleExpand, + rowSpan, } = this.props; const CellComponent = component; return ( @@ -82,6 +85,7 @@ export class GridCell extends PureComponent { customProps={customProps} expanded={expanded} toggleExpand={toggleExpand} + rowSpan={rowSpan} /> ); } diff --git a/app/src/components/main/grid/gridBody/gridRow/gridRow.jsx b/app/src/components/main/grid/gridBody/gridRow/gridRow.jsx index 6f08f59a5a..dbff3003b4 100644 --- a/app/src/components/main/grid/gridBody/gridRow/gridRow.jsx +++ b/app/src/components/main/grid/gridBody/gridRow/gridRow.jsx @@ -18,6 +18,7 @@ import React, { Component } from 'react'; import track from 'react-tracking'; import PropTypes from 'prop-types'; import classNames from 'classnames/bind'; +import { MarkdownViewer } from 'components/main/markdown'; import { LOG_MESSAGE_HIGHLIGHT_TIMEOUT } from '../../constants'; import { columnPropTypes } from '../../propTypes'; import { GridCell } from './gridCell'; @@ -25,6 +26,7 @@ import { CheckboxCell } from './checkboxCell'; import styles from './gridRow.scss'; const cx = classNames.bind(styles); +const DESCRIPTION_INITIAL_HEIGHT = 80; @track() export class GridRow extends Component { @@ -50,6 +52,10 @@ export class GridRow extends Component { excludeFromSelection: PropTypes.arrayOf(PropTypes.object), gridRowClassName: PropTypes.string, level: PropTypes.number, + descriptionConfig: PropTypes.shape({ + colSpan: PropTypes.number, + className: PropTypes.string, + }), }; static defaultProps = { @@ -70,6 +76,7 @@ export class GridRow extends Component { excludeFromSelection: [], gridRowClassName: '', level: 0, + descriptionConfig: null, }; state = { @@ -116,6 +123,7 @@ export class GridRow extends Component { }; rowRef = React.createRef(); + descriptionRef = React.createRef(); highLightGridRow() { this.rowRef.current.scrollIntoView({ behavior: 'smooth', block: 'center' }); @@ -134,7 +142,11 @@ export class GridRow extends Component { return; } - if (this.overflowCell.offsetHeight > this.overflowCellMaxHeight) { + if ( + this.overflowCell.offsetHeight > this.overflowCellMaxHeight || + (this.descriptionRef.current && + this.descriptionRef.current.offsetHeight > DESCRIPTION_INITIAL_HEIGHT) + ) { !this.state.withAccordion && this.setupAccordion(); } else if (this.overflowCell.offsetHeight < this.overflowCellMaxHeight) { this.state.withAccordion && this.removeAccordion(); @@ -165,6 +177,7 @@ export class GridRow extends Component { rowClassMapper, gridRowClassName, level, + descriptionConfig, } = this.props; const { expanded } = this.state; @@ -214,6 +227,7 @@ export class GridRow extends Component { customProps={column.customProps} expanded={expanded} toggleExpand={this.toggleAccordion} + rowSpan={descriptionConfig ? column.rowSpan : null} /> ); if (level && i === 0) { @@ -241,9 +255,33 @@ export class GridRow extends Component { selected: this.isItemSelected(), onChange: this.props.onToggleSelection, }} + rowSpan={descriptionConfig ? 2 : null} /> )} + {descriptionConfig && !!value.description && ( + + +
+ +
+ + + )} {this.state.withAccordion && (
diff --git a/app/src/components/main/grid/gridBody/gridRow/gridRow.scss b/app/src/components/main/grid/gridBody/gridRow/gridRow.scss index 53dfa7db14..5347e99897 100644 --- a/app/src/components/main/grid/gridBody/gridRow/gridRow.scss +++ b/app/src/components/main/grid/gridBody/gridRow/gridRow.scss @@ -300,3 +300,24 @@ $LEVEL_OFFSET_STEP: 20px; border-left-style: solid; @include levels-desktop; } + +.description-cell { + overflow: hidden; + background-color: transparent; + transition: background-color 2s ease; + padding-bottom: 30px; + &.highlight { + background-color: $COLOR--go-to-stack-trace; + transition: background-color 0.01s linear; + } +} + +.description { + word-break: break-word; +} + +@media (max-width: $SCREEN_SM_MAX) { + .description-row { + display: none; + } +} diff --git a/app/src/components/widgets/singleLevelWidgets/tables/launchesTable/launchesTable.jsx b/app/src/components/widgets/singleLevelWidgets/tables/launchesTable/launchesTable.jsx index 6ad08341ec..b1faa6dcb6 100644 --- a/app/src/components/widgets/singleLevelWidgets/tables/launchesTable/launchesTable.jsx +++ b/app/src/components/widgets/singleLevelWidgets/tables/launchesTable/launchesTable.jsx @@ -90,14 +90,25 @@ const NameColumn = ( }; return ( -
- -
+ <> +
+ +
+
+ +
+ ); }; NameColumn.propTypes = { @@ -318,11 +329,16 @@ export class LaunchesTable extends PureComponent { render() { const { result } = this.props.widget.content; + const data = result.map((item) => ({ ...item, description: item.values.description })); const columns = this.getColumns(); return ( - + ); } diff --git a/app/src/components/widgets/singleLevelWidgets/tables/launchesTable/launchesTable.scss b/app/src/components/widgets/singleLevelWidgets/tables/launchesTable/launchesTable.scss index e19fef4f5d..286032b37a 100644 --- a/app/src/components/widgets/singleLevelWidgets/tables/launchesTable/launchesTable.scss +++ b/app/src/components/widgets/singleLevelWidgets/tables/launchesTable/launchesTable.scss @@ -17,8 +17,17 @@ .name-col { width: 30%; + @media (max-width: $SCREEN_SM_MAX) { + display: none; + } +} +.name-col-mobile { + width: 100%; + display: none; + @media (max-width: $SCREEN_SM_MAX) { width: 100%; + display: block; } } .time-col { @@ -186,3 +195,8 @@ display: block; } } + +.description { + padding-left: 20px; + padding-right: 20px; +} diff --git a/app/src/pages/inside/common/itemInfo/attributesBlock/attributesBlock.scss b/app/src/pages/inside/common/itemInfo/attributesBlock/attributesBlock.scss index 17f0062789..0f1dc3a906 100644 --- a/app/src/pages/inside/common/itemInfo/attributesBlock/attributesBlock.scss +++ b/app/src/pages/inside/common/itemInfo/attributesBlock/attributesBlock.scss @@ -16,6 +16,7 @@ .attributes-block { display: inline; + margin-bottom: 10px; } .attributes-icon { display: inline-block; diff --git a/app/src/pages/inside/common/itemInfo/itemInfo.jsx b/app/src/pages/inside/common/itemInfo/itemInfo.jsx index fd4316e0d3..d7f016ea07 100644 --- a/app/src/pages/inside/common/itemInfo/itemInfo.jsx +++ b/app/src/pages/inside/common/itemInfo/itemInfo.jsx @@ -87,6 +87,7 @@ export class ItemInfo extends Component { getTrackingData: PropTypes.func, }).isRequired, onClickRetries: PropTypes.func, + hideDescription: PropTypes.bool, }; static defaultProps = { @@ -105,6 +106,7 @@ export class ItemInfo extends Component { onClickRetries: () => {}, refFunction: null, extensionComponents: [], + hideDescription: false, }; handleEditItem = () => { @@ -141,6 +143,7 @@ export class ItemInfo extends Component { onClickRetries, customProps, extensionComponents, + hideDescription, } = this.props; const autoAnalysisLabel = @@ -243,7 +246,7 @@ export class ItemInfo extends Component {
)} - {value.description && ( + {value.description && !hideDescription && (
diff --git a/app/src/pages/inside/common/itemInfo/itemInfo.scss b/app/src/pages/inside/common/itemInfo/itemInfo.scss index 6d3a932f10..b8bb301d66 100644 --- a/app/src/pages/inside/common/itemInfo/itemInfo.scss +++ b/app/src/pages/inside/common/itemInfo/itemInfo.scss @@ -129,6 +129,7 @@ display: inline-block; width: 100%; box-sizing: border-box; + margin-bottom: 10px; } .duration-block { margin-right: 20px; @@ -140,7 +141,6 @@ .item-description { width: 100%; margin-top: 10px; - margin-bottom: 10px; word-break: break-word; } .mobile-info { diff --git a/app/src/pages/inside/common/launchSuiteGrid/launchSuiteGrid.jsx b/app/src/pages/inside/common/launchSuiteGrid/launchSuiteGrid.jsx index 8413c39dd9..ba0a8c9d3f 100644 --- a/app/src/pages/inside/common/launchSuiteGrid/launchSuiteGrid.jsx +++ b/app/src/pages/inside/common/launchSuiteGrid/launchSuiteGrid.jsx @@ -58,18 +58,23 @@ import styles from './launchSuiteGrid.scss'; const cx = classNames.bind(styles); const HamburgerColumn = ({ className, ...rest }) => ( -
+ -
+ ); HamburgerColumn.propTypes = { className: PropTypes.string.isRequired, }; const NameColumn = ({ className, ...rest }) => ( -
- -
+ <> + + + +
+ +
+ ); NameColumn.propTypes = { className: PropTypes.string.isRequired, @@ -519,6 +524,7 @@ export class LaunchSuiteGrid extends PureComponent { loading={loading} onFilterClick={onFilterClick} rowHighlightingConfig={rowHighlightingConfig} + descriptionConfig={{ colSpan: 9, className: cx('description') }} /> {!data.length && !loading && this.renderNoItemsBlock()} diff --git a/app/src/pages/inside/common/launchSuiteGrid/launchSuiteGrid.scss b/app/src/pages/inside/common/launchSuiteGrid/launchSuiteGrid.scss index ee29e26db9..ac34b9aefd 100644 --- a/app/src/pages/inside/common/launchSuiteGrid/launchSuiteGrid.scss +++ b/app/src/pages/inside/common/launchSuiteGrid/launchSuiteGrid.scss @@ -25,9 +25,20 @@ width: 30%; @media (max-width: $SCREEN_SM_MAX) { - width: 100%; + display: none; + } +} + +.name-col-mobile { + width: 100%; + display: none; + padding-left: 15px; + + @media (max-width: $SCREEN_SM_MAX) { + display: block; } } + .start-time-col { width: 10%; @@ -64,6 +75,10 @@ border: 1px solid $COLOR--gray-91; padding: 0; } + + .name-col { + display: none; + } } .select-col { @@ -73,3 +88,8 @@ display: none; } } + +.description { + padding-left: 10px; + padding-right: 10px; +} From 8ebd75aa1fd33bf9c548741e29fbb582b5d337e8 Mon Sep 17 00:00:00 2001 From: Ilya Hancharyk Date: Mon, 27 Jun 2022 19:02:51 +0300 Subject: [PATCH 02/23] EPMRPP-77870 || Fix description for Launches table widget --- .../singleLevelWidgets/tables/launchesTable/launchesTable.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/components/widgets/singleLevelWidgets/tables/launchesTable/launchesTable.jsx b/app/src/components/widgets/singleLevelWidgets/tables/launchesTable/launchesTable.jsx index b1faa6dcb6..54b1aae050 100644 --- a/app/src/components/widgets/singleLevelWidgets/tables/launchesTable/launchesTable.jsx +++ b/app/src/components/widgets/singleLevelWidgets/tables/launchesTable/launchesTable.jsx @@ -91,7 +91,7 @@ const NameColumn = ( return ( <> -
+ -
+
Date: Wed, 6 Jul 2022 16:45:03 +0400 Subject: [PATCH 03/23] EPMRPP-78116 || Text in description has extra padding in "Launches table" widget (#3165) --- .../singleLevelWidgets/tables/launchesTable/launchesTable.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/components/widgets/singleLevelWidgets/tables/launchesTable/launchesTable.scss b/app/src/components/widgets/singleLevelWidgets/tables/launchesTable/launchesTable.scss index 286032b37a..678241ec4c 100644 --- a/app/src/components/widgets/singleLevelWidgets/tables/launchesTable/launchesTable.scss +++ b/app/src/components/widgets/singleLevelWidgets/tables/launchesTable/launchesTable.scss @@ -197,6 +197,6 @@ } .description { - padding-left: 20px; + padding-left: 10px; padding-right: 20px; } From d7137985187607bf076fd6c029bb0a6e433c6082 Mon Sep 17 00:00:00 2001 From: Vadim73i <55870906+Vadim73i@users.noreply.github.com> Date: Mon, 25 Jul 2022 12:10:37 +0400 Subject: [PATCH 04/23] EPMRPP-78497 || Launch separation line is missing padding for launch without description (#3190) --- app/src/components/main/grid/gridBody/gridRow/gridRow.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/components/main/grid/gridBody/gridRow/gridRow.jsx b/app/src/components/main/grid/gridBody/gridRow/gridRow.jsx index dbff3003b4..6764548778 100644 --- a/app/src/components/main/grid/gridBody/gridRow/gridRow.jsx +++ b/app/src/components/main/grid/gridBody/gridRow/gridRow.jsx @@ -259,7 +259,7 @@ export class GridRow extends Component { /> )}
- {descriptionConfig && !!value.description && ( + {descriptionConfig && !!value.description ? ( + ) : ( + )} {this.state.withAccordion && (
From f6bfb8a95ec223f2ce5e0d454c57bff8c5187381 Mon Sep 17 00:00:00 2001 From: Vadim73i <55870906+Vadim73i@users.noreply.github.com> Date: Tue, 16 Aug 2022 13:37:20 +0400 Subject: [PATCH 05/23] EPMRPP-78924 || Salesforce. Update the lead:source on service ui (#3226) --- .../sidebar/supportBlock/modal/requestSupportModal.jsx | 10 ++-------- .../supportBlock/modal/requestSupportModal.scss | 4 ---- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/app/src/layouts/common/sidebar/supportBlock/modal/requestSupportModal.jsx b/app/src/layouts/common/sidebar/supportBlock/modal/requestSupportModal.jsx index e23b7bb897..494855ff6d 100644 --- a/app/src/layouts/common/sidebar/supportBlock/modal/requestSupportModal.jsx +++ b/app/src/layouts/common/sidebar/supportBlock/modal/requestSupportModal.jsx @@ -112,6 +112,8 @@ const RequestSupport = ({ handleSubmit, initialize, invalid }) => { > + +
@@ -159,14 +161,6 @@ const RequestSupport = ({ handleSubmit, initialize, invalid }) => { /> - - - - diff --git a/app/src/layouts/common/sidebar/supportBlock/modal/requestSupportModal.scss b/app/src/layouts/common/sidebar/supportBlock/modal/requestSupportModal.scss index 54402b3f66..9aef567473 100644 --- a/app/src/layouts/common/sidebar/supportBlock/modal/requestSupportModal.scss +++ b/app/src/layouts/common/sidebar/supportBlock/modal/requestSupportModal.scss @@ -18,10 +18,6 @@ margin-bottom: 25px; } -.hidden { - visibility: hidden; -} - .text { display: inline-block; margin-bottom: 20px; From 95128fb52db233bb48bacc7d7e92f9bc00b542d6 Mon Sep 17 00:00:00 2001 From: Pavel Bortnik Date: Thu, 15 Sep 2022 15:12:07 +0300 Subject: [PATCH 06/23] Update Jenkinsfile --- Jenkinsfile | 60 +++++++++++++++++++++++------------------------------ 1 file changed, 26 insertions(+), 34 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6ebf165031..3ec27ec74c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,42 +11,34 @@ node { } - docker.withServer("$DOCKER_HOST") { - stage('Build Docker Image') { - withEnv(["NODE_OPTIONS=--max_old_space_size=4096"]) { - sh """ - MAJOR_VER=\$(cat VERSION) - BUILD_VER="\${MAJOR_VER}-${env.BUILD_NUMBER}" - make IMAGE_NAME=reportportal-dev/service-ui build-image-dev v=\$BUILD_VER - """ - } - } + stage('Build Docker Image') { + withEnv(["NODE_OPTIONS=--max_old_space_size=4096"]) { + sh """ + MAJOR_VER=\$(cat VERSION) + BUILD_VER="\${MAJOR_VER}-${env.BUILD_NUMBER}" + make IMAGE_NAME=reportportal-dev/service-ui build-image-dev v=\$BUILD_VER + """ + } + } - stage('Deploy container') { - sh "docker-compose -p reportportal -f $COMPOSE_FILE_RP up -d --force-recreate ui" - - stage('Push to ECR') { - withEnv(["AWS_URI=${AWS_URI}", "AWS_REGION=${AWS_REGION}"]) { - sh 'docker tag reportportal-dev/service-ui ${AWS_URI}/service-ui' - def image = env.AWS_URI + '/service-ui' - def url = 'https://' + env.AWS_URI - def credentials = 'ecr:' + env.AWS_REGION + ':aws_credentials' - docker.withRegistry(url, credentials) { - docker.image(image).push('SNAPSHOT-${BUILD_NUMBER}') - } - } - } - } - - stage('Cleanup') { - docker.withServer("$DOCKER_HOST") { - withEnv(["AWS_URI=${AWS_URI}"]) { - sh 'docker rmi ${AWS_URI}/service-ui:SNAPSHOT-${BUILD_NUMBER}' - sh 'docker rmi ${AWS_URI}/service-ui:latest' - } - } + stage('Push to registries') { + withEnv(["AWS_URI=${AWS_URI}", "AWS_REGION=${AWS_REGION}"]) { + sh 'docker tag reportportal-dev/service-ui $AWS_URI/service-ui:SNAPSHOT-$BUILD_NUMBER' + def image = env.AWS_URI + '/service-ui' + ':SNAPSHOT-' + env.BUILD_NUMBER + def url = 'https://' + env.AWS_URI + def credentials = 'ecr:' + env.AWS_REGION + ':aws_credentials' + docker.withRegistry(url, credentials) { + docker.image(image).push() } } + } + + stage('Cleanup') { + withEnv(["AWS_URI=${AWS_URI}"]) { + sh 'docker rmi $AWS_URI/service-ui:SNAPSHOT-$BUILD_NUMBER' + sh 'docker rmi reportportal-dev/service-ui:latest' + sh 'docker image prune -f' + } + } } } - From 8b8d87ba18d54c5541fc09386bd1141744ab16ed Mon Sep 17 00:00:00 2001 From: tr1ble <43150561+tr1ble@users.noreply.github.com> Date: Mon, 25 Jul 2022 14:58:24 +0400 Subject: [PATCH 07/23] EPMRPP-78035 || Launch and Test item description validation update (#3188) --- app/localization/translated/be.json | 2 + app/localization/translated/ru.json | 2 + app/localization/translated/uk.json | 2 + .../utils/validation/commonValidators.js | 5 ++ app/src/common/utils/validation/validate.js | 1 + .../fields/fieldErrorHint/fieldErrorHint.jsx | 11 +++- .../markdownEditor/markdownEditor.jsx | 66 ++++++++++++++----- .../markdownEditor/markdownEditor.scss | 21 ++++++ .../modalLayout/modalFooter/modalFooter.jsx | 11 +++- .../modalLayout/modalFooter/modalFooter.scss | 19 ++++++ .../main/modal/modalLayout/modalLayout.jsx | 4 ++ .../modals/editItemModal/editItemModal.jsx | 38 +++++++++-- .../modals/editItemsModal/editItemsModal.jsx | 37 +++++++++-- .../modals/testItemDetailsModal/messages.js | 4 ++ .../testItemDetailsModal.jsx | 33 ++++++++-- 15 files changed, 223 insertions(+), 33 deletions(-) diff --git a/app/localization/translated/be.json b/app/localization/translated/be.json index 33515473f9..2b3fa63ece 100644 --- a/app/localization/translated/be.json +++ b/app/localization/translated/be.json @@ -462,6 +462,8 @@ "DurationTooltip.message": "Працягласць - інтэрвал паміж пачаткам першага падзапуску і заканчэннем апошняга падзапуску. Але калі падзапускі ідуць у параллелі, час заканчэння - гэта час найдаўжэйшага падзапуску, у гэтым выпадку працягласць не будзе роўнай суме працягласцяў падзапускаў.", "EditItemModal.attributesLabel": "Атрыбуты", "EditItemModal.contentTitle": "Апісанне {type}а", + "EditItemModal.descriptionAdviceHint": "Вы выкарысталі {length} з 2048 сімвалаў", + "EditItemModal.descriptionHint": "Апісанне павінна мець памер ад '0' да '2048' сімвалаў", "EditItemModal.descriptionPlaceholder": "Увядзіце апісанне {type}а", "EditItemModal.detailsTabTitle": "Апісанне", "EditItemModal.item": "элемент", diff --git a/app/localization/translated/ru.json b/app/localization/translated/ru.json index ad7c17951f..9d1d660a8c 100644 --- a/app/localization/translated/ru.json +++ b/app/localization/translated/ru.json @@ -462,6 +462,8 @@ "DurationTooltip.message": "Длительность - это интервал между началом первого подпрогона и окончанием последнего подпрогона. Но если подпрогоны происходят параллельно, время окончания - это окончание наиболее длительного подпрогона, в этом случае длительность не будет равна сумме длительностей подпрогонов.", "EditItemModal.attributesLabel": "Атрибуты", "EditItemModal.contentTitle": "Детали {type}а", + "EditItemModal.descriptionAdviceHint": "Вы использовали {length} из 2048 символов", + "EditItemModal.descriptionHint": "Описание должно иметь размер от '0' до '2048' символов", "EditItemModal.descriptionPlaceholder": "Введите описание {type}а", "EditItemModal.detailsTabTitle": "Детали", "EditItemModal.item": "элемент", diff --git a/app/localization/translated/uk.json b/app/localization/translated/uk.json index c9f745213b..4d548cb8ae 100644 --- a/app/localization/translated/uk.json +++ b/app/localization/translated/uk.json @@ -462,6 +462,8 @@ "DurationTooltip.message": "Тривалість - це інтервал між початком першої і закінченням останньої подпрогона подпрогона. Але якщо подпрогоны відбуваються паралельно, час закінчення - це закінчення найбільш тривалого подпрогона, час закінчення - це закінчення найбільш тривалого подпрогона", "EditItemModal.attributesLabel": "Атрибути", "EditItemModal.contentTitle": "Деталі {type}у", + "EditItemModal.descriptionAdviceHint": "Ви використали {length} із 2048 символів", + "EditItemModal.descriptionHint": "Опис повинен мати розмір від '0' до '2048' символів", "EditItemModal.descriptionPlaceholder": "Внесіть опис {type}у", "EditItemModal.detailsTabTitle": "Деталі", "EditItemModal.item": "елемент", diff --git a/app/src/common/utils/validation/commonValidators.js b/app/src/common/utils/validation/commonValidators.js index 3838525f90..c163c2c0cc 100644 --- a/app/src/common/utils/validation/commonValidators.js +++ b/app/src/common/utils/validation/commonValidators.js @@ -62,3 +62,8 @@ export const createNumberOfLaunchesValidator = (message) => bindMessageToValidator(validate.widgetNumberOfLaunches, message); export const createWidgetContentFieldsValidator = (message) => bindMessageToValidator(validate.isNotEmptyArray, message); + +export const createDescriptionValidator = bindMessageToValidator( + validate.descriptionField, + 'descriptionHint', +); diff --git a/app/src/common/utils/validation/validate.js b/app/src/common/utils/validation/validate.js index ea34eecec5..ac88697d1d 100644 --- a/app/src/common/utils/validation/validate.js +++ b/app/src/common/utils/validation/validate.js @@ -98,6 +98,7 @@ export const attributesArray = (value) => isEmpty(value) || !value.length || value.every((attribute) => attributeValue(attribute.value) && !attribute.edited); +export const descriptionField = maxLength(2048); export const widgetNumberOfLaunches = composeValidators([isNotEmpty, range(1, 600)]); export const cumulativeItemsValidation = composeValidators([isNotEmpty, range(1, 20000)]); diff --git a/app/src/components/fields/fieldErrorHint/fieldErrorHint.jsx b/app/src/components/fields/fieldErrorHint/fieldErrorHint.jsx index 47edac775e..e44c6f89bc 100644 --- a/app/src/components/fields/fieldErrorHint/fieldErrorHint.jsx +++ b/app/src/components/fields/fieldErrorHint/fieldErrorHint.jsx @@ -223,6 +223,10 @@ const messages = defineMessages({ id: 'MembersPageToolbar.membersSearchHint', defaultMessage: 'Member name must not be empty', }, + descriptionHint: { + id: 'EditItemModal.descriptionHint', + defaultMessage: "Description should have size from '0' to '2048' symbols", + }, }); @injectIntl @@ -273,7 +277,12 @@ export class FieldErrorHint extends Component { return (
- {children && cloneElement(children, { error, active, ...rest })} + {children && + cloneElement(children, { + error: error && messages[error] ? intl.formatMessage(messages[error]) : error, + active, + ...rest, + })}
{}, + active: false, + touched: false, + error: '', + hint: { hintText: () => '', hintCondition: () => true }, + provideErrorHint: false, }; state = { @@ -262,23 +275,46 @@ export class MarkdownEditor extends React.Component { }; render() { - const { value, onChange, mode } = this.props; + const { + value, + onChange, + mode, + active, + error, + touched, + provideErrorHint, + hint: { hintText, hintCondition }, + } = this.props; + return ( -
+
+