This is an automated email from the ASF dual-hosted git repository.
lgcareer pushed a commit to branch dev-resource-tree
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git
The following commit(s) were added to refs/heads/dev-resource-tree by this push:
new 25a924a File management list modification (#1976)
25a924a is described below
commit 25a924ae884dbe0c5072cca3ee5ec4e3877b6df3
Author: break60 <[email protected]>
AuthorDate: Wed Feb 19 10:18:09 2020 +0800
File management list modification (#1976)
---
.../resource/pages/file/pages/_source/common.js | 15 ++-
.../resource/pages/file/pages/create/index.vue | 4 +
.../file/pages/{create => createFolder}/index.vue | 93 +++++-----------
.../pages/file/pages/list/_source/list.vue | 14 ++-
.../pages/resource/pages/file/pages/list/index.vue | 2 +
.../pages/file/pages/{create => subFile}/index.vue | 7 +-
.../file/pages/{create => subFileFolder}/index.vue | 93 +++++-----------
.../pages/{list => subdirectory}/_source/list.vue | 25 ++++-
.../file/pages/subdirectory/_source/rename.vue | 119 +++++++++++++++++++++
.../file/pages/{list => subdirectory}/index.vue | 17 +--
.../src/js/conf/home/router/index.js | 32 ++++++
.../src/js/conf/home/store/resource/actions.js | 12 +++
.../{fileUpdate.vue => fileChildUpdate.vue} | 8 +-
.../js/module/components/fileUpdate/fileUpdate.vue | 4 +
.../src/js/module/components/nav/nav.vue | 41 +++++++
.../src/js/module/i18n/locale/en_US.js | 11 ++
.../src/js/module/i18n/locale/zh_CN.js | 11 ++
.../src/js/module/util/routerUtil.js | 6 +-
18 files changed, 363 insertions(+), 151 deletions(-)
diff --git
a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/_source/common.js
b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/_source/common.js
old mode 100644
new mode 100755
index 8e534f9..2522d56
---
a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/_source/common.js
+++
b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/_source/common.js
@@ -18,6 +18,19 @@
/**
* Create file type
*/
+import i18n from '@/module/i18n'
+
let filtTypeArr = ['txt', 'log', 'sh', 'conf', 'cfg', 'py', 'java', 'sql',
'xml', 'hql', 'properties']
-export { filtTypeArr }
+const folderList = [
+ {
+ value: 'FILE',
+ label: `${i18n.$t('FILE')}`
+ },
+ {
+ value: 'UDF',
+ label: `${i18n.$t('UDF')}`
+ }
+ ]
+
+export { filtTypeArr, folderList }
diff --git
a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/create/index.vue
b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/create/index.vue
old mode 100644
new mode 100755
index caa31ed..0348f32
---
a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/create/index.vue
+++
b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/create/index.vue
@@ -96,6 +96,8 @@
description: '',
fileTypeList: filtTypeArr,
content: '',
+ pid: -1,
+ currentDir: '/',
spinnerLoading: false
}
},
@@ -107,6 +109,8 @@
this.spinnerLoading = true
this.createResourceFile({
type: 'FILE',
+ pid: this.pid,
+ currentDir: this.currentDir,
fileName: this.fileName,
suffix: this.suffix,
description: this.description,
diff --git
a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/create/index.vue
b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/createFolder/index.vue
old mode 100644
new mode 100755
similarity index 62%
copy from
dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/create/index.vue
copy to
dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/createFolder/index.vue
index caa31ed..be53033
---
a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/create/index.vue
+++
b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/createFolder/index.vue
@@ -15,15 +15,15 @@
* limitations under the License.
*/
<template>
- <m-list-construction :title="$t('Create File')">
+ <m-list-construction :title="$t('Create folder')">
<template slot="content">
<div class="resource-create-model">
<m-list-box-f>
- <template slot="name"><strong>*</strong>{{$t('File
Name')}}</template>
+ <template slot="name"><strong>*</strong>{{$t('Folder
Name')}}</template>
<template slot="content">
<x-input
type="input"
- v-model="fileName"
+ v-model="name"
maxlength="60"
style="width: 300px;"
:placeholder="$t('Please enter name')"
@@ -31,19 +31,19 @@
</x-input>
</template>
</m-list-box-f>
- <m-list-box-f>
- <template slot="name"><strong>*</strong>{{$t('File
Format')}}</template>
+ <!-- <m-list-box-f>
+ <template slot="name"><strong>*</strong>{{$t('Folder
Format')}}</template>
<template slot="content">
- <x-select v-model="suffix" style="width: 100px;"
@on-change="_onChange">
+ <x-select v-model="type" style="width: 100px;">
<x-option
- v-for="city in fileTypeList"
- :key="city"
- :value="city"
- :label="city">
+ v-for="item in folderList"
+ :key="item.value"
+ :value="item.value"
+ :label="item.label">
</x-option>
</x-select>
</template>
- </m-list-box-f>
+ </m-list-box-f> -->
<m-list-box-f>
<template slot="name">{{$t('Description')}}</template>
<template slot="content">
@@ -57,12 +57,6 @@
</template>
</m-list-box-f>
<m-list-box-f>
- <template slot="name"><strong>*</strong>{{$t('File
Content')}}</template>
- <template slot="content">
- <textarea id="code-create-mirror"
name="code-create-mirror"></textarea>
- </template>
- </m-list-box-f>
- <m-list-box-f>
<template slot="name"> </template>
<template slot="content">
<div class="submit">
@@ -78,44 +72,42 @@
<script>
import i18n from '@/module/i18n'
import { mapActions } from 'vuex'
- import { filtTypeArr } from '../_source/common'
+ import { folderList } from '../_source/common'
import { handlerSuffix } from '../details/_source/utils'
- import codemirror from '../_source/codemirror'
import mListBoxF from '@/module/components/listBoxF/listBoxF'
import mSpin from '@/module/components/spin/spin'
import mConditions from '@/module/components/conditions/conditions'
+ import localStore from '@/module/util/localStorage'
import mListConstruction from
'@/module/components/listConstruction/listConstruction'
- let editor
export default {
name: 'resource-list-create-FILE',
data () {
return {
- suffix: 'sh',
- fileName: '',
+ type: '',
+ name: '',
description: '',
- fileTypeList: filtTypeArr,
- content: '',
+ folderList: folderList,
spinnerLoading: false
}
},
props: {},
methods: {
- ...mapActions('resource', ['createResourceFile']),
+ ...mapActions('resource', ['createResourceFolder']),
ok () {
if (this._validation()) {
this.spinnerLoading = true
- this.createResourceFile({
+ this.createResourceFolder({
type: 'FILE',
- fileName: this.fileName,
- suffix: this.suffix,
- description: this.description,
- content: editor.getValue()
+ name: this.name,
+ currentDir: '/',
+ pid: -1,
+ description: this.description
}).then(res => {
this.$message.success(res.msg)
setTimeout(() => {
this.spinnerLoading = false
- this.$router.push({ name: 'file' })
+ this.$router.push({ path: `/resource/file`})
}, 800)
}).catch(e => {
this.$message.error(e.msg || '')
@@ -124,52 +116,21 @@
}
},
_validation () {
- if (!this.fileName) {
- this.$message.warning(`${i18n.$t('Please enter resource name')}`)
- return false
- }
- if (!editor.getValue()) {
- this.$message.warning(`${i18n.$t('Please enter the resource
content')}`)
+ if (!this.name) {
+ this.$message.warning(`${i18n.$t('Please enter resource folder
name')}`)
return false
}
return true
},
- /**
- * Processing code highlighting
- */
- _handlerEditor () {
- // editor
- editor = codemirror('code-create-mirror', {
- mode: 'shell',
- readOnly: false
- })
-
- this.keypress = () => {
- if (!editor.getOption('readOnly')) {
- editor.showHint({
- completeSingle: false
- })
- }
- }
-
- // Monitor keyboard
- editor.on('keypress', this.keypress)
- },
- _onChange (val) {
- editor.setOption('mode', handlerSuffix['.' + val.label])
- }
},
watch: {},
created () {
},
mounted () {
this.$modal.destroy()
- this._handlerEditor()
},
destroyed () {
- editor.toTextArea() // uninstall
- editor.off($('.code-create-mirror'), 'keypress', this.keypress)
},
computed: {},
components: { mListConstruction, mConditions, mSpin, mListBoxF }
@@ -180,8 +141,4 @@
.resource-create-model {
padding: 30px;
}
- .CodeMirror {
- border:1px solid #DDDEDD;
- border-radius: 3px;
- }
</style>
diff --git
a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/list/_source/list.vue
b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/list/_source/list.vue
old mode 100644
new mode 100755
index 783eead..3bc1bfa
---
a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/list/_source/list.vue
+++
b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/list/_source/list.vue
@@ -26,6 +26,9 @@
<span>{{$t('Name')}}</span>
</th>
<th scope="col">
+ <span>{{$t('Whether directory')}}</span>
+ </th>
+ <th scope="col">
<span>{{$t('File Name')}}</span>
</th>
<th scope="col">
@@ -50,6 +53,9 @@
<a href="javascript:" class="links"
@click="_go(item)">{{item.alias}}</a>
</span>
</td>
+ <td>
+ <span>{{item.directory? $t('Yes') : $t('No')}}</span>
+ </td>
<td><span class="ellipsis" v-tooltip.large.top.start.light="{text:
item.fileName, maxWidth: '500px'}">{{item.fileName}}</span></td>
<td>
<span v-if="item.description" class="ellipsis"
v-tooltip.large.top.start.light="{text: item.description, maxWidth:
'500px'}">{{item.description}}</span>
@@ -89,6 +95,7 @@
size="xsmall"
data-toggle="tooltip"
:title="$t('Download')"
+ :disabled="item.directory? true: false"
@click="_downloadFile(item)"
icon="ans-icon-download">
</x-button>
@@ -148,7 +155,12 @@
},
_go (item) {
localStore.setItem('file', `${item.alias}|${item.size}`)
- this.$router.push({ path: `/resource/file/list/${item.id}` })
+ if(item.directory) {
+ localStore.setItem('currentDir', `${item.fullName}`)
+ this.$router.push({ path: `/resource/file/subdirectory/${item.id}` })
+ } else {
+ this.$router.push({ path: `/resource/file/list/${item.id}` })
+ }
},
_downloadFile (item) {
downloadFile('/dolphinscheduler/resources/download', {
diff --git
a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/list/index.vue
b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/list/index.vue
old mode 100644
new mode 100755
index 8f1f939..73ce023
---
a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/list/index.vue
+++
b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/list/index.vue
@@ -20,6 +20,7 @@
<m-conditions @on-conditions="_onConditions">
<template slot="button-group">
<x-button-group size="small" >
+ <x-button type="ghost" @click="() => $router.push({name:
'resource-file-createFolder'})">{{$t('Create folder')}}</x-button>
<x-button type="ghost" @click="() => $router.push({name:
'resource-file-create'})">{{$t('Create File')}}</x-button>
<x-button type="ghost" @click="_uploading">{{$t('Upload
Files')}}</x-button>
</x-button-group>
@@ -61,6 +62,7 @@
isLoading: false,
fileResourcesList: [],
searchParams: {
+ id: -1,
pageSize: 10,
pageNo: 1,
searchVal: '',
diff --git
a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/create/index.vue
b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subFile/index.vue
old mode 100644
new mode 100755
similarity index 95%
copy from
dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/create/index.vue
copy to
dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subFile/index.vue
index caa31ed..1e63635
---
a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/create/index.vue
+++
b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subFile/index.vue
@@ -84,6 +84,7 @@
import mListBoxF from '@/module/components/listBoxF/listBoxF'
import mSpin from '@/module/components/spin/spin'
import mConditions from '@/module/components/conditions/conditions'
+ import localStore from '@/module/util/localStorage'
import mListConstruction from
'@/module/components/listConstruction/listConstruction'
let editor
@@ -96,6 +97,8 @@
description: '',
fileTypeList: filtTypeArr,
content: '',
+ pid: -1,
+ currentDir: '/',
spinnerLoading: false
}
},
@@ -107,6 +110,8 @@
this.spinnerLoading = true
this.createResourceFile({
type: 'FILE',
+ pid: this.$route.params.id,
+ currentDir: localStore.getItem('currentDir'),
fileName: this.fileName,
suffix: this.suffix,
description: this.description,
@@ -115,7 +120,7 @@
this.$message.success(res.msg)
setTimeout(() => {
this.spinnerLoading = false
- this.$router.push({ name: 'file' })
+ this.$router.push({ path:
`/resource/file/subdirectory/${this.$route.params.id}`})
}, 800)
}).catch(e => {
this.$message.error(e.msg || '')
diff --git
a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/create/index.vue
b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subFileFolder/index.vue
old mode 100644
new mode 100755
similarity index 62%
copy from
dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/create/index.vue
copy to
dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subFileFolder/index.vue
index caa31ed..9f903a1
---
a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/create/index.vue
+++
b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subFileFolder/index.vue
@@ -15,15 +15,15 @@
* limitations under the License.
*/
<template>
- <m-list-construction :title="$t('Create File')">
+ <m-list-construction :title="$t('Create folder')">
<template slot="content">
<div class="resource-create-model">
<m-list-box-f>
- <template slot="name"><strong>*</strong>{{$t('File
Name')}}</template>
+ <template slot="name"><strong>*</strong>{{$t('Folder
Name')}}</template>
<template slot="content">
<x-input
type="input"
- v-model="fileName"
+ v-model="name"
maxlength="60"
style="width: 300px;"
:placeholder="$t('Please enter name')"
@@ -31,19 +31,19 @@
</x-input>
</template>
</m-list-box-f>
- <m-list-box-f>
- <template slot="name"><strong>*</strong>{{$t('File
Format')}}</template>
+ <!-- <m-list-box-f>
+ <template slot="name"><strong>*</strong>{{$t('Folder
Format')}}</template>
<template slot="content">
- <x-select v-model="suffix" style="width: 100px;"
@on-change="_onChange">
+ <x-select v-model="type" style="width: 100px;">
<x-option
- v-for="city in fileTypeList"
- :key="city"
- :value="city"
- :label="city">
+ v-for="item in folderList"
+ :key="item.value"
+ :value="item.value"
+ :label="item.label">
</x-option>
</x-select>
</template>
- </m-list-box-f>
+ </m-list-box-f> -->
<m-list-box-f>
<template slot="name">{{$t('Description')}}</template>
<template slot="content">
@@ -57,12 +57,6 @@
</template>
</m-list-box-f>
<m-list-box-f>
- <template slot="name"><strong>*</strong>{{$t('File
Content')}}</template>
- <template slot="content">
- <textarea id="code-create-mirror"
name="code-create-mirror"></textarea>
- </template>
- </m-list-box-f>
- <m-list-box-f>
<template slot="name"> </template>
<template slot="content">
<div class="submit">
@@ -78,44 +72,42 @@
<script>
import i18n from '@/module/i18n'
import { mapActions } from 'vuex'
- import { filtTypeArr } from '../_source/common'
+ import { folderList } from '../_source/common'
import { handlerSuffix } from '../details/_source/utils'
- import codemirror from '../_source/codemirror'
import mListBoxF from '@/module/components/listBoxF/listBoxF'
import mSpin from '@/module/components/spin/spin'
import mConditions from '@/module/components/conditions/conditions'
+ import localStore from '@/module/util/localStorage'
import mListConstruction from
'@/module/components/listConstruction/listConstruction'
- let editor
export default {
name: 'resource-list-create-FILE',
data () {
return {
- suffix: 'sh',
- fileName: '',
+ type: '',
+ name: '',
description: '',
- fileTypeList: filtTypeArr,
- content: '',
+ folderList: folderList,
spinnerLoading: false
}
},
props: {},
methods: {
- ...mapActions('resource', ['createResourceFile']),
+ ...mapActions('resource', ['createResourceFolder']),
ok () {
if (this._validation()) {
this.spinnerLoading = true
- this.createResourceFile({
+ this.createResourceFolder({
type: 'FILE',
- fileName: this.fileName,
- suffix: this.suffix,
- description: this.description,
- content: editor.getValue()
+ name: this.name,
+ currentDir: localStore.getItem('currentDir'),
+ pid: this.$route.params.id,
+ description: this.description
}).then(res => {
this.$message.success(res.msg)
setTimeout(() => {
this.spinnerLoading = false
- this.$router.push({ name: 'file' })
+ this.$router.push({ path:
`/resource/file/subdirectory/${this.$route.params.id}`})
}, 800)
}).catch(e => {
this.$message.error(e.msg || '')
@@ -124,52 +116,21 @@
}
},
_validation () {
- if (!this.fileName) {
- this.$message.warning(`${i18n.$t('Please enter resource name')}`)
- return false
- }
- if (!editor.getValue()) {
- this.$message.warning(`${i18n.$t('Please enter the resource
content')}`)
+ if (!this.name) {
+ this.$message.warning(`${i18n.$t('Please enter resource folder
name')}`)
return false
}
return true
},
- /**
- * Processing code highlighting
- */
- _handlerEditor () {
- // editor
- editor = codemirror('code-create-mirror', {
- mode: 'shell',
- readOnly: false
- })
-
- this.keypress = () => {
- if (!editor.getOption('readOnly')) {
- editor.showHint({
- completeSingle: false
- })
- }
- }
-
- // Monitor keyboard
- editor.on('keypress', this.keypress)
- },
- _onChange (val) {
- editor.setOption('mode', handlerSuffix['.' + val.label])
- }
},
watch: {},
created () {
},
mounted () {
this.$modal.destroy()
- this._handlerEditor()
},
destroyed () {
- editor.toTextArea() // uninstall
- editor.off($('.code-create-mirror'), 'keypress', this.keypress)
},
computed: {},
components: { mListConstruction, mConditions, mSpin, mListBoxF }
@@ -180,8 +141,4 @@
.resource-create-model {
padding: 30px;
}
- .CodeMirror {
- border:1px solid #DDDEDD;
- border-radius: 3px;
- }
</style>
diff --git
a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/list/_source/list.vue
b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subdirectory/_source/list.vue
old mode 100644
new mode 100755
similarity index 90%
copy from
dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/list/_source/list.vue
copy to
dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subdirectory/_source/list.vue
index 783eead..c851e48
---
a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/list/_source/list.vue
+++
b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subdirectory/_source/list.vue
@@ -26,6 +26,9 @@
<span>{{$t('Name')}}</span>
</th>
<th scope="col">
+ <span>{{$t('Whether directory')}}</span>
+ </th>
+ <th scope="col">
<span>{{$t('File Name')}}</span>
</th>
<th scope="col">
@@ -50,6 +53,9 @@
<a href="javascript:" class="links"
@click="_go(item)">{{item.alias}}</a>
</span>
</td>
+ <td>
+ <span>{{item.directory? $t('Yes') : $t('No')}}</span>
+ </td>
<td><span class="ellipsis" v-tooltip.large.top.start.light="{text:
item.fileName, maxWidth: '500px'}">{{item.fileName}}</span></td>
<td>
<span v-if="item.description" class="ellipsis"
v-tooltip.large.top.start.light="{text: item.description, maxWidth:
'500px'}">{{item.description}}</span>
@@ -148,7 +154,12 @@
},
_go (item) {
localStore.setItem('file', `${item.alias}|${item.size}`)
- this.$router.push({ path: `/resource/file/list/${item.id}` })
+ if(item.directory) {
+ localStore.setItem('currentDir', `${item.fullName}`)
+ this.$router.push({ path: `/resource/file/subdirectory/${item.id}` })
+ } else {
+ this.$router.push({ path: `/resource/file/list/${item.id}` })
+ }
},
_downloadFile (item) {
downloadFile('/dolphinscheduler/resources/download', {
@@ -217,7 +228,17 @@
setTimeout(() => {
this.list = a
})
- }
+ },
+ // Listening for routing changes
+ // '$route': {
+ // deep: false,
+ // handler () {
+ // this.$emit('on-update',this.$route.params.id)
+ // }
+ // }
+ },
+ beforeRouteUpdate (to, from, next) {
+ next() // 一定要有next
},
created () {
},
diff --git
a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subdirectory/_source/rename.vue
b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subdirectory/_source/rename.vue
new file mode 100755
index 0000000..b082f88
--- /dev/null
+++
b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subdirectory/_source/rename.vue
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+<template>
+ <m-popup :ok-text="$t('Rename')" :nameText="$t('Rename')" @ok="_ok"
:asyn-loading="true">
+ <template slot="content">
+ <div class="resource-rename-model">
+ <m-list-box-f>
+ <template slot="name"><strong>*</strong>{{$t('Name')}}</template>
+ <template slot="content">
+ <x-input
+ type="input"
+ v-model="name"
+ :placeholder="$t('Please enter name')"
+ autocomplete="off">
+ </x-input>
+ </template>
+ </m-list-box-f>
+ <m-list-box-f>
+ <template slot="name">{{$t('Description')}}</template>
+ <template slot="content">
+ <x-input
+ type="textarea"
+ v-model="description"
+ :placeholder="$t('Please enter description')"
+ autocomplete="off">
+ </x-input>
+ </template>
+ </m-list-box-f>
+ </div>
+ </template>
+ </m-popup>
+</template>
+<script>
+ import i18n from '@/module/i18n'
+ import store from '@/conf/home/store'
+ import mPopup from '@/module/components/popup/popup'
+ import mListBoxF from '@/module/components/listBoxF/listBoxF'
+
+ export default {
+ name: 'resource-file-rename',
+ data () {
+ return {
+ store,
+ description: '',
+ name: ''
+ }
+ },
+ props: {
+ item: Object
+ },
+ methods: {
+ _ok (fn) {
+ this._verification().then(res => {
+ if (this.name === this.item.alias) {
+ return new Promise((resolve,reject) => {
+ this.description === this.item.description ?
reject({msg:'内容未修改'}) : resolve()
+ })
+ }else{
+ return this.store.dispatch('resource/resourceVerifyName', {
+ name: this.name,
+ type: 'FILE'
+ })
+ }
+ }).then(res => {
+ return this.store.dispatch('resource/resourceRename', {
+ name: this.name,
+ description: this.description,
+ id: this.item.id,
+ type: 'FILE'
+ })
+ }).then(res => {
+ this.$message.success(res.msg)
+ this.$emit('onUpDate', res.data)
+ fn()
+ }).catch(e => {
+ fn()
+ this.$message.error(e.msg || '')
+ })
+ },
+ _verification () {
+ return new Promise((resolve, reject) => {
+ if (!this.name) {
+ reject({ // eslint-disable-line
+ msg: `${i18n.$t('Please enter resource name')}`
+ })
+ } else {
+ resolve()
+ }
+
+ })
+ }
+ },
+ watch: {},
+ created () {
+ let item = this.item || {}
+ if (item) {
+ this.name = item.alias
+ this.description = item.description
+ }
+ },
+ mounted () {
+ },
+ components: { mPopup, mListBoxF }
+ }
+</script>
\ No newline at end of file
diff --git
a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/list/index.vue
b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subdirectory/index.vue
old mode 100644
new mode 100755
similarity index 83%
copy from
dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/list/index.vue
copy to
dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subdirectory/index.vue
index 8f1f939..0cf7528
---
a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/list/index.vue
+++
b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subdirectory/index.vue
@@ -20,7 +20,8 @@
<m-conditions @on-conditions="_onConditions">
<template slot="button-group">
<x-button-group size="small" >
- <x-button type="ghost" @click="() => $router.push({name:
'resource-file-create'})">{{$t('Create File')}}</x-button>
+ <x-button type="ghost" @click="() => $router.push({path:
`/resource/file/subFileFolder/${searchParams.id}`})">{{$t('Create
folder')}}</x-button>
+ <x-button type="ghost" @click="() => $router.push({path:
`/resource/file/subFile/${searchParams.id}`})">{{$t('Create File')}}</x-button>
<x-button type="ghost" @click="_uploading">{{$t('Upload
Files')}}</x-button>
</x-button-group>
</template>
@@ -28,7 +29,7 @@
</template>
<template slot="content">
<template v-if="fileResourcesList.length || total>0">
- <m-list @on-update="_onUpdate"
:file-resources-list="fileResourcesList" :page-no="searchParams.pageNo"
:page-size="searchParams.pageSize">
+ <m-list @on-update="_onUpdate" @on-updateList="_updateList"
:file-resources-list="fileResourcesList" :page-no="searchParams.pageNo"
:page-size="searchParams.pageSize">
</m-list>
<div class="page-box">
<x-page :current="parseInt(searchParams.pageNo)" :total="total"
:page-size="searchParams.pageSize" show-elevator @on-change="_page" show-sizer
:page-size-options="[10,30,50]" @on-size-change="_pageSize"></x-page>
@@ -61,6 +62,7 @@
isLoading: false,
fileResourcesList: [],
searchParams: {
+ id: this.$route.params.id,
pageSize: 10,
pageNo: 1,
searchVal: '',
@@ -76,7 +78,7 @@
* File Upload
*/
_uploading () {
- findComponentDownward(this.$root, 'roof-nav')._fileUpdate('FILE')
+ findComponentDownward(this.$root,
'roof-nav')._fileChildUpdate('FILE',this.searchParams.id)
},
_onConditions (o) {
this.searchParams = _.assign(this.searchParams, o)
@@ -102,20 +104,23 @@
this.isLoading = false
})
},
- _updateList () {
+ _updateList (data) {
+ this.searchParams.id = data
this.searchParams.pageNo = 1
this.searchParams.searchVal = ''
this._debounceGET()
},
- _onUpdate () {
+ _onUpdate (data) {
+ this.searchParams.id = data
this._debounceGET()
- }
+ },
},
watch: {
// router
'$route' (a) {
// url no params get instance list
this.searchParams.pageNo = _.isEmpty(a.query) ? 1 : a.query.pageNo
+ this.searchParams.id = a.params.id
}
},
created () {
diff --git a/dolphinscheduler-ui/src/js/conf/home/router/index.js
b/dolphinscheduler-ui/src/js/conf/home/router/index.js
index 21e211d..4e7d169 100644
--- a/dolphinscheduler-ui/src/js/conf/home/router/index.js
+++ b/dolphinscheduler-ui/src/js/conf/home/router/index.js
@@ -211,6 +211,30 @@ const router = new Router({
}
},
{
+ path: '/resource/file/createFolder',
+ name: 'resource-file-createFolder',
+ component: resolve =>
require(['../pages/resource/pages/file/pages/createFolder/index'], resolve),
+ meta: {
+ title: `${i18n.$t('Create Resource')}`
+ }
+ },
+ {
+ path: '/resource/file/subFileFolder/:id',
+ name: 'resource-file-subFileFolder',
+ component: resolve =>
require(['../pages/resource/pages/file/pages/subFileFolder/index'], resolve),
+ meta: {
+ title: `${i18n.$t('Create Resource')}`
+ }
+ },
+ {
+ path: '/resource/file/subFile/:id',
+ name: 'resource-file-subFile',
+ component: resolve =>
require(['../pages/resource/pages/file/pages/subFile/index'], resolve),
+ meta: {
+ title: `${i18n.$t('Create Resource')}`
+ }
+ },
+ {
path: '/resource/file/list/:id',
name: 'resource-file-details',
component: resolve =>
require(['../pages/resource/pages/file/pages/details/index'], resolve),
@@ -219,6 +243,14 @@ const router = new Router({
}
},
{
+ path: '/resource/file/subdirectory/:id',
+ name: 'resource-file-subdirectory',
+ component: resolve =>
require(['../pages/resource/pages/file/pages/subdirectory/index'], resolve),
+ meta: {
+ title: `${i18n.$t('File Subdirectory')}`
+ }
+ },
+ {
path: '/resource/file/edit/:id',
name: 'resource-file-edit',
component: resolve =>
require(['../pages/resource/pages/file/pages/edit/index'], resolve),
diff --git a/dolphinscheduler-ui/src/js/conf/home/store/resource/actions.js
b/dolphinscheduler-ui/src/js/conf/home/store/resource/actions.js
old mode 100644
new mode 100755
index 2537062..6077e57
--- a/dolphinscheduler-ui/src/js/conf/home/store/resource/actions.js
+++ b/dolphinscheduler-ui/src/js/conf/home/store/resource/actions.js
@@ -161,6 +161,18 @@ export default {
})
},
/**
+ * Resource online create folder
+ */
+ createResourceFolder ({ state }, payload) {
+ return new Promise((resolve, reject) => {
+ io.post(`resources/directory/create`, payload, res => {
+ resolve(res)
+ }).catch(e => {
+ reject(e)
+ })
+ })
+ },
+ /**
* Resource rename
*/
resourceRename ({ state }, payload) {
diff --git
a/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileUpdate.vue
b/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileChildUpdate.vue
similarity index 97%
copy from dolphinscheduler-ui/src/js/module/components/fileUpdate/fileUpdate.vue
copy to
dolphinscheduler-ui/src/js/module/components/fileUpdate/fileChildUpdate.vue
index b7cef4e..4052c44 100644
--- a/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileUpdate.vue
+++
b/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileChildUpdate.vue
@@ -92,6 +92,7 @@
import store from '@/conf/home/store'
import mPopup from '@/module/components/popup/popup'
import mListBoxF from '@/module/components/listBoxF/listBoxF'
+ import localStore from '@/module/util/localStorage'
import mProgressBar from '@/module/components/progressBar/progressBar'
export default {
@@ -107,6 +108,8 @@
progress: 0,
// file
file: '',
+ currentDir: localStore.getItem('currentDir'),
+ pid: this.id,
// Whether to drag upload
dragOver: false
}
@@ -114,7 +117,8 @@
watch: {
},
props: {
- type: String
+ type: String,
+ id: Number
},
methods: {
/**
@@ -172,6 +176,8 @@
formData.append('file', this.file)
formData.append('type', this.type)
formData.append('name', this.name)
+ formData.append('pid', this.pid)
+ formData.append('currentDir', this.currentDir)
formData.append('description', this.description)
io.post(`resources/create`, res => {
this.$message.success(res.msg)
diff --git
a/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileUpdate.vue
b/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileUpdate.vue
old mode 100644
new mode 100755
index b7cef4e..1fe209e
--- a/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileUpdate.vue
+++ b/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileUpdate.vue
@@ -107,6 +107,8 @@
progress: 0,
// file
file: '',
+ currentDir: '/',
+ pid: -1,
// Whether to drag upload
dragOver: false
}
@@ -172,6 +174,8 @@
formData.append('file', this.file)
formData.append('type', this.type)
formData.append('name', this.name)
+ formData.append('pid', this.pid)
+ formData.append('currentDir', this.currentDir)
formData.append('description', this.description)
io.post(`resources/create`, res => {
this.$message.success(res.msg)
diff --git a/dolphinscheduler-ui/src/js/module/components/nav/nav.vue
b/dolphinscheduler-ui/src/js/module/components/nav/nav.vue
index 7212f51..91fd182 100644
--- a/dolphinscheduler-ui/src/js/module/components/nav/nav.vue
+++ b/dolphinscheduler-ui/src/js/module/components/nav/nav.vue
@@ -155,6 +155,7 @@
import { mapState, mapActions } from 'vuex'
import { findComponentDownward } from '@/module/util/'
import mFileUpdate from '@/module/components/fileUpdate/fileUpdate'
+ import mFileChildUpdate from '@/module/components/fileUpdate/fileChildUpdate'
import mDefinitionUpdate from
'@/module/components/fileUpdate/definitionUpdate'
import mProgressBar from '@/module/components/progressBar/progressBar'
@@ -260,6 +261,46 @@
}
})
},
+ _fileChildUpdate (type,data) {
+ if (this.progress) {
+ this._toggleArchive()
+ return
+ }
+ let self = this
+ let modal = this.$modal.dialog({
+ closable: false,
+ showMask: true,
+ escClose: true,
+ className: 'update-file-modal',
+ transitionName: 'opacityp',
+ render (h) {
+ return h(mFileChildUpdate, {
+ on: {
+ onProgress (val) {
+ self.progress = val
+ },
+ onUpdate () {
+ findComponentDownward(self.$root,
`resource-list-index-${type}`)._updateList(data)
+ self.isUpdate = false
+ self.progress = 0
+ modal.remove()
+ },
+ onArchive () {
+ self.isUpdate = true
+ },
+ close () {
+ self.progress = 0
+ modal.remove()
+ }
+ },
+ props: {
+ type: type,
+ id: data
+ }
+ })
+ }
+ })
+ },
/**
* Upload popup layer display
*/
diff --git a/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
b/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
index 6e8c113..77305d8 100644
--- a/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
+++ b/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
@@ -136,6 +136,7 @@ export default {
'jdbc connect parameters': 'jdbc connect parameters',
'Test Connect': 'Test Connect',
'Please enter resource name': 'Please enter resource name',
+ 'Please enter resource folder name': 'Please enter resource folder name',
'Please enter a non-query SQL statement': 'Please enter a non-query SQL
statement',
'Please enter IP/hostname': 'Please enter IP/hostname',
'jdbc connection parameters is not a correct JSON format': 'jdbc connection
parameters is not a correct JSON format',
@@ -224,8 +225,11 @@ export default {
'execution': 'execution',
'finish': 'finish',
'Create File': 'Create File',
+ 'Create folder': 'Create folder',
'File Name': 'File Name',
+ 'Folder Name': 'Folder Name',
'File Format': 'File Format',
+ 'Folder Format': 'Folder Format',
'File Content': 'File Content',
'Create': 'Create',
'Please enter the resource content': 'Please enter the resource content',
@@ -270,6 +274,9 @@ export default {
'Edit UDF Function': 'Edit UDF Function',
'type': 'type',
'UDF Function Name': 'UDF Function Name',
+ 'FILE': 'FILE',
+ 'UDF': 'UDF',
+ 'File Subdirectory': 'File Subdirectory',
'Please enter a function name': 'Please enter a function name',
'Package Name': 'Package Name',
'Please enter a Package name': 'Please enter a Package name',
@@ -518,4 +525,8 @@ export default {
'SpeedRecord': 'speed(record count)',
'0 means unlimited by byte': '0 means unlimited',
'0 means unlimited by count': '0 means unlimited',
+ 'Modify User': 'Modify User',
+ 'Whether directory': 'Whether directory',
+ 'Yes': 'Yes',
+ 'No': 'No'
}
diff --git a/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js
b/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js
index 52a9877..97325fd 100644
--- a/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js
+++ b/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js
@@ -119,6 +119,9 @@ export default {
'SQL Parameter': 'sql参数',
'SQL Statement': 'sql语句',
'UDF Function': 'UDF函数',
+ 'FILE': '文件',
+ 'UDF': 'UDF',
+ 'File Subdirectory': '文件子目录',
'Please enter a SQL Statement(required)': '请输入sql语句(必填)',
'One form or attachment must be selected': '表格、附件必须勾选一个',
'Recipient required': '收件人邮箱必填',
@@ -137,6 +140,7 @@ export default {
'jdbc connect parameters': 'jdbc连接参数',
'Test Connect': '测试连接',
'Please enter resource name': '请输入数据源名称',
+ 'Please enter resource folder name': '请输入资源文件夹名称',
'Please enter a non-query SQL statement': '请输入非查询sql语句',
'Please enter IP/hostname': '请输入IP/主机名',
'jdbc connection parameters is not a correct JSON format':
'jdbc连接参数不是一个正确的JSON格式',
@@ -222,8 +226,11 @@ export default {
'execution': '执行中',
'finish': '完成',
'Create File': '创建文件',
+ 'Create folder': '创建文件夹',
'File Name': '文件名称',
+ 'Folder Name': '文件夹名称',
'File Format': '文件格式',
+ 'Folder Format': '文件夹格式',
'File Content': '文件内容',
'Upload File Size': '文件大小不能超过1G',
'Create': '创建',
@@ -518,4 +525,8 @@ export default {
'SpeedRecord': '限流(记录数)',
'0 means unlimited by byte': 'KB,0代表不限制',
'0 means unlimited by count': '0代表不限制',
+ 'Modify User': '修改用户',
+ 'Whether directory' : '是否目录',
+ 'Yes': '是',
+ 'No': '否'
}
diff --git a/dolphinscheduler-ui/src/js/module/util/routerUtil.js
b/dolphinscheduler-ui/src/js/module/util/routerUtil.js
index 7ae91f0..c19a8e7 100644
--- a/dolphinscheduler-ui/src/js/module/util/routerUtil.js
+++ b/dolphinscheduler-ui/src/js/module/util/routerUtil.js
@@ -19,7 +19,7 @@ import merge from 'webpack-merge'
import router from '@/conf/home/router'
export function setUrlParams (o) {
- router.push({
- query: merge(router.history.current.query, o)
- })
+ // router.push({
+ // query: merge(router.history.current.query, o)
+ // })
}