Skip to content

Commit

Permalink
chore: 1.9.0 (#653)
Browse files Browse the repository at this point in the history
  • Loading branch information
mayinrain authored Nov 19, 2024
1 parent 73a0bf9 commit cb4e395
Show file tree
Hide file tree
Showing 11 changed files with 277 additions and 73 deletions.
87 changes: 87 additions & 0 deletions linkis-web/src/apps/PythonModule/public/tutorial.html

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions linkis-web/src/apps/PythonModule/src/global.less
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ body {
#app {
height: 100vh;
}
.fes-form .fes-form-item-label {
justify-content: flex-end;
}
12 changes: 9 additions & 3 deletions linkis-web/src/apps/PythonModule/src/locales/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default {
cancel: 'Cancel',
moduleResource: 'Module Resource',
uploadResource: 'Please upload module resource',
onlyPyAndZip: 'Only .py and .zip files are supported',
onlyPyAndZip: 'Only .py, .zip and tar.gz files are supported',
selectIsLoaded: 'Please select if loaded',
selectIsExpire: 'Please select if expired',
moduleDescription: 'Module Description',
Expand All @@ -46,12 +46,18 @@ export default {
confirmStatusChange: 'Confirm Load Status Change',
confirmStatusChangeContent: 'Are you sure you want to change the load status of module {name}?',
moduleNameTooLong: 'Module name cannot exceed 50 characters',
moduleNameNotFormat: 'Module name can only contain letters, numbers, and underscores, and must start with a letter',
// 支持横线
moduleNameNotFormat: 'Module name can only contain letters, numbers, dash, and underscores, and must start with a letter',
moduleNameExist: 'Module name {name} already exists, please delete the old module before re-uploading',
moduleSizeExceed: 'Module size cannot exceed 50MB',
saveSuccess: 'Saved successfully',
normal: 'Normal',
expire: 'Expired',
known: 'Got it',
uploadFile: 'Upload File'
uploadFile: 'Upload File',
fullScreen: 'Full Screen View',
pythonModule: 'Module Dependencies',
placeholderPyModules: 'Please enter the module dependencies.',
noDeps: 'There is no module dependencies',
messageForPyModules: 'Please enter the module dependencies, separated by commas, Module name cannot exceed 50 characters and can only contain letters, numbers, dash, and underscores, and must start with a letter'
};
11 changes: 8 additions & 3 deletions linkis-web/src/apps/PythonModule/src/locales/zh-CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default {
cancel: '取消',
moduleResource: '模块物料',
uploadResource: '请上传模块物料',
onlyPyAndZip: '仅支持.py和.zip格式文件',
onlyPyAndZip: '仅支持.py、.zip和.tar.gz格式文件',
selectIsLoaded: '请选择是否加载',
selectIsExpire: '请选择是否过期',
moduleDescription: '模块描述',
Expand All @@ -46,12 +46,17 @@ export default {
confirmStatusChange: '确认加载状态变更',
confirmStatusChangeContent: '您确定要修改模块 {name} 的加载状态吗?',
moduleNameTooLong: '模块名称长度不能超过50个字符',
moduleNameNotFormat: '模块名称只支持数字字母下划线,且以字母开头',
moduleNameNotFormat: '模块名称只支持数字字母横线下划线,且以字母开头',
moduleNameExist: '模块名称{name}已存在,如需重新上传请先删除旧的模块',
moduleSizeExceed: '模块大小不能超过50MB',
saveSuccess: '保存成功',
normal: '正常',
expire: '过期',
known: '知道了',
uploadFile: '上传文件'
uploadFile: '上传文件',
fullScreen: '全屏查看',
pythonModule: '模块依赖',
placeholderPyModules: '请输入模块依赖',
noDeps: '无依赖模块',
messageForPyModules: '模块名长度最大为50,支持数字字母横线下划线,且以英文开头',
};
112 changes: 75 additions & 37 deletions linkis-web/src/apps/PythonModule/src/pages/index/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@ export default defineComponent({
id: 'apiPythonuploadFilesystem',
query(params) {
return letgoRequest(
'/api/rest_j/v1/filesystem/python-upload',
'/api/rest_j/v1/udf/python-upload',
params,
{
method: 'POST'
method: 'POST',
timeout: 60000
},
);
},
Expand Down Expand Up @@ -204,7 +205,7 @@ export default defineComponent({
_label={$t('moduleName')}
placeholder={$t('moduleNamePlaceholder')}
v-model={$$.pythonModuleName}
span={5}
span={6}
style={{
width: '260px',
}}
Expand All @@ -214,7 +215,7 @@ export default defineComponent({
_label={$t('userName')}
placeholder={$t('userNamePlaceholder')}
v-model={$$.userName}
span={5}
span={6}
style={{
width: '260px',
}}
Expand All @@ -223,7 +224,7 @@ export default defineComponent({
<WSelect
_label={$t('engineType')}
labelWidth={`60px`}
span={5}
span={6}
style={{
width: '260px',
}}
Expand All @@ -247,7 +248,7 @@ export default defineComponent({
}
]}
/>
<WSelect
{/* <WSelect
_label={$t('isExpire')}
labelWidth={60}
span={5}
Expand All @@ -269,11 +270,11 @@ export default defineComponent({
label: $t('all'),
}
]}
/>
/> */}
<WSelect
_label={$t('isLoaded')}
labelWidth={60}
span={5}
span={6}
style={{
width: '260px',
}}
Expand Down Expand Up @@ -308,7 +309,7 @@ export default defineComponent({
$$.pythonModuleName,
$$.userName,
$$.engineType,
$$.isExpired,
// $$.isExpired,
$$.isLoaded,
$$.currentPage,
$$.pageSize,
Expand Down Expand Up @@ -423,6 +424,12 @@ export default defineComponent({
},
]}
/>
<WInput
_label={$t('pythonModule')}
v-model={$$.selectedModule.pythonModule}
placeholder={$$.getDep ? $t('noDeps') : $t('placeholderPyModules')}
disabled
/>
<WUpload
v-model:fileList={$$.selectedModule.fileList}
_label={$t('moduleResource')}
Expand All @@ -447,7 +454,7 @@ export default defineComponent({
<FText
type={'default'}
style={{
width: '200px',
width: '210px',
}}
>
{$t('onlyPyAndZip')}
Expand All @@ -463,7 +470,7 @@ export default defineComponent({
if($$.selectedModule.name && $$.selectedModule.path) {
return (
<div>
<FText type={'default'}>{$$.selectedModule.name + '.' + $$.selectedModule.path?.split('.')[1] || ''}</FText>
<FText type={'default'}>{$$.selectedModule?.path?.split('/')[$$.selectedModule?.path?.split('/').length - 1] || ''}</FText>
</div>
);
}
Expand All @@ -474,14 +481,15 @@ export default defineComponent({
}
}}
beforeUpload={(...args) => $$.validateModuleFile(...args)}
accept={['.zip', '.py']}
accept={['.zip', '.py', '.tar.gz']}
httpRequest={(...args) => $$.handleUploadHttpRequest(...args)}
>
<FButton
type={'default'}
v-slots={{
icon: () => <UploadOutlined />
}}
loading={$$.isUploading}
>
{$t('uploadFile')}
</FButton>
Expand All @@ -507,7 +515,7 @@ export default defineComponent({
},
]}
/>
<WRadioGroup
{/* <WRadioGroup
_label={$t('isExpire')}
v-model={$$.selectedModule.isExpire}
rules={[
Expand All @@ -527,7 +535,7 @@ export default defineComponent({
label: $t('no'),
},
]}
/>
/> */}
<WInput
_label={$t('moduleDescription')}
v-model={$$.selectedModule.description}
Expand Down Expand Up @@ -598,6 +606,12 @@ export default defineComponent({
},
]}
/>
<WInput
_label={$t('pythonModule')}
v-model={$$.selectedModule.pythonModule}
placeholder={$$.getDep ? $t('noDeps') : $t('placeholderPyModules')}
disabled
/>
<WUpload
v-model:fileList={$$.selectedModule.fileList}
_label={$t('moduleResource')}
Expand All @@ -622,7 +636,7 @@ export default defineComponent({
<FText
type={'default'}
style={{
width: '200px',
width: '210px',
}}
>
{$t('onlyPyAndZip')}
Expand All @@ -638,7 +652,7 @@ export default defineComponent({
if($$.selectedModule.name && $$.selectedModule.path) {
return (
<div>
<FText type={'default'}>{$$.selectedModule.name + '.' + $$.selectedModule.path?.split('.')[1] || ''}</FText>
<FText type={'default'}>{$$.selectedModule?.path?.split('/')[$$.selectedModule?.path?.split('/').length - 1] || ''}</FText>
</div>
);
}
Expand All @@ -649,14 +663,15 @@ export default defineComponent({
}
}}
beforeUpload={(...args) => $$.validateModuleFile(...args)}
accept={['.zip', '.py']}
accept={['.zip', '.py', '.tar.gz']}
httpRequest={(...args) => $$.handleUploadHttpRequest(...args)}
>
<FButton
type={'default'}
v-slots={{
icon: () => <UploadOutlined />
}}
loading={$$.isUploading}
>
{$t('uploadFile')}
</FButton>
Expand All @@ -682,7 +697,7 @@ export default defineComponent({
},
]}
/>
<WRadioGroup
{/* <WRadioGroup
_label={$t('isExpire')}
v-model={$$.selectedModule.isExpire}
rules={[
Expand All @@ -702,7 +717,7 @@ export default defineComponent({
label: $t('no'),
},
]}
/>
/> */}
<WInput
_label={$t('moduleDescription')}
v-model={$$.selectedModule.description}
Expand Down Expand Up @@ -738,8 +753,14 @@ export default defineComponent({
getContainer={() => document.body}
v-slots={{
title: () => {
return(<h1>{$t('useTutorial')}</h1>)
}
return(
<div style={{display: 'flex', width: '732px', justifyContent: 'space-between', alignItems: 'center'}}>
<h1>{$t('useTutorial')}</h1>
<FButton onClick={() => $$.openNewTab()}>{$t('fullScreen')}</FButton>
</div>
)
},

}}
onUpdate:show={[
() => {
Expand All @@ -754,7 +775,10 @@ export default defineComponent({
]}
>
<div style={{padding: '0px 20px'}}>
<h2 style="color: #333;">1. 首先你需要准备好对应的模块物料,支持.py文件和.zip文件</h2>
<div style="background-color: #f9eda6; font-weight: bold; padding: 10px; border: 1px solid #ffeeba;">
注意事项:当前linkis支持的python版本为2.7.13和3.6.4两个版本,用户上传的python文件或模块必须兼容对应的python版本才能正常使用。
</div>
<h2 style="color: #333;">1. 首先你需要准备好对应的模块物料,支持.py文件, tar.gz文件, .zip文件</h2>
<p>a. 对于py 文件你的模块名一定要和文件名一致,如hello_world.py 模块名就是hello_world,您可以在里面定义你的python方法和class等,如下:</p>
<pre style="background-color: #f4f4f4; padding: 10px; border-radius: 4px; overflow-x: auto;">
<code><span style={{ color: '#999' }}>#文件名一定是 hello_world.py<br /></span>
Expand Down Expand Up @@ -823,28 +847,42 @@ df_transformed.show()
: 'Python';
},
},
{
prop: 'status',
label: $t('status'),
formatter: ({
row,
column,
rowIndex,
coloumIndex,
cellValue,
}) => {
return row.isExpire === 0
? $t('normal')
: $t('expire');
},
},
// {
// prop: 'status',
// label: $t('status'),
// formatter: ({
// row,
// column,
// rowIndex,
// coloumIndex,
// cellValue,
// }) => {
// return row.isExpire === 0
// ? $t('normal')
// : $t('expire');
// },
// },
{
prop: 'path',
label: $t('pathInfo'),
},
{
prop: 'pythonModule',
label: $t('pythonModule'),
formatter: ({row, column ,rowIndex, columnIndex, cellValue}) => {
if(!row.pythonModule) {
return '- -'
}
}
},
{
prop: 'description',
label: $t('moduleDescription'),
formatter: ({row, column, rowIndex, columnIndex, cellValue}) => {
if(!row.description) {
return '- -'
}
}
},
{
prop: 'createTime',
Expand Down
Loading

0 comments on commit cb4e395

Please sign in to comment.