Skip to content

Commit

Permalink
display last sync date
Browse files Browse the repository at this point in the history
  • Loading branch information
irahopkinson committed Dec 27, 2016
1 parent 184f5b0 commit 3580381
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 33 deletions.
1 change: 1 addition & 0 deletions src/Api/Model/Languageforge/Lexicon/LexProjectModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public function getPublicSettings($userId)
$settings = parent::getPublicSettings($userId);
$settings['currentUserRole'] = $this->users[$userId]->role;
$settings['hasSendReceive'] = $this->hasSendReceive();
$settings['lastSyncedDate'] = $this->lastSyncedDate->asDateTimeInterface()->format(\DateTime::RFC2822);

return array_merge($settings, LexBaseViewDto::encode($this->id->asString(), $userId));
}
Expand Down
26 changes: 0 additions & 26 deletions src/angular-app/languageforge/lexicon/js/filters.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ angular.module('lexicon.services')
};
}])
.service('lexSendReceive', ['sessionService', 'silNoticeService', 'lexSendReceiveApi',
'$interval', 'lexEditorDataService',
function (sessionService, notice, sendReceiveApi, $interval, editorData) {
'$interval', 'lexEditorDataService', '$filter',
function (sessionService, notice, sendReceiveApi, $interval, editorData, $filter) {
const syncStatusInterval = 3000; // ms
const pollUpdateInterval = 32000; // ms
const cloneStatusInterval = 3000; // ms
Expand Down Expand Up @@ -191,7 +191,7 @@ angular.module('lexicon.services')

// UI strings corresponding to SRState in the LfMerge state file.
// SRStates with an "LF_" prefix are languageforge overrides
this.syncNotice = function syncNotice() {
this.syncNotice = function syncNotice(projectSettings) {
if (angular.isUndefined(status)) return;

switch (status.SRState) {
Expand All @@ -204,7 +204,14 @@ angular.module('lexicon.services')
return 'Pending';
case 'IDLE':
case 'SYNCED':
return 'Synced';
if (angular.isDefined(projectSettings) &&
angular.isDefined(projectSettings.lastSyncedDate)
) {
return 'Last sync: ' + $filter('relativetime')(projectSettings.lastSyncedDate);
} else {
return 'Synced';
}

case 'LF_UNSYNCED':
return 'Un-synced';
case 'HOLD':
Expand Down
2 changes: 0 additions & 2 deletions src/angular-app/languageforge/lexicon/lexicon.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ angular.module('lexicon',
'lexicon.settings',
'lexicon.sync',
'lexicon.services',
'lexicon.filters',
'pascalprecht.translate'
])
.config(['$stateProvider', '$urlRouterProvider', '$translateProvider',
Expand Down Expand Up @@ -66,7 +65,6 @@ angular.module('lexicon',
var pristineLanguageCode;

$scope.project = sessionService.session.project;
$scope.syncNotice = sendReceive.syncNotice;

$scope.rights = rights;
$scope.rights.showControlBar = function showControlBar() {
Expand Down
2 changes: 1 addition & 1 deletion src/angular-app/languageforge/lexicon/views/sync.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
data-ng-disabled="disableSyncButton()"
data-ng-click="syncProject()">
<i class="fa fa-cloud-upload fa-lg text-info"></i>{{'Send/Receive' | translate}}</button>
<div class="muted" style="margin-right: 10px">{{syncNotice()}}</div>
<div class="muted" style="margin-right: 10px">{{syncNotice(projectSettings)}}</div>
</div>
</div>
</div>
1 change: 1 addition & 0 deletions src/angular-app/languageforge/lexicon/views/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ angular.module('lexicon.sync', ['ui.bootstrap', 'bellows.services', 'palaso.ui.n
lexProjectService.setBreadcrumbs('sync', 'Synchronize');

$scope.syncNotice = sendReceive.syncNotice;
$scope.projectSettings = sessionService.session.projectSettings;

$scope.showSyncButton = function showSyncButton() {
return !sessionService.session.project.isArchived && rights.canEditUsers() &&
Expand Down

0 comments on commit 3580381

Please sign in to comment.