Skip to content

Commit

Permalink
Data export (#14)
Browse files Browse the repository at this point in the history
* show zoom widget only if the graph is not empty

* remove Details, create TheButtonDownload

* add kibana in comment in docker-compose.yml for debugging

* Zip noeuds.csv, liens.csv and transactions.csv
  • Loading branch information
benoitguigal authored Oct 15, 2018
1 parent ef49668 commit f30149c
Show file tree
Hide file tree
Showing 15 changed files with 195 additions and 289 deletions.
16 changes: 8 additions & 8 deletions app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ def send_static(path):
return send_from_directory('dist', path)


@application.route('/transactions')
@application.route('/transactions', methods=["POST"])
def get_transactions():
""" Returns all the transactions of a given entity """
entity = request.args.get("node")
entities = request.get_json()['data']['entities']
query = {
'size': 200,
'query': {
'bool': {
'should': [
{ 'term': { 'ben_entity_id': entity } },
{ 'term': { 'don_entity_id': entity } }
'must': [
{ 'terms': { 'ben_entity_id': entities } },
{ 'terms': { 'don_entity_id': entities } }
]
}
}
Expand Down Expand Up @@ -84,13 +84,13 @@ def get_transactions():
'ben_pays_code',
'ben_code_postal',
]

rows = []
for transaction in transactions:
row = [transaction.get(column) for column in columns]
row = { k: v for (k, v) in transaction.items() if k in columns }
rows.append(row)

response = {'columns': columns, 'rows': rows}
return jsonify(response)
return jsonify(rows)

def format_properties(vp):
for k in vp.keys():
Expand Down
77 changes: 66 additions & 11 deletions app/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 app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"axios": "^0.18.0",
"d3": "^4.13.0",
"jsnetworkx": "^0.3.4",
"jszip": "^3.1.5",
"vue": "^2.5.11",
"vue-material": "^1.0.0-beta-10.2",
"vuex": "^3.0.1"
Expand Down
2 changes: 1 addition & 1 deletion app/src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default {
})
},
transactions(options, callback){
axios.get(transactionsUrl, options).then(response => {
axios.post(transactionsUrl, options).then(response => {
callback(response.data);
})
}
Expand Down
16 changes: 7 additions & 9 deletions app/src/components/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
<!-- <filter-list></filter-list> -->
<drawer></drawer>
<graph></graph>
<zoom-widget></zoom-widget>
<modal v-if="showModal">
<modal-links-detail></modal-links-detail>
</modal>
<zoom-widget v-if="showGraphWidgets"></zoom-widget>
<the-button-download v-if="showGraphWidgets"></the-button-download>
<progress-spinner v-show="showProgressSpinner"></progress-spinner>
</div>
</template>
Expand All @@ -18,20 +16,20 @@ import FilterList from "./FilterList.vue";
import Drawer from "./Drawer.vue";
import Graph from "./Graph.vue";
import ZoomWidget from "./ZoomWidget.vue";
import Modal from "./Modal.vue";
import ModalLinksDetail from "./ModalLinksDetail.vue";
import TheButtonDownload from "./TheButtonDownload.vue";
import ProgressSpinner from "./ProgressSpinner";
import { mapActions, mapState } from 'vuex';
import { mapActions, mapState, mapGetters } from 'vuex';
export default {
name: "app",
components: {Search, FilterList, Drawer, Graph, ZoomWidget, Modal, ModalLinksDetail, ProgressSpinner },
components: {Search, FilterList, Drawer, Graph, ZoomWidget, TheButtonDownload, ProgressSpinner },
computed: {
filter() {
return this.$store.state.filter;
},
...mapState(["showModal", "showProgressSpinner"])
...mapState(["showModal", "showProgressSpinner"]),
...mapGetters(["showGraphWidgets"])
},
methods: {
...mapActions(['expand'])
Expand Down
137 changes: 0 additions & 137 deletions app/src/components/AppTable.vue

This file was deleted.

Loading

0 comments on commit f30149c

Please sign in to comment.