|
|
@ -62,9 +62,10 @@ export class InspectDataTab extends PureComponent<Props, State> { |
|
|
|
|
|
|
|
|
|
|
|
// Replace the time field with a formatted time
|
|
|
|
// Replace the time field with a formatted time
|
|
|
|
const { timeIndex, timeField } = getTimeField(dataFrame); |
|
|
|
const { timeIndex, timeField } = getTimeField(dataFrame); |
|
|
|
|
|
|
|
|
|
|
|
if (timeField) { |
|
|
|
if (timeField) { |
|
|
|
// Use the configurd date or standandard time display
|
|
|
|
// Use the configurd date or standandard time display
|
|
|
|
let processor: DisplayProcessor = timeField.display; |
|
|
|
let processor: DisplayProcessor | undefined = timeField.display; |
|
|
|
if (!processor) { |
|
|
|
if (!processor) { |
|
|
|
processor = getDisplayProcessor({ |
|
|
|
processor = getDisplayProcessor({ |
|
|
|
field: timeField, |
|
|
|
field: timeField, |
|
|
@ -78,7 +79,8 @@ export class InspectDataTab extends PureComponent<Props, State> { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const fields = [...dataFrame.fields]; |
|
|
|
const fields = [...dataFrame.fields]; |
|
|
|
fields[timeIndex] = formattedDateField; |
|
|
|
fields[timeIndex!] = formattedDateField; |
|
|
|
|
|
|
|
|
|
|
|
dataFrame = { |
|
|
|
dataFrame = { |
|
|
|
...dataFrame, |
|
|
|
...dataFrame, |
|
|
|
fields, |
|
|
|
fields, |
|
|
@ -100,8 +102,9 @@ export class InspectDataTab extends PureComponent<Props, State> { |
|
|
|
transformId: |
|
|
|
transformId: |
|
|
|
item.value === DataTransformerID.seriesToColumns ? DataTransformerID.seriesToColumns : DataTransformerID.noop, |
|
|
|
item.value === DataTransformerID.seriesToColumns ? DataTransformerID.seriesToColumns : DataTransformerID.noop, |
|
|
|
dataFrameIndex: typeof item.value === 'number' ? item.value : 0, |
|
|
|
dataFrameIndex: typeof item.value === 'number' ? item.value : 0, |
|
|
|
selectedDataFrame: item.value, |
|
|
|
selectedDataFrame: item.value!, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.props.onOptionsChange({ |
|
|
|
this.props.onOptionsChange({ |
|
|
|
...this.props.options, |
|
|
|
...this.props.options, |
|
|
|
}); |
|
|
|
}); |
|
|
@ -127,6 +130,10 @@ export class InspectDataTab extends PureComponent<Props, State> { |
|
|
|
const { options } = this.props; |
|
|
|
const { options } = this.props; |
|
|
|
let data = this.props.data; |
|
|
|
let data = this.props.data; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!data) { |
|
|
|
|
|
|
|
return []; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (this.state.transformId !== DataTransformerID.noop) { |
|
|
|
if (this.state.transformId !== DataTransformerID.noop) { |
|
|
|
data = this.getTransformedData(); |
|
|
|
data = this.getTransformedData(); |
|
|
|
} |
|
|
|
} |
|
|
@ -152,16 +159,21 @@ export class InspectDataTab extends PureComponent<Props, State> { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
getActiveString = () => { |
|
|
|
getActiveString() { |
|
|
|
const { selectedDataFrame } = this.state; |
|
|
|
const { selectedDataFrame } = this.state; |
|
|
|
const { options, data } = this.props; |
|
|
|
const { options, data } = this.props; |
|
|
|
|
|
|
|
|
|
|
|
let activeString = ''; |
|
|
|
let activeString = ''; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!data) { |
|
|
|
|
|
|
|
return activeString; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (selectedDataFrame === DataTransformerID.seriesToColumns) { |
|
|
|
if (selectedDataFrame === DataTransformerID.seriesToColumns) { |
|
|
|
activeString = 'series joined by time'; |
|
|
|
activeString = 'series joined by time'; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
activeString = getFrameDisplayName(data[selectedDataFrame as number]); |
|
|
|
activeString = getFrameDisplayName(data[selectedDataFrame as number]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (options.withTransforms || options.withFieldConfig) { |
|
|
|
if (options.withTransforms || options.withFieldConfig) { |
|
|
|
activeString += ' - applied '; |
|
|
|
activeString += ' - applied '; |
|
|
|
if (options.withTransforms) { |
|
|
|
if (options.withTransforms) { |
|
|
@ -176,10 +188,11 @@ export class InspectDataTab extends PureComponent<Props, State> { |
|
|
|
activeString += 'field configuration'; |
|
|
|
activeString += 'field configuration'; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return activeString; |
|
|
|
return activeString; |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
renderDataOptions = (dataFrames: DataFrame[]) => { |
|
|
|
renderDataOptions(dataFrames: DataFrame[]) { |
|
|
|
const { options, onOptionsChange, panel, data } = this.props; |
|
|
|
const { options, onOptionsChange, panel, data } = this.props; |
|
|
|
const { transformId, transformationOptions, selectedDataFrame } = this.state; |
|
|
|
const { transformId, transformationOptions, selectedDataFrame } = this.state; |
|
|
|
|
|
|
|
|
|
|
@ -193,7 +206,7 @@ export class InspectDataTab extends PureComponent<Props, State> { |
|
|
|
|
|
|
|
|
|
|
|
let dataSelect = dataFrames; |
|
|
|
let dataSelect = dataFrames; |
|
|
|
if (selectedDataFrame === DataTransformerID.seriesToColumns) { |
|
|
|
if (selectedDataFrame === DataTransformerID.seriesToColumns) { |
|
|
|
dataSelect = data; |
|
|
|
dataSelect = data!; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const choices = dataSelect.map((frame, index) => { |
|
|
|
const choices = dataSelect.map((frame, index) => { |
|
|
@ -222,7 +235,7 @@ export class InspectDataTab extends PureComponent<Props, State> { |
|
|
|
className={css` |
|
|
|
className={css` |
|
|
|
margin-bottom: 0; |
|
|
|
margin-bottom: 0; |
|
|
|
`}
|
|
|
|
`}
|
|
|
|
disabled={!(data.length > 1)} |
|
|
|
disabled={data!.length < 2} |
|
|
|
> |
|
|
|
> |
|
|
|
<Select |
|
|
|
<Select |
|
|
|
options={selectableOptions} |
|
|
|
options={selectableOptions} |
|
|
@ -260,7 +273,7 @@ export class InspectDataTab extends PureComponent<Props, State> { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</QueryOperationRow> |
|
|
|
</QueryOperationRow> |
|
|
|
); |
|
|
|
); |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
render() { |
|
|
|
render() { |
|
|
|
const { isLoading } = this.props; |
|
|
|
const { isLoading } = this.props; |
|
|
|