@@ -16,7 +16,13 @@ import scala.scalajs.js
16
16
import scala .scalajs .js .{Dynamic , URIUtils }
17
17
18
18
object ElectronPlatformService extends PlatformService {
19
- override def appVersion : String = " Electron DockerUI beta"
19
+
20
+ override def appVersion : String = {
21
+ import js .Dynamic .{global => g }
22
+ val electron = g.require(" electron" )
23
+ electron.remote.app.getVersion().asInstanceOf [String ]
24
+ }
25
+
20
26
val keyStoragePrefix = " v1_"
21
27
22
28
override def osName : Future [String ] = Future .successful(" Electron Platform" )
@@ -36,15 +42,15 @@ object ElectronPlatformService extends PlatformService {
36
42
}
37
43
38
44
override def sendAppView (name : String ): Unit = {
39
- log.info( s " sendAppView: $ name" )
45
+ ElectronAnalytics .sendPageView( name)
40
46
}
41
47
42
48
override def sendEvent (category : String , action : String , label : String ): Unit = {
43
- log.info( s " sendEvent: $ category, $ action, $ label" )
49
+ ElectronAnalytics . sendEvent( category, action, label)
44
50
}
45
51
46
52
override def sendException (ex : String ): Unit = {
47
- log.info( s " sendException: $ex " )
53
+ ElectronAnalytics . sendException(ex )
48
54
}
49
55
50
56
override def buildDockerClient (con : Connection ): DockerClient = try {
@@ -62,10 +68,13 @@ object ElectronPlatformService extends PlatformService {
62
68
log.debug(s " Default docker url $DefaultDockerURL" )
63
69
DefaultDockerURL
64
70
}
71
+
72
+ override def checkIsLatestVersion (callback : (String ) => Unit ): Unit = CheckIsLatestVersion .check(callback)
65
73
}
66
74
67
75
class ElectronDockerConnection (val connection : Connection ) extends DockerConnection {
68
76
import DockerClientConfig ._
77
+
69
78
import js .JSConverters ._
70
79
71
80
val info = connection.url
@@ -82,14 +91,14 @@ class ElectronDockerConnection(val connection: Connection) extends DockerConnect
82
91
val callback : js.Function2 [js.Any , js.Dynamic , Unit ] =
83
92
(msg : js.Any , response : js.Dynamic ) => {
84
93
if (msg == null ) {
85
- log.debug(s " Processing dail response... " )
94
+ // log.debug(s"Processing dail response...")
86
95
if (dialOptions.hijack) {
87
96
processHijackResponse(onWebSocketCreated, response)
88
97
} else if (dialOptions.isStream) {
89
98
processStreamingResponse(onStreamingData, shouldAbort, response)
90
99
} else {
91
100
val responseText = js.Dynamic .global.JSON .stringify(response).asInstanceOf [String ]
92
- log.debug(s " dial response: ${responseText.take(1000 )}... " )
101
+ // log.debug(s"dial response: ${responseText.take(1000)}...")
93
102
p.success(Response (responseText, 200 ))
94
103
}
95
104
} else {
@@ -203,7 +212,6 @@ class ElectronDockerConnection(val connection: Connection) extends DockerConnect
203
212
204
213
// TODO refactor
205
214
def events (update : Seq [DockerEvent ] => Unit ): ConnectedStream = {
206
- log.info(" [dockerClient.events] start" )
207
215
val since = {
208
216
val t = new js.Date ()
209
217
t.setDate(t.getDate() - 3 ) // pull 3 days
@@ -225,7 +233,6 @@ class ElectronDockerConnection(val connection: Connection) extends DockerConnect
225
233
update(currentStream.events)
226
234
}
227
235
228
- log.info(s " [dockerClient.events] start: $eventsUrl" )
229
236
val options = new DialOptions (path = eventsUrl, method = " GET" , options = js.undefined, Map ((" 200" , true )).toJSDictionary, isStream = true )
230
237
dial(options, onStreamingData, (Unit ) => isAborted)
231
238
0 commit comments