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
fc865dd0
Commit
fc865dd0
authored
Jul 17, 2021
by
wanli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat(应用打包模块、文件管理模块):
应用打包模块完善所有页面可用功能;文件管理模块移动GET和POST接口文件;
parent
9d898628
Changes
22
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
334 additions
and
324 deletions
+334
-324
tools/build_out/controllers/app.py
tools/build_out/controllers/app.py
+20
-15
tools/build_out/controllers/package.py
tools/build_out/controllers/package.py
+53
-38
tools/build_out/models/app.py
tools/build_out/models/app.py
+2
-1
tools/build_out/models/package.py
tools/build_out/models/package.py
+15
-6
tools/build_out/views/app.py
tools/build_out/views/app.py
+9
-5
tools/build_out/views/package.20210715165358.py
tools/build_out/views/package.20210715165358.py
+9
-1
tools/build_out/views/package.py
tools/build_out/views/package.py
+46
-17
tools/frontend/src/api/get.js
tools/frontend/src/api/get.js
+1
-1
tools/frontend/src/api/openapi.js
tools/frontend/src/api/openapi.js
+9
-1
tools/frontend/src/api/post.js
tools/frontend/src/api/post.js
+1
-1
tools/frontend/src/router/index.js
tools/frontend/src/router/index.js
+5
-0
tools/frontend/src/store/file-manager/actions.js
tools/frontend/src/store/file-manager/actions.js
+2
-2
tools/frontend/src/store/file-manager/manager/actions.js
tools/frontend/src/store/file-manager/manager/actions.js
+1
-1
tools/frontend/src/store/file-manager/tree/actions.js
tools/frontend/src/store/file-manager/tree/actions.js
+1
-1
tools/frontend/src/utils/index.js
tools/frontend/src/utils/index.js
+8
-0
tools/frontend/src/views/Application/Index.vue
tools/frontend/src/views/Application/Index.vue
+5
-5
tools/frontend/src/views/Application/Manager.vue
tools/frontend/src/views/Application/Manager.vue
+142
-209
tools/frontend/src/views/FileManager/FileManager.vue
tools/frontend/src/views/FileManager/FileManager.vue
+2
-1
tools/frontend/src/views/FileManager/components/blocks/mixins/contextMenuActions.js
...ileManager/components/blocks/mixins/contextMenuActions.js
+1
-1
tools/frontend/src/views/FileManager/components/manager/Thumbnail.vue
...nd/src/views/FileManager/components/manager/Thumbnail.vue
+1
-1
tools/frontend/src/views/FileManager/components/modals/views/Preview.vue
...src/views/FileManager/components/modals/views/Preview.vue
+1
-1
tools/frontend/src/views/FileManager/init.js
tools/frontend/src/views/FileManager/init.js
+0
-16
No files found.
tools/build_out/controllers/app.py
View file @
fc865dd0
...
...
@@ -76,7 +76,7 @@ class AppResource(object):
shutil
.
copy
(
target_file
.
resolve
()
.
as_posix
(),
dst_file
.
resolve
()
.
as_posix
())
app_files
.
append
([
sf
.
id
,
dst_file
.
resolve
()
.
as_posix
()])
target_dir
.
joinpath
(
"epk.json"
)
.
write_text
(
json
.
dumps
(
app
.
to_dict
()),
encoding
=
"utf-8"
)
target_dir
.
joinpath
(
"epk.json"
)
.
write_text
(
json
.
dumps
(
app
.
to_dict
()
,
ensure_ascii
=
False
),
encoding
=
"utf-8"
)
# 打包成EPK文件
app_info
=
{}
...
...
@@ -100,8 +100,12 @@ class AppResource(object):
db
.
session
.
commit
()
# 新增一条AppLogs
package
=
PackageModel
(
app
=
app
.
app_name
,
app_version
=
app
.
app_version
,
file_path
=
epk_path
,
package_info
=
json
.
dumps
(
app_info
),
create_by
=
user
.
id
,
create_at
=
datetime
.
now
())
package
=
PackageModel
(
app
=
app
.
app_name
,
app_version
=
app
.
app_version
,
file_path
=
epk_path
,
package_info
=
json
.
dumps
(
app_info
,
ensure_ascii
=
False
),
create_by
=
user
.
id
,
create_at
=
datetime
.
now
())
db
.
session
.
add
(
package
)
app
.
update_by
=
user
.
id
app
.
update_at
=
datetime
.
now
()
app
.
app_file_size
=
app_info
.
get
(
"buff_length"
,
0
)
app
.
download_url
=
epk_path
db
.
session
.
commit
()
return
{
'app_name'
:
app
.
app_name
,
'app_path'
:
epk_path
},
ResponseCode
.
HTTP_SUCCESS
...
...
@@ -118,19 +122,22 @@ class AppResource(object):
else
:
filters
.
append
(
AppModel
.
create_by
==
user
.
id
)
temp
.
update
({
"create_by"
:
user
.
id
,
"is_delete"
:
False
})
if
"scope
_type"
in
params
and
params
.
get
(
"scope_ty
pe"
)
==
"list"
:
logger
.
info
(
params
)
if
"scope
"
in
params
and
params
.
get
(
"sco
pe"
)
==
"list"
:
result
=
AppModel
.
query
.
filter_by
(
**
temp
)
.
order_by
(
AppModel
.
create_at
.
desc
())
temp
=
[]
for
item
in
result
:
temp
.
append
(
item
.
to_dict
(
only
=
[
"uuid"
,
"app_name"
]))
return
(
temp
,
len
(
temp
)),
ResponseCode
.
HTTP_SUCCESS
elif
"scope_type"
in
params
and
params
.
get
(
"scope_type"
)
==
"distinct"
:
temp
.
append
({
"uuid"
:
item
.
uuid
,
"app_name"
:
item
.
app_name
})
return
temp
,
ResponseCode
.
HTTP_SUCCESS
elif
"scope"
in
params
and
params
.
get
(
"scope"
)
==
"distinct"
:
result
=
db
.
session
.
query
(
AppModel
,
func
.
count
(
distinct
(
AppModel
.
name
)))
.
all
()
temp
=
[]
for
item
in
result
:
temp
.
append
(
item
)
return
(
temp
,
len
(
temp
))
,
ResponseCode
.
HTTP_SUCCESS
return
temp
,
ResponseCode
.
HTTP_SUCCESS
for
p
in
params
:
if
hasattr
(
AppModel
,
p
)
and
params
[
p
]
!=
None
:
...
...
@@ -148,9 +155,6 @@ class AppResource(object):
# handle business
# 应用打包
# 插入一条打包记录
logger
.
info
(
jwt
)
user
=
UserModel
.
query
.
filter
(
UserModel
.
uuid
==
jwt
.
get
(
'uuid'
))
.
one_or_none
()
if
not
user
:
return
False
,
ResponseCode
.
USER_NOT_EXISTS
...
...
@@ -187,12 +191,13 @@ class AppResource(object):
db
.
session
.
add
(
app
)
db
.
session
.
commit
()
logger
.
info
(
params
)
# 在EPK目录下生成JSON文件
epk_path
.
joinpath
(
"epk.json"
)
.
write_text
(
json
.
dumps
(
app
.
to_dict
()),
encoding
=
"utf-8"
)
epk_path
.
joinpath
(
"epk.json"
)
.
write_text
(
json
.
dumps
(
app
.
to_dict
()
,
ensure_ascii
=
False
),
encoding
=
"utf-8"
)
# with open(os.sep.join([os.path.dirname(epk_path), "epk.json"]), "w") as f:
# json.dump(app.to_dict(), f)
logger
.
info
(
app_files
)
for
a
in
app_files
:
t
=
Path
(
config
.
UPLOAD_ROOT_DIR
)
.
joinpath
(
a
)
res
=
AnnexModel
(
app
=
app
.
id
,
title
=
t
.
name
,
path
=
a
,
size
=
t
.
stat
()
.
st_size
,
create_by
=
user
.
id
,
create_at
=
datetime
.
now
(),
update_by
=
user
.
id
,
update_at
=
datetime
.
now
())
...
...
@@ -211,7 +216,7 @@ class AppResource(object):
epk
=
EpkApp
(
**
params
)
app_info
=
epk
.
pack
()
epk_filename
=
epk_path
.
relative_to
(
config
.
UPLOAD_ROOT_DIR
)
.
joinpath
(
"{}.epk"
.
format
(
app
.
app_name
))
.
resolve
()
.
as_posix
()
epk_filename
=
epk_path
.
parent
.
relative_to
(
config
.
UPLOAD_ROOT_DIR
)
.
joinpath
(
"{}.epk"
.
format
(
app
.
app_name
))
.
resolve
()
.
as_posix
()
if
app_info
:
app_info
[
'md5'
]
=
str
(
app_info
[
'md5'
])
...
...
@@ -219,7 +224,7 @@ class AppResource(object):
app
.
download_url
=
epk_filename
db
.
session
.
commit
()
package
=
PackageModel
(
app
=
app
.
id
,
file_path
=
epk_filename
,
app_version
=
params
.
get
(
"appVersion"
),
package_info
=
json
.
dumps
(
app_info
),
source
=
1
,
create_by
=
user
.
id
,
create_at
=
datetime
.
now
(),
update_by
=
user
.
id
,
update_at
=
datetime
.
now
(),
remarks
=
json
.
dumps
(
params
))
package
=
PackageModel
(
app
=
app
.
id
,
file_path
=
epk_filename
,
app_version
=
params
.
get
(
"appVersion"
),
package_info
=
json
.
dumps
(
app_info
,
ensure_ascii
=
False
),
source
=
1
,
create_by
=
user
.
id
,
create_at
=
datetime
.
now
(),
update_by
=
user
.
id
,
update_at
=
datetime
.
now
(),
remarks
=
json
.
dumps
(
params
,
ensure_ascii
=
False
))
db
.
session
.
add
(
package
)
db
.
session
.
commit
()
...
...
tools/build_out/controllers/package.py
View file @
fc865dd0
'''
Author: your name
Date: 2021-06-30 18:03:41
LastEditTime: 2021-07-1
5 17:10:22
LastEditTime: 2021-07-1
7 13:47:11
LastEditors: Please set LastEditors
Description: In User Settings Edit
FilePath:
\
evm-store
\t
ools
\b
uild_out
\
controllers
\
package.py
...
...
@@ -12,6 +12,7 @@ FilePath: \evm-store\tools\build_out\controllers\package.py
import
os
import
re
import
shutil
from
pathlib
import
Path
from
datetime
import
datetime
from
application.app
import
db
,
config
from
models.annex
import
AnnexModel
...
...
@@ -26,7 +27,7 @@ class PackageResource(object):
def
__init__
(
self
):
super
()
.
__init__
()
def
get
(
self
,
uuid
,
params
):
def
get
(
self
,
uuid
,
jwt
):
# handle business
filters
=
[
PackageModel
.
is_delete
==
False
,
PackageModel
.
uuid
==
uuid
]
result
=
PackageModel
.
query
.
filter
(
*
filters
)
.
first
()
...
...
@@ -34,48 +35,60 @@ class PackageResource(object):
return
result
,
ResponseCode
.
HTTP_SUCCESS
return
None
,
ResponseCode
.
HTTP_NOT_FOUND
def
getList
(
self
,
params
):
def
getList
(
self
,
params
,
jwt
):
# handle business
logger
.
warn
(
params
)
filters
=
[
PackageModel
.
is_delete
==
False
]
result
=
PackageModel
.
query
.
filter
(
*
filters
)
.
order_by
(
PackageModel
.
create_at
)
.
paginate
(
params
.
get
(
'page'
,
1
),
params
.
get
(
'pageSize'
,
10
),
error_out
=
False
)
# filters = [PackageModel.is_delete==False]
# result = PackageModel.query.filter(*filters).order_by(PackageModel.create_at).paginate(params.get('page', 1), params.get('pageSize', 10), error_out=False)
# if result:
# return result, ResponseCode.HTTP_SUCCESS
if
result
:
return
result
,
ResponseCode
.
HTTP_SUCCESS
user
=
UserModel
.
query
.
filter
(
id
=
params
.
get
(
'user'
))
.
onr_or_none
()
user
=
UserModel
.
query
.
filter
(
UserModel
.
uuid
==
jwt
.
get
(
'uuid'
))
.
one_or_none
()
if
not
user
:
return
False
,
ResponseCode
.
USER_NOT_EXISTS
temp
=
{}
if
user
.
role
==
"administrator"
:
temp
.
update
({
"is_delete"
:
False
})
if
user
.
role
==
1
:
temp
.
update
({
"is_delete"
:
False
})
else
:
temp
.
update
({
"create_by"
:
user
.
id
,
"is_delete"
:
False
})
if
"scope
_type"
in
params
and
params
.
get
(
"scope_ty
pe"
)
==
"list"
:
if
"scope
"
in
params
and
params
.
get
(
"sco
pe"
)
==
"list"
:
result
=
PackageModel
.
query
.
filter_by
(
**
temp
)
.
order_by
(
PackageModel
.
create_at
.
desc
())
temp
=
[]
for
item
in
result
:
temp
.
append
({
"name"
:
item
.
app
.
app_name
,
"uuid"
:
str
(
item
.
uuid
)
})
return
temp
,
len
(
temp
),
"get build_logs {}."
.
format
(
"success"
if
temp
else
"fail"
)
result
=
PackageModel
.
query
.
filter_by
(
**
temp
)
.
order_by
(
PackageModel
.
create_at
.
desc
())
.
paginate
(
params
.
get
(
"pagenum"
,
1
),
params
.
get
(
"pagesize"
,
10
),
error_out
=
False
)
temp
=
[
PackageModel
.
is_delete
==
False
]
if
params
.
get
(
"app"
)
and
isinstance
(
params
.
get
(
"app"
),
str
):
logger
.
info
(
params
.
get
(
"app"
))
app
=
AppModel
.
query
.
filter
(
AppModel
.
uuid
==
params
.
get
(
"app"
))
.
one_or_none
()
if
app
:
params
.
update
({
"app"
:
app
.
id
})
temp
.
append
(
PackageModel
.
app
==
app
.
id
)
else
:
return
None
,
ResponseCode
.
HTTP_NOT_FOUND
if
params
.
get
(
"app_version"
):
temp
.
append
(
PackageModel
.
app_version
==
params
.
get
(
"app_version"
))
if
params
.
get
(
"algorithm"
):
temp
.
append
(
PackageModel
.
algorithm
==
params
.
get
(
"algorithm"
))
if
params
.
get
(
"source"
):
temp
.
append
(
PackageModel
.
source
==
params
.
get
(
"source"
))
# for p in params:
# if hasattr(PackageModel, p) and params[p] != None:
# logger.info(p)
# temp[p] = params[p]
logger
.
info
(
temp
)
result
=
db
.
session
.
query
(
PackageModel
)
.
join
(
AppModel
,
PackageModel
.
app
==
AppModel
.
id
)
.
filter
(
*
temp
)
.
order_by
(
PackageModel
.
create_at
.
desc
())
.
add_entity
(
AppModel
)
.
paginate
(
params
.
get
(
"page"
,
1
),
params
.
get
(
"pageSize"
,
15
),
error_out
=
False
)
if
result
.
total
and
len
(
result
.
items
):
temp
=
[]
for
item
in
result
.
items
:
t
=
item
.
to_dict
()
t
.
update
({
"create_at"
:
item
.
create_at
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
if
item
.
create_at
else
None
,
"update_at"
:
item
.
update_at
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
if
item
.
update_at
else
None
,
})
temp
.
append
(
t
)
return
(
temp
,
result
.
total
),
ResponseCode
.
HTTP_SUCCESS
return
result
,
ResponseCode
.
HTTP_SUCCESS
return
result
,
ResponseCode
.
HTTP_NO_DATA
def
post
(
self
,
params
,
jwt
=
{}):
# 判断用户是否存在
user
=
UserModel
.
query
.
filter
(
UserModel
.
id
==
params
.
get
(
'user
'
))
user
=
UserModel
.
query
.
filter
(
UserModel
.
uuid
==
jwt
.
get
(
'uuid
'
))
if
not
user
:
return
False
,
ResponseCode
.
USER_NOT_EXISTS
...
...
@@ -90,26 +103,28 @@ class PackageResource(object):
return
None
,
ResponseCode
.
HTTP_NO_DATA
dir_format
=
"{}-{}-{}"
.
format
(
app
.
app_name
,
app
.
app_version
,
datetime
.
now
()
.
strftime
(
"
%
Y
%
m
%
d
%
H
%
M
%
S"
))
upload_dir
=
os
.
sep
.
join
([
config
.
UPLOAD_ROOT_DIR
,
"uploads"
,
"evueapps"
])
target_dir
=
os
.
sep
.
join
([
upload_dir
,
user
.
account
,
dir_format
])
dest_dir
=
os
.
sep
.
join
([
target_dir
,
"src"
])
if
not
os
.
path
.
exists
(
dest_dir
):
os
.
makedirs
(
dest_dir
)
upload_dir
=
Path
(
config
.
UPLOAD_ROOT_DIR
)
.
joinpath
(
"uploads"
)
.
joinpath
(
"evueapps"
)
# upload_dir = os.sep.join([config.UPLOAD_ROOT_DIR, "uploads", "evueapps"])
target_dir
=
upload_dir
.
joinpath
(
user
.
account
)
.
joinpath
(
dir_format
)
# target_dir = os.sep.join([upload_dir, user.account, dir_format])
dest_dir
=
target_dir
.
joinpath
(
"src"
)
# dest_dir = os.sep.join([target_dir, "src"])
if
not
dest_dir
.
exists
():
os
.
makedirs
(
dest_dir
.
resolve
()
.
as_posix
())
app_files
=
[]
for
sf
in
source_files
:
target_file
=
os
.
sep
.
join
([
config
.
UPLOAD_ROOT_DIR
,
sf
.
path
])
filename
=
os
.
path
.
basename
(
target_file
)
name
,
suffix
=
os
.
path
.
splitext
(
filename
)
name
=
re
.
sub
(
r"_\d{14}$"
,
""
,
name
)
dst_file
=
os
.
path
.
normpath
(
os
.
sep
.
join
([
dest_dir
,
name
+
suffix
]))
shutil
.
move
(
os
.
path
.
normpath
(
target_file
),
dst_file
)
app_files
.
append
([
sf
.
id
,
dst_file
])
target_file
=
Path
(
config
.
UPLOAD_ROOT_DIR
)
.
joinpath
(
sf
.
path
)
name
=
re
.
sub
(
r"_\d{14}$"
,
""
,
target_file
.
stem
)
suffix
=
target_file
.
suffix
dst_file
=
dest_dir
.
joinpath
(
name
+
suffix
)
shutil
.
move
(
target_file
.
resolve
()
.
as_posix
(),
dst_file
.
resolve
()
.
as_posix
())
app_files
.
append
([
sf
.
id
,
dst_file
.
resolve
()
.
as_posix
()])
# 打包成EPK文件
app_info
=
{}
params
=
{
'appName'
:
app
.
app_name
,
'appDir'
:
dest_dir
,
'appVersion'
:
app
.
app_version
,
'output'
:
target_dir
}
if
user
.
role
==
"administrator"
or
user
.
role
==
"community"
:
params
=
{
'appName'
:
app
.
app_name
,
'appDir'
:
dest_dir
,
'appVersion'
:
app
.
app_version
,
'output'
:
target_dir
.
resolve
()
.
as_posix
()
}
if
user
.
role
==
1
:
params
[
'algorithm'
]
=
"h"
epk
=
EpkApp
(
**
params
)
app_info
=
epk
.
pack
()
...
...
@@ -125,7 +140,7 @@ class PackageResource(object):
# db.session.flush()
# db.session.commit()
epk_path
=
os
.
sep
.
join
([
target_dir
.
replace
(
config
.
UPLOAD_ROOT_DIR
,
""
),
"{}.epk"
.
format
(
app
.
app_name
)])
.
replace
(
'
\\
'
,
'/'
)
epk_path
=
target_dir
.
relative_to
(
config
.
UPLOAD_ROOT_DIR
)
.
joinpath
(
"{}.epk"
.
format
(
app
.
app_name
))
.
resolve
()
.
as_posix
(
)
# handle business
# result = PackageModel.query.filter(PackageModel.app == params.get('app')).first()
# if result and result.is_delete:
...
...
tools/build_out/models/app.py
View file @
fc865dd0
# -*- coding: utf-8 -*-
from
application.app
import
db
,
ma
from
.base
import
PrimaryModel
from
.base
import
PrimaryModel
from
marshmallow
import
Schema
,
fields
,
INCLUDE
,
EXCLUDE
class
AppModel
(
PrimaryModel
):
...
...
@@ -103,6 +103,7 @@ class GetListAppSchema(ma.SQLAlchemySchema):
uuid
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
page
=
fields
.
Integer
(
required
=
False
,
default
=
1
,
nullable
=
True
)
pageSize
=
fields
.
Integer
(
required
=
False
,
default
=
15
,
nullable
=
True
)
scope
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
app_name
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
app_icon
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
app_version
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
...
...
tools/build_out/models/package.py
View file @
fc865dd0
...
...
@@ -2,7 +2,7 @@
# -*- coding: utf_8 -*-
from
application.app
import
db
,
ma
from
.base
import
PrimaryModel
from
.base
import
PrimaryModel
from
marshmallow
import
Schema
,
fields
,
INCLUDE
,
EXCLUDE
class
PackageModel
(
PrimaryModel
):
...
...
@@ -46,18 +46,25 @@ class PackageModel(PrimaryModel):
return
'<PackageModel
%
r>'
%
(
self
.
app
)
def
to_dict
(
self
):
source
=
'Frontend'
if
self
.
source
==
1
:
source
=
'API'
return
{
'uuid'
:
self
.
uuid
,
'app_version'
:
self
.
app_version
,
'package_info'
:
self
.
package_info
,
'algorithm'
:
self
.
algorithm
,
'file_path'
:
self
.
file_path
,
'source'
:
s
elf
.
s
ource
,
'source'
:
source
,
'user_agent'
:
self
.
user_agent
,
'download_url'
:
self
.
download_url
,
'ip'
:
self
.
ip
,
'geo_location'
:
self
.
geo_location
,
'operator'
:
self
.
operator
,
'remarks'
:
self
.
remarks
'remarks'
:
self
.
remarks
,
"create_at"
:
self
.
create_at
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
if
self
.
create_at
else
None
,
"update_at"
:
self
.
update_at
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
if
self
.
update_at
else
None
,
}
...
...
@@ -67,17 +74,19 @@ class GetListPackageSchema(ma.SQLAlchemySchema):
unknown
=
EXCLUDE
# 未知字段默认排除
model
=
PackageModel
id
=
fields
.
Integer
(
required
=
False
,
nullable
=
True
)
uuid
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
page
=
fields
.
Integer
(
required
=
False
)
pageSize
=
fields
.
Integer
(
required
=
False
)
app
=
ma
.
auto_field
(
)
app
=
fields
.
String
(
required
=
False
)
app_version
=
ma
.
auto_field
()
package_info
=
ma
.
auto_field
(
)
package_info
=
fields
.
String
(
required
=
False
)
file_path
=
ma
.
auto_field
()
source
=
ma
.
auto_field
()
user_agent
=
ma
.
auto_field
()
download_url
=
ma
.
auto_field
()
ip
=
ma
.
auto_field
()
geo_location
=
ma
.
auto_field
(
)
geo_location
=
fields
.
String
(
required
=
False
)
operator
=
ma
.
auto_field
()
getListPackageSchema
=
GetListPackageSchema
()
...
...
tools/build_out/views/app.py
View file @
fc865dd0
...
...
@@ -22,6 +22,8 @@ class AppResourceList(Resource):
@
jwt_required
(
locations
=
[
"headers"
])
def
get
(
self
):
# 特殊参数,即不是从json获取参数的接口,可以将这个注释打开
self
.
parser
.
add_argument
(
"app"
,
type
=
str
,
location
=
"args"
,
nullable
=
True
,
required
=
False
)
self
.
parser
.
add_argument
(
"scope"
,
type
=
str
,
location
=
"args"
,
nullable
=
True
,
required
=
False
)
self
.
parser
.
add_argument
(
"app_name"
,
type
=
str
,
location
=
"args"
,
nullable
=
True
,
required
=
False
)
self
.
parser
.
add_argument
(
"app_version"
,
type
=
str
,
location
=
"args"
,
nullable
=
True
,
required
=
False
)
self
.
parser
.
add_argument
(
"category"
,
type
=
str
,
location
=
"args"
,
nullable
=
True
,
required
=
False
)
...
...
@@ -41,8 +43,12 @@ class AppResourceList(Resource):
result
,
message
=
signalManager
.
actionGetListApp
.
emit
(
data
,
jwt
)
json_dumps
=
getListAppSchema
.
dump
(
result
)
if
result
:
json_dumps
=
getListAppsSchema
.
dump
(
result
.
items
)
return
response_result
(
ResponseCode
.
HTTP_SUCCESS
,
data
=
json_dumps
,
total
=
result
.
total
,
pageSize
=
args
.
pageSize
)
if
isinstance
(
result
,
list
):
json_dumps
=
result
return
response_result
(
ResponseCode
.
HTTP_SUCCESS
,
data
=
json_dumps
)
else
:
json_dumps
=
getListAppsSchema
.
dump
(
result
.
items
)
return
response_result
(
ResponseCode
.
HTTP_SUCCESS
,
data
=
json_dumps
,
total
=
result
.
total
,
pageSize
=
args
.
pageSize
)
return
response_result
(
message
)
except
Exception
as
e
:
traceback
.
print_exc
()
...
...
@@ -73,7 +79,6 @@ class AppResourceList(Resource):
# 获取相对路径
dirname
=
"{}-{}-{}-{}"
.
format
(
params
[
"app_name"
],
params
[
"app_version"
],
params
[
"category"
],
now_str
)
relative_path
=
Path
(
config
.
UPLOAD_ROOT_DIR
)
logger
.
info
(
dirname
)
# 获取最终存储的绝对路径
upload_path
=
Path
(
config
.
EPK_DIR
)
.
joinpath
(
dirname
)
...
...
@@ -105,8 +110,7 @@ class AppResourceList(Resource):
params
.
update
({
"fileList"
:
files
,
"epk_path"
:
upload_path
,
'real_ip'
:
request
.
headers
.
get
(
'X-Forwarded-For'
,
'127.0.0.1'
)
})
result
,
message
=
signalManager
.
actionPostApp
.
emit
(
params
,
jwt
)
if
result
:
logger
.
warn
(
result
)
return
response_result
(
ResponseCode
.
HTTP_SUCCESS
,
data
=
result
,
msg
=
message
)
return
response_result
(
ResponseCode
.
HTTP_SUCCESS
,
data
=
result
)
return
response_result
(
message
)
except
Exception
as
e
:
traceback
.
print_exc
()
...
...
tools/build_out/views/package.20210715165358.py
View file @
fc865dd0
'''
Author: your name
Date: 2021-07-15 09:33:39
LastEditTime: 2021-07-16 19:27:36
LastEditors: your name
Description: In User Settings Edit
FilePath:
\
evm-store
\t
ools
\b
uild_out
\v
iews
\
package.20210715165358.py
'''
from
flask
import
current_app
,
jsonify
,
request
from
flask_restful
import
Resource
from
flask_restful.reqparse
import
RequestParser
...
...
@@ -11,7 +19,7 @@ class PackageResourceList(Resource):
def
__init__
(
self
):
pass
# 特殊参数,即不是从json获取参数的接口,可以将这个注释打开
#
self.parser = RequestParser()
self
.
parser
=
RequestParser
()
def
get
(
self
):
# 特殊参数,即不是从json获取参数的接口,可以将这个注释打开
...
...
tools/build_out/views/package.py
View file @
fc865dd0
'''
Author: your name
Date: 2021-07-15 09:33:39
LastEditTime: 2021-07-17 13:29:31
LastEditors: Please set LastEditors
Description: In User Settings Edit
FilePath:
\
evm-store
\t
ools
\b
uild_out
\v
iews
\
package.py
'''
#!/usr/bin/env python
# -*- coding: utf_8 -*-
import
os
import
json
import
traceback
from
flask
import
current_app
,
jsonify
,
request
from
flask_restful
import
Resource
from
flask_restful.reqparse
import
RequestParser
...
...
@@ -12,36 +23,53 @@ from webcreator.response import ResponseCode, response_result
class
PackageResourceList
(
Resource
):
def
__init__
(
self
):
pass
# 特殊参数,即不是从json获取参数的接口,可以将这个注释打开
#
self.parser = RequestParser()
self
.
parser
=
RequestParser
()
@
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
(
"app"
,
type
=
str
,
location
=
"args"
,
nullable
=
True
,
required
=
False
)
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
()
try
:
json_payload
=
request
.
json
logger
.
warn
(
json_payload
)
data
=
getListPackageSchema
.
load
(
json_payload
)
result
,
message
=
signalManager
.
actionGetListPackage
.
emit
(
data
)
json_dumps
=
getListPackageSchema
.
dump
(
result
)
jwt
=
get_jwt_identity
()
data
=
dict
()
for
key
,
value
in
args
.
items
():
if
value
!=
None
:
data
[
key
]
=
value
result
,
message
=
signalManager
.
actionGetListPackage
.
emit
(
data
,
jwt
)
if
result
:
json_dumps
=
getListPackagesSchema
.
dump
(
result
.
items
)
logger
.
warn
(
json_dumps
)
return
response_result
(
message
,
data
=
json_dumps
,
count
=
result
.
total
)
# json_dumps = getListPackagesSchema.dump(result.items)
replace_key
=
'******'
response
=
[]
for
p
,
a
in
result
.
items
:
t
=
p
.
to_dict
()
if
p
.
geo_location
!=
""
and
isinstance
(
p
.
geo_location
,
str
):
t
[
'geo_location'
]
=
json
.
loads
(
p
.
geo_location
)
if
p
.
remarks
!=
""
and
isinstance
(
p
.
remarks
,
str
):
t
[
'remarks'
]
=
json
.
loads
(
p
.
remarks
)
t
[
'remarks'
][
'appDir'
]
=
replace_key
+
t
[
'remarks'
][
'appDir'
][
len
(
replace_key
):]
t
[
'app_name'
]
=
a
.
app_name
t
[
'file_dir'
]
=
os
.
path
.
dirname
(
p
.
file_path
)
t
[
'application'
]
=
a
.
to_dict
()
t
[
'package_info'
]
=
json
.
loads
(
p
.
package_info
)
t
[
'package_info'
][
'epkfile'
]
=
replace_key
+
t
[
'package_info'
][
'epkfile'
][
len
(
replace_key
):]
response
.
append
(
t
)
return
response_result
(
message
,
data
=
response
,
total
=
result
.
total
,
pageSize
=
args
.
pageSize
)
return
response_result
(
message
)
except
Exception
as
e
:
traceback
.
print_exc
()
current_app
.
logger
.
error
(
e
)
return
response_result
(
ResponseCode
.
HTTP_SERVER_ERROR
)
class
PackageResource
(
Resource
):
def
__init__
(
self
):
pass
# 特殊参数,即不是从json获取参数的接口,可以将这个注释打开
#
self.parser = RequestParser()
self
.
parser
=
RequestParser
()
@
jwt_required
(
locations
=
[
"headers"
])
def
get
(
self
,
uuid
):
...
...
@@ -51,14 +79,15 @@ class PackageResource(Resource):
# args = self.parser.parse_args()
try
:
jwt
=
get_jwt_identity
()
json_payload
=
request
.
json
print
(
"========>"
,
uuid
,
json_payload
)
data
=
getPackageSchema
.
load
(
json_payload
)
result
,
message
=
signalManager
.
actionGetPackage
.
emit
(
uuid
,
data
)
result
,
message
=
signalManager
.
actionGetPackage
.
emit
(
uuid
,
jwt
)
if
result
:
json_dumps
=
getPackageSchema
.
dump
(
result
)
return
response_result
(
message
,
data
=
json_dumps
)
return
response_result
(
message
)
except
Exception
as
e
:
traceback
.
print_exc
()
current_app
.
logger
.
error
(
e
)
return
response_result
(
ResponseCode
.
HTTP_SERVER_ERROR
)
tools/frontend/src/
utils
/get.js
→
tools/frontend/src/
api
/get.js
View file @
fc865dd0
import
request
from
'
.
/axios
'
;
import
request
from
'
@/utils
/axios
'
;
export
default
{
/**
...
...
tools/frontend/src/api/openapi.js
View file @
fc865dd0
/*
* @Author: your name
* @Date: 2021-07-15 09:33:39
* @LastEditTime: 2021-07-16
18:28:38
* @LastEditTime: 2021-07-16
20:19:01
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \evm-store\tools\frontend\src\api\openapi.js
...
...
@@ -53,3 +53,11 @@ export function deleteApplication(uuid) {
method
:
"
delete
"
})
}
export
function
getPackageList
(
params
)
{
return
request
({
url
:
"
/api/v1/package
"
,
method
:
"
get
"
,
params
})
}
tools/frontend/src/
utils
/post.js
→
tools/frontend/src/
api
/post.js
View file @
fc865dd0
import
request
from
'
.
/axios
'
;
import
request
from
'
@/utils
/axios
'
;
export
default
{
/**
...
...
tools/frontend/src/router/index.js
View file @
fc865dd0
...
...
@@ -187,6 +187,11 @@ const router = new Router({
path
:
"
/application/form
"
,
component
:
()
=>
import
(
"
@/views/Application/Form
"
),
},
{
path
:
"
/application/source
"
,
name
:
"
FileManager
"
,
component
:
()
=>
import
(
"
@/views/FileManager/FileManager
"
),
},
],
},
],
...
...
tools/frontend/src/store/file-manager/actions.js
View file @
fc865dd0
/* eslint-disable max-len,prefer-destructuring,object-curly-newline */
import
GET
from
'
@/
utils
/get
'
;
import
POST
from
'
@/
utils
/post
'
;
import
GET
from
'
@/
api
/get
'
;
import
POST
from
'
@/
api
/post
'
;
export
default
{
/**
...
...
tools/frontend/src/store/file-manager/manager/actions.js
View file @
fc865dd0
/* eslint-disable object-curly-newline */
import
GET
from
'
@/
utils
/get
'
;
import
GET
from
'
@/
api
/get
'
;
export
default
{
/**
...
...
tools/frontend/src/store/file-manager/tree/actions.js
View file @
fc865dd0
import
GET
from
'
@/
utils
/get
'
;
import
GET
from
'
@/
api
/get
'
;
export
default
{
/**
...
...
tools/frontend/src/utils/index.js
View file @
fc865dd0
...
...
@@ -272,3 +272,11 @@ export function download(name, url) {
});
}
export
function
saveFile
(
d
,
a
)
{
var
b
=
document
.
createElement
(
'
a
'
);
b
.
href
=
d
;
b
.
download
=
a
;
var
c
=
document
.
createEvent
(
"
MouseEvents
"
);
c
.
initMouseEvent
(
"
click
"
,
true
,
false
,
window
,
0
,
0
,
0
,
0
,
0
,
false
,
false
,
false
,
false
,
0
,
null
);
b
.
dispatchEvent
(
c
);
}
tools/frontend/src/views/Application/Index.vue
View file @
fc865dd0
...
...
@@ -28,7 +28,7 @@
</a-col>
<a-col
:md=
"8"
:sm=
"24"
>
<span
class=
"submitButtons"
>
<a-button
type=
"primary"
htmlType=
"submit"
@
click=
"
onQuery
"
>
<a-button
type=
"primary"
htmlType=
"submit"
@
click=
"
getApplicationList
"
>
查询
</a-button>
<a-button
:style=
"
{ marginLeft: '8px' }" @click="resetForm"> 重置
</a-button>
...
...
@@ -106,7 +106,7 @@
</a-row>
<div
style=
"overflow: hidden"
>
<div
:style=
"
{ float: 'right', marginBottom: '24px' }">
<a-button
type=
"primary"
htmlType=
"submit"
@
click=
"
onQuery
"
>
<a-button
type=
"primary"
htmlType=
"submit"
@
click=
"
getApplicationList
"
>
查询
</a-button>
<a-button
:style=
"
{ marginLeft: '8px' }" @click="resetForm"> 重置
</a-button>
...
...
@@ -408,9 +408,6 @@ export default {
toggleForm
()
{
this
.
expandForm
=
!
this
.
expandForm
;
},
onQuery
()
{
this
.
getApplicationList
();
},
onSelectChange
(
selectedRowKeys
)
{
window
.
console
.
log
(
"
selectedRowKeys changed:
"
,
selectedRowKeys
);
this
.
selectedRowKeys
=
selectedRowKeys
;
...
...
@@ -438,6 +435,7 @@ export default {
// );
},
getApplicationList
()
{
this
.
loading
=
true
let
opts
=
mapTrim
(
this
.
query
);
opts
=
Object
.
assign
(
opts
,
this
.
post
);
...
...
@@ -452,6 +450,8 @@ export default {
})
.
catch
((
err
)
=>
{
message
.
error
(
err
.
msg
);
}).
finally
(()
=>
{
this
.
loading
=
false
});
},
rebuildApplication
(
record
)
{
...
...
tools/frontend/src/views/Application/Manager.vue
View file @
fc865dd0
This diff is collapsed.
Click to expand it.
tools/frontend/src/views/FileManager/FileManager.vue
View file @
fc865dd0
...
...
@@ -37,7 +37,6 @@
</template>
<
script
>
/* eslint-disable import/no-duplicates, no-param-reassign */
import
{
mapState
}
from
"
vuex
"
;
// Axios
import
request
from
"
@/utils/axios
"
;
...
...
@@ -85,6 +84,8 @@ export default {
};
},
created
()
{
console
.
log
(
this
.
$route
.
params
)
// manual settings
this
.
$store
.
commit
(
"
fm/settings/manualSettings
"
,
this
.
settings
);
...
...
tools/frontend/src/views/FileManager/components/blocks/mixins/contextMenuActions.js
View file @
fc865dd0
import
HTTP
from
'
@/
utils
/get
'
;
import
HTTP
from
'
@/
api
/get
'
;
/**
* Context menu actions
...
...
tools/frontend/src/views/FileManager/components/manager/Thumbnail.vue
View file @
fc865dd0
...
...
@@ -11,7 +11,7 @@
</
template
>
<
script
>
import
GET
from
'
@/
utils
/get
'
;
import
GET
from
'
@/
api
/get
'
;
export
default
{
name
:
'
Thumbnail
'
,
...
...
tools/frontend/src/views/FileManager/components/modals/views/Preview.vue
View file @
fc865dd0
...
...
@@ -60,7 +60,7 @@ import CropperModule from "../additions/Cropper.vue";
import
modal
from
"
../mixins/modal
"
;
import
translate
from
"
@/utils/translate
"
;
import
helper
from
"
@/utils/helper
"
;
import
GET
from
"
@/
utils
/get
"
;
import
GET
from
"
@/
api
/get
"
;
export
default
{
name
:
"
Preview
"
,
...
...
tools/frontend/src/views/FileManager/init.js
deleted
100644 → 0
View file @
9d898628
import
store
from
'
@/store/file-manager
'
;
import
FileManager
from
'
./FileManager.vue
'
;
/**
* Install
*
* @param Vue
* @param options
*/
export
default
function
install
(
Vue
,
options
=
{})
{
if
(
!
options
.
store
)
window
.
console
.
error
(
'
Please provide a store!!
'
);
Vue
.
component
(
'
file-manager
'
,
FileManager
);
options
.
store
.
registerModule
(
'
fm
'
,
store
);
}
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