diff options
Diffstat (limited to 'app/assets/javascripts/vue_merge_request_widget/components')
17 files changed, 61 insertions, 111 deletions
diff --git a/app/assets/javascripts/vue_merge_request_widget/components/action_buttons.vue b/app/assets/javascripts/vue_merge_request_widget/components/action_buttons.vue index 952ff9b18e9..c49c1316b1b 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/action_buttons.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/action_buttons.vue @@ -4,32 +4,26 @@ import { GlPopover, GlSprintf, GlLink, - GlDropdown, - GlDropdownItem, + GlDisclosureDropdown, GlTooltipDirective, } from '@gitlab/ui'; -import { sprintf, __ } from '~/locale'; export default { + name: 'ActionButtons', components: { GlButton, GlPopover, GlSprintf, GlLink, - GlDropdown, - GlDropdownItem, + GlDisclosureDropdown, }, directives: { GlTooltip: GlTooltipDirective, }, props: { - widget: { - type: String, - required: false, - default: '', - }, tertiaryButtons: { type: Array, + // fix `spec/frontend/vue_merge_request_widget/mr_widget_options_spec.js` before making this required required: false, default: () => [], }, @@ -41,17 +35,26 @@ export default { }; }, computed: { - dropdownLabel() { - if (!this.widget) return undefined; - - return sprintf(__('%{widget} options'), { widget: this.widget }); - }, hasOneOption() { return this.tertiaryButtons.length === 1; }, hasMultipleOptions() { return this.tertiaryButtons.length > 1; }, + dropdownItems() { + return this.tertiaryButtons.map((item) => { + return { + ...item, + text: item.text, + href: item.href, + extraAttrs: { + dataClipboardText: item.dataClipboardText, + dataMethod: item.dataMethod, + target: item.target, + }, + }; + }); + }, }, methods: { onClickAction(action) { @@ -135,32 +138,18 @@ export default { </span> </template> <template v-if="hasMultipleOptions"> - <gl-dropdown + <gl-disclosure-dropdown v-gl-tooltip + :items="dropdownItems" :title="__('Options')" - :text="dropdownLabel" icon="ellipsis_v" no-caret category="tertiary" - right - lazy text-sr-only size="small" - toggle-class="gl-p-2!" class="gl-display-block gl-md-display-none!" - > - <gl-dropdown-item - v-for="(btn, index) in tertiaryButtons" - :key="index" - :href="btn.href" - :target="btn.target" - :data-clipboard-text="btn.dataClipboardText" - :data-method="btn.dataMethod" - @click="onClickAction(btn)" - > - {{ btn.text }} - </gl-dropdown-item> - </gl-dropdown> + @action="onClickAction" + /> <span v-for="(btn, index) in tertiaryButtons" :key="index"> <gl-button :id="btn.id" diff --git a/app/assets/javascripts/vue_merge_request_widget/components/added_commit_message.vue b/app/assets/javascripts/vue_merge_request_widget/components/added_commit_message.vue index 5090081d281..3b62345b969 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/added_commit_message.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/added_commit_message.vue @@ -70,7 +70,8 @@ export default { message() { if (this.state === STATUS_CLOSED) { return s__('mrWidgetCommitsAdded|The changes were not merged into %{targetBranch}.'); - } else if (this.isMerged) { + } + if (this.isMerged) { return s__( 'mrWidgetCommitsAdded|Changes merged into %{targetBranch} with %{mergeCommitSha}%{squashedCommits}.', ); diff --git a/app/assets/javascripts/vue_merge_request_widget/components/approvals/approvals.vue b/app/assets/javascripts/vue_merge_request_widget/components/approvals/approvals.vue index 95fa01c23f1..4ed470440cc 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/approvals/approvals.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/approvals/approvals.vue @@ -131,7 +131,8 @@ export default { variant: 'confirm', action: () => this.approve(), }; - } else if (this.showUnapprove) { + } + if (this.showUnapprove) { return { text: s__('mrWidget|Revoke approval'), variant: 'default', diff --git a/app/assets/javascripts/vue_merge_request_widget/components/deployment/deployment_actions.vue b/app/assets/javascripts/vue_merge_request_widget/components/deployment/deployment_actions.vue index e79d2db4b5a..7a3dd4ca35e 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/deployment/deployment_actions.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/deployment/deployment_actions.vue @@ -1,9 +1,7 @@ <script> import { createAlert } from '~/alert'; import { confirmAction } from '~/lib/utils/confirm_via_gl_modal/confirm_via_gl_modal'; -import { visitUrl } from '~/lib/utils/url_utility'; import { __, s__ } from '~/locale'; -import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import eventHub from '../../event_hub'; import MRWidgetService from '../../services/mr_widget_service'; import { @@ -25,7 +23,6 @@ export default { DeploymentActionButton, DeploymentViewButton, }, - mixins: [glFeatureFlagsMixin()], props: { computedDeploymentStatus: { type: String, @@ -71,10 +68,7 @@ export default { return this.deployment.details?.playable_build?.play_path; }, redeployPath() { - if (this.redeployMrWidgetFeatureFlagEnabled) { - return this.deployment.retry_url; - } - return this.deployment.details?.playable_build?.retry_path; + return this.deployment.retry_url; }, stopUrl() { return this.deployment.stop_url; @@ -82,13 +76,8 @@ export default { environmentAvailable() { return Boolean(this.deployment.environment_available); }, - redeployMrWidgetFeatureFlagEnabled() { - return this.glFeatures.reviewAppsRedeployMrWidget; - }, showDeploymentActionButton() { - return ( - this.redeployPath && !this.environmentAvailable && this.redeployMrWidgetFeatureFlagEnabled - ); + return this.redeployPath && !this.environmentAvailable; }, }, actionsConfiguration: { @@ -137,16 +126,6 @@ export default { this.actionInProgress = actionName; MRWidgetService.executeInlineAction(endpoint) - .then((resp) => { - if (this.redeployMrWidgetFeatureFlagEnabled) { - return; - } - - const redirectUrl = resp?.data?.redirect_url; - if (redirectUrl) { - visitUrl(redirectUrl); - } - }) .catch(() => { createAlert({ message: errorMessage, @@ -184,17 +163,6 @@ export default { > <span>{{ $options.actionsConfiguration[constants.DEPLOYING].buttonText }}</span> </deployment-action-button> - <deployment-action-button - v-if="canBeManuallyRedeployed && !redeployMrWidgetFeatureFlagEnabled" - :action-in-progress="actionInProgress" - :actions-configuration="$options.actionsConfiguration[constants.REDEPLOYING]" - :computed-deployment-status="computedDeploymentStatus" - :icon="$options.btnIcons.repeat" - container-classes="js-manual-redeploy-action" - @click="redeploy" - > - <span>{{ $options.actionsConfiguration[constants.REDEPLOYING].buttonText }}</span> - </deployment-action-button> <deployment-view-button v-if="hasExternalUrls && environmentAvailable" :app-button-text="appButtonText" diff --git a/app/assets/javascripts/vue_merge_request_widget/components/deployment/memory_usage.vue b/app/assets/javascripts/vue_merge_request_widget/components/deployment/memory_usage.vue index c7d34d45f06..efe71ed569a 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/deployment/memory_usage.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/deployment/memory_usage.vue @@ -58,7 +58,8 @@ export default { return s__( 'mrWidget|%{metricsLinkStart} Memory %{metricsLinkEnd} usage %{emphasisStart} increased %{emphasisEnd} from %{memoryFrom}MB to %{memoryTo}MB', ); - } else if (memoryTo < memoryFrom) { + } + if (memoryTo < memoryFrom) { return s__( 'mrWidget|%{metricsLinkStart} Memory %{metricsLinkEnd} usage %{emphasisStart} decreased %{emphasisEnd} from %{memoryFrom}MB to %{memoryTo}MB', ); diff --git a/app/assets/javascripts/vue_merge_request_widget/components/extensions/base.vue b/app/assets/javascripts/vue_merge_request_widget/components/extensions/base.vue index 31bf62b7e52..3e2f3ab4103 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/extensions/base.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/extensions/base.vue @@ -305,11 +305,7 @@ export default { </script> <template> - <section - class="media-section" - data-testid="widget-extension" - data-qa-selector="mr_widget_extension" - > + <section class="media-section" data-testid="widget-extension"> <state-container :status="statusIconName" :is-loading="isLoadingSummary" @@ -346,11 +342,7 @@ export default { </template> </template> </div> - <actions - :widget="$options.label || $options.name" - :tertiary-buttons="tertiaryActionsButtons" - @clickedAction="onClickedAction" - /> + <actions :tertiary-buttons="tertiaryActionsButtons" @clickedAction="onClickedAction" /> <div v-if="isCollapsible" class="gl-border-l-1 gl-border-l-solid gl-border-gray-100 gl-ml-3 gl-pl-3 gl-h-6" @@ -363,7 +355,6 @@ export default { :icon="isCollapsed ? 'chevron-lg-down' : 'chevron-lg-up'" category="tertiary" data-testid="toggle-button" - data-qa-selector="toggle_button" size="small" @click="toggleCollapsed" /> diff --git a/app/assets/javascripts/vue_merge_request_widget/components/extensions/child_content.vue b/app/assets/javascripts/vue_merge_request_widget/components/extensions/child_content.vue index fa369d23b6c..5f0fd973e84 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/extensions/child_content.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/extensions/child_content.vue @@ -108,7 +108,6 @@ export default { </gl-badge> </div> <actions - :widget="widgetLabel" :tertiary-buttons="data.actions" class="gl-ml-auto gl-pl-3" @clickedAction="onClickedAction" @@ -128,7 +127,6 @@ export default { :modal-id="modalId" :level="3" data-testid="child-content" - data-qa-selector="child_content" @clickedAction="onClickedAction" /> </li> diff --git a/app/assets/javascripts/vue_merge_request_widget/components/extensions/telemetry.js b/app/assets/javascripts/vue_merge_request_widget/components/extensions/telemetry.js index 4f8f8d6cb58..b6bcc68e5e0 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/extensions/telemetry.js +++ b/app/assets/javascripts/vue_merge_request_widget/components/extensions/telemetry.js @@ -8,8 +8,10 @@ import { function simplifyWidgetName(componentName) { const noWidget = componentName.replace(/^Widget/, ''); + const camelName = noWidget.charAt(0).toLowerCase() + noWidget.slice(1); + const tierlessName = camelName.replace(/(CE|EE)$/, ''); - return noWidget.charAt(0).toLowerCase() + noWidget.slice(1); + return tierlessName; } function baseRedisEventName(extensionName) { diff --git a/app/assets/javascripts/vue_merge_request_widget/components/extensions/utils.js b/app/assets/javascripts/vue_merge_request_widget/components/extensions/utils.js index 757178ee336..83f5c1490e2 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/extensions/utils.js +++ b/app/assets/javascripts/vue_merge_request_widget/components/extensions/utils.js @@ -65,11 +65,8 @@ const createText = (text) => { export const generateText = (text) => { if (typeof text === 'string') { return createText(escapeText(text)); - } else if ( - typeof text === 'object' && - typeof text.text === 'string' && - typeof text.href === 'string' - ) { + } + if (typeof text === 'object' && typeof text.text === 'string' && typeof text.href === 'string') { return createText( `${ text.prependText ? `${escapeText(text.prependText)} ` : '' diff --git a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue index e94e0fbe6dc..bfcd4610379 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue @@ -11,9 +11,9 @@ import { import SafeHtml from '~/vue_shared/directives/safe_html'; import { s__, n__ } from '~/locale'; import CiIcon from '~/vue_shared/components/ci_icon.vue'; -import { keepLatestDownstreamPipelines } from '~/pipelines/components/parsing_utils'; -import PipelineArtifacts from '~/pipelines/components/pipelines_list/pipelines_artifacts.vue'; -import LegacyPipelineMiniGraph from '~/pipelines/components/pipeline_mini_graph/legacy_pipeline_mini_graph.vue'; +import { keepLatestDownstreamPipelines } from '~/ci/pipeline_details/utils/parsing_utils'; +import PipelineArtifacts from '~/ci/pipelines_page/components/pipelines_artifacts.vue'; +import LegacyPipelineMiniGraph from '~/ci/pipeline_mini_graph/legacy_pipeline_mini_graph.vue'; import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue'; import TooltipOnTruncate from '~/vue_shared/components/tooltip_on_truncate/tooltip_on_truncate.vue'; import { MT_MERGE_STRATEGY } from '../constants'; @@ -183,7 +183,7 @@ export default { v-gl-tooltip :href="ciTroubleshootingDocsPath" target="_blank" - :title="__('About this feature')" + :title="__('Get more information about troubleshooting pipelines')" class="gl-display-flex gl-align-items-center gl-ml-2" > <gl-icon @@ -205,9 +205,7 @@ export default { data-qa-selector="merge_request_pipeline_info_content" class="gl-display-flex gl-flex-wrap gl-align-items-center gl-justify-content-space-between" > - <p - class="mr-pipeline-title gl-m-0! gl-mr-3! gl-font-weight-bold gl-line-height-32 gl-text-gray-900" - > + <p class="mr-pipeline-title gl-m-0! gl-mr-3! gl-font-weight-bold gl-text-gray-900"> {{ pipeline.details.event_type_name }} <gl-link :href="pipeline.path" @@ -253,7 +251,7 @@ export default { v-safe-html="sourceBranchLink" :title="sourceBranch" truncate-target="child" - class="label-branch label-truncate gl-font-weight-normal gl-vertical-align-text-bottom" + class="label-branch label-truncate gl-font-weight-normal" /> </template> <template v-if="finishedAt"> diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/commits_header.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/commits_header.vue index 400759aa086..4f39bd1d972 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/states/commits_header.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/states/commits_header.vue @@ -38,7 +38,7 @@ export default { }, modifyLinkMessage() { if (this.isFastForwardEnabled) return __('Modify commit message'); - else if (this.isSquashEnabled) return __('Modify commit messages'); + if (this.isSquashEnabled) return __('Modify commit messages'); return __('Modify merge commit'); }, ariaLabel() { diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/merge_checks_failed.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/merge_checks_failed.vue index 61eec503951..bf2c5e52184 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/states/merge_checks_failed.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/states/merge_checks_failed.vue @@ -30,9 +30,11 @@ export default { failedText() { if (this.mr.approvals && !this.mr.isApproved) { return this.$options.i18n.approvalNeeded; - } else if (this.mr.detailedMergeStatus === DETAILED_MERGE_STATUS.BLOCKED_STATUS) { + } + if (this.mr.detailedMergeStatus === DETAILED_MERGE_STATUS.BLOCKED_STATUS) { return this.$options.i18n.blockingMergeRequests; - } else if (this.mr.detailedMergeStatus === DETAILED_MERGE_STATUS.EXTERNAL_STATUS_CHECKS) { + } + if (this.mr.detailedMergeStatus === DETAILED_MERGE_STATUS.EXTERNAL_STATUS_CHECKS) { return this.$options.i18n.externalStatusChecksFailed; } diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue index 7071759b8bb..0ce8389579d 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue @@ -488,7 +488,7 @@ export default { mergeAndSquashCommitTemplatesHintText: s__( 'mrWidget|To change these default messages, edit the templates for both the merge and squash commit messages. %{linkStart}Learn more%{linkEnd}.', ), - sourceDivergedFromTargetText: s__('mrWidget|The source branch is %{link} the target branch'), + sourceDivergedFromTargetText: s__('mrWidget|The source branch is %{link} the target branch.'), divergedCommits: (count) => n__('%d commit behind', '%d commits behind', count), }, }; diff --git a/app/assets/javascripts/vue_merge_request_widget/components/widget/app.vue b/app/assets/javascripts/vue_merge_request_widget/components/widget/app.vue index 9bb39ba22e0..8249dffcc27 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/widget/app.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/widget/app.vue @@ -5,6 +5,7 @@ export default { import( '~/vue_merge_request_widget/extensions/security_reports/mr_widget_security_reports.vue' ), + MrTestReportWidget: () => import('~/vue_merge_request_widget/extensions/test_report/index.vue'), MrTerraformWidget: () => import('~/vue_merge_request_widget/extensions/terraform/index.vue'), MrCodeQualityWidget: () => import('~/vue_merge_request_widget/extensions/code_quality/index.vue'), @@ -18,6 +19,10 @@ export default { }, computed: { + testReportWidget() { + return this.mr.testResultsPath && 'MrTestReportWidget'; + }, + terraformPlansWidget() { return this.mr.terraformReportsPath && 'MrTerraformWidget'; }, @@ -27,9 +32,12 @@ export default { }, widgets() { - return [this.codeQualityWidget, this.terraformPlansWidget, 'MrSecurityWidget'].filter( - (w) => w, - ); + return [ + this.codeQualityWidget, + this.testReportWidget, + this.terraformPlansWidget, + 'MrSecurityWidget', + ].filter((w) => w); }, }, }; diff --git a/app/assets/javascripts/vue_merge_request_widget/components/widget/dynamic_content.vue b/app/assets/javascripts/vue_merge_request_widget/components/widget/dynamic_content.vue index 618d1e71f81..72c041759d9 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/widget/dynamic_content.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/widget/dynamic_content.vue @@ -92,7 +92,6 @@ export default { </div> <actions v-if="hasActionButtons" - :widget="widgetName" :tertiary-buttons="data.actions" class="gl-ml-auto gl-pl-3" @clickedAction="onClickedAction" diff --git a/app/assets/javascripts/vue_merge_request_widget/components/widget/widget.vue b/app/assets/javascripts/vue_merge_request_widget/components/widget/widget.vue index 2c8bf90064e..d17be3e4037 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/widget/widget.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/widget/widget.vue @@ -368,7 +368,6 @@ export default { <slot name="action-buttons"> <action-buttons v-if="actionButtons.length > 0" - :widget="widgetName" :tertiary-buttons="actionButtons" @clickedAction="onActionClick" /> diff --git a/app/assets/javascripts/vue_merge_request_widget/components/widget/widget_content_row.vue b/app/assets/javascripts/vue_merge_request_widget/components/widget/widget_content_row.vue index e67924d28ab..bb82da7796a 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/widget/widget_content_row.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/widget/widget_content_row.vue @@ -128,11 +128,7 @@ export default { > </template> </help-popover> - <action-buttons - v-if="hasActionButtons" - :widget="widgetName" - :tertiary-buttons="actionButtons" - /> + <action-buttons v-if="hasActionButtons" :tertiary-buttons="actionButtons" /> </div> </div> <div class="gl-display-flex gl-align-items-baseline"> |