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

[Improve] Flink cdc yaml FE improvements #4178

Merged
merged 1 commit into from
Jan 22, 2025
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@

handleCluster(values);
const params = {
jobType: JobTypeEnum.SQL,
jobType: values.jobType,
flinkSql: values.flinkSql,
appType: AppTypeEnum.STREAMPARK_FLINK,
config,
Expand All @@ -265,12 +265,18 @@
submitLoading.value = true;
if (formValue.jobType == JobTypeEnum.SQL || formValue.jobType == JobTypeEnum.CDC) {
if (formValue.flinkSql == null || formValue.flinkSql.trim() === '') {
const errorMsg = formValue.jobType == JobTypeEnum.SQL ? t('flink.app.editStreamPark.flinkSqlRequired') : t('flink.app.editStreamPark.yamlRequired')
const errorMsg =
formValue.jobType == JobTypeEnum.SQL
? t('flink.app.editStreamPark.flinkSqlRequired')
: t('flink.app.editStreamPark.yamlRequired');
createMessage.warning(errorMsg);
} else {
const access = await flinkSql?.value?.handleVerifySql();
if (!access) {
const errorMsg = formValue.jobType == JobTypeEnum.SQL ? t('flink.app.editStreamPark.sqlCheck') : t('flink.app.editStreamPark.yamlCheck')
const errorMsg =
formValue.jobType == JobTypeEnum.SQL
? t('flink.app.editStreamPark.sqlCheck')
: t('flink.app.editStreamPark.yamlCheck');
createMessage.warning(errorMsg);
throw new Error(access);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,18 @@
submitLoading.value = true;
if (app.jobType == JobTypeEnum.SQL || app.jobType == JobTypeEnum.CDC) {
if (values.flinkSql == null || values.flinkSql.trim() === '') {
const errorMsg = app.jobType == JobTypeEnum.SQL ? t('flink.app.editStreamPark.flinkSqlRequired') : t('flink.app.editStreamPark.yamlRequired')
const errorMsg =
app.jobType == JobTypeEnum.SQL
? t('flink.app.editStreamPark.flinkSqlRequired')
: t('flink.app.editStreamPark.yamlRequired');
createMessage.warning(errorMsg);
} else {
const access = await flinkSql?.value?.handleVerifySql();
if (!access) {
const errorMsg = app.jobType == JobTypeEnum.SQL ? t('flink.app.editStreamPark.sqlCheck') : t('flink.app.editStreamPark.yamlCheck')
const errorMsg =
app.jobType == JobTypeEnum.SQL
? t('flink.app.editStreamPark.sqlCheck')
: t('flink.app.editStreamPark.yamlCheck');
createMessage.warning(errorMsg);
throw new Error(access);
}
Expand Down Expand Up @@ -370,7 +376,7 @@
<template #args="{ model }">
<ProgramArgs
ref="programArgRef"
v-if="model.args != null && model.args != undefined"
v-if="model.args != null"
v-model:value="model.args"
:suggestions="suggestions"
@preview="(value) => openReviewDrawer(true, { value, suggestions })"
Expand All @@ -385,6 +391,7 @@
v-model:value="model[field]"
:versionId="model['versionId']"
:suggestions="suggestions"
:jobType="Number(model['jobType'])"
@preview="(value) => openReviewDrawer(true, { value, suggestions })"
/>
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
default: () => [],
},
jobType: {
type: Number
}
type: Number,
},
});
const defaultValue = '';

Expand All @@ -84,7 +84,6 @@
createMessage.error(t('flink.app.dependencyError'));
return false;
} else {
console.log(props.jobType)
if (props.jobType === JobTypeEnum.CDC) {
try {
YAML.load(props.value);
Expand All @@ -101,37 +100,37 @@
}
} else {
try {
const { data } = await fetchFlinkSqlVerify({
sql: props.value,
versionId: props.versionId,
});
const success = data.data === true || data.data === 'true';
if (success) {
verifyRes.verified = true;
verifyRes.errorMsg = '';
syntaxError();
return true;
} else {
verifyRes.errorStart = parseInt(data.start);
verifyRes.errorEnd = parseInt(data.end);
switch (data.type) {
case 4:
verifyRes.errorMsg = 'Unsupported sql';
break;
case 5:
verifyRes.errorMsg = "SQL is not endWith ';'";
break;
default:
verifyRes.errorMsg = data.message;
break;
const { data } = await fetchFlinkSqlVerify({
sql: props.value,
versionId: props.versionId,
});
const success = data.data === true || data.data === 'true';
if (success) {
verifyRes.verified = true;
verifyRes.errorMsg = '';
syntaxError();
return true;
} else {
verifyRes.errorStart = parseInt(data.start);
verifyRes.errorEnd = parseInt(data.end);
switch (data.type) {
case 4:
verifyRes.errorMsg = 'Unsupported sql';
break;
case 5:
verifyRes.errorMsg = "SQL is not endWith ';'";
break;
default:
verifyRes.errorMsg = data.message;
break;
}
syntaxError();
return false;
}
syntaxError();
} catch (error) {
console.error(error);
return false;
}
} catch (error) {
console.error(error);
return false;
}
}
}
}
Expand Down Expand Up @@ -243,7 +242,13 @@
<Icon icon="ant-design:eye-outlined" />
{{ t('flink.app.flinkSql.preview') }}
</a-button>
<a-button class="flinksql-tool-item" size="small" type="default" @click="handleFormatSql">
<a-button
v-if="props.jobType === JobTypeEnum.SQL"
class="flinksql-tool-item"
size="small"
type="default"
@click="handleFormatSql"
>
<Icon icon="ant-design:thunderbolt-outlined" />
{{ t('flink.app.flinkSql.format') }}
</a-button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ export const getDescSchema = (): DescItem[] => {
{
field: 'module',
label: t('flink.app.module'),
show: (data) => data.jobType != JobTypeEnum.SQL,
show: (data) => data.jobType == JobTypeEnum.JAR,
},
{
field: 'projectName',
label: t('flink.app.project'),
show: (data) => data.jobType != JobTypeEnum.SQL,
show: (data) => data.jobType == JobTypeEnum.JAR,
},
{
field: 'appType',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export const useAppTableAction = (
sessionStorage.setItem('appPageNo', String(currentPageNo || 1));
flinkAppStore.setApplicationId(app.id);
if (app.appType == AppTypeEnum.STREAMPARK_FLINK) {
// jobType( 1 custom code 2: flinkSQL)
// jobType( 1 flinkJAR 2: flinkSQL)
router.push({ path: '/flink/app/edit_streampark', query: { appId: app.id } });
} else if (app.appType == AppTypeEnum.APACHE_FLINK) {
//Apache Flink
Expand Down
Loading
Loading