@Override public void onResponseCode(Request request, Response response) { transientRequest = null; if (response.getStatusCode() == SC_CREATED) { DatasourceDto datasourceDto = JsonUtils.unsafeEval(response.getText()); importConfig.setTransientDatasourceName(datasourceDto.getName()); datasourceDiff(datasourceDto); } else { getView() .showDatasourceCreationError( (ClientErrorDto) JsonUtils.unsafeEval(response.getText())); } }
@Override public void showError(String message, @Nullable FormField group) { if (Strings.isNullOrEmpty(message)) return; String msg = message; try { ClientErrorDto errorDto = JsonUtils.unsafeEval(message); msg = errorDto.getStatus(); } catch (Exception ignored) { } if (group == null) { dialog.addAlert(msg, AlertType.ERROR); } else { dialog.addAlert(msg, AlertType.ERROR, variableGroup); } }
@Override public void onResponseCode(Request request, Response response) { if (response.getStatusCode() == SC_OK) { String uri = UriBuilder.create() .segment("datasource", "{}", "view", "{}", "variable", "{}") .query("comment", getView().getComment()) .build(table.getDatasourceName(), table.getName(), variable.getName()); ResourceRequestBuilderFactory.newBuilder() // .forResource(uri) // .withResourceBody(VariableDto.stringify(newVariable)) // .withCallback(new UpdateVariableCallbackHandler(), SC_OK, SC_BAD_REQUEST) // .put() .send(); } else { NotificationEvent notificationEvent = new JSErrorNotificationEventBuilder() .build((ClientErrorDto) JsonUtils.unsafeEval(response.getText())); fireEvent(notificationEvent); } }