Skip to content

Commit

Permalink
Merge pull request #276 from Ritika-Patel08/fixed-timezone-modal
Browse files Browse the repository at this point in the history
Spinner in timezone modal so users can see that data is being fetched
  • Loading branch information
ravilodhi authored Mar 15, 2024
2 parents 23d633a + 4856712 commit 9c1d229
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"Excluded ATP": "Excluded ATP",
"from date": "from date",
"Failed to update configuration": "Failed to update configuration",
"Fetching time zones": "Fetching time zones",
"Go to Launchpad": "Go to Launchpad",
"Go to OMS": "Go to OMS",
"History": "History",
Expand Down
17 changes: 14 additions & 3 deletions src/views/timezone-modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,14 @@

<ion-content class="ion-padding">
<!-- Empty state -->
<div class="empty-state" v-if="filteredTimeZones.length === 0">
<p>{{ $t("No time zone found")}}</p>
<div class="empty-state" v-if="isLoading">
<ion-item lines="none">
<ion-spinner color="secondary" name="crescent" slot="start" />
{{ $t("Fetching time zones") }}
</ion-item>
</div>
<div class="empty-state" v-else-if="filteredTimeZones.length === 0">
<p>{{ $t("No time zone found") }}</p>
</div>

<!-- Timezones -->
Expand Down Expand Up @@ -54,6 +60,7 @@ import {
IonRadioGroup,
IonRadio,
IonSearchbar,
IonSpinner,
IonTitle,
IonToolbar,
modalController,
Expand Down Expand Up @@ -81,6 +88,7 @@ export default defineComponent({
IonRadioGroup,
IonRadio,
IonSearchbar,
IonSpinner,
IonTitle,
IonToolbar
},
Expand All @@ -89,7 +97,8 @@ export default defineComponent({
queryString: '',
filteredTimeZones: [],
timeZones: [],
timeZoneId: ''
timeZoneId: '',
isLoading: false
}
},
methods: {
Expand Down Expand Up @@ -126,6 +135,7 @@ export default defineComponent({
});
},
async getAvailableTimeZones() {
this.isLoading = true;
const resp = await UserService.getAvailableTimeZones()
if(resp.status === 200 && !hasError(resp)) {
// We are filtering valid the timeZones coming with response here
Expand All @@ -134,6 +144,7 @@ export default defineComponent({
});
this.findTimeZone();
}
this.isLoading = false;
},
async selectSearchBarText(event: any) {
const element = await event.target.getInputElement()
Expand Down

0 comments on commit 9c1d229

Please sign in to comment.