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: sync pr(#568 & #572 & 578) #580

Merged
merged 1 commit into from
Jun 16, 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
14 changes: 7 additions & 7 deletions app/components/CodeMirror/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,13 @@ export default class ReactCodeMirror extends React.PureComponent<IProps, any> {
};

codemirrorValueChange = (doc, change) => {
const line = change.from.line;
const lineInfo = doc?.lineInfo(line);
if (lineInfo?.text?.startsWith('//') || lineInfo?.text?.startsWith('#')) {
doc.addLineClass(line, 'wrap', 'notes');
} else if(lineInfo?.wrapClass === 'notes') {
doc.removeLineClass(line, 'wrap', 'notes');
}
doc.eachLine(line => {
if(line.text.startsWith('//') || line.text.startsWith('#')) {
doc.addLineClass(line, 'wrap', 'notes');
} else if (line.wrapClass === 'notes') {
doc.removeLineClass(line, 'wrap', 'notes');
}
});
if (change.origin !== 'setValue') {
if (this.props.onChange) {
this.props.onChange(doc.getValue());
Expand Down
3 changes: 2 additions & 1 deletion app/pages/Schema/SpaceCreate/CreateForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { nameRulesFn, numberRulesFn, replicaRulesFn, stringByteRulesFn } from '@
import { useI18n } from '@vesoft-inc/i18n';
import { DEFAULT_PARTITION_NUM } from '@app/utils/constant';
import styles from './index.module.less';
import { observer } from 'mobx-react-lite';
const Option = Select.Option;


Expand Down Expand Up @@ -127,4 +128,4 @@ const CreateForm = (props: IProps) => {
);
};

export default CreateForm;
export default observer(CreateForm);
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ const PopoverContent = (props: IContentProps) => {
sketchModel
} = useStore();
const { getMachineNumber, getSpaces, updateSpaceInfo } = schema;
useEffect(() => {
getMachineNumber();
}, []);
const handleChangeMode = useCallback(async (e: any) => {
const { value } = e.target;
setMode(value);
Expand Down
5 changes: 2 additions & 3 deletions server/api/studio/pkg/filestore/sftpstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bufio"
"errors"
"fmt"
"os/user"
"strings"

"github.com/pkg/sftp"
Expand Down Expand Up @@ -93,12 +92,12 @@ func (s *SftpStore) ReadFile(path string, startLine ...int) ([]string, error) {

func (s *SftpStore) ListFiles(dir string) ([]FileConfig, error) {
var files []FileConfig
var err error
if dir == "" {
user, err := user.Lookup(s.Username)
dir, err = s.SftpClient.Getwd()
if err != nil {
return nil, err
}
dir = user.HomeDir
}

_files, err := s.SftpClient.ReadDir(dir)
Expand Down