Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
evm-store
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanli
evm-store
Commits
a61e7b5f
Commit
a61e7b5f
authored
Jul 19, 2021
by
wanli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
测试下是否未提交
parent
f7b3f91b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
30 deletions
+31
-30
tools/build_out/controllers/file.py
tools/build_out/controllers/file.py
+13
-7
tools/build_out/views/file.py
tools/build_out/views/file.py
+8
-8
tools/frontend/src/api/get.js
tools/frontend/src/api/get.js
+5
-4
tools/frontend/src/store/file-manager/actions.js
tools/frontend/src/store/file-manager/actions.js
+2
-2
tools/frontend/src/views/FileManager/FileManager.vue
tools/frontend/src/views/FileManager/FileManager.vue
+3
-9
No files found.
tools/build_out/controllers/file.py
View file @
a61e7b5f
...
...
@@ -20,7 +20,7 @@ class FileManager(object):
@param {*} self
@return {*}
'''
def
initialize
(
self
,
jwt
):
def
initialize
(
self
,
path
,
jwt
):
'''
disks: {
files: {driver: "local"},
...
...
@@ -51,7 +51,7 @@ class FileManager(object):
})
else
:
result
[
"disks"
]
.
update
({
"
upload
s"
:
{
"driver"
:
"local"
}
"
epk
s"
:
{
"driver"
:
"local"
}
})
return
result
,
ResponseCode
.
HTTP_SUCCESS
...
...
@@ -61,7 +61,7 @@ class FileManager(object):
@param {*} self
@return {*}
'''
def
content
(
self
,
disk
,
target_path
=
'
'
):
def
content
(
self
,
disk
,
target_path
=
'
.'
,
root
=
"."
):
'''
目录信息结构体:
{
...
...
@@ -96,7 +96,7 @@ class FileManager(object):
"files"
:
[]
}
if
target_path
!=
None
and
target_path
.
find
(
disk
)
>
0
:
if
target_path
!=
None
and
target_path
.
find
(
disk
)
>
-
1
:
disk_path
=
Path
(
disk_root
)
else
:
disk_path
=
Path
(
disk_root
)
.
joinpath
(
disk
)
...
...
@@ -115,6 +115,9 @@ class FileManager(object):
return
None
,
ResponseCode
.
DIRECTORY_NOT_EXISTS
for
child
in
target_path
.
iterdir
():
if
child
.
resolve
()
.
as_posix
()
.
find
(
root
)
<
0
:
continue
if
child
.
is_dir
():
result
[
"directories"
]
.
append
({
"basename"
:
child
.
name
,
...
...
@@ -142,14 +145,17 @@ class FileManager(object):
f
.
write
(
json
.
dumps
(
result
,
ensure_ascii
=
True
))
# pprint.pprint(result)
return
result
,
ResponseCode
.
HTTP_SUCCESS
if
len
(
result
[
"directories"
])
or
len
(
result
[
"files"
]):
return
result
,
ResponseCode
.
HTTP_SUCCESS
else
:
return
None
,
ResponseCode
.
HTTP_NO_DATA
'''
@description: 获取目录结构树
@param {*} self
@return {*}
'''
def
tree
(
self
,
disk
,
target_path
=
"
/
"
):
def
tree
(
self
,
disk
,
target_path
=
"
."
,
root
=
".
"
):
'''
{
basename: "trees"
...
...
@@ -180,7 +186,7 @@ class FileManager(object):
# p = Path(disk_path)
for
child
in
temp_path
.
iterdir
():
if
child
.
is_dir
():
if
child
.
is_dir
()
and
child
.
resolve
()
.
name
.
find
(
root
)
>
-
1
:
result
.
append
({
"basename"
:
child
.
name
,
"dirname"
:
child
.
parent
.
relative_to
(
rp
)
.
as_posix
(),
...
...
tools/build_out/views/file.py
View file @
a61e7b5f
'''
Author: your name
Date: 2021-07-09 12:39:40
LastEditTime: 2021-07-19
09:32:48
LastEditTime: 2021-07-19
13:58:36
LastEditors: Please set LastEditors
Description: In User Settings Edit
FilePath:
\
evm-store
\t
ools
\b
uild_out
\v
iews
\f
ile.py
...
...
@@ -27,13 +27,12 @@ class FileInit(Resource):
@
jwt_required
(
locations
=
[
"headers"
])
def
get
(
self
):
# 特殊参数,即不是从json获取参数的接口,可以将这个注释打开
# self.parser.add_argument("page", type=int, location="args", default=1)
# self.parser.add_argument("pageSize", type=int, location="args", default=15)
# args = self.parser.parse_args()
self
.
parser
.
add_argument
(
"path"
,
type
=
str
,
location
=
"args"
,
required
=
False
)
args
=
self
.
parser
.
parse_args
()
try
:
jwt
=
get_jwt_identity
()
result
,
message
=
signalManager
.
actionGetFileInit
.
emit
(
jwt
)
result
,
message
=
signalManager
.
actionGetFileInit
.
emit
(
args
.
path
,
jwt
)
if
result
:
return
{
'config'
:
result
,
'result'
:
{
'message'
:
None
,
'status'
:
"success"
}
}
return
{
'information'
:
list
(
message
),
'result'
:
{
'message'
:
"no data"
,
'status'
:
"fail"
}
}
...
...
@@ -52,10 +51,11 @@ class FileContent(Resource):
# 特殊参数,即不是从json获取参数的接口,可以将这个注释打开
self
.
parser
.
add_argument
(
"disk"
,
type
=
str
,
location
=
"args"
,
required
=
True
)
self
.
parser
.
add_argument
(
"path"
,
type
=
str
,
location
=
"args"
,
required
=
False
,
default
=
None
)
self
.
parser
.
add_argument
(
"root"
,
type
=
str
,
location
=
"args"
,
required
=
True
)
args
=
self
.
parser
.
parse_args
()
try
:
result
,
message
=
signalManager
.
actionGetFileContent
.
emit
(
args
.
disk
,
args
.
path
)
result
,
message
=
signalManager
.
actionGetFileContent
.
emit
(
args
.
disk
,
args
.
path
,
args
.
root
)
if
result
:
response
=
{
'result'
:
{
'message'
:
None
,
'status'
:
"success"
}
}
response
.
update
(
result
)
...
...
@@ -76,12 +76,12 @@ class FileTree(Resource):
# 特殊参数,即不是从json获取参数的接口,可以将这个注释打开
self
.
parser
.
add_argument
(
"disk"
,
type
=
str
,
location
=
"args"
,
required
=
True
)
self
.
parser
.
add_argument
(
"path"
,
type
=
str
,
location
=
"args"
,
required
=
False
)
self
.
parser
.
add_argument
(
"root"
,
type
=
str
,
location
=
"args"
,
required
=
True
)
args
=
self
.
parser
.
parse_args
()
try
:
result
,
message
=
signalManager
.
actionGetFileTree
.
emit
(
args
.
disk
,
args
.
path
)
result
,
message
=
signalManager
.
actionGetFileTree
.
emit
(
args
.
disk
,
args
.
path
,
args
.
root
)
if
result
:
logger
.
info
(
result
)
response
=
{
'result'
:
{
'message'
:
None
,
'status'
:
"success"
},
'directories'
:
None
}
response
.
update
({
'directories'
:
result
})
return
response
...
...
tools/frontend/src/api/get.js
View file @
a61e7b5f
...
...
@@ -5,8 +5,9 @@ export default {
* Get configuration data from server
* @returns {*}
*/
initialize
()
{
return
request
.
get
(
'
initialize
'
);
initialize
(
path
)
{
console
.
log
(
path
)
return
request
.
get
(
'
initialize
'
,
{
params
:
{
path
}
});
},
/**
...
...
@@ -16,7 +17,7 @@ export default {
* @returns {*}
*/
tree
(
disk
,
path
)
{
return
request
.
get
(
'
tree
'
,
{
params
:
{
disk
,
path
}
});
return
request
.
get
(
'
tree
'
,
{
params
:
{
disk
,
path
,
root
:
window
.
sessionStorage
.
getItem
(
"
DISK_ROOT
"
)
}
});
},
/**
...
...
@@ -35,7 +36,7 @@ export default {
* @returns {*}
*/
content
(
disk
,
path
)
{
return
request
.
get
(
'
content
'
,
{
params
:
{
disk
,
path
}
});
return
request
.
get
(
'
content
'
,
{
params
:
{
disk
,
path
,
root
:
window
.
sessionStorage
.
getItem
(
"
DISK_ROOT
"
)
}
});
},
/**
...
...
tools/frontend/src/store/file-manager/actions.js
View file @
a61e7b5f
...
...
@@ -10,8 +10,8 @@ export default {
* @param getters
* @param dispatch
*/
initializeApp
({
state
,
commit
,
getters
,
dispatch
})
{
GET
.
initialize
().
then
((
response
)
=>
{
initializeApp
({
state
,
commit
,
getters
,
dispatch
}
,
{
directory
}
)
{
GET
.
initialize
(
directory
).
then
((
response
)
=>
{
if
(
response
.
data
.
result
.
status
===
'
success
'
)
{
commit
(
'
settings/initSettings
'
,
response
.
data
.
config
);
commit
(
'
setDisks
'
,
response
.
data
.
config
.
disks
);
...
...
tools/frontend/src/views/FileManager/FileManager.vue
View file @
a61e7b5f
...
...
@@ -88,13 +88,9 @@ export default {
},
created
()
{
// disk and path
console
.
log
(
this
.
$route
.
params
);
const
params
=
this
.
$route
.
params
;
if
(
params
.
disk
&&
params
.
path
)
{
this
.
$store
.
dispatch
(
"
fm/selectDisk
"
,
{
disk
:
params
.
disk
,
manager
:
"
left
"
,
});
if
(
params
.
directory
)
{
window
.
sessionStorage
.
setItem
(
"
DISK_ROOT
"
,
params
.
directory
)
}
// manual settings
...
...
@@ -106,7 +102,7 @@ export default {
this
.
responseInterceptor
();
// initialize app settings
this
.
$store
.
dispatch
(
"
fm/initializeApp
"
);
this
.
$store
.
dispatch
(
"
fm/initializeApp
"
,
{
directory
:
params
.
directory
}
);
/**
* todo Keyboard event
...
...
@@ -120,8 +116,6 @@ export default {
});
*/
// 切换目录
},
destroyed
()
{
// reset state
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment