Commit 7fef0c21 authored by Mathieu Leclaire's avatar Mathieu Leclaire
Browse files

[GUI] Try with separate projects for plugins

parent cec54c8b
import org.openmole.buildsystem._
import OMKeys._
......@@ -444,6 +441,7 @@ lazy val client = Project("org-openmole-rest-client", restDir / "client") settin
def guiDir = file("gui")
def guiExt = guiDir / "ext"
def guiExtTarget = guiExt / "target"
def guiProvidedScope =
Osgi.openMOLEScope += "gui-provided"
......@@ -455,43 +453,57 @@ lazy val dataGUI = OsgiProject(guiExt, "org.openmole.gui.ext.data") enablePlugin
Libraries.scalajsDomJS,
Libraries.upickleJS,
guiProvidedScope
) settings (defaultSettings: _*)
) settings (defaultSettings: _*)
lazy val extTool = OsgiProject(guiExt, "org.openmole.gui.ext.tool") enablePlugins (ScalaJSPlugin) settings(
lazy val extServerTool = OsgiProject(guiExt, "org.openmole.gui.ext.tool.server") enablePlugins (ScalaJSPlugin) dependsOn (dataGUI) settings(
libraryDependencies += Libraries.autowire,
libraryDependencies += Libraries.upickle,
Libraries.scalajsDomJS
libraryDependencies += Libraries.upickle
) settings (defaultSettings: _*)
lazy val extPluginGUI = OsgiProject(guiExt, "org.openmole.gui.ext.plugin") enablePlugins (ScalaJSPlugin) dependsOn (extTool) settings(
lazy val extClientTool = OsgiProject(guiExt, "org.openmole.gui.ext.tool.client") enablePlugins (ScalaJSPlugin) settings(
Libraries.upickleJS,
Libraries.autowireJS,
Libraries.rxJS,
Libraries.scalajsDomJS,
Libraries.scaladgetJS,
Libraries.scalaTagsJS,
libraryDependencies += Libraries.equinoxOSGi,
guiProvidedScope) settings (defaultSettings: _*)
Libraries.scalaTagsJS
) settings (defaultSettings: _*)
//lazy val extPluginGUIClient = OsgiProject(guiExtTarget, "org.openmole.gui.ext.plugin.client",
// privatePackages = Seq("autowire.*", "upickle.*", "rx.*", "org.scalajs.dom.*", "scalatags.*", "fr.iscpif.scaladget.*")) enablePlugins (ScalaJSPlugin) settings(
// Libraries.upickleJS,
// Libraries.autowireJS,
// Libraries.rxJS,
// Libraries.scalajsDomJS,
// Libraries.scaladgetJS,
// Libraries.scalaTagsJS,
// libraryDependencies += Libraries.equinoxOSGi) dependsOn(extClientTool) settings (defaultSettings: _*)
lazy val extPluginGUIServer = OsgiProject(guiExt, "org.openmole.gui.ext.plugin.server") dependsOn (extServerTool) settings(
libraryDependencies += Libraries.rx,
libraryDependencies += Libraries.equinoxOSGi) settings (defaultSettings: _*)
lazy val sharedGUI = OsgiProject(guiExt, "org.openmole.gui.ext.api") dependsOn(dataGUI, market) settings (defaultSettings: _*) settings (guiProvidedScope)
val jqueryPath = s"META-INF/resources/webjars/jquery/${Libraries.jqueryVersion}/jquery.js"
val acePath = s"META-INF/resources/webjars/ace/${Libraries.aceVersion}/src-min/ace.js"
lazy val jsCompile = OsgiProject(guiServerDir, "org.openmole.gui.server.jscompile", imports = Seq("*")) dependsOn(pluginManager, fileService, workspace, extPluginGUI) settings (defaultSettings: _*) settings(
lazy val jsCompile = OsgiProject(guiServerDir, "org.openmole.gui.server.jscompile", imports = Seq("*")) dependsOn(pluginManager, fileService, workspace, dataGUI) settings (defaultSettings: _*) settings(
libraryDependencies += "org.scala-js" %% "scalajs-library" % Libraries.scalajsVersion % "provided" intransitive(),
libraryDependencies += Libraries.scalajsTools,
(resourceDirectories in Compile) += (crossTarget.value / "resources"),
(OsgiKeys.embeddedJars) := {
val scalaLib =
(Keys.externalDependencyClasspath in Compile).value.filter {
d => d.data.getName startsWith "scalajs-library"
}.head
val dest = crossTarget.value / "resources/scalajs-library.jar"
dest.getParentFile.mkdirs()
sbt.IO.copyFile(scalaLib.data, dest)
Seq()
val scalaLib =
(Keys.externalDependencyClasspath in Compile).value.filter {
d => d.data.getName startsWith "scalajs-library"
}.head
val dest = crossTarget.value / "resources/scalajs-library.jar"
dest.getParentFile.mkdirs()
sbt.IO.copyFile(scalaLib.data, dest)
Seq()
},
guiProvidedScope)
......@@ -500,13 +512,7 @@ lazy val jsCompile = OsgiProject(guiServerDir, "org.openmole.gui.server.jscompil
def guiClientDir = guiDir / "client"
lazy val clientGUI = OsgiProject(guiClientDir, "org.openmole.gui.client.core") enablePlugins (ScalaJSPlugin) dependsOn
(sharedGUI, clientToolGUI, market, extPluginGUI) settings(
Libraries.upickleJS,
Libraries.autowireJS,
Libraries.rxJS,
Libraries.scalajsDomJS,
Libraries.scaladgetJS,
Libraries.scalaTagsJS,
(sharedGUI, clientToolGUI, market, dataGUI, extClientTool) settings(
libraryDependencies += Libraries.async,
skip in packageJSDependencies := false,
jsDependencies += Libraries.jquery / jqueryPath minified jqueryPath.replace(".js", ".min.js"),
......@@ -552,8 +558,8 @@ lazy val serverGUI = OsgiProject(guiServerDir, "org.openmole.gui.server.core") s
openmoleCrypto,
module,
market,
extPluginGUI,
extTool,
extServerTool,
extPluginGUIServer,
jsCompile
) settings (defaultSettings: _*)
......@@ -563,15 +569,29 @@ lazy val state = OsgiProject(guiServerDir, "org.openmole.gui.server.state") sett
/* -------------------- GUI Plugin ----------------------- */
def guiPlugins = Seq(guiPluginEnvironmentEGI)
def guiPluginSettings = defaultSettings ++ Seq(defaultActivator)
def guiPluginDir = guiDir / "plugins"
lazy val guiPluginEnvironmentEGI =
OsgiProject(guiPluginDir, "org.openmole.gui.plugin.environment.egi") enablePlugins (ScalaJSPlugin) dependsOn (extPluginGUI) settings (defaultActivator)
lazy val clientPluginSettings = Seq(
Libraries.upickleJS,
Libraries.autowireJS,
Libraries.rxJS,
Libraries.scalajsDomJS,
Libraries.scaladgetJS,
Libraries.scalaTagsJS,
Libraries.sourcecodeJS,
libraryDependencies += Libraries.equinoxOSGi)
lazy val clientPrivatePackages = Seq("autowire.*", "upickle/js.*", "sourcecode.*", "rx.*", "org.scalajs.dom.*", "scalatags.*", "fr.iscpif.scaladget.*")
lazy val sshared = OsgiProject(guiPluginDir, "org.openmole.gui.plugin.environment.egi.shared")
lazy val sserver = OsgiProject(guiPluginDir, "org.openmole.gui.plugin.environment.egi.server") dependsOn(extPluginGUIServer, dataGUI, sshared) settings (defaultActivator)
lazy val cclient = OsgiProject(guiPluginDir, "org.openmole.gui.plugin.environment.egi.client", privatePackages = clientPrivatePackages) enablePlugins (ScalaJSPlugin) dependsOn(dataGUI, extClientTool,sshared) settings (clientPluginSettings)
lazy val guiPluginEnvironmentEGI = Seq(sshared, sserver, cclient)
val guiPlugins = Seq(sserver, cclient)
/* -------------------- Bin ------------------------- */
......
......@@ -10,7 +10,7 @@ import scala.concurrent.Future
import scala.scalajs.concurrent.JSExecutionContext.Implicits.runNow
import org.openmole.gui.client.core.files.treenodemanager.{ instance manager }
import org.openmole.gui.ext.api.Api
import org.openmole.gui.ext.tool.OMPost
import org.openmole.gui.ext.tool.client.OMPost
import scalatags.JsDom.all._
......
......@@ -35,7 +35,7 @@ import rx._
import bs._
import org.openmole.gui.client.core.authentications._
import org.openmole.gui.ext.api.Api
import org.openmole.gui.ext.tool.OMPost
import org.openmole.gui.ext.tool.client.OMPost
import scalatags.JsDom
......
......@@ -41,7 +41,7 @@ import org.openmole.gui.ext.data._
import bs._
import org.openmole.gui.client.tool.{ Expander, Utils }
import org.openmole.gui.ext.api.Api
import org.openmole.gui.ext.tool.OMPost
import org.openmole.gui.ext.tool.client.OMPost
import rx._
import concurrent.duration._
......
......@@ -27,7 +27,7 @@ import rx._
import scala.scalajs.concurrent.JSExecutionContext.Implicits.runNow
import autowire._
import org.openmole.gui.ext.api._
import org.openmole.gui.ext.tool.OMPost
import org.openmole.gui.ext.tool.client.OMPost
import js.JSConverters._
......
......@@ -41,7 +41,7 @@ import scalatags.JsDom.all._
import bs._
import org.openmole.gui.client.tool.InputFilter
import org.openmole.gui.ext.api.Api
import org.openmole.gui.ext.tool.OMPost
import org.openmole.gui.ext.tool.client.OMPost
class MarketPanel extends ModalPanel {
lazy val modalID = "marketPanelID"
......
......@@ -44,7 +44,7 @@ import sheet._
import bs._
import org.openmole.gui.client.tool.{ OMTags, OptionsDiv }
import org.openmole.gui.ext.api.Api
import org.openmole.gui.ext.tool.OMPost
import org.openmole.gui.ext.tool.client.OMPost
class ModelWizardPanel extends ModalPanel {
implicit val ctx: Ctx.Owner = Ctx.Owner.safe()
......
......@@ -16,13 +16,8 @@ package org.openmole.gui.client.core
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import org.openmole.gui.ext.plugin.Authentication
import org.openmole.gui.ext.data.Authentication
import scala.scalajs.js
import js.annotation._
@js.native
@JSImport("js/plugins.js", "PluginMapping")
object PluginMapping extends js.Object {
def authentications(): Seq[Authentication] = js.native
trait PluginMapping {
def authentications: Seq[Authentication]
}
\ No newline at end of file
......@@ -19,7 +19,7 @@ import fr.iscpif.scaladget.stylesheet.{ all ⇒ sheet }
import org.openmole.gui.client.core.alert.AlertPanel
import org.openmole.gui.client.tool.OMTags
import org.openmole.gui.ext.api.Api
import org.openmole.gui.ext.tool.OMPost
import org.openmole.gui.ext.tool.client.OMPost
import sheet._
/*
......
package org.openmole.gui.client.core
import org.openmole.gui.ext.api.Api
import org.openmole.gui.ext.plugin.Authentication
import org.openmole.gui.ext.data.Authentication
import autowire._
import scala.scalajs.concurrent.JSExecutionContext.Implicits.runNow
......@@ -9,10 +9,9 @@ import rx._
import scalatags.JsDom.all._
import org.openmole.gui.client.tool.JsRxTags._
import org.openmole.gui.ext.tool.OMPost
import org.openmole.gui.ext.tool.client.OMPost
import scalatags.JsDom.tags
import scala.scalajs.js
import js.annotation._
......@@ -34,7 +33,13 @@ import js.annotation._
*/
object Plugins {
val authentications: Var[Seq[Authentication]] = Var(Seq())
// lazy val mapping = buildJSObject("PluginMapping").asInstanceOf[PluginMapping]
lazy val authentications: Var[Seq[Authentication]] = Var(Seq())
// private val mapping = new PluginMapping()
// println("MAPPINH " + mapping)
//def apply() = mapping
def buildJSObject(obj: String) = {
scalajs.js.eval(s"new $obj()")
......@@ -43,6 +48,7 @@ object Plugins {
def load =
OMPost()[Api].loadPlugins.call().foreach { _
org.scalajs.dom.document.location.reload(true)
// val pluginScript = script(src := "js/plugins.js").render
// pluginScript.onload = (e: Event) => {
// val apple = scalajs.js.eval("thing.ThingOps().build()")
......
......@@ -31,7 +31,7 @@ import scalatags.JsDom.all._
import scalatags.JsDom.tags
import org.openmole.gui.client.tool._
import JsRxTags._
import org.openmole.gui.ext.tool.OMPost
import org.openmole.gui.ext.tool.client.OMPost
class ResetPassword {
val shutDown = new ShutDown
......
......@@ -22,9 +22,9 @@ import autowire._
import org.openmole.gui.client.core.files.FileManager
import org.openmole.gui.client.tool.OMTags
import org.openmole.gui.ext.api.Api
import org.openmole.gui.ext.tool.client.OMPost
import org.openmole.gui.ext.data.ProcessState
import org.openmole.gui.ext.plugin.Authentication
import org.openmole.gui.ext.tool.OMPost
import org.openmole.gui.ext.data.Authentication
import org.scalajs
import org.scalajs.dom.raw.Event
......@@ -183,18 +183,30 @@ object ScriptClient {
}
body.appendChild(maindiv)
body.appendChild(bs.button("build", btn_danger +++ ms("ooo"), () Plugins.load))
body.appendChild(bs.button("call", btn_primary +++ ms("oooo"), () {
OMPost()[Api].getGUIPlugins.call().foreach { all
Plugins.authentications() = all.authentications.map { gp Plugins.buildJSObject(gp.jsObject).asInstanceOf[Authentication] }
//TODO: add right sjsir dependencies (scalatags, autowire, etc) for building plugins.js
// Plugins.load
/* OMPost()[Api].getGUIPlugins.call().foreach { all ⇒
Plugins.authentications() = all.authentications.map { gp ⇒ Plugins.buildJSObject(gp.jsObject).asInstanceOf[Authentication] }
//TEst
println("auth:" + Plugins.authentications.now)
val oo = Plugins.authentications.now.headOption.map { h
println("h " + h)
println("h " + h.panel)
println("h " + h.test)
h.panel
}.getOrElse(tags.div("Cannot load"))
//TEst
println("auth:" + Plugins.authentications.now)
// org.scalajs.dom.document.body.appendChild(Plugins.authentications.now.headOption.map { _.panel }.getOrElse(tags.div("Cannot load")).render)
Plugins.authentications.now.headOption.map { _.test }
println("OO " + oo)
}*/
org.scalajs.dom.document.body.appendChild(oo.render)
// Plugins.authentications.now.headOption.map { _.test }
}
}))
//TODO: add right sjsir dependencies (scalatags, autowire, etc) for building plugins.js
//
}
......
......@@ -21,8 +21,8 @@ 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.tool.client.OMPost
import org.openmole.gui.ext.data.OMSettings
import org.openmole.gui.ext.tool.OMPost
object Settings {
......
......@@ -14,7 +14,7 @@ import fr.iscpif.scaladget.stylesheet.{ all ⇒ sheet }
import scalatags.JsDom.tags
import AuthenticationUtils._
import org.openmole.gui.ext.api.Api
import org.openmole.gui.ext.tool.OMPost
import org.openmole.gui.ext.tool.client.OMPost
/*
* Copyright (C) 02/07/15 // mathieu.leclaire@openmole.org
......
......@@ -11,7 +11,7 @@ import scalatags.JsDom.all._
import AuthenticationUtils._
import org.openmole.gui.client.tool.Utils
import org.openmole.gui.ext.api.Api
import org.openmole.gui.ext.tool.OMPost
import org.openmole.gui.ext.tool.client.OMPost
/*
* Copyright (C) 16/06/15 // mathieu.leclaire@openmole.org
......
......@@ -10,7 +10,7 @@ import autowire._
import scalatags.JsDom.all._
import AuthenticationUtils._
import org.openmole.gui.ext.api.Api
import org.openmole.gui.ext.tool.OMPost
import org.openmole.gui.ext.tool.client.OMPost
/*
* Copyright (C) 01/07/15 // mathieu.leclaire@openmole.org
......
......@@ -9,7 +9,7 @@ import autowire._
import rx._
import org.openmole.gui.client.core.panels._
import org.openmole.gui.ext.api.Api
import org.openmole.gui.ext.tool.OMPost
import org.openmole.gui.ext.tool.client.OMPost
/*
* Copyright (C) 07/05/15 // mathieu.leclaire@openmole.org
......
......@@ -5,7 +5,7 @@ import org.scalajs.dom.raw._
import autowire._
import org.openmole.gui.client.tool.Utils
import org.openmole.gui.ext.api.Api
import org.openmole.gui.ext.tool.OMPost
import org.openmole.gui.ext.tool.client.OMPost
import org.scalajs.dom
import scala.scalajs.concurrent.JSExecutionContext.Implicits.runNow
......
......@@ -28,7 +28,7 @@ import org.openmole.gui.client.core.alert.AlertPanel
import org.openmole.gui.client.core.panels._
import org.openmole.gui.client.tool._
import org.openmole.gui.ext.api.Api
import org.openmole.gui.ext.tool.OMPost
import org.openmole.gui.ext.tool.client.OMPost
/*
* Copyright (C) 20/01/16 // mathieu.leclaire@openmole.org
......
......@@ -33,7 +33,7 @@ import rx._
import fr.iscpif.scaladget.stylesheet.{ all sheet }
import org.openmole.gui.client.tool.Utils
import org.openmole.gui.ext.api.Api
import org.openmole.gui.ext.tool.OMPost
import org.openmole.gui.ext.tool.client.OMPost
import sheet._
class AuthFileUploaderUI(
......
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