summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/blob
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/blob')
-rw-r--r--app/assets/javascripts/blob/3d_viewer/index.js4
-rw-r--r--app/assets/javascripts/blob/balsamiq/balsamiq_viewer.js4
-rw-r--r--app/assets/javascripts/blob/blob_file_dropzone.js14
-rw-r--r--app/assets/javascripts/blob/blob_line_permalink_updater.js6
-rw-r--r--app/assets/javascripts/blob/components/blob_content_error.vue2
-rw-r--r--app/assets/javascripts/blob/components/blob_header_default_actions.vue5
-rw-r--r--app/assets/javascripts/blob/file_template_mediator.js45
-rw-r--r--app/assets/javascripts/blob/notebook/notebook_viewer.vue6
-rw-r--r--app/assets/javascripts/blob/openapi/index.js2
-rw-r--r--app/assets/javascripts/blob/pipeline_tour_success_modal.vue6
-rw-r--r--app/assets/javascripts/blob/sketch/index.js6
-rw-r--r--app/assets/javascripts/blob/stl_viewer.js4
-rw-r--r--app/assets/javascripts/blob/suggest_gitlab_ci_yml/index.js2
-rw-r--r--app/assets/javascripts/blob/template_selector.js8
-rw-r--r--app/assets/javascripts/blob/template_selectors/ci_syntax_yaml_selector.js29
-rw-r--r--app/assets/javascripts/blob/template_selectors/ci_yaml_selector.js4
-rw-r--r--app/assets/javascripts/blob/template_selectors/dockerfile_selector.js4
-rw-r--r--app/assets/javascripts/blob/template_selectors/gitignore_selector.js4
-rw-r--r--app/assets/javascripts/blob/template_selectors/license_selector.js4
-rw-r--r--app/assets/javascripts/blob/template_selectors/metrics_dashboard_selector.js4
-rw-r--r--app/assets/javascripts/blob/template_selectors/type_selector.js4
-rw-r--r--app/assets/javascripts/blob/viewer/index.js10
22 files changed, 105 insertions, 72 deletions
diff --git a/app/assets/javascripts/blob/3d_viewer/index.js b/app/assets/javascripts/blob/3d_viewer/index.js
index 2d4f45cc365..94397d70384 100644
--- a/app/assets/javascripts/blob/3d_viewer/index.js
+++ b/app/assets/javascripts/blob/3d_viewer/index.js
@@ -68,7 +68,7 @@ export default class Renderer {
}
loadFile() {
- this.loader.load(this.container.dataset.endpoint, geo => {
+ this.loader.load(this.container.dataset.endpoint, (geo) => {
const obj = new MeshObject(geo);
this.objects.push(obj);
@@ -99,7 +99,7 @@ export default class Renderer {
}
changeObjectMaterials(type) {
- this.objects.forEach(obj => {
+ this.objects.forEach((obj) => {
obj.changeMaterial(type);
});
}
diff --git a/app/assets/javascripts/blob/balsamiq/balsamiq_viewer.js b/app/assets/javascripts/blob/balsamiq/balsamiq_viewer.js
index 5b781947d55..ebe2c2b3bb8 100644
--- a/app/assets/javascripts/blob/balsamiq/balsamiq_viewer.js
+++ b/app/assets/javascripts/blob/balsamiq/balsamiq_viewer.js
@@ -28,7 +28,7 @@ class BalsamiqViewer {
.then(({ data }) => {
this.renderFile(data);
})
- .catch(e => {
+ .catch((e) => {
throw new Error(e);
});
}
@@ -39,7 +39,7 @@ class BalsamiqViewer {
this.initDatabase(fileBuffer);
const previews = this.getPreviews();
- previews.forEach(preview => {
+ previews.forEach((preview) => {
const renderedPreview = this.renderPreview(preview);
container.appendChild(renderedPreview);
diff --git a/app/assets/javascripts/blob/blob_file_dropzone.js b/app/assets/javascripts/blob/blob_file_dropzone.js
index e8772b7240a..19bad64155d 100644
--- a/app/assets/javascripts/blob/blob_file_dropzone.js
+++ b/app/assets/javascripts/blob/blob_file_dropzone.js
@@ -43,16 +43,14 @@ export default class BlobFileDropzone {
previewsContainer: '.dropzone-previews',
headers: csrf.headers,
init() {
- this.on('processing', function() {
+ this.on('processing', function () {
this.options.url = form.attr('action');
});
this.on('addedfile', () => {
toggleLoading(submitButton, submitButtonLoadingIcon, false);
dropzoneMessage.addClass(HIDDEN_CLASS);
- $('.dropzone-alerts')
- .html('')
- .hide();
+ $('.dropzone-alerts').html('').hide();
});
this.on('removedfile', () => {
toggleLoading(submitButton, submitButtonLoadingIcon, false);
@@ -62,7 +60,7 @@ export default class BlobFileDropzone {
$('#modal-upload-blob').modal('hide');
visitUrl(response.filePath);
});
- this.on('maxfilesexceeded', function(file) {
+ this.on('maxfilesexceeded', function (file) {
dropzoneMessage.addClass(HIDDEN_CLASS);
this.removeFile(file);
});
@@ -74,9 +72,7 @@ export default class BlobFileDropzone {
},
// Override behavior of adding error underneath preview
error(file, errorMessage) {
- const stripped = $('<div/>')
- .html(errorMessage)
- .text();
+ const stripped = $('<div/>').html(errorMessage).text();
$('.dropzone-alerts')
.html(sprintf(__('Error uploading file: %{stripped}'), { stripped }))
.show();
@@ -84,7 +80,7 @@ export default class BlobFileDropzone {
},
});
- submitButton.on('click', e => {
+ submitButton.on('click', (e) => {
e.preventDefault();
e.stopPropagation();
if (dropzone[0].dropzone.getQueuedFiles().length === 0) {
diff --git a/app/assets/javascripts/blob/blob_line_permalink_updater.js b/app/assets/javascripts/blob/blob_line_permalink_updater.js
index 62f0a56ed75..11089b299c5 100644
--- a/app/assets/javascripts/blob/blob_line_permalink_updater.js
+++ b/app/assets/javascripts/blob/blob_line_permalink_updater.js
@@ -2,12 +2,12 @@ import { getLocationHash } from '../lib/utils/url_utility';
const lineNumberRe = /^L[0-9]+/;
-const updateLineNumbersOnBlobPermalinks = linksToUpdate => {
+const updateLineNumbersOnBlobPermalinks = (linksToUpdate) => {
const hash = getLocationHash();
if (hash && lineNumberRe.test(hash)) {
const hashUrlString = `#${hash}`;
- [].concat(Array.prototype.slice.call(linksToUpdate)).forEach(permalinkButton => {
+ [].concat(Array.prototype.slice.call(linksToUpdate)).forEach((permalinkButton) => {
const baseHref =
permalinkButton.getAttribute('data-original-href') ||
(() => {
@@ -28,7 +28,7 @@ function BlobLinePermalinkUpdater(blobContentHolder, lineNumberSelector, element
}, 0);
};
- blobContentHolder.addEventListener('click', e => {
+ blobContentHolder.addEventListener('click', (e) => {
if (e.target.matches(lineNumberSelector)) {
updateBlameAndBlobPermalinkCb();
}
diff --git a/app/assets/javascripts/blob/components/blob_content_error.vue b/app/assets/javascripts/blob/components/blob_content_error.vue
index 7344b9cdff5..4c5d9831237 100644
--- a/app/assets/javascripts/blob/components/blob_content_error.vue
+++ b/app/assets/javascripts/blob/components/blob_content_error.vue
@@ -25,7 +25,7 @@ export default {
},
renderErrorReason() {
const defaultReasonPath = Object.keys(BLOB_RENDER_ERRORS.REASONS).find(
- reason => BLOB_RENDER_ERRORS.REASONS[reason].id === this.viewerError,
+ (reason) => BLOB_RENDER_ERRORS.REASONS[reason].id === this.viewerError,
);
const defaultReason = BLOB_RENDER_ERRORS.REASONS[defaultReasonPath].text;
return this.notStoredExternally
diff --git a/app/assets/javascripts/blob/components/blob_header_default_actions.vue b/app/assets/javascripts/blob/components/blob_header_default_actions.vue
index 6eddec31166..b9f2c5b42e4 100644
--- a/app/assets/javascripts/blob/components/blob_header_default_actions.vue
+++ b/app/assets/javascripts/blob/components/blob_header_default_actions.vue
@@ -16,6 +16,7 @@ export default {
directives: {
GlTooltip: GlTooltipDirective,
},
+ inject: ['blobHash'],
props: {
rawPath: {
type: String,
@@ -32,7 +33,6 @@ export default {
default: false,
},
},
- inject: ['blobHash'],
computed: {
downloadUrl() {
return `${this.rawPath}?inline=false`;
@@ -50,7 +50,7 @@ export default {
};
</script>
<template>
- <gl-button-group>
+ <gl-button-group data-qa-selector="default_actions_container">
<gl-button
v-if="!hasRenderError"
v-gl-tooltip.hover
@@ -59,6 +59,7 @@ export default {
:disabled="copyDisabled"
:data-clipboard-target="getBlobHashTarget"
data-testid="copyContentsButton"
+ data-qa-selector="copy_contents_button"
icon="copy-to-clipboard"
category="primary"
variant="default"
diff --git a/app/assets/javascripts/blob/file_template_mediator.js b/app/assets/javascripts/blob/file_template_mediator.js
index 8f64bda1ba6..c35f9934004 100644
--- a/app/assets/javascripts/blob/file_template_mediator.js
+++ b/app/assets/javascripts/blob/file_template_mediator.js
@@ -9,6 +9,7 @@ import { deprecatedCreateFlash as Flash } from '../flash';
import FileTemplateTypeSelector from './template_selectors/type_selector';
import BlobCiYamlSelector from './template_selectors/ci_yaml_selector';
+import BlobCiSyntaxYamlSelector from './template_selectors/ci_syntax_yaml_selector';
import DockerfileSelector from './template_selectors/dockerfile_selector';
import GitignoreSelector from './template_selectors/gitignore_selector';
import LicenseSelector from './template_selectors/license_selector';
@@ -33,24 +34,30 @@ export default class FileTemplateMediator {
this.templateSelectors = [
GitignoreSelector,
BlobCiYamlSelector,
+ BlobCiSyntaxYamlSelector,
MetricsDashboardSelector,
DockerfileSelector,
LicenseSelector,
- ].map(TemplateSelectorClass => new TemplateSelectorClass({ mediator: this }));
+ ].map((TemplateSelectorClass) => new TemplateSelectorClass({ mediator: this }));
}
initTemplateTypeSelector() {
this.typeSelector = new FileTemplateTypeSelector({
mediator: this,
- dropdownData: this.templateSelectors.map(templateSelector => {
- const cfg = templateSelector.config;
-
- return {
- name: cfg.name,
- key: cfg.key,
- id: cfg.key,
- };
- }),
+ dropdownData: this.templateSelectors
+ .map((templateSelector) => {
+ const cfg = templateSelector.config;
+
+ return {
+ name: cfg.name,
+ key: cfg.key,
+ id: cfg.key,
+ };
+ })
+ .reduce(
+ (acc, current) => (acc.find((item) => item.id === current.id) ? acc : [...acc, current]),
+ [],
+ ),
});
}
@@ -92,7 +99,7 @@ export default class FileTemplateMediator {
}
listenForPreviewMode() {
- this.$navLinks.on('click', 'a', e => {
+ this.$navLinks.on('click', 'a', (e) => {
const urlPieces = e.target.href.split('#');
const hash = urlPieces[1];
if (hash === 'preview') {
@@ -108,7 +115,7 @@ export default class FileTemplateMediator {
e.preventDefault();
}
- this.templateSelectors.forEach(selector => {
+ this.templateSelectors.forEach((selector) => {
if (selector.config.key === item.key) {
selector.show();
} else {
@@ -131,7 +138,7 @@ export default class FileTemplateMediator {
selector.renderLoading();
this.fetchFileTemplate(selector.config.type, query, data)
- .then(file => {
+ .then((file) => {
this.setEditorContent(file);
this.setFilename(name);
selector.renderLoaded();
@@ -150,12 +157,12 @@ export default class FileTemplateMediator {
initPopover(suggestCommitChanges);
}
})
- .catch(err => new Flash(`An error occurred while fetching the template: ${err}`));
+ .catch((err) => new Flash(`An error occurred while fetching the template: ${err}`));
}
displayMatchedTemplateSelector() {
const currentInput = this.getFilename();
- this.templateSelectors.forEach(selector => {
+ this.templateSelectors.forEach((selector) => {
const match = selector.config.pattern.test(currentInput);
if (match) {
@@ -167,8 +174,8 @@ export default class FileTemplateMediator {
}
fetchFileTemplate(type, query, data = {}) {
- return new Promise(resolve => {
- const resolveFile = file => resolve(file);
+ return new Promise((resolve) => {
+ const resolveFile = (file) => resolve(file);
Api.projectTemplate(this.projectId, type, query, data, resolveFile);
});
@@ -187,7 +194,7 @@ export default class FileTemplateMediator {
}
findTemplateSelectorByKey(key) {
- return this.templateSelectors.find(selector => selector.config.key === key);
+ return this.templateSelectors.find((selector) => selector.config.key === key);
}
hideTemplateSelectorMenu() {
@@ -243,6 +250,6 @@ export default class FileTemplateMediator {
}
getSelected() {
- return this.templateSelectors.find(selector => selector.selected);
+ return this.templateSelectors.find((selector) => selector.selected);
}
}
diff --git a/app/assets/javascripts/blob/notebook/notebook_viewer.vue b/app/assets/javascripts/blob/notebook/notebook_viewer.vue
index ea33d621d47..02f93e14219 100644
--- a/app/assets/javascripts/blob/notebook/notebook_viewer.vue
+++ b/app/assets/javascripts/blob/notebook/notebook_viewer.vue
@@ -45,12 +45,12 @@ export default {
loadFile() {
axios
.get(this.endpoint)
- .then(res => res.data)
- .then(data => {
+ .then((res) => res.data)
+ .then((data) => {
this.json = data;
this.loading = false;
})
- .catch(e => {
+ .catch((e) => {
if (e.status !== 200) {
this.loadError = true;
}
diff --git a/app/assets/javascripts/blob/openapi/index.js b/app/assets/javascripts/blob/openapi/index.js
index 12cc2be8246..e6dc463f764 100644
--- a/app/assets/javascripts/blob/openapi/index.js
+++ b/app/assets/javascripts/blob/openapi/index.js
@@ -12,7 +12,7 @@ export default () => {
dom_id: '#js-openapi-viewer',
});
})
- .catch(error => {
+ .catch((error) => {
flash(__('Something went wrong while initializing the OpenAPI viewer'));
throw error;
});
diff --git a/app/assets/javascripts/blob/pipeline_tour_success_modal.vue b/app/assets/javascripts/blob/pipeline_tour_success_modal.vue
index 02a522dda9d..fdaa4b082f7 100644
--- a/app/assets/javascripts/blob/pipeline_tour_success_modal.vue
+++ b/app/assets/javascripts/blob/pipeline_tour_success_modal.vue
@@ -98,7 +98,7 @@ export default {
</template>
<p>
<gl-sprintf :message="$options.i18n.bodyMessage">
- <template #codeQualityLink="{content}">
+ <template #codeQualityLink="{ content }">
<gl-link :href="codeQualityLink" target="_blank" class="font-size-inherit">{{
content
}}</gl-link>
@@ -106,12 +106,12 @@ export default {
</gl-sprintf>
</p>
<gl-sprintf :message="$options.i18n.helpMessage">
- <template #beginnerLink="{content}">
+ <template #beginnerLink="{ content }">
<gl-link :href="$options.beginnerLink" target="_blank">
{{ content }}
</gl-link>
</template>
- <template #exampleLink="{content}">
+ <template #exampleLink="{ content }">
<gl-link :href="exampleLink" target="_blank">
{{ content }}
</gl-link>
diff --git a/app/assets/javascripts/blob/sketch/index.js b/app/assets/javascripts/blob/sketch/index.js
index 767e205fcaa..d257810da65 100644
--- a/app/assets/javascripts/blob/sketch/index.js
+++ b/app/assets/javascripts/blob/sketch/index.js
@@ -12,9 +12,9 @@ export default class SketchLoader {
load() {
return this.getZipFile()
- .then(data => JSZip.loadAsync(data))
- .then(asyncResult => asyncResult.files['previews/preview.png'].async('uint8array'))
- .then(content => {
+ .then((data) => JSZip.loadAsync(data))
+ .then((asyncResult) => asyncResult.files['previews/preview.png'].async('uint8array'))
+ .then((content) => {
const url = window.URL || window.webkitURL;
const blob = new Blob([new Uint8Array(content)], {
type: 'image/png',
diff --git a/app/assets/javascripts/blob/stl_viewer.js b/app/assets/javascripts/blob/stl_viewer.js
index f129b6e631e..339906adc34 100644
--- a/app/assets/javascripts/blob/stl_viewer.js
+++ b/app/assets/javascripts/blob/stl_viewer.js
@@ -3,8 +3,8 @@ import Renderer from './3d_viewer';
export default () => {
const viewer = new Renderer(document.getElementById('js-stl-viewer'));
- [].slice.call(document.querySelectorAll('.js-material-changer')).forEach(el => {
- el.addEventListener('click', e => {
+ [].slice.call(document.querySelectorAll('.js-material-changer')).forEach((el) => {
+ el.addEventListener('click', (e) => {
const { target } = e;
e.preventDefault();
diff --git a/app/assets/javascripts/blob/suggest_gitlab_ci_yml/index.js b/app/assets/javascripts/blob/suggest_gitlab_ci_yml/index.js
index 55edb852ee6..d0dd80932cc 100644
--- a/app/assets/javascripts/blob/suggest_gitlab_ci_yml/index.js
+++ b/app/assets/javascripts/blob/suggest_gitlab_ci_yml/index.js
@@ -1,7 +1,7 @@
import Vue from 'vue';
import Popover from './components/popover.vue';
-export default el =>
+export default (el) =>
new Vue({
el,
render(createElement) {
diff --git a/app/assets/javascripts/blob/template_selector.js b/app/assets/javascripts/blob/template_selector.js
index ae9bb3455f0..9fa70ce3c62 100644
--- a/app/assets/javascripts/blob/template_selector.js
+++ b/app/assets/javascripts/blob/template_selector.js
@@ -26,12 +26,12 @@ export default class TemplateSelector {
data,
filterable: true,
selectable: true,
- toggleLabel: item => item.name,
+ toggleLabel: (item) => item.name,
search: {
fields: ['name'],
},
- clicked: options => this.onDropdownClicked(options),
- text: item => item.name,
+ clicked: (options) => this.onDropdownClicked(options),
+ text: (item) => item.name,
});
}
@@ -46,7 +46,7 @@ export default class TemplateSelector {
}
listenForFilenameInput() {
- return this.$filenameInput.on('keyup blur', e => this.renderMatchedDropdown(e));
+ return this.$filenameInput.on('keyup blur', (e) => this.renderMatchedDropdown(e));
}
renderMatchedDropdown() {
diff --git a/app/assets/javascripts/blob/template_selectors/ci_syntax_yaml_selector.js b/app/assets/javascripts/blob/template_selectors/ci_syntax_yaml_selector.js
new file mode 100644
index 00000000000..9370e170571
--- /dev/null
+++ b/app/assets/javascripts/blob/template_selectors/ci_syntax_yaml_selector.js
@@ -0,0 +1,29 @@
+import FileTemplateSelector from '../file_template_selector';
+import initDeprecatedJQueryDropdown from '~/deprecated_jquery_dropdown';
+
+export default class BlobCiSyntaxYamlSelector extends FileTemplateSelector {
+ constructor({ mediator }) {
+ super(mediator);
+ this.config = {
+ key: 'gitlab-ci-yaml',
+ name: '.gitlab-ci.yml',
+ pattern: /(.gitlab-ci.yml)/,
+ type: 'gitlab_ci_syntax_ymls',
+ dropdown: '.js-gitlab-ci-syntax-yml-selector',
+ wrapper: '.js-gitlab-ci-syntax-yml-selector-wrap',
+ };
+ }
+
+ initDropdown() {
+ initDeprecatedJQueryDropdown(this.$dropdown, {
+ data: this.$dropdown.data('data'),
+ filterable: true,
+ selectable: true,
+ search: {
+ fields: ['name'],
+ },
+ clicked: (options) => this.reportSelectionName(options),
+ text: (item) => item.name,
+ });
+ }
+}
diff --git a/app/assets/javascripts/blob/template_selectors/ci_yaml_selector.js b/app/assets/javascripts/blob/template_selectors/ci_yaml_selector.js
index 3a4e86fe572..3879a6c5742 100644
--- a/app/assets/javascripts/blob/template_selectors/ci_yaml_selector.js
+++ b/app/assets/javascripts/blob/template_selectors/ci_yaml_selector.js
@@ -23,8 +23,8 @@ export default class BlobCiYamlSelector extends FileTemplateSelector {
search: {
fields: ['name'],
},
- clicked: options => this.reportSelectionName(options),
- text: item => item.name,
+ clicked: (options) => this.reportSelectionName(options),
+ text: (item) => item.name,
});
}
}
diff --git a/app/assets/javascripts/blob/template_selectors/dockerfile_selector.js b/app/assets/javascripts/blob/template_selectors/dockerfile_selector.js
index 3cb4bb83930..5d976c5acdb 100644
--- a/app/assets/javascripts/blob/template_selectors/dockerfile_selector.js
+++ b/app/assets/javascripts/blob/template_selectors/dockerfile_selector.js
@@ -24,8 +24,8 @@ export default class DockerfileSelector extends FileTemplateSelector {
search: {
fields: ['name'],
},
- clicked: options => this.reportSelectionName(options),
- text: item => item.name,
+ clicked: (options) => this.reportSelectionName(options),
+ text: (item) => item.name,
});
}
}
diff --git a/app/assets/javascripts/blob/template_selectors/gitignore_selector.js b/app/assets/javascripts/blob/template_selectors/gitignore_selector.js
index 1721230dcb7..1bb1cbb74de 100644
--- a/app/assets/javascripts/blob/template_selectors/gitignore_selector.js
+++ b/app/assets/javascripts/blob/template_selectors/gitignore_selector.js
@@ -22,8 +22,8 @@ export default class BlobGitignoreSelector extends FileTemplateSelector {
search: {
fields: ['name'],
},
- clicked: options => this.reportSelectionName(options),
- text: item => item.name,
+ clicked: (options) => this.reportSelectionName(options),
+ text: (item) => item.name,
});
}
}
diff --git a/app/assets/javascripts/blob/template_selectors/license_selector.js b/app/assets/javascripts/blob/template_selectors/license_selector.js
index dafde82b1e0..affa20997e9 100644
--- a/app/assets/javascripts/blob/template_selectors/license_selector.js
+++ b/app/assets/javascripts/blob/template_selectors/license_selector.js
@@ -22,7 +22,7 @@ export default class BlobLicenseSelector extends FileTemplateSelector {
search: {
fields: ['name'],
},
- clicked: options => {
+ clicked: (options) => {
const { e } = options;
const el = options.$el;
const query = options.selectedObj;
@@ -39,7 +39,7 @@ export default class BlobLicenseSelector extends FileTemplateSelector {
data,
});
},
- text: item => item.name,
+ text: (item) => item.name,
});
}
}
diff --git a/app/assets/javascripts/blob/template_selectors/metrics_dashboard_selector.js b/app/assets/javascripts/blob/template_selectors/metrics_dashboard_selector.js
index 9e698bfea5d..42adab05ce3 100644
--- a/app/assets/javascripts/blob/template_selectors/metrics_dashboard_selector.js
+++ b/app/assets/javascripts/blob/template_selectors/metrics_dashboard_selector.js
@@ -22,8 +22,8 @@ export default class MetricsDashboardSelector extends FileTemplateSelector {
search: {
fields: ['name'],
},
- clicked: options => this.reportSelectionName(options),
- text: item => item.name,
+ clicked: (options) => this.reportSelectionName(options),
+ text: (item) => item.name,
});
}
}
diff --git a/app/assets/javascripts/blob/template_selectors/type_selector.js b/app/assets/javascripts/blob/template_selectors/type_selector.js
index 01625911815..f74f7535d99 100644
--- a/app/assets/javascripts/blob/template_selectors/type_selector.js
+++ b/app/assets/javascripts/blob/template_selectors/type_selector.js
@@ -17,8 +17,8 @@ export default class FileTemplateTypeSelector extends FileTemplateSelector {
data: this.config.dropdownData,
filterable: false,
selectable: true,
- clicked: options => this.mediator.selectTemplateTypeOptions(options),
- text: item => item.name,
+ clicked: (options) => this.mediator.selectTemplateTypeOptions(options),
+ text: (item) => item.name,
});
}
}
diff --git a/app/assets/javascripts/blob/viewer/index.js b/app/assets/javascripts/blob/viewer/index.js
index 01350acad0c..4e6ec20ec64 100644
--- a/app/assets/javascripts/blob/viewer/index.js
+++ b/app/assets/javascripts/blob/viewer/index.js
@@ -7,7 +7,7 @@ import eventHub from '../../notes/event_hub';
import { __ } from '~/locale';
import { fixTitle } from '~/tooltips';
-const loadRichBlobViewer = type => {
+const loadRichBlobViewer = (type) => {
switch (type) {
case 'balsamiq':
return import(/* webpackChunkName: 'balsamiq_viewer' */ '../balsamiq_viewer');
@@ -30,8 +30,8 @@ export const handleBlobRichViewer = (viewer, type) => {
if (!viewer || !type) return;
loadRichBlobViewer(type)
- .then(module => module?.default(viewer))
- .catch(error => {
+ .then((module) => module?.default(viewer))
+ .catch((error) => {
Flash(__('Error loading file viewer.'));
throw error;
});
@@ -84,7 +84,7 @@ export default class BlobViewer {
initBindings() {
if (this.switcherBtns.length) {
- Array.from(this.switcherBtns).forEach(el => {
+ Array.from(this.switcherBtns).forEach((el) => {
el.addEventListener('click', this.switchViewHandler.bind(this));
});
}
@@ -155,7 +155,7 @@ export default class BlobViewer {
this.toggleCopyButtonState();
BlobViewer.loadViewer(newViewer)
- .then(viewer => {
+ .then((viewer) => {
$(viewer).renderGFM();
this.$fileHolder.trigger('highlight:line');