Skip to content

Commit

Permalink
feat: update exec request (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
xigongdaEricyang authored Mar 15, 2023
1 parent 5a44fa0 commit d1f1f50
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
5 changes: 2 additions & 3 deletions src/pages/ServiceManage/LeaderDistribution/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@ const LeaderDistribution: React.FC<IProps> = (props: IProps) => {
};

const handleBalance = async () => {
let code = -1;
if (compare(formatVersion(cluster?.version || DEFAULT_VERSION), 'v3.0.0', '<')) {
code = await props.asyncExecNGQL('BALANCE LEADER');
const { code } = await props.asyncExecNGQL('BALANCE LEADER');
if (code === 0) {
message.success(intl.get('common.successDelay'));
getStorageInfo();
Expand All @@ -111,7 +110,7 @@ const LeaderDistribution: React.FC<IProps> = (props: IProps) => {

const handleHide = async () => {
modalHandler.current?.hide();
const code = await props.asyncExecNGQL('SUBMIT JOB BALANCE LEADER');
const { code } = await props.asyncExecNGQL('SUBMIT JOB BALANCE LEADER');
if (code === 0) {
message.success(intl.get('common.successDelay'));
getStorageInfo();
Expand Down
4 changes: 2 additions & 2 deletions src/pages/ServiceManage/Overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const Overview: React.FC<IProps> = (props: IProps) => {
};

const balanceData = async () => {
const code = await props.asyncExecNGQL('submit job balance data');
const { code } = await props.asyncExecNGQL('submit job balance data');
if (code === 0) {
message.success(intl.get('common.successDelay'));
props.asyncGetServices();
Expand All @@ -117,7 +117,7 @@ const Overview: React.FC<IProps> = (props: IProps) => {
okText: intl.get('common.confirm'),
cancelText: intl.get('common.cancel'),
onOk: async () => {
const code = await props.asyncExecNGQL(
const { code } = await props.asyncExecNGQL(
`submit job balance data remove ${host}`,
);
if (code === 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ServiceManage/ServiceInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class ServiceInfo extends React.Component<IProps> {

handleHide = async () => {
this.modalHandler.hide();
const code = await this.props.asyncExecNGQL('SUBMIT JOB BALANCE IN ZONE');
const { code } = await this.props.asyncExecNGQL('SUBMIT JOB BALANCE IN ZONE');
if (code === 0) {
message.success(intl.get('common.succeed'));
this.props.asyncGetServices();
Expand Down
2 changes: 1 addition & 1 deletion src/store/models/nebula.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export function NebulaModelWrapper(serviceApi, state, _effects) {

async asyncExecNGQL(gql) {
const res = (await serviceApi.execNGQL({ gql })) as any;
return res.code;
return res;
},

async asyncGetServiceVersion(type?: IServiceType) {
Expand Down

0 comments on commit d1f1f50

Please sign in to comment.