Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions example.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@
<body>
<!-- chart-id needs to be inside of Workspace `-est` because variables.ts names that workspace via `PLACEHOLDER_WORKSPACE_ID` -->
<!-- api-key works with a Dashboard auth token -->
<astra-composed-chart
api-key="[redacted]"
header="My Favorite Chart"
subheader="Don't tell the others"
chart-id="3a13754e-d98f-49f6-905f-ee921dd396ba"
/>
<astra-composed-chart header="New Chart" api-key="12345" chart-id="03859be3-5278-4122-beec-7210a3c39354" filter-time="'7 pm'" />
</body>
</html>
14 changes: 14 additions & 0 deletions src/components/charts/chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ export default class AstraChart extends ClassifiedElement {
'x-chart-api-key': apiKey,
'content-type': 'application/json',
},
body: JSON.stringify({
filters: {
time: { type: 'search', value: "'9 years'" },
},
}),
})
return response.json()
} catch (err) {
Expand Down Expand Up @@ -262,6 +267,15 @@ export default class AstraChart extends ClassifiedElement {
override updated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void {
super.updated(_changedProperties)

// Iterating through attributes to find those with the 'filter-' prefix
Array.from(this.attributes).forEach((attr) => {
if (attr.name.startsWith('filter-')) {
const key = attr.name
const value = attr.value
console.log(`Key: ${key}, Value: ${value}`)
}
})

if (
_changedProperties.has('data') ||
_changedProperties.has('type') ||
Expand Down
2 changes: 1 addition & 1 deletion src/variables.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const OUTERBASE_API_DOMAIN = 'app.outerbase.com'
export const OUTERBASE_API_DOMAIN = 'app.dev.outerbase.com'