@include("../commons/styles.html") @include("../commons/images.html") @args() { List> items List> groupitems List> locitems Map info Locale locale String date_column String fromDate String toDate List> migrations List> replications } @returnIf(items == null) @*Queries: * [ * { * "paramName" : "items", * "query" : [ * "SELECT", * "count(*) as total,", * "count(case when state in ('0') then 1 else null end) as successful,", * "count(case when state in ('1') then 1 else null end) as warning,", * "count(case when state in ('3', 'c') then 1 else null end) as cancelled,", * "count(case when state in ('2', 'd', 'X') then 1 else null end) as error,", * "count(case when state in ('a') then 1 else null end) as active,", * "count(case when state in ('q') then 1 else null end) as queued,", * "count(case when state in ('w', 'W') then 1 else null end) as waiting", * "FROM", * "results", * "WHERE", * "@(dateRange:@(date_column))", * "@if(location_id != null) {", * "AND", * "client_id in (WITH RECURSIVE children(id) AS (SELECT l.id FROM locations l WHERE l.id=@(location_id)", * "UNION ALL SELECT l.id from children c,locations l where l.parent=c.id) SELECT * FROM children)", * "}", * "AND", * "backup_type is not NULL", * "AND", * "fdi_type in ('F','C','I','D')", * "AND", * "original_saveset is NULL", * "AND", * "saveset not like 'V%'" * ] * }, * { * "paramName" : "groupitems", * "query" : [ * "SELECT", * "count(*) as total,", * "count(case when state in ('0') then 1 else null end) as successful,", * "count(case when state in ('1') then 1 else null end) as warning,", * "count(case when state in ('3', 'c') then 1 else null end) as cancelled,", * "count(case when state in ('2', 'd', 'X') then 1 else null end) as error,", * "count(case when state in ('a') then 1 else null end) as active,", * "count(case when state in ('q') then 1 else null end) as queued,", * "count(case when state in ('w', 'W') then 1 else null end) as waiting", * "FROM", * "results", * "WHERE", * "@(dateRange:@(date_column))", * "AND", * "backup_type is not NULL", * "AND", * "fdi_type in ('GF','GC','GI','GD')", * "AND", * "original_saveset is NULL", * "AND", * "saveset not like 'V%'" * ] * }, * { * "paramName" : "locitems", * "condition" : [ * "@returnIf(location_id == null)" * ], * "query" : [ * "SELECT", * "name", * "FROM", * "locations", * "WHERE", * "id", * "IN", * "(WITH RECURSIVE children(id) AS (SELECT l.id FROM locations l WHERE l.id=@(location_id)", * "UNION ALL SELECT l.id from children c,locations l where l.parent=c.id) SELECT * FROM children)" * ] * }, * { * "paramName" : "migrations", * "query" : [ * "SELECT", * "count(*) as total,", * "count(case when state in ('0') then 1 else null end) as successful,", * "count(case when state in ('1') then 1 else null end) as warning,", * "count(case when state in ('3', 'c') then 1 else null end) as cancelled,", * "count(case when state in ('2', 'd', 'X') then 1 else null end) as error,", * "count(case when state in ('a') then 1 else null end) as active,", * "count(case when state in ('q') then 1 else null end) as queued,", * "count(case when state in ('w', 'W') then 1 else null end) as waiting", * "FROM", * "migration_results", * "WHERE", * "@(dateRange:@(date_column))", * "@if(location_id != null) {", * "AND", * "client_id in (WITH RECURSIVE children(id) AS (SELECT l.id FROM locations l WHERE l.id=@(location_id)", * "UNION ALL SELECT l.id from children c,locations l where l.parent=c.id) SELECT * FROM children)", * "}", * "AND", * "replication_type = 'SEP Migration'" * ] * }, * { * "paramName" : "replications", * "query" : [ * "SELECT", * "count(*) as total,", * "count(case when state in ('0') then 1 else null end) as successful,", * "count(case when state in ('1') then 1 else null end) as warning,", * "count(case when state in ('3', 'c') then 1 else null end) as cancelled,", * "count(case when state in ('2', 'd', 'X') then 1 else null end) as error,", * "count(case when state in ('a') then 1 else null end) as active,", * "count(case when state in ('q') then 1 else null end) as queued,", * "count(case when state in ('w', 'W') then 1 else null end) as waiting", * "FROM", * "migration_results", * "WHERE", * "@(dateRange:@(date_column))", * "@if(location_id != null) {", * "AND", * "client_id in (WITH RECURSIVE children(id) AS (SELECT l.id FROM locations l WHERE l.id=@(location_id)", * "UNION ALL SELECT l.id from children c,locations l where l.parent=c.id) SELECT * FROM children)", * "}", * "AND", * "replication_type = 'SEP Si3 Replication'" * ] * } * ] *@ @include("../commons/tags.html") @include("../commons/functions.html") @// Collect the data to show in the single tables @{ List> sections = new ArrayList<>(); Map section = new HashMap<>(); section.put("data", items.get(0)); section.put("base", "StatTask"); sections.add(section); if (locitems == null) { section = new HashMap<>(); section.put("data", groupitems.get(0)); section.put("base", "StatGroup"); sections.add(section); } section = new HashMap<>(); section.put("data", migrations.get(0)); section.put("base", "StatMigration"); sections.add(section); section = new HashMap<>(); section.put("data", replications.get(0)); section.put("base", "StatReplication"); sections.add(section); } @// determine the color decoration for title box @{ int warning = 0; int error = 0; for (Map candidate : sections) { Map d = (Map) candidate.get("data"); Object o = d.get("warning"); if (o instanceof Integer) { warning += (Integer) o; } o = d.get("cancelled"); if (o instanceof Integer) { warning += (Integer) o; } o = d.get("error"); if (o instanceof Integer) { error += (Integer) o; } } String titleClass = "sep-title-ok"; if (warning > 0) { titleClass = "sep-title-warning"; } if (error > 0) { titleClass = "sep-title-error"; } } @sepReportHeader("Report") @sepTitleBox("Title", sepFnGetToday(locale), titleClass) @if (date_column == "sesam_date") { @sepDateRangeLabel(sepFnGetDate(sepFnStringToDate(fromDate), locale), sepFnGetDate(sepFnStringToDate(toDate), locale), date_column) } else { @sepDateRangeLabel(sepFnGetDateLong(sepFnStringToDate(fromDate), locale), sepFnGetDateLong(sepFnStringToDate(toDate), locale), date_column) }

@// if this is a location based report, insert information about location @if (locitems != null) {

@i18n("Location.list")

    @for (Map locitem : locitems) {
  • @(locitem.get("name"))
  • }
} @{ Map item = null; String base = null; } @for (Map candidate : sections) { @{ item = (Map) candidate.get("data"); base = (String) candidate.get("base"); }

@i18n(base + ".Title")

@i18n(base + ".success") @(item.get("successful"))
@i18n(base + ".warn") @(item.get("warning"))
@i18n(base + ".cancel") @(item.get("cancelled"))
@i18n(base + ".error") @(item.get("error"))
@i18n(base + ".active") @(item.get("active"))
@i18n(base + ".queue") @(item.get("queued"))
@i18n(base + ".wait") @(item.get("waiting"))
@i18n(base + ".all") @(item.get("total"))

}