Skip to content

Commit 2555d54

Browse files
committed
Revert "IPTE-165: ON-OFF API Status"
This reverts commit 49630a3.
1 parent 49630a3 commit 2555d54

File tree

2 files changed

+8
-57
lines changed

2 files changed

+8
-57
lines changed

src/main/java/de/doubleslash/keeptime/view/SettingsController.java

Lines changed: 3 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package de.doubleslash.keeptime.view;
1818

1919
import java.io.File;
20-
import java.io.FileInputStream;
2120
import java.io.FileOutputStream;
2221
import java.io.IOException;
2322
import java.io.InputStream;
@@ -167,7 +166,7 @@ public class SettingsController {
167166
private TextField authName;
168167

169168
@FXML
170-
private PasswordField authPassword;
169+
private PasswordField authPassword1;
171170

172171
private ToggleGroup toggleGroup;
173172

@@ -186,15 +185,6 @@ public class SettingsController {
186185
@FXML
187186
private TextField authPort;
188187

189-
@FXML
190-
private Label labelPassword;
191-
192-
@FXML
193-
private Label labelPort;
194-
195-
@FXML
196-
private Label labelUsername;
197-
198188
private String propertiesFilePath = "application.properties";
199189

200190
private static final String GITHUB_PAGE = "https://www.github.com/doubleSlashde/KeepTime";
@@ -256,41 +246,8 @@ private void initialize() {
256246
radioApiOff.setToggleGroup(toggleGroup);
257247
radioApiOn.setToggleGroup(toggleGroup);
258248

259-
Properties properties = new Properties();
260-
User user;
261-
try (FileInputStream input = new FileInputStream(propertiesFilePath)) {
262-
properties.load(input);
263-
String apistatus = properties.getProperty("api");
264-
System.err.println(apistatus);
265-
266-
if (apistatus.equals("ON")) {
267-
radioApiOn.setSelected(true);
268-
radioApiOff.setSelected(false);
269-
authPort.setText(properties.getProperty("server.port"));
270-
authName.setText(properties.getProperty("authUsername"));
271-
// labelPort.setDisable(false);
272-
// labelUsername.setDisable(false);
273-
// labelPassword.setDisable(false);
274-
// authPort.setDisable(false);
275-
// authName.setDisable(false);
276-
// authPassword.setDisable(false);
277-
System.err.println("--------");
278-
} else if (apistatus.equals("OFF")) {
279-
radioApiOn.setSelected(false);
280-
radioApiOff.setSelected(true);
281-
// labelPort.setDisable(true);
282-
// labelUsername.setDisable(true);
283-
// labelPassword.setDisable(true);
284-
// authPort.setDisable(true);
285-
// authName.setDisable(true);
286-
// authPassword.setDisable(true);
287-
System.err.println("+++++++++");
288-
}
289-
} catch (IOException e) {
290-
e.printStackTrace();
291-
}
292-
293249
LOG.debug("saveButton.setOnAction");
250+
294251
saveButton.setOnAction(ae -> {
295252
LOG.info("Save clicked");
296253

@@ -629,24 +586,18 @@ private void showLicense(final Licenses license) {
629586
}
630587

631588
private void handleApiOff() {
632-
Map<String, String> propertiesToUpdate = new HashMap<>();
633589
setWebApplicationType("none");
634-
propertiesToUpdate.put("api", "OFF");
635-
propertyWrite(propertiesToUpdate);
636-
637590
}
638591

639592
private void handleApiOn() {
640593
username = authName.getText();
641-
password = authPassword.getText();
594+
password = authPassword1.getText();
642595

643596
createAndSaveUser(username, password);
644597

645598
Map<String, String> propertiesToUpdate = new HashMap<>();
646599
propertiesToUpdate.put("spring.main.web-application-type", "");
647600
propertiesToUpdate.put("server.port", authPort.getText());
648-
propertiesToUpdate.put("api", "ON");
649-
propertiesToUpdate.put("authUsername", username);
650601

651602
propertyWrite(propertiesToUpdate);
652603
}

src/main/resources/layouts/settings.fxml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -372,24 +372,24 @@
372372
<content>
373373
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="420.0" prefWidth="407.0">
374374
<children>
375-
<Label fx:id="labelUsername" layoutX="24.0" layoutY="169.0" text="Username:" />
375+
<Label layoutX="24.0" layoutY="169.0" text="Username:" />
376376
<Label layoutX="14.0" layoutY="14.0" prefHeight="28.0" prefWidth="279.0" text="Rest API Authentication">
377377
<font>
378378
<Font name="System Bold" size="13.0" />
379379
</font>
380380
</Label>
381-
<Label fx:id="labelPassword" layoutX="24.0" layoutY="219.0" text="Password:" />
382-
<TextField fx:id="authName" layoutX="97.0" layoutY="166.0" prefHeight="26.0" prefWidth="298.0" />
381+
<Label layoutX="24.0" layoutY="219.0" text="Password:" />
382+
<TextField fx:id="authName" layoutX="97.0" layoutY="166.0" prefHeight="26.0" prefWidth="298.0" promptText="User" />
383383
<Label layoutX="24.0" layoutY="70.0" text="Auth" />
384-
<Label fx:id="labelPort" layoutX="26.0" layoutY="124.0" text="Port:" />
384+
<Label layoutX="26.0" layoutY="124.0" text="Port:" />
385385
<TextField fx:id="authPort" layoutX="97.0" layoutY="120.0" prefHeight="26.0" prefWidth="298.0" promptText="8080" />
386386
<RadioButton fx:id="radioApiOn" layoutX="88.0" layoutY="64.0" mnemonicParsing="false" text="ON">
387387
<toggleGroup>
388388
<ToggleGroup fx:id="authAPI" />
389389
</toggleGroup>
390390
</RadioButton>
391391
<RadioButton fx:id="radioApiOff" layoutX="219.0" layoutY="64.0" mnemonicParsing="false" text="OFF" toggleGroup="$authAPI" />
392-
<PasswordField fx:id="authPassword" layoutX="97.0" layoutY="215.0" prefHeight="26.0" prefWidth="298.0" />
392+
<PasswordField fx:id="authPassword1" layoutX="97.0" layoutY="215.0" prefHeight="26.0" prefWidth="298.0" />
393393
</children></AnchorPane>
394394
</content>
395395
<graphic>

0 commit comments

Comments
 (0)