Skip to content

Commit

Permalink
Fixed bug where editing a duplicated panel might affect the original
Browse files Browse the repository at this point in the history
  • Loading branch information
vereecw committed Jan 7, 2025
1 parent a849abf commit f0cd61e
Showing 1 changed file with 28 additions and 23 deletions.
51 changes: 28 additions & 23 deletions src/QueryEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,12 @@ export class QueryEditor extends Component<Props, QueryEditorState> {

onChangeAssetMeasurementQuery(assetMeasurementQuery: AssetMeasurementQuery): void {
const { onChange, query } = this.props
query.queryType = 'AssetMeasurementQuery'
query.query = assetMeasurementQuery
query.tabIndex = TabIndex.Assets
query.historianInfo = this.historianInfo
onChange(query)
const updatedQuery = JSON.parse(JSON.stringify(query)) as Query
updatedQuery.queryType = 'AssetMeasurementQuery'
updatedQuery.query = assetMeasurementQuery
updatedQuery.tabIndex = TabIndex.Assets
updatedQuery.historianInfo = this.historianInfo
onChange(updatedQuery)
this.onRunQuery(this.props)
this.setState({
...this.state,
Expand All @@ -138,11 +139,12 @@ export class QueryEditor extends Component<Props, QueryEditorState> {

onChangeMeasurementQuery(measurementQuery: MeasurementQuery): void {
const { onChange, query } = this.props
query.queryType = 'MeasurementQuery'
query.query = measurementQuery
query.tabIndex = TabIndex.Measurements
query.historianInfo = this.historianInfo
onChange(query)
const updatedQuery = JSON.parse(JSON.stringify(query)) as Query
updatedQuery.queryType = 'MeasurementQuery'
updatedQuery.query = measurementQuery
updatedQuery.tabIndex = TabIndex.Measurements
updatedQuery.historianInfo = this.historianInfo
onChange(updatedQuery)
this.onRunQuery(this.props)
this.setState({
...this.state,
Expand All @@ -152,11 +154,12 @@ export class QueryEditor extends Component<Props, QueryEditorState> {

onChangeRawQuery(rawQuery: RawQuery): void {
const { onChange, query } = this.props
query.queryType = 'RawQuery'
query.query = rawQuery
query.tabIndex = TabIndex.RawQuery
query.historianInfo = this.historianInfo
onChange(query)
const updatedQuery = JSON.parse(JSON.stringify(query)) as Query
updatedQuery.queryType = 'RawQuery'
updatedQuery.query = rawQuery
updatedQuery.tabIndex = TabIndex.RawQuery
updatedQuery.historianInfo = this.historianInfo
onChange(updatedQuery)
this.onRunQuery(this.props)
this.setState({
...this.state,
Expand All @@ -166,11 +169,12 @@ export class QueryEditor extends Component<Props, QueryEditorState> {

onChangeEventQuery(eventQuery: EventQuery): void {
const { onChange, query } = this.props
query.queryType = 'EventQuery'
query.query = eventQuery
query.tabIndex = TabIndex.Events
query.historianInfo = this.historianInfo
onChange(query)
const updatedQuery = JSON.parse(JSON.stringify(query)) as Query
updatedQuery.queryType = 'EventQuery'
updatedQuery.query = eventQuery
updatedQuery.tabIndex = TabIndex.Events
updatedQuery.historianInfo = this.historianInfo
onChange(updatedQuery)
this.onRunQuery(this.props)
this.setState({
...this.state,
Expand All @@ -180,9 +184,10 @@ export class QueryEditor extends Component<Props, QueryEditorState> {

onChangeSeriesLimit(value: number): void {
const { onChange, query } = this.props
query.seriesLimit = value
query.historianInfo = this.historianInfo
onChange(query)
const updatedQuery = JSON.parse(JSON.stringify(query)) as Query
updatedQuery.seriesLimit = value
updatedQuery.historianInfo = this.historianInfo
onChange(updatedQuery)
this.onRunQuery(this.props)
}

Expand Down

0 comments on commit f0cd61e

Please sign in to comment.