summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-05-17 18:07:07 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-17 18:07:07 +0000
commit8746f6e79d7717a8cb16737fecdb977feaa22cdb (patch)
treecd1080192931a17e459fc5b476f3c5d91f83dde3 /app
parent30785cadee10a5deaa45ada13def96bcfa6663b0 (diff)
downloadgitlab-ce-8746f6e79d7717a8cb16737fecdb977feaa22cdb.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/lib/utils/url_utility.js8
-rw-r--r--app/assets/javascripts/pipelines/components/pipelines_list/pipelines.vue1
-rw-r--r--app/assets/javascripts/super_sidebar/components/frequent_items_list.vue24
-rw-r--r--app/assets/javascripts/super_sidebar/components/help_center.vue6
-rw-r--r--app/assets/javascripts/super_sidebar/components/items_list.vue17
-rw-r--r--app/assets/javascripts/super_sidebar/components/sidebar_menu.vue7
-rw-r--r--app/graphql/mutations/environments/update.rb44
-rw-r--r--app/graphql/types/mutation_type.rb1
-rw-r--r--app/helpers/safe_format_helper.rb3
-rw-r--r--app/services/environments/update_service.rb23
10 files changed, 110 insertions, 24 deletions
diff --git a/app/assets/javascripts/lib/utils/url_utility.js b/app/assets/javascripts/lib/utils/url_utility.js
index f16ff188edb..4301fbf2f0e 100644
--- a/app/assets/javascripts/lib/utils/url_utility.js
+++ b/app/assets/javascripts/lib/utils/url_utility.js
@@ -8,10 +8,14 @@ const SHA_REGEX = /[\da-f]{40}/gi;
// GitLab default domain (override in jh)
export const DOMAIN = 'gitlab.com';
-// About GitLab default host (overwrite in jh)
+// Following URLs will be overwritten in jh
+export const FORUM_URL = `https://forum.${DOMAIN}/`; // forum.gitlab.com
+export const DOCS_URL = `https://docs.${DOMAIN}`; // docs.gitlab.com
+
+// About GitLab default host
export const PROMO_HOST = `about.${DOMAIN}`; // about.gitlab.com
-// About Gitlab default url (overwrite in jh)
+// About Gitlab default url
export const PROMO_URL = `https://${PROMO_HOST}`;
// Reset the cursor in a Regex so that multiple uses before a recompile don't fail
diff --git a/app/assets/javascripts/pipelines/components/pipelines_list/pipelines.vue b/app/assets/javascripts/pipelines/components/pipelines_list/pipelines.vue
index 4934df0adc1..7d41700c492 100644
--- a/app/assets/javascripts/pipelines/components/pipelines_list/pipelines.vue
+++ b/app/assets/javascripts/pipelines/components/pipelines_list/pipelines.vue
@@ -391,6 +391,7 @@ export default {
@filterPipelines="filterPipelines"
/>
<gl-collapsible-listbox
+ v-model="visibilityPipelineIdType"
data-testid="pipeline-key-collapsible-box"
:toggle-text="selectedPipelineKeyOption.text"
:items="$options.PipelineKeyOptions"
diff --git a/app/assets/javascripts/super_sidebar/components/frequent_items_list.vue b/app/assets/javascripts/super_sidebar/components/frequent_items_list.vue
index 11bf2ddbd30..79f3faacac9 100644
--- a/app/assets/javascripts/super_sidebar/components/frequent_items_list.vue
+++ b/app/assets/javascripts/super_sidebar/components/frequent_items_list.vue
@@ -1,13 +1,19 @@
<script>
+import { GlButton, GlTooltipDirective } from '@gitlab/ui';
import * as Sentry from '@sentry/browser';
import AccessorUtilities from '~/lib/utils/accessor';
+import { __ } from '~/locale';
import { getTopFrequentItems, formatContextSwitcherItems } from '../utils';
import ItemsList from './items_list.vue';
export default {
components: {
+ GlButton,
ItemsList,
},
+ directives: {
+ GlTooltip: GlTooltipDirective,
+ },
props: {
title: {
type: String,
@@ -68,6 +74,9 @@ export default {
}
},
},
+ i18n: {
+ removeItem: __('Remove'),
+ },
};
</script>
@@ -87,7 +96,20 @@ export default {
>
{{ pristineText }}
</div>
- <items-list :aria-label="title" :items="cachedFrequentItems" @remove-item="handleItemRemove">
+ <items-list :aria-label="title" :items="cachedFrequentItems">
+ <template #actions="{ item }">
+ <gl-button
+ v-gl-tooltip.right.viewport
+ size="small"
+ category="tertiary"
+ icon="dash"
+ :aria-label="$options.i18n.removeItem"
+ :title="$options.i18n.removeItem"
+ class="gl-align-self-center gl-p-1! gl-absolute gl-right-4"
+ data-testid="item-remove"
+ @click.stop.prevent="handleItemRemove(item)"
+ />
+ </template>
<template #view-all-items>
<slot name="view-all-items"></slot>
</template>
diff --git a/app/assets/javascripts/super_sidebar/components/help_center.vue b/app/assets/javascripts/super_sidebar/components/help_center.vue
index 1fffbb05d03..4de17ffa8b6 100644
--- a/app/assets/javascripts/super_sidebar/components/help_center.vue
+++ b/app/assets/javascripts/super_sidebar/components/help_center.vue
@@ -8,7 +8,7 @@ import {
} from '@gitlab/ui';
import GitlabVersionCheckBadge from '~/gitlab_version_check/components/gitlab_version_check_badge.vue';
import { helpPagePath } from '~/helpers/help_page_helper';
-import { DOMAIN, PROMO_URL } from 'jh_else_ce/lib/utils/url_utility';
+import { FORUM_URL, DOCS_URL, PROMO_URL } from 'jh_else_ce/lib/utils/url_utility';
import { __, s__ } from '~/locale';
import { STORAGE_KEY } from '~/whats_new/utils/notification';
import Tracking from '~/tracking';
@@ -93,7 +93,7 @@ export default {
},
{
text: this.$options.i18n.docs,
- href: `https://docs.${DOMAIN}`,
+ href: DOCS_URL,
extraAttrs: {
...this.trackingAttrs('gitlab_documentation'),
},
@@ -107,7 +107,7 @@ export default {
},
{
text: this.$options.i18n.forum,
- href: `https://forum.${DOMAIN}/`,
+ href: FORUM_URL,
extraAttrs: {
...this.trackingAttrs('community_forum'),
},
diff --git a/app/assets/javascripts/super_sidebar/components/items_list.vue b/app/assets/javascripts/super_sidebar/components/items_list.vue
index ef27251dc6c..46f27dd7d06 100644
--- a/app/assets/javascripts/super_sidebar/components/items_list.vue
+++ b/app/assets/javascripts/super_sidebar/components/items_list.vue
@@ -1,17 +1,12 @@
<script>
-import { GlButton, GlTooltipDirective } from '@gitlab/ui';
import ProjectAvatar from '~/vue_shared/components/project_avatar.vue';
import NavItem from './nav_item.vue';
export default {
components: {
- GlButton,
ProjectAvatar,
NavItem,
},
- directives: {
- GlTooltip: GlTooltipDirective,
- },
props: {
items: {
type: Array,
@@ -40,17 +35,7 @@ export default {
/>
</template>
<template #actions>
- <gl-button
- v-gl-tooltip.right.viewport
- size="small"
- category="tertiary"
- icon="dash"
- :aria-label="__('Remove')"
- :title="__('Remove')"
- class="gl-align-self-center gl-p-1! gl-absolute gl-right-4"
- data-testid="item-remove"
- @click.stop.prevent="$emit('remove-item', item)"
- />
+ <slot name="actions" :item="item"></slot>
</template>
</nav-item>
<slot name="view-all-items"></slot>
diff --git a/app/assets/javascripts/super_sidebar/components/sidebar_menu.vue b/app/assets/javascripts/super_sidebar/components/sidebar_menu.vue
index 08af9232107..0ec4c759acc 100644
--- a/app/assets/javascripts/super_sidebar/components/sidebar_menu.vue
+++ b/app/assets/javascripts/super_sidebar/components/sidebar_menu.vue
@@ -1,6 +1,7 @@
<script>
import * as Sentry from '@sentry/browser';
import axios from '~/lib/utils/axios_utils';
+import { s__ } from '~/locale';
import { PANELS_WITH_PINS } from '../constants';
import NavItem from './nav_item.vue';
import PinnedSection from './pinned_section.vue';
@@ -42,6 +43,10 @@ export default {
},
},
+ i18n: {
+ mainNavigation: s__('Navigation|Main navigation'),
+ },
+
data() {
return {
// This is used as a provide and injected into the nav items.
@@ -137,7 +142,7 @@ export default {
</script>
<template>
- <nav class="gl-p-2 gl-relative">
+ <nav :aria-label="$options.i18n.mainNavigation" class="gl-p-2 gl-relative">
<ul v-if="hasStaticItems" class="gl-p-0 gl-m-0">
<nav-item v-for="item in staticItems" :key="item.id" :item="item" is-static />
</ul>
diff --git a/app/graphql/mutations/environments/update.rb b/app/graphql/mutations/environments/update.rb
new file mode 100644
index 00000000000..dc1fb9b23af
--- /dev/null
+++ b/app/graphql/mutations/environments/update.rb
@@ -0,0 +1,44 @@
+# frozen_string_literal: true
+
+module Mutations
+ module Environments
+ class Update < ::Mutations::BaseMutation
+ graphql_name 'EnvironmentUpdate'
+ description 'Update an environment.'
+
+ authorize :update_environment
+
+ argument :id,
+ ::Types::GlobalIDType[::Environment],
+ required: true,
+ description: 'Global ID of the environment to update.'
+
+ argument :external_url,
+ GraphQL::Types::String,
+ required: false,
+ description: 'External URL of the environment.'
+
+ argument :tier,
+ Types::DeploymentTierEnum,
+ required: false,
+ description: 'Tier of the environment.'
+
+ field :environment,
+ Types::EnvironmentType,
+ null: true,
+ description: 'Environment after attempt to update.'
+
+ def resolve(id:, **kwargs)
+ environment = authorized_find!(id: id)
+
+ response = ::Environments::UpdateService.new(environment.project, current_user, kwargs).execute(environment)
+
+ if response.success?
+ { environment: response.payload[:environment], errors: [] }
+ else
+ { environment: response.payload[:environment], errors: response.errors }
+ end
+ end
+ end
+ end
+end
diff --git a/app/graphql/types/mutation_type.rb b/app/graphql/types/mutation_type.rb
index 7e436d74dcf..9f84e2efab6 100644
--- a/app/graphql/types/mutation_type.rb
+++ b/app/graphql/types/mutation_type.rb
@@ -53,6 +53,7 @@ module Types
mount_mutation Mutations::DependencyProxy::GroupSettings::Update
mount_mutation Mutations::Environments::CanaryIngress::Update
mount_mutation Mutations::Environments::Stop
+ mount_mutation Mutations::Environments::Update
mount_mutation Mutations::IncidentManagement::TimelineEvent::Create, alpha: { milestone: '15.6' }
mount_mutation Mutations::IncidentManagement::TimelineEvent::PromoteFromNote
mount_mutation Mutations::IncidentManagement::TimelineEvent::Update
diff --git a/app/helpers/safe_format_helper.rb b/app/helpers/safe_format_helper.rb
index c79e8b50a1a..f05cf5ab50f 100644
--- a/app/helpers/safe_format_helper.rb
+++ b/app/helpers/safe_format_helper.rb
@@ -15,7 +15,8 @@ module SafeFormatHelper
def safe_format(format, **args)
raise ArgumentError, 'Argument `format` must not be marked as html_safe!' if format.html_safe?
- format(
+ # Use `Kernel.format` to avoid conflicts with ViewComponent's `format`.
+ Kernel.format(
html_escape(format),
args.transform_values { |value| html_escape(value) }
).html_safe
diff --git a/app/services/environments/update_service.rb b/app/services/environments/update_service.rb
new file mode 100644
index 00000000000..e02b2398426
--- /dev/null
+++ b/app/services/environments/update_service.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+module Environments
+ class UpdateService < BaseService
+ def execute(environment)
+ unless can?(current_user, :update_environment, environment)
+ return ServiceResponse.error(
+ message: _('Unauthorized to update the environment'),
+ payload: { environment: environment }
+ )
+ end
+
+ if environment.update(**params)
+ ServiceResponse.success(payload: { environment: environment })
+ else
+ ServiceResponse.error(
+ message: environment.errors.full_messages,
+ payload: { environment: environment }
+ )
+ end
+ end
+ end
+end