Skip to content

Commit

Permalink
[fix/flinkSource][taier-ui]fix flinkSource alias (#817)
Browse files Browse the repository at this point in the history
  • Loading branch information
mortalYoung authored Oct 25, 2022
1 parent 68c85f4 commit c353c0c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ export class CollapsePreview extends React.Component<CollaProps, any> {
const jsonStr = Utils.isJSONStr(item) ? Utils.jsonFormat(item, 4) : item;
return (
<Panel
header={<div className={defaultClass}>{jsonStr || '无数据'}</div>}
header={
<div className={defaultClass} style={{ width: 500 }}>
{jsonStr || '无数据'}
</div>
}
key={`data-preview-${index}`}
>
<TextArea style={defaultStyle} value={jsonStr} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class DataPreviewModal extends React.Component<any, any> {
title="数据预览"
onCancel={onCancel}
maskClosable={false}
width={600}
footer={[
<Button key="back" type="primary" onClick={onCancel}>
关闭
Expand Down
4 changes: 2 additions & 2 deletions taier-ui/src/pages/rightBar/flinkSource/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,13 @@ export default function SourceForm({
<Editor
style={{ minHeight: 202 }}
className="bd"
sync
options={{
fontSize: 12,
minimap: {
enabled: false,
},
}}
language="plaintext"
placeholder={`字段 类型, 比如 id int 一行一个字段${
getFieldValue(NAME_FIELD)?.[index].type !==
DATA_SOURCE_ENUM.KAFKA_CONFLUENT
Expand Down Expand Up @@ -311,7 +311,7 @@ export default function SourceForm({
<Editor
style={{ minHeight: 202, height: '100%' }}
className="bd"
sync
language='plaintext'
placeholder="分区 偏移量,比如pt 2 一行一对值"
/>
</FormItem>
Expand Down
24 changes: 16 additions & 8 deletions taier-ui/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -675,14 +675,22 @@ export function getColumnsByColumnsText(text: string = '') {
if (text) {
text.split('\n')
.filter(Boolean)
.forEach((v) => {
const asCase = /^\s*(.+)\s+(.+)\s*$/i.exec(v?.trim());
if (asCase && !tmpMap[asCase[1]]) {
tmpMap[asCase[1]] = true;
columns.push({
field: asCase[1],
type: asCase[2],
});
.forEach((v = '') => {
const asCase = /^.*\w.*\s+as\s+(\w+)$/i.exec(v.trim());
if (asCase) {
if (!tmpMap[asCase[1]]) {
tmpMap[asCase[1]] = true;
columns.push({
field: asCase[1],
type: asCase[2],
});
}
} else {
const [field, type] = v.trim().split(' ');
if (!tmpMap[field]) {
tmpMap[field] = true;
columns.push({ field, type });
}
}
});
}
Expand Down

0 comments on commit c353c0c

Please sign in to comment.