From 088adba139dfc5eef6188e308dfdd84fb6868b3e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zden=C4=9Bk=20=C5=A0ustr?= Date: Tue, 28 Aug 2012 07:07:20 +0000 Subject: [PATCH] Display job type and state in job lists --- org.glite.lb.server/src/lb_html.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/org.glite.lb.server/src/lb_html.c b/org.glite.lb.server/src/lb_html.c index e3b56c3..bfd0b87 100644 --- a/org.glite.lb.server/src/lb_html.c +++ b/org.glite.lb.server/src/lb_html.c @@ -84,7 +84,7 @@ char *get_html_header(edg_wll_Context ctx, int text) { } else rlen = -1; - if (rlen == -1 ) header=strdup(""); + if (rlen == -1 ) header=strdup(""); return header; } @@ -214,8 +214,8 @@ int edg_wll_ConfigurationToHTML(edg_wll_Context ctx, int admin, char **message, /* construct Message-Body of Response-Line for edg_wll_UserJobs */ int edg_wll_UserInfoToHTML(edg_wll_Context ctx UNUSED_VAR, edg_wlc_JobId *jobsOut, edg_wll_JobStat *statsOut, char **message, int text) { - char *pomA = NULL, *pomB, *pomC, *header = NULL, *recent_parent = NULL; - int i, total = 0, bufsize, written = 0, linlen, wassub = 0, issub = 0, lineoverhead; + char *pomA = NULL, *pomB, *pomC, *header = NULL, *recent_parent = NULL, *st; + int i, total = 0, bufsize, written = 0, linlen, wassub = 0, issub = 0, lineoverhead, jt; JobIdSorter *order; while (jobsOut && jobsOut[total]) total++; @@ -262,11 +262,27 @@ int edg_wll_UserInfoToHTML(edg_wll_Context ctx UNUSED_VAR, edg_wlc_JobId *jobsOu for (i = 0; i < total; i++) { if (text) linlen = asprintf(&pomA,"%s%s", order[i].id_unparsed, i + 1 == total ? "\n" : ","); else { + jt = statsOut[order[i].order].jobtype; + switch (jt) { + case EDG_WLL_STAT_CREAM: + st = edg_wll_CreamStatToString(statsOut[order[i].order].cream_state); + case EDG_WLL_STAT_VIRTUAL_MACHINE: + st = edg_wll_VMStatToString(statsOut[order[i].order].vm_state); + case EDG_WLL_STAT_PBS: + st = statsOut[order[i].order].pbs_state ? + strdup(statsOut[order[i].order].pbs_state) : + edg_wll_StatToString(statsOut[order[i].order].state); + default: + st = edg_wll_StatToString(statsOut[order[i].order].state); + } issub = order[i].parent_unparsed && recent_parent && !strcmp(recent_parent, order[i].parent_unparsed) ? 1 : 0; - linlen = asprintf(&pomA, "%s
  • %s
  • \n", + linlen = asprintf(&pomA, "%s
  • %s — %s %s
  • \n", issub ? (wassub++ ? "" : "" : ""), order[i].id_unparsed, - order[i].id_unparsed ); + order[i].id_unparsed, + jt >= 0 && jt < EDG_WLL_NUMBER_OF_JOBTYPES ? edg_wll_StatusJobtypeNames[jt] : "Unknown!", + st); + free(st); if (!issub || !order[i].parent_unparsed) { wassub = 0; recent_parent = order[i].id_unparsed; } } @@ -443,7 +459,8 @@ int edg_wll_GeneralJobStatusToHTML(edg_wll_Context ctx UNUSED_VAR, edg_wll_JobSt free(chtemp); add_row(&out, "Status", "Status", (chtemp = edg_wll_StatToString(stat.state)), NULL, text); free(chtemp); - add_row(&out, "job_type", "Type", edg_wll_StatusJobtypeNames[stat.jobtype], NULL, text); + add_row(&out, "job_type", "Type", stat.jobtype >= 0 && stat.jobtype < EDG_WLL_NUMBER_OF_JOBTYPES ? + edg_wll_StatusJobtypeNames[stat.jobtype] : "Unknown!", NULL, text); switch (stat.jobtype) { case EDG_WLL_STAT_CREAM: -- 1.8.2.3