Commit 3d85ce54 authored by Mathieu's avatar Mathieu
Browse files

Fix plugin construction

parent 5813b15b
Pipeline #621 failed with stage
in 4 minutes and 42 seconds
......@@ -705,7 +705,7 @@ lazy val guiEnvironmentSSHLoginPlugin = OsgiProject(guiPluginDir, "org.openmole.
Libraries.bootstrapnative
) dependsOn(extPluginGUIServer, extClientTool, dataGUI, workspace, ssh) enablePlugins (ScalaJSPlugin)
lazy val netlogoWizardPlugin = OsgiProject(guiPluginDir, "org.openmole.gui.plugin.wizard.netlogo", imports = Seq("!org.scalajs.*", "!rx.*", "!scaladget.*", "*")) settings(
lazy val netlogoWizardPlugin = OsgiProject(guiPluginDir, "org.openmole.gui.plugin.wizard.netlogo") settings(
guiPluginSettings,
libraryDependencies += Libraries.equinoxOSGi
) dependsOn(extPluginGUIServer, extClientTool, extServerTool, workspace) enablePlugins (ScalaJSPlugin)
......
package org.openmole.gui.client.core
import org.openmole.gui.ext.api.Api
import org.openmole.gui.ext.data.{ AllPluginExtensionData, AuthenticationPluginFactory, WizardPluginFactory }
import org.openmole.gui.ext.data.{ AllPluginExtensionData, AuthenticationPluginFactory, GUIPluginFactory, WizardPluginFactory }
import autowire._
import scala.concurrent.ExecutionContext.Implicits.global
......@@ -9,6 +9,7 @@ import boopickle.Default._
import rx._
import scala.scalajs.js
import scala.scalajs.js.annotation.JSExportTopLevel
/*
* Copyright (C) 30/11/16 // mathieu.leclaire@openmole.org
*
......@@ -33,18 +34,14 @@ object Plugins {
def fetch(f: AllPluginExtensionData Unit) = {
post()[Api].getGUIPlugins.call().foreach { p
authenticationFactories() = p.authentications.map { gp Plugins.buildJSObject(gp.jsObject).asInstanceOf[AuthenticationPluginFactory] }
authenticationFactories() = p.authentications.map { gp
Plugins.buildJSObject(gp.jsObject).asInstanceOf[AuthenticationPluginFactory]
}
wizardFactories() = p.wizards.map { gp Plugins.buildJSObject(gp.jsObject).asInstanceOf[WizardPluginFactory] }
f(p)
}
}
def buildJSObject(obj: String) = {
scalajs.js.eval(s"new $obj")
scalajs.js.eval(s"${obj.split('.').takeRight(2).head}")
}
// def buildAndLoad = post()[Api].loadPlugins().call.foreach { _ ⇒
// org.scalajs.dom.document.location.reload(true)
//
// }
}
......@@ -118,10 +118,12 @@ object ScriptClient {
def run(): Unit = {
implicit val ctx: Ctx.Owner = Ctx.Owner.safe()
println("RUM")
Plugins.fetch { _
val maindiv = div()
// val settingsView = new SettingsView
println("in FETECH")
val authenticationPanel = new AuthenticationPanel
val openFileTree = Var(true)
......@@ -215,6 +217,7 @@ object ScriptClient {
// Define the option sequence
println("BEFOR SETTINGS")
Settings.settings.map { sets
dom.document.body.appendChild(
div(
......
......@@ -17,12 +17,14 @@ package org.openmole.gui.ext.tool.client
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import org.openmole.gui.ext.data.GUIPluginFactory
import org.scalajs.dom.raw.{ Event, HTMLElement }
import scalatags.JsDom.all._
import rx._
import scalatags.JsDom.TypedTag
import scaladget.tools._
import scala.scalajs.js
import scala.scalajs.js.Date
object Utils {
......@@ -47,4 +49,8 @@ object Utils {
}
}
def toJSObject(pluginFactory: GUIPluginFactory) = new js.Object {
val factory = pluginFactory
}
}
......@@ -18,24 +18,21 @@
package org.openmole.gui.plugin.authentication.desktopgrid
import scala.concurrent.ExecutionContext.Implicits.global
import boopickle.Default._
import org.openmole.gui.ext.data.{ AuthenticationPlugin, AuthenticationPluginFactory }
import org.openmole.gui.ext.data.{AuthenticationPlugin, AuthenticationPluginFactory}
import org.openmole.gui.ext.tool.client.OMPost
import scaladget.bootstrapnative.bsn._
import scaladget.tools._
import autowire._
import sheet._
import bs._
import org.scalajs.dom.raw.HTMLElement
import org.openmole.gui.ext.data._
import scala.concurrent.Future
import scala.scalajs.js.annotation._
import scalatags.JsDom.TypedTag
import scalatags.JsDom.all._
@JSExportTopLevel("DesktopGridAuthenticationFactory")
object TopLevelExports {
@JSExportTopLevel("desktopgrid")
val desktopgrid = js.Object {
new org.openmole.gui.plugin.authentication.desktopgrid.DesktopGridAuthenticationFactory
}
}
class DesktopGridAuthenticationFactory extends AuthenticationPluginFactory {
type AuthType = DesktopGridAuthenticationData
......@@ -48,7 +45,6 @@ class DesktopGridAuthenticationFactory extends AuthenticationPluginFactory {
def getData: Future[Seq[AuthType]] = OMPost()[DesktopGridAuthenticationAPI].desktopGridAuthentications().call()
}
@JSExportTopLevel("DesktopGridAuthenticationGUI")
class DesktopGridAuthenticationGUI(val data: DesktopGridAuthenticationData = DesktopGridAuthenticationData()) extends AuthenticationPlugin {
type AuthType = DesktopGridAuthenticationData
......
......@@ -20,9 +20,7 @@ package org.openmole.gui.plugin.authentication.egi
import scala.concurrent.ExecutionContext.Implicits.global
import org.openmole.gui.ext.data.{ AuthenticationPlugin, AuthenticationPluginFactory }
import org.openmole.gui.ext.tool.client.{ FileUploaderUI, OMPost }
import scaladget.bootstrapnative.bsn._
import boopickle.Default._
import autowire._
......@@ -30,7 +28,15 @@ import scala.concurrent.Future
import scala.scalajs.js.annotation._
import scalatags.JsDom.all._
@JSExportTopLevel("EGIAuthenticationGUIFactory")
import scala.scalajs.js
object TopLevelExports {
@JSExportTopLevel("egi")
val egi = js.Object {
new org.openmole.gui.plugin.authentication.egi.EGIAuthenticationGUIFactory
}
}
class EGIAuthenticationGUIFactory extends AuthenticationPluginFactory {
type AuthType = EGIAuthenticationData
......@@ -43,7 +49,6 @@ class EGIAuthenticationGUIFactory extends AuthenticationPluginFactory {
def getData: Future[Seq[AuthType]] = OMPost()[EGIAuthenticationAPI].egiAuthentications().call()
}
@JSExportTopLevel("EGIAuthenticationGUI")
class EGIAuthenticationGUI(val data: EGIAuthenticationData = EGIAuthenticationData()) extends AuthenticationPlugin {
type AuthType = EGIAuthenticationData
......
......@@ -21,17 +21,23 @@ import scala.concurrent.ExecutionContext.Implicits.global
import boopickle.Default._
import org.openmole.gui.ext.data.{ AuthenticationPlugin, AuthenticationPluginFactory }
import org.openmole.gui.ext.tool.client.{ FileUploaderUI, OMPost }
import scaladget.bootstrapnative.bsn._
import scaladget.tools._
import autowire._
import scala.concurrent.Future
import scala.scalajs.js.annotation._
import scalatags.JsDom.all._
@JSExportTopLevel("PrivateKeyAuthenticationFactory")
import scala.scalajs.js
object TopLevelExports {
@JSExportTopLevel("sshkey")
val sshkey = js.Object {
new org.openmole.gui.plugin.authentication.sshkey.PrivateKeyAuthenticationFactory
}
}
class PrivateKeyAuthenticationFactory extends AuthenticationPluginFactory {
type AuthType = PrivateKeyAuthenticationData
......@@ -44,7 +50,6 @@ class PrivateKeyAuthenticationFactory extends AuthenticationPluginFactory {
def getData: Future[Seq[AuthType]] = OMPost()[PrivateKeyAuthenticationAPI].privateKeyAuthentications().call()
}
@JSExportTopLevel("PrivateKeyAuthenticationGUI")
class PrivateKeyAuthenticationGUI(val data: PrivateKeyAuthenticationData = PrivateKeyAuthenticationData()) extends AuthenticationPlugin {
type AuthType = PrivateKeyAuthenticationData
......
......@@ -23,18 +23,24 @@ import org.openmole.gui.ext.data.{ AuthenticationPlugin, AuthenticationPluginFac
import org.openmole.gui.ext.tool.client.OMPost
import scaladget.bootstrapnative.bsn._
import scaladget.tools._
import autowire._
import org.scalajs.dom.raw.HTMLElement
import org.openmole.gui.ext.data._
import org.openmole.gui.ext.tool.client
import scala.concurrent.Future
import scala.scalajs.js.annotation._
import scalatags.JsDom.TypedTag
import scalatags.JsDom.all._
import scalajs.js
object TopLevelExports {
@JSExportTopLevel("sshlogin")
val sshlogin = js.Object {
new org.openmole.gui.plugin.authentication.sshlogin.LoginAuthenticationFactory
}
}
@JSExportTopLevel("LoginAuthenticationFactory")
class LoginAuthenticationFactory extends AuthenticationPluginFactory {
type AuthType = LoginAuthenticationData
......@@ -47,7 +53,6 @@ class LoginAuthenticationFactory extends AuthenticationPluginFactory {
def getData: Future[Seq[AuthType]] = OMPost()[LoginAuthenticationAPI].loginAuthentications().call()
}
@JSExportTopLevel("LoginAuthenticationGUI")
class LoginAuthenticationGUI(val data: LoginAuthenticationData = LoginAuthenticationData()) extends AuthenticationPlugin {
type AuthType = LoginAuthenticationData
......
......@@ -35,8 +35,15 @@ import org.openmole.gui.ext.api.Api
import org.openmole.gui.ext.data.DataUtils._
import org.openmole.gui.ext.tool.client
import rx._
import scalajs.js
object TopLevelExports {
@JSExportTopLevel("jar")
val jar = js.Object {
new org.openmole.gui.plugin.wizard.jar.JarWizardFactory
}
}
@JSExportTopLevel("JarWizardFactory")
class JarWizardFactory extends WizardPluginFactory {
type WizardType = JarWizardData
......@@ -49,7 +56,6 @@ class JarWizardFactory extends WizardPluginFactory {
def name: String = "Jar"
}
@JSExportTopLevel("JarWizardGUI")
class JarWizardGUI(safePath: SafePath, onMethodSelected: (LaunchingCommand) Unit) extends WizardGUIPlugin {
type WizardType = JarWizardData
......
......@@ -30,7 +30,15 @@ import scalatags.JsDom.TypedTag
import scalatags.JsDom.all._
import rx._
@JSExportTopLevel("NativeWizardFactory")
import scala.scalajs.js
object TopLevelExports {
@JSExportTopLevel("native")
val native = js.Object {
new org.openmole.gui.plugin.wizard.native.NativeWizardFactory
}
}
class NativeWizardFactory extends WizardPluginFactory {
val fileType = CareArchive
......@@ -43,7 +51,6 @@ class NativeWizardFactory extends WizardPluginFactory {
case class NativeWizardData() extends WizardData
@JSExportTopLevel("NativeWizardGUI")
class NativeWizardGUI extends WizardGUIPlugin {
type WizardType = NativeWizardData
......
......@@ -26,14 +26,21 @@ import scaladget.tools._
import autowire._
import org.openmole.gui.ext.tool.client
import org.scalajs.dom.raw.HTMLElement
import scaladget.bootstrapnative.{ SelectableButtons, ToggleButton }
import scaladget.bootstrapnative.{ ToggleButton }
import scala.concurrent.Future
import scala.scalajs.js.annotation._
import scalatags.JsDom.TypedTag
import scalatags.JsDom.all._
import scala.scalajs.js
object TopLevelExports {
@JSExportTopLevel("netlogo")
val netlogo = js.Object {
new org.openmole.gui.plugin.wizard.netlogo.NetlogoWizardFactory
}
}
@JSExportTopLevel("NetlogoWizardFactory")
class NetlogoWizardFactory extends WizardPluginFactory {
type WizardType = NetlogoWizardData
......@@ -48,7 +55,6 @@ class NetlogoWizardFactory extends WizardPluginFactory {
def name: String = "NetLogo"
}
@JSExportTopLevel("NetlogoWizardGUI")
class NetlogoWizardGUI extends WizardGUIPlugin {
type WizardType = NetlogoWizardData
......
......@@ -32,7 +32,15 @@ import scala.scalajs.js.annotation._
import scalatags.JsDom.TypedTag
import scalatags.JsDom.all._
@JSExportTopLevel("RWizardFactory")
import scala.scalajs.js
object TopLevelExports {
@JSExportTopLevel("r")
val r = js.Object {
new org.openmole.gui.plugin.wizard.r.RWizardFactory
}
}
class RWizardFactory extends WizardPluginFactory {
val fileType = CodeFile(RLanguage())
......@@ -45,7 +53,6 @@ class RWizardFactory extends WizardPluginFactory {
case class RWizardData() extends WizardData
@JSExportTopLevel("RWizardGUI")
class RWizardGUI extends WizardGUIPlugin {
def factory = new RWizardFactory
......
......@@ -341,8 +341,6 @@ object Utils extends JavaLogger {
def update = {
logger.info("Building GUI plugins ...")
jsFile.delete
println("jsPlugin directory " + jsPluginDirectory.getAbsolutePath)
println("js file " + jsFile.getAbsolutePath)
JSPack.link(jsPluginDirectory, jsFile, optimizedJS)
}
......
......@@ -51,7 +51,7 @@ object JSPack {
linker = StandardImpl.linker(config)
_ linker.link(sjsirFiles, Nil, LinkerOutput(PathOutputFile(outputJSFile.toPath)), NullLogger)
} yield () )
} yield ())
Await.result(result, Duration.Inf)
}
......
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