Commit 06bed03f authored by Dmytro Zaporozhets (DZ)'s avatar Dmytro Zaporozhets (DZ)

Merge branch '248564-remove-web-ide-suggestion-banner-on-blob-edit' into 'master'

Remove banner that suggests WedIDE gitlab-ci.yml

Closes #248564

See merge request gitlab-org/gitlab!42815
parents f3b8c8c8 f52ab2c4
<script>
import { GlAlert, GlButton } from '@gitlab/ui';
import axios from '~/lib/utils/axios_utils';
export default {
components: {
GlAlert,
GlButton,
},
props: {
dismissEndpoint: {
type: String,
required: true,
},
featureId: {
type: String,
required: true,
},
editPath: {
type: String,
required: true,
},
},
data() {
return {
showAlert: true,
};
},
methods: {
dismissAlert() {
this.showAlert = false;
return axios.post(this.dismissEndpoint, {
feature_name: this.featureId,
});
},
},
};
</script>
<template>
<gl-alert v-if="showAlert" class="gl-mt-5" @dismiss="dismissAlert">
{{ __('The Web IDE offers advanced syntax highlighting capabilities and more.') }}
<div class="gl-mt-5">
<gl-button :href="editPath" category="primary" variant="info">{{
__('Open Web IDE')
}}</gl-button>
</div>
</gl-alert>
</template>
import Vue from 'vue';
import WebIdeAlert from './components/web_ide_alert.vue';
export default el => {
const { dismissEndpoint, featureId, editPath } = el.dataset;
// eslint-disable-next-line no-new
new Vue({
el,
render(createElement) {
return createElement(WebIdeAlert, {
props: {
dismissEndpoint,
featureId,
editPath,
},
});
},
});
};
...@@ -7,14 +7,12 @@ import BlobFileDropzone from '../blob/blob_file_dropzone'; ...@@ -7,14 +7,12 @@ import BlobFileDropzone from '../blob/blob_file_dropzone';
import initPopover from '~/blob/suggest_gitlab_ci_yml'; import initPopover from '~/blob/suggest_gitlab_ci_yml';
import { disableButtonIfEmptyField, setCookie } from '~/lib/utils/common_utils'; import { disableButtonIfEmptyField, setCookie } from '~/lib/utils/common_utils';
import Tracking from '~/tracking'; import Tracking from '~/tracking';
import initWebIdeAlert from '~/blob/suggest_web_ide_ci';
export default () => { export default () => {
const editBlobForm = $('.js-edit-blob-form'); const editBlobForm = $('.js-edit-blob-form');
const uploadBlobForm = $('.js-upload-blob-form'); const uploadBlobForm = $('.js-upload-blob-form');
const deleteBlobForm = $('.js-delete-blob-form'); const deleteBlobForm = $('.js-delete-blob-form');
const suggestEl = document.querySelector('.js-suggest-gitlab-ci-yml'); const suggestEl = document.querySelector('.js-suggest-gitlab-ci-yml');
const alertEl = document.getElementById('js-suggest-web-ide-ci');
if (editBlobForm.length) { if (editBlobForm.length) {
const urlRoot = editBlobForm.data('relativeUrlRoot'); const urlRoot = editBlobForm.data('relativeUrlRoot');
...@@ -85,8 +83,4 @@ export default () => { ...@@ -85,8 +83,4 @@ export default () => {
}); });
} }
} }
if (alertEl) {
initWebIdeAlert(alertEl);
}
}; };
...@@ -9,7 +9,6 @@ module UserCalloutsHelper ...@@ -9,7 +9,6 @@ module UserCalloutsHelper
TABS_POSITION_HIGHLIGHT = 'tabs_position_highlight' TABS_POSITION_HIGHLIGHT = 'tabs_position_highlight'
WEBHOOKS_MOVED = 'webhooks_moved' WEBHOOKS_MOVED = 'webhooks_moved'
CUSTOMIZE_HOMEPAGE = 'customize_homepage' CUSTOMIZE_HOMEPAGE = 'customize_homepage'
WEB_IDE_ALERT_DISMISSED = 'web_ide_alert_dismissed'
def show_admin_integrations_moved? def show_admin_integrations_moved?
!user_dismissed?(ADMIN_INTEGRATIONS_MOVED) !user_dismissed?(ADMIN_INTEGRATIONS_MOVED)
...@@ -51,10 +50,6 @@ module UserCalloutsHelper ...@@ -51,10 +50,6 @@ module UserCalloutsHelper
customize_homepage && !user_dismissed?(CUSTOMIZE_HOMEPAGE) customize_homepage && !user_dismissed?(CUSTOMIZE_HOMEPAGE)
end end
def show_web_ide_alert?
!user_dismissed?(WEB_IDE_ALERT_DISMISSED)
end
private private
def user_dismissed?(feature_name, ignore_dismissal_earlier_than = nil) def user_dismissed?(feature_name, ignore_dismissal_earlier_than = nil)
......
...@@ -19,7 +19,7 @@ class UserCallout < ApplicationRecord ...@@ -19,7 +19,7 @@ class UserCallout < ApplicationRecord
webhooks_moved: 13, webhooks_moved: 13,
service_templates_deprecated: 14, service_templates_deprecated: 14,
admin_integrations_moved: 15, admin_integrations_moved: 15,
web_ide_alert_dismissed: 16, web_ide_alert_dismissed: 16, # no longer in use
active_user_count_threshold: 18, # EE-only active_user_count_threshold: 18, # EE-only
buy_pipeline_minutes_notification_dot: 19, # EE-only buy_pipeline_minutes_notification_dot: 19, # EE-only
personal_access_token_expiry: 21, # EE-only personal_access_token_expiry: 21, # EE-only
......
...@@ -118,10 +118,6 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated ...@@ -118,10 +118,6 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated
add_special_file_path(file_name: ci_config_path_or_default) add_special_file_path(file_name: ci_config_path_or_default)
end end
def add_ci_yml_ide_path
ide_edit_path(project, default_branch_or_master, ci_config_path_or_default)
end
def add_readme_path def add_readme_path
add_special_file_path(file_name: 'README.md') add_special_file_path(file_name: 'README.md')
end end
...@@ -330,7 +326,7 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated ...@@ -330,7 +326,7 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated
if cicd_missing? if cicd_missing?
AnchorData.new(false, AnchorData.new(false,
statistic_icon + _('Set up CI/CD'), statistic_icon + _('Set up CI/CD'),
add_ci_yml_ide_path) add_ci_yml_path)
elsif repository.gitlab_ci_yml.present? elsif repository.gitlab_ci_yml.present?
AnchorData.new(false, AnchorData.new(false,
statistic_icon('doc-text') + _('CI/CD configuration'), statistic_icon('doc-text') + _('CI/CD configuration'),
......
...@@ -9,9 +9,6 @@ ...@@ -9,9 +9,6 @@
= link_to "the file", project_blob_path(@project, tree_join(@branch_name, @file_path)), target: "_blank", rel: 'noopener noreferrer', class: 'gl-link' = link_to "the file", project_blob_path(@project, tree_join(@branch_name, @file_path)), target: "_blank", rel: 'noopener noreferrer', class: 'gl-link'
and make sure your changes will not unintentionally remove theirs. and make sure your changes will not unintentionally remove theirs.
- if editing_ci_config? && show_web_ide_alert?
#js-suggest-web-ide-ci{ data: { dismiss_endpoint: user_callouts_path, feature_id: UserCalloutsHelper::WEB_IDE_ALERT_DISMISSED, edit_path: ide_edit_path } }
.editor-title-row .editor-title-row
%h3.page-title.blob-edit-page-title %h3.page-title.blob-edit-page-title
Edit file Edit file
......
---
title: Remove banner that suggests Web IDE for editing gitlab-ci.yml
merge_request: 42815
author:
type: changed
...@@ -17837,9 +17837,6 @@ msgstr "" ...@@ -17837,9 +17837,6 @@ msgstr ""
msgid "Open Selection" msgid "Open Selection"
msgstr "" msgstr ""
msgid "Open Web IDE"
msgstr ""
msgid "Open comment type dropdown" msgid "Open comment type dropdown"
msgstr "" msgstr ""
...@@ -25267,9 +25264,6 @@ msgstr "" ...@@ -25267,9 +25264,6 @@ msgstr ""
msgid "The URL to use for connecting to Elasticsearch. Use a comma-separated list to support clustering (e.g., \"http://localhost:9200, http://localhost:9201\")." msgid "The URL to use for connecting to Elasticsearch. Use a comma-separated list to support clustering (e.g., \"http://localhost:9200, http://localhost:9201\")."
msgstr "" msgstr ""
msgid "The Web IDE offers advanced syntax highlighting capabilities and more."
msgstr ""
msgid "The X509 Certificate to use when mutual TLS is required to communicate with the external authorization service. If left blank, the server certificate is still validated when accessing over HTTPS." msgid "The X509 Certificate to use when mutual TLS is required to communicate with the external authorization service. If left blank, the server certificate is still validated when accessing over HTTPS."
msgstr "" msgstr ""
......
...@@ -226,7 +226,7 @@ RSpec.describe 'Projects > Show > User sees setup shortcut buttons' do ...@@ -226,7 +226,7 @@ RSpec.describe 'Projects > Show > User sees setup shortcut buttons' do
expect(project.repository.gitlab_ci_yml).to be_nil expect(project.repository.gitlab_ci_yml).to be_nil
page.within('.project-buttons') do page.within('.project-buttons') do
expect(page).to have_link('Set up CI/CD', href: presenter.add_ci_yml_ide_path) expect(page).to have_link('Set up CI/CD', href: presenter.add_ci_yml_path)
end end
end end
......
import MockAdapter from 'axios-mock-adapter';
import waitForPromises from 'helpers/wait_for_promises';
import { shallowMount } from '@vue/test-utils';
import { GlButton, GlAlert } from '@gitlab/ui';
import axios from '~/lib/utils/axios_utils';
import WebIdeAlert from '~/blob/suggest_web_ide_ci/components/web_ide_alert.vue';
const dismissEndpoint = '/-/user_callouts';
const featureId = 'web_ide_alert_dismissed';
const editPath = 'edit/master/-/.gitlab-ci.yml';
describe('WebIdeAlert', () => {
let wrapper;
let mock;
const findButton = () => wrapper.find(GlButton);
const findAlert = () => wrapper.find(GlAlert);
const dismissAlert = alertWrapper => alertWrapper.vm.$emit('dismiss');
const getPostPayload = () => JSON.parse(mock.history.post[0].data);
const createComponent = () => {
wrapper = shallowMount(WebIdeAlert, {
propsData: {
dismissEndpoint,
featureId,
editPath,
},
});
};
beforeEach(() => {
mock = new MockAdapter(axios);
mock.onPost(dismissEndpoint).reply(200);
createComponent();
});
afterEach(() => {
wrapper.destroy();
wrapper = null;
mock.restore();
});
describe('with defaults', () => {
it('displays alert correctly', () => {
expect(findAlert().exists()).toBe(true);
});
it('web ide button link has correct path', () => {
expect(findButton().attributes('href')).toBe(editPath);
});
it('dismisses alert correctly', async () => {
const alertWrapper = findAlert();
dismissAlert(alertWrapper);
await waitForPromises();
expect(alertWrapper.exists()).toBe(false);
expect(mock.history.post).toHaveLength(1);
expect(getPostPayload()).toEqual({ feature_name: featureId });
});
});
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment