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

Dev 1.10.0 webank #687

Merged
merged 2 commits into from
Dec 19, 2024
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
8 changes: 5 additions & 3 deletions linkis-web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "linkis",
"version": "1.4.0",
"version": "1.10.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
Expand All @@ -25,7 +25,7 @@
},
"dependencies": {
"@form-create/iview": "2.5.27",
"axios": "0.28.1",
"axios": "1.7.4",
"dexie": "3.2.3",
"dt-sql-parser": "3.0.5",
"highlight.js": "10.7.0",
Expand All @@ -49,7 +49,9 @@
"vue-router": "3.4.8",
"vuedraggable": "2.24.3",
"vuescroll": "4.16.1",
"worker-loader": "3.0.8"
"worker-loader": "3.0.8",
"xterm": "5.3.0",
"xterm-addon-fit": "0.8.0"
},
"devDependencies": {
"@intlify/vue-i18n-loader": "1.0.0",
Expand Down
2 changes: 0 additions & 2 deletions linkis-web/src/apps/PythonModule/.npmrc

This file was deleted.

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
Loading