use icons for delete buttons in grids
This commit is contained in:
parent
2f146b76be
commit
6a6c5f6605
3 changed files with 24 additions and 13 deletions
|
@ -27,6 +27,7 @@ import com.faendir.acra.ui.view.base.InMemoryUpload;
|
|||
import com.faendir.acra.ui.view.base.layout.MyGrid;
|
||||
import com.faendir.acra.ui.view.base.popup.Popup;
|
||||
import com.faendir.acra.ui.view.base.popup.ValidatedField;
|
||||
import com.vaadin.icons.VaadinIcons;
|
||||
import com.vaadin.shared.data.sort.SortDirection;
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
|
@ -61,14 +62,16 @@ public class ProguardPanel implements AdminPanel{
|
|||
grid.setSizeToRows();
|
||||
grid.sort(grid.addColumn(ProguardMapping::getVersionCode, QProguardMapping.proguardMapping.versionCode, "Version"), SortDirection.ASCENDING);
|
||||
if (SecurityUtils.hasPermission(app, Permission.Level.EDIT)) {
|
||||
grid.addColumn(report -> "Delete",
|
||||
new ButtonRenderer<>(e -> new Popup().setTitle("Confirm")
|
||||
.addComponent(new Label("Are you sure you want to delete the mapping for version " + e.getItem().getVersionCode() + "?"))
|
||||
.addYesNoButtons(p -> {
|
||||
dataService.delete(e.getItem());
|
||||
grid.getDataProvider().refreshAll();
|
||||
}, true)
|
||||
.show()));
|
||||
ButtonRenderer<ProguardMapping> renderer = new ButtonRenderer<>(e -> new Popup().setTitle("Confirm")
|
||||
.addComponent(new Label("Are you sure you want to delete the mapping for version " + e.getItem().getVersionCode() + "?"))
|
||||
.addYesNoButtons(p -> {
|
||||
dataService.delete(e.getItem());
|
||||
grid.getDataProvider().refreshAll();
|
||||
}, true)
|
||||
.show());
|
||||
renderer.setHtmlContentAllowed(true);
|
||||
grid.addColumn(report -> VaadinIcons.TRASH.getHtml(),
|
||||
renderer);
|
||||
}
|
||||
layout.addComponent(grid);
|
||||
layout.addStyleName(AcraTheme.NO_PADDING);
|
||||
|
|
|
@ -26,6 +26,7 @@ import com.faendir.acra.ui.view.base.layout.MyGrid;
|
|||
import com.faendir.acra.ui.view.base.popup.Popup;
|
||||
import com.faendir.acra.ui.view.report.ReportView;
|
||||
import com.faendir.acra.util.TimeSpanRenderer;
|
||||
import com.vaadin.icons.VaadinIcons;
|
||||
import com.vaadin.shared.data.sort.SortDirection;
|
||||
import com.vaadin.ui.Grid;
|
||||
import com.vaadin.ui.Label;
|
||||
|
@ -52,11 +53,13 @@ public class ReportList extends MyGrid<Report> {
|
|||
addColumn(report -> report.getStacktrace().getStacktrace().split("\n", 2)[0], QReport.report.stacktrace.stacktrace, "Stacktrace").setExpandRatio(1)
|
||||
.setMinimumWidthFromContent(false);
|
||||
if (SecurityUtils.hasPermission(app, Permission.Level.EDIT)) {
|
||||
addColumn(report -> "Delete",
|
||||
new ButtonRenderer<>(e -> new Popup().setTitle("Confirm")
|
||||
.addComponent(new Label("Are you sure you want to delete this report?"))
|
||||
.addYesNoButtons(p -> reportDeleter.accept(e.getItem()), true)
|
||||
.show())).setSortable(false);
|
||||
ButtonRenderer<Report> renderer = new ButtonRenderer<>(e -> new Popup().setTitle("Confirm")
|
||||
.addComponent(new Label("Are you sure you want to delete this report?"))
|
||||
.addYesNoButtons(p -> reportDeleter.accept(e.getItem()), true)
|
||||
.show());
|
||||
renderer.setHtmlContentAllowed(true);
|
||||
addColumn(report -> VaadinIcons.TRASH.getHtml(),
|
||||
renderer).setSortable(false);
|
||||
}
|
||||
addOnClickNavigation(navigationManager, ReportView.class, e -> e.getItem().getId());
|
||||
}
|
||||
|
|
|
@ -189,4 +189,9 @@ $v-app-loading-text: "Acrarium is loading...";
|
|||
width: calc(25% - 20px) !important;
|
||||
}
|
||||
}
|
||||
|
||||
.v-nativebutton {
|
||||
border: none !important;
|
||||
background: none !important;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue