Skip to content

Commit 19aa645

Browse files
authored
Merge pull request #32 from ArielMAJ/feat/#29/restart-search
Feat/#29/restart search
2 parents 8023725 + f5d428d commit 19aa645

5 files changed

Lines changed: 33 additions & 13 deletions

File tree

api/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "api"
3-
version = "0.4.1"
3+
version = "0.4.2"
44
description = ""
55
authors = ["ArielMAJ <ariel.maj@hotmail.com>"]
66
readme = "README.md"

vue-front/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "GitHub_Viz",
3-
"version": "0.4.1",
3+
"version": "0.4.2",
44
"private": true,
55
"scripts": {
66
"serve": "vue-cli-service serve",

vue-front/src/App.vue

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,16 @@
2121
@click="pieChartModalOpen = !pieChartModalOpen"
2222
>Open Repository Visualization
2323
</v-btn> -->
24-
<PieChartModal v-if="pieChartModalOpen" :username="this.username" />
24+
<PieChartModal
25+
v-if="pieChartModalOpen"
26+
:username="this.username"
27+
:reload-watcher="this.reloadCount"
28+
/>
2529
</div>
2630
</template>
2731
<script>
2832
import PieChartModal from "./modals/PieChartModal.vue";
33+
import _ from "lodash";
2934
3035
export default {
3136
name: "app",
@@ -39,15 +44,24 @@ export default {
3944
required: (value) => !!value || "Field is required",
4045
},
4146
username: "",
47+
reloadCount: 0,
4248
};
4349
},
4450
methods: {
4551
search() {
4652
if (this.username !== "") {
53+
this.reloadCount++;
4754
this.pieChartModalOpen = true;
4855
}
4956
},
5057
},
58+
watch: {
59+
username: _.debounce(function () {
60+
if (this.username === "") {
61+
this.pieChartModalOpen = false;
62+
}
63+
}, 2000),
64+
},
5165
};
5266
</script>
5367

vue-front/src/components/PlotlyChart.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ export default {
4646
return {};
4747
},
4848
mounted() {
49-
console.log(this.divId, this.chartData);
5049
this.newPlot();
5150
this.bindEvents();
5251
},

vue-front/src/modals/PieChartModal.vue

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ export default {
3232
type: String,
3333
required: true,
3434
},
35+
reloadWatcher: {
36+
type: Number,
37+
required: true,
38+
},
3539
},
3640
data: function () {
3741
return {
@@ -53,29 +57,32 @@ export default {
5357
};
5458
},
5559
async mounted() {
56-
this.plotItems.forEach((item) => {
57-
this.fetchData(this.username, item);
58-
});
60+
this.load();
5961
},
6062
methods: {
63+
load() {
64+
this.plotItems.forEach((item) => {
65+
item.chartData = null;
66+
this.fetchData(this.username, item);
67+
});
68+
},
6169
async fetchData(username, item) {
6270
try {
63-
console.log(
64-
"Fetching data...",
65-
process.env.VUE_APP_BACKEND_ROOT_ENDPOINT +
66-
`${username}/${item.information}`
67-
);
6871
const resp = await fetch(
6972
process.env.VUE_APP_BACKEND_ROOT_ENDPOINT +
7073
`${username}/${item.information}`
7174
);
7275
item.chartData = await resp.json();
73-
console.log(item);
7476
} catch (error) {
7577
console.error("Error fetching data:", error);
7678
}
7779
},
7880
},
81+
watch: {
82+
reloadWatcher() {
83+
this.load();
84+
},
85+
},
7986
};
8087
</script>
8188

0 commit comments

Comments
 (0)