fix(ui) - dashbaord fixes

This commit is contained in:
Shekar Siri 2022-04-19 12:18:27 +02:00
parent 55f0ff1ad5
commit 7f7a7e70cc
4 changed files with 6 additions and 4 deletions

View file

@ -23,7 +23,9 @@ function DashboardModal(props) {
const onSave = () => {
dashboardStore.save(dashboard).then(hideModal).then(() => {
dashboardStore.fetch(dashboard.dashboardId)
if (dashboard.exists()) {
dashboardStore.fetch(dashboard.dashboardId)
}
})
}

View file

@ -13,7 +13,6 @@ import { getStartAndEndTimestampsByDensity } from 'Types/dashboard/helper';
interface Props {
metric: any;
isWidget?: boolean
onClick?: () => void;
}
function WidgetChart(props: Props) {
const { isWidget = false, metric } = props;

View file

@ -69,7 +69,7 @@ function WidgetWrapper(props: Props) {
const onChartClick = () => {
if (!isWidget || isPredefined) return;
props.history.push(withSiteId(dashboardMetricDetails(dashboardId, widget.metricId),siteId));
props.history.push(withSiteId(dashboardMetricDetails(dashboard?.dashboardId, widget.metricId),siteId));
}
const ref: any = useRef(null)

View file

@ -222,6 +222,7 @@ export default class DashboardStore implements IDashboardSotre {
if (isCreating) {
toast.success('Dashboard created successfully')
this.addDashboard(_dashboard)
console.log('_dashboard', _dashboard)
} else {
toast.success('Dashboard updated successfully')
this.updateDashboard(_dashboard)
@ -295,7 +296,7 @@ export default class DashboardStore implements IDashboardSotre {
}
addDashboard(dashboard: Dashboard) {
this.dashboards.push(dashboard)
this.dashboards.push(new Dashboard().fromJson(dashboard))
}
removeDashboard(dashboard: Dashboard) {