-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat: Add data panel to display object related data fetched via Cloud Function #2584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 11 commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
0c4acab
initial commit for aggreation side panel
vardhan0604 16b8519
updates
vardhan0604 26bb6c8
Merge branch 'alpha' of https://github.com/parse-community/parse-dash…
vardhan0604 c32afca
Merge branch 'parse-community:alpha' into 2495
vardhan0604 4f92208
Merge branch '2495' of https://github.com/vardhan0604/parse-dashboard…
vardhan0604 152e22b
fix lint
vardhan0604 775f98e
fixed max resize constraint on the side panel
vardhan0604 59e01a8
fixed resize handler
vardhan0604 a093048
fixed resize handler bug
vardhan0604 7cc202c
fix side panel overflow
vardhan0604 9301db6
Merge branch 'alpha' into 2495
mtrezza 082bdd5
Merge branch 'alpha' of https://github.com/parse-community/parse-dash…
vardhan0604 0889527
fixing issues
vardhan0604 b9ca3fc
Merge branch '2495' of https://github.com/vardhan0604/parse-dashboard…
vardhan0604 5d714aa
fixing linting issues
vardhan0604 1f6b36c
fixing get
vardhan0604 4ec1c68
removed unwanted changes
vardhan0604 b07bf28
update react-draggable and react-resizable version
vardhan0604 70b4353
fix issues
vardhan0604 26e4d95
add loading feature
vardhan0604 5c3bcee
Merge branch 'alpha' into 2495
mtrezza d153425
update
vardhan0604 34037b1
Merge branch 'alpha' of https://github.com/parse-community/parse-dash…
vardhan0604 4ba8c2f
Merge branch '2495' of https://github.com/vardhan0604/parse-dashboard…
vardhan0604 35fdbb7
update
vardhan0604 20e4135
Update src/dashboard/Data/Browser/Browser.react.js
vardhan0604 8c4e68f
fixed issues
vardhan0604 081434d
Merge branch '2495' of https://github.com/vardhan0604/parse-dashboard…
vardhan0604 2322b5d
Merge branch 'alpha' into 2495
mtrezza 1bd146f
fixed bugs
vardhan0604 1d4dcd2
Merge branch '2495' of https://github.com/vardhan0604/parse-dashboard…
vardhan0604 13e8e26
fix lint
vardhan0604 bde2c47
Fixed all required bugs
vardhan0604 f7fe82b
fix lint
vardhan0604 3d87049
Merge branch 'alpha' into 2495
mtrezza db8eff2
shorten panel text
mtrezza 5a614bd
add panel shadow
mtrezza ac64604
soften panel shadow
mtrezza 9bd827e
minor style adjustments
mtrezza a498be9
add background color
mtrezza 87881d5
prevent sidebar selection
mtrezza f6f8990
min panel width 100
mtrezza ffc683b
button style
mtrezza e91ea1b
Merge branch 'alpha' of https://github.com/parse-community/parse-dash…
vardhan0604 28d6349
fix reorder bug
vardhan0604 32967a9
Merge branch '2495' of https://github.com/vardhan0604/parse-dashboard…
vardhan0604 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React from 'react'; | ||
import { | ||
TextElement, | ||
KeyValueElement, | ||
TableElement, | ||
ImageElement, | ||
VideoElement, | ||
AudioElement, | ||
ButtonElement, | ||
} from './AggregationPanelComponents'; | ||
import styles from './AggregationPanel.scss'; | ||
const AggregationPanel = ({ data }) => { | ||
console.log('data aggregation panel', data); | ||
vardhan0604 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return ( | ||
<> | ||
{Object.keys(data).length !== 0 ? ( | ||
data.panel.segments.map((segment, index) => ( | ||
<div key={index}> | ||
<h2 className={styles.heading}>{segment.title}</h2> | ||
<div className={styles.segmentItems}> | ||
{segment.items.map((item, idx) => { | ||
switch (item.type) { | ||
case 'text': | ||
return <TextElement key={idx} text={item.text} />; | ||
case 'keyValue': | ||
return <KeyValueElement key={idx} item={item} />; | ||
case 'table': | ||
return <TableElement key={idx} columns={item.columns} rows={item.rows} />; | ||
case 'image': | ||
return <ImageElement key={idx} url={item.url} />; | ||
case 'video': | ||
return <VideoElement key={idx} url={item.url} />; | ||
case 'audio': | ||
return <AudioElement key={idx} url={item.url} />; | ||
case 'button': | ||
return <ButtonElement key={idx} item={item} />; | ||
default: | ||
return null; | ||
} | ||
})} | ||
</div> | ||
</div> | ||
)) | ||
) : ( | ||
<div className={styles.loading}>No object selected. Select an object</div> | ||
vardhan0604 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
)} | ||
</> | ||
); | ||
}; | ||
|
||
export default AggregationPanel; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
@import 'stylesheets/globals.scss'; | ||
|
||
.heading{ | ||
font-size: 18px; | ||
margin-bottom: 15px; | ||
margin-top: 0; | ||
padding: 6px; | ||
padding-left: 10px; | ||
background-color: $blue; | ||
color: $white; | ||
} | ||
|
||
.segmentItems{ | ||
padding-left: 10px; | ||
padding-right: 10px; | ||
display: flex; | ||
flex-direction: column; | ||
gap: 10px; | ||
} | ||
|
||
.keyValue{ | ||
display: flex; | ||
gap: 36px; | ||
} | ||
|
||
.video{ | ||
width: 100%; | ||
height: 100%; | ||
} | ||
.image{ | ||
width: 100%; | ||
height: 100%; | ||
} | ||
|
||
.audio{ | ||
width: 100%; | ||
} | ||
|
||
.segmentItems table, .segmentItems th, .segmentItems td { | ||
border: 1px solid #ddd; | ||
} | ||
.segmentItems th, .segmentItems td { | ||
padding: 8px; | ||
text-align: left; | ||
} | ||
|
||
.button{ | ||
display: block; | ||
width: 100%; | ||
padding: 10px; | ||
background-color: #007BFF; | ||
color: #fff; | ||
border: none; | ||
cursor: pointer; | ||
margin-bottom: 15px; | ||
} | ||
|
||
.loading{ | ||
height: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
text-align: center; | ||
} |
87 changes: 87 additions & 0 deletions
87
src/components/AggregationPanel/AggregationPanelComponents.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import React from 'react'; | ||
import styles from './AggregationPanel.scss'; | ||
// Text Element Component | ||
export const TextElement = ({ text }) => ( | ||
<div className="text-element"> | ||
<p>{text}</p> | ||
</div> | ||
); | ||
|
||
// Key-Value Element Component | ||
export const KeyValueElement = ({ item }) => ( | ||
<div className={styles.keyValue}> | ||
<strong>{item.key}:</strong> | ||
{item.url ? <a href={item.url}>{item.value}</a> : <span>{item.value}</span>} | ||
</div> | ||
); | ||
|
||
// Table Element Component | ||
export const TableElement = ({ columns, rows }) => ( | ||
<div className="table-element"> | ||
<table> | ||
<thead> | ||
<tr> | ||
{columns.map((column, idx) => ( | ||
<th key={idx}>{column.name}</th> | ||
))} | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{rows.map((row, idx) => ( | ||
<tr key={idx}> | ||
{columns.map((column, colIdx) => ( | ||
<td key={colIdx}>{row[column.name]}</td> | ||
))} | ||
</tr> | ||
))} | ||
</tbody> | ||
</table> | ||
</div> | ||
); | ||
|
||
// Image Element Component | ||
export const ImageElement = ({ url }) => ( | ||
<div className="image-element"> | ||
<img src={url} alt="Image" className={styles.image}/> | ||
</div> | ||
); | ||
|
||
// Video Element Component | ||
export const VideoElement = ({ url }) => ( | ||
<div className="video-element"> | ||
<video controls className={styles.video}> | ||
<source src={url} type="video/mp4" /> | ||
Your browser does not support the video tag. | ||
</video> | ||
</div> | ||
); | ||
|
||
// Audio Element Component | ||
export const AudioElement = ({ url }) => ( | ||
<div className="audio-element"> | ||
<audio controls className={styles.audio}> | ||
<source src={url} type="audio/mpeg" /> | ||
Your browser does not support the audio element. | ||
</audio> | ||
</div> | ||
); | ||
|
||
// Button Element Component | ||
export const ButtonElement = ({ item }) => { | ||
const handleClick = () => { | ||
fetch(item.action.url, { | ||
method: item.action.method, | ||
headers: item.action.headers, | ||
body: JSON.stringify(item.action.body), | ||
}) | ||
.then(response => response.json()) | ||
.then(data => console.log(data)) | ||
.catch(error => console.error('Error:', error)); | ||
vardhan0604 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; | ||
|
||
return ( | ||
<div className="button-element"> | ||
<button onClick={handleClick} className={styles.button}>{item.text}</button> | ||
</div> | ||
); | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.