Commit 088de723 authored by Filipa Lacerda's avatar Filipa Lacerda

[ci skip] Fix more eslint rules

parent 7c7f5266
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import LineHighlighter from '../../line_highlighter'; import LineHighlighter from '../../line_highlighter';
import syntaxHighlight from '../../syntax_highlight'; import syntaxHighlight from '../../syntax_highlight';
export default { export default {
computed: { computed: {
...mapGetters([ ...mapGetters([
'activeFile', 'activeFile',
]), ]),
renderErrorTooLarge() { renderErrorTooLarge() {
return this.activeFile.renderError === 'too_large'; return this.activeFile.renderError === 'too_large';
},
}, },
}, mounted() {
methods: {
highlightFile() {
syntaxHighlight($(this.$el).find('.file-content'));
},
},
mounted() {
this.highlightFile();
this.lineHighlighter = new LineHighlighter({
fileHolderSelector: '.blob-viewer-container',
scrollFileHolder: true,
});
},
updated() {
this.$nextTick(() => {
this.highlightFile(); this.highlightFile();
}); this.lineHighlighter = new LineHighlighter({
}, fileHolderSelector: '.blob-viewer-container',
}; scrollFileHolder: true,
});
},
updated() {
this.$nextTick(() => {
this.highlightFile();
});
},
methods: {
highlightFile() {
syntaxHighlight($(this.$el).find('.file-content'));
},
},
};
</script> </script>
<template> <template>
<div> <div>
<div <div
v-if="!activeFile.renderError" v-if="!activeFile.renderError"
v-html="activeFile.html" v-html="activeFile.html"
class="multi-file-preview-holder" class="multi-file-preview-holder"
> >
</div> </div>
<div <div
v-else-if="activeFile.tempFile" v-else-if="activeFile.tempFile"
class="vertical-center render-error"> class="vertical-center render-error">
<p class="text-center"> <p class="text-center">
The source could not be displayed for this temporary file. The source could not be displayed for this temporary file.
</p> </p>
</div> </div>
<div <div
v-else-if="renderErrorTooLarge" v-else-if="renderErrorTooLarge"
class="vertical-center render-error"> class="vertical-center render-error">
<p class="text-center"> <p class="text-center">
The source could not be displayed because it is too large. You can <a :href="activeFile.rawPath" download>download</a> it instead. The source could not be displayed because it is too large.
</p> You can <a
</div> :href="activeFile.rawPath"
<div download>download</a> it instead.
v-else </p>
class="vertical-center render-error"> </div>
<p class="text-center"> <div
The source could not be displayed because a rendering error occurred. You can <a :href="activeFile.rawPath" download>download</a> it instead. v-else
</p> class="vertical-center render-error">
<p class="text-center">
The source could not be displayed because a rendering error occurred.
You can <a
:href="activeFile.rawPath"
download>download</a> it instead.
</p>
</div>
</div> </div>
</div>
</template> </template>
<script> <script>
import { mapActions } from 'vuex'; import { mapActions } from 'vuex';
import fileIcon from '../../vue_shared/components/file_icon.vue'; import fileIcon from '../../vue_shared/components/file_icon.vue';
export default { export default {
props: { components: {
tab: { fileIcon,
type: Object,
required: true,
}, },
}, props: {
components: { tab: {
fileIcon, type: Object,
}, required: true,
computed: { },
closeLabel() {
if (this.tab.changed || this.tab.tempFile) {
return `${this.tab.name} changed`;
}
return `Close ${this.tab.name}`;
}, },
changedClass() { computed: {
const tabChangedObj = { closeLabel() {
'fa-times close-icon': !this.tab.changed && !this.tab.tempFile, if (this.tab.changed || this.tab.tempFile) {
'fa-circle unsaved-icon': this.tab.changed || this.tab.tempFile, return `${this.tab.name} changed`;
}; }
return tabChangedObj; return `Close ${this.tab.name}`;
},
changedClass() {
const tabChangedObj = {
'fa-times close-icon': !this.tab.changed && !this.tab.tempFile,
'fa-circle unsaved-icon': this.tab.changed || this.tab.tempFile,
};
return tabChangedObj;
},
}, },
},
methods: { methods: {
...mapActions([ ...mapActions([
'closeFile', 'closeFile',
]), ]),
clickFile(tab) { clickFile(tab) {
this.$router.push(`/project${tab.url}`); this.$router.push(`/project${tab.url}`);
},
}, },
}, };
};
</script> </script>
<template> <template>
<li <li @click="clickFile(tab)">
@click="clickFile(tab)"
>
<button <button
type="button" type="button"
class="multi-file-tab-close" class="multi-file-tab-close"
...@@ -69,8 +67,7 @@ export default { ...@@ -69,8 +67,7 @@ export default {
<file-icon <file-icon
:file-name="tab.name" :file-name="tab.name"
:size="16" :size="16"
> />
</file-icon>
{{ tab.name }} {{ tab.name }}
</div> </div>
</li> </li>
......
<script> <script>
import Visibility from 'visibilityjs'; import Visibility from 'visibilityjs';
import { visitUrl } from '../../lib/utils/url_utility'; import { visitUrl } from '../../lib/utils/url_utility';
import Poll from '../../lib/utils/poll'; import Poll from '../../lib/utils/poll';
import eventHub from '../event_hub'; import eventHub from '../event_hub';
import Service from '../services/index'; import Service from '../services/index';
import Store from '../stores'; import Store from '../stores';
import titleComponent from './title.vue'; import titleComponent from './title.vue';
import descriptionComponent from './description.vue'; import descriptionComponent from './description.vue';
import editedComponent from './edited.vue'; import editedComponent from './edited.vue';
import formComponent from './form.vue'; import formComponent from './form.vue';
import recaptchaModalImplementor from '../../vue_shared/mixins/recaptcha_modal_implementor'; import recaptchaModalImplementor from '../../vue_shared/mixins/recaptcha_modal_implementor';
export default { export default {
props: { components: {
endpoint: { descriptionComponent,
required: true, titleComponent,
type: String, editedComponent,
formComponent,
}, },
updateEndpoint: { mixins: [
required: true, recaptchaModalImplementor,
type: String, ],
}, props: {
canUpdate: { endpoint: {
required: true, required: true,
type: Boolean, type: String,
}, },
canDestroy: { updateEndpoint: {
required: true, required: true,
type: Boolean, type: String,
}, },
showInlineEditButton: { canUpdate: {
type: Boolean, required: true,
required: false, type: Boolean,
default: true, },
}, canDestroy: {
showDeleteButton: { required: true,
type: Boolean, type: Boolean,
required: false, },
default: true, showInlineEditButton: {
}, type: Boolean,
enableAutocomplete: { required: false,
type: Boolean, default: true,
required: false, },
default: true, showDeleteButton: {
}, type: Boolean,
issuableRef: { required: false,
type: String, default: true,
required: true, },
}, enableAutocomplete: {
initialTitleHtml: { type: Boolean,
type: String, required: false,
required: true, default: true,
}, },
initialTitleText: { issuableRef: {
type: String, type: String,
required: true, required: true,
}, },
initialDescriptionHtml: { initialTitleHtml: {
type: String, type: String,
required: false, required: true,
default: '', },
}, initialTitleText: {
initialDescriptionText: { type: String,
type: String, required: true,
required: false, },
default: '', initialDescriptionHtml: {
}, type: String,
initialTaskStatus: { required: false,
type: String, default: '',
required: false, },
default: '', initialDescriptionText: {
}, type: String,
updatedAt: { required: false,
type: String, default: '',
required: false, },
default: '', initialTaskStatus: {
}, type: String,
updatedByName: { required: false,
type: String, default: '',
required: false, },
default: '', updatedAt: {
}, type: String,
updatedByPath: { required: false,
type: String, default: '',
required: false, },
default: '', updatedByName: {
}, type: String,
issuableTemplates: { required: false,
type: Array, default: '',
required: false, },
default: () => [], updatedByPath: {
}, type: String,
markdownPreviewPath: { required: false,
type: String, default: '',
required: true, },
}, issuableTemplates: {
markdownDocsPath: { type: Array,
type: String, required: false,
required: true, default: () => [],
}, },
projectPath: { markdownPreviewPath: {
type: String, type: String,
required: true, required: true,
}, },
projectNamespace: { markdownDocsPath: {
type: String, type: String,
required: true, required: true,
}, },
issuableType: { projectPath: {
type: String, type: String,
required: false, required: true,
default: 'issue', },
}, projectNamespace: {
canAttachFile: { type: String,
type: Boolean, required: true,
required: false, },
default: true, issuableType: {
type: String,
required: false,
default: 'issue',
},
canAttachFile: {
type: Boolean,
required: false,
default: true,
},
}, },
}, data() {
data() { const store = new Store({
const store = new Store({ titleHtml: this.initialTitleHtml,
titleHtml: this.initialTitleHtml, titleText: this.initialTitleText,
titleText: this.initialTitleText, descriptionHtml: this.initialDescriptionHtml,
descriptionHtml: this.initialDescriptionHtml, descriptionText: this.initialDescriptionText,
descriptionText: this.initialDescriptionText, updatedAt: this.updatedAt,
updatedAt: this.updatedAt, updatedByName: this.updatedByName,
updatedByName: this.updatedByName, updatedByPath: this.updatedByPath,
updatedByPath: this.updatedByPath, taskStatus: this.initialTaskStatus,
taskStatus: this.initialTaskStatus, });
});
return { return {
store, store,
state: store.state, state: store.state,
showForm: false, showForm: false,
}; };
},
computed: {
formState() {
return this.store.formState;
}, },
hasUpdated() { computed: {
return !!this.state.updatedAt; formState() {
return this.store.formState;
},
hasUpdated() {
return !!this.state.updatedAt;
},
}, },
}, created() {
components: { this.service = new Service(this.endpoint);
descriptionComponent, this.poll = new Poll({
titleComponent, resource: this.service,
editedComponent, method: 'getData',
formComponent, successCallback: res => this.store.updateState(res.data),
}, errorCallback(err) {
throw new Error(err);
mixins: [ },
recaptchaModalImplementor, });
],
methods: { if (!Visibility.hidden()) {
openForm() { this.poll.makeRequest();
if (!this.showForm) {
this.showForm = true;
this.store.setFormState({
title: this.state.titleText,
description: this.state.descriptionText,
lockedWarningVisible: false,
updateLoading: false,
});
} }
},
closeForm() {
this.showForm = false;
},
updateIssuable() {
return this.service.updateIssuable(this.store.formState)
.then(res => res.data)
.then(data => this.checkForSpam(data))
.then((data) => {
if (location.pathname !== data.web_url) {
visitUrl(data.web_url);
}
return this.service.getData();
})
.then(res => res.data)
.then((data) => {
this.store.updateState(data);
eventHub.$emit('close.form');
})
.catch((error) => {
if (error && error.name === 'SpamError') {
this.openRecaptcha();
} else {
eventHub.$emit('close.form');
window.Flash(`Error updating ${this.issuableType}`);
}
});
},
closeRecaptchaModal() { Visibility.change(() => {
this.store.setFormState({ if (!Visibility.hidden()) {
updateLoading: false, this.poll.restart();
} else {
this.poll.stop();
}
}); });
this.closeRecaptcha(); eventHub.$on('delete.issuable', this.deleteIssuable);
eventHub.$on('update.issuable', this.updateIssuable);
eventHub.$on('close.form', this.closeForm);
eventHub.$on('open.form', this.openForm);
},
beforeDestroy() {
eventHub.$off('delete.issuable', this.deleteIssuable);
eventHub.$off('update.issuable', this.updateIssuable);
eventHub.$off('close.form', this.closeForm);
eventHub.$off('open.form', this.openForm);
}, },
methods: {
openForm() {
if (!this.showForm) {
this.showForm = true;
this.store.setFormState({
title: this.state.titleText,
description: this.state.descriptionText,
lockedWarningVisible: false,
updateLoading: false,
});
}
},
closeForm() {
this.showForm = false;
},
deleteIssuable() { updateIssuable() {
this.service.deleteIssuable() return this.service.updateIssuable(this.store.formState)
.then(res => res.data) .then(res => res.data)
.then((data) => { .then(data => this.checkForSpam(data))
// Stop the poll so we don't get 404's with the issuable not existing .then((data) => {
this.poll.stop(); if (location.pathname !== data.web_url) {
visitUrl(data.web_url);
}
visitUrl(data.web_url); return this.service.getData();
}) })
.catch(() => { .then(res => res.data)
eventHub.$emit('close.form'); .then((data) => {
window.Flash(`Error deleting ${this.issuableType}`); this.store.updateState(data);
}); eventHub.$emit('close.form');
}, })
}, .catch((error) => {
created() { if (error && error.name === 'SpamError') {
this.service = new Service(this.endpoint); this.openRecaptcha();
this.poll = new Poll({ } else {
resource: this.service, eventHub.$emit('close.form');
method: 'getData', window.Flash(`Error updating ${this.issuableType}`);
successCallback: res => this.store.updateState(res.data), }
errorCallback(err) { });
throw new Error(err);
}, },
});
if (!Visibility.hidden()) { closeRecaptchaModal() {
this.poll.makeRequest(); this.store.setFormState({
} updateLoading: false,
});
this.closeRecaptcha();
},
Visibility.change(() => { deleteIssuable() {
if (!Visibility.hidden()) { this.service.deleteIssuable()
this.poll.restart(); .then(res => res.data)
} else { .then((data) => {
this.poll.stop(); // Stop the poll so we don't get 404's with the issuable not existing
} this.poll.stop();
});
eventHub.$on('delete.issuable', this.deleteIssuable); visitUrl(data.web_url);
eventHub.$on('update.issuable', this.updateIssuable); })
eventHub.$on('close.form', this.closeForm); .catch(() => {
eventHub.$on('open.form', this.openForm); eventHub.$emit('close.form');
}, window.Flash(`Error deleting ${this.issuableType}`);
beforeDestroy() { });
eventHub.$off('delete.issuable', this.deleteIssuable); },
eventHub.$off('update.issuable', this.updateIssuable); },
eventHub.$off('close.form', this.closeForm); };
eventHub.$off('open.form', this.openForm);
},
};
</script> </script>
<template> <template>
<div> <div>
<div v-if="canUpdate && showForm"> <div v-if="canUpdate && showForm">
<form-component <form-component
:form-state="formState" :form-state="formState"
:can-destroy="canDestroy" :can-destroy="canDestroy"
:issuable-templates="issuableTemplates" :issuable-templates="issuableTemplates"
:markdown-docs-path="markdownDocsPath" :markdown-docs-path="markdownDocsPath"
:markdown-preview-path="markdownPreviewPath" :markdown-preview-path="markdownPreviewPath"
:project-path="projectPath" :project-path="projectPath"
:project-namespace="projectNamespace" :project-namespace="projectNamespace"
:show-delete-button="showDeleteButton" :show-delete-button="showDeleteButton"
:can-attach-file="canAttachFile" :can-attach-file="canAttachFile"
:enable-autocomplete="enableAutocomplete" :enable-autocomplete="enableAutocomplete"
/> />
<recaptcha-modal <recaptcha-modal
v-show="showRecaptcha" v-show="showRecaptcha"
:html="recaptchaHTML" :html="recaptchaHTML"
@close="closeRecaptchaModal" @close="closeRecaptchaModal"
/> />
</div> </div>
<div v-else> <div v-else>
<title-component <title-component
:issuable-ref="issuableRef" :issuable-ref="issuableRef"
:can-update="canUpdate" :can-update="canUpdate"
:title-html="state.titleHtml" :title-html="state.titleHtml"
:title-text="state.titleText" :title-text="state.titleText"
:show-inline-edit-button="showInlineEditButton" :show-inline-edit-button="showInlineEditButton"
/> />
<description-component <description-component
v-if="state.descriptionHtml" v-if="state.descriptionHtml"
:can-update="canUpdate" :can-update="canUpdate"
:description-html="state.descriptionHtml" :description-html="state.descriptionHtml"
:description-text="state.descriptionText" :description-text="state.descriptionText"
:updated-at="state.updatedAt" :updated-at="state.updatedAt"
:task-status="state.taskStatus" :task-status="state.taskStatus"
:issuable-type="issuableType" :issuable-type="issuableType"
:update-url="updateEndpoint" :update-url="updateEndpoint"
/> />
<edited-component <edited-component
v-if="hasUpdated" v-if="hasUpdated"
:updated-at="state.updatedAt" :updated-at="state.updatedAt"
:updated-by-name="state.updatedByName" :updated-by-name="state.updatedByName"
:updated-by-path="state.updatedByPath" :updated-by-path="state.updatedByPath"
/> />
</div>
</div> </div>
</div>
</template> </template>
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
import markdownField from '../../../vue_shared/components/markdown/field.vue'; import markdownField from '../../../vue_shared/components/markdown/field.vue';
export default { export default {
mixins: [updateMixin],
components: { components: {
markdownField, markdownField,
}, },
mixins: [updateMixin],
props: { props: {
formState: { formState: {
type: Object, type: Object,
......
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
import { spriteIcon } from '../../lib/utils/common_utils'; import { spriteIcon } from '../../lib/utils/common_utils';
export default { export default {
mixins: [animateMixin],
directives: { directives: {
tooltip, tooltip,
}, },
mixins: [animateMixin],
props: { props: {
issuableRef: { issuableRef: {
type: String, type: String,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
import loadingIcon from '../../vue_shared/components/loading_icon.vue'; import loadingIcon from '../../vue_shared/components/loading_icon.vue';
export default { export default {
name: 'jobHeaderSection', name: 'JobHeaderSection',
components: { components: {
ciHeader, ciHeader,
loadingIcon, loadingIcon,
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
mixins: [MonitoringMixin], mixins: [MonitoringMixin],
props: { props: {
graphData: { graphData: {
type: Object, type: Object,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment