use of org.pentaho.mantle.client.dialogs.scheduling.NewScheduleDialog in project pentaho-platform by pentaho.
the class SchedulesPanel method editJob.
private void editJob(JsJob editJob) {
final String url = GWT.getHostPageBaseURL() + "api/scheduler/jobinfo?jobId=" + URL.encodeQueryString(editJob.getJobId());
RequestBuilder executableTypesRequestBuilder = new RequestBuilder(RequestBuilder.GET, url);
executableTypesRequestBuilder.setHeader("accept", "application/json");
executableTypesRequestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
try {
executableTypesRequestBuilder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable exception) {
// showError(exception);
}
public void onResponseReceived(Request request, Response response) {
if (response.getStatusCode() == Response.SC_OK) {
final JsJob jsJob = parseJsonJob(JsonUtils.escapeJsonForEval(response.getText()));
// check email is setup
RequestBuilder emailValidRequest = new RequestBuilder(RequestBuilder.GET, GWT.getHostPageBaseURL() + "api/emailconfig/isValid");
emailValidRequest.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
emailValidRequest.setHeader("accept", "text/plain");
try {
emailValidRequest.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable exception) {
MessageDialogBox dialogBox = // $NON-NLS-1$
new MessageDialogBox(Messages.getString("error"), exception.toString(), false, false, true);
dialogBox.center();
}
public void onResponseReceived(Request request, Response response) {
if (response.getStatusCode() == Response.SC_OK) {
final boolean isEmailConfValid = Boolean.parseBoolean(response.getText());
final NewScheduleDialog schedDialog = new NewScheduleDialog(jsJob, scheduleDialogCallback, isEmailConfValid);
schedDialog.center();
}
}
});
} catch (RequestException e) {
// showError(e);
}
} else {
MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("error"), Messages.getString("serverErrorColon") + " " + response.getStatusCode(), false, false, // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
true);
dialogBox.center();
}
}
});
} catch (RequestException e) {
// showError(e);
}
}
Aggregations