Shirly Radco has uploaded a new change for review. Change subject: reports: edited ic query-only_hosts_host_type ......................................................................
reports: edited ic query-only_hosts_host_type I edited the, only_hosts_host_type, input control query, so it will be more readable and added comments. Change-Id: Ic42e9313c3ab8ebd66e8f6023343f343e345497d Signed-off-by: Shirly Radco <sra...@redhat.com> --- M packaging/ovirt-reports/resources/reports_resources/JDBC/Input_Controls/Regular_Input_Controls/Only_Hosts/P_Host_Type.xml 1 file changed, 85 insertions(+), 26 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-reports refs/changes/14/25414/1 diff --git a/packaging/ovirt-reports/resources/reports_resources/JDBC/Input_Controls/Regular_Input_Controls/Only_Hosts/P_Host_Type.xml b/packaging/ovirt-reports/resources/reports_resources/JDBC/Input_Controls/Regular_Input_Controls/Only_Hosts/P_Host_Type.xml index 18aac39..b14358d 100644 --- a/packaging/ovirt-reports/resources/reports_resources/JDBC/Input_Controls/Regular_Input_Controls/Only_Hosts/P_Host_Type.xml +++ b/packaging/ovirt-reports/resources/reports_resources/JDBC/Input_Controls/Regular_Input_Controls/Only_Hosts/P_Host_Type.xml @@ -2,10 +2,10 @@ <inputControl> <folder>/reports_resources/JDBC/Input_Controls/Regular_Input_Controls/Only_Hosts</folder> <name>P_Host_Type</name> - <version>26</version> + <version>33</version> <label>$R{ic.host.type}</label> - <creationDate>2013-01-09T15:03:27.041+02:00</creationDate> - <updateDate>2013-01-16T11:50:22.686+02:00</updateDate> + <creationDate>2014-03-05T13:32:54.003+02:00</creationDate> + <updateDate>2014-03-05T14:36:29.045+02:00</updateDate> <type>4</type> <mandatory>true</mandatory> <readOnly>false</readOnly> @@ -17,34 +17,93 @@ <name>Host_Type</name> <version>1</version> <label>Host_Type</label> - <creationDate>2013-01-16T11:50:22.686+02:00</creationDate> - <updateDate>2013-01-16T11:50:22.686+02:00</updateDate> + <creationDate>2014-03-05T14:36:29.045+02:00</creationDate> + <updateDate>2014-03-05T14:36:29.045+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 +-- localized in session language. + +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' + ) 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 +-- Here we filter the results by the chosen datacenter +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 ) +) +-- Here we filter the results by the chosen cluster +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 +-- This will determine if deleted entities will be included in the report, +-- according to the user selection for "is_deleted" parameter $P!{active_hosts_select} + UNION -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) + +-- Here we add the "All" option to the select list, +-- as the first option. +-- The value is localized according to the session language. +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 +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> -- To view, visit http://gerrit.ovirt.org/25414 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic42e9313c3ab8ebd66e8f6023343f343e345497d 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