Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-06-08 03:10:34 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-06-08 03:10:34 +0300
commit6aead03bb3056c7ee0104311236c2ae06f0e2d18 (patch)
treea468b3b3ae108c8d266f80490bd9ef2fa25af1da /app
parentc98df6ecba0c2a2026803d824ff67d26d6251374 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/runner/components/cells/runner_actions_cell.vue58
-rw-r--r--app/assets/javascripts/runner/graphql/delete_runner.mutation.graphql5
-rw-r--r--app/helpers/nav/top_nav_helper.rb8
-rw-r--r--app/models/ci/build.rb2
-rw-r--r--app/services/base_count_service.rb4
-rw-r--r--app/views/profiles/notifications/show.html.haml16
6 files changed, 76 insertions, 17 deletions
diff --git a/app/assets/javascripts/runner/components/cells/runner_actions_cell.vue b/app/assets/javascripts/runner/components/cells/runner_actions_cell.vue
index 1ed07c39fd5..dca5b88e216 100644
--- a/app/assets/javascripts/runner/components/cells/runner_actions_cell.vue
+++ b/app/assets/javascripts/runner/components/cells/runner_actions_cell.vue
@@ -1,13 +1,16 @@
<script>
import { GlButton, GlButtonGroup, GlTooltipDirective } from '@gitlab/ui';
import { getIdFromGraphQLId } from '~/graphql_shared/utils';
-import { __ } from '~/locale';
+import { __, s__ } from '~/locale';
+import deleteRunnerMutation from '~/runner/graphql/delete_runner.mutation.graphql';
import updateRunnerMutation from '~/runner/graphql/update_runner.mutation.graphql';
const i18n = {
I18N_EDIT: __('Edit'),
I18N_PAUSE: __('Pause'),
I18N_RESUME: __('Resume'),
+ I18N_REMOVE: __('Remove'),
+ I18N_REMOVE_CONFIRMATION: s__('Runners|Are you sure you want to delete this runner?'),
};
export default {
@@ -27,6 +30,7 @@ export default {
data() {
return {
updating: false,
+ deleting: false,
};
},
computed: {
@@ -46,12 +50,16 @@ export default {
toggleActiveTitle() {
if (this.updating) {
// Prevent a "sticky" tooltip: If this button is disabled,
- // mouseout listeners will not run and the tooltip will
- // stay stuck on the button.
+ // mouseout listeners don't run leaving the tooltip stuck
return '';
}
return this.isActive ? i18n.I18N_PAUSE : i18n.I18N_RESUME;
},
+ deleteTitle() {
+ // Prevent a "sticky" tooltip: If element gets removed,
+ // mouseout listeners don't run and leaving the tooltip stuck
+ return this.deleting ? '' : i18n.I18N_REMOVE;
+ },
},
methods: {
async onToggleActive() {
@@ -87,6 +95,39 @@ export default {
}
},
+ async onDelete() {
+ // TODO Replace confirmation with gl-modal
+ // eslint-disable-next-line no-alert
+ if (!window.confirm(i18n.I18N_REMOVE_CONFIRMATION)) {
+ return;
+ }
+
+ this.deleting = true;
+ try {
+ const {
+ data: {
+ runnerDelete: { errors },
+ },
+ } = await this.$apollo.mutate({
+ mutation: deleteRunnerMutation,
+ variables: {
+ input: {
+ id: this.runner.id,
+ },
+ },
+ awaitRefetchQueries: true,
+ refetchQueries: ['getRunners'],
+ });
+ if (errors && errors.length) {
+ this.onError(new Error(errors[0]));
+ }
+ } catch (e) {
+ this.onError(e);
+ } finally {
+ this.deleting = false;
+ }
+ },
+
onError(error) {
// TODO Render errors when "delete" action is done
// `active` toggle would not fail due to user input.
@@ -116,6 +157,15 @@ export default {
data-testid="toggle-active-runner"
@click="onToggleActive"
/>
- <!-- TODO add delete action to update runners -->
+ <gl-button
+ v-gl-tooltip.hover.viewport
+ :title="deleteTitle"
+ :aria-label="deleteTitle"
+ icon="close"
+ :loading="deleting"
+ variant="danger"
+ data-testid="delete-runner"
+ @click="onDelete"
+ />
</gl-button-group>
</template>
diff --git a/app/assets/javascripts/runner/graphql/delete_runner.mutation.graphql b/app/assets/javascripts/runner/graphql/delete_runner.mutation.graphql
new file mode 100644
index 00000000000..d580ea2785e
--- /dev/null
+++ b/app/assets/javascripts/runner/graphql/delete_runner.mutation.graphql
@@ -0,0 +1,5 @@
+mutation runnerDelete($input: RunnerDeleteInput!) {
+ runnerDelete(input: $input) {
+ errors
+ }
+}
diff --git a/app/helpers/nav/top_nav_helper.rb b/app/helpers/nav/top_nav_helper.rb
index 25c6167185a..7abc1e5e902 100644
--- a/app/helpers/nav/top_nav_helper.rb
+++ b/app/helpers/nav/top_nav_helper.rb
@@ -24,7 +24,7 @@ module Nav
if explore_nav_link?(:projects)
builder.add_primary_menu_item_with_shortcut(
href: explore_root_path,
- active: active_nav_link?(path: %w[dashboard#show root#show projects#trending projects#starred projects#index]),
+ active: nav == 'project' || active_nav_link?(path: %w[dashboard#show root#show projects#trending projects#starred projects#index]),
**projects_menu_item_attrs
)
end
@@ -32,7 +32,7 @@ module Nav
if explore_nav_link?(:groups)
builder.add_primary_menu_item_with_shortcut(
href: explore_groups_path,
- active: active_nav_link?(controller: [:groups, 'groups/milestones', 'groups/group_members']),
+ active: nav == 'group' || active_nav_link?(controller: [:groups, 'groups/milestones', 'groups/group_members']),
**groups_menu_item_attrs
)
end
@@ -59,7 +59,7 @@ module Nav
current_item = project ? current_project(project: project) : {}
builder.add_primary_menu_item_with_shortcut(
- active: active_nav_link?(path: %w[root#index projects#trending projects#starred dashboard/projects#index]),
+ active: nav == 'project' || active_nav_link?(path: %w[root#index projects#trending projects#starred dashboard/projects#index]),
css_class: 'qa-projects-dropdown',
data: { track_label: "projects_dropdown", track_event: "click_dropdown", track_experiment: "new_repo" },
view: PROJECTS_VIEW,
@@ -73,7 +73,7 @@ module Nav
current_item = group ? current_group(group: group) : {}
builder.add_primary_menu_item_with_shortcut(
- active: active_nav_link?(path: %w[dashboard/groups explore/groups]),
+ active: nav == 'group' || active_nav_link?(path: %w[dashboard/groups explore/groups]),
css_class: 'qa-groups-dropdown',
data: { track_label: "groups_dropdown", track_event: "click_dropdown" },
view: GROUPS_VIEW,
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index e8fd039ed69..d588ea4bc72 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -595,6 +595,8 @@ module Ci
variables.concat(persisted_environment.predefined_variables)
+ variables.append(key: 'CI_ENVIRONMENT_ACTION', value: environment_action)
+
# Here we're passing unexpanded environment_url for runner to expand,
# and we need to make sure that CI_ENVIRONMENT_NAME and
# CI_ENVIRONMENT_SLUG so on are available for the URL be expanded.
diff --git a/app/services/base_count_service.rb b/app/services/base_count_service.rb
index c316c488148..ff1949ce4dd 100644
--- a/app/services/base_count_service.rb
+++ b/app/services/base_count_service.rb
@@ -27,7 +27,7 @@ class BaseCountService
end
def delete_cache
- Rails.cache.delete(cache_key)
+ ::Gitlab::Cache.delete(cache_key)
end
def raw?
@@ -49,4 +49,4 @@ class BaseCountService
end
end
-BaseCountService.prepend_mod_with('BaseCountService')
+BaseCountService.prepend_mod
diff --git a/app/views/profiles/notifications/show.html.haml b/app/views/profiles/notifications/show.html.haml
index 853188c563f..22cb95b346a 100644
--- a/app/views/profiles/notifications/show.html.haml
+++ b/app/views/profiles/notifications/show.html.haml
@@ -4,13 +4,15 @@
%div
- if @user.errors.any?
.gl-alert.gl-alert-danger.gl-my-5
- %button.js-close.gl-alert-dismiss{ type: 'button', 'aria-label' => _('Dismiss') }
- = sprite_icon('close', css_class: 'gl-icon')
- = sprite_icon('error', css_class: 'gl-icon gl-alert-icon gl-alert-icon-no-title')
- .gl-alert-body
- %ul
- - @user.errors.full_messages.each do |msg|
- %li= msg
+ .gl-alert-container
+ %button.js-close.btn.gl-dismiss-btn.btn-default.btn-sm.gl-button.btn-default-tertiary.btn-icon{ type: 'button', 'aria-label' => _('Dismiss') }
+ = sprite_icon('close', css_class: 'gl-icon')
+ = sprite_icon('error', css_class: 'gl-icon gl-alert-icon gl-alert-icon-no-title')
+ .gl-alert-content
+ .gl-alert-body
+ %ul
+ - @user.errors.full_messages.each do |msg|
+ %li= msg
= hidden_field_tag :notification_type, 'global'
.row.gl-mt-3