With filtered output, avoid listing subjobs under foreign parents
authorZdeněk Šustr <sustr4@cesnet.cz>
Fri, 10 Aug 2012 13:20:09 +0000 (13:20 +0000)
committerZdeněk Šustr <sustr4@cesnet.cz>
Fri, 10 Aug 2012 13:20:09 +0000 (13:20 +0000)
org.glite.lb.server/src/bkserverd.c
org.glite.lb.server/src/lb_html.c

index 28b0690..77beb69 100644 (file)
@@ -591,7 +591,6 @@ int main(int argc, char *argv[])
                asprintf(&html_header, "%s/html_header.html", html_header_prefix);
        }
        if (html_header) {
-               char *et, *ed;
                FILE *fp = fopen(html_header, "r");
                if( fp ) {
                        fclose(fp);
index a025696..cb0af11 100644 (file)
@@ -77,8 +77,8 @@ int jobstat_cmp (const void *a, const void *b) {
 /* 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;
-       int i, total = 0, bufsize, written = 0, linlen, wassub = 0, lineoverhead;
+        char *pomA = NULL, *pomB, *pomC, *header = NULL, *recent_parent = NULL;
+       int i, total = 0, bufsize, written = 0, linlen, wassub = 0, issub = 0, lineoverhead;
        JobIdSorter *order;
 
         while (jobsOut && jobsOut[total]) total++;
@@ -125,11 +125,12 @@ 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 {
+                       issub = order[i].parent_unparsed && recent_parent && !strcmp(recent_parent, order[i].parent_unparsed) ? 1 : 0;
                        linlen = asprintf(&pomA, "%s<li><a href=\"%s\">%s</a></li>\n",
-                               order[i].parent_unparsed ? (wassub++ ? "" : "<ul>") : (wassub ? "</UL>" : ""),
+                               issub ? (wassub++ ? "" : "<ul>") : (wassub ? "</UL>" : ""),
                                order[i].id_unparsed,
                                order[i].id_unparsed );
-                       if (!order[i].parent_unparsed) wassub = 0;
+                       if (!issub || !order[i].parent_unparsed) { wassub = 0; recent_parent = order[i].id_unparsed; }
                }
 
                while (written+linlen >= bufsize) {