Open mtrezza opened 1 year ago
@Bhavyajain21 this may be interesting for you
@mtrezza From my understanding, the process involves:
can you define how the response from the Cloud Function should look? This will ensure consistency and make it easier to render the information in the panel.
Thank you!
I have updated the JSON response structure in the description above. The panel would structurally look like this (albeit in the style of the screenshot above, so it fits the dashboard style), where each element is a row:
For reference the HTML code of the render above as an example:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Panel Example</title>
<style>
body {
font-family: Arial, sans-serif;
}
.panel {
width: 300px;
border: 1px solid #ccc;
padding: 15px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
margin: 0 auto;
}
.panel h2 {
font-size: 18px;
margin-bottom: 15px;
}
.panel table {
width: 100%;
border-collapse: collapse;
margin-bottom: 15px;
}
.panel table, .panel th, .panel td {
border: 1px solid #ddd;
}
.panel th, .panel td {
padding: 8px;
text-align: left;
}
.panel button {
display: block;
width: 100%;
padding: 10px;
background-color: #007BFF;
color: #fff;
border: none;
cursor: pointer;
margin-bottom: 15px;
}
.panel button:hover {
background-color: #0056b3;
}
.panel img, .panel video, .panel audio {
width: 100%;
margin-bottom: 15px;
}
.key-value {
margin-bottom: 15px;
}
.key-value a {
color: #007BFF;
text-decoration: none;
}
</style>
</head>
<body>
<div class="panel">
<h2>Purchases</h2>
<!-- Text Element -->
<div class="text-element">
<p>This user has a high churn risk!</p>
</div>
<!-- Key-Value Element -->
<div class="key-value">
<strong>Lifetime purchase value:</strong> $10k
</div>
<!-- Key-Value with Link Element -->
<div class="key-value">
<strong>Last purchase ID:</strong>
<a href="https://example.com/purchaseDetails?purchaseId=012345">012345</a>
</div>
<!-- Table Element -->
<div class="table-element">
<table>
<thead>
<tr>
<th>Name</th>
<th>Age</th>
</tr>
</thead>
<tbody>
<tr>
<td>Alice</td>
<td>30</td>
</tr>
<tr>
<td>Bob</td>
<td>40</td>
</tr>
</tbody>
</table>
</div>
<!-- Image Element -->
<div class="image-element">
<img src="https://example.com/images?purchaseId=012345" alt="Image">
</div>
<!-- Video Element -->
<div class="video-element">
<video controls>
<source src="https://example.com/video.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</div>
<!-- Audio Element -->
<div class="audio-element">
<audio controls>
<source src="https://example.com/audio.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</div>
<!-- Button Element -->
<div class="button-element">
<button onclick="handleButtonClick()">Click me!</button>
</div>
</div>
<script>
function handleButtonClick() {
fetch('https://api.example.com/click', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ key: 'value' })
})
.then(response => response.json())
// Instead of console logging, the response would need to displayed like other messages, there's a pop-up method for this, see for example the "script" feature of dashboard
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
}
</script>
</body>
</html>
Bounty increased due to scope increase of the feature and its high value for the usability of the dashboard.
I have updated the JSON response structure in the description above. The panel would structurally look like this (albeit in the style of the screenshot above, so it fits the dashboard style), where each element is a row:
I have checked the JSON response , I will get started with this feature asap
New Feature / Enhancement Checklist
Current Limitation
An object may have related information stored in other classes, for example a user and its related purchase history and its related payment transactions. This related information needs to be researched manually by going into the respective classes. With each navigation, only the information in the current class is visible, there is no aggregated view of all information at once, e.g. purchase history and payment transactions.
Feature / Enhancement Description
Add a slide-in panel that displays aggregated information related to the selected object in the data browser table.
The process should be:
Example Use Case
Dashboard options could look like this:
The response of the Cloud Function could be:
The panel could look like this:
Alternatives / Workarounds
Future extensions