Skip to content

Commit

Permalink
fix: Fix chart schema parse
Browse files Browse the repository at this point in the history
Signed-off-by: leoliu <leoliu@yunify.com>
  • Loading branch information
leoliu committed Aug 3, 2020
1 parent 0b5e378 commit cad3b97
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 18 deletions.
36 changes: 22 additions & 14 deletions src/components/Base/Slider/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import React from 'react'
import PropTypes from 'prop-types'
import classNames from 'classnames'
import { isUndefined } from 'lodash'
import {
Slider as BaseSlider,
Field,
Expand Down Expand Up @@ -67,6 +68,11 @@ export default class Slider extends React.Component {
onChange(`${value}${unit}`)
}

get showSlider() {
const { min, max } = this.props
return !isUndefined(max) && !isUndefined(min)
}

render() {
const {
className,
Expand All @@ -88,20 +94,22 @@ export default class Slider extends React.Component {

return (
<Field className={classNames(styles.field, className)}>
<Control className={styles.slider}>
<BaseSlider
value={formatValue}
defaultValue={formatDefaultValue}
max={max}
min={min}
marks={marks}
step={step}
handleStyle={handleStyle}
railStyle={railStyle}
trackStyle={trackStyle}
onChange={this.handleChange}
/>
</Control>
{this.showSlider && (
<Control className={styles.slider}>
<BaseSlider
value={formatValue}
defaultValue={formatDefaultValue}
max={max}
min={min}
marks={marks}
step={step}
handleStyle={handleStyle}
railStyle={railStyle}
trackStyle={trackStyle}
onChange={this.handleChange}
/>
</Control>
)}
<Control className={classNames({ [styles.withUnit]: unit })}>
<InputNumber
min={min}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Base/Slider/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@

.numberInput {
width: 138px;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ class AlertDetail extends React.Component {

@computed
get monitoringConfig() {
const { isLoading } = this.monitorStore
const { isLoading, resourceName } = this.monitorStore
const { metricName, condition_type, thresholds, unit } = this.store.detail
const title = this.metricLabel
const data = get(this.metrics, `${metricName}.data.result`) || []
const legend = data.map((record, index) =>
get(record, 'metric.resource_name', `${this.resourceType}_${index}`)
get(record, `metric.${resourceName}`, `${this.resourceType}_${index}`)
)

return {
Expand Down
2 changes: 1 addition & 1 deletion src/stores/openpitrix/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import Base from './base'
export default class Version extends Base {
resourceName = 'versions'

sortKey = 'create_time'
sortKey = 'sequence'

defaultStatus = DEFAULT_QUERY_STATUS

Expand Down

0 comments on commit cad3b97

Please sign in to comment.