cleaner looking danger zone for app AdminTab
This commit is contained in:
parent
e556461f73
commit
80193603c6
5 changed files with 62 additions and 36 deletions
|
@ -37,6 +37,7 @@ class AcrariumCard extends PolymerElement {
|
|||
|
||||
slot[class~="divider"]::slotted(:not(:first-child)) {
|
||||
border-top: 1px solid var(--lumo-contrast-20pct);
|
||||
margin-top: 0.5em;
|
||||
}
|
||||
</style>
|
||||
<slot name="header" class="acrarium-card-header" on-click="handleClick"></slot>
|
||||
|
|
|
@ -117,8 +117,8 @@ public class Translatable<T extends Component> extends Composite<T> implements L
|
|||
return new Translatable<>(new TextArea("", initialValue, ""), textField -> textField.setLabel(textField.getTranslation(captionId, params)));
|
||||
}
|
||||
|
||||
public static <T> Translatable<ComboBox<T>> createComboBox(@NonNull Collection<T> items, @NonNull String captionId, @NonNull Object... params) {
|
||||
return new Translatable<>(new ComboBox<>("", items), tComboBox -> tComboBox.setLabel(tComboBox.getTranslation(captionId, params)));
|
||||
public static <T> Translatable.Value<ComboBox<T>, T> createComboBox(@NonNull Collection<T> items, @NonNull String captionId, @NonNull Object... params) {
|
||||
return new Translatable.Value<>(new ComboBox<>("", items), tComboBox -> tComboBox.setLabel(tComboBox.getTranslation(captionId, params)));
|
||||
}
|
||||
|
||||
public static <T> Translatable<Select<T>> createSelect(@NonNull Collection<T> items, @NonNull String captionId, @NonNull Object... params) {
|
||||
|
|
|
@ -170,37 +170,50 @@ public class AdminTab extends AppTab<Div> {
|
|||
|
||||
Box configBox = new Box(Translatable.createLabel(Messages.NEW_ACRA_CONFIG), Translatable.createLabel(Messages.NEW_ACRA_CONFIG_DETAILS),
|
||||
Translatable.createButton(e -> new Popup().setTitle(Messages.NEW_ACRA_CONFIG_CONFIRM)
|
||||
.addYesNoButtons(popup -> popup.clear().addComponent(new ConfigurationLabel(getDataService().recreateReporterUser(app))).addCloseButton().show())
|
||||
.show(), Messages.CREATE));
|
||||
.addYesNoButtons(popup -> popup.clear().addComponent(new ConfigurationLabel(getDataService().recreateReporterUser(app))).addCloseButton().show())
|
||||
.show(), Messages.CREATE));
|
||||
Box matchingBox = new Box(Translatable.createLabel(Messages.NEW_BUG_CONFIG), Translatable.createLabel(Messages.NEW_BUG_CONFIG_DETAILS),
|
||||
Translatable.createButton(e -> {
|
||||
App.Configuration configuration = app.getConfiguration();
|
||||
Translatable.Value<RangeField, Double> score = Translatable.createRangeField(Messages.SCORE).with(it -> {
|
||||
it.setMin(0);
|
||||
it.setMax(100);
|
||||
it.setValue((double) configuration.getMinScore());
|
||||
});
|
||||
new Popup().addComponent(score)
|
||||
.setTitle(Messages.NEW_BUG_CONFIG_CONFIRM)
|
||||
.addYesNoButtons(p -> getDataService().changeConfiguration(app, new App.Configuration(score.getValue().intValue())), true)
|
||||
.show();
|
||||
}, Messages.CONFIGURE));
|
||||
NumberField age = new NumberField();
|
||||
age.setStep(1d);
|
||||
age.setMin(1d);
|
||||
age.setValue(30d);
|
||||
age.setPreventInvalidInput(true);
|
||||
age.setHasControls(true);
|
||||
age.setWidthFull();
|
||||
age.setSuffixComponent(Translatable.createLabel(Messages.REPORTS_OLDER_THAN2));
|
||||
FlexLayout purgeAge = new FlexLayout();
|
||||
purgeAge.setWidthFull();
|
||||
purgeAge.preventWhiteSpaceBreaking();
|
||||
purgeAge.setAlignItems(FlexComponent.Alignment.CENTER);
|
||||
purgeAge.add(Translatable.createButton(e -> getDataService().deleteReportsOlderThanDays(app, age.getValue().intValue()), Messages.PURGE),
|
||||
Translatable.createLabel(Messages.REPORTS_OLDER_THAN1),
|
||||
age);
|
||||
purgeAge.expand(age);
|
||||
App.Configuration configuration = app.getConfiguration();
|
||||
Translatable.Value<RangeField, Double> score = Translatable.createRangeField(Messages.SCORE).with(it -> {
|
||||
it.setMin(0);
|
||||
it.setMax(100);
|
||||
it.setValue((double) configuration.getMinScore());
|
||||
});
|
||||
new Popup().addComponent(score)
|
||||
.setTitle(Messages.NEW_BUG_CONFIG_CONFIRM)
|
||||
.addYesNoButtons(p -> getDataService().changeConfiguration(app, new App.Configuration(score.getValue().intValue())), true)
|
||||
.show();
|
||||
}, Messages.CONFIGURE));
|
||||
Box purgeAgeBox = new Box(Translatable.createLabel(Messages.PURGE_OLD), Translatable.createLabel(Messages.PURGE_OLD_DETAILS), Translatable.createButton(e -> {
|
||||
Translatable.Value<NumberField, Double> age = Translatable.createNumberField(30d, Messages.REPORTS_OLDER_THAN1).with(it -> {
|
||||
it.setStep(1d);
|
||||
it.setMin(1d);
|
||||
it.setPreventInvalidInput(true);
|
||||
it.setHasControls(true);
|
||||
it.setWidthFull();
|
||||
it.setSuffixComponent(Translatable.createLabel(Messages.REPORTS_OLDER_THAN2));
|
||||
}
|
||||
);
|
||||
new Popup().addComponent(age)
|
||||
.addYesNoButtons(popup -> {
|
||||
getDataService().deleteReportsOlderThanDays(app, age.getValue().intValue());
|
||||
}, true).show();
|
||||
}, Messages.PURGE));
|
||||
Box purgeVersionBox = new Box(Translatable.createLabel(Messages.PURGE_VERSION), Translatable.createLabel(Messages.PURGE_VERSION_DETAILS), Translatable.createButton(e -> {
|
||||
Translatable.Value<ComboBox<Integer>, Integer> versionBox = Translatable.createComboBox(getDataService().getFromReports(app, null, report.stacktrace.version.code), Messages.REPORTS_BEFORE_VERSION);
|
||||
new Popup().addComponent(versionBox)
|
||||
.addYesNoButtons(popup -> {
|
||||
if (versionBox.getValue() != null) {
|
||||
getDataService().deleteReportsBeforeVersion(app, versionBox.getValue());
|
||||
}
|
||||
}, true).show();
|
||||
}, Messages.PURGE));
|
||||
Box deleteBox = new Box(Translatable.createLabel(Messages.DELETE_APP), Translatable.createLabel(Messages.DELETE_APP_DETAILS), Translatable.createButton(e ->
|
||||
new Popup().setTitle(Messages.DELETE_APP_CONFIRM).addYesNoButtons(popup -> {
|
||||
getDataService().delete(app);
|
||||
UI.getCurrent().navigate(Overview.class);
|
||||
}, true).show(), Messages.DELETE));
|
||||
ComboBox<Integer> versionBox = new ComboBox<>(null, getDataService().getFromReports(app, null, QReport.report.stacktrace.version.code));
|
||||
versionBox.setWidth("100%");
|
||||
FlexLayout purgeVersion = new FlexLayout();
|
||||
|
@ -218,7 +231,7 @@ public class AdminTab extends AppTab<Div> {
|
|||
UI.getCurrent().navigate(Overview.class);
|
||||
}, true).show(), Messages.DELETE_APP);
|
||||
deleteButton.setWidthFull();
|
||||
Card dangerCard = createCard(configBox, matchingBox, purgeAge, purgeVersion, deleteButton);
|
||||
Card dangerCard = createCard(configBox, matchingBox, purgeAgeBox, purgeVersionBox, deleteBox);
|
||||
dangerCard.setHeader(Translatable.createLabel(Messages.DANGER_ZONE));
|
||||
dangerCard.enableDivider();
|
||||
dangerCard.setHeaderColor("var(----lumo-error-text-color)", "var(--lumo-error-color)");
|
||||
|
|
|
@ -50,7 +50,7 @@ solved=Gelöst
|
|||
statistics=Statistiken
|
||||
newAcraConfig=Erzeuge neue ACRA Konfiguration
|
||||
confirm=Bestätigen
|
||||
newAcraConfigConfirm=Sind Sie sicher dass Sie eine neue ACRA Konfiguration erzeugen wollen?<br>Die existierende Konfiguration wird dadurch ungültig
|
||||
newAcraConfigConfirm=Sind Sie sicher dass Sie eine neue ACRA Konfiguration erzeugen wollen? Die existierende Konfiguration wird dadurch ungültig
|
||||
newBugConfig=Bugzusammenfassung konfigurieren
|
||||
minScore=Minimaler Score
|
||||
newBugConfigConfirm=Sind Sie sicher dass sie diese Konfiguration speichern wollen? Alle Bugs werden überprüft, was eine Weile dauern kann. Beachten Sie außerdem, dass ein höherer Wert keine bereits gebildeten Zusammenfassungen auflöst.
|
||||
|
@ -169,4 +169,10 @@ settings=Einstellungen
|
|||
other=Weitere
|
||||
newAcraConfigDetails=Nützlich wenn Sie die Konfiguration vergessen haben oder invalidieren wollen
|
||||
configure=Konfigurieren
|
||||
newBugConfigDetails=Anpassen wie ähnlich Bugs sein müssen um automatisch zusammgeführt zu werden
|
||||
newBugConfigDetails=Anpassen wie ähnlich Bugs sein müssen um automatisch zusammgeführt zu werden
|
||||
purgeOld=Lösche alte Berichte
|
||||
purgeOldDetails=Lösche Berichte, die älter als das gegebene Datum sind
|
||||
purgeVersion=Lösche Berichte aus alten Versionen
|
||||
purgeVersionDetails=Lösche Berichte, die älter als die gegebene Version sind
|
||||
deleteAppDetails=Lösche diese App und alle zugehörigen Daten
|
||||
delete=Lösche
|
|
@ -50,7 +50,7 @@ solved=Solved
|
|||
statistics=Statistics
|
||||
newAcraConfig=Create new ACRA Configuration
|
||||
confirm=Confirm
|
||||
newAcraConfigConfirm=Are you sure you want to create a new ACRA configuration?<br>The existing configuration will be invalidated
|
||||
newAcraConfigConfirm=Are you sure you want to create a new ACRA configuration? The existing configuration will be invalidated
|
||||
newBugConfig=Configure Bug matching
|
||||
minScore=Minimum Score
|
||||
newBugConfigConfirm=Are you sure you want to save this configuration?\
|
||||
|
@ -171,4 +171,10 @@ settings=Settings
|
|||
other=Other
|
||||
newAcraConfigDetails=Useful if you forgot or want to invalidate the old configuration
|
||||
configure=Configure
|
||||
newBugConfigDetails=Change how similar bugs have to be to be merged automatically
|
||||
newBugConfigDetails=Change how similar bugs have to be to be merged automatically
|
||||
purgeOld=Purge old reports
|
||||
purgeOldDetails=Delete reports older than a certain date
|
||||
purgeVersion=Purge reports from previous versions
|
||||
purgeVersionDetails=Delete reports older than a certain version
|
||||
deleteAppDetails=Delete this app and all data associated with it
|
||||
delete=Delete
|
Loading…
Reference in a new issue