package water.api;

import hex.gbm.GBM.GBMModel;
import water.*;

import com.google.gson.JsonObject;

public class GBMProgressPage extends Progress2 {
  /** Return {@link Response} for finished job. */
  @Override protected Response jobDone(final Job job, final String dst) {
    JsonObject args = new JsonObject();
    args.addProperty("model_key", job.dest().toString());
    return GBMModelView.redirect(this, job.dest());
  }

  public static Response redirect(Request req, Key jobkey, Key dest) {
    return new Response(Response.Status.redirect, req, -1, -1, "GBMProgressPage", "job", jobkey, "dst_key", dest);
  }

  @Override public boolean toHTML(StringBuilder sb) {
    Job jjob = Job.findJob(Key.make(job.value()));
    Value value = DKV.get(jjob.dest());
    GBMModel m = value != null ? (GBMModel) value.get() : null;
    if( m != null )
      m.generateHTML("GBM Model", sb);
    else
      DocGen.HTML.paragraph(sb, "Pending...");
    return true;
  }
}

@@ -768,37 +768,79 @@
     
-GBMModel m =
+if(
  value 
-!
+=
 = null 
-? 
+) DocGen.HTML.paragraph(sb, %22Pending...%22);%0A    else (
 (GBM
@@ -845,17 +845,16 @@
 BMModel)
- 
 value.ge
@@ -860,129 +860,38 @@
 et()
- : null;%0A    if( m != null )%0A      m.generateHTML(%22GBM Model%22, sb);%0A    else%0A      DocGen.HTML.paragraph(sb, %22Pending...%22
+).generateHTML(%22GBM Model%22, sb
 );%0A 

Clean up gbm progress page