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
fe5dec80
Commit
fe5dec80
authored
Dec 14, 2016
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
导入
parent
4ab3842e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
97 additions
and
7 deletions
+97
-7
app/app-detail.component.css
app/app-detail.component.css
+13
-0
app/app-detail.component.html
app/app-detail.component.html
+53
-3
app/app-detail.component.ts
app/app-detail.component.ts
+31
-4
No files found.
app/app-detail.component.css
View file @
fe5dec80
...
...
@@ -52,4 +52,17 @@ progress {
#network
.input-group-btn
>
.dropdown-toggle
{
border-bottom-left-radius
:
0
;
border-top-left-radius
:
0
;
}
.custom-file
{
width
:
100%
;
}
.custom-file-control
:lang
(
en
)
::after
{
content
:
initial
;
}
.custom-file-control
{
overflow
:
hidden
;
white-space
:
nowrap
;
}
\ No newline at end of file
app/app-detail.component.html
View file @
fe5dec80
<h1>
{{currentApp.name}}
</h1>
<!--应用未安装-->
<div
class=
"actions"
*ngIf=
"!currentApp.isInstalled()"
>
<button
i18n
type=
"button"
class=
"btn btn-primary"
data-toggle=
"modal"
(click)=
"updateInstallOption(currentApp)
"
data-target=
"#install-modal"
>
安装
</button>
<button
i18n
(click)=
"importGame(currentApp)"
type=
"button"
class=
"btn btn-secondary
"
>
导入
</button>
<button
i18n
(click)=
"updateInstallOption(currentApp)"
type=
"button"
class=
"btn btn-primary"
data-toggle=
"modal
"
data-target=
"#install-modal"
>
安装
</button>
<button
i18n
*ngIf=
"currentApp.runnable()"
(click)=
"updateInstallOption(currentApp)"
type=
"button"
class=
"btn btn-secondary"
data-toggle=
"modal"
data-target=
"#import-modal
"
>
导入
</button>
</div>
<!--应用变更中-->
...
...
@@ -119,7 +119,57 @@
</div>
<div
class=
"modal-footer"
>
<button
i18n
type=
"button"
class=
"btn btn-secondary"
data-dismiss=
"modal"
>
取消
</button>
<button
i18n
id=
"submit"
type=
"submit"
[disabled]=
"!theForm.form.valid"
class=
"btn btn-primary"
>
安装
</button>
<button
i18n
type=
"submit"
[disabled]=
"!theForm.form.valid"
class=
"btn btn-primary"
>
安装
</button>
</div>
</form>
</div>
</div>
<div
class=
"modal fade"
id=
"import-modal"
tabindex=
"-1"
role=
"dialog"
aria-labelledby=
"myModalLabel"
aria-hidden=
"true"
*ngIf=
"installOption"
>
<div
class=
"modal-dialog"
role=
"document"
>
<form
id=
"import-form"
class=
"modal-content"
(ngSubmit)=
"importGame(currentApp,installOption,referencesInstall)"
#theForm
="
ngForm
"
>
<div
class=
"modal-header"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
>
<span>
×
</span>
</button>
<h4
i18n
class=
"modal-title"
>
导入 {{currentApp.name}}
</h4>
</div>
<div
class=
"modal-body"
>
<p
i18n
>
选择主程序 {{currentApp.actions.get('main').execute}}
</p>
<label
class=
"custom-file"
lang=
"en"
>
<input
(click)=
"$event.preventDefault();selectImport(currentApp)"
type=
"file"
id=
"file"
class=
"custom-file-input"
>
<span
class=
"custom-file-control"
>
{{import_path || currentApp.actions.get('main').execute}}
</span>
</label>
<h4
i18n
>
导入到
</h4>
<div
class=
"form-group"
>
<select
class=
"form-control"
name=
"installPath"
(change)=
"selectLibrary()"
[(ngModel)]=
"installOption.installLibrary"
title=
"path"
>
<option
*ngFor=
"let library of libraries"
value=
"{{library}}"
>
{{library}}
</option>
<option
*ngFor=
"let library of availableLibraries"
value=
"create_{{library}}"
>
在 {{library}}\ 盘新建 MyCard 库
</option>
</select>
</div>
<!--<h4 i18n>快捷方式</h4>-->
<!--<div class="checkbox">-->
<!--<input id="create_application_shortcut" type="checkbox" name="application" [(ngModel)]="installOption.createShortcut">-->
<!--<label i18n *ngIf="platform == 'darwin'" for="create_application_shortcut">创建 LaunchPad 快捷方式</label>-->
<!--<label i18n *ngIf="platform == 'win32'" for="create_application_shortcut">创建开始菜单快捷方式</label>-->
<!--</div>-->
<!--<div class="checkbox">-->
<!--<input id="create_desktop_shortcut" type="checkbox" name="desktop" [(ngModel)]="installOption.createDesktopShortcut">-->
<!--<label i18n for="create_desktop_shortcut">创建桌面快捷方式</label>-->
<!--</div>-->
<h4
i18n
*ngIf=
"references.length>0"
>
扩展内容
</h4>
<div
*ngFor=
"let reference of references"
><label>
<input
type=
"checkbox"
[(ngModel)]=
"referencesInstall[reference.id]"
name=
"references"
>
{{reference.name}}
</label></div>
<div
*ngIf=
"currentApp.findDependencies().length"
>
<span
i18n
>
依赖:
</span>
<span
class=
"dependency"
*ngFor=
"let dependency of currentApp.findDependencies()"
>
{{dependency.name}}
</span>
</div>
</div>
<div
class=
"modal-footer"
>
<button
i18n
type=
"button"
class=
"btn btn-secondary"
data-dismiss=
"modal"
>
取消
</button>
<button
i18n
type=
"submit"
[disabled]=
"import_path && !theForm.form.valid"
class=
"btn btn-primary"
>
导入
</button>
</div>
</form>
</div>
...
...
app/app-detail.component.ts
View file @
fe5dec80
import
{
Component
,
OnInit
,
Input
,
ChangeDetectorRef
,
OnChanges
,
SimpleChanges
}
from
"
@angular/core
"
;
import
{
Component
,
OnInit
,
Input
,
ChangeDetectorRef
}
from
"
@angular/core
"
;
import
{
AppsService
}
from
"
./apps.service
"
;
import
{
InstallOption
}
from
"
./install-option
"
;
import
{
SettingsService
}
from
"
./settings.sevices
"
;
...
...
@@ -27,6 +27,8 @@ export class AppDetailComponent implements OnInit {
references
:
App
[];
referencesInstall
:
{[
id
:
string
]:
boolean
};
import_path
:
string
;
constructor
(
private
appsService
:
AppsService
,
private
settingsService
:
SettingsService
,
private
downloadService
:
DownloadService
,
private
ref
:
ChangeDetectorRef
)
{
}
...
...
@@ -145,9 +147,10 @@ export class AppDetailComponent implements OnInit {
this
.
appsService
.
runApp
(
app
,
'
custom
'
);
}
importGame
(
app
:
App
)
{
let
dir
=
this
.
selectDir
();
this
.
appsService
.
importApp
(
app
,
dir
);
importGame
(
targetApp
:
App
,
options
:
InstallOption
,
referencesInstall
:
{[
id
:
string
]:
boolean
})
{
let
dir
=
path
.
basename
(
this
.
import_path
);
// TODO: 执行依赖和references安装
this
.
appsService
.
importApp
(
targetApp
,
dir
);
}
async
verifyFiles
(
app
:
App
)
{
...
...
@@ -168,4 +171,28 @@ export class AppDetailComponent implements OnInit {
clipboard
.
writeText
(
text
);
}
async
selectImport
(
app
:
App
)
{
let
main
=
app
.
actions
.
get
(
'
main
'
);
if
(
!
main
)
{
return
}
if
(
!
main
.
execute
)
{
return
}
let
filename
=
main
.
execute
.
split
(
'
/
'
)[
0
];
let
extname
=
path
.
extname
(
filename
).
slice
(
1
);
// let remote = require('electron').remote
let
filePaths
=
await
new
Promise
((
resolve
,
reject
)
=>
{
remote
.
dialog
.
showOpenDialog
({
filters
:
[{
name
:
filename
,
extensions
:
[
extname
]}],
properties
:
[
'
openFile
'
,
'
openDirectory
'
,
'
multiSelections
'
]
},
resolve
)
});
if
(
filePaths
&&
filePaths
[
0
])
{
this
.
import_path
=
filePaths
[
0
]
}
}
}
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