Skip to content

Commit

Permalink
fix: fix for job (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
xigongdaEricyang authored Sep 20, 2022
1 parent ca1aa8a commit 92529b5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/MetricsFilterPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Icon from '../Icon';
import { isCloudVersion } from '@/utils';


function FrequencySelect(props: { value?, onChange?, handleRefresh?}) {
export function FrequencySelect(props: { value?, onChange?, handleRefresh?}) {
const { value, onChange, handleRefresh } = props;
return (
<div className={styles.frequency}>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/ServiceManage/LeaderDistribution/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import classnames from 'classnames';
import SelectSpace from '../SelectSpace';
import './index.less';
import { isCommunityVersion } from '@/utils';
import { DEFAULT_VERSION } from '@/utils/dashboard';
import { DEFAULT_VERSION, formatVersion } from '@/utils/dashboard';

const mapDispatch: any = (dispatch: IDispatch) => ({
asyncGetHostsInfo: dispatch.nebula.asyncGetHostsInfo,
Expand Down Expand Up @@ -90,7 +90,7 @@ const LeaderDistribution: React.FC<IProps> = (props: IProps) => {

const handleBalance = async () => {
let code = -1;
if (compare(cluster?.version || DEFAULT_VERSION, 'v3.0.0', '<')) {
if (compare(formatVersion(cluster?.version || DEFAULT_VERSION), 'v3.0.0', '<')) {
code = await props.asyncExecNGQL('BALANCE LEADER');
if (code === 0) {
message.success(intl.get('common.succeed'));
Expand Down
6 changes: 4 additions & 2 deletions src/store/models/metric.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { compare } from 'compare-versions';
import service from '@/config/service';
import { filterServiceMetrics } from '@/utils/metric';
import { getClusterPrefix, diskPararms } from '@/utils/promQL';
import { formatVersion } from '@/utils/dashboard';

interface IState {
graphd: any[];
Expand Down Expand Up @@ -37,9 +38,10 @@ export function MetricModelWrapper(serviceApi) {
const { componentType, version, clusterID } = payload;
let metricList = [];
let spaceMetricList = [];
const curVersion = formatVersion(version);
const clusterSuffix1 = clusterID ? `,${getClusterPrefix()}='${clusterID}'` : '';
switch (true) {
case compare(version, 'v3.0.0', '<'): {
case compare(curVersion, 'v3.0.0', '<'): {
const { code, data } = (await serviceApi.getMetrics({
clusterID,
'match[]': `{componentType="${componentType}",__name__!~"ALERTS.*",__name__!~".*count"${clusterSuffix1}}`,
Expand All @@ -49,7 +51,7 @@ export function MetricModelWrapper(serviceApi) {
}
break;
}
case compare(version, 'v3.0.0', '>='):
case compare(curVersion, 'v3.0.0', '>='):
{
const { code, data } = (await serviceApi.getMetrics({
clusterID,
Expand Down
1 change: 1 addition & 0 deletions src/store/models/nebula.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export function NebulaModelWrapper(serviceApi, state, _effects) {
this.update({
jobs: data.tables,
});
return data.tables;
}
},

Expand Down

0 comments on commit 92529b5

Please sign in to comment.