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-07-13 00:09:24 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-07-13 00:09:24 +0300
commit40a1569568e57bb93632d2ac048dbbf6c9bb9770 (patch)
treea5ce642b7a9237544a0a1c3a6beaf00d60ee19da /app
parentdd1c093e289dab5b2142e8e7f02883f2281e7910 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/blob/viewer/index.js26
-rw-r--r--app/assets/javascripts/issues_list/components/issues_list_app.vue3
-rw-r--r--app/assets/javascripts/performance/constants.js4
-rw-r--r--app/assets/stylesheets/framework/files.scss22
4 files changed, 47 insertions, 8 deletions
diff --git a/app/assets/javascripts/blob/viewer/index.js b/app/assets/javascripts/blob/viewer/index.js
index db91d478b39..4d133659daa 100644
--- a/app/assets/javascripts/blob/viewer/index.js
+++ b/app/assets/javascripts/blob/viewer/index.js
@@ -6,6 +6,8 @@ import {
REPO_BLOB_LOAD_VIEWER_START,
REPO_BLOB_LOAD_VIEWER_FINISH,
REPO_BLOB_LOAD_VIEWER,
+ REPO_BLOB_SWITCH_TO_VIEWER_START,
+ REPO_BLOB_SWITCH_VIEWER,
} from '~/performance/constants';
import { performanceMarkAndMeasure } from '~/performance/utils';
import { fixTitle } from '~/tooltips';
@@ -49,6 +51,9 @@ export const handleBlobRichViewer = (viewer, type) => {
export default class BlobViewer {
constructor() {
+ performanceMarkAndMeasure({
+ mark: REPO_BLOB_LOAD_VIEWER_START,
+ });
const viewer = document.querySelector('.blob-viewer[data-type="rich"]');
const type = viewer?.dataset?.richType;
BlobViewer.initAuxiliaryViewer();
@@ -141,7 +146,7 @@ export default class BlobViewer {
switchToViewer(name) {
performanceMarkAndMeasure({
- mark: REPO_BLOB_LOAD_VIEWER_START,
+ mark: REPO_BLOB_SWITCH_TO_VIEWER_START,
});
const newViewer = this.$fileHolder[0].querySelector(`.blob-viewer[data-type='${name}']`);
if (this.activeViewer === newViewer) return;
@@ -171,11 +176,15 @@ export default class BlobViewer {
BlobViewer.loadViewer(newViewer)
.then((viewer) => {
$(viewer).renderGFM();
+ window.requestIdleCallback(() => {
+ this.$fileHolder.trigger('highlight:line');
+ handleLocationHash();
- this.$fileHolder.trigger('highlight:line');
- handleLocationHash();
+ viewer.setAttribute('data-loaded', 'true');
+ this.toggleCopyButtonState();
+ eventHub.$emit('showBlobInteractionZones', viewer.dataset.path);
+ });
- this.toggleCopyButtonState();
performanceMarkAndMeasure({
mark: REPO_BLOB_LOAD_VIEWER_FINISH,
measures: [
@@ -183,6 +192,10 @@ export default class BlobViewer {
name: REPO_BLOB_LOAD_VIEWER,
start: REPO_BLOB_LOAD_VIEWER_START,
},
+ {
+ name: REPO_BLOB_SWITCH_VIEWER,
+ start: REPO_BLOB_SWITCH_TO_VIEWER_START,
+ },
],
});
})
@@ -205,9 +218,10 @@ export default class BlobViewer {
return axios.get(url).then(({ data }) => {
viewer.innerHTML = data.html;
- viewer.setAttribute('data-loaded', 'true');
- eventHub.$emit('showBlobInteractionZones', viewer.dataset.path);
+ window.requestIdleCallback(() => {
+ viewer.removeAttribute('data-loading');
+ });
return viewer;
});
diff --git a/app/assets/javascripts/issues_list/components/issues_list_app.vue b/app/assets/javascripts/issues_list/components/issues_list_app.vue
index e3cc43d2679..6563094ef72 100644
--- a/app/assets/javascripts/issues_list/components/issues_list_app.vue
+++ b/app/assets/javascripts/issues_list/components/issues_list_app.vue
@@ -691,8 +691,9 @@ export default {
</li>
<blocking-issues-count
class="blocking-issues gl-display-none gl-sm-display-block"
- :blocking-issues-count="issuable.blockedByCount"
+ :blocking-issues-count="issuable.blockingCount"
:is-list-item="true"
+ data-testid="blocking-issues"
/>
</template>
diff --git a/app/assets/javascripts/performance/constants.js b/app/assets/javascripts/performance/constants.js
index 1db80057d0c..b9a9ef215af 100644
--- a/app/assets/javascripts/performance/constants.js
+++ b/app/assets/javascripts/performance/constants.js
@@ -83,7 +83,9 @@ export const PIPELINES_DETAIL_LINKS_JOB_RATIO = 'pipeline_graph_links_per_job_ra
// Marks
export const REPO_BLOB_LOAD_VIEWER_START = 'blobviewer-load-viewer-start';
+export const REPO_BLOB_SWITCH_TO_VIEWER_START = 'blobviewer-switch-to-viewerr-start';
export const REPO_BLOB_LOAD_VIEWER_FINISH = 'blobviewer-load-viewer-finish';
// Measures
-export const REPO_BLOB_LOAD_VIEWER = 'Repository File Viewer: loading the content';
+export const REPO_BLOB_LOAD_VIEWER = 'Repository File Viewer: loading the viewer';
+export const REPO_BLOB_SWITCH_VIEWER = 'Repository File Viewer: switching the viewer';
diff --git a/app/assets/stylesheets/framework/files.scss b/app/assets/stylesheets/framework/files.scss
index bda123fa7ea..5ad7ceecb2b 100644
--- a/app/assets/stylesheets/framework/files.scss
+++ b/app/assets/stylesheets/framework/files.scss
@@ -508,3 +508,25 @@ span.idiff {
}
}
}
+
+//
+// IMPORTANT PERFORMANCE OPTIMIZATION BELOW
+//
+// * :nth-of-type(1n+70) - makes sure we do not render lines 71+ right
+// away. Even though the HTML is injected in the DOM, as long as we do
+// not render those lines, the browser doesn't need to spend resources
+// calculating and repainting what's hidden.
+//
+// * :not(:last-of-type) makes sure that we output the last line of the
+// blob's snippet. This is important because the column with the line
+// numbers has auto width and is expanding based on the content in it.
+// This leads to unnecessary layout shift when the last lines of the
+// snippet are longer than two (2) digits.
+// EXAMPLE: Let's say, we have a blob with 100 lines. If we output 70
+// lines, and then, the remaining 30 (incl the line 100), it will lead
+// to the layout reflow and styles recalculation when we output line
+// 100 (because the width of '100' is always bigger than '70'). By
+// outputting the last line right away, we prevent that as the column
+// will always be expanded to the maximum needed width.
+.blob-viewer[data-loading] .file-content.code .line:nth-of-type(1n+70):not(:last-of-type),
+.blob-viewer[data-loading] .file-content.code .file-line-num:nth-of-type(1n+70):not(:last-of-type) {display: none !important;}