neodash icon indicating copy to clipboard operation
neodash copied to clipboard

#Vulcan 235/(Graph report type)Show customised message or render string response returned from cypher query

Open m-o-n-i-s-h opened this issue 2 years ago • 4 comments

Problem: The issue which we are trying to address is when user searches for the data which is not exists in our db. The graph report type returns a generic message "Query returned no data" message or an empty canvas. So, to address this we have created custom component which is similar to single value report.

Solution The custom component will check the response of the cypher query. If it return valid node data then it prints the graph or else if it is of type string then the value is printed by the custom component. Please refer the below example cypher query.

MATCH (n:Movie {title:'SomeRandomMovieOrEmptyString'}) WITH collect(n) as nodes UNWIND (CASE nodes WHEN [] THEN [NULL] ELSE nodes END) AS m RETURN coalesce(m, "No results")

The result from this query is used and displayed to user. In this way, we could show the users a customized message instead of generic message.

Screenshots SingleValueComponent

NOTICE:
 The program was tested solely for our own use cases, which might differ from yours.

Author Info: Monish [email protected] on behalf of Mercedes-Benz Research and Development India https://github.com/mercedes-benz/mercedes-benz-foss/blob/master/PROVIDER_INFORMATION.md

m-o-n-i-s-h avatar Sep 26 '23 14:09 m-o-n-i-s-h

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

sonarqubecloud[bot] avatar Sep 26 '23 14:09 sonarqubecloud[bot]

Hi @m-o-n-i-s-h , thank you for helping the project? One question: isn't this clashing with the Override Query return no data option inside the advanced options of each report?

alfredorubin96 avatar May 02 '24 12:05 alfredorubin96

@alfredorubin96 True in a way but we are trying to render a whole new component like below. This implementation works only for Graph. image

The existing implementation works for all the reports. Screenshot 2024-05-03 at 3 52 40 PM

NOTICE:
 The program was tested solely for our own use cases, which might differ from yours.

Author Info: Monish [email protected] on behalf of Mercedes-Benz Research and Development India https://github.com/mercedes-benz/mercedes-benz-foss/blob/master/PROVIDER_INFORMATION.md

m-o-n-i-s-h avatar May 03 '24 10:05 m-o-n-i-s-h

Quality Gate Failed Quality Gate failed

Failed conditions
7.1% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

sonarqubecloud[bot] avatar May 03 '24 10:05 sonarqubecloud[bot]