BigW Consortium Gitlab

Fix eslint offenses

parent 4ae39ceb
......@@ -103,16 +103,15 @@ const Api = {
return $.ajax({
url,
headers: {
'PRIVATE_TOKEN': token,
PRIVATE_TOKEN: token,
},
type: 'POST',
contentType: "application/json; charset=utf-8",
contentType: 'application/json; charset=utf-8',
data: JSON.stringify(data),
dataType: 'json',
})
.done(commitData => callback(commitData))
.fail(message => callback(message.responseJSON));
},
// Return text for a specific license
......
......@@ -77,7 +77,7 @@ import Cookies from 'js-cookie';
},
dataType: "json"
}).done(function(refs) {
console.log(refs)
console.log(refs);
return callback(refs);
});
},
......
......@@ -19,12 +19,12 @@ function initRepo() {
Store.service.url = repo.dataset.url;
Store.projectName = repo.dataset.projectName;
Store.service.refsUrl = repo.dataset.refsUrl;
Store.currentBranch = $("button.dropdown-menu-toggle").attr('data-ref');
Store.currentBranch = $('button.dropdown-menu-toggle').attr('data-ref');
Store.checkIsCommitable();
Store.projectId = repo.dataset.projectId;
Store.tempPrivateToken = repo.dataset.tempToken;
new Vue({
this.vm = new Vue({
el: repo,
data: () => Store,
template: `
......@@ -45,7 +45,7 @@ function initRepo() {
'repo-file-buttons': RepoFileButtons,
'repo-binary-viewer': RepoBinaryViewer,
'repo-editor': RepoEditor,
'repo-commit-section': RepoCommitSection
'repo-commit-section': RepoCommitSection,
},
});
......
<script>
import Vue from 'vue';
import Store from './repo_store';
import RepoHelper from './repo_helper';
......
<script>
import Vue from 'vue';
/* global Flash */
import Store from './repo_store';
import Api from '../api'
import Api from '../api';
const RepoCommitSection = {
data: () => Store,
......@@ -9,21 +9,21 @@ const RepoCommitSection = {
methods: {
makeCommit() {
// see https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions
const branch = $("button.dropdown-menu-toggle").attr('data-ref');
const branch = $('button.dropdown-menu-toggle').attr('data-ref');
const commitMessage = this.commitMessage;
const actions = this.changedFiles.map(f => {
const filePath = f.url.split(branch)[1];
return {
action: 'update',
file_path: filePath,
content: f.newContent,
};
const actions = this.changedFiles.map((f) => {
const filePath = f.url.split(branch)[1];
return {
action: 'update',
file_path: filePath,
content: f.newContent,
};
});
const payload = {
branch: branch,
branch,
commit_message: commitMessage,
actions: actions,
}
actions,
};
Store.submitCommitsLoading = true;
Api.commitMultiple(Store.projectId, payload, (data) => {
Store.submitCommitsLoading = false;
......@@ -36,7 +36,7 @@ const RepoCommitSection = {
this.editMode = false;
$('html, body').animate({ scrollTop: 0 }, 'fast');
}, Store.tempPrivateToken);
}
},
},
computed: {
......@@ -46,7 +46,7 @@ const RepoCommitSection = {
return changedFileList;
},
},
}
};
export default RepoCommitSection;
</script>
......
<script>
/* global monaco */
import Vue from 'vue';
import Store from './repo_store';
import Helper from './repo_helper';
import monacoLoader from './monaco_loader';
......@@ -28,7 +27,7 @@ const RepoEditor = {
const newModel = monaco.editor.createModel(this.blobRaw, 'plaintext');
this.monacoInstance.setModel(newModel);
});
}).catch(Helper.loadingError);
});
},
......@@ -55,7 +54,7 @@ const RepoEditor = {
location.hash = `L${e.target.position.lineNumber}`;
Store.activeLine = e.target.position.lineNumber;
}
}
},
},
watch: {
......
<script>
import Vue from 'vue';
import Store from './repo_store';
import Helper from './repo_helper';
import RepoMiniMixin from './repo_mini_mixin';
......
......@@ -27,8 +27,8 @@ const RepoHelper = {
},
setDirectoryOpen(tree) {
let file = tree;
if (!file) return;
const file = tree;
if (!file) return undefined;
file.opened = true;
file.icon = 'fa-folder-open';
......@@ -91,14 +91,12 @@ const RepoHelper = {
return oldList;
},
compareFilesCaseInsensitive(a,b) {
compareFilesCaseInsensitive(a, b) {
const aName = a.name.toLowerCase();
const bName = b.name.toLowerCase();
if(a.level > 0) return 0;
if (aName < bName)
return -1;
if (aName > bName)
return 1;
if (a.level > 0) return 0;
if (aName < bName) { return -1; }
if (aName > bName) { return 1; }
return 0;
},
......@@ -109,7 +107,7 @@ const RepoHelper = {
.then((response) => {
const data = response.data;
// RepoHelper.setLoading(false, loadingData);
if(cb) cb();
if (cb) cb();
Store.isTree = RepoHelper.isTree(data);
if (!Store.isTree) {
if (!file) file = data;
......@@ -187,15 +185,13 @@ const RepoHelper = {
};
},
scrollTabsRight() {
// wait for the transition. 0.1 seconds.
setTimeout(() => {
const tabs = document.getElementById('tabs');
if(!tabs) return;
if (!tabs) return;
tabs.scrollLeft = 12000;
}, 200)
}, 200);
},
dataToListOfFiles(data) {
......
import Store from './repo_store';
import axios from 'axios';
import Store from './repo_store';
const RepoService = {
url: '',
......@@ -12,10 +12,10 @@ const RepoService = {
checkCurrentBranchIsCommitable() {
const url = Store.service.refsUrl;
return axios.get(url, {params: {
ref: Store.currentBranch,
search: Store.currentBranch
}});
return axios.get(url, { params: {
ref: Store.currentBranch,
search: Store.currentBranch,
} });
},
buildParams(url = this.url) {
......
<script>
import Vue from 'vue';
import Service from './repo_service';
import Helper from './repo_helper';
import Store from './repo_store';
......
/* global Flash */
import RepoHelper from './repo_helper';
const RepoStore = {
......@@ -37,7 +38,7 @@ const RepoStore = {
raw: false,
newContent: '',
changed: false,
loading: false
loading: false,
},
activeFileIndex: 0,
activeLine: 0,
......@@ -64,12 +65,12 @@ const RepoStore = {
checkIsCommitable() {
RepoStore.service.checkCurrentBranchIsCommitable()
.then((data) => {
// you shouldn't be able to make commits on commits or tags.
let {Branches, Commits, Tags} = data.data;
if(Branches && Branches.length) RepoStore.isCommitable = true;
if(Commits && Commits.length) RepoStore.isCommitable = false;
if(Tags && Tags.length) RepoStore.isCommitable = false;
});
// you shouldn't be able to make commits on commits or tags.
const { Branches, Commits, Tags } = data.data;
if (Branches && Branches.length) RepoStore.isCommitable = true;
if (Commits && Commits.length) RepoStore.isCommitable = false;
if (Tags && Tags.length) RepoStore.isCommitable = false;
}).catch(() => Flash('Failed to check if branch can be committed to.'));
},
addFilesToDirectory(inDirectory, currentList, newList) {
......@@ -126,11 +127,11 @@ const RepoStore = {
RepoStore.files = RepoStore.files.filter((file) => {
const isItTheTreeWeWant = file.url === treeToClose.url;
// if it's the next tree
if(foundTree && file.type === 'tree' && !isItTheTreeWeWant && file.level === treeToClose.level) {
if (foundTree && file.type === 'tree' && !isItTheTreeWeWant && file.level === treeToClose.level) {
wereDone = true;
return true;
}
if(wereDone) return true;
if (wereDone) return true;
if (isItTheTreeWeWant) foundTree = true;
......
......@@ -16,7 +16,7 @@ const RepoTabs = {
methods: {
isOverflow() {
return this.$el.scrollWidth > this.$el.offsetWidth;
}
},
},
watch: {
......@@ -24,9 +24,9 @@ const RepoTabs = {
Vue.nextTick(() => {
this.tabsOverflow = this.isOverflow();
});
}
}
}
},
},
};
export default RepoTabs;
</script>
......
......@@ -20,7 +20,7 @@ describe('RepoTab', () => {
tab,
});
const close = vm.$el.querySelector('.close');
const name = vm.$el.querySelector(`a[title="${tab.url}"]`)
const name = vm.$el.querySelector(`a[title="${tab.url}"]`);
spyOn(vm, 'xClicked');
spyOn(vm, 'tabClicked');
......
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