Skip to content

Commit

Permalink
Merge pull request #2794 from Coduz/feature-jobExecutionLogDialog
Browse files Browse the repository at this point in the history
Added Dialog to show Job Execution Log in Console
  • Loading branch information
Coduz authored Dec 11, 2019
2 parents c0d6ec2 + 3cf3a67 commit 344daa0
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*******************************************************************************
* Copyright (c) 2019 Eurotech and/or its affiliates and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Eurotech - initial API and implementation
*******************************************************************************/
package org.eclipse.kapua.app.console.module.job.client.execution;

import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.google.gwt.core.client.GWT;
import org.eclipse.kapua.app.console.module.api.client.resources.icons.IconSet;
import org.eclipse.kapua.app.console.module.api.client.resources.icons.KapuaIcon;
import org.eclipse.kapua.app.console.module.api.client.ui.button.Button;
import org.eclipse.kapua.app.console.module.job.client.messages.ConsoleJobMessages;

public class JobExecutionLogButton extends Button {

private static final ConsoleJobMessages MSGS_JOB = GWT.create(ConsoleJobMessages.class);

public JobExecutionLogButton(SelectionListener<ButtonEvent> listener) {
super(MSGS_JOB.jobExecutionLogButton(),
new KapuaIcon(IconSet.STICKY_NOTE_O),
listener);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*******************************************************************************
* Copyright (c) 2019 Eurotech and/or its affiliates and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Eurotech - initial API and implementation
*******************************************************************************/
package org.eclipse.kapua.app.console.module.job.client.execution;

import com.google.gwt.core.client.GWT;
import org.eclipse.kapua.app.console.module.api.client.ui.dialog.entity.EntityLogDialog;
import org.eclipse.kapua.app.console.module.job.client.messages.ConsoleJobMessages;
import org.eclipse.kapua.app.console.module.job.shared.model.GwtJobExecution;

public class JobExecutionLogDialog extends EntityLogDialog {

private static final ConsoleJobMessages MSG_JOB = GWT.create(ConsoleJobMessages.class);

public JobExecutionLogDialog(GwtJobExecution jobExecution) {
super(MSG_JOB.jobExecutionLogDialogHeader(), jobExecution.getUnescapedLog());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class JobTabExecutionsToolbar extends EntityCRUDToolbar<GwtJobExecution>
private String jobId;

private Button stopJobButton;
private Button logExecutionButton;

public JobTabExecutionsToolbar(GwtSession currentSession) {
super(currentSession, true);
Expand Down Expand Up @@ -58,6 +59,15 @@ public void componentSelected(ButtonEvent buttonEvent) {
stopJobButton.disable();
addExtraButton(stopJobButton);

logExecutionButton = new JobExecutionLogButton(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent buttonEvent) {
JobExecutionLogDialog logDialog = new JobExecutionLogDialog(gridSelectionModel.getSelectedItem());
logDialog.show();
}
});
addExtraButton(logExecutionButton);

super.onRender(target, index);

checkButtons();
Expand All @@ -78,6 +88,10 @@ private void checkButtons() {
if (stopJobButton != null) {
stopJobButton.setEnabled(gridSelectionModel != null && gridSelectionModel.getSelectedItem() != null && gridSelectionModel.getSelectedItem().getEndedOn() == null);
}

if (logExecutionButton != null) {
logExecutionButton.setEnabled(gridSelectionModel != null && gridSelectionModel.getSelectedItem() != null);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,16 @@ public String getEndedOnFormatted() {
public void setEndedOn(Date endedOn) {
set("endedOn", endedOn);
}

public String getLog() {
return get("log");
}

public String getUnescapedLog() {
return getUnescaped("log");
}

public void setLog(String log) {
set("log", log);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ public static GwtJobExecution convertJobExecution(JobExecution jobExecution) {
gwtJobExecution.setJobId(KapuaGwtCommonsModelConverter.convertKapuaId(jobExecution.getJobId()));
gwtJobExecution.setStartedOn(jobExecution.getStartedOn());
gwtJobExecution.setEndedOn(jobExecution.getEndedOn());
gwtJobExecution.setLog(jobExecution.getLog());

return gwtJobExecution;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,11 @@ jobExecutionStopDialogInfo=Stop the selected job execution?
jobExecutionStopStoppedMessage=Job execution successfully stopped.
jobExecutionStopErrorMessage=Selected job execution could not be stopped. Either job execution has not been started or it could not be stopped. Please check console log for errors.

#
# Stop Job Execution dialog
jobExecutionLogButton=Log
jobExecutionLogDialogHeader=Job Execution Log

#
# Job Filter
filterHeader=Job Filter
Expand Down

0 comments on commit 344daa0

Please sign in to comment.