Shirly Radco has uploaded a new change for review. Change subject: reports: edited ic query-host_type ......................................................................
reports: edited ic query-host_type I edited the, host_type, input control query, so it will be more readable and added comments. Change-Id: I133e38b83976c318a45f550c2aaccd0ee30ada97 Signed-off-by: Shirly Radco <sra...@redhat.com> --- M packaging/ovirt-reports/resources/reports_resources/JDBC/Input_Controls/Period_Affected/single_select/host_ic/P_Host_Type.xml 1 file changed, 106 insertions(+), 39 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-reports refs/changes/94/25294/1 diff --git a/packaging/ovirt-reports/resources/reports_resources/JDBC/Input_Controls/Period_Affected/single_select/host_ic/P_Host_Type.xml b/packaging/ovirt-reports/resources/reports_resources/JDBC/Input_Controls/Period_Affected/single_select/host_ic/P_Host_Type.xml index 39c50b7..e858ecd 100644 --- a/packaging/ovirt-reports/resources/reports_resources/JDBC/Input_Controls/Period_Affected/single_select/host_ic/P_Host_Type.xml +++ b/packaging/ovirt-reports/resources/reports_resources/JDBC/Input_Controls/Period_Affected/single_select/host_ic/P_Host_Type.xml @@ -2,10 +2,10 @@ <inputControl> <folder>/reports_resources/JDBC/Input_Controls/Period_Affected/single_select/host_ic</folder> <name>P_Host_Type</name> - <version>26</version> + <version>28</version> <label>$R{ic.host.type}</label> - <creationDate>2013-01-09T15:03:35.593+02:00</creationDate> - <updateDate>2013-01-16T11:27:42.190+02:00</updateDate> + <creationDate>2014-03-03T12:38:20.004+02:00</creationDate> + <updateDate>2014-03-04T08:31:31.744+02:00</updateDate> <type>4</type> <mandatory>true</mandatory> <readOnly>false</readOnly> @@ -17,45 +17,112 @@ <name>Host_Type</name> <version>1</version> <label>Host_Type</label> - <creationDate>2013-01-16T11:27:42.190+02:00</creationDate> - <updateDate>2013-01-16T11:27:42.190+02:00</updateDate> + <creationDate>2014-03-04T08:31:31.744+02:00</creationDate> + <updateDate>2014-03-04T08:31:31.744+02:00</updateDate> <language>sql</language> - <queryString>SELECT DISTINCT coalesce(enum_translator_localized.value_localized,enum_translator_default.value) as value, enum_translator_default.enum_key, 0 as sort -FROM enum_translator as enum_translator_default - LEFT OUTER JOIN (SELECT enum_type, enum_key, value as value_localized - FROM enum_translator - WHERE language_code = $P{userlocale}) as enum_translator_localized ON (enum_translator_localized.enum_type = enum_translator_default.enum_type AND enum_translator_localized.enum_key = enum_translator_default.enum_key) - INNER JOIN v3_4_configuration_history_hosts ON (v3_4_configuration_history_hosts.host_type = enum_translator_default.enum_key AND enum_translator_default.enum_type = 'HOST_TYPE') + <queryString>-- This query will return the Host Types list according to the datacenter that was chosen, +-- as well as the "All" option". + +SELECT DISTINCT + COALESCE ( + enum_translator_localized.value_localized, + enum_translator_default.value + ) + AS value, + enum_translator_default.enum_key, + 0 AS sort +FROM enum_translator AS enum_translator_default + LEFT OUTER JOIN ( + SELECT + enum_type, + enum_key, + value AS value_localized + FROM enum_translator + WHERE language_code = $P{P_Locale} + ) + AS enum_translator_localized + ON ( + enum_translator_localized.enum_type = + enum_translator_default.enum_type + AND enum_translator_localized.enum_key = + enum_translator_default.enum_key + ) + INNER JOIN v3_4_configuration_history_hosts + ON ( + v3_4_configuration_history_hosts.host_type = + enum_translator_default.enum_key + AND enum_translator_default.enum_type = 'HOST_TYPE' + ) WHERE enum_translator_default.language_code = 'en_US' - AND v3_4_configuration_history_hosts.cluster_id in (SELECT v3_4_configuration_history_clusters.cluster_id - FROM v3_4_configuration_history_clusters - WHERE v3_4_configuration_history_clusters.datacenter_id = cast($P{P_DataCenter_ID} as uuid)) - AND v3_4_configuration_history_hosts.cluster_id = CASE $P{P_Cluster_ID} - WHEN '11111111-1111-1111-1111-111111111111' THEN v3_4_configuration_history_hosts.cluster_id - ELSE cast($P{P_Cluster_ID} as uuid) - END - AND history_id in (SELECT max(a.history_id) - FROM v3_4_configuration_history_hosts a - GROUP BY a.host_id) - AND create_date <= CASE - WHEN $P{P_Period} = 0 THEN CAST($P{P_Start_Date} as TIMESTAMP) + interval '1 day' - WHEN $P{P_Period} = 1 THEN CAST($P{P_Start_Date} as TIMESTAMP) + interval '1 month' - WHEN $P{P_Period} = 2 THEN CAST($P{P_Start_Date} as TIMESTAMP) + interval '3 month' - WHEN $P{P_Period} = 3 THEN CAST($P{P_Start_Date} as TIMESTAMP) + interval '1 year' - END - AND (delete_date IS NULL OR delete_date >= CAST($P{P_Start_Date} as TIMESTAMP)) - $P!{is_deleted} +AND v3_4_configuration_history_hosts.cluster_id IN ( + SELECT v3_4_configuration_history_clusters.cluster_id + FROM v3_4_configuration_history_clusters + WHERE + v3_4_configuration_history_clusters.datacenter_id = + CAST ( $P{P_DataCenter_ID} AS uuid ) +) +AND v3_4_configuration_history_hosts.cluster_id = + CASE $P{P_Cluster_ID} + WHEN '11111111-1111-1111-1111-111111111111' + THEN v3_4_configuration_history_hosts.cluster_id + ELSE CAST ( $P{P_Cluster_ID} AS uuid ) + END +AND history_id IN ( + SELECT MAX ( a.history_id ) + FROM v3_4_configuration_history_hosts a + GROUP BY a.host_id +) +AND create_date <= + CASE + WHEN $P{P_Period} = 0 + THEN CAST ( $P{P_Start_Date} AS timestamp ) + interval '1 day' + WHEN $P{P_Period} = 1 + THEN CAST ( $P{P_Start_Date} AS timestamp ) + interval '1 month' + WHEN $P{P_Period} = 2 + THEN CAST ( $P{P_Start_Date} AS timestamp ) + interval '3 month' + WHEN $P{P_Period} = 3 + THEN CAST ( $P{P_Start_Date} AS timestamp ) + interval '1 year' + END +AND ( + delete_date IS NULL + OR + delete_date >= CAST ( $P{P_Start_Date} AS TIMESTAMP ) +) +-- This will determine if deleted entities will be included in the report, +-- according to the user selection for "is_deleted" parameter +$P!{is_deleted} + UNION ALL -SELECT DISTINCT coalesce(enum_translator_localized.value_localized,enum_translator_default.value) as value, -1, 1 - FROM enum_translator as enum_translator_default - LEFT OUTER JOIN (SELECT enum_type, enum_key, value as value_localized - FROM enum_translator - WHERE language_code = $P{userlocale}) as enum_translator_localized ON (enum_translator_localized.enum_type = enum_translator_default.enum_type AND enum_translator_localized.enum_key = enum_translator_default.enum_key) - WHERE language_code = 'en_US' - AND enum_translator_default.enum_type = 'REPORTS_ALL' - AND enum_translator_default.enum_key = 0 -ORDER BY sort DESC, value -</queryString> + +-- Adding to the hosts list the "All" as the first option in the select list. +SELECT DISTINCT + COALESCE ( + enum_translator_localized.value_localized, + enum_translator_default.value + ) + AS value, + -1, + 1 +FROM enum_translator AS enum_translator_default + LEFT OUTER JOIN ( + SELECT + enum_type, + enum_key, + value AS value_localized + FROM enum_translator + WHERE language_code = $P{P_Locale} + ) + AS enum_translator_localized + ON ( + enum_translator_localized.enum_type = + enum_translator_default.enum_type + AND enum_translator_localized.enum_key = + enum_translator_default.enum_key + ) +WHERE language_code = 'en_US' +AND enum_translator_default.enum_type = 'REPORTS_ALL' +AND enum_translator_default.enum_key = 0 +ORDER BY sort DESC, value</queryString> <dataSource> <uri>/reports_resources/JDBC/data_sources/ovirt</uri> </dataSource> -- To view, visit http://gerrit.ovirt.org/25294 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I133e38b83976c318a45f550c2aaccd0ee30ada97 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-reports Gerrit-Branch: master Gerrit-Owner: Shirly Radco <sra...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches