minor bug fix in connection table

This commit is contained in:
anhefti 2019-08-12 13:11:34 +02:00
parent bc791e1eae
commit 1e475c6699
5 changed files with 25 additions and 29 deletions

View file

@ -50,7 +50,6 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.exam.GetIndicator
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.session.GetClientConnectionDataList;
import ch.ethz.seb.sebserver.gui.service.remote.webservice.auth.CurrentUser;
import ch.ethz.seb.sebserver.gui.service.session.ClientConnectionTable;
import ch.ethz.seb.sebserver.gui.widget.WidgetFactory;
@Lazy
@Component
@ -82,7 +81,6 @@ public class MonitoringRunningExam implements TemplateComposer {
@Override
public void compose(final PageContext pageContext) {
final RestService restService = this.resourceService.getRestService();
final WidgetFactory widgetFactory = this.pageService.getWidgetFactory();
final EntityKey entityKey = pageContext.getEntityKey();
final CurrentUser currentUser = this.resourceService.getCurrentUser();
final Exam exam = restService.getBuilder(GetExam.class)
@ -113,7 +111,7 @@ public class MonitoringRunningExam implements TemplateComposer {
.withURIVariable(API.EXAM_API_PARAM_EXAM_ID, exam.getModelId());
final ClientConnectionTable clientTable = new ClientConnectionTable(
widgetFactory,
this.pageService,
tablePane,
exam,
indicators,

View file

@ -56,7 +56,8 @@ public final class ClientConnectionTable {
private static final int BOTTOM_PADDING = 20;
private final static String STATUS_LOC_TEXT_KEY_PREFIX = "sebserver.monitoring.connection.status.";
private static final String INDICATOR_NAME_TEXT_KEY_PREFIX =
"sebserver.monitoring.connection.list.column.indicator.";
private final static LocTextKey CONNECTION_ID_TEXT_KEY =
new LocTextKey("sebserver.monitoring.connection.list.column.id");
@ -67,6 +68,7 @@ public final class ClientConnectionTable {
private static final int NUMBER_OF_NONE_INDICATOR_COLUMNS = 3;
private final PageService pageService;
private final WidgetFactory widgetFactory;
private final Exam exam;
private final RestCall<Collection<ClientConnectionData>>.RestCallBuilder restCallBuilder;
@ -80,13 +82,14 @@ public final class ClientConnectionTable {
private final Set<String> sessionIds;
public ClientConnectionTable(
final WidgetFactory widgetFactory,
final PageService pageService,
final Composite tableRoot,
final Exam exam,
final Collection<Indicator> indicators,
final RestCall<Collection<ClientConnectionData>>.RestCallBuilder restCallBuilder) {
this.widgetFactory = widgetFactory;
this.pageService = pageService;
this.widgetFactory = pageService.getWidgetFactory();
this.exam = exam;
this.restCallBuilder = restCallBuilder;
@ -98,7 +101,7 @@ public final class ClientConnectionTable {
display,
NUMBER_OF_NONE_INDICATOR_COLUMNS);
this.table = widgetFactory.tableLocalized(tableRoot, SWT.SINGLE | SWT.V_SCROLL);
this.table = this.widgetFactory.tableLocalized(tableRoot, SWT.SINGLE | SWT.V_SCROLL);
final GridLayout gridLayout = new GridLayout(3 + indicators.size(), true);
this.table.setLayout(gridLayout);
final GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false);
@ -107,19 +110,19 @@ public final class ClientConnectionTable {
this.table.setHeaderVisible(true);
this.table.setLinesVisible(true);
widgetFactory.tableColumnLocalized(
this.widgetFactory.tableColumnLocalized(
this.table,
CONNECTION_ID_TEXT_KEY);
widgetFactory.tableColumnLocalized(
this.widgetFactory.tableColumnLocalized(
this.table,
CONNECTION_ADDRESS_TEXT_KEY);
widgetFactory.tableColumnLocalized(
this.widgetFactory.tableColumnLocalized(
this.table,
CONNECTION_STATUS_TEXT_KEY);
for (final Indicator indDef : indicators) {
final TableColumn tc = new TableColumn(this.table, SWT.NONE);
final String indicatorName = widgetFactory.getI18nSupport().getText(
"sebserver.monitoring.connection.list.column.indicator." + indDef.name,
final String indicatorName = this.widgetFactory.getI18nSupport().getText(
INDICATOR_NAME_TEXT_KEY_PREFIX + indDef.name,
indDef.name);
tc.setText(indicatorName);
}
@ -343,15 +346,10 @@ public final class ClientConnectionTable {
}
String getStatusName() {
String name;
if (this.connectionData != null && this.connectionData.clientConnection.status != null) {
name = this.connectionData.clientConnection.status.name();
} else {
name = ConnectionStatus.UNDEFINED.name();
}
return ClientConnectionTable.this.widgetFactory.getI18nSupport()
.getText(STATUS_LOC_TEXT_KEY_PREFIX + name, name);
return ClientConnectionTable.this.pageService.getResourceService().localizedClientConnectionStatusName(
(this.connectionData != null && this.connectionData.clientConnection != null)
? this.connectionData.clientConnection.status
: ConnectionStatus.UNDEFINED);
}
String getConnectionAddress() {

View file

@ -7,7 +7,7 @@ logging.file=log/sebserver.log
# data source configuration
spring.datasource.initialize=true
spring.datasource.initialization-mode=always
spring.datasource.url=jdbc:mariadb://ralph.ethz.ch:6603/SEBServer?useSSL=false&createDatabaseIfNotExist=true
spring.datasource.url=jdbc:mariadb://localhost:6603/SEBServer?useSSL=false&createDatabaseIfNotExist=true
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
spring.datasource.platform=dev
spring.datasource.hikari.max-lifetime=600000

View file

@ -943,11 +943,11 @@ sebserver.monitoring.exam.connection.event.type.ERROR_LOG=Error
sebserver.monitoring.exam.connection.event.type.LAST_PING=Last Ping
sebserver.monitoring.exam.connection.status.UNDEFINED=Undefined
sebserver.monitoring.exam.connection.status.CONNECTION_REQUESTED=Connection Requested,
sebserver.monitoring.exam.connection.status.AUTHENTICATED=Authenticated,
sebserver.monitoring.exam.connection.status.ESTABLISHED=Established,
sebserver.monitoring.exam.connection.status.CLOSED=Closed,
sebserver.monitoring.exam.connection.status.ABORTED=Aborted,
sebserver.monitoring.exam.connection.status.CONNECTION_REQUESTED=Connection Requested
sebserver.monitoring.exam.connection.status.AUTHENTICATED=Authenticated
sebserver.monitoring.exam.connection.status.ESTABLISHED=Established
sebserver.monitoring.exam.connection.status.CLOSED=Closed
sebserver.monitoring.exam.connection.status.ABORTED=Aborted
sebserver.monitoring.exam.connection.status.RELEASED=Released
################################

View file

@ -78,8 +78,8 @@ public class HTTPClientBot {
public HTTPClientBot(final Map<String, String> args) {
this.webserviceAddress = args.getOrDefault("webserviceAddress", "http://ralph.ethz.ch:8080");
//this.webserviceAddress = args.getOrDefault("webserviceAddress", "http://localhost:8080");
//this.webserviceAddress = args.getOrDefault("webserviceAddress", "http://ralph.ethz.ch:8080");
this.webserviceAddress = args.getOrDefault("webserviceAddress", "http://localhost:8080");
this.accessTokenEndpoint = args.getOrDefault("accessTokenEndpoint", "/oauth/token");
this.clientId = args.getOrDefault("clientId", "TO_SET");