Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Claudio Mezzasalma <claudio.mezzasalma@eurotech.com>
- Loading branch information
Claudio Mezzasalma
committed
Apr 14, 2020
1 parent
2bffe49
commit 5493cea
Showing
5 changed files
with
131 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
...org/eclipse/kapua/app/console/module/job/client/targets/JobTargetRestartTargetDialog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2020 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.targets; | ||
|
||
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.dialog.SimpleDialog; | ||
import org.eclipse.kapua.app.console.module.api.client.util.ConsoleInfo; | ||
import org.eclipse.kapua.app.console.module.api.client.util.DialogUtils; | ||
import org.eclipse.kapua.app.console.module.job.client.messages.ConsoleJobMessages; | ||
import org.eclipse.kapua.app.console.module.job.shared.model.GwtJob; | ||
import org.eclipse.kapua.app.console.module.job.shared.model.GwtJobTarget; | ||
import org.eclipse.kapua.app.console.module.job.shared.service.GwtJobEngineService; | ||
import org.eclipse.kapua.app.console.module.job.shared.service.GwtJobEngineServiceAsync; | ||
|
||
import com.google.gwt.core.client.GWT; | ||
import com.google.gwt.user.client.rpc.AsyncCallback; | ||
|
||
public class JobTargetRestartTargetDialog extends SimpleDialog { | ||
|
||
private static final ConsoleJobMessages JOB_MSGS = GWT.create(ConsoleJobMessages.class); | ||
|
||
private static final GwtJobEngineServiceAsync JOB_ENGINE_SERVICE = GWT.create(GwtJobEngineService.class); | ||
|
||
private final GwtJob gwtJob; | ||
private final GwtJobTarget gwtJobTarget; | ||
|
||
public JobTargetRestartTargetDialog(GwtJob gwtJob, GwtJobTarget gwtJobTarget) { | ||
this.gwtJob = gwtJob; | ||
this.gwtJobTarget = gwtJobTarget; | ||
|
||
DialogUtils.resizeDialog(this, 300, 135); | ||
} | ||
|
||
@Override | ||
public void createBody() { | ||
// No action needed | ||
} | ||
|
||
@Override | ||
protected void addListeners() { | ||
// No action needed | ||
} | ||
|
||
@Override | ||
public void submit() { | ||
JOB_ENGINE_SERVICE.restart(gwtJob.getScopeId(), gwtJob.getId(), gwtJobTarget.getId(), new AsyncCallback<Void>() { | ||
|
||
@Override | ||
public void onFailure(Throwable caught) { | ||
ConsoleInfo.display(MSGS.popupError(), JOB_MSGS.jobStartTargetErrorMessage(caught.getLocalizedMessage())); | ||
unmask(); | ||
hide(); | ||
} | ||
|
||
@Override | ||
public void onSuccess(Void result) { | ||
ConsoleInfo.display(MSGS.popupInfo(), JOB_MSGS.jobStartTargetStartedMessage()); | ||
unmask(); | ||
hide(); | ||
} | ||
}); | ||
} | ||
|
||
@Override | ||
public String getHeaderMessage() { | ||
return JOB_MSGS.jobStartTargetDialogHeader(gwtJob.getJobName(), gwtJobTarget.getClientId()); | ||
} | ||
|
||
@Override | ||
public KapuaIcon getInfoIcon() { | ||
return new KapuaIcon(IconSet.WARNING); | ||
} | ||
|
||
@Override | ||
public String getInfoMessage() { | ||
return JOB_MSGS.jobStartTargetDialogInfo(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters