Commit 67a6b171 authored by Eric Eastwood's avatar Eric Eastwood

Format and remove unused cruft

parent 0c8c9543
...@@ -17,7 +17,6 @@ const RepoCommitSection = { ...@@ -17,7 +17,6 @@ const RepoCommitSection = {
}, },
branchPaths() { branchPaths() {
const branch = this.currentBranch;
return this.changedFiles.map(f => f.path); return this.changedFiles.map(f => f.path);
}, },
...@@ -33,15 +32,12 @@ const RepoCommitSection = { ...@@ -33,15 +32,12 @@ const RepoCommitSection = {
methods: { methods: {
makeCommit() { makeCommit() {
// see https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions // see https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions
const branch = Store.currentBranch;
const commitMessage = this.commitMessage; const commitMessage = this.commitMessage;
const actions = this.changedFiles.map(f => { const actions = this.changedFiles.map(f => ({
return { action: 'update',
action: 'update', file_path: f.path,
file_path: f.path, content: f.newContent,
content: f.newContent, }));
};
});
const payload = { const payload = {
branch: Store.targetBranch, branch: Store.targetBranch,
commit_message: commitMessage, commit_message: commitMessage,
...@@ -54,10 +50,9 @@ const RepoCommitSection = { ...@@ -54,10 +50,9 @@ const RepoCommitSection = {
resetCommitState() { resetCommitState() {
this.submitCommitsLoading = false; this.submitCommitsLoading = false;
this.changedFiles = []; this.changedFiles = [];
// this.openedFiles = [];
this.commitMessage = ''; this.commitMessage = '';
this.editMode = false; this.editMode = false;
window.scrollTo(0,0); window.scrollTo(0, 0);
}, },
}, },
}; };
...@@ -66,35 +61,68 @@ export default RepoCommitSection; ...@@ -66,35 +61,68 @@ export default RepoCommitSection;
</script> </script>
<template> <template>
<div id="commit-area" v-if="showCommitable"> <div
<form class="form-horizontal" @submit.prevent="makeCommit"> v-if="showCommitable"
id="commit-area">
<form
class="form-horizontal"
@submit.prevent="makeCommit">
<fieldset> <fieldset>
<div class="form-group"> <div class="form-group">
<label class="col-md-4 control-label staged-files">Staged files ({{changedFiles.length}})</label> <label class="col-md-4 control-label staged-files">
Staged files ({{changedFiles.length}})
</label>
<div class="col-md-6"> <div class="col-md-6">
<ul class="list-unstyled changed-files"> <ul class="list-unstyled changed-files">
<li v-for="file in branchPaths" :key="file.id"> <li v-for="file in branchPaths" :key="file.id">
<span class="help-block">{{file}}</span> <span class="help-block">
{{file}}
</span>
</li> </li>
</ul> </ul>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-4 control-label" for="commit-message">Commit message</label> <label
class="col-md-4 control-label"
for="commit-message">
Commit message
</label>
<div class="col-md-6"> <div class="col-md-6">
<textarea class="form-control" id="commit-message" name="commit-message" v-model="commitMessage"></textarea> <textarea
id="commit-message"
class="form-control"
name="commit-message"
v-model="commitMessage">
</textarea>
</div> </div>
</div> </div>
<div class="form-group target-branch"> <div class="form-group target-branch">
<label class="col-md-4 control-label" for="target-branch">Target branch</label> <label
class="col-md-4 control-label"
for="target-branch">
Target branch
</label>
<div class="col-md-6"> <div class="col-md-6">
<span class="help-block">{{targetBranch}}</span> <span class="help-block">
{{targetBranch}}
</span>
</div> </div>
</div> </div>
<div class="col-md-offset-4 col-md-6"> <div class="col-md-offset-4 col-md-6">
<button type="submit" :disabled="cantCommitYet" class="btn btn-success submit-commit"> <button
<i class="fa fa-spinner fa-spin" v-if="submitCommitsLoading" aria-hidden="true" aria-label="loading"></i> type="submit"
<span class="commit-summary">Commit {{changedFiles.length}} {{filePluralize}}</span> :disabled="cantCommitYet"
class="btn btn-success submit-commit">
<i
v-if="submitCommitsLoading"
class="fa fa-spinner fa-spin"
aria-hidden="true"
aria-label="loading">
</i>
<span class="commit-summary">
Commit {{changedFiles.length}} {{filePluralize}}
</span>
</button> </button>
</div> </div>
</fieldset> </fieldset>
......
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