Commit 6f5ca746 authored by Mathieu's avatar Mathieu
Browse files

[GUI] Replace upickle by boopickle

parent a564d304
......@@ -54,6 +54,9 @@ lazy val circe = OsgiProject(dir, "io.circe",
libraryDependencies += shapeless,
version := circeVersion) settings(settings: _*)
lazy val akkautil = OsgiProject(dir, "com.typesafe.akka", exports = Seq("akka.util.*"), dynamicImports = Seq("*")) settings
(libraryDependencies += "com.typesafe.akka" % "akka-actor_2.12" % "2.5.6", version := "2.5.6") settings(settings: _*)
lazy val logback = OsgiProject(dir, "ch.qos.logback", exports = Seq("ch.qos.logback.*", "org.slf4j.impl"), dynamicImports = Seq("*")) settings
(libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.0.9", version := "1.0.9") settings(settings: _*)
......@@ -154,6 +157,7 @@ lazy val scalaTagsVersion = "0.6.5"
lazy val scalaRxVersion = "0.3.2"
lazy val scalaDomVersion = "0.9.3"
lazy val scalaUpickleVersion = "0.4.4"
lazy val scalaBoopickleVersion = "1.2.6"
lazy val scalaAutowireVersion = "0.2.6"
lazy val scalajsVersion = "0.6.18"
......@@ -182,6 +186,10 @@ lazy val upickle = OsgiProject(dir, "upickle", exports = Seq("upickle.*", "jawn.
libraryDependencies ++= Seq("com.lihaoyi" %% "upickle" % scalaUpickleVersion),
version := scalaUpickleVersion) settings(settings: _*)
lazy val boopickle = OsgiProject(dir, "boopickle", exports = Seq("boopickle.*"), imports = Seq("*")) settings(
libraryDependencies ++= Seq("io.suzaku" %% "boopickle" % scalaBoopickleVersion),
version := scalaBoopickleVersion) settings(settings: _*)
lazy val autowire = OsgiProject(dir, "autowire", exports = Seq("autowire.*")) settings(
libraryDependencies ++= Seq("com.lihaoyi" %% "autowire" % scalaAutowireVersion),
version := scalaAutowireVersion) settings(settings: _*)
......
import org.openmole.buildsystem._
import OMKeys._
import sbt._
import Keys._
import Keys.{libraryDependencies, _}
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
organization := "org.openmole"
......@@ -536,11 +534,11 @@ lazy val dataGUI = OsgiProject(guiExt, "org.openmole.gui.ext.data") enablePlugin
lazy val extServerTool = OsgiProject(guiExt, "org.openmole.gui.ext.tool.server") dependsOn(dataGUI, workspace) settings(
libraryDependencies += Libraries.autowire,
libraryDependencies += Libraries.upickle
libraryDependencies += Libraries.boopickle
) settings (defaultSettings: _*)
lazy val extClientTool = OsgiProject(guiExt, "org.openmole.gui.ext.tool.client") enablePlugins (ScalaJSPlugin) dependsOn(dataGUI, sharedGUI) settings(
Libraries.upickleJS,
Libraries.boopickleJS,
Libraries.autowireJS,
Libraries.rxJS,
Libraries.scalajsDomJS,
......@@ -599,9 +597,9 @@ lazy val clientGUI = OsgiProject(guiClientDir, "org.openmole.gui.client.core") e
) settings (defaultSettings: _*)
lazy val clientToolGUI = OsgiProject(guiClientDir, "org.openmole.gui.client.tool", privatePackages = Seq("autowire.*", "upickle.*", "sourcecode.*", "rx.*", "org.scalajs.dom.*", "scalatags.*", "scaladget.*")) enablePlugins (ScalaJSPlugin) dependsOn (workspace) settings(
lazy val clientToolGUI = OsgiProject(guiClientDir, "org.openmole.gui.client.tool", privatePackages = Seq("autowire.*", "boopickle.*" ,"sourcecode.*", "rx.*", "org.scalajs.dom.*", "scalatags.*", "scaladget.*")) enablePlugins (ScalaJSPlugin) dependsOn (workspace) settings(
Libraries.autowireJS,
Libraries.upickleJS,
Libraries.boopickleJS,
Libraries.scalajsDomJS,
Libraries.scalaTagsJS,
Libraries.scaladgetJS,
......@@ -613,7 +611,7 @@ lazy val clientToolGUI = OsgiProject(guiClientDir, "org.openmole.gui.client.tool
def guiServerDir = guiDir / "server"
lazy val serverGUI = OsgiProject(guiServerDir, "org.openmole.gui.server.core") settings
(libraryDependencies ++= Seq(Libraries.autowire, Libraries.upickle, Libraries.scalaTags, Libraries.logback, Libraries.scalatra, Libraries.clapper, Libraries.arm)) dependsOn(
(libraryDependencies ++= Seq(Libraries.arm, Libraries.autowire, Libraries.boopickle, Libraries.circe, Libraries.scalaTags, Libraries.logback, Libraries.scalatra, Libraries.clapper)) dependsOn(
sharedGUI,
dataGUI,
workflow,
......@@ -918,9 +916,9 @@ lazy val launcher = OsgiProject(binDir, "org.openmole.launcher", imports = Seq("
) settings (defaultSettings: _*)
lazy val consoleBin = OsgiProject(binDir, "org.openmole.console", imports = Seq("*")) settings (
libraryDependencies += Libraries.upickle
) dependsOn(
lazy val consoleBin = OsgiProject(binDir, "org.openmole.console", imports = Seq("*")) settings(
libraryDependencies += Libraries.boopickle
) dependsOn(
workflow,
console,
project,
......
......@@ -7,10 +7,13 @@ import org.openmole.gui.client.core.alert.AbsolutePositioning.{ FileZone, Relati
import org.openmole.gui.client.core.alert.AlertPanel
import scala.concurrent.Future
import scala.scalajs.concurrent.JSExecutionContext.Implicits.runNow
import scala.concurrent.ExecutionContext.Implicits.global
import boopickle.Default._
import org.openmole.gui.client.core.files.treenodemanager.{ instance manager }
import org.openmole.gui.ext.api.Api
import org.openmole.gui.ext.tool.client.OMPost
import scala.util.{ Failure, Success }
import scalatags.JsDom.all._
/*
......
......@@ -25,7 +25,8 @@ import org.openmole.gui.ext.tool.client._
import org.openmole.gui.ext.tool.client.JsRxTags._
import scala.concurrent.Future
import scala.scalajs.concurrent.JSExecutionContext.Implicits.runNow
import boopickle.Default._
import scala.concurrent.ExecutionContext.Implicits.global
import scaladget.stylesheet.{ all sheet }
import org.openmole.gui.ext.data._
import sheet._
......@@ -88,7 +89,7 @@ class AuthenticationPanel {
)
test match {
case PassedTest(_) lab(label_success).render
case PendingTest lab(label_warning).render
case PendingTest() lab(label_warning).render
case _ lab(label_danger +++ pointer)(onclick := { ()
currentStack() = test.errorStack.stackTrace
errorOn() = !errorOn.now
......
......@@ -39,7 +39,7 @@ class EnvironmentErrorPanel {
val scrollableTable = scrollableDiv()
val scrollableStack = scrollableText()
val sortingAndOrdering: Var[ListSortingAndOrdering] = Var(ListSortingAndOrdering(TimeSorting, Descending))
val sortingAndOrdering: Var[ListSortingAndOrdering] = Var(ListSortingAndOrdering(TimeSorting(), Descending()))
val currentData: Var[Option[EnvironmentErrorData]] = Var(None)
val topTriangle = glyph_triangle_top +++ (fontSize := 10)
......@@ -69,14 +69,14 @@ class EnvironmentErrorPanel {
} yield (error.errorMessage, mostRecentDate, occurrences, error.level, error.stack)
val sorted = sortingAndOrdering.fileSorting match {
case AlphaSorting lines.sortBy(_._1)
case TimeSorting lines.sortBy(_._2)
case _ lines.sortBy(_._4.name)
case AlphaSorting() lines.sortBy(_._1)
case TimeSorting() lines.sortBy(_._2)
case _ lines.sortBy(_._4.name)
}
sortingAndOrdering.fileOrdering match {
case Ascending sorted
case _ sorted.reverse
case Ascending() sorted
case _ sorted.reverse
}
}
......@@ -112,10 +112,10 @@ class EnvironmentErrorPanel {
val errorTable = tags.table(sheet.table +++ ms("EnvError") +++ (width := "100%"))(
thead(
tr(row)(
th(exclusiveButton("Error", () setSorting(AlphaSorting, Ascending), () setSorting(AlphaSorting, Descending))),
th(exclusiveButton("Error", () setSorting(AlphaSorting(), Ascending()), () setSorting(AlphaSorting(), Descending()))),
th(""),
th(exclusiveButton("Date", () setSorting(TimeSorting, Ascending), () setSorting(TimeSorting, Descending))),
th(exclusiveButton("Level", () setSorting(LevelSorting, Ascending), () setSorting(LevelSorting, Descending)))
th(exclusiveButton("Date", () setSorting(TimeSorting(), Ascending()), () setSorting(TimeSorting(), Descending()))),
th(exclusiveButton("Level", () setSorting(LevelSorting(), Ascending()), () setSorting(LevelSorting(), Descending())))
)
), Rx {
tbody(
......
......@@ -31,7 +31,8 @@ import org.openmole.gui.ext.tool.client.JsRxTags._
import org.openmole.gui.ext.tool.client._
import scala.scalajs.js.timers._
import scala.scalajs.concurrent.JSExecutionContext.Implicits.runNow
import scala.concurrent.ExecutionContext.Implicits.global
import boopickle.Default._
import scaladget.stylesheet.{ all sheet }
import sheet._
import autowire._
......
......@@ -22,10 +22,10 @@ import org.openmole.gui.client.core.alert.{ AbsolutePositioning, AlertPanel }
import AbsolutePositioning.CenterPagePosition
import scaladget.api.{ BootstrapTags bs }
import org.openmole.gui.ext.data.{ ProcessState, Processing }
import org.openmole.gui.client.tool._
import org.openmole.gui.ext.tool.client.JsRxTags._
import org.openmole.gui.ext.tool.client._
import scala.scalajs.concurrent.JSExecutionContext.Implicits.runNow
import scala.concurrent.ExecutionContext.Implicits.global
import boopickle.Default._
import org.openmole.gui.client.core.files.TreeNodePanel
import org.openmole.gui.client.core.files.treenodemanager.{ instance manager }
import scaladget.stylesheet.{ all sheet }
......
......@@ -23,7 +23,8 @@ import org.openmole.gui.ext.data._
import org.openmole.gui.client.core.panels._
import autowire._
import org.scalajs.dom.html.TextArea
import scala.scalajs.concurrent.JSExecutionContext.Implicits.runNow
import scala.concurrent.ExecutionContext.Implicits.global
import boopickle.Default._
import org.openmole.gui.client.core.files.treenodemanager.{ instance manager }
import org.scalajs.dom.raw.{ HTMLDivElement, HTMLInputElement }
import org.openmole.gui.ext.tool.client._
......@@ -337,7 +338,7 @@ class ModelWizardPanel {
}
// Other archive: tgz, tar.gz
case UndefinedLanguage
case UndefinedLanguage()
post()[Api].models(uploadPath).call().foreach {
models
fileToUploadPath() = models.headOption
......
......@@ -9,7 +9,8 @@ import scalatags.JsDom.all._
import scaladget.api.{ BootstrapTags bs }
import scalatags.JsDom.tags
import scala.scalajs.concurrent.JSExecutionContext.Implicits.runNow
import scala.concurrent.ExecutionContext.Implicits.global
import boopickle.Default._
import org.openmole.gui.ext.tool.client.JsRxTags._
import org.openmole.gui.ext.tool.client._
import autowire._
......
......@@ -4,17 +4,11 @@ import org.openmole.gui.ext.api.Api
import org.openmole.gui.ext.data.{ AllPluginExtensionData, AuthenticationPluginFactory }
import autowire._
import scala.scalajs.concurrent.JSExecutionContext.Implicits.runNow
import scala.concurrent.ExecutionContext.Implicits.global
import boopickle.Default._
import rx._
import scalatags.JsDom.all._
import org.openmole.gui.ext.tool.client.JsRxTags._
import scalatags.JsDom.tags
import scala.scalajs.js
import js.annotation._
import scala.concurrent.Future
/*
* Copyright (C) 30/11/16 // mathieu.leclaire@openmole.org
*
......
......@@ -15,7 +15,8 @@ import sheet._
import bs._
import org.scalajs.dom.KeyboardEvent
import scala.scalajs.concurrent.JSExecutionContext.Implicits.runNow
import scala.concurrent.ExecutionContext.Implicits.global
import boopickle.Default._
import autowire._
import scaladget.api.Selector.Options
import org.openmole.gui.client.core.alert.{ AlertPanel, BannerAlert }
......
......@@ -18,10 +18,11 @@ package org.openmole.gui.client.core
*/
import scala.concurrent.Future
import scala.scalajs.concurrent.JSExecutionContext.Implicits.runNow
import autowire._
import org.openmole.gui.ext.api.Api
import org.openmole.gui.ext.data.OMSettings
import scala.concurrent.ExecutionContext.Implicits.global
import boopickle.Default._
object Settings {
......
......@@ -4,7 +4,8 @@ import scaladget.stylesheet.all._
import org.openmole.gui.client.core.alert.AbsolutePositioning.CenterPagePosition
import scalatags.JsDom._
import scala.scalajs.concurrent.JSExecutionContext.Implicits.runNow
import scala.concurrent.ExecutionContext.Implicits.global
import boopickle.Default._
import org.openmole.gui.client.core.alert.AlertPanel
import scaladget.api.{ BootstrapTags bs }
import org.openmole.gui.client.core.panels._
......
......@@ -4,7 +4,8 @@ import TreeNodeTabs._
import org.openmole.gui.ext.data.ScriptData
import org.openmole.gui.ext.data._
import scala.concurrent.duration._
import scala.scalajs.concurrent.JSExecutionContext.Implicits.runNow
import scala.concurrent.ExecutionContext.Implicits.global
import boopickle.Default._
import autowire._
import rx._
import org.openmole.gui.client.core.panels._
......
......@@ -17,7 +17,8 @@ import org.openmole.gui.client.core.files.treenodemanager.{ instance ⇒ manager
import org.openmole.gui.ext.tool.client.JsRxTags._
import autowire._
import org.openmole.gui.ext.tool.client._
import scala.scalajs.concurrent.JSExecutionContext.Implicits.runNow
import scala.concurrent.ExecutionContext.Implicits.global
import boopickle.Default._
import org.scalajs.dom.raw.{ HTMLButtonElement, HTMLElement, HTMLInputElement, HTMLSpanElement }
import rx._
import org.openmole.gui.client.core.Waiter._
......@@ -305,17 +306,17 @@ class FileToolBar(treeNodePanel: TreeNodePanel) {
}
def switchAlphaSorting = {
updateFilter(fileFilter.now.switchTo(AlphaSorting))
updateFilter(fileFilter.now.switchTo(AlphaSorting()))
treeNodePanel.invalidCacheAndDraw
}
def switchTimeSorting = {
updateFilter(fileFilter.now.switchTo(TimeSorting))
updateFilter(fileFilter.now.switchTo(TimeSorting()))
treeNodePanel.invalidCacheAndDraw
}
def switchSizeSorting = {
updateFilter(fileFilter.now.switchTo(SizeSorting))
updateFilter(fileFilter.now.switchTo(SizeSorting()))
treeNodePanel.invalidCacheAndDraw
}
......
......@@ -18,7 +18,8 @@ import scalatags.JsDom.all._
import scalatags.JsDom.{ TypedTag, tags }
import org.openmole.gui.client.core.files.treenodemanager.{ instance manager }
import scala.scalajs.concurrent.JSExecutionContext.Implicits.runNow
import scala.concurrent.ExecutionContext.Implicits.global
import boopickle.Default._
import TreeNode._
import autowire._
import rx._
......@@ -409,8 +410,8 @@ class TreeNodePanel {
}
def timeOrSize(tn: TreeNode): String = fileToolBar.fileFilter.now.fileSorting match {
case TimeSorting CoreUtils.longTimeToString(tn.time)
case _ CoreUtils.readableByteCountAsString(tn.size)
case TimeSorting() CoreUtils.longTimeToString(tn.time)
case _ CoreUtils.readableByteCountAsString(tn.size)
}
def clearSelectionExecpt(safePath: SafePath) = {
......
......@@ -2,7 +2,8 @@ package org.openmole.gui.client.core.files
import org.openmole.gui.ext.data._
import scala.scalajs.concurrent.JSExecutionContext.Implicits.runNow
import scala.concurrent.ExecutionContext.Implicits.global
import boopickle.Default._
import autowire._
import org.openmole.gui.ext.tool.client.Utils._
import scaladget.stylesheet.{ all sheet }
......
......@@ -187,17 +187,17 @@ import org.openmole.gui.ext.data.SafePath._
sealed trait ServerFileSystemContext
object AbsoluteFileSystem extends ServerFileSystemContext
case class AbsoluteFileSystem() extends ServerFileSystemContext
object ProjectFileSystem extends ServerFileSystemContext
case class ProjectFileSystem() extends ServerFileSystemContext
object ServerFileSystemContext {
implicit val absolute: ServerFileSystemContext = AbsoluteFileSystem
implicit val project: ServerFileSystemContext = ProjectFileSystem
implicit val absolute: ServerFileSystemContext = AbsoluteFileSystem()
implicit val project: ServerFileSystemContext = ProjectFileSystem()
}
//The path it relative to the project root directory
case class SafePath(path: Seq[String]) {
case class SafePath(path: Seq[String], context: ServerFileSystemContext = ProjectFileSystem()) {
def ++(s: String) = sp(this.path :+ s)
......@@ -454,18 +454,18 @@ object FileType {
def apply(safePath: SafePath): FileType = apply(safePath.name)
def apply(fileName: String): FileType = {
if (fileName.endsWith("tar.gz.bin") || fileName.endsWith("tgz.bin")) CodeFile(UndefinedLanguage)
if (fileName.endsWith("tar.gz.bin") || fileName.endsWith("tgz.bin")) CodeFile(UndefinedLanguage())
else if (fileName.endsWith("nlogo")) CodeFile(NetLogoLanguage())
else if (fileName.endsWith("jar")) Archive(JavaLikeLanguage())
else if (fileName.endsWith("tgz") || fileName.endsWith("tar.gz")) Archive(UndefinedLanguage)
else if (fileName.endsWith("tgz") || fileName.endsWith("tar.gz")) Archive(UndefinedLanguage())
else UndefinedFileType
}
def isSupportedLanguage(fileName: String): Boolean = apply(fileName) match {
case CodeFile(_) ⇒ true
case a: Archive ⇒ a.language match {
case UndefinedLanguage ⇒ false
case _ ⇒ true
case UndefinedLanguage() ⇒ false
case _ ⇒ true
}
case _ ⇒ false
}
......@@ -501,7 +501,7 @@ case class JavaLikeLanguage() extends Language {
val taskType = ScalaTaskType()
}
object UndefinedLanguage extends Language {
case class UndefinedLanguage() extends Language {
val name = ""
val extension = ""
val taskType = UndefinedTaskType()
......@@ -633,30 +633,30 @@ case class Resources(all: Seq[Resource], implicits: Seq[Resource], number: Int)
sealed trait FirstLast
object First extends FirstLast
case class First() extends FirstLast
object Last extends FirstLast
case class Last() extends FirstLast
sealed trait ListOrdering
object Ascending extends ListOrdering
case class Ascending() extends ListOrdering
object Descending extends ListOrdering
case class Descending() extends ListOrdering
sealed trait ListSorting
object AlphaSorting extends ListSorting
case class AlphaSorting() extends ListSorting
object SizeSorting extends ListSorting
case class SizeSorting() extends ListSorting
object TimeSorting extends ListSorting
case class TimeSorting() extends ListSorting
object LevelSorting extends ListSorting
case class LevelSorting() extends ListSorting
case class ListSortingAndOrdering(fileSorting: ListSorting = AlphaSorting, fileOrdering: ListOrdering = Ascending)
case class ListSortingAndOrdering(fileSorting: ListSorting = AlphaSorting(), fileOrdering: ListOrdering = Ascending())
object ListSortingAndOrdering {
def defaultSorting = ListSortingAndOrdering(AlphaSorting, Ascending)
def defaultSorting = ListSortingAndOrdering(AlphaSorting(), Ascending())
}
object FileSizeOrdering extends Ordering[TreeNodeData] {
......@@ -688,23 +688,23 @@ object ListSorting {
implicit def sortingToOrdering(fs: ListSorting): Ordering[TreeNodeData] =
fs match {
case AlphaSorting AlphaOrdering
case SizeSorting FileSizeOrdering
case _ TimeOrdering
case AlphaSorting() AlphaOrdering
case SizeSorting() FileSizeOrdering
case _ TimeOrdering
}
}
case class FileFilter(firstLast: FirstLast = First, threshold: Option[Int] = Some(20), nameFilter: String = "", fileSorting: ListSorting = AlphaSorting) {
case class FileFilter(firstLast: FirstLast = First(), threshold: Option[Int] = Some(20), nameFilter: String = "", fileSorting: ListSorting = AlphaSorting()) {
def switchTo(newFileSorting: ListSorting) = {
val fl = {
if (fileSorting == newFileSorting) {
firstLast match {
case First Last
case _ First
case First() Last()
case _ First()
}
}
else First
else First()
}
copy(fileSorting = newFileSorting, firstLast = fl)
}
......@@ -713,7 +713,7 @@ case class FileFilter(firstLast: FirstLast = First, threshold: Option[Int] = Som
case class ListFilesData(list: Seq[TreeNodeData], nbFilesOnServer: Int)
object FileFilter {
def defaultFilter = FileFilter.this(First, Some(100), "", AlphaSorting)
def defaultFilter = FileFilter.this(First(), Some(100), "", AlphaSorting())
}
case class OMSettings(workspace: SafePath, version: String, versionName: String, buildTime: String)
......@@ -739,7 +739,7 @@ sealed trait Test {
def errorStack: Error
}
object PendingTest extends Test {
case class PendingTest() extends Test {
def passed = false
def message = "pending"
......@@ -760,7 +760,7 @@ case class PassedTest(message: String) extends Test {
object Test {
def passed(message: String = "OK") = PassedTest(message)
def pending = PendingTest
def pending = PendingTest()
def error(msg: String, err: Error) = FailedTest(msg, err)
}
......
......@@ -4,8 +4,8 @@ import org.openmole.gui.ext.data._
import org.scalajs.dom.raw._
import autowire._
import org.openmole.gui.ext.api.Api
import scala.scalajs.concurrent.JSExecutionContext.Implicits.runNow
import boopickle.Default._
import scala.concurrent.ExecutionContext.Implicits.global
/*
* Copyright (C) 29/04/15 // mathieu.leclaire@openmole.org
......
......@@ -24,7 +24,8 @@ import org.openmole.gui.ext.api.Api
import org.openmole.gui.ext.data._
import org.openmole.gui.ext.tool.client.JsRxTags._
import org.scalajs.dom.raw.HTMLInputElement
import scala.scalajs.concurrent.JSExecutionContext.Implicits.runNow
import scala.concurrent.ExecutionContext.Implicits.global
import boopickle.Default._
import autowire._
import rx._
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment