Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
Breeze
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DeStream-public
Breeze
Commits
ec1245d5
Commit
ec1245d5
authored
Apr 27, 2017
by
dev0tion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make create form a reactive form
parent
e6bcd1ba
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
32 deletions
+51
-32
login.component.ts
Breeze.UI/src/app/login/login.component.ts
+2
-1
create.component.html
Breeze.UI/src/app/setup/create/create.component.html
+21
-21
create.component.ts
Breeze.UI/src/app/setup/create/create.component.ts
+16
-8
setup-routing.module.ts
Breeze.UI/src/app/setup/setup-routing.module.ts
+2
-2
setup.module.ts
Breeze.UI/src/app/setup/setup.module.ts
+2
-0
wallet-creation.ts
Breeze.UI/src/app/shared/classes/wallet-creation.ts
+8
-0
No files found.
Breeze.UI/src/app/login/login.component.ts
View file @
ec1245d5
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
FormGroup
,
FormControl
,
Validators
,
FormBuilder
}
from
'@angular/forms'
;
import
{
Router
}
from
'@angular/router'
;
import
{
GlobalService
}
from
'../shared/services/global.service'
;
import
{
ApiService
}
from
'../shared/services/api.service'
;
import
{
WalletLoad
}
from
'../shared/classes/wallet-load'
;
import
{
FormGroup
,
FormControl
,
Validators
,
FormBuilder
}
from
'@angular/forms'
;
@
Component
({
selector
:
'app-login'
,
...
...
Breeze.UI/src/app/setup/create/create.component.html
View file @
ec1245d5
...
...
@@ -2,26 +2,26 @@
<h1>
Please create a new wallet.
</h1>
<div
class=
"form-group"
>
<label
for=
"name"
>
Name:
</label>
<input
class=
"form-control"
type=
"text"
#
walletName
required
>
</div>
<div
class=
"form-group"
>
<label
for=
"password"
>
Password:
</label>
<input
class=
"form-control"
type=
"password"
#
walletPassword
required
>
</div>
<div
class=
"form-group"
>
<label
for=
"networklabel"
>
Network:
</label>
<select
name=
"network"
#
walletNetwork
>
<form
[
formGroup
]="
createWalletForm
"
(
ngSubmit
)="
onCreateClicked
()"
>
<div
class=
"form-group"
>
<label>
Name:
</label>
<input
class=
"form-control"
formControlName=
"walletName"
type=
"text"
placeholder=
"Enter a name for your wallet."
>
</div>
<div
class=
"form-group"
>
<label>
Password:
</label>
<input
class=
"form-control"
formControlName=
"walletPassword"
type=
"password"
placeholder=
"Enter a password for your wallet."
>
</div>
<div
class=
"form-group"
>
<label>
Network:
</label>
<select
name=
"network"
formControlName=
"selectNetwork"
>
<option
value=
"main"
>
Main
</option>
<option
value=
"test"
>
Testnet
</option>
</select>
</div>
<div
class=
"form-group"
>
<label
for=
"path"
>
Path:
</label>
<input
class=
"form-control"
type=
"text"
#
walletPath
required
>
</div>
<button
type=
"submit"
(
click
)="
createWallet
(
walletPassword
.
value
,
walletNetwork
.
value
,
walletPath
.
value
,
walletName
.
value
)"
>
Create
</button>
</div>
<div
class=
"form-group"
>
<button
type=
"submit"
[
disabled
]="!
createWalletForm
.
valid
"
class=
"btn btn-success"
>
Create Wallet
</button>
</div>
</form>
<div>
<label>
Mnemonic:
</label>
</div>
...
...
Breeze.UI/src/app/setup/create/create.component.ts
View file @
ec1245d5
import
{
Component
,
Injectable
}
from
'@angular/core'
;
import
{
FormGroup
,
FormControl
,
Validators
,
FormBuilder
}
from
'@angular/forms'
;
import
{
GlobalService
}
from
'../../shared/services/global.service'
;
import
{
ApiService
}
from
'../../shared/services/api.service'
;
import
{
WalletCreation
}
from
'../../shared/classes/wallet-creation'
;
...
...
@@ -12,22 +14,28 @@ import { Mnemonic } from '../../shared/classes/mnemonic';
})
export
class
CreateComponent
{
constructor
(
private
apiService
:
ApiService
)
{}
constructor
(
private
globalService
:
GlobalService
,
private
apiService
:
ApiService
,
private
fb
:
FormBuilder
)
{
this
.
createWalletForm
=
fb
.
group
({
"walletName"
:
[
""
,
Validators
.
required
],
"walletPassword"
:
[
""
,
Validators
.
required
],
"selectNetwork"
:
[
"main"
,
Validators
.
required
]
});
}
private
newWallet
:
WalletCreation
;
private
createWalletForm
:
FormGroup
;
private
responseMessage
:
string
;
private
errorMessage
:
string
;
private
createWallet
(
password
:
string
,
network
:
string
,
folderPath
:
string
,
name
:
string
,
)
{
this
.
newWallet
=
new
WalletCreation
();
this
.
newWallet
.
password
=
password
;
this
.
newWallet
.
network
=
network
;
this
.
newWallet
.
folderPath
=
folderPath
;
this
.
newWallet
.
name
=
name
;
private
onCreateClicked
()
{
this
.
newWallet
=
new
WalletCreation
(
this
.
createWalletForm
.
get
(
"walletPassword"
).
value
,
this
.
createWalletForm
.
get
(
"selectNetwork"
).
value
,
this
.
globalService
.
getWalletPath
(),
this
.
createWalletForm
.
get
(
"walletName"
).
value
);
this
.
createWallet
(
this
.
newWallet
);
}
private
createWallet
(
wallet
:
WalletCreation
)
{
this
.
apiService
.
createWallet
(
this
.
newW
allet
)
.
createWallet
(
w
allet
)
.
subscribe
(
response
=>
{
if
(
response
.
status
>=
200
&&
response
.
status
<
400
){
...
...
Breeze.UI/src/app/setup/setup-routing.module.ts
View file @
ec1245d5
...
...
@@ -8,8 +8,8 @@ import { RecoverComponent } from './recover/recover.component';
const
routes
:
Routes
=
[
{
path
:
''
,
redirectTo
:
'setup'
,
pathMatch
:
'full'
},
{
path
:
'setup'
,
component
:
SetupComponent
},
{
path
:
'
setup/
create'
,
component
:
CreateComponent
},
{
path
:
'
setup/
recover'
,
component
:
RecoverComponent
}
{
path
:
'create'
,
component
:
CreateComponent
},
{
path
:
'recover'
,
component
:
RecoverComponent
}
];
@
NgModule
({
...
...
Breeze.UI/src/app/setup/setup.module.ts
View file @
ec1245d5
import
{
CommonModule
}
from
'@angular/common'
;
import
{
NgModule
}
from
'@angular/core'
;
import
{
ReactiveFormsModule
}
from
'@angular/forms'
;
import
{
SetupComponent
}
from
'./setup.component'
;
import
{
CreateComponent
}
from
'./create/create.component'
;
...
...
@@ -12,6 +13,7 @@ import { RecoverComponent } from './recover/recover.component';
@
NgModule
({
imports
:
[
CommonModule
,
ReactiveFormsModule
,
SetupRoutingModule
,
SharedModule
.
forRoot
()
],
...
...
Breeze.UI/src/app/shared/classes/wallet-creation.ts
View file @
ec1245d5
export
class
WalletCreation
{
constructor
(
password
:
string
,
network
:
string
,
folderPath
:
string
,
name
:
string
)
{
this
.
password
=
password
;
this
.
network
=
network
;
this
.
folderPath
=
folderPath
;
this
.
name
=
name
;
}
password
:
string
;
network
:
string
;
folderPath
:
string
;
...
...
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