forked from rojo-rbx/rojo
PluginActions for connecting/disconnecting a session (#537)
* Create plugin action component * Add plugin action for session start/end * Add output for connection status change * Move host & port refs to App level so keybind can access them * Use passed function directly * Improve the action text clarity * Add actions for single action * Add to changelog * Explicitly return nil Co-authored-by: Lucien Greathouse <me@lpghatguy.com> * Change log level to info * Refactor startSession to contain the logic * Formatting Co-authored-by: Lucien Greathouse <me@lpghatguy.com>
This commit is contained in:
@@ -82,11 +82,6 @@ end
|
||||
|
||||
local NotConnectedPage = Roact.Component:extend("NotConnectedPage")
|
||||
|
||||
function NotConnectedPage:init()
|
||||
self.hostRef = Roact.createRef()
|
||||
self.portRef = Roact.createRef()
|
||||
end
|
||||
|
||||
function NotConnectedPage:render()
|
||||
return Roact.createFragment({
|
||||
Header = e(Header, {
|
||||
@@ -95,8 +90,8 @@ function NotConnectedPage:render()
|
||||
}),
|
||||
|
||||
AddressEntry = e(AddressEntry, {
|
||||
hostRef = self.hostRef,
|
||||
portRef = self.portRef,
|
||||
hostRef = self.props.hostRef,
|
||||
portRef = self.props.portRef,
|
||||
transparency = self.props.transparency,
|
||||
layoutOrder = 2,
|
||||
}),
|
||||
@@ -119,18 +114,7 @@ function NotConnectedPage:render()
|
||||
style = "Solid",
|
||||
transparency = self.props.transparency,
|
||||
layoutOrder = 2,
|
||||
onClick = function()
|
||||
local hostText = self.hostRef.current.Text
|
||||
local portText = self.portRef.current.Text
|
||||
|
||||
lastHost = hostText
|
||||
lastPort = portText
|
||||
|
||||
self.props.onConnect(
|
||||
#hostText > 0 and hostText or Config.defaultHost,
|
||||
#portText > 0 and portText or Config.defaultPort
|
||||
)
|
||||
end,
|
||||
onClick = self.props.onConnect,
|
||||
}),
|
||||
|
||||
Layout = e("UIListLayout", {
|
||||
@@ -156,4 +140,4 @@ function NotConnectedPage:render()
|
||||
})
|
||||
end
|
||||
|
||||
return NotConnectedPage
|
||||
return NotConnectedPage
|
||||
|
||||
Reference in New Issue
Block a user