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/flinkSource][taier-ui]fix flinkSource alias #817

Merged
merged 1 commit into from
Oct 25, 2022
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 @@ -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