Skip to content

Commit 19ad17c

Browse files
committed
Initial implementation of the Data page
1 parent dfb2759 commit 19ad17c

13 files changed

Lines changed: 386 additions & 89 deletions

File tree

client/src/components/NavigationBar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default {
2020
</script>
2121

2222
<template>
23-
<v-app-bar app flat>
23+
<v-app-bar app>
2424
<v-toolbar-title>
2525
<v-tooltip open-delay="2000" bottom>
2626
<template #activator="{ on }">

client/src/components/SamplesLocation.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,13 @@ export default {
107107
attribution="© OpenStreetMap contributors, © CARTO"
108108
:zIndex="0"
109109
/>
110-
<GeojsGeojsonLayer
111-
:zIndex="1"
110+
<GeojsGeojsonLayer
111+
:zIndex="1"
112112
:geojson="sitesFeature"
113113
:featureStyle="{
114-
point: {stroke: false }
115-
}" />
114+
point: { stroke: false }
115+
}"
116+
/>
116117
<GeojsGeojsonLayer
117118
:zIndex="2"
118119
:geojson="selectedRegion"

client/src/components/Sunburst.vue

Lines changed: 55 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -59,22 +59,33 @@ function treeSum(arr) {
5959
export default {
6060
name: "Sunburst",
6161
props: {
62-
filteredTables: {
62+
filter: {
6363
type: Object,
64-
required: true
65-
},
66-
cmap: {
67-
required: true
64+
required: false
6865
}
66+
// filteredTables: {
67+
// type: Object,
68+
// required: true
69+
// },
70+
// cmap: {
71+
// required: true
72+
// }
6973
},
74+
inject: ["girderRest"],
75+
data: () => ({
76+
initialized: false
77+
}),
7078
computed: {
71-
treeData() {
72-
return this.filteredTables.table8.map(treeifyTable8);
73-
},
7479
treeDataSum() {
80+
if (!this.treeData) {
81+
return null;
82+
}
7583
return treeSum(this.treeData);
7684
},
7785
sunburstData() {
86+
if (!this.treeDataSum) {
87+
return null;
88+
}
7889
const data = this.treeDataSum;
7990
8091
return {
@@ -88,29 +99,46 @@ export default {
8899
}))
89100
};
90101
},
91-
testData() {
92-
return {
93-
name: "root",
94-
children: [
95-
{
96-
name: "A",
97-
value: 3
98-
},
99-
{
100-
name: "B",
101-
value: 4
102-
}
103-
]
102+
sc10: d3.scale.category10,
103+
cmap() {
104+
return v => {
105+
if (v === "") {
106+
return "#ffffff";
107+
}
108+
return this.sc10(v);
104109
};
105110
}
106111
},
112+
asyncComputed: {
113+
async treeData() {
114+
var { data: records } = await this.girderRest.get("record/filtered", {
115+
params: {
116+
fields: JSON.stringify(["table8"]),
117+
filter: this.filter
118+
}
119+
});
120+
return records.data
121+
.map(record => record.table8)
122+
.filter(d => d)
123+
.map(treeifyTable8);
124+
}
125+
},
107126
watch: {
108127
sunburstData(data) {
109-
this.debouncedUpdate(data);
128+
if (data) {
129+
if (!this.initialized) {
130+
this.initialize();
131+
} else {
132+
this.debouncedUpdate(data);
133+
}
134+
}
110135
}
111136
},
112-
mounted() {
113-
this.$nextTick(() => {
137+
// mounted() {
138+
// this.$nextTick(() => {});
139+
// },
140+
methods: {
141+
initialize() {
114142
this.chart = Sunburst()
115143
.width(this.$el.offsetWidth)
116144
.height(this.$el.offsetHeight)
@@ -137,9 +165,8 @@ export default {
137165
this.update(this.sunburstData);
138166
139167
this.chart(this.$el);
140-
});
141-
},
142-
methods: {
168+
this.initialized = true;
169+
},
143170
update(data) {
144171
this.chart.data(data);
145172
}
@@ -154,6 +181,7 @@ export default {
154181
<style>
155182
.eco-sunburst {
156183
flex: 1;
184+
padding: 5px;
157185
}
158186
159187
textPath.text-contour {

client/src/components/WidgetContainer.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<template functional>
22
<div class="widget-container">
3-
<div class="grey darken-2 white--text body-2 pl-2"><slot name="title"></slot></div>
3+
<div class="grey darken-2 white--text body-2 pl-2">
4+
<slot name="title"></slot>
5+
</div>
46
<div class="widget flex-grow-1">
57
<slot />
68
</div>
@@ -13,4 +15,4 @@
1315
display: flex;
1416
flex-direction: column;
1517
}
16-
</style>
18+
</style>

client/src/router.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Router from "vue-router";
44
import girder from "./girder";
55
import Login from "@/views/Login.vue";
66
import Landing from "@/views/Landing.vue";
7+
import Data from "@/views/Data.vue";
78

89
Vue.use(Router);
910

@@ -27,6 +28,12 @@ export default new Router({
2728
name: "Landing",
2829
component: Landing,
2930
beforeEnter
31+
},
32+
{
33+
path: "/data",
34+
name: "Data",
35+
component: Data,
36+
beforeEnter
3037
}
3138
]
3239
});

client/src/store/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Vue from "vue";
22
import Vuex from "vuex";
33

4-
import girder from "@/girder";
4+
// import girder from "@/girder";
55

66
Vue.use(Vuex);
77

client/src/util/colors.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,13 @@ var colormap = {
2424
"freshwater lake",
2525
"epilimnion"
2626
],
27-
interpolateOranges: ["grassland biome", "farm", "sphagnum bog", "watershed"],
28-
interpolateRdPu:["microbial mat"]
27+
interpolateOranges: [
28+
"grassland biome",
29+
"farm",
30+
"sphagnum bog",
31+
"watershed"
32+
],
33+
interpolateRdPu: ["microbial mat"]
2934
},
3035
material: {
3136
interpolateBlues: [
@@ -36,7 +41,7 @@ var colormap = {
3641
"hypersaline water"
3742
],
3843
interpolateOranges: ["soil", "grassland soil", "farm soil"],
39-
interpolateRdPu:["microbial mat material"]
44+
interpolateRdPu: ["microbial mat material"]
4045
},
4146
biome: {
4247
interpolateBlues: [

0 commit comments

Comments
 (0)