Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update exec request #219

Merged
merged 1 commit into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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