diff options
Diffstat (limited to 'app/assets')
19 files changed, 104 insertions, 53 deletions
diff --git a/app/assets/javascripts/pages/projects/blob/show/index.js b/app/assets/javascripts/pages/projects/blob/show/index.js index 84e5bb3c46e..aee67899ca2 100644 --- a/app/assets/javascripts/pages/projects/blob/show/index.js +++ b/app/assets/javascripts/pages/projects/blob/show/index.js @@ -3,6 +3,7 @@ import commitPipelineStatus from '~/projects/tree/components/commit_pipeline_sta import BlobViewer from '~/blob/viewer/index'; import initBlob from '~/pages/projects/init_blob'; import GpgBadges from '~/gpg_badges'; +import '~/sourcegraph/load'; document.addEventListener('DOMContentLoaded', () => { new BlobViewer(); // eslint-disable-line no-new diff --git a/app/assets/javascripts/pages/projects/commit/show/index.js b/app/assets/javascripts/pages/projects/commit/show/index.js index 5aa4734244e..0eb6f231839 100644 --- a/app/assets/javascripts/pages/projects/commit/show/index.js +++ b/app/assets/javascripts/pages/projects/commit/show/index.js @@ -9,6 +9,7 @@ import initNotes from '~/init_notes'; import initChangesDropdown from '~/init_changes_dropdown'; import initDiffNotes from '~/diff_notes/diff_notes_bundle'; import { fetchCommitMergeRequests } from '~/commit_merge_requests'; +import '~/sourcegraph/load'; document.addEventListener('DOMContentLoaded', () => { const hasPerfBar = document.querySelector('.with-performance-bar'); diff --git a/app/assets/javascripts/pages/projects/merge_requests/init_merge_request_show.js b/app/assets/javascripts/pages/projects/merge_requests/init_merge_request_show.js index fa1de1f13cb..16034313af2 100644 --- a/app/assets/javascripts/pages/projects/merge_requests/init_merge_request_show.js +++ b/app/assets/javascripts/pages/projects/merge_requests/init_merge_request_show.js @@ -5,6 +5,7 @@ import { handleLocationHash } from '~/lib/utils/common_utils'; import howToMerge from '~/how_to_merge'; import initPipelines from '~/commit/pipelines/pipelines_bundle'; import initVueIssuableSidebarApp from '~/issuable_sidebar/sidebar_bundle'; +import initSourcegraph from '~/sourcegraph'; import initWidget from '../../../vue_merge_request_widget'; export default function() { @@ -19,4 +20,5 @@ export default function() { handleLocationHash(); howToMerge(); initWidget(); + initSourcegraph(); } diff --git a/app/assets/javascripts/pages/projects/pages_domains/form.js b/app/assets/javascripts/pages/projects/pages_domains/form.js index cef8e92610c..ae5368179b1 100644 --- a/app/assets/javascripts/pages/projects/pages_domains/form.js +++ b/app/assets/javascripts/pages/projects/pages_domains/form.js @@ -1,17 +1,23 @@ import setupToggleButtons from '~/toggle_buttons'; +function updateVisibility(selector, isVisible) { + Array.from(document.querySelectorAll(selector)).forEach(el => { + if (isVisible) { + el.classList.remove('d-none'); + } else { + el.classList.add('d-none'); + } + }); +} + export default () => { const toggleContainer = document.querySelector('.js-auto-ssl-toggle-container'); if (toggleContainer) { const onToggleButtonClicked = isAutoSslEnabled => { - Array.from(document.querySelectorAll('.js-shown-unless-auto-ssl')).forEach(el => { - if (isAutoSslEnabled) { - el.classList.add('d-none'); - } else { - el.classList.remove('d-none'); - } - }); + updateVisibility('.js-shown-unless-auto-ssl', !isAutoSslEnabled); + + updateVisibility('.js-shown-if-auto-ssl', isAutoSslEnabled); Array.from(document.querySelectorAll('.js-enabled-unless-auto-ssl')).forEach(el => { if (isAutoSslEnabled) { diff --git a/app/assets/javascripts/pipelines/components/test_reports/test_summary_table.vue b/app/assets/javascripts/pipelines/components/test_reports/test_summary_table.vue index 688baa93b6d..96177512e35 100644 --- a/app/assets/javascripts/pipelines/components/test_reports/test_summary_table.vue +++ b/app/assets/javascripts/pipelines/components/test_reports/test_summary_table.vue @@ -64,14 +64,14 @@ export default { v-for="(testSuite, index) in getTestSuites" :key="index" role="row" - class="gl-responsive-table-row test-reports-summary-row rounded cursor-pointer js-suite-row" + class="gl-responsive-table-row gl-responsive-table-row-clickable test-reports-summary-row rounded cursor-pointer js-suite-row" @click="tableRowClick(testSuite)" > <div class="table-section section-25"> <div role="rowheader" class="table-mobile-header font-weight-bold"> {{ __('Suite') }} </div> - <div class="table-mobile-content test-reports-summary-suite cgray pl-3"> + <div class="table-mobile-content underline cgray pl-3"> {{ testSuite.name }} </div> </div> diff --git a/app/assets/javascripts/releases/detail/index.js b/app/assets/javascripts/releases/detail/index.js index 3da971e6d90..0dab90a1ede 100644 --- a/app/assets/javascripts/releases/detail/index.js +++ b/app/assets/javascripts/releases/detail/index.js @@ -5,7 +5,7 @@ import createStore from './store'; export default () => { const el = document.getElementById('js-edit-release-page'); - const store = createStore(el.dataset); + const store = createStore(); store.dispatch('setInitialState', el.dataset); return new Vue({ diff --git a/app/assets/javascripts/repository/components/last_commit.vue b/app/assets/javascripts/repository/components/last_commit.vue index 5a89efa4538..26c1f5813f5 100644 --- a/app/assets/javascripts/repository/components/last_commit.vue +++ b/app/assets/javascripts/repository/components/last_commit.vue @@ -109,7 +109,7 @@ export default { class="text-expander" @click="toggleShowDescription" > - <icon name="ellipsis_h" /> + <icon name="ellipsis_h" :size="10" /> </gl-button> <div class="committer"> <gl-link @@ -124,7 +124,7 @@ export default { </div> <pre v-if="commit.description" - v-show="showDescription" + :class="{ 'd-block': showDescription }" class="commit-row-description append-bottom-8" > {{ commit.description }} diff --git a/app/assets/javascripts/repository/log_tree.js b/app/assets/javascripts/repository/log_tree.js index 112f7d1a30e..87310278b9e 100644 --- a/app/assets/javascripts/repository/log_tree.js +++ b/app/assets/javascripts/repository/log_tree.js @@ -1,4 +1,5 @@ import axios from '~/lib/utils/axios_utils'; +import { normalizeData } from 'ee_else_ce/repository/utils/commit'; import getCommits from './queries/getCommits.query.graphql'; import getProjectPath from './queries/getProjectPath.query.graphql'; import getRef from './queries/getRef.query.graphql'; @@ -6,19 +7,6 @@ import getRef from './queries/getRef.query.graphql'; let fetchpromise; let resolvers = []; -export function normalizeData(data) { - return data.map(d => ({ - sha: d.commit.id, - message: d.commit.message, - committedDate: d.commit.committed_date, - commitPath: d.commit_path, - fileName: d.file_name, - type: d.type, - lockLabel: d.lock_label, - __typename: 'LogTreeCommit', - })); -} - export function resolveCommit(commits, { resolve, entry }) { const commit = commits.find(c => c.fileName === entry.name && c.type === entry.type); diff --git a/app/assets/javascripts/repository/queries/commit.fragment.graphql b/app/assets/javascripts/repository/queries/commit.fragment.graphql new file mode 100644 index 00000000000..9bb13c475c7 --- /dev/null +++ b/app/assets/javascripts/repository/queries/commit.fragment.graphql @@ -0,0 +1,8 @@ +fragment TreeEntryCommit on LogTreeCommit { + sha + message + committedDate + commitPath + fileName + type +} diff --git a/app/assets/javascripts/repository/queries/getCommit.query.graphql b/app/assets/javascripts/repository/queries/getCommit.query.graphql index 65d750884a8..e4aeaaff8fe 100644 --- a/app/assets/javascripts/repository/queries/getCommit.query.graphql +++ b/app/assets/javascripts/repository/queries/getCommit.query.graphql @@ -1,11 +1,7 @@ +#import "ee_else_ce/repository/queries/commit.fragment.graphql" + query getCommit($fileName: String!, $type: String!, $path: String!) { commit(path: $path, fileName: $fileName, type: $type) @client { - sha - message - committedDate - commitPath - fileName - type - lockLabel + ...TreeEntryCommit } } diff --git a/app/assets/javascripts/repository/queries/getCommits.query.graphql b/app/assets/javascripts/repository/queries/getCommits.query.graphql index 780a24d2663..0976b8f32d7 100644 --- a/app/assets/javascripts/repository/queries/getCommits.query.graphql +++ b/app/assets/javascripts/repository/queries/getCommits.query.graphql @@ -1,11 +1,7 @@ +#import "ee_else_ce/repository/queries/commit.fragment.graphql" + query getCommits { commits @client { - sha - message - committedDate - commitPath - fileName - type - lockLabel + ...TreeEntryCommit } } diff --git a/app/assets/javascripts/repository/queries/pathLastCommit.query.graphql b/app/assets/javascripts/repository/queries/pathLastCommit.query.graphql index 74ccdd79dd0..4bb959a8001 100644 --- a/app/assets/javascripts/repository/queries/pathLastCommit.query.graphql +++ b/app/assets/javascripts/repository/queries/pathLastCommit.query.graphql @@ -5,7 +5,7 @@ query pathLastCommit($projectPath: ID!, $path: String, $ref: String!) { lastCommit { sha title - message + description webUrl authoredDate author { diff --git a/app/assets/javascripts/repository/utils/commit.js b/app/assets/javascripts/repository/utils/commit.js new file mode 100644 index 00000000000..6c204b57b37 --- /dev/null +++ b/app/assets/javascripts/repository/utils/commit.js @@ -0,0 +1,13 @@ +// eslint-disable-next-line import/prefer-default-export +export function normalizeData(data, extra = () => {}) { + return data.map(d => ({ + sha: d.commit.id, + message: d.commit.message, + committedDate: d.commit.committed_date, + commitPath: d.commit_path, + fileName: d.file_name, + type: d.type, + __typename: 'LogTreeCommit', + ...extra(d), + })); +} diff --git a/app/assets/javascripts/sourcegraph/index.js b/app/assets/javascripts/sourcegraph/index.js new file mode 100644 index 00000000000..796e90bf08e --- /dev/null +++ b/app/assets/javascripts/sourcegraph/index.js @@ -0,0 +1,28 @@ +function loadScript(path) { + const script = document.createElement('script'); + script.type = 'application/javascript'; + script.src = path; + script.defer = true; + document.head.appendChild(script); +} + +/** + * Loads the Sourcegraph integration for support for Sourcegraph extensions and + * code intelligence. + */ +export default function initSourcegraph() { + const { url } = gon.sourcegraph || {}; + + if (!url) { + return; + } + + const assetsUrl = new URL('/assets/webpack/sourcegraph/', window.location.href); + const scriptPath = new URL('scripts/integration.bundle.js', assetsUrl).href; + + window.SOURCEGRAPH_ASSETS_URL = assetsUrl.href; + window.SOURCEGRAPH_URL = url; + window.SOURCEGRAPH_INTEGRATION = 'gitlab-integration'; + + loadScript(scriptPath); +} diff --git a/app/assets/javascripts/sourcegraph/load.js b/app/assets/javascripts/sourcegraph/load.js new file mode 100644 index 00000000000..f9491505d42 --- /dev/null +++ b/app/assets/javascripts/sourcegraph/load.js @@ -0,0 +1,6 @@ +import initSourcegraph from './index'; + +/** + * Load sourcegraph in it's own listener so that it's isolated from failures. + */ +document.addEventListener('DOMContentLoaded', initSourcegraph); diff --git a/app/assets/javascripts/vue_shared/components/markdown/header.vue b/app/assets/javascripts/vue_shared/components/markdown/header.vue index 7596dbf1229..af4ac024e4f 100644 --- a/app/assets/javascripts/vue_shared/components/markdown/header.vue +++ b/app/assets/javascripts/vue_shared/components/markdown/header.vue @@ -168,7 +168,7 @@ export default { :prepend="true" tag="* [ ] " :button-title="__('Add a task list')" - icon="task-done" + icon="list-task" /> <toolbar-button :tag="mdTable" diff --git a/app/assets/stylesheets/framework/common.scss b/app/assets/stylesheets/framework/common.scss index f4e7e4e456b..31ea59df4c5 100644 --- a/app/assets/stylesheets/framework/common.scss +++ b/app/assets/stylesheets/framework/common.scss @@ -572,3 +572,10 @@ img.emoji { .gl-font-size-20 { font-size: $gl-font-size-20; } .gl-font-size-28 { font-size: $gl-font-size-28; } .gl-font-size-42 { font-size: $gl-font-size-42; } + +.border-section { + @include gl-py-6; + @include gl-m-0; + + border-top: 1px solid $border-color; +} diff --git a/app/assets/stylesheets/framework/responsive_tables.scss b/app/assets/stylesheets/framework/responsive_tables.scss index fd6f80e26cb..1878fac1c60 100644 --- a/app/assets/stylesheets/framework/responsive_tables.scss +++ b/app/assets/stylesheets/framework/responsive_tables.scss @@ -20,6 +20,17 @@ @extend .gl-responsive-table-row-layout; margin-top: 10px; border: 1px solid $border-color; + color: $gray-700; + + &.gl-responsive-table-row-clickable { + &:hover { + background-color: $gray-light; + + .underline { + text-decoration: underline; + } + } + } @include media-breakpoint-up(md) { margin: 0; diff --git a/app/assets/stylesheets/pages/pipelines.scss b/app/assets/stylesheets/pages/pipelines.scss index faf669829e1..364fe3da71e 100644 --- a/app/assets/stylesheets/pages/pipelines.scss +++ b/app/assets/stylesheets/pages/pipelines.scss @@ -1084,18 +1084,6 @@ button.mini-pipeline-graph-dropdown-toggle { } .test-reports-table { - color: $gray-700; - - .test-reports-summary-row { - &:hover { - background-color: $gray-light; - - .test-reports-summary-suite { - text-decoration: underline; - } - } - } - .build-trace { @include build-trace(); } |