From: Zdeněk Šustr Date: Thu, 2 Aug 2012 15:01:30 +0000 (+0000) Subject: Show related jobid with notification details X-Git-Tag: glite-lb-server_R_2_4_3_1~4 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=0f7977fc4c409da6c19fd16472dbfe9f0f34656b;p=jra1mw.git Show related jobid with notification details Show number of registrations in notification listiting --- diff --git a/org.glite.lb.server/src/lb_html.c b/org.glite.lb.server/src/lb_html.c index 1076192..f651c13 100644 --- a/org.glite.lb.server/src/lb_html.c +++ b/org.glite.lb.server/src/lb_html.c @@ -198,6 +198,7 @@ int edg_wll_UserNotifsToHTML(edg_wll_Context ctx UNUSED_VAR, char **notifids, ch asprintf(&ret, "\n\nNotifications\n\n\n%s\n\n\r\n" "

%s

\r\n" "

%s%s%s" + "

Total of %d" "

" "\t\r\n", header, @@ -205,7 +206,7 @@ int edg_wll_UserNotifsToHTML(edg_wll_Context ctx UNUSED_VAR, char **notifids, ch mylink ? mylink : "", alllink ? alllink : "", foreignlink ? foreignlink : "", - pomA ? pomA : "No registrations found" + i, pomA ? pomA : "No registrations found" ); free(pomA); free(mylink); @@ -266,6 +267,11 @@ int edg_wll_NotificationToHTML(edg_wll_Context ctx UNUSED_VAR, notifInfo *ni, ch TR("Destination", "%s", ni->destination, NULL); TR("Valid until", "%s", ni->valid, NULL); TR("Flags", "%s", flags, NULL); + if (strcmp(ni->jobid,"all_jobs")) { + TRL("Job ID", "%s", ni->jobid, NULL); } + else { + TR("Job ID", "%s", "—", NULL); + } free(flags); if (! edg_wll_Condition_Dump(ni, &cond, 0)){ @@ -634,7 +640,7 @@ char *edg_wll_ErrorToHTML(edg_wll_Context ctx,int code) e = edg_wll_Error(ctx,&et,&ed); header = get_html_header(ctx, 0); - asprintf(&out, "\n\nError\n\n\n%s\n\n" + asprintf(&out, "\n\n\nError\n%s\n\n" "

%s

\n" "%d: %s (%s)",header,msg,e,et,ed); diff --git a/org.glite.lb.server/src/lb_proto.c b/org.glite.lb.server/src/lb_proto.c index c89f628..a951f85 100644 --- a/org.glite.lb.server/src/lb_proto.c +++ b/org.glite.lb.server/src/lb_proto.c @@ -284,14 +284,14 @@ err: static int getNotifInfo(edg_wll_Context ctx, char *notifId, notifInfo *ni){ char *q = NULL; glite_lbu_Statement notif = NULL; - char *notifc[5] = {NULL, NULL, NULL, NULL, NULL}; + char *notifc[6] = {NULL, NULL, NULL, NULL, NULL, NULL}; char *can_peername = NULL; int retval = HTTP_OK; - trio_asprintf(&q, "select n.destination, n.valid, n.conditions, n.flags, u.cert_subj " - "from notif_registrations as n, users as u " - "where (n.notifid='%s') AND (n.userid=u.userid)", notifId); + trio_asprintf(&q, "select n.destination, n.valid, n.conditions, n.flags, u.cert_subj, j.jobid " + "from notif_registrations as n, users as u, notif_jobs as j " + "where (n.notifid='%s') AND (n.userid=u.userid) AND (n.notifid=j.notifid)", notifId); glite_common_log_msg(LOG_CATEGORY_LB_SERVER_DB, LOG_PRIORITY_DEBUG, q); if (edg_wll_ExecSQL(ctx, q, ¬if) < 0) return HTTP_INTERNAL; free(q); q = NULL; @@ -308,6 +308,7 @@ static int getNotifInfo(edg_wll_Context ctx, char *notifId, notifInfo *ni){ parseJobQueryRec(ctx, notifc[2], strlen(notifc[2]), &(ni->conditions)); ni->flags = atoi(notifc[3]); ni->owner = notifc[4]; + ni->jobid = notifc[5]; } else { retval = HTTP_UNAUTH; @@ -339,6 +340,7 @@ static void freeNotifInfo(notifInfo *ni){ } if (ni->conditions_text) free(ni->conditions_text); if (ni->owner) free(ni->owner); + if (ni->jobid) free(ni->jobid); } static int getJobsRSS(edg_wll_Context ctx, char *feedType, edg_wll_JobStat **statesOut){ diff --git a/org.glite.lb.server/src/lb_proto.h b/org.glite.lb.server/src/lb_proto.h index 3d29d94..b55f59b 100644 --- a/org.glite.lb.server/src/lb_proto.h +++ b/org.glite.lb.server/src/lb_proto.h @@ -47,6 +47,7 @@ typedef struct _notifInfo{ char *conditions_text; int flags; char *owner; + char *jobid; } notifInfo; typedef enum _http_admin_option{