mirror of
https://github.com/moparisthebest/mail
synced 2024-11-22 17:02:17 -05:00
[WO-629] Fix online status in desktop nav
This commit is contained in:
parent
571d9dbf34
commit
b10c0896e9
@ -242,19 +242,19 @@ var MailListCtrl = function($scope, $routeParams) {
|
|||||||
if (!searchText) {
|
if (!searchText) {
|
||||||
// set display buffer to first messages
|
// set display buffer to first messages
|
||||||
$scope.displayMessages = currentFolder().messages.slice(0, INIT_DISPLAY_LEN);
|
$scope.displayMessages = currentFolder().messages.slice(0, INIT_DISPLAY_LEN);
|
||||||
$scope.searching = false;
|
setSearching(false);
|
||||||
updateStatus('Online');
|
updateStatus('Online');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// display searching spinner
|
// display searching spinner
|
||||||
$scope.searching = true;
|
setSearching(true);
|
||||||
updateStatus('Searching ...');
|
updateStatus('Searching ...');
|
||||||
searchTimeout = setTimeout(function() {
|
searchTimeout = setTimeout(function() {
|
||||||
$scope.$apply(function() {
|
$scope.$apply(function() {
|
||||||
// filter relevant messages
|
// filter relevant messages
|
||||||
$scope.displayMessages = $scope.search(currentFolder().messages, searchText);
|
$scope.displayMessages = $scope.search(currentFolder().messages, searchText);
|
||||||
$scope.searching = false;
|
setSearching(false);
|
||||||
updateStatus('Matches in this folder');
|
updateStatus('Matches in this folder');
|
||||||
});
|
});
|
||||||
}, 500);
|
}, 500);
|
||||||
@ -366,8 +366,12 @@ var MailListCtrl = function($scope, $routeParams) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateStatus(lbl, time) {
|
function updateStatus(lbl, time) {
|
||||||
$scope.lastUpdateLbl = lbl;
|
$scope.state.mailList.lastUpdateLbl = lbl;
|
||||||
$scope.lastUpdate = (time) ? time : '';
|
$scope.state.mailList.lastUpdate = (time) ? time : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
function setSearching(state) {
|
||||||
|
$scope.state.mailList.searching = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
function currentFolder() {
|
function currentFolder() {
|
||||||
|
@ -67,12 +67,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
<span class="spinner" ng-show="account.loggingIn || account.busy || searching"></span>
|
<span class="spinner" ng-show="account.loggingIn || account.busy || state.mailList.searching"></span>
|
||||||
<span class="text" ng-switch="account.online">
|
<span class="text" ng-switch="account.online">
|
||||||
<span ng-switch-when="false">
|
<span ng-switch-when="false">
|
||||||
<svg><use xlink:href="#icon-offline" /></svg>
|
<svg><use xlink:href="#icon-offline" /></svg>
|
||||||
</span>
|
</span>
|
||||||
{{lastUpdateLbl}} {{lastUpdate | date:'shortTime'}}
|
{{state.mailList.lastUpdateLbl}} {{state.mailList.lastUpdate | date:'shortTime'}}
|
||||||
</span>
|
</span>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
@ -68,12 +68,12 @@
|
|||||||
</ul><!--/nav__secondary-->
|
</ul><!--/nav__secondary-->
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
<span class="spinner" ng-show="account.loggingIn || account.busy || searching"></span>
|
<span class="spinner" ng-show="account.loggingIn || account.busy || state.mailList.searching"></span>
|
||||||
<span class="text" ng-switch="account.online">
|
<span class="text" ng-switch="account.online">
|
||||||
<span ng-switch-when="false">
|
<span ng-switch-when="false">
|
||||||
<svg><use xlink:href="#icon-offline" /></svg>
|
<svg><use xlink:href="#icon-offline" /></svg>
|
||||||
</span>
|
</span>
|
||||||
{{lastUpdateLbl}} {{lastUpdate | date:'shortTime'}}
|
{{state.mailList.lastUpdateLbl}} {{state.mailList.lastUpdate | date:'shortTime'}}
|
||||||
</span>
|
</span>
|
||||||
</footer>
|
</footer>
|
||||||
</nav>
|
</nav>
|
@ -137,8 +137,8 @@ describe('Mail List controller unit test', function() {
|
|||||||
|
|
||||||
it('should show initial message on empty', function() {
|
it('should show initial message on empty', function() {
|
||||||
scope.displaySearchResults();
|
scope.displaySearchResults();
|
||||||
expect(scope.searching).to.be.false;
|
expect(scope.state.mailList.searching).to.be.false;
|
||||||
expect(scope.lastUpdateLbl).to.equal('Online');
|
expect(scope.state.mailList.lastUpdateLbl).to.equal('Online');
|
||||||
expect(scope.displayMessages.length).to.equal(2);
|
expect(scope.displayMessages.length).to.equal(2);
|
||||||
});
|
});
|
||||||
it('should show initial message on empty', function() {
|
it('should show initial message on empty', function() {
|
||||||
@ -147,13 +147,13 @@ describe('Mail List controller unit test', function() {
|
|||||||
|
|
||||||
|
|
||||||
scope.displaySearchResults('query');
|
scope.displaySearchResults('query');
|
||||||
expect(scope.searching).to.be.true;
|
expect(scope.state.mailList.searching).to.be.true;
|
||||||
expect(scope.lastUpdateLbl).to.equal('Searching ...');
|
expect(scope.state.mailList.lastUpdateLbl).to.equal('Searching ...');
|
||||||
clock.tick(500);
|
clock.tick(500);
|
||||||
|
|
||||||
expect(scope.displayMessages).to.deep.equal(['a']);
|
expect(scope.displayMessages).to.deep.equal(['a']);
|
||||||
expect(scope.searching).to.be.false;
|
expect(scope.state.mailList.searching).to.be.false;
|
||||||
expect(scope.lastUpdateLbl).to.equal('Matches in this folder');
|
expect(scope.state.mailList.lastUpdateLbl).to.equal('Matches in this folder');
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user