Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Commit

Permalink
feat(app): loading spinners main views
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-wilmer committed Mar 31, 2016
1 parent 7801e24 commit 5efd889
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 3 deletions.
3 changes: 3 additions & 0 deletions app/scripts/projects/projects.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ module ngApp.projects.controllers {
projectColumns: any[];
tabSwitch: boolean = false;
numPrimarySites: number = 0;
loading: boolean = true;

/* @ngInject */
constructor(private $scope: IProjectScope, private ProjectsService: IProjectsService,
Expand Down Expand Up @@ -55,6 +56,7 @@ module ngApp.projects.controllers {
}

refresh() {
this.loading = true;
if (!this.tabSwitch) {
this.ProjectsService.getProjects({
fields: this.ProjectTableModel.fields,
Expand All @@ -69,6 +71,7 @@ module ngApp.projects.controllers {
],
size: 100
}).then((data) => {
this.loading = false;
this.projects = data;
if (this.ProjectsState.tabs.graph.active) {
this.drawGraph(this.projects);
Expand Down
7 changes: 6 additions & 1 deletion app/scripts/projects/templates/projects.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,14 @@
</div>
</div>

<h3 class="col-lg-9 col-md-8" data-ng-if="!prsc.projects.hits.length" data-translate>
<h3 class="col-lg-9 col-md-8" data-ng-if="prsc.loading" data-translate>
Loading, please wait.. <i class="fa fa-spinner fa-spin"></i>
</h3>

<h3 class="col-lg-9 col-md-8" data-ng-if="!prsc.projects.hits.length && !prsc.loading" data-translate>
No projects found using those filters.
</h3>

<ul class="nav nav-tabs" data-ng-if="prsc.projects.hits.length">
<li role="presentation"
data-ng-class="{ active: prsc.ProjectsState.tabs.table.active }"
Expand Down
7 changes: 7 additions & 0 deletions app/scripts/query/query.controllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ module ngApp.query.controllers {
class QueryController implements IQueryController {
files: IFiles;
participants: IParticipants;
participantsLoading: boolean = true;
filesLoading: boolean = true;
query: string = "";
tabSwitch: boolean = false;
projectIdChartConfig: any;
Expand Down Expand Up @@ -78,6 +80,9 @@ module ngApp.query.controllers {
}

refresh() {
this.participantsLoading = true;
this.filesLoading = true;

if (this.tabSwitch) {
if (this.QState.tabs.participants.active) {
this.QState.setActive("participants", "hasLoadedOnce");
Expand Down Expand Up @@ -105,6 +110,7 @@ module ngApp.query.controllers {
};

this.FilesService.getFiles(fileOptions).then((data: IFiles) => {
this.filesLoading = false;
this.files = this.files || {};
this.files.aggregations = data.aggregations;

Expand All @@ -122,6 +128,7 @@ module ngApp.query.controllers {
});

this.ParticipantsService.getParticipants(participantOptions).then((data: IParticipants) => {
this.participantsLoading = false;
this.participants = this.participants || {};
this.participants.aggregations = data.aggregations;

Expand Down
6 changes: 5 additions & 1 deletion app/scripts/query/templates/query.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@

<search-bar></search-bar>

<h3 class="col-lg-9 col-md-8" data-ng-if="!qc.participants.hits.length && !qc.files.hits.length" data-translate>
<h3 class="col-lg-9 col-md-8" data-ng-if="qc.participantsLoading && qc.filesLoading" data-translate>
Loading, please wait.. <i class="fa fa-spinner fa-spin"></i>
</h3>

<h3 class="col-lg-9 col-md-8" data-ng-if="!qc.participants.hits.length && !qc.files.hits.length && qc.participantsLoading && qc.filesLoading" data-translate>
No results found using those filters.
</h3>

Expand Down
7 changes: 7 additions & 0 deletions app/scripts/search/search.controllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ module ngApp.search.controllers {
class SearchController implements ISearchController {
files: IFiles;
participants: IParticipants;
participantsLoading: boolean = true;
filesLoading: boolean = true;
summary: any;
tabSwitch: boolean = false;
projectIdChartConfig: any;
Expand Down Expand Up @@ -103,6 +105,9 @@ module ngApp.search.controllers {
}

refresh() {
this.filesLoading = true;
this.participantsLoading = true;

if (this.tabSwitch) {
if (this.SearchState.tabs.participants.active) {
this.SearchState.setActive("tabs", "participants", "hasLoadedOnce");
Expand Down Expand Up @@ -135,6 +140,7 @@ module ngApp.search.controllers {
};

this.FilesService.getFiles(fileOptions).then((data: IFiles) => {
this.filesLoading = false;
this.files = this.files || {};
this.files.aggregations = data.aggregations;

Expand All @@ -152,6 +158,7 @@ module ngApp.search.controllers {
});

this.ParticipantsService.getParticipants(participantOptions).then((data: IParticipants) => {
this.participantsLoading = false;
this.participants = this.participants || {};
this.participants.aggregations = data.aggregations;

Expand Down
6 changes: 5 additions & 1 deletion app/scripts/search/templates/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@
</div>
</div>

<h3 class="col-lg-9 col-md-8" data-ng-if="!sc.participants.hits.length && !sc.files.hits.length" data-translate>
<h3 class="col-lg-9 col-md-8" data-ng-if="sc.participantsLoading && sc.filesLoading" data-translate>
Loading, please wait.. <i class="fa fa-spinner fa-spin"></i>
</h3>

<h3 class="col-lg-9 col-md-8" data-ng-if="!sc.participants.hits.length && !sc.files.hits.length && !sc.participantsLoading && !sc.filesLoading" data-translate>
No results found using those filters.
</h3>

Expand Down

0 comments on commit 5efd889

Please sign in to comment.