diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-11 18:09:30 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-11 18:09:30 +0300 |
commit | ce4562ad642c2c2b504dc322d9c7a1fdbf30cb83 (patch) | |
tree | 71f641fd95cab65ae14bd942c9b5dfda13f090f2 /app/assets | |
parent | 29549d052d62b949830873f76b6c77d97cbd533d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets')
17 files changed, 61 insertions, 52 deletions
diff --git a/app/assets/javascripts/diffs/components/diff_content.vue b/app/assets/javascripts/diffs/components/diff_content.vue index 1c93cb4d021..11ae9d79def 100644 --- a/app/assets/javascripts/diffs/components/diff_content.vue +++ b/app/assets/javascripts/diffs/components/diff_content.vue @@ -3,7 +3,7 @@ import { GlLoadingIcon, GlButton } from '@gitlab/ui'; import { mapActions, mapGetters, mapState } from 'vuex'; import { sprintf } from '~/locale'; import { createAlert } from '~/alert'; -import { mapParallel, mapParallelNoSast } from 'ee_else_ce/diffs/components/diff_row_utils'; +import { mapParallel } from 'ee_else_ce/diffs/components/diff_row_utils'; import DiffFileDrafts from '~/batch_comments/components/diff_file_drafts.vue'; import draftCommentsMixin from '~/diffs/mixins/draft_comments'; import { diffViewerModes } from '~/ide/constants'; @@ -14,7 +14,6 @@ import NotDiffableViewer from '~/vue_shared/components/diff_viewer/viewers/not_d import NoteForm from '~/notes/components/note_form.vue'; import eventHub from '~/notes/event_hub'; import UserAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue'; -import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import { IMAGE_DIFF_POSITION_TYPE } from '../constants'; import { SAVING_THE_COMMENT_FAILED, SOMETHING_WENT_WRONG } from '../i18n'; import { getDiffMode } from '../store/utils'; @@ -36,7 +35,7 @@ export default { UserAvatarLink, DiffFileDrafts, }, - mixins: [diffLineNoteFormMixin, draftCommentsMixin, glFeatureFlagsMixin()], + mixins: [diffLineNoteFormMixin, draftCommentsMixin], props: { diffFile: { type: Object, @@ -92,11 +91,7 @@ export default { return this.getUserData; }, mappedLines() { - if (this.glFeatures.sastReportsInInlineDiff) { - return this.diffLines(this.diffFile).map(mapParallel(this)) || []; - } - - return this.diffLines(this.diffFile).map(mapParallelNoSast(this)) || []; + return this.diffLines(this.diffFile).map(mapParallel(this)) || []; }, imageDiscussions() { return this.diffFile.discussions.filter( diff --git a/app/assets/javascripts/diffs/components/diff_line.vue b/app/assets/javascripts/diffs/components/diff_line.vue index fb201a558d4..4867a21493f 100644 --- a/app/assets/javascripts/diffs/components/diff_line.vue +++ b/app/assets/javascripts/diffs/components/diff_line.vue @@ -15,31 +15,18 @@ export default { parsedCodeQuality() { return (this.line.left ?? this.line.right)?.codequality; }, - parsedSast() { - return (this.line.left ?? this.line.right)?.sast; - }, codeQualityLineNumber() { return this.parsedCodeQuality[0]?.line; }, - sastLineNumber() { - return this.parsedSast[0]?.line; - }, }, methods: { hideInlineFindings() { - this.$emit( - 'hideInlineFindings', - this.codeQualityLineNumber ? this.codeQualityLineNumber : this.sastLineNumber, - ); + this.$emit('hideInlineFindings', this.codeQualityLineNumber); }, }, }; </script> <template> - <inline-findings - :code-quality="parsedCodeQuality" - :sast="parsedSast" - @hideInlineFindings="hideInlineFindings" - /> + <inline-findings :code-quality="parsedCodeQuality" @hideInlineFindings="hideInlineFindings" /> </template> diff --git a/app/assets/javascripts/diffs/components/diff_row.vue b/app/assets/javascripts/diffs/components/diff_row.vue index 52a8cf29052..318ecc89d14 100644 --- a/app/assets/javascripts/diffs/components/diff_row.vue +++ b/app/assets/javascripts/diffs/components/diff_row.vue @@ -342,7 +342,6 @@ export default { v-if="$options.showCodequalityLeft(props) || $options.showSecurityLeft(props)" :inline-findings-expanded="props.inlineFindingsExpanded" :codequality="props.line.left.codequality" - :sast="props.line.left.sast" :file-path="props.filePath" @showInlineFindings=" listeners.toggleCodeQualityFindings( @@ -483,7 +482,6 @@ export default { :is="$options.InlineFindingsGutterIcon" v-if="$options.showCodequalityRight(props) || $options.showSecurityRight(props)" :codequality="props.line.right.codequality" - :sast="props.line.right.sast" :file-path="props.filePath" data-testid="inlineFindingsIcon" @showInlineFindings=" diff --git a/app/assets/javascripts/diffs/components/diff_row_utils.js b/app/assets/javascripts/diffs/components/diff_row_utils.js index 28834dab3b3..a489c96b0c9 100644 --- a/app/assets/javascripts/diffs/components/diff_row_utils.js +++ b/app/assets/javascripts/diffs/components/diff_row_utils.js @@ -189,7 +189,3 @@ export const mapParallel = (content) => (line) => { commentRowClasses: hasDiscussions(left) || hasDiscussions(right) ? '' : 'js-temp-notes-holder', }; }; - -export const mapParallelNoSast = (content) => { - return mapParallel(content); -}; diff --git a/app/assets/javascripts/diffs/components/diff_view.vue b/app/assets/javascripts/diffs/components/diff_view.vue index 09e3f36fa6f..3eacd42831f 100644 --- a/app/assets/javascripts/diffs/components/diff_view.vue +++ b/app/assets/javascripts/diffs/components/diff_view.vue @@ -4,6 +4,7 @@ import { throttle } from 'lodash'; import { IdState } from 'vendor/vue-virtual-scroller'; import DraftNote from '~/batch_comments/components/draft_note.vue'; import draftCommentsMixin from '~/diffs/mixins/draft_comments'; +import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import { getCommentedLines } from '~/notes/components/multiline_comment_utils'; import { hide } from '~/tooltips'; import { pickDirection } from '../utils/diff_line'; @@ -21,7 +22,11 @@ export default { DiffCommentCell, DraftNote, }, - mixins: [draftCommentsMixin, IdState({ idProp: (vm) => vm.diffFile.file_hash })], + mixins: [ + draftCommentsMixin, + IdState({ idProp: (vm) => vm.diffFile.file_hash }), + glFeatureFlagsMixin(), + ], props: { diffFile: { type: Object, @@ -44,7 +49,7 @@ export default { }, data() { return { - codeQualityExpandedLines: [], + inlineFindingsExpandedLines: [], }; }, idState() { @@ -75,12 +80,15 @@ export default { this.diffLines, ); }, - hasCodequalityChanges() { + hasInlineFindingsChanges() { return ( this.codequalityDiff?.files?.[this.diffFile.file_path]?.length > 0 || this.sastDiff?.added?.length > 0 ); }, + sastReportsInInlineDiff() { + return this.glFeatures.sastReportsInInlineDiff; + }, }, created() { this.onDragOverThrottled = throttle((line) => this.onDragOver(line), 100, { leading: true }); @@ -101,14 +109,14 @@ export default { this.idState.dragStart = line; }, hideInlineFindings(line) { - const index = this.codeQualityExpandedLines.indexOf(line); + const index = this.inlineFindingsExpandedLines.indexOf(line); if (index > -1) { - this.codeQualityExpandedLines.splice(index, 1); + this.inlineFindingsExpandedLines.splice(index, 1); } }, toggleCodeQualityFindings(line) { - if (!this.codeQualityExpandedLines.includes(line)) { - this.codeQualityExpandedLines.push(line); + if (!this.inlineFindingsExpandedLines.includes(line)) { + this.inlineFindingsExpandedLines.push(line); } else { this.hideInlineFindings(line); } @@ -207,7 +215,7 @@ export default { <div :class="[ $options.userColorScheme, - { 'inline-diff-view': inline, 'with-codequality': hasCodequalityChanges }, + { 'inline-diff-view': inline, 'with-inline-findings': hasInlineFindingsChanges }, ]" :data-commit-id="commitId" class="diff-grid diff-table code diff-wrap-lines js-syntax-highlight text-file" @@ -256,7 +264,7 @@ export default { :is-last-highlighted-line="isLastHighlightedLine(line) || index === commentedLines.endLine" :inline="inline" :index="index" - :code-quality-expanded="codeQualityExpandedLines.includes(getCodeQualityLine(line))" + :inline-findings-expanded="inlineFindingsExpandedLines.includes(getCodeQualityLine(line))" :file-line-coverage="fileLineCoverage" :coverage-loaded="coverageLoaded" @showCommentForm="(code) => singleLineComment(code, line)" @@ -270,8 +278,11 @@ export default { @startdragging="onStartDragging" @stopdragging="onStopDragging" /> + <!-- Don't display InlineFindings expanded section when sastReportsInInlineDiff is false --> <diff-line - v-if="codeQualityExpandedLines.includes(getCodeQualityLine(line))" + v-if=" + inlineFindingsExpandedLines.includes(getCodeQualityLine(line)) && !sastReportsInInlineDiff + " :key="line.line_code" :line="line" @hideInlineFindings="hideInlineFindings" diff --git a/app/assets/javascripts/diffs/components/inline_findings.vue b/app/assets/javascripts/diffs/components/inline_findings.vue index 48b8f27fed3..efceedd1141 100644 --- a/app/assets/javascripts/diffs/components/inline_findings.vue +++ b/app/assets/javascripts/diffs/components/inline_findings.vue @@ -14,10 +14,6 @@ export default { type: Array, required: true, }, - sast: { - type: Array, - required: true, - }, }, }; </script> @@ -33,12 +29,6 @@ export default { :findings="codeQuality" /> - <diff-inline-findings - v-if="sast.length" - :title="$options.i18n.newSastFindings" - :findings="sast" - /> - <gl-button data-testid="inline-findings-close" category="tertiary" diff --git a/app/assets/javascripts/entrypoints/jira_connect_app.js b/app/assets/javascripts/entrypoints/jira_connect_app.js new file mode 100644 index 00000000000..90ad39ea487 --- /dev/null +++ b/app/assets/javascripts/entrypoints/jira_connect_app.js @@ -0,0 +1 @@ +import '../jira_connect/subscriptions'; diff --git a/app/assets/javascripts/entrypoints/main.js b/app/assets/javascripts/entrypoints/main.js new file mode 100644 index 00000000000..6d59e89cfd0 --- /dev/null +++ b/app/assets/javascripts/entrypoints/main.js @@ -0,0 +1,6 @@ +import '../main'; +import { runModules } from '~/run_modules'; + +const modules = import.meta.glob('../pages/**/index.js'); + +runModules(modules, '../pages/'); diff --git a/app/assets/javascripts/entrypoints/main_ee.js b/app/assets/javascripts/entrypoints/main_ee.js new file mode 100644 index 00000000000..4a83be6be94 --- /dev/null +++ b/app/assets/javascripts/entrypoints/main_ee.js @@ -0,0 +1,5 @@ +import { runModules } from '~/run_modules'; + +const modules = import.meta.glob('../../../../ee/app/assets/javascripts/pages/**/index.js'); + +runModules(modules, '../../../../ee/app/assets/javascripts/pages/'); diff --git a/app/assets/javascripts/entrypoints/main_jh.js b/app/assets/javascripts/entrypoints/main_jh.js new file mode 100644 index 00000000000..92a42a9ac70 --- /dev/null +++ b/app/assets/javascripts/entrypoints/main_jh.js @@ -0,0 +1,5 @@ +import { runModules } from '~/run_modules'; + +const modules = import.meta.glob('../../../../jh/app/assets/javascripts/pages/**/index.js'); + +runModules(modules, '../../../../jh/app/assets/javascripts/pages/'); diff --git a/app/assets/javascripts/entrypoints/performance_bar.js b/app/assets/javascripts/entrypoints/performance_bar.js new file mode 100644 index 00000000000..3f6fc6272d0 --- /dev/null +++ b/app/assets/javascripts/entrypoints/performance_bar.js @@ -0,0 +1 @@ +import '../performance_bar'; diff --git a/app/assets/javascripts/entrypoints/redirect_listbox.js b/app/assets/javascripts/entrypoints/redirect_listbox.js new file mode 100644 index 00000000000..811a73fbf2f --- /dev/null +++ b/app/assets/javascripts/entrypoints/redirect_listbox.js @@ -0,0 +1 @@ +import './behaviors/redirect_listbox'; diff --git a/app/assets/javascripts/entrypoints/sandboxed_mermaid.js b/app/assets/javascripts/entrypoints/sandboxed_mermaid.js new file mode 100644 index 00000000000..d3dd144ffba --- /dev/null +++ b/app/assets/javascripts/entrypoints/sandboxed_mermaid.js @@ -0,0 +1 @@ +import '../lib/mermaid'; diff --git a/app/assets/javascripts/entrypoints/sentry.js b/app/assets/javascripts/entrypoints/sentry.js new file mode 100644 index 00000000000..debafc6fab3 --- /dev/null +++ b/app/assets/javascripts/entrypoints/sentry.js @@ -0,0 +1 @@ +import '../sentry/index'; diff --git a/app/assets/javascripts/lib/utils/webpack.js b/app/assets/javascripts/lib/utils/webpack.js index 38d2f3d7551..f1e87145406 100644 --- a/app/assets/javascripts/lib/utils/webpack.js +++ b/app/assets/javascripts/lib/utils/webpack.js @@ -5,10 +5,11 @@ import { joinPaths } from '~/lib/utils/url_utility'; * See https://gitlab.com/gitlab-org/gitlab/-/issues/321656 for a fix */ export function resetServiceWorkersPublicPath() { + // No-op if we're running Vite instead of Webpack + if (typeof __webpack_public_path__ === 'undefined') return; // eslint-disable-line camelcase // __webpack_public_path__ is a global variable that can be used to adjust // the webpack publicPath setting at runtime. // see: https://webpack.js.org/guides/public-path/ const relativeRootPath = (gon && gon.relative_url_root) || ''; - const webpackAssetPath = joinPaths(relativeRootPath, '/assets/webpack/'); - __webpack_public_path__ = webpackAssetPath; // eslint-disable-line camelcase + __webpack_public_path__ = joinPaths(relativeRootPath, '/assets/webpack/'); // eslint-disable-line camelcase } diff --git a/app/assets/javascripts/run_modules.js b/app/assets/javascripts/run_modules.js new file mode 100644 index 00000000000..fabdff9bb76 --- /dev/null +++ b/app/assets/javascripts/run_modules.js @@ -0,0 +1,9 @@ +export const runModules = (modules, prefix) => { + document + .querySelector('meta[name="controller-path"]') + .content.split('/') + .forEach((part, index, arr) => { + const path = `${prefix}${[...arr.slice(0, index), part].join('/')}/index.js`; + modules[path]?.(); + }); +}; diff --git a/app/assets/javascripts/webpack.js b/app/assets/javascripts/webpack.js index 1c6e632135d..ef82142289d 100644 --- a/app/assets/javascripts/webpack.js +++ b/app/assets/javascripts/webpack.js @@ -7,6 +7,7 @@ * e.g. the `window` scope, because it needs to be executed in the scope of webpack. */ -if (gon && gon.webpack_public_path) { +// eslint-disable-next-line camelcase +if (gon && gon.webpack_public_path && typeof __webpack_public_path__ !== 'undefined') { __webpack_public_path__ = gon.webpack_public_path; // eslint-disable-line camelcase } |