Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.16.1 - Mise en prod 21/09/2021 #1177

Merged
merged 14 commits into from
Sep 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.0.2"
version = "3.0.4"
maxColumn = 100
spaces.afterKeywordBeforeParen = true
newlines.topLevelStatements = [before, after]
Expand Down
10 changes: 6 additions & 4 deletions app/controllers/ApplicationController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ case class ApplicationController @Inject() (
val numOfMonthsDisplayed: Int = request
.getQueryString(Keys.QueryParam.numOfMonthsDisplayed)
.flatMap(s => Try(s.toInt).toOption)
.getOrElse(12)
.getOrElse(3)
val area = if (areaId === Area.allArea.id) None else Area.fromId(areaId)
allApplicationVisibleByUserAdmin(request.currentUser, area, numOfMonthsDisplayed).map {
unfilteredApplications =>
Expand Down Expand Up @@ -1085,14 +1085,16 @@ case class ApplicationController @Inject() (
)
form.fold(
formWithErrors => {
val message =
s"Erreur dans le formulaire de réponse (${formWithErrors.errors.map(_.format).mkString(", ")})."
val error =
s"Erreur dans le formulaire de réponse (${formWithErrors.errors.map(_.message).mkString(", ")})."
eventService.log(AnswerNotCreated, s"$error", application = application.some)
s"Erreur dans le formulaire de réponse (${formErrorsLog(formWithErrors)})"
eventService.log(AnswerNotCreated, error, application = application.some)
Future(
Redirect(
routes.ApplicationController.show(applicationId).withFragment("answer-error")
)
.flashing("answer-error" -> error, "opened-tab" -> "anwser")
.flashing("answer-error" -> message, "opened-tab" -> "anwser")
)
},
answerData => {
Expand Down
7 changes: 7 additions & 0 deletions app/controllers/UserController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,18 @@ case class UserController @Inject() (
eventService.log(UsersShowed, "Appelle la liste des utilisateurs")
val idToGroup = groups.map(group => (group.id, group)).toMap
val userInfos = users.map { user =>
val completeName = {
val firstName = user.firstName.getOrElse("")
val lastName = user.lastName.getOrElse("")
if (firstName.nonEmpty || lastName.nonEmpty) s"${user.name} ($lastName $firstName)"
else user.name
}
UserInfos(
id = user.id,
firstName = user.firstName,
lastName = user.lastName,
name = user.name,
completeName = completeName,
qualite = user.qualite,
email = user.email,
phoneNumber = user.phoneNumber,
Expand Down
1 change: 1 addition & 0 deletions app/models/Application.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ case class Application(
(invitedGroupIdsAtCreation ::: answers.flatMap(_.invitedGroupIds)).toSet

val seenByUserIds = seenByUsers.map(_.userId)
val seenByUsersMap = seenByUsers.map { case SeenByUser(userId, date) => (userId, date) }.toMap

def newAnswersFor(userId: UUID) = {
val maybeSeenLastDate = seenByUsers.find(_.userId === userId).map(_.lastSeenDate)
Expand Down
1 change: 1 addition & 0 deletions app/serializers/ApiModel.scala
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ object ApiModel {
firstName: Option[String],
lastName: Option[String],
name: String,
completeName: String,
qualite: String,
email: String,
phoneNumber: Option[String],
Expand Down
2 changes: 1 addition & 1 deletion app/views/helpers/menuNav.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
}

@if(Authorization.canSeeApplicationsAsAdmin(currentUserRights)) {
<a @linkAttrs(routes.ApplicationController.all(Area.allArea.id), serializers.Keys.QueryParam.numOfMonthsDisplayed + "=12")>
<a @linkAttrs(routes.ApplicationController.all(Area.allArea.id), serializers.Keys.QueryParam.numOfMonthsDisplayed + "=3")>
<i class="material-icons" role="presentation">folder</i>Admin : demandes
</a>
}
Expand Down
9 changes: 6 additions & 3 deletions app/views/showApplication.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -315,13 +315,16 @@ <h2 class="mdl-card__title-text">@application.subject</h2>
</span>
</div>
<div class="mdl-list__item-secondary-content">
@if(application.seenByUserIds.contains(userId)){
@application.seenByUsersMap.get(userId) match {
case None => {}
case Some(date) => {
<div id="seen-@userId" class="vertical-align--middle">
<i class="material-icons icon--light">remove_red_eye</i>
<i class="material-icons">remove_red_eye</i>
</div>
<div class="mdl-tooltip" for="seen-@userId">
Consultée par l’utilisateur
Consultée par l’utilisateur (@Time.formatPatternFr(date.atZone(currentUser.timeZone), "dd MMM YYYY - HH:mm"))
</div>
}
}
</div>
</div>
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
"ts-polyfill": "3.8.2",
"unfetch": "4.2.0",
"unorm": "1.6.0",
"xlsx": "0.17.1"
"xlsx": "0.17.2"
},
"devDependencies": {
"@types/tabulator-tables": "4.9.3",
"copy-webpack-plugin": "9.0.1",
"css-loader": "6.2.0",
"mini-css-extract-plugin": "2.2.2",
"css-loader": "6.3.0",
"mini-css-extract-plugin": "2.3.0",
"rimraf": "3.0.2",
"ts-loader": "9.2.5",
"typescript": "4.4.2",
"webpack": "5.52.0",
"typescript": "4.4.3",
"webpack": "5.53.0",
"webpack-cli": "4.8.0",
"webpack-merge": "5.8.0"
}
Expand Down
4 changes: 2 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// of jackson is set in build.sbt (with the patch version that is not vulnerable)
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.8")
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.10.0-RC1")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.8.2")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.0")
addSbtPlugin("com.codacy" % "sbt-codacy-coverage" % "3.0.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.4")
addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.2")
Expand All @@ -17,4 +17,4 @@ addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.1")
// Makes available sbt commands results to project scala code
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0")

addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.30")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.31")
64 changes: 39 additions & 25 deletions typescript/src/admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ if (window.document.getElementById(franceServiceDeploymentTableTagId)) {
}
}
const element = window.document.getElementById(franceServiceDeploymentTotalTagId);
element.textContent = "Nombre de déploiements (plus de 1 utilisateur): " +
nrOfDeployed + " ; Nombre total: " + totalNr
if (element) {
element.textContent = "Nombre de déploiements (plus de 1 utilisateur): " +
nrOfDeployed + " ; Nombre total: " + totalNr
}
return response; //return the response data to tabulator
},
layout: "fitColumns", //fit columns to width of table
Expand All @@ -101,22 +103,28 @@ if (window.document.getElementById(franceServiceDeploymentTableTagId)) {



window.document.getElementById(franceServiceDeploymentDownloadBtnCsvId).onclick = () => {
const date = new Date().toISOString().replace(/:/g, '-');
franceServiceDeploymentTable.download(
'csv',
'aplus-export-deploiement-france-service-' + date + '.csv'
);
};
const csvBtn = window.document.getElementById(franceServiceDeploymentDownloadBtnCsvId);
if (csvBtn) {
csvBtn.onclick = () => {
const date = new Date().toISOString().replace(/:/g, '-');
franceServiceDeploymentTable.download(
'csv',
'aplus-export-deploiement-france-service-' + date + '.csv'
);
};
}

window.document.getElementById(franceServiceDeploymentDownloadBtnXlsxId).onclick = () => {
const date = new Date().toISOString().replace(/:/g, '-');
franceServiceDeploymentTable.download(
"xlsx",
'aplus-export-deploiement-france-service-' + date + '.xlsx',
{ sheetName: "Déploiement France Service" }
);
};
const xlsxBtn = window.document.getElementById(franceServiceDeploymentDownloadBtnXlsxId);
if (xlsxBtn) {
xlsxBtn.onclick = () => {
const date = new Date().toISOString().replace(/:/g, '-');
franceServiceDeploymentTable.download(
"xlsx",
'aplus-export-deploiement-france-service-' + date + '.xlsx',
{ sheetName: "Déploiement France Service" }
);
};
}

}

Expand Down Expand Up @@ -269,15 +277,21 @@ if (window.document.getElementById(deploymentTableTagId)) {
height: "85vh",
});

window.document.getElementById(deploymentDownloadBtnCsvId).onclick = () => {
const date = new Date().toISOString().replace(/:/g, '-');
table.download('csv', 'aplus-export-deploiement-' + date + '.csv');
};
const csvBtn = window.document.getElementById(deploymentDownloadBtnCsvId);
if (csvBtn) {
csvBtn.onclick = () => {
const date = new Date().toISOString().replace(/:/g, '-');
table.download('csv', 'aplus-export-deploiement-' + date + '.csv');
};
}

window.document.getElementById(deploymentDownloadBtnXlsxId).onclick = () => {
const date = new Date().toISOString().replace(/:/g, '-');
table.download("xlsx", 'aplus-export-deploiement-' + date + '.xlsx', { sheetName: "Déploiement" });
};
const xlsxBtn = window.document.getElementById(deploymentDownloadBtnXlsxId);
if (xlsxBtn) {
xlsxBtn.onclick = () => {
const date = new Date().toISOString().replace(/:/g, '-');
table.download("xlsx", 'aplus-export-deploiement-' + date + '.xlsx', { sheetName: "Déploiement" });
};
}

});
}
Loading