Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
mycard
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
9
Issues
9
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
mycard
Commits
10141262
Commit
10141262
authored
Dec 09, 2016
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v3' of github.com:mycard/mycard into v3
parents
2e4df7f6
97fd7c71
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
173 additions
and
140 deletions
+173
-140
app/app-detail.component.html
app/app-detail.component.html
+1
-1
app/app-detail.component.ts
app/app-detail.component.ts
+12
-2
app/apps.service.ts
app/apps.service.ts
+126
-112
app/download.service.ts
app/download.service.ts
+34
-25
No files found.
app/app-detail.component.html
View file @
10141262
...
...
@@ -66,7 +66,7 @@
<td
*ngIf=
"!mod.isInstalled()"
>
<button
i18n
(click)=
"installMod(mod)"
type=
"button"
*ngIf=
"!mod.isInstalled()"
class=
"btn btn-primary btn-sm"
>
安装
</button>
</td>
<td
*ngIf=
"mod.isInstalled()&&!mod.isReady()"
>
:
<td
*ngIf=
"mod.isInstalled()&&!mod.isReady()"
>
<progress
class=
"progress progress-striped progress-animated"
value=
"{{mod.status.progress}}"
max=
"{{mod.status.total}}"
></progress>
<!--<div i18n *ngIf="mod.isWaiting()">等待安装...</div>-->
</td>
...
...
app/app-detail.component.ts
View file @
10141262
...
...
@@ -145,8 +145,18 @@ export class AppDetailComponent implements OnInit {
this
.
appsService
.
runApp
(
app
,
'
custom
'
);
}
verifyFiles
(
app
:
App
)
{
this
.
appsService
.
verifyFiles
(
app
);
async
verifyFiles
(
app
:
App
)
{
try
{
await
this
.
appsService
.
update
(
app
,
true
);
let
installedMods
=
this
.
appsService
.
findChildren
(
app
).
filter
((
child
)
=>
{
return
child
.
parent
===
app
&&
child
.
isInstalled
()
&&
child
.
isReady
();
});
for
(
let
mod
of
installedMods
)
{
await
this
.
appsService
.
update
(
mod
,
true
);
}
}
catch
(
e
)
{
console
.
log
(
e
);
}
}
copy
(
text
:
string
)
{
...
...
app/apps.service.ts
View file @
10141262
This diff is collapsed.
Click to expand it.
app/download.service.ts
View file @
10141262
...
...
@@ -112,6 +112,7 @@ export class DownloadService {
let
activeList
=
await
this
.
aria2
.
tellActive
();
let
waitList
=
await
this
.
aria2
.
tellWaiting
(
0
,
MAX_LIST_NUM
);
let
stoppedList
=
await
this
.
aria2
.
tellStopped
(
0
,
MAX_LIST_NUM
);
this
.
downloadList
.
clear
();
for
(
let
item
of
activeList
)
{
this
.
downloadList
.
set
(
item
.
gid
,
new
DownloadStatus
(
item
));
}
...
...
@@ -142,33 +143,41 @@ export class DownloadService {
let
gids
=
this
.
taskMap
.
get
(
id
);
if
(
gids
)
{
let
allStatus
:
DownloadStatus
;
this
.
updateEmitter
.
subscribe
(()
=>
{
let
status
:
DownloadStatus
=
new
DownloadStatus
();
// 合并每个状态信息
status
=
gids
!
.
map
((
value
,
index
,
array
)
=>
{
let
s
=
this
.
downloadList
.
get
(
value
);
if
(
!
s
)
{
throw
new
Error
(
"
Gid not Exists
"
);
}
return
s
;
})
.
reduce
((
previousValue
,
currentValue
,
currentIndex
,
array
)
=>
{
return
previousValue
.
combine
(
currentValue
);
},
status
);
if
(
!
allStatus
)
{
allStatus
=
status
;
}
else
{
if
(
allStatus
.
compareTo
(
status
)
!=
0
)
{
let
subscription
=
this
.
updateEmitter
.
subscribe
(()
=>
{
try
{
let
status
:
DownloadStatus
=
new
DownloadStatus
();
// 合并每个状态信息
status
=
gids
!
.
map
((
value
,
index
,
array
)
=>
{
let
s
=
this
.
downloadList
.
get
(
value
);
if
(
!
s
)
{
throw
"
Gid not exists
"
;
}
return
s
;
})
.
reduce
((
previousValue
,
currentValue
,
currentIndex
,
array
)
=>
{
return
previousValue
.
combine
(
currentValue
);
},
status
);
if
(
!
allStatus
)
{
allStatus
=
status
;
}
else
{
if
(
allStatus
.
compareTo
(
status
)
!=
0
)
{
allStatus
=
status
;
}
}
}
if
(
allStatus
.
status
===
"
error
"
)
{
reject
(
`Download Error: code
${
allStatus
.
errorCode
}
, message:
${
allStatus
.
errorMessage
}
`
);
}
else
if
(
allStatus
.
status
===
"
complete
"
)
{
resolve
();
}
else
{
callback
(
allStatus
);
if
(
allStatus
.
status
===
"
error
"
)
{
throw
`Download Error: code
${
allStatus
.
errorCode
}
, message:
${
allStatus
.
errorMessage
}
`
;
}
else
if
(
allStatus
.
status
===
"
complete
"
)
{
resolve
();
subscription
.
unsubscribe
();
}
else
{
callback
(
allStatus
);
}
}
catch
(
e
)
{
reject
(
e
);
subscription
.
unsubscribe
();
}
});
}
else
{
...
...
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