isUsed/owner progress
This commit is contained in:
parent
950871e5e4
commit
2d3159f91a
|
@ -43,7 +43,9 @@ public class ProxyClient {
|
|||
|
||||
ControllerInfo ci = ControllerInfo.valueOf(element);
|
||||
UserDetails userDetails = UserDetails.valueOf(element);
|
||||
userLists.add(new PublicSession(userDetails, ci));
|
||||
boolean isUsed = (Boolean) element.get(IS_USED);
|
||||
String ownerName = (String) element.get(OWNER);
|
||||
userLists.add(new PublicSession(userDetails, ci, isUsed, ownerName));
|
||||
}
|
||||
|
||||
System.out.println("object=" + array);
|
||||
|
|
|
@ -6,10 +6,14 @@ import com.rusefi.server.UserDetails;
|
|||
public class PublicSession {
|
||||
private final UserDetails userDetails;
|
||||
private final ControllerInfo controllerInfo;
|
||||
private final boolean isUsed;
|
||||
private final String ownerName;
|
||||
|
||||
public PublicSession(UserDetails userDetails, ControllerInfo controllerInfo) {
|
||||
public PublicSession(UserDetails userDetails, ControllerInfo controllerInfo, boolean isUsed, String ownerName) {
|
||||
this.userDetails = userDetails;
|
||||
this.controllerInfo = controllerInfo;
|
||||
this.isUsed = isUsed;
|
||||
this.ownerName = ownerName;
|
||||
}
|
||||
|
||||
public UserDetails getUserDetails() {
|
||||
|
@ -20,11 +24,21 @@ public class PublicSession {
|
|||
return controllerInfo;
|
||||
}
|
||||
|
||||
public boolean isUsed() {
|
||||
return isUsed;
|
||||
}
|
||||
|
||||
public String getOwnerName() {
|
||||
return ownerName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PublicSession{" +
|
||||
"userDetails=" + userDetails +
|
||||
", controllerInfo=" + controllerInfo +
|
||||
", isUsed=" + isUsed +
|
||||
", ownerName='" + ownerName + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,23 +110,18 @@ public class RemoteTab {
|
|||
|
||||
userPanel.add(new URLLabel(SignatureHelper.getUrl(controllerInfo.getSignature())));
|
||||
|
||||
if (publicSession.isUsed()) {
|
||||
userPanel.add(new JLabel(" used by " + publicSession.getOwnerName()));
|
||||
} else {
|
||||
JButton connect = new JButton("Connect");
|
||||
connect.addActionListener(event -> {
|
||||
|
||||
JButton connect = new JButton("Connect");
|
||||
connect.addActionListener(event -> {
|
||||
setStatus("Connecting to " + publicSession.getUserDetails().getUserName());
|
||||
|
||||
setStatus("Connecting to " + publicSession.getUserDetails().getUserName());
|
||||
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
runAuthenticator(publicSession, controllerInfo);
|
||||
|
||||
}
|
||||
}, "Authenticator").start();
|
||||
|
||||
|
||||
});
|
||||
userPanel.add(connect);
|
||||
new Thread(() -> runAuthenticator(publicSession, controllerInfo), "Authenticator").start();
|
||||
});
|
||||
userPanel.add(connect);
|
||||
}
|
||||
|
||||
return userPanel;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="RemoteTabSandbox" type="Application" factoryName="Application" nameIsGenerated="true">
|
||||
<configuration default="false" name="RemoteTabSandbox local" type="Application" factoryName="Application">
|
||||
<option name="MAIN_CLASS_NAME" value="com.rusefi.ts_plugin.RemoteTabSandbox" />
|
||||
<module name="ts_plugin" />
|
||||
<option name="VM_PARAMETERS" value="-DRUSEFI_PROXY_URL=localhost -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog -Dorg.apache.commons.logging.simplelog.showdatetime=true -Dorg.apache.commons.logging.simplelog.log.org.apache.http=DEBUG -Dorg.apache.commons.logging.simplelog.log.org.apache.http.wire=ERROR" />
|
|
@ -0,0 +1,16 @@
|
|||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="RemoteTabSandbox real" type="Application" factoryName="Application">
|
||||
<option name="MAIN_CLASS_NAME" value="com.rusefi.ts_plugin.RemoteTabSandbox" />
|
||||
<module name="ts_plugin" />
|
||||
<option name="VM_PARAMETERS" value="-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog -Dorg.apache.commons.logging.simplelog.showdatetime=true -Dorg.apache.commons.logging.simplelog.log.org.apache.http=DEBUG -Dorg.apache.commons.logging.simplelog.log.org.apache.http.wire=ERROR" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="com.rusefi.ts_plugin.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
Loading…
Reference in New Issue