auth token setting UI
This commit is contained in:
parent
5d6e715b05
commit
e4f6d10188
|
@ -11,10 +11,7 @@ import com.rusefi.io.serial.BaudRateHolder;
|
||||||
import com.rusefi.maintenance.FirmwareFlasher;
|
import com.rusefi.maintenance.FirmwareFlasher;
|
||||||
import com.rusefi.maintenance.VersionChecker;
|
import com.rusefi.maintenance.VersionChecker;
|
||||||
import com.rusefi.tools.ConsoleTools;
|
import com.rusefi.tools.ConsoleTools;
|
||||||
import com.rusefi.ui.FormulasPane;
|
import com.rusefi.ui.*;
|
||||||
import com.rusefi.ui.GaugesPanel;
|
|
||||||
import com.rusefi.ui.MessagesPane;
|
|
||||||
import com.rusefi.ui.SensorsLiveDataPane;
|
|
||||||
import com.rusefi.ui.console.MainFrame;
|
import com.rusefi.ui.console.MainFrame;
|
||||||
import com.rusefi.ui.console.TabbedPanel;
|
import com.rusefi.ui.console.TabbedPanel;
|
||||||
import com.rusefi.ui.engine.EngineSnifferPanel;
|
import com.rusefi.ui.engine.EngineSnifferPanel;
|
||||||
|
@ -45,7 +42,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
|
||||||
* @see EngineSnifferPanel
|
* @see EngineSnifferPanel
|
||||||
*/
|
*/
|
||||||
public class Launcher {
|
public class Launcher {
|
||||||
public static final int CONSOLE_VERSION = 20200516;
|
public static final int CONSOLE_VERSION = 20200520;
|
||||||
public static final String INI_FILE_PATH = System.getProperty("ini_file_path", "..");
|
public static final String INI_FILE_PATH = System.getProperty("ini_file_path", "..");
|
||||||
public static final String INPUT_FILES_PATH = System.getProperty("input_files_path", "..");
|
public static final String INPUT_FILES_PATH = System.getProperty("input_files_path", "..");
|
||||||
public static final String TOOLS_PATH = System.getProperty("tools_path", ".");
|
public static final String TOOLS_PATH = System.getProperty("tools_path", ".");
|
||||||
|
@ -148,6 +145,9 @@ public class Launcher {
|
||||||
tabbedPane.addTab("Trigger Shape", new AverageAnglePanel().getPanel());
|
tabbedPane.addTab("Trigger Shape", new AverageAnglePanel().getPanel());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tabbedPane.addTab("rusEFI Online", new OnlineTab().getContent());
|
||||||
|
|
||||||
|
|
||||||
if (!LinkManager.isLogViewerMode(port)) {
|
if (!LinkManager.isLogViewerMode(port)) {
|
||||||
int selectedIndex = getConfig().getRoot().getIntProperty(TAB_INDEX, DEFAULT_TAB_INDEX);
|
int selectedIndex = getConfig().getRoot().getIntProperty(TAB_INDEX, DEFAULT_TAB_INDEX);
|
||||||
if (selectedIndex < tabbedPane.tabbedPane.getTabCount())
|
if (selectedIndex < tabbedPane.tabbedPane.getTabCount())
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.rusefi.ui;
|
||||||
|
|
||||||
|
import org.putgemin.VerticalFlowLayout;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
|
||||||
|
import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
|
||||||
|
|
||||||
|
public class OnlineTab {
|
||||||
|
private static final String AUTH_TOKEN = "auth_token";
|
||||||
|
|
||||||
|
private final JPanel content = new JPanel(new VerticalFlowLayout());
|
||||||
|
|
||||||
|
public OnlineTab() {
|
||||||
|
JTextField textField = new JTextField();
|
||||||
|
textField.setPreferredSize(new Dimension(200, 24));
|
||||||
|
|
||||||
|
textField.setText(getConfig().getRoot().getProperty(AUTH_TOKEN));
|
||||||
|
|
||||||
|
content.add(textField);
|
||||||
|
|
||||||
|
JButton save = new JButton("Save");
|
||||||
|
save.addActionListener(new AbstractAction() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
getConfig().getRoot().setProperty(AUTH_TOKEN, textField.getText());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
content.add(save);
|
||||||
|
}
|
||||||
|
|
||||||
|
public JPanel getContent() {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue