Преглед изворни кода

Show warning message if V1 connection fails

Alasdair Smith пре 9 година
родитељ
комит
f3583b1702

+ 4 - 1
services/web/app/coffee/Features/Project/ProjectController.coffee

@@ -151,7 +151,9 @@ module.exports = ProjectController =
 				ProjectGetter.findAllUsersProjects user_id, 'name lastUpdated publicAccesLevel archived owner_ref tokens', cb
 			v1Projects: (cb) ->
 				Modules.hooks.fire "findAllV1Projects", user_id, (error, projects = []) ->
-					cb error, projects[0] # hooks.fire returns an array of results, only need first
+					if error? and error.message == 'No V1 connection'
+						return cb(null, projects: [], tags: [], noConnection: true)
+					return cb(error, projects[0]) # hooks.fire returns an array of results, only need first
 			hasSubscription: (cb)->
 				LimitationsManager.userHasSubscriptionOrIsGroupMember currentUser, cb
 			user: (cb) ->
@@ -179,6 +181,7 @@ module.exports = ProjectController =
 						user: user
 						hasSubscription: results.hasSubscription[0]
 						isShowingV1Projects: results.v1Projects?
+						noV1Connection: results.v1Projects?.noConnection
 					}
 
 					if Settings?.algolia?.app_id? and Settings?.algolia?.read_only_api_key?

+ 4 - 0
services/web/app/views/project/list/project-list.pug

@@ -114,6 +114,10 @@
 					) #{translate("delete_forever")}
 
 .row.row-spaced
+	if noV1Connection
+		.col-xs-12
+			.alert.alert-warning No V1 Connection
+
 	.col-xs-12
 		.card.card-thin.project-list-card
 			ul.list-unstyled.project-list.structured-list(