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