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
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
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
syntax_j
mycard
Commits
1c09ffdc
Commit
1c09ffdc
authored
Nov 25, 2016
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v3' of github.com:mycard/mycard into v3
parents
4136eb34
cf943090
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
93 deletions
+66
-93
app/app-detail.component.html
app/app-detail.component.html
+35
-40
app/app-detail.component.ts
app/app-detail.component.ts
+29
-53
app/app.ts
app/app.ts
+1
-0
i18n/zh-CN.json
i18n/zh-CN.json
+1
-0
No files found.
app/app-detail.component.html
View file @
1c09ffdc
<h1>
{{currentApp.name}}
</h1>
<div
*ngIf=
"currentApp.status.status === 'init'"
>
<button
type=
"button"
class=
"btn btn-primary"
data-toggle=
"modal"
(click)=
"updateInstallConfig()"
<button
type=
"button"
class=
"btn btn-primary"
data-toggle=
"modal"
(click)=
"updateInstallConfig(
currentApp
)"
data-target=
"#install-modal"
>
安装
</button>
<button
type=
"button"
class=
"btn btn-secondary"
>
导入
</button>
...
...
@@ -73,44 +73,6 @@
<br>
</div>-->
<div
*ngIf=
"mods && mods.length"
>
<h2>
Mods
</h2>
<table
class=
"table table-striped"
>
<thead
class=
"thead-inverse"
>
<tr>
<th>
#
</th>
<th>
名称
</th>
<th>
类型
</th>
<th>
操作
</th>
</tr>
</thead>
<tbody>
<tr
*ngFor=
"let mod of mods; let i = index"
>
<th
scope=
"row"
>
{{i + 1}}
</th>
<td>
{{'app.' + mod.id + '.name' | translate}}
</td>
<td>
{{mod.type}}
</td>
<td
*ngIf=
"checkInstall(mod.id)"
>
<button
type=
"button"
class=
"btn btn-danger btn-sm"
>
卸载
</button>
</td>
<td
*ngIf=
"!checkInstall(mod.id)"
>
<button
*ngIf=
"!appsService.getDownloadInfo(mod.id)"
(click)=
"install(mod.id)"
type=
"button"
class=
"btn btn-primary btn-sm"
>
安装
</button>
<progress
*ngIf=
"appsService.getDownloadInfo(mod.id) && appsService.getDownloadInfo(mod.id).status === 'active'"
class=
"progress progress-striped progress-animated"
value=
"{{appsService.getDownloadInfo(mod.id).progress}}"
max=
"100"
></progress>
<div
*ngIf=
"appsService.getDownloadInfo(mod.id) && appsService.getDownloadInfo(mod.id).status === 'wait'"
>
等待安装...
</div>
<div
*ngIf=
"appsService.getDownloadInfo(mod.id) && appsService.getDownloadInfo(mod.id).status === 'install'"
>
正在安装...
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div
*ngIf=
"currentApp.isInstalled()"
>
<h2>
本地文件
</h2>
...
...
@@ -119,12 +81,45 @@
<button
(click)=
"uninstall(currentApp)"
type=
"button"
class=
"btn btn-secondary"
>
{{'uninstall'|translate}}
</button>
<div
*ngIf=
"mods"
>
<h2>
{{'mods'|translate}}
</h2>
<table
class=
"table table-striped"
>
<thead
class=
"thead-inverse"
>
<tr>
<th>
#
</th>
<th>
名称
</th>
<th>
操作
</th>
</tr>
</thead>
<tbody>
<tr
*ngFor=
"let mod of mods; let i = index"
>
<th
scope=
"row"
>
{{i + 1}}
</th>
<td>
{{mod.name}}
</td>
<td
*ngIf=
"mod.isInstalled()"
>
<button
type=
"button"
(click)=
"uninstall(mod)"
class=
"btn btn-danger btn-sm"
>
卸载
</button>
</td>
<td
*ngIf=
"!mod.isInstalled()"
>
<button
(click)=
"installMod(mod)"
type=
"button"
*ngIf=
"mod.status.status==='init'"
class=
"btn btn-primary btn-sm"
>
安装
</button>
<progress
*ngIf=
"mod.status.status==='downloading'"
class=
"progress progress-striped progress-animated"
value=
"{{mod.status.progress}}"
max=
"{{mod.status.total}}"
></progress>
<div
*ngIf=
"mod.status.status==='waiting'"
>
等待安装...
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div
class=
"modal fade"
id=
"install-modal"
tabindex=
"-1"
role=
"dialog"
aria-labelledby=
"myModalLabel"
aria-hidden=
"true"
*ngIf=
"installConfig"
>
<div
class=
"modal-dialog"
role=
"document"
>
<form
id=
"install-form"
class=
"modal-content"
(ngSubmit)=
"install()"
#theForm
="
ngForm
"
>
<form
id=
"install-form"
class=
"modal-content"
(ngSubmit)=
"install(
currentApp
)"
#theForm
="
ngForm
"
>
<div
class=
"modal-header"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
>
<span
aria-hidden=
"true"
>
×
</span>
...
...
app/app-detail.component.ts
View file @
1c09ffdc
...
...
@@ -32,11 +32,11 @@ export class AppDetailComponent implements OnInit {
ngOnInit
()
{
}
updateInstallConfig
()
{
this
.
installConfig
=
new
InstallConfig
(
this
.
currentA
pp
);
updateInstallConfig
(
app
:
App
)
{
this
.
installConfig
=
new
InstallConfig
(
a
pp
);
this
.
installConfig
.
installLibrary
=
this
.
settingsService
.
getDefaultLibrary
().
path
;
this
.
installConfig
.
references
=
[];
for
(
let
reference
of
this
.
currentA
pp
.
references
.
values
())
{
for
(
let
reference
of
a
pp
.
references
.
values
())
{
this
.
installConfig
.
references
.
push
(
new
InstallConfig
(
reference
))
}
}
...
...
@@ -49,71 +49,47 @@ export class AppDetailComponent implements OnInit {
return
this
.
currentApp
.
news
;
}
get
mods
()
{
// let contains = ["optional", "language", "emulator"];
//
// let currentApp = this.appsService.currentApp;
// if (currentApp) {
// if (currentApp.references[process.platform] && currentApp.references[process.platform].length > 0) {
// let refs = currentApp.references[process.platform];
// refs = refs.filter((ref)=> {
// return contains.includes(ref.type);
// });
// refs = refs.map((ref)=> {
// let tmp = Object.create(ref);
// switch (tmp.type) {
// case "optional":
// tmp.type = "选项";
// break;
// case "language":
// tmp.type = "语言";
// break;
// default:
// break;
// }
// //console.log(tmp.type);
// return tmp;
// });
// return refs;
//return this.currentApp.references[process.platform];
// }
// }
return
[];
get
mods
():
App
[]
{
return
this
.
appsService
.
findChildren
(
this
.
currentApp
);
}
async
installMod
(
mod
:
App
)
{
this
.
updateInstallConfig
(
mod
);
await
this
.
install
(
mod
);
}
async
uninstall
(
app
:
App
)
{
if
(
confirm
(
"
确认删除?
"
))
{
await
this
.
installService
.
uninstall
(
app
);
this
.
currentA
pp
.
status
.
status
=
"
init
"
;
a
pp
.
status
.
status
=
"
init
"
;
}
}
async
install
()
{
async
install
(
targetApp
:
App
)
{
$
(
'
#install-modal
'
).
modal
(
'
hide
'
);
let
currentApp
=
this
.
currentApp
;
let
options
=
this
.
installConfig
;
let
dependencies
=
curren
tApp
.
findDependencies
();
let
apps
=
dependencies
.
concat
(
curren
tApp
).
filter
((
app
)
=>
{
let
dependencies
=
targe
tApp
.
findDependencies
();
let
apps
=
dependencies
.
concat
(
targe
tApp
).
filter
((
app
)
=>
{
return
!
app
.
isInstalled
()
});
for
(
let
reference
of
options
.
references
)
{
if
(
reference
.
install
&&
!
reference
.
app
.
isInstalled
())
{
apps
.
push
(
reference
.
app
);
apps
.
push
(...
reference
.
app
.
findDependencies
().
filter
((
app
)
=>
{
return
!
app
.
isInstalled
()
}))
if
(
options
)
{
for
(
let
reference
of
options
.
references
)
{
if
(
reference
.
install
&&
!
reference
.
app
.
isInstalled
())
{
apps
.
push
(
reference
.
app
);
apps
.
push
(...
reference
.
app
.
findDependencies
().
filter
((
app
)
=>
{
return
!
app
.
isInstalled
()
}))
}
}
}
let
downloadPath
=
path
.
join
(
this
.
installConfig
.
installLibrary
,
"
downloading
"
);
try
{
let
downloadApps
=
await
this
.
downloadService
.
addUris
(
apps
,
downloadPath
);
for
(
let
app
of
apps
)
{
for
(
let
app
of
apps
)
{
this
.
downloadService
.
getProgress
(
app
)
.
subscribe
((
progress
)
=>
{
app
.
status
.
status
=
"
downloading
"
;
...
...
@@ -138,18 +114,18 @@ export class AppDetailComponent implements OnInit {
return
this
.
installService
.
add
(
completeApp
,
options
);
});
}));
for
(
let
app
of
apps
)
{
new
Promise
(
async
(
resolve
,
reject
)
=>
{
for
(
let
app
of
apps
)
{
new
Promise
(
async
(
resolve
,
reject
)
=>
{
await
this
.
installService
.
getComplete
(
app
);
app
.
status
.
status
=
'
ready
'
;
app
.
status
.
status
=
'
ready
'
;
resolve
();
})
}
await
this
.
installService
.
getComplete
(
curren
tApp
);
curren
tApp
.
status
.
status
=
"
ready
"
;
await
this
.
installService
.
getComplete
(
targe
tApp
);
targe
tApp
.
status
.
status
=
"
ready
"
;
this
.
ref
.
detectChanges
();
}
catch
(
e
)
{
new
Notification
(
curren
tApp
.
name
,
{
body
:
"
下载失败
"
});
new
Notification
(
targe
tApp
.
name
,
{
body
:
"
下载失败
"
});
}
}
...
...
app/app.ts
View file @
1c09ffdc
...
...
@@ -99,4 +99,5 @@ export class App {
}
return
[];
}
}
i18n/zh-CN.json
View file @
1c09ffdc
...
...
@@ -5,6 +5,7 @@
"cancel"
:
"取消"
,
"install"
:
"安装"
,
"uninstall"
:
"卸载"
,
"mods"
:
"附加模块"
,
"general"
:
"常规"
,
"updates"
:
"更新"
,
"local files"
:
"本地文件"
,
...
...
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