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

Show warnings on project list for some V1 data
This commit is contained in:
Alasdair Smith 2017-12-05 13:16:58 +00:00 committed by GitHub
commit cf9861bace
2 changed files with 13 additions and 3 deletions

View file

@ -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:

View file

@ -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