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
380b60c0
Commit
380b60c0
authored
Sep 26, 2017
by
dev0tion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update login component to load Bitcoin and Stratis
parent
5403d689
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
34 deletions
+52
-34
login.component.ts
Breeze.UI/src/app/login/login.component.ts
+48
-30
wallet-load.ts
Breeze.UI/src/app/shared/classes/wallet-load.ts
+4
-4
No files found.
Breeze.UI/src/app/login/login.component.ts
View file @
380b60c0
...
@@ -62,18 +62,43 @@ export class LoginComponent implements OnInit {
...
@@ -62,18 +62,43 @@ export class LoginComponent implements OnInit {
}
}
};
};
private
updateWalletFileDisplay
(
walletName
:
string
)
{
private
getWalletFiles
()
{
this
.
openWalletForm
.
patchValue
({
selectWallet
:
walletName
})
this
.
apiService
.
getWalletFiles
()
.
subscribe
(
response
=>
{
if
(
response
.
status
>=
200
&&
response
.
status
<
400
)
{
let
responseMessage
=
response
.
json
();
this
.
wallets
=
responseMessage
.
walletsFiles
;
this
.
globalService
.
setWalletPath
(
responseMessage
.
walletsPath
);
if
(
this
.
wallets
.
length
>
0
)
{
this
.
hasWallet
=
true
;
for
(
let
wallet
in
this
.
wallets
)
{
this
.
wallets
[
wallet
]
=
this
.
wallets
[
wallet
].
slice
(
0
,
-
12
);
}
this
.
updateWalletFileDisplay
(
this
.
wallets
[
0
]);
}
else
{
this
.
hasWallet
=
false
;
}
}
},
error
=>
{
if
(
error
.
status
===
0
)
{
alert
(
"Something went wrong while connecting to the API. Please restart the application."
);
}
else
if
(
error
.
status
>=
400
)
{
if
(
!
error
.
json
().
errors
[
0
])
{
console
.
log
(
error
);
}
else
{
alert
(
error
.
json
().
errors
[
0
].
message
);
}
}
}
)
;
}
}
private
onDecryptClicked
()
{
private
updateWalletFileDisplay
(
walletName
:
string
)
{
this
.
setGlobalWalletName
(
this
.
openWalletForm
.
get
(
"selectWallet"
).
value
);
this
.
openWalletForm
.
patchValue
({
selectWallet
:
walletName
})
let
walletLoad
=
new
WalletLoad
(
this
.
openWalletForm
.
get
(
"password"
).
value
,
this
.
globalService
.
getWalletPath
(),
this
.
openWalletForm
.
get
(
"selectWallet"
).
value
);
this
.
loadWallet
(
walletLoad
);
}
}
private
onCreateClicked
()
{
private
onCreateClicked
()
{
...
@@ -86,27 +111,21 @@ export class LoginComponent implements OnInit {
...
@@ -86,27 +111,21 @@ export class LoginComponent implements OnInit {
}
}
}
}
private
setGlobalWalletName
(
walletName
:
string
)
{
private
onDecryptClicked
()
{
this
.
globalService
.
setWalletName
(
walletName
);
this
.
globalService
.
setWalletName
(
this
.
openWalletForm
.
get
(
"selectWallet"
).
value
);
let
walletLoad
=
new
WalletLoad
(
this
.
openWalletForm
.
get
(
"selectWallet"
).
value
,
this
.
openWalletForm
.
get
(
"password"
).
value
);
this
.
loadWallets
(
walletLoad
);
}
}
private
getWalletFiles
(
)
{
private
loadWallets
(
walletLoad
:
WalletLoad
)
{
this
.
apiService
.
getWalletFiles
(
)
this
.
apiService
.
loadBitcoinWallet
(
walletLoad
)
.
subscribe
(
.
subscribe
(
response
=>
{
response
=>
{
if
(
response
.
status
>=
200
&&
response
.
status
<
400
)
{
if
(
response
.
status
>=
200
&&
response
.
status
<
400
)
{
let
responseMessage
=
response
.
json
();
//Bitcoin wallet loaded
this
.
wallets
=
responseMessage
.
walletsFiles
;
this
.
globalService
.
setWalletPath
(
responseMessage
.
walletsPath
);
if
(
this
.
wallets
.
length
>
0
)
{
this
.
hasWallet
=
true
;
for
(
let
wallet
in
this
.
wallets
)
{
this
.
wallets
[
wallet
]
=
this
.
wallets
[
wallet
].
slice
(
0
,
-
12
);
}
this
.
updateWalletFileDisplay
(
this
.
wallets
[
0
]);
}
else
{
this
.
hasWallet
=
false
;
}
}
}
},
},
error
=>
{
error
=>
{
...
@@ -123,14 +142,13 @@ export class LoginComponent implements OnInit {
...
@@ -123,14 +142,13 @@ export class LoginComponent implements OnInit {
}
}
)
)
;
;
}
private
loadWallet
(
walletLoad
:
WalletLoad
)
{
this
.
apiService
.
loadStratisWallet
(
walletLoad
)
this
.
apiService
.
loadWallet
(
walletLoad
)
.
subscribe
(
.
subscribe
(
response
=>
{
response
=>
{
if
(
response
.
status
>=
200
&&
response
.
status
<
400
)
{
if
(
response
.
status
>=
200
&&
response
.
status
<
400
)
{
this
.
globalService
.
setWalletName
(
walletLoad
.
name
)
this
.
globalService
.
setCoinName
(
"Bitcoin"
);
this
.
globalService
.
setWalletName
(
walletLoad
.
name
);
this
.
globalService
.
setCoinType
(
1
);
this
.
globalService
.
setCoinType
(
1
);
this
.
router
.
navigate
([
'/wallet'
]);
this
.
router
.
navigate
([
'/wallet'
]);
}
}
...
...
Breeze.UI/src/app/shared/classes/wallet-load.ts
View file @
380b60c0
export
class
WalletLoad
{
export
class
WalletLoad
{
constructor
(
password
:
string
,
folderPath
:
string
,
name
:
string
)
{
constructor
(
name
:
string
,
password
:
string
,
folderPath
:
string
=
null
)
{
this
.
name
=
name
;
this
.
password
=
password
;
this
.
password
=
password
;
this
.
folderPath
=
folderPath
;
this
.
folderPath
=
folderPath
;
this
.
name
=
name
;
}
}
public
password
:
string
;
public
folderPath
:
string
;
public
name
:
string
;
public
name
:
string
;
public
password
:
string
;
public
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