diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-06 21:09:19 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-06 21:09:19 +0000 |
commit | 7915c41e4261719719e791602c8235574157164c (patch) | |
tree | 6c1fc8c4ad4e974878c879fcc2c7c8f7d56d0cee | |
parent | 495c22d1245b6212b21b7379a542df73dfa77206 (diff) | |
download | gitlab-ce-7915c41e4261719719e791602c8235574157164c.tar.gz |
Add latest changes from gitlab-org/gitlab@master
28 files changed, 252 insertions, 40 deletions
diff --git a/.rubocop.yml b/.rubocop.yml index ac7a6a05a28..a5f7f5dd45a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -380,8 +380,3 @@ Performance/ChainArrayAllocation: - 'lib/gitlab/import_export/**/*' - 'ee/lib/gitlab/import_export/**/*' - 'ee/lib/ee/gitlab/import_export/**/*' - -# https://gitlab.com/gitlab-org/gitlab/-/issues/212541 -RSpec/RepeatedExample: - Exclude: - - 'spec/features/merge_request/user_posts_diff_notes_spec.rb' diff --git a/app/assets/javascripts/vue_shared/components/stacked_progress_bar.vue b/app/assets/javascripts/vue_shared/components/stacked_progress_bar.vue index ec077197c9c..82b3c784f96 100644 --- a/app/assets/javascripts/vue_shared/components/stacked_progress_bar.vue +++ b/app/assets/javascripts/vue_shared/components/stacked_progress_bar.vue @@ -14,15 +14,18 @@ export default { }, successLabel: { type: String, - required: true, + required: false, + default: 'successful', }, failureLabel: { type: String, - required: true, + required: false, + default: 'failed', }, neutralLabel: { type: String, - required: true, + required: false, + default: 'neutral', }, successCount: { type: Number, @@ -36,6 +39,11 @@ export default { type: Number, required: true, }, + hideTooltips: { + type: Boolean, + required: false, + default: false, + }, }, computed: { neutralCount() { @@ -87,7 +95,7 @@ export default { return `width: ${percent}%;`; }, getTooltip(label, count) { - return `${label}: ${count}`; + return this.hideTooltips ? '' : `${label}: ${count}`; }, }, }; diff --git a/app/assets/stylesheets/utilities.scss b/app/assets/stylesheets/utilities.scss index 0a1e97d1252..91bed4fc9f2 100644 --- a/app/assets/stylesheets/utilities.scss +++ b/app/assets/stylesheets/utilities.scss @@ -62,6 +62,14 @@ .gl-h-32 { height: px-to-rem($grid-size * 4); } .gl-h-64 { height: px-to-rem($grid-size * 8); } +.gl-shim-h-2 { + height: px-to-rem(4px); +} + +.gl-shim-w-5 { + width: px-to-rem(16px); +} + .gl-text-purple { color: $purple; } .gl-text-gray-800 { color: $gray-800; } .gl-bg-purple-light { background-color: $purple-light; } diff --git a/app/views/admin/groups/_form.html.haml b/app/views/admin/groups/_form.html.haml index dd01ef8a29f..22cf722d117 100644 --- a/app/views/admin/groups/_form.html.haml +++ b/app/views/admin/groups/_form.html.haml @@ -32,7 +32,7 @@ - else .form-actions - = f.submit _('Save changes'), class: "btn btn-success" + = f.submit _('Save changes'), class: "btn btn-success", data: { qa_selector: 'save_changes_button' } = link_to _('Cancel'), admin_group_path(@group), class: "btn btn-cancel" = render_if_exists 'ldap_group_links/ldap_syncrhonizations', group: @group diff --git a/app/views/admin/groups/_group.html.haml b/app/views/admin/groups/_group.html.haml index 855858ff929..5fe8f9b4bbc 100644 --- a/app/views/admin/groups/_group.html.haml +++ b/app/views/admin/groups/_group.html.haml @@ -1,7 +1,7 @@ - group = local_assigns.fetch(:group) - css_class = 'no-description' if group.description.blank? -%li.group-row.py-3{ class: css_class } +%li.group-row.py-3{ class: css_class, data: { qa_selector: 'group_row_content' } } .controls = link_to _('Edit'), admin_group_edit_path(group), id: "edit_#{dom_id(group)}", class: 'btn' = link_to _('Delete'), [:admin, group], data: { confirm: _("Are you sure you want to remove %{group_name}?") % { group_name: group.name } }, method: :delete, class: 'btn btn-remove' @@ -26,7 +26,7 @@ .avatar-container.rect-avatar.s40 = group_icon(group, class: "avatar s40 d-none d-sm-block") .title - = link_to [:admin, group], class: 'group-name' do + = link_to [:admin, group], class: 'group-name', data: { qa_selector: 'group_name_link' } do = group.full_name - if group.description.present? diff --git a/app/views/admin/groups/index.html.haml b/app/views/admin/groups/index.html.haml index 434b6e3a37e..f295e5a06cb 100644 --- a/app/views/admin/groups/index.html.haml +++ b/app/views/admin/groups/index.html.haml @@ -7,7 +7,7 @@ .search-holder - project_name = params[:name].present? ? params[:name] : nil .search-field-holder - = search_field_tag :name, project_name, class: "form-control search-text-input js-search-input", autofocus: true, spellcheck: false, placeholder: 'Search by name' + = search_field_tag :name, project_name, class: "form-control search-text-input js-search-input", autofocus: true, spellcheck: false, placeholder: 'Search by name', data: { qa_selector: 'group_search_field' } = icon("search", class: "search-icon") = render "shared/groups/dropdown", options_hash: admin_groups_sort_options_hash = link_to new_admin_group_path, class: "btn btn-success" do diff --git a/app/views/admin/groups/show.html.haml b/app/views/admin/groups/show.html.haml index 3c542c962ec..ebed558f11b 100644 --- a/app/views/admin/groups/show.html.haml +++ b/app/views/admin/groups/show.html.haml @@ -4,7 +4,7 @@ %h3.page-title = _('Group: %{group_name}') % { group_name: @group.full_name } - = link_to admin_group_edit_path(@group), class: "btn float-right" do + = link_to admin_group_edit_path(@group), class: "btn float-right", data: { qa_selector: 'edit_group_link' } do %i.fa.fa-pencil-square-o = _('Edit') %hr diff --git a/app/views/layouts/nav/sidebar/_admin.html.haml b/app/views/layouts/nav/sidebar/_admin.html.haml index a5f285e4e96..52964dd6739 100644 --- a/app/views/layouts/nav/sidebar/_admin.html.haml +++ b/app/views/layouts/nav/sidebar/_admin.html.haml @@ -28,11 +28,11 @@ %span = _('Projects') = nav_link(controller: :users) do - = link_to admin_users_path, title: _('Users') , data: { qa_selector: 'users_overview_link' } do + = link_to admin_users_path, title: _('Users'), data: { qa_selector: 'users_overview_link' } do %span = _('Users') = nav_link(controller: :groups) do - = link_to admin_groups_path, title: _('Groups') do + = link_to admin_groups_path, title: _('Groups'), data: { qa_selector: 'groups_overview_link' } do %span = _('Groups') = nav_link path: 'jobs#index' do diff --git a/changelogs/unreleased/asciidoc-attr.yml b/changelogs/unreleased/asciidoc-attr.yml new file mode 100644 index 00000000000..491c099fa83 --- /dev/null +++ b/changelogs/unreleased/asciidoc-attr.yml @@ -0,0 +1,5 @@ +--- +title: Support Asciidoc docname attribute +merge_request: 22313 +author: Jouke Witteveen +type: added diff --git a/changelogs/unreleased/user-post-diff-notes.yml b/changelogs/unreleased/user-post-diff-notes.yml new file mode 100644 index 00000000000..d6885d8d765 --- /dev/null +++ b/changelogs/unreleased/user-post-diff-notes.yml @@ -0,0 +1,5 @@ +--- +title: Fix duplicate spec in user post diff notes +merge_request: 28859 +author: Rajendra Kadam +type: added diff --git a/doc/administration/geo/replication/img/geo_node_dashboard.png b/doc/administration/geo/replication/img/geo_node_dashboard.png Binary files differindex 99792d0770d..0d3dc5895af 100644 --- a/doc/administration/geo/replication/img/geo_node_dashboard.png +++ b/doc/administration/geo/replication/img/geo_node_dashboard.png diff --git a/doc/development/documentation/styleguide.md b/doc/development/documentation/styleguide.md index 75e38c3a5be..8e9ff0fb218 100644 --- a/doc/development/documentation/styleguide.md +++ b/doc/development/documentation/styleguide.md @@ -769,7 +769,7 @@ To indicate the steps of navigation through the UI: a valid name for an illustration is `devops_diagram_v11_1.png`. - Keep all file names in lower case. - Consider using PNG images instead of JPEG. -- Compress all images with <https://pngquant.org/> or similar tool. +- [Compress all PNG images](#compress-images). - Compress gifs with <https://ezgif.com/optimize> or similar tool. - Images should be used (only when necessary) to _illustrate_ the description of a process, not to _replace_ it. @@ -796,6 +796,35 @@ directly to an HTML `img` tag: <img src="path/to/image.jpg" alt="Alt text (required)" class="image-noshadow"> ``` +### Compress images + +You should always compress any new images you add to the documentation. One +known tool is [`pngquant`](https://pngquant.org/), which is cross-platform and +open source. Install it by visiting the official website and following the +instructions for your OS. + +GitLab has a [raketask](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/tasks/pngquant.rake) +that you can use to automate the process. In the root directory of your local +copy of `https://gitlab.com/gitlab-org/gitlab`, run in a terminal: + +- Before compressing, if you want, check that all documentation PNG images have + been compressed: + + ```shell + bundle exec rake pngquant:lint + ``` + +- Compress all documentation PNG images using `pngquant`: + + ```shell + bundle exec rake pngquant:compress + ``` + +The only caveat is that the task runs on all images under `doc/`, not only the +ones you might have included in a merge request. In that case, you can run the +compress task and only commit the images that are relevant to your merge +request. + ## Videos Adding GitLab's existing YouTube video tutorials to the documentation is diff --git a/doc/user/admin_area/settings/usage_statistics.md b/doc/user/admin_area/settings/usage_statistics.md index 9e7fae05be7..cbfdf2d188c 100644 --- a/doc/user/admin_area/settings/usage_statistics.md +++ b/doc/user/admin_area/settings/usage_statistics.md @@ -327,6 +327,8 @@ but commented out to help encourage others to add to it in the future. --> |dependency_scanning_jobs|counts|| |license_management_jobs|counts|| |sast_jobs|counts|| +|status_page_projects|counts|monitor| +|status_page_issues|counts|monitor| |epics_deepest_relationship_level|counts|| |operations_dashboard_default_dashboard|counts|| |operations_dashboard_users_with_projects_added|counts|| diff --git a/doc/user/asciidoc.md b/doc/user/asciidoc.md index c35d1da5a88..8834deb8d50 100644 --- a/doc/user/asciidoc.md +++ b/doc/user/asciidoc.md @@ -91,6 +91,8 @@ stem:[sqrt(4) = 2] ### Attributes +**User-defined attributes** + ```asciidoc // define attributes in the document header :name: value @@ -104,6 +106,15 @@ C{pp} is not required, only Ruby. Use a leading backslash to output a word enclosed in curly braces, like \{name}. ``` +**Environment attributes** + +GitLab sets the following environment attributes: + +| Attribute | Description | +| :-------------- | :--------------------------------------------------------------------------------------------------------------------- | +| `docname` | Root name of the source document (no leading path or file extension). | +| `outfilesuffix` | File extension corresponding to the backend output (defaults to `.adoc` to make inter-document cross references work). | + ### Links ```asciidoc diff --git a/lib/gitlab/asciidoc.rb b/lib/gitlab/asciidoc.rb index 8d072422e17..2fac76d03e8 100644 --- a/lib/gitlab/asciidoc.rb +++ b/lib/gitlab/asciidoc.rb @@ -25,6 +25,19 @@ module Gitlab 'max-include-depth' => MAX_INCLUDE_DEPTH }.freeze + def self.path_attrs(path) + return {} unless path + + { + # Set an empty docname if the path is a directory + 'docname' => if path[-1] == ::File::SEPARATOR + '' + else + ::File.basename(path, '.*') + end + } + end + # Public: Converts the provided Asciidoc markup into HTML. # # input - the source text in Asciidoc format @@ -35,9 +48,10 @@ module Gitlab include_processor ::Gitlab::Asciidoc::IncludeProcessor.new(context) end + extra_attrs = path_attrs(context[:requested_path]) asciidoc_opts = { safe: :secure, backend: :gitlab_html5, - attributes: DEFAULT_ADOC_ATTRS, + attributes: DEFAULT_ADOC_ATTRS.merge(extra_attrs), extensions: extensions } context[:pipeline] = :ascii_doc diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 917e2226982..ad1d79c3733 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -9314,9 +9314,6 @@ msgstr "" msgid "GeoNodes|Not checksummed" msgstr "" -msgid "GeoNodes|Out of sync" -msgstr "" - msgid "GeoNodes|Pausing replication stops the sync process. Are you sure?" msgstr "" @@ -9365,9 +9362,6 @@ msgstr "" msgid "GeoNodes|Sync settings" msgstr "" -msgid "GeoNodes|Synced" -msgstr "" - msgid "GeoNodes|Unused slots" msgstr "" @@ -13772,6 +13766,9 @@ msgstr "" msgid "Now you can access the merge request navigation tabs at the top, where they’re easier to find." msgstr "" +msgid "Number of %{itemTitle}" +msgstr "" + msgid "Number of Elasticsearch replicas" msgstr "" @@ -16441,6 +16438,9 @@ msgstr "" msgid "Query is valid" msgstr "" +msgid "Queued" +msgstr "" + msgid "Quick actions can be used in the issues description and comment boxes." msgstr "" @@ -19568,6 +19568,9 @@ msgstr "" msgid "Sync information" msgstr "" +msgid "Synced" +msgstr "" + msgid "System" msgstr "" diff --git a/package.json b/package.json index 33938ac5469..82a757e3a54 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@babel/preset-env": "^7.8.4", "@gitlab/at.js": "1.5.5", "@gitlab/svgs": "1.117.0", - "@gitlab/ui": "11.0.3", + "@gitlab/ui": "11.1.0", "@gitlab/visual-review-tools": "1.5.1", "@sentry/browser": "^5.10.2", "@sourcegraph/code-host-integration": "0.0.34", @@ -369,6 +369,12 @@ module QA autoload :Index, 'qa/page/admin/overview/users/index' autoload :Show, 'qa/page/admin/overview/users/show' end + + module Groups + autoload :Index, 'qa/page/admin/overview/groups/index' + autoload :Show, 'qa/page/admin/overview/groups/show' + autoload :Edit, 'qa/page/admin/overview/groups/edit' + end end end diff --git a/qa/qa/page/admin/menu.rb b/qa/qa/page/admin/menu.rb index 2d1af78046d..da716ca8e27 100644 --- a/qa/qa/page/admin/menu.rb +++ b/qa/qa/page/admin/menu.rb @@ -16,9 +16,7 @@ module QA element :admin_sidebar_monitoring_submenu_content element :admin_sidebar_overview_submenu_content element :users_overview_link - end - - view 'app/views/layouts/nav/sidebar/_admin.html.haml' do + element :groups_overview_link element :integration_settings_link end @@ -76,6 +74,12 @@ module QA end end + def go_to_groups_overview + within_submenu(:admin_sidebar_overview_submenu_content) do + click_element :groups_overview_link + end + end + private def hover_element(element) diff --git a/qa/qa/page/admin/overview/groups/edit.rb b/qa/qa/page/admin/overview/groups/edit.rb new file mode 100644 index 00000000000..c96e953d05b --- /dev/null +++ b/qa/qa/page/admin/overview/groups/edit.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module QA + module Page + module Admin + module Overview + module Groups + class Edit < QA::Page::Base + view 'app/views/admin/groups/_form.html.haml' do + element :save_changes_button, required: true + end + + def click_save_changes_button + click_element :save_changes_button, Groups::Show + end + end + end + end + end + end +end + +QA::Page::Admin::Overview::Groups::Edit.prepend_if_ee('QA::EE::Page::Admin::Overview::Groups::Edit') diff --git a/qa/qa/page/admin/overview/groups/index.rb b/qa/qa/page/admin/overview/groups/index.rb new file mode 100644 index 00000000000..c9417bd01b1 --- /dev/null +++ b/qa/qa/page/admin/overview/groups/index.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module QA + module Page + module Admin + module Overview + module Groups + class Index < QA::Page::Base + view 'app/views/admin/groups/index.html.haml' do + element :group_search_field, required: true + end + + view 'app/views/admin/groups/_group.html.haml' do + element :group_row_content + element :group_name_link + end + + def search_group(group_name) + find_element(:group_search_field).set(group_name).send_keys(:return) + end + + def click_group(group_name) + within_element(:group_row_content, text: group_name) do + click_element(:group_name_link) + end + end + end + end + end + end + end +end diff --git a/qa/qa/page/admin/overview/groups/show.rb b/qa/qa/page/admin/overview/groups/show.rb new file mode 100644 index 00000000000..6744b0c1e70 --- /dev/null +++ b/qa/qa/page/admin/overview/groups/show.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module QA + module Page + module Admin + module Overview + module Groups + class Show < QA::Page::Base + view 'app/views/admin/groups/show.html.haml' do + element :edit_group_link, required: true + end + + def click_edit_group_link + click_element :edit_group_link, Groups::Edit + end + end + end + end + end + end +end diff --git a/qa/qa/runtime/env.rb b/qa/qa/runtime/env.rb index d8a3fe93bc0..5c23586fb3e 100644 --- a/qa/qa/runtime/env.rb +++ b/qa/qa/runtime/env.rb @@ -23,6 +23,10 @@ module QA SUPPORTED_FEATURES end + def dot_com? + Runtime::Scenario.gitlab_address.include?(".com") + end + def additional_repository_storage ENV['QA_ADDITIONAL_REPOSITORY_STORAGE'] end diff --git a/qa/spec/runtime/env_spec.rb b/qa/spec/runtime/env_spec.rb index 6b8777af9fe..f2e5eb35871 100644 --- a/qa/spec/runtime/env_spec.rb +++ b/qa/spec/runtime/env_spec.rb @@ -340,4 +340,18 @@ describe QA::Runtime::Env do end end end + + describe '.dot_com?' do + it 'returns true when url has .com' do + QA::Runtime::Scenario.define(:gitlab_address, "https://staging.gitlab.com") + + expect(described_class.dot_com?).to be_truthy + end + + it 'returns false when url does not have .com' do + QA::Runtime::Scenario.define(:gitlab_address, "https://gitlab.test") + + expect(described_class.dot_com?).to be_falsy + end + end end diff --git a/spec/features/merge_request/user_posts_diff_notes_spec.rb b/spec/features/merge_request/user_posts_diff_notes_spec.rb index 103d126891e..19f82058be2 100644 --- a/spec/features/merge_request/user_posts_diff_notes_spec.rb +++ b/spec/features/merge_request/user_posts_diff_notes_spec.rb @@ -66,12 +66,7 @@ describe 'Merge request > User posts diff notes', :js do end context 'with a match line' do - it 'does not allow commenting on the left side' do - line_holder = find('.match', match: :first).find(:xpath, '..') - match_should_not_allow_commenting(line_holder) - end - - it 'does not allow commenting on the right side' do + it 'does not allow commenting' do line_holder = find('.match', match: :first).find(:xpath, '..') match_should_not_allow_commenting(line_holder) end diff --git a/spec/javascripts/vue_shared/components/stacked_progress_bar_spec.js b/spec/javascripts/vue_shared/components/stacked_progress_bar_spec.js index f226dabb8a0..c062ee13231 100644 --- a/spec/javascripts/vue_shared/components/stacked_progress_bar_spec.js +++ b/spec/javascripts/vue_shared/components/stacked_progress_bar_spec.js @@ -68,8 +68,20 @@ describe('StackedProgressBarComponent', () => { }); describe('getTooltip', () => { - it('returns label string based on label and count provided', () => { - expect(vm.getTooltip('Synced', 10)).toBe('Synced: 10'); + describe('when hideTooltips is false', () => { + it('returns label string based on label and count provided', () => { + expect(vm.getTooltip('Synced', 10)).toBe('Synced: 10'); + }); + }); + + describe('when hideTooltips is true', () => { + beforeEach(() => { + vm = createComponent({ hideTooltips: true }); + }); + + it('returns an empty string', () => { + expect(vm.getTooltip('Synced', 10)).toBe(''); + }); }); }); }); diff --git a/spec/lib/gitlab/asciidoc_spec.rb b/spec/lib/gitlab/asciidoc_spec.rb index c7156a500d0..24528d79fa8 100644 --- a/spec/lib/gitlab/asciidoc_spec.rb +++ b/spec/lib/gitlab/asciidoc_spec.rb @@ -46,6 +46,27 @@ module Gitlab end end + context "with requested path" do + input = <<~ADOC + Document name: {docname}. + ADOC + + it "ignores {docname} when not available" do + expect(render(input, {})).to include(input.strip) + end + + [ + ['/', '', 'root'], + ['README', 'README', 'just a filename'], + ['doc/api/', '', 'a directory'], + ['doc/api/README.adoc', 'README', 'a complete path'] + ].each do |path, basename, desc| + it "sets {docname} for #{desc}" do + expect(render(input, { requested_path: path })).to include(": #{basename}.") + end + end + end + context "XSS" do items = { 'link with extra attribute' => { diff --git a/yarn.lock b/yarn.lock index 6f014b22440..acd0bcfd7e3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -786,10 +786,10 @@ resolved "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-1.117.0.tgz#05239ddcf529c62ca29e1ec1a25a7e24efb98207" integrity sha512-dGy/VWuRAFCTZX3Yqu1+RnAHTSUWafteIk/RMfUCN9B/EMbYzjhYsNy0NLVoZ23Rj/KGv1bUGHvyQCoPP6VzpA== -"@gitlab/ui@11.0.3": - version "11.0.3" - resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-11.0.3.tgz#7ef5aa78e8b3226c189487cb1d131859180bf539" - integrity sha512-BCV0+3xJCiBOvdpDlDm6YMnsAP1l4L03e5y0Nqtw8T6hITCL86eGTs0IEPzmE/v2x+03sK4QSHa6rf0dqlvwDg== +"@gitlab/ui@11.1.0": + version "11.1.0" + resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-11.1.0.tgz#72dd6d4309909fd1874f8abc42be8365e875822e" + integrity sha512-lmHTIUIYuUSGiisvnndhpUASvXZokP8/1LBfws9qkbEFPnMIvJAxGRHo3F7dLjcDBCvy4xepgDFFjI6HNFhLWA== dependencies: "@babel/standalone" "^7.0.0" "@gitlab/vue-toasted" "^1.3.0" |