-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merging pull request #119 from fga-gpp-mds/us11_manter_revisao
- Loading branch information
Showing
8 changed files
with
592 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
<template> | ||
<div> | ||
<div> | ||
<button type="button" class="btn btn-info btn-md falko-button" id="addButton" | ||
data-toggle="modal" data-target="#addRevisionModal"> | ||
Add Revision | ||
</button> | ||
</div> | ||
|
||
<div class="row no-margin justify-content-center modal fade" id="addRevisionModal"> | ||
<div class="modal-dialog"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h3 class="modal-title"> | ||
Add Sprint Revision | ||
</h3> | ||
<button type="button" class="close" data-dismiss="modal" aria-label="Fechar"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
</div> | ||
<div class="modal-body"> | ||
<listRevision parent="DoneReport" v-on:listUpdated="updateList"></listRevision> | ||
<listRevision parent="UndoneReport" v-on:listUpdated="updateList"></listRevision> | ||
</div> | ||
<div class="modal-footer"> | ||
<button class="btn btn-info btn-md falko-button" | ||
v-bind:disabled="FieldsNotFilled" v-on:click="addRevision" | ||
data-dismiss="modal" | ||
> | ||
Save | ||
</button> | ||
<button class="btn btn-info btn-md falko-button-grey" data-dismiss="modal"> | ||
Cancel | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import ListRevision from '@/components/Revision/ListRevision' | ||
import {HTTP} from '../../http-common.js'; | ||
export default { | ||
components: { | ||
'listRevision': ListRevision | ||
}, | ||
data() { | ||
return { | ||
doneReport: [], | ||
undoneReport: [], | ||
resivionId: '', | ||
} | ||
}, | ||
methods: { | ||
addRevision() { | ||
var token = localStorage.getItem('token'); | ||
var tokenSimple = token.replace(/"/, ""); | ||
var tokenSimple2 = tokenSimple.replace(/"/, ""); | ||
var headers = { 'Authorization': tokenSimple2 }; | ||
HTTP.post(`sprints/${this.$route.params.id}/revisions`, { | ||
done_report: this.doneReport, | ||
undone_report: this.undoneReport, | ||
}, { headers: headers }) | ||
.then((response) => { | ||
this.$emit('revisionCreated') | ||
this.revisionId = response.data.id | ||
this.$router.push({ path: `/revisions/${this.revisionId}`}); | ||
}) | ||
.catch((e) => { | ||
this.errors.push(e) | ||
}); | ||
}, | ||
updateList(items, parent) { | ||
if (parent == "DoneReport") { | ||
this.doneReport = [] | ||
for(var i = 0; i < items.length; i++) { | ||
this.doneReport.push(items[i].title) | ||
} | ||
} else if (parent == "UndoneReport") { | ||
this.undoneReport = [] | ||
for(var i = 0; i < items.length; i++) { | ||
this.undoneReport.push(items[i].title) | ||
} | ||
} | ||
} | ||
}, | ||
computed: { | ||
FieldsNotFilled() { | ||
return this.undoneReport.length == 0 || | ||
this.doneReport.length == 0 | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
input::placeholder { | ||
color: #777; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<template> | ||
<div> | ||
<button type="button" class="btn btn-info btn-md falko-button-danger" id="deletebutton" data-toggle="modal" data-target="#delRevisionModal"> | ||
Delete | ||
</button> | ||
|
||
<div class="modal fade" id ="delRevisionModal" role="dialog"> | ||
<div class="modal-dialog"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<div> | ||
<h4 class="modal-title">Delete Revision?</h4> | ||
</div> | ||
<button type="button" class="close" data-dismiss="modal" aria-label="Fechar"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
</div> | ||
<div class="modal-body"> | ||
<p><label> Are you sure?</label></p> | ||
</div> | ||
<div class="modal-footer"> | ||
<button v-on:click="delRevision()" type="button" class="btn btn-primary" data-dismiss="modal" >Yes</button> | ||
<button type="button" class="btn btn-secondary" data-dismiss="modal">No</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import {HTTP} from '../../http-common.js'; | ||
export default { | ||
name: 'delRevision', | ||
data () { | ||
return { | ||
} | ||
}, | ||
methods:{ | ||
async delRevision(){ | ||
var token = localStorage.getItem('token'); | ||
var tokenSimple = token.replace(/"/, ""); | ||
var tokenSimple2 = tokenSimple.replace(/"/, ""); | ||
var headers = { 'Authorization':tokenSimple2 }; | ||
try { | ||
let response = await HTTP.get("/revisions/"+this.$route.params.id, { headers: headers }); | ||
let id = response.data.sprint_id; | ||
await HTTP.delete("/revisions/"+this.$route.params.id, { headers: headers }) | ||
this.$router.push({ path : `/Sprints/${id}`}); | ||
} catch(err) { | ||
console.log(err) | ||
} | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<template> | ||
<div> | ||
<div> | ||
<button type="button" class="btn btn-info btn-md falko-button" id="addButton" | ||
data-toggle="modal" data-target="#editRevisionModal"> | ||
Edit Revision | ||
</button> | ||
</div> | ||
|
||
<div class="row no-margin justify-content-center modal fade" id="editRevisionModal"> | ||
<div class="modal-dialog"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h3 class="modal-title"> | ||
Add Sprint Revision | ||
</h3> | ||
<button type="button" class="close" data-dismiss="modal" aria-label="Fechar"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
</div> | ||
<div class="modal-body"> | ||
<listRevision parent="DoneReport" v-on:listUpdated="updateList"></listRevision> | ||
<listRevision parent="UndoneReport" v-on:listUpdated="updateList"></listRevision> | ||
</div> | ||
<div class="modal-footer"> | ||
<button class="btn btn-info btn-md falko-button" v-on:click="editRevision()" data-dismiss="modal">Save</button> | ||
<button class="btn btn-info btn-md falko-button-grey" data-dismiss="modal">Cancel</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import ListRevision from '@/components/Revision/ListRevision'; | ||
import { HTTP } from '../../http-common.js'; | ||
export default { | ||
components: { | ||
'listRevision': ListRevision | ||
}, | ||
data() { | ||
return { | ||
doneReport: [], | ||
undoneReport: [], | ||
} | ||
}, | ||
methods: { | ||
editRevision() { | ||
var token = localStorage.getItem('token'); | ||
var tokenSimple = token.replace(/"/, ""); | ||
var tokenSimple2 = tokenSimple.replace(/"/, ""); | ||
var headers = { 'Authorization':tokenSimple2 }; | ||
HTTP.patch(`revisions/${this.$route.params.id}`, { | ||
done_report: this.doneReport, | ||
undone_report: this.undoneReport, | ||
}, { headers: headers }) | ||
.then(() => { | ||
this.$emit('revisionCreated') | ||
}) | ||
.catch((e) => { | ||
this.errors.push(e) | ||
}); | ||
}, | ||
updateList (items, parent) { | ||
if (parent == "DoneReport") { | ||
this.doneReport = [] | ||
for(var i = 0; i < items.length; i++) { | ||
this.doneReport.push(items[i].title) | ||
} | ||
} else if (parent == "UndoneReport") { | ||
this.undoneReport = [] | ||
for(var i = 0; i < items.length; i++) { | ||
this.undoneReport.push(items[i].title) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
input::placeholder { | ||
color: #777; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<template> | ||
<div> | ||
<li class="row no-margin"> | ||
<div class="col-11 text-justify align-self-center"> | ||
{{title}} | ||
</div> | ||
<div class="col-1 align-self-center"> | ||
<button v-on:click="$emit('remove')" class="float-right" > | ||
<h4 class="no-margin">×</h4> | ||
</button> | ||
</div> | ||
</li> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: ['title'] | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
h3 { | ||
margin-bottom: 4em; | ||
} | ||
li { | ||
padding: 0.8em 0em; | ||
border-bottom: 1px solid #E0E8EB; | ||
color: #677; | ||
} | ||
li div { | ||
word-wrap: break-word; | ||
} | ||
button { | ||
background-color: transparent; | ||
border: none; | ||
font-weight: bold; | ||
cursor: pointer; | ||
color: #5E8181; | ||
outline: none; | ||
} | ||
button:hover { | ||
color: #2E5151; | ||
} | ||
</style> |
Oops, something went wrong.