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

Merge pull request #186 from sharelatex/as-show-v1-warnings

Show warnings on project list for some V1 data
Alasdair Smith пре 8 година
родитељ
комит
cf9861bace

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

@@ -170,6 +170,8 @@ module.exports = ProjectController =
 					return notification
 					return notification
 				projects = ProjectController._buildProjectList results.projects, results.v1Projects?.projects
 				projects = ProjectController._buildProjectList results.projects, results.v1Projects?.projects
 				user = results.user
 				user = results.user
+				warnings = ProjectController._buildWarningsList results.v1Projects
+
 				ProjectController._injectProjectOwners projects, (error, projects) ->
 				ProjectController._injectProjectOwners projects, (error, projects) ->
 					return next(error) if error?
 					return next(error) if error?
 					viewModel = {
 					viewModel = {
@@ -181,7 +183,7 @@ module.exports = ProjectController =
 						user: user
 						user: user
 						hasSubscription: results.hasSubscription[0]
 						hasSubscription: results.hasSubscription[0]
 						isShowingV1Projects: results.v1Projects?
 						isShowingV1Projects: results.v1Projects?
-						noV1Connection: results.v1Projects?.noConnection
+						warnings: warnings
 					}
 					}
 
 
 					if Settings?.algolia?.app_id? and Settings?.algolia?.read_only_api_key?
 					if Settings?.algolia?.app_id? and Settings?.algolia?.read_only_api_key?
@@ -427,6 +429,14 @@ module.exports = ProjectController =
 					project.owner = users[project.owner_ref.toString()]
 					project.owner = users[project.owner_ref.toString()]
 			callback null, projects
 			callback null, projects
 
 
+	_buildWarningsList: (v1ProjectData = {}) ->
+		warnings = []
+		if v1ProjectData.noConnection
+			warnings.push 'No V1 Connection'
+		if v1ProjectData.hasHiddenV1Projects
+			warnings.push "Looks like you've got a lot of V1 projects! Some of them may be hidden on V2. To view them all, use the V1 dashboard."
+		return warnings
+
 defaultSettingsForAnonymousUser = (user_id)->
 defaultSettingsForAnonymousUser = (user_id)->
 	id : user_id
 	id : user_id
 	ace:
 	ace:

+ 2 - 2
services/web/app/views/project/list/project-list.pug

@@ -114,9 +114,9 @@
 					) #{translate("delete_forever")}
 					) #{translate("delete_forever")}
 
 
 .row.row-spaced
 .row.row-spaced
-	if noV1Connection
+	each warning in warnings
 		.col-xs-12
 		.col-xs-12
-			.alert.alert-warning No V1 Connection
+			.alert.alert-warning(role="alert")= warning
 
 
 	.col-xs-12
 	.col-xs-12
 		.card.card-thin.project-list-card
 		.card.card-thin.project-list-card