|
|
|
@ -88,7 +88,7 @@ export class PanelChrome extends PureComponent<Props, State> { |
|
|
|
|
onAnnotationCreate: this.onAnnotationCreate, |
|
|
|
|
onAnnotationUpdate: this.onAnnotationUpdate, |
|
|
|
|
onAnnotationDelete: this.onAnnotationDelete, |
|
|
|
|
canAddAnnotations: () => Boolean(props.dashboard.meta.canEdit || props.dashboard.meta.canMakeEditable), |
|
|
|
|
canAddAnnotations: this.canAddAnnotation, |
|
|
|
|
onInstanceStateChange: this.onInstanceStateChange, |
|
|
|
|
onToggleLegendSort: this.onToggleLegendSort, |
|
|
|
|
canEditAnnotations: this.canEditAnnotation, |
|
|
|
@ -98,6 +98,17 @@ export class PanelChrome extends PureComponent<Props, State> { |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
canEditDashboard = () => Boolean(this.props.dashboard.meta.canEdit || this.props.dashboard.meta.canMakeEditable); |
|
|
|
|
|
|
|
|
|
canAddAnnotation = () => { |
|
|
|
|
let canAdd = true; |
|
|
|
|
|
|
|
|
|
if (contextSrv.accessControlEnabled()) { |
|
|
|
|
canAdd = !!this.props.dashboard.meta.annotationsPermissions?.dashboard.canAdd; |
|
|
|
|
} |
|
|
|
|
return canAdd && this.canEditDashboard(); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
canEditAnnotation = (dashboardId: number) => { |
|
|
|
|
let canEdit = true; |
|
|
|
|
|
|
|
|
@ -108,7 +119,7 @@ export class PanelChrome extends PureComponent<Props, State> { |
|
|
|
|
canEdit = !!this.props.dashboard.meta.annotationsPermissions?.organization.canEdit; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return canEdit && Boolean(this.props.dashboard.meta.canEdit || this.props.dashboard.meta.canMakeEditable); |
|
|
|
|
return canEdit && this.canEditDashboard(); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
canDeleteAnnotation = (dashboardId: number) => { |
|
|
|
@ -121,7 +132,7 @@ export class PanelChrome extends PureComponent<Props, State> { |
|
|
|
|
canDelete = !!this.props.dashboard.meta.annotationsPermissions?.organization.canDelete; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return canDelete && Boolean(this.props.dashboard.meta.canEdit || this.props.dashboard.meta.canMakeEditable); |
|
|
|
|
return canDelete && this.canEditDashboard(); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// Due to a mutable panel model we get the sync settings via function that proactively reads from the model
|
|
|
|
|