Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented: Spinner in timezone modal so users can see that data is being fetched #236

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"Failed": "Failed",
"Failed to update some jobs": "Failed to update some jobs",
"Failed to schedule service, hence other jobs are not updated": "Failed to schedule service, hence other jobs are not updated",
"Fetching time zones": "Fetching time zones",
"Go to Launchpad": "Go to Launchpad",
"Go to OMS": "Go to OMS",
"History": "History",
Expand Down
18 changes: 18 additions & 0 deletions src/theme/variables.css
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ http://ionicframework.com/docs/theming/ */
--ion-color-light-tint: #f5f6f9;
}


@media (prefers-color-scheme: dark) {
/*
* Dark Colors
Expand Down Expand Up @@ -312,6 +313,23 @@ hr {
border-bottom: var(--border-medium);
}

.empty-state {
max-width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 10px;
}

.empty-state > img {
object-fit: contain;
}

.empty-state > p {
text-align: center;
}

@media (min-width: 991px) {
.find {
grid: "search main" min-content
Expand Down
21 changes: 16 additions & 5 deletions src/views/TimezoneModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,15 @@
</ion-header>

<ion-content class="ion-padding">
<!-- Empty state -->
<div class="empty-state" v-if="filteredTimeZones.length === 0">
<p>{{ $t("No time zone found")}}</p>
<!-- Empty state -->
<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 All @@ -30,7 +36,7 @@
</ion-radio-group>
</ion-list>
</div>

<ion-fab vertical="bottom" horizontal="end" slot="fixed">
<ion-fab-button :disabled="!timeZoneId" @click="saveAlert">
<ion-icon :icon="save" />
Expand All @@ -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 @@ -129,6 +138,7 @@ export default defineComponent({
});
},
async getAvailableTimeZones() {
this.isLoading = true;
UserService.getAvailableTimeZones().then((resp: any) => {
if(resp.status === 200 && !hasError(resp)) {
// We are filtering valid the timeZones coming with response here
Expand All @@ -137,6 +147,7 @@ export default defineComponent({
});
this.findTimeZone();
}
this.isLoading = false;
})
},
selectSearchBarText(event: any) {
Expand Down