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
ba6e79d1
Commit
ba6e79d1
authored
Mar 16, 2021
by
wanli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
c4e041d0
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
66 additions
and
40 deletions
+66
-40
.gitignore
.gitignore
+1
-0
backend/controller/apps_manager.py
backend/controller/apps_manager.py
+10
-1
backend/controller/build_logs_manager.py
backend/controller/build_logs_manager.py
+13
-11
backend/view/apps.py
backend/view/apps.py
+10
-0
frontend/src/api/app-store.js
frontend/src/api/app-store.js
+7
-0
frontend/src/utils/index.js
frontend/src/utils/index.js
+9
-8
frontend/src/views/app-store/index.vue
frontend/src/views/app-store/index.vue
+15
-19
frontend/src/views/login/index.vue
frontend/src/views/login/index.vue
+1
-1
No files found.
.gitignore
View file @
ba6e79d1
...
...
@@ -44,6 +44,7 @@ backend/upload/
backend/uploads/
backend/static/
backend/config.ini
*/app-store.db
config.ini
release/
...
...
backend/controller/apps_manager.py
View file @
ba6e79d1
...
...
@@ -10,14 +10,19 @@ import traceback
from
datetime
import
datetime
from
pony.orm
import
*
from
flask
import
request
from
app
import
signalManager
from
model
import
fullStackDB
from
model.annex
import
Annex
from
model.apps
import
Apps
from
model.user
import
User
from
utils
import
sql_filter
from
utils
import
sql_filter
,
ThreadMaker
logger
=
logging
.
getLogger
(
"AppsManager"
)
@
ThreadMaker
def
build_application
(
uuid
):
signalManager
.
actionAddBuildLog
.
emit
(
uuid
)
class
AppsManager
(
object
):
def
__init__
(
self
):
super
(
AppsManager
,
self
)
.
__init__
()
...
...
@@ -57,6 +62,8 @@ class AppsManager(object):
flush
()
commit
()
build_application
(
str
(
result
.
uuid
))
return
result
,
"add app {}."
.
format
(
"success"
if
result
else
"fail"
)
def
delete
(
self
,
uuid
):
...
...
@@ -154,6 +161,8 @@ class AppsManager(object):
result
.
set
(
update_at
=
datetime
.
now
(),
update_by
=
editor
,
**
data
)
commit
()
build_application
(
str
(
result
.
uuid
))
return
result
,
"update app {}."
.
format
(
"success"
if
result
else
"fail"
)
appsManager
=
AppsManager
()
backend/controller/build_logs_manager.py
View file @
ba6e79d1
...
...
@@ -66,12 +66,6 @@ class BuildLogsManager(object):
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
])
# if os.path.exists(target_file):
# shutil.move(target_file, dest_dir)
# app_files.append([sf.id, os.sep.join([dest_dir, os.path.basename(parsed_result.path)])])
# else:
# print("file not found: %s" % target_file)
# break
try
:
# 打包成EPK文件
...
...
@@ -80,6 +74,7 @@ class BuildLogsManager(object):
except
Exception
as
e
:
logger
.
error
(
e
)
traceback
.
print_exc
()
return
False
,
e
# 更新数据库对应文件路径
for
sf
in
source_files
:
...
...
@@ -106,11 +101,18 @@ class BuildLogsManager(object):
result
=
fullStackDB
.
update
(
BuildLogs
,
{
'uuid'
:
uuid
},
is_delete
=
True
,
delete_at
=
datetime
.
now
(),
delete_by
=
editor
)
return
result
,
"delete build_logs {}."
.
format
(
"success"
if
result
else
"fail"
)
def
get
(
self
,
data
):
result
=
BuildLogs
.
get
(
**
data
)
if
result
:
result
=
result
.
to_dict
(
only
=
[
"uuid"
,
"name"
,
"create_at"
,
"update_at"
])
return
result
,
"get build_logs {}."
.
format
(
"success"
if
result
else
"no data"
)
def
get
(
self
,
app_id
):
with
db_session
:
app
=
Apps
.
get
(
uuid
=
app_id
)
if
not
app
:
return
False
,
"app not found"
result
=
BuildLogs
.
get
(
app
=
app
)
print
(
result
)
if
result
:
result
=
result
.
to_dict
(
only
=
[
"uuid"
,
"app_path"
])
result
.
update
({
"app_name"
:
app
.
app_name
})
return
result
,
"get build_logs {}."
.
format
(
"success"
if
result
else
"no data"
)
def
getList
(
self
,
data
):
if
not
data
or
len
(
data
)
<=
0
:
...
...
backend/view/apps.py
View file @
ba6e79d1
...
...
@@ -105,6 +105,16 @@ def build_app(id):
else
:
return
response_result
(
ResponseCode
.
NOTHING_CHANGE
,
msg
=
message
)
@
apps_api
.
route
(
"/getBuildApp/<uuid:id>"
,
methods
=
[
'POST'
])
@
validate_schema
(
LogAddScheme
)
@
Auth
.
auth_required
def
get_build_app
(
id
):
result
,
message
=
signalManager
.
actionGetBuildLog
.
emit
(
id
)
if
result
:
return
response_result
(
ResponseCode
.
OK
,
data
=
result
,
msg
=
message
)
else
:
return
response_result
(
ResponseCode
.
NOTHING_CHANGE
,
msg
=
message
)
@
apps_api
.
route
(
"/buildLogs"
,
methods
=
[
'POST'
])
@
validate_schema
(
LogQuerySchema
)
@
Auth
.
auth_required
...
...
frontend/src/api/app-store.js
View file @
ba6e79d1
...
...
@@ -31,6 +31,13 @@ export function deleteApp(id) {
});
}
export
function
getBuildApp
(
id
)
{
return
request
({
url
:
`/api/v1/evm_store/apps/getBuildApp/
${
id
}
`
,
method
:
"
post
"
})
}
export
function
buildApp
(
id
)
{
return
request
({
url
:
`/api/v1/evm_store/apps/build/
${
id
}
`
,
...
...
frontend/src/utils/index.js
View file @
ba6e79d1
...
...
@@ -285,14 +285,15 @@ export function formatBytes(bytes, decimals) {
}
export
function
download
(
name
,
url
)
{
return
new
Promise
((
resolve
)
=>
{
var
a
=
document
.
createElement
(
"
a
"
);
a
.
href
=
url
;
a
.
download
=
name
;
a
.
target
=
"
_blank
"
;
a
.
click
();
resolve
();
});
return
new
Promise
((
resolve
)
=>
{
var
a
=
document
.
createElement
(
"
a
"
);
a
.
href
=
url
;
a
.
download
=
name
;
a
.
target
=
"
_blank
"
;
a
.
click
();
resolve
();
// document.body.removeChild(a);
});
}
export
function
checkURL
(
URL
)
{
...
...
frontend/src/views/app-store/index.vue
View file @
ba6e79d1
...
...
@@ -67,7 +67,7 @@
size=
"mini"
type=
"primary"
@
click=
"handleBuild(scope.$index, scope.row)"
>
一键打包
</el-button
>
下载应用
</el-button
>
<el-button
size=
"mini"
...
...
@@ -192,8 +192,8 @@
</div>
</template>
<
script
>
import
{
getAppsList
,
deleteApp
,
addApp
,
updateApp
,
b
uildApp
,
addFramework
}
from
"
@/api/app-store
"
;
import
{
mapTrim
,
checkURL
}
from
"
@/utils/index
"
;
import
{
getAppsList
,
deleteApp
,
addApp
,
updateApp
,
getB
uildApp
,
addFramework
}
from
"
@/api/app-store
"
;
import
{
mapTrim
,
checkURL
,
download
}
from
"
@/utils/index
"
;
export
default
{
name
:
"
AppIndex
"
,
...
...
@@ -256,16 +256,17 @@ export default {
});
},
handleSizeChange
(
e
)
{
this
.
form
.
pagesize
=
e
;
this
.
fetchData
(
mapTrim
(
this
.
form
));
this
.
form
.
pagesize
=
e
;
this
.
fetchData
(
mapTrim
(
this
.
form
));
},
handleCurrentChange
(
e
)
{
this
.
form
.
pagenum
=
e
;
this
.
fetchData
(
mapTrim
(
this
.
form
));
this
.
form
.
pagenum
=
e
;
this
.
fetchData
(
mapTrim
(
this
.
form
));
},
handleBuild
(
index
,
row
)
{
console
.
log
(
index
)
buildApp
(
row
.
uuid
).
then
(
res
=>
{
getBuildApp
(
row
.
uuid
).
then
(
res
=>
{
download
(
res
.
data
.
app_name
,
res
.
data
.
app_path
)
this
.
$message
.
success
(
res
.
message
)
}).
catch
(
err
=>
{
console
.
log
(
err
)
...
...
@@ -273,11 +274,11 @@ export default {
})
},
handleEdit
(
index
,
row
)
{
this
.
post
=
Object
.
assign
(
row
);
this
.
currentIndex
=
index
;
this
.
currentValue
=
row
;
this
.
dialogTitle
=
"
编辑
"
;
this
.
dialogVisible
=
true
;
this
.
post
=
Object
.
assign
(
row
);
this
.
currentIndex
=
index
;
this
.
currentValue
=
row
;
this
.
dialogTitle
=
"
编辑
"
;
this
.
dialogVisible
=
true
;
},
handleDelete
(
index
,
row
)
{
this
.
$alert
(
...
...
@@ -345,9 +346,7 @@ export default {
}
console
.
log
(
file
);
},
handleFrameworkRemove
()
{
},
handleFrameworkRemove
()
{},
handleFrameworkSuccess
(
res
)
{
this
.
framework
.
assets
.
files
.
push
(
res
.
data
)
},
...
...
@@ -382,9 +381,6 @@ export default {
this
.
dialogVisible
=
false
;
return
result
;
});
},
submitFramework
()
{
},
addFramework
()
{
addFramework
(
this
.
framework
).
then
(
res
=>
{
...
...
frontend/src/views/login/index.vue
View file @
ba6e79d1
...
...
@@ -39,7 +39,7 @@
<button
class=
"ghost"
@
click=
"isActive = false"
>
登录
</button>
</div>
<div
class=
"overlay-panel overlay-right"
>
<h1>
项目管理平台
</h1>
<h1>
EVM应用商店
</h1>
<p>
注册账号请联系超级管理员
</p>
<button
class=
"ghost"
@
click=
"$message.success('请联系超级管理员')"
>
注册
...
...
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