Revision 55671
Added by Myrto Koukouli almost 5 years ago
register-datasource-select-existing.component.ts | ||
---|---|---|
87 | 87 |
} |
88 | 88 |
|
89 | 89 |
getReposInCountry(i: number) { |
90 |
setTimeout( () => { |
|
91 |
const country = this.countries[i]; |
|
92 |
console.log(`I got ${country} and ${this.mode}`); |
|
93 |
this.countryRepos = []; |
|
94 |
this.selectedCountry = country; |
|
95 |
this.hasSelectedCountry = false; |
|
96 |
this.loadingMessage = loadingReposMessage; |
|
97 |
this.noRepositories = ''; |
|
98 |
this.repoService.getRepositoriesOfCountry(country.code, this.mode).subscribe ( |
|
99 |
repos => { |
|
100 |
this.countryRepos = repos; |
|
101 |
}, |
|
102 |
error => { |
|
103 |
console.log(error.statusText); |
|
104 |
this.loadingMessage = ''; |
|
105 |
this.alertMessage = noServiceMessage; |
|
106 |
this.countryRepos = []; |
|
107 |
}, |
|
108 |
() => { |
|
109 |
if (!this.countryRepos || !this.countryRepos.length) { |
|
110 |
this.noRepositories = noRepositoriesFound; |
|
90 |
const country = this.countries[i]; |
|
91 |
console.log(`I got ${country} and ${this.mode}`); |
|
92 |
this.countryRepos = []; |
|
93 |
this.selectedCountry = country; |
|
94 |
this.hasSelectedCountry = false; |
|
95 |
this.loadingMessage = loadingReposMessage; |
|
96 |
this.noRepositories = ''; |
|
97 |
this.repoService.getRepositoriesOfCountry(country.code, this.mode).subscribe ( |
|
98 |
repos => { |
|
99 |
this.countryRepos = repos; |
|
100 |
}, |
|
101 |
error => { |
|
102 |
console.log(error.statusText); |
|
103 |
this.loadingMessage = ''; |
|
104 |
this.alertMessage = noServiceMessage; |
|
105 |
this.countryRepos = []; |
|
106 |
}, |
|
107 |
() => { |
|
108 |
if (!this.countryRepos || !this.countryRepos.length) { |
|
109 |
this.noRepositories = noRepositoriesFound; |
|
110 |
} else { |
|
111 |
this.noRepositories = ''; |
|
112 |
if (this.selectedCountry.code === country.code) { |
|
113 |
/* to make sure that the correct set of repositories is displayed - in case of consequent country selections */ |
|
114 |
this.hasSelectedCountry = true; |
|
111 | 115 |
} else { |
112 |
this.noRepositories = ''; |
|
113 |
if (this.selectedCountry.code === country.code) { |
|
114 |
/* to make sure that the correct set of repositories is displayed - in case of consequent country selections */ |
|
115 |
this.hasSelectedCountry = true; |
|
116 |
} else { |
|
117 |
this.countryRepos = []; |
|
118 |
} |
|
116 |
this.countryRepos = []; |
|
119 | 117 |
} |
120 |
this.loadingMessage = ''; |
|
121 |
this.alertMessage = ''; |
|
122 |
console.log('this.selectedCountry became', JSON.stringify(this.selectedCountry)); |
|
123 | 118 |
} |
124 |
); |
|
125 |
}, 500); |
|
119 |
this.loadingMessage = ''; |
|
120 |
this.alertMessage = ''; |
|
121 |
console.log('this.selectedCountry became', JSON.stringify(this.selectedCountry)); |
|
122 |
} |
|
123 |
); |
|
126 | 124 |
} |
127 | 125 |
|
128 | 126 |
getLatestUpdate() { |
Also available in: Unified diff
completed timezones list and removed not needed setTimeouts