Skip to content

Commit 3d357ee

Browse files
author
Ivan Gavryshko
committed
Merge remote-tracking branch 'origin/MAGETWO-44650-sync-issue-with-different-users' into PR_Branch
2 parents 10bcfb0 + 5ac9619 commit 3d357ee

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

setup/pub/magento/setup/component-grid.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ angular.module('component-grid', ['ngStorage'])
88
.controller('componentGridController', ['$rootScope', '$scope', '$http', '$localStorage', '$state',
99
function ($rootScope, $scope, $http, $localStorage, $state) {
1010
$rootScope.componentsProcessed = false;
11+
$scope.syncError = false;
1112
$http.get('index.php/componentGrid/components').success(function(data) {
1213
$scope.components = data.components;
1314
$scope.total = data.total;
@@ -65,7 +66,13 @@ angular.module('component-grid', ['ngStorage'])
6566
$scope.sync = function() {
6667
$scope.isHiddenSpinner = false;
6768
$http.get('index.php/componentGrid/sync').success(function(data) {
68-
$scope.lastSyncDate = $scope.convertDate(data.lastSyncData.lastSyncDate);
69+
if(typeof data.lastSyncData.lastSyncDate !== "undefined") {
70+
$scope.lastSyncDate = $scope.convertDate(data.lastSyncData.lastSyncDate);
71+
}
72+
if (data.error !== '') {
73+
$scope.syncError = true;
74+
$scope.ErrorMessage = data.error;
75+
}
6976
$scope.availableUpdatePackages = data.lastSyncData.packages;
7077
$scope.countOfUpdate = data.lastSyncData.countOfUpdate;
7178
$scope.countOfInstall = data.lastSyncData.countOfInstall;

setup/src/Magento/Setup/Controller/ComponentGrid.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,21 +143,27 @@ public function componentsAction()
143143
*/
144144
public function syncAction()
145145
{
146-
$this->updatePackagesCache->syncPackagesForUpdate();
147-
$lastSyncData = $this->updatePackagesCache->getPackagesForUpdate();
146+
$error = '';
147+
try {
148+
$this->updatePackagesCache->syncPackagesForUpdate();
149+
$lastSyncData = $this->updatePackagesCache->getPackagesForUpdate();
150+
151+
$this->marketplaceManager->syncPackagesForInstall();
152+
$packagesForInstall = $this->marketplaceManager->getPackagesForInstall();
153+
} catch (\Exception $e) {
154+
$error = $e->getMessage();
155+
}
148156

149-
$this->marketplaceManager->syncPackagesForInstall();
150-
$packagesForInstall = $this->marketplaceManager->getPackagesForInstall();
151157

152158
$lastSyncData['countOfInstall'] =
153159
isset($packagesForInstall['packages']) ? count($packagesForInstall['packages']) : 0;
154160
$lastSyncData['countOfUpdate'] = isset($lastSyncData['packages']) ? count($lastSyncData['packages']) : 0;
155161

156-
157162
return new \Zend\View\Model\JsonModel(
158163
[
159164
'success' => true,
160-
'lastSyncData' => $lastSyncData
165+
'lastSyncData' => $lastSyncData,
166+
'error' => $error
161167
]
162168
);
163169
}

setup/view/magento/setup/component-grid.phtml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
?>
77
<h2 class="page-title">{{$state.current.header}}</h2>
88
<div ng-controller="authDialogController">
9+
<div class="message message-error" ng-show="syncError">
10+
<span class="message-text">
11+
{{ErrorMessage}}
12+
</span>
13+
</div>
914
<div ng-show="$root.isMarketplaceAuthorized" class="componenet-manager-wrap">
1015
<div class="component-manager-title">
1116
Magento Marketplace Account

0 commit comments

Comments
 (0)