Skip to content

Commit

Permalink
[MERGE] pull request #110 from fga-gpp-mds/development
Browse files Browse the repository at this point in the history
Sprint 12
  • Loading branch information
arthur0496 committed Jun 2, 2018
2 parents 142f66d + a234a0d commit d9a50bc
Show file tree
Hide file tree
Showing 14 changed files with 434 additions and 84 deletions.
12 changes: 3 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,12 @@ FROM node:slim

RUN apt-get update && apt-get install bzip2

RUN mkdir -p /usr/src/tropical-hazards-frontend
WORKDIR /tropical-hazards-frontend

WORKDIR /usr/src/tropical-hazards-frontend
COPY package.json /tropical-hazards-frontend/

COPY package.json /usr/src/tropical-hazards-frontend/

RUN npm install

COPY . /usr/src/tropical-hazards-frontend
COPY . /tropical-hazards-frontend

EXPOSE 8080

RUN chmod +x start.sh

CMD ["./start.sh"]
4 changes: 2 additions & 2 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ services:
th_bi-front:
container_name: tropical-hazards-front
build: .
command: /bin/bash start.sh
command: npm install --dev
volumes:
- .:/TropicalHazards-BI-FrontEnd
- .:/tropical-hazards-frontend
external_links:
- 20181tropicalhazardsbi_default
ports:
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
build: .
command: /bin/bash start.sh
volumes:
- .:/usr/src/tropical-hazards-frontend
- .:/tropical-hazards-frontend
external_links:
- 20181tropicalhazardsbi_default
ports:
Expand Down
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"line-navigator": "^2.1.6",
"materialize-css": "^1.0.0-beta",
"papaparse": "^4.4.0",
"raven-js": "^3.25.2",
"vue": "^2.5.2",
"vue-js-modal": "^1.3.13",
"vue-resource": "^1.5.0",
Expand Down
2 changes: 2 additions & 0 deletions semantic-release.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

if [ "${TRAVIS_BRANCH}" == "master" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
echo "deploying it"
npx semantic-release
Expand Down
173 changes: 173 additions & 0 deletions src/components/Modals/RegisterModal.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
<template>
<modal
:width="500"
:height="auto"
name="register">
<v-dialog
@before-opened="dialogEvent('before-open')"
@before-closed="dialogEvent('before-close')"
@opened="dialogEvent('opened')"
@closed="dialogEvent('closed')"/>
<div class="container center-align">
<h4 style="color: black">Registrar Usuário</h4>
<p>
Como visitante você tem acesso a funcionalidade de pesquisa de observatóriose pode navegar entre estes observatórios.
</p>
<form>
<div class="row">
<div class="file-field input-field">
<div class="btn">
<span>Selecione o arquivo</span>
<input
id="file"
ref="file"
type="text"
autoComplete="off"
required>
</div>
<div class="file-path-wrapper">
<input
class="file-path validate"
type="text">
</div>
</div>

</div>
</form>
<div class="progress">
<div
class="determinate"
style="width: 25%" />
</div>
</div>
<div class="modal-footer">
<div class="row center-align">
<div class="col s12 m4">
<a
class="modal-action modal-close waves-effect waves-light grey white-text btn-flat"
@click="$modal.hide('register')">
Voltar
</a>
</div>
<div class="col s12 offset-m4 m4">
<a
class="modal-action modal-close waves-effect waves-light blue lighten-1 white-text btn-flat"
@click="submitFile ()">
Próximo
</a>
</div>
</div>
</div>
</modal>
</template>

<script>
export default {
name: "Register",
components: {
},
data (){
return {
text: "Project id: ",
project: "",
file: null,
error: null
}
},
methods: {
checkForm(){
if(this.file) return true
this.error = null
if(!this.file)
this.error = "Selecione um arquivo"
return false
},
submitFile(){
if(this.checkForm()){
let formData = new FormData ()
formData.append("file", this.file)
formData.append("project", this.project)
this.$http.post(
"import/",
formData,
{
headers: {
"Content-Type": "multipart/form-data",
"Authorization": "JWT " + localStorage.token
}
}
).then((response) => {
if(response.status == 201){
this.showUploadSucess()
this.showFilterCsv ()
}
},
error => {
this.showUploadFail()
error.log(error)
})
}else{
this.showInvalidForm(this.error)
}
},
showUploadSucess () {
this.$modal.show("dialog", {
title: "Sucesso",
text: "Arquivo enviado com sucesso",
buttons: [
{
title: "Continuar",
handler: () => {
//APAGAR LINHA ABAIXO QUANDO ESTIVER PRONTA PARTE DE RETORNAR CABEÇALHOS
//SEGUIR PARA ETAPA DE CABEÇALHOS
// this.$modal.hide("import-csv")
this.$modal.hide("dialog")
}
},
]
})
},
showUploadFail(){
this.$modal.show("dialog", {
title: "Erro",
text: "Arquivo inválido",
buttons: [
{
title: "Tentar novamente",
handler: () => {
this.file = null
this.$modal.hide("dialog")
}
},
{
title: "Cancelar",
handler: () => {
this.$modal.hide("register")
this.$modal.hide("dialog")
}
}
]
})
},
showInvalidForm(error){
this.$modal.show("dialog", {
title: "Erro",
text: error,
buttons: [
{
title: "Continuar",
handler: () => {
this.file = null
this.$modal.hide("dialog")
}
}
]
})
},
showFilterCsv (){
this.$modal.show("filter-csv", { project: 1 })
},
}
}
</script>
87 changes: 15 additions & 72 deletions src/components/Observatorio/ObservatorioDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@
@click="deleteDashboard()">Deletar Dashboard
<span class="fa fa-trash"/>
</button>
<p></p>
<button
class = "btn-large blue"
v-on:
@click="$modal.show('ask-question', { dashboard: dashboard.id })">Gerar indicador
<span class="fa fa-trash"/>
</button>
<modal-question/>
</div>
<div class="col s12 m4">
<div class="card">
Expand All @@ -50,60 +58,11 @@
<div class="row">
<div class="col s12">
<!-- vai ser iframe então lembrar de colocar tag de iframe com a classe de reixar IFRAME RESPONSIVO -->
<img
src="https://s3-us-west-2.amazonaws.com/i.cdpn.io/250639.eZENxO.12a72d88-e8ed-4403-b737-dfcbde7f008d.png"
class="responsive-img">
<!-- <iframe
src="{{ iframeUrl}}" /> -->
</div>
</div>
<div class="row white darken-1">
<div class="col s12">
<table class="table-responsive stripped">
<thead>
<tr>
<th>Nome</th>
<th>Frequência (%)</th>
</tr>
</thead>
<tbody>
<tr>
<td><b>A</b></td>
<td>8</td>
</tr>
<tr>
<td><b>B</b></td>
<td>1.5</td>
</tr>
<tr>
<td><b>C</b></td>
<td>2.75</td>
</tr>
<tr>
<td><b>D</b></td>
<td>4.1</td>
</tr>
<tr>
<td><b>E</b></td>
<td>13</td>
</tr>
<tr>
<td><b>F</b></td>
<td>2.06</td>
</tr>
<tr>
<td><b>G</b></td>
<td>2</td>
</tr>
<tr>
<td><b>H</b></td>
<td>6</td>
</tr>
<tr>
<td><b>I</b></td>
<td>7</td>
</tr>
</tbody>
</table>
</div>
<div class="col s12">
<a
href="#"
Expand All @@ -122,25 +81,27 @@
import {mapGetters} from "vuex"
import SideBar from "@/components/Utils/SideBar"
import modalQuestion from "@/components/Questions/modalQuestion"
export default {
components: {
"sidebar": SideBar,
"modal-question": modalQuestion
},
data(){
return {
dashboard: {
project: "",
name: ""
name: "",
id: ""
},
user: {
username: "",
password: "",
email: ""
},
isModalVisible: false,
}
}
},
computed: {
Expand All @@ -153,7 +114,6 @@ export default {
this.modalScript()
},
methods: {
deleteDashboard (){
if (window.confirm("Deseja realmente deletar o dashboard ?")){
this.$http.delete("dashboards/" + this.$route.params.id + "/", { headers: { "Authorization": "JWT " + localStorage.token } }).then(result => {
Expand All @@ -167,7 +127,6 @@ export default {
})
}
},
getObservatorioDetail(){
this.$http.get("dashboards/" + this.$route.params.id + "/", { headers: { "Authorization": "JWT " + localStorage.token } }).then(result => {
this.dashboard = result.data
Expand All @@ -182,22 +141,6 @@ export default {
this.user.username = this.currentUser.name
this.user.email = this.currentUser.email
},
showModal() {
this.isModalVisible = true
},
closeModal() {
this.isModalVisible = false
},
modalScript() {
$(document).ready(function(){
$(".modal").modal()
})
$(document).ready(function(){
$("select").formSelect()
})
}
},
}
</script>
Expand Down
2 changes: 2 additions & 0 deletions src/components/Projects/CreateProject.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ export default {
data(){
return {
importData: {},
headers: [],
project: {
user: "",
name: "",
Expand Down
Loading

0 comments on commit d9a50bc

Please sign in to comment.