diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-11 15:10:27 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-11 15:10:27 +0300 |
commit | 29549d052d62b949830873f76b6c77d97cbd533d (patch) | |
tree | 7ae33d6fc400a73e79b7c5cc1fa78241baff21a2 /app/assets | |
parent | f91915aadb90fcf2fdf6326ca9160defa4217fea (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets')
17 files changed, 132 insertions, 79 deletions
diff --git a/app/assets/javascripts/admin/broadcast_messages/components/message_form.vue b/app/assets/javascripts/admin/broadcast_messages/components/message_form.vue index b06b6e1437a..109df943c42 100644 --- a/app/assets/javascripts/admin/broadcast_messages/components/message_form.vue +++ b/app/assets/javascripts/admin/broadcast_messages/components/message_form.vue @@ -69,8 +69,13 @@ export default { dismissableDescription: s__('BroadcastMessages|Allow users to dismiss the broadcast message'), target: s__('BroadcastMessages|Target broadcast message'), targetRoles: s__('BroadcastMessages|Target roles'), + targetRolesRequired: s__('BroadcastMessages|Select at least one role.'), + targetRolesValidationMsg: s__('BroadcastMessages|One or more roles is required.'), targetPath: s__('BroadcastMessages|Target Path'), - targetPathDescription: s__('BroadcastMessages|Paths can contain wildcards, like */welcome'), + targetPathDescription: s__('BroadcastMessages|Paths can contain wildcards, like */welcome.'), + targetPathWithRolesReminder: s__( + 'BroadcastMessages|Leave blank to target all group and project pages.', + ), startsAt: s__('BroadcastMessages|Starts at'), endsAt: s__('BroadcastMessages|Ends at'), add: s__('BroadcastMessages|Add broadcast message'), @@ -110,6 +115,7 @@ export default { endsAt: new Date(this.broadcastMessage.endsAt.getTime()), renderedMessage: '', showInCli: this.broadcastMessage.showInCli, + isValidated: false, }; }, computed: { @@ -138,6 +144,18 @@ export default { this.targetSelected === TARGET_ROLES || this.targetSelected === TARGET_ALL_MATCHING_PATH ); }, + targetPathDescription() { + const defaultDescription = this.$options.i18n.targetPathDescription; + + if (this.showTargetRoles) { + return `${defaultDescription} ${this.$options.i18n.targetPathWithRolesReminder}`; + } + + return defaultDescription; + }, + targetRolesValid() { + return !this.showTargetRoles || this.targetAccessLevels.length > 0; + }, formPayload() { return JSON.stringify({ message: this.message, @@ -177,6 +195,12 @@ export default { }, async onSubmit() { this.loading = true; + this.isValidated = true; + + if (!this.targetRolesValid) { + this.loading = false; + return; + } const success = await this.submitForm(); if (success) { @@ -294,6 +318,9 @@ export default { <gl-form-group v-show="showTargetRoles" :label="$options.i18n.targetRoles" + :label-description="$options.i18n.targetRolesRequired" + :invalid-feedback="$options.i18n.targetRolesValidationMsg" + :state="!isValidated || targetRolesValid" data-testid="target-roles-checkboxes" > <gl-form-checkbox-group v-model="targetAccessLevels" :options="targetAccessLevelOptions" /> @@ -307,7 +334,7 @@ export default { > <gl-form-input id="target-path-input" v-model="targetPath" /> <gl-form-text> - {{ $options.i18n.targetPathDescription }} + {{ targetPathDescription }} </gl-form-text> </gl-form-group> @@ -326,7 +353,7 @@ export default { :loading="loading" :disabled="messageBlank" data-testid="submit-button" - class="gl-mr-2" + class="js-no-auto-disable gl-mr-2" > {{ isAddForm ? $options.i18n.add : $options.i18n.update }} </gl-button> diff --git a/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_closed.vue b/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_closed.vue index 1b209e97ed5..85c42ca5485 100644 --- a/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_closed.vue +++ b/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_closed.vue @@ -4,6 +4,7 @@ import { TARGET_TYPE_MERGE_REQUEST, EVENT_CLOSED_ICONS, } from 'ee_else_ce/contribution_events/constants'; +import { getValueByEventTarget } from '../../utils'; import ContributionEventBase from './contribution_event_base.vue'; export default { @@ -16,20 +17,14 @@ export default { }, }, computed: { - target() { - return this.event.target; - }, targetType() { - return this.target.type; - }, - issueType() { - return this.target.issue_type; + return this.event.target.type; }, message() { - return EVENT_CLOSED_I18N[this.issueType || this.targetType] || EVENT_CLOSED_I18N.fallback; + return getValueByEventTarget(EVENT_CLOSED_I18N, this.event); }, iconName() { - return EVENT_CLOSED_ICONS[this.issueType || this.targetType] || EVENT_CLOSED_ICONS.fallback; + return getValueByEventTarget(EVENT_CLOSED_ICONS, this.event); }, iconClass() { return this.targetType === TARGET_TYPE_MERGE_REQUEST ? 'gl-text-red-500' : 'gl-text-blue-500'; diff --git a/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_created.vue b/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_created.vue index 6c861e18a2f..7915cd6679d 100644 --- a/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_created.vue +++ b/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_created.vue @@ -1,5 +1,10 @@ <script> -import { EVENT_CREATED_I18N, TARGET_TYPE_DESIGN } from 'ee_else_ce/contribution_events/constants'; +import { + EVENT_CREATED_I18N, + TARGET_TYPE_DESIGN, + TYPE_FALLBACK, +} from 'ee_else_ce/contribution_events/constants'; +import { getValueByEventTarget } from '../../utils'; import ContributionEventBase from './contribution_event_base.vue'; export default { @@ -18,15 +23,12 @@ export default { resourceParent() { return this.event.resource_parent; }, - issueType() { - return this.target.issue_type; - }, message() { if (!this.target) { - return EVENT_CREATED_I18N[this.resourceParent.type] || EVENT_CREATED_I18N.fallback; + return EVENT_CREATED_I18N[this.resourceParent.type] || EVENT_CREATED_I18N[TYPE_FALLBACK]; } - return EVENT_CREATED_I18N[this.issueType || this.target.type] || EVENT_CREATED_I18N.fallback; + return getValueByEventTarget(EVENT_CREATED_I18N, this.event); }, iconName() { switch (this.target?.type) { diff --git a/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_reopened.vue b/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_reopened.vue new file mode 100644 index 00000000000..36c65950238 --- /dev/null +++ b/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_reopened.vue @@ -0,0 +1,36 @@ +<script> +import { + EVENT_REOPENED_I18N, + EVENT_REOPENED_ICONS, +} from 'ee_else_ce/contribution_events/constants'; +import { getValueByEventTarget } from '../../utils'; +import ContributionEventBase from './contribution_event_base.vue'; + +export default { + name: 'ContributionEventReopened', + components: { ContributionEventBase }, + props: { + event: { + type: Object, + required: true, + }, + }, + computed: { + message() { + return getValueByEventTarget(EVENT_REOPENED_I18N, this.event); + }, + iconName() { + return getValueByEventTarget(EVENT_REOPENED_ICONS, this.event); + }, + }, +}; +</script> + +<template> + <contribution-event-base + :event="event" + :message="message" + :icon-name="iconName" + icon-class="gl-text-green-500" + /> +</template> diff --git a/app/assets/javascripts/contribution_events/components/contribution_events.vue b/app/assets/javascripts/contribution_events/components/contribution_events.vue index d93fe96abfd..f161afa6048 100644 --- a/app/assets/javascripts/contribution_events/components/contribution_events.vue +++ b/app/assets/javascripts/contribution_events/components/contribution_events.vue @@ -10,6 +10,7 @@ import { EVENT_TYPE_MERGED, EVENT_TYPE_CREATED, EVENT_TYPE_CLOSED, + EVENT_TYPE_REOPENED, } from '../constants'; import ContributionEventApproved from './contribution_event/contribution_event_approved.vue'; import ContributionEventExpired from './contribution_event/contribution_event_expired.vue'; @@ -20,6 +21,7 @@ import ContributionEventPrivate from './contribution_event/contribution_event_pr import ContributionEventMerged from './contribution_event/contribution_event_merged.vue'; import ContributionEventCreated from './contribution_event/contribution_event_created.vue'; import ContributionEventClosed from './contribution_event/contribution_event_closed.vue'; +import ContributionEventReopened from './contribution_event/contribution_event_reopened.vue'; export default { props: { @@ -141,6 +143,9 @@ export default { case EVENT_TYPE_CLOSED: return ContributionEventClosed; + case EVENT_TYPE_REOPENED: + return ContributionEventReopened; + default: return EmptyComponent; } diff --git a/app/assets/javascripts/contribution_events/constants.js b/app/assets/javascripts/contribution_events/constants.js index ab242d2b1a9..6d1c5aa1b4c 100644 --- a/app/assets/javascripts/contribution_events/constants.js +++ b/app/assets/javascripts/contribution_events/constants.js @@ -34,6 +34,8 @@ export const WORK_ITEM_ISSUE_TYPE_ISSUE = 'issue'; export const WORK_ITEM_ISSUE_TYPE_TASK = 'task'; export const WORK_ITEM_ISSUE_TYPE_INCIDENT = 'incident'; +export const TYPE_FALLBACK = 'fallback'; + export const EVENT_CREATED_I18N = { [RESOURCE_PARENT_TYPE_PROJECT]: s__('ContributionEvent|Created project %{resourceParentLink}.'), [TARGET_TYPE_MILESTONE]: s__( @@ -57,7 +59,7 @@ export const EVENT_CREATED_I18N = { [WORK_ITEM_ISSUE_TYPE_INCIDENT]: s__( 'ContributionEvent|Opened incident %{targetLink} in %{resourceParentLink}.', ), - fallback: s__('ContributionEvent|Created resource.'), + [TYPE_FALLBACK]: s__('ContributionEvent|Created resource.'), }; export const EVENT_CLOSED_I18N = { @@ -76,11 +78,35 @@ export const EVENT_CLOSED_I18N = { [WORK_ITEM_ISSUE_TYPE_INCIDENT]: s__( 'ContributionEvent|Closed incident %{targetLink} in %{resourceParentLink}.', ), - fallback: s__('ContributionEvent|Closed resource.'), + [TYPE_FALLBACK]: s__('ContributionEvent|Closed resource.'), +}; + +export const EVENT_REOPENED_I18N = { + [TARGET_TYPE_MILESTONE]: s__( + 'ContributionEvent|Reopened milestone %{targetLink} in %{resourceParentLink}.', + ), + [TARGET_TYPE_MERGE_REQUEST]: s__( + 'ContributionEvent|Reopened merge request %{targetLink} in %{resourceParentLink}.', + ), + [WORK_ITEM_ISSUE_TYPE_ISSUE]: s__( + 'ContributionEvent|Reopened issue %{targetLink} in %{resourceParentLink}.', + ), + [WORK_ITEM_ISSUE_TYPE_TASK]: s__( + 'ContributionEvent|Reopened task %{targetLink} in %{resourceParentLink}.', + ), + [WORK_ITEM_ISSUE_TYPE_INCIDENT]: s__( + 'ContributionEvent|Reopened incident %{targetLink} in %{resourceParentLink}.', + ), + [TYPE_FALLBACK]: s__('ContributionEvent|Reopened resource.'), }; export const EVENT_CLOSED_ICONS = { [WORK_ITEM_ISSUE_TYPE_ISSUE]: 'issue-closed', [TARGET_TYPE_MERGE_REQUEST]: 'merge-request-close', - fallback: 'status_closed', + [TYPE_FALLBACK]: 'status_closed', +}; + +export const EVENT_REOPENED_ICONS = { + [TARGET_TYPE_MERGE_REQUEST]: 'merge-request-open', + [TYPE_FALLBACK]: 'status_open', }; diff --git a/app/assets/javascripts/contribution_events/utils.js b/app/assets/javascripts/contribution_events/utils.js new file mode 100644 index 00000000000..0760b5187c6 --- /dev/null +++ b/app/assets/javascripts/contribution_events/utils.js @@ -0,0 +1,9 @@ +import { TYPE_FALLBACK } from './constants'; + +export const getValueByEventTarget = (map, event) => { + const { + target: { type: targetType, issue_type: issueType }, + } = event; + + return map[issueType || targetType] || map[TYPE_FALLBACK]; +}; diff --git a/app/assets/javascripts/environments/components/edit_environment.vue b/app/assets/javascripts/environments/components/edit_environment.vue index a2405d23924..a8e8e9a59e3 100644 --- a/app/assets/javascripts/environments/components/edit_environment.vue +++ b/app/assets/javascripts/environments/components/edit_environment.vue @@ -2,9 +2,7 @@ import { GlLoadingIcon } from '@gitlab/ui'; import { createAlert } from '~/alert'; import { visitUrl } from '~/lib/utils/url_utility'; -import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import getEnvironment from '../graphql/queries/environment.query.graphql'; -import getEnvironmentWithNamespace from '../graphql/queries/environment_with_namespace.graphql'; import updateEnvironment from '../graphql/mutations/update_environment.mutation.graphql'; import EnvironmentForm from './environment_form.vue'; @@ -13,14 +11,11 @@ export default { GlLoadingIcon, EnvironmentForm, }, - mixins: [glFeatureFlagsMixin()], inject: ['projectEnvironmentsPath', 'projectPath', 'environmentName'], apollo: { environment: { query() { - return this.glFeatures?.kubernetesNamespaceForEnvironment - ? getEnvironmentWithNamespace - : getEnvironment; + return getEnvironment; }, variables() { return { diff --git a/app/assets/javascripts/environments/components/environment_form.vue b/app/assets/javascripts/environments/components/environment_form.vue index 1bff013b9c2..745a8a1d3ed 100644 --- a/app/assets/javascripts/environments/components/environment_form.vue +++ b/app/assets/javascripts/environments/components/environment_form.vue @@ -17,7 +17,6 @@ import { ENVIRONMENT_EDIT_HELP_TEXT, } from 'ee_else_ce/environments/constants'; import csrf from '~/lib/utils/csrf'; -import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import { getIdFromGraphQLId } from '~/graphql_shared/utils'; import getNamespacesQuery from '../graphql/queries/k8s_namespaces.query.graphql'; import getUserAuthorizedAgents from '../graphql/queries/user_authorized_agents.query.graphql'; @@ -33,7 +32,6 @@ export default { GlSprintf, GlAlert, }, - mixins: [glFeatureFlagsMixin()], inject: { protectedEnvironmentSettingsPath: { default: '' }, projectPath: { default: '' }, @@ -173,11 +171,8 @@ export default { item.text.toLowerCase().includes(lowerCasedSearchTerm), ); }, - isKasKubernetesNamespaceAvailable() { - return this.glFeatures?.kubernetesNamespaceForEnvironment; - }, showNamespaceSelector() { - return Boolean(this.isKasKubernetesNamespaceAvailable && this.selectedAgentId); + return Boolean(this.selectedAgentId); }, namespaceDropdownToggleText() { return this.selectedNamespace || this.$options.i18n.namespaceHelpText; diff --git a/app/assets/javascripts/environments/components/new_environment_item.vue b/app/assets/javascripts/environments/components/new_environment_item.vue index 555d525c3b6..48a3281c16f 100644 --- a/app/assets/javascripts/environments/components/new_environment_item.vue +++ b/app/assets/javascripts/environments/components/new_environment_item.vue @@ -11,10 +11,8 @@ import { import { __, s__ } from '~/locale'; import { truncate } from '~/lib/utils/text_utility'; import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue'; -import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import isLastDeployment from '../graphql/queries/is_last_deployment.query.graphql'; import getEnvironmentClusterAgent from '../graphql/queries/environment_cluster_agent.query.graphql'; -import getEnvironmentClusterAgentWithNamespace from '../graphql/queries/environment_cluster_agent_with_namespace.query.graphql'; import ExternalUrl from './environment_external_url.vue'; import Actions from './environment_actions.vue'; import StopComponent from './environment_stop.vue'; @@ -52,7 +50,6 @@ export default { directives: { GlTooltip, }, - mixins: [glFeatureFlagsMixin()], inject: ['helpPagePath', 'projectPath'], props: { environment: { @@ -165,9 +162,6 @@ export default { rolloutStatus() { return this.environment?.rolloutStatus; }, - isKubernetesNamespaceAvailable() { - return this.glFeatures?.kubernetesNamespaceForEnvironment; - }, }, methods: { toggleEnvironmentCollapse() { @@ -185,9 +179,7 @@ export default { return { environmentName: this.environment.name, projectFullPath: this.projectPath }; }, query() { - return this.isKubernetesNamespaceAvailable - ? getEnvironmentClusterAgentWithNamespace - : getEnvironmentClusterAgent; + return getEnvironmentClusterAgent; }, update(data) { this.clusterAgent = data?.project?.environment?.clusterAgent; diff --git a/app/assets/javascripts/environments/graphql/queries/environment.query.graphql b/app/assets/javascripts/environments/graphql/queries/environment.query.graphql index 20402e8d32e..53dfe5303f3 100644 --- a/app/assets/javascripts/environments/graphql/queries/environment.query.graphql +++ b/app/assets/javascripts/environments/graphql/queries/environment.query.graphql @@ -5,6 +5,7 @@ query getEnvironment($projectFullPath: ID!, $environmentName: String) { id name externalUrl + kubernetesNamespace clusterAgent { id name diff --git a/app/assets/javascripts/environments/graphql/queries/environment_cluster_agent.query.graphql b/app/assets/javascripts/environments/graphql/queries/environment_cluster_agent.query.graphql index 760f1fba897..19374ae7a81 100644 --- a/app/assets/javascripts/environments/graphql/queries/environment_cluster_agent.query.graphql +++ b/app/assets/javascripts/environments/graphql/queries/environment_cluster_agent.query.graphql @@ -3,6 +3,7 @@ query getEnvironmentClusterAgent($projectFullPath: ID!, $environmentName: String id environment(name: $environmentName) { id + kubernetesNamespace clusterAgent { id name diff --git a/app/assets/javascripts/environments/graphql/queries/environment_cluster_agent_with_namespace.query.graphql b/app/assets/javascripts/environments/graphql/queries/environment_cluster_agent_with_namespace.query.graphql deleted file mode 100644 index 5e72c2dac20..00000000000 --- a/app/assets/javascripts/environments/graphql/queries/environment_cluster_agent_with_namespace.query.graphql +++ /dev/null @@ -1,20 +0,0 @@ -query getEnvironmentClusterAgentWithNamespace($projectFullPath: ID!, $environmentName: String) { - project(fullPath: $projectFullPath) { - id - environment(name: $environmentName) { - id - kubernetesNamespace - clusterAgent { - id - name - webPath - tokens { - nodes { - id - lastUsedAt - } - } - } - } - } -} diff --git a/app/assets/javascripts/environments/graphql/queries/environment_with_namespace.graphql b/app/assets/javascripts/environments/graphql/queries/environment_with_namespace.graphql deleted file mode 100644 index 42796f982b6..00000000000 --- a/app/assets/javascripts/environments/graphql/queries/environment_with_namespace.graphql +++ /dev/null @@ -1,15 +0,0 @@ -query getEnvironmentWithNamespace($projectFullPath: ID!, $environmentName: String) { - project(fullPath: $projectFullPath) { - id - environment(name: $environmentName) { - id - name - externalUrl - kubernetesNamespace - clusterAgent { - id - name - } - } - } -} diff --git a/app/assets/javascripts/repository/components/blob_content_viewer.vue b/app/assets/javascripts/repository/components/blob_content_viewer.vue index 310095b0dd4..6f9f0a81dfd 100644 --- a/app/assets/javascripts/repository/components/blob_content_viewer.vue +++ b/app/assets/javascripts/repository/components/blob_content_viewer.vue @@ -454,7 +454,7 @@ export default { </div> <ai-genie v-if="explainCodeAvailable" - container-id="fileHolder" + container-selector=".file-content" :file-path="path" class="gl-ml-7" /> diff --git a/app/assets/javascripts/vue_merge_request_widget/index.js b/app/assets/javascripts/vue_merge_request_widget/index.js index a2f088a7a58..e8b97098a2b 100644 --- a/app/assets/javascripts/vue_merge_request_widget/index.js +++ b/app/assets/javascripts/vue_merge_request_widget/index.js @@ -1,6 +1,6 @@ import Vue from 'vue'; import VueApollo from 'vue-apollo'; -import MrWidgetOptions from 'ee_else_ce/vue_merge_request_widget/mr_widget_options.vue'; +import MrWidgetOptions from 'any_else_ce/vue_merge_request_widget/mr_widget_options.vue'; import createDefaultClient from '~/lib/graphql'; import { parseBoolean } from '~/lib/utils/common_utils'; import Translate from '../vue_shared/translate'; diff --git a/app/assets/javascripts/vue_shared/components/source_viewer/source_viewer_new.vue b/app/assets/javascripts/vue_shared/components/source_viewer/source_viewer_new.vue index 8e4c438719e..0fb6e577f32 100644 --- a/app/assets/javascripts/vue_shared/components/source_viewer/source_viewer_new.vue +++ b/app/assets/javascripts/vue_shared/components/source_viewer/source_viewer_new.vue @@ -40,6 +40,10 @@ export default { this.track(EVENT_ACTION, { label: EVENT_LABEL_VIEWER, property: this.blob.language }); addBlobLinksTracking(); }, + mounted() { + const { hash } = this.$route; + this.lineHighlighter.highlightHash(hash); + }, userColorScheme: window.gon.user_color_scheme, }; </script> |