File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11[tool .poetry ]
22name = " api"
3- version = " 0.4.1 "
3+ version = " 0.4.2 "
44description = " "
55authors = [" ArielMAJ <ariel.maj@hotmail.com>" ]
66readme = " README.md"
Original file line number Diff line number Diff line change 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" ,
Original file line number Diff line number Diff line change 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 >
2832import PieChartModal from " ./modals/PieChartModal.vue" ;
33+ import _ from " lodash" ;
2934
3035export 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
Original file line number Diff line number Diff 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 },
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments