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

fix: fix alter property limit in edit page #514

Merged
merged 2 commits into from
Mar 29, 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
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';
import { AlterType, IProperty } from '@app/interfaces/schema';
import { useI18n } from '@vesoft-inc/i18n';
import { nameRulesFn, numberRulesFn, stringByteRulesFn } from '@app/config/rules';
import { DATA_TYPE, EXPLAIN_DATA_TYPE } from '@app/utils/constant';
import { DataTypeTransformMap, DATA_TYPE, EXPLAIN_DATA_TYPE } from '@app/utils/constant';

import styles from './index.module.less';
const Option = Select.Option;
Expand Down Expand Up @@ -102,8 +102,11 @@ export const EditRow = (props: IEditProps) => {
message: intl.get('formRules.dataTypeRequired'),
},
]}>
<Select showSearch={true} onChange={onUpdateType} dropdownMatchSelectWidth={false}>
<Select disabled={!(type in DataTypeTransformMap)} showSearch={true} onChange={onUpdateType} dropdownMatchSelectWidth={false}>
{DATA_TYPE.map(item => {
if(!DataTypeTransformMap[type]?.includes(item.value) || item.value !== type) {
return null;
}
return (
<Option value={item.value} key={item.value}>
{item.label}
Expand Down
8 changes: 8 additions & 0 deletions app/utils/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ export const ENUM_OF_COMPARE = {
],
};

export const DataTypeTransformMap = {
int8: ['int16', 'int32', 'int'],
int16: ['int32', 'int'],
int32: ['int'],
fixed_string: ['string'],
float: ['double'],
} as const;

export const DATA_TYPE = [
{
value: 'int',
Expand Down
6 changes: 3 additions & 3 deletions server/api/studio/pkg/client/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,9 @@ func parseExecuteData(response SingleResponse) (ParsedResult, error) {
return result, nil
}

if !res.IsSucceed() {
return result, errors.New(res.GetErrorMsg())
}
if res.IsSetPlanDesc() {
resp := response.Result
if response.Result == nil {
Expand Down Expand Up @@ -510,9 +513,6 @@ func parseExecuteData(response SingleResponse) (ParsedResult, error) {
return result, nil
}
}
if !res.IsSucceed() {
return result, errors.New(res.GetErrorMsg())
}
if !res.IsEmpty() {
rows := res.GetRows()
rowSize := len(rows)
Expand Down