未验证 提交 6a40b750 编写于 作者: X xingchun-chen 提交者: GitHub

Merge pull request #4646 from chengshiwen/improve-file-type

[Improvement][UI] Support more file types in file detail page
...@@ -18,6 +18,6 @@ ...@@ -18,6 +18,6 @@
/** /**
* Create file type * Create file type
*/ */
const filtTypeArr = ['txt', 'log', 'sh', 'conf', 'cfg', 'py', 'java', 'sql', 'xml', 'hql', 'properties'] const filtTypeArr = ['txt', 'log', 'sh', 'bat', 'conf', 'cfg', 'py', 'java', 'sql', 'xml', 'hql', 'properties', 'json', 'yml', 'yaml', 'ini', 'js', 'css', 'html']
export { filtTypeArr } export { filtTypeArr }
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
     
</div> </div>
</h2> </h2>
<template v-if="isNoType"> <template v-if="isViewType">
<div class="code-mirror-model" v-if="!msg"> <div class="code-mirror-model" v-if="!msg">
<textarea id="code-details-mirror" name="code-details-mirror"></textarea> <textarea id="code-details-mirror" name="code-details-mirror"></textarea>
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<m-no-data :msg="msg" v-if="msg"></m-no-data> <m-no-data :msg="msg" v-if="msg"></m-no-data>
</template> </template>
<template v-if="!isNoType"> <template v-if="!isViewType">
<m-no-type></m-no-type> <m-no-type></m-no-type>
</template> </template>
</div> </div>
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
data () { data () {
return { return {
name: '', name: '',
isNoType: true, isViewType: true,
isLoading: false, isLoading: false,
filtTypeArr: filtTypeArr, filtTypeArr: filtTypeArr,
loadingIndex: 0, loadingIndex: 0,
...@@ -197,10 +197,10 @@ ...@@ -197,10 +197,10 @@
let a = fileName.substring(i, fileName.length) let a = fileName.substring(i, fileName.length)
this.mode = handlerSuffix[a] this.mode = handlerSuffix[a]
this.size = bytesToSize(parseInt(fileSize)) this.size = bytesToSize(parseInt(fileSize))
this.isNoType = _.includes(this.filtTypeArr, _.trimStart(a, '.')) this.isViewType = _.includes(this.filtTypeArr, _.trimStart(a, '.'))
}, },
mounted () { mounted () {
if (this.isNoType) { if (this.isViewType) {
// get data // get data
this._getViewResources() this._getViewResources()
} }
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<h2> <h2>
<span>{{name}}</span> <span>{{name}}</span>
</h2> </h2>
<template v-show="isNoType"> <template v-show="isViewType">
<template v-if="!msg"> <template v-if="!msg">
<div class="code-mirror-model"> <div class="code-mirror-model">
<textarea id="code-edit-mirror" name="code-edit-mirror"></textarea> <textarea id="code-edit-mirror" name="code-edit-mirror"></textarea>
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
<m-no-data :msg="msg" v-if="msg"></m-no-data> <m-no-data :msg="msg" v-if="msg"></m-no-data>
</template> </template>
<template v-if="!isNoType"> <template v-if="!isViewType">
<m-no-type></m-no-type> <m-no-type></m-no-type>
</template> </template>
</div> </div>
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
data () { data () {
return { return {
name: '', name: '',
isNoType: true, isViewType: true,
isLoading: false, isLoading: false,
filtTypeArr: filtTypeArr, filtTypeArr: filtTypeArr,
loadingIndex: 0, loadingIndex: 0,
...@@ -165,10 +165,10 @@ ...@@ -165,10 +165,10 @@
let a = fileName.substring(i, fileName.length) let a = fileName.substring(i, fileName.length)
this.mode = handlerSuffix[a] this.mode = handlerSuffix[a]
this.size = bytesToSize(parseInt(fileSize)) this.size = bytesToSize(parseInt(fileSize))
this.isNoType = _.includes(this.filtTypeArr, _.trimStart(a, '.')) this.isViewType = _.includes(this.filtTypeArr, _.trimStart(a, '.'))
}, },
mounted () { mounted () {
if (this.isNoType) { if (this.isViewType) {
// get data // get data
this._getViewResources() this._getViewResources()
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册