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
4b2572dd
Commit
4b2572dd
authored
Apr 04, 2017
by
dev0tion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add basic login component
parent
96933470
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
113 additions
and
19 deletions
+113
-19
db.json
Breeze.UI/db.json
+10
-1
app-routing.module.ts
Breeze.UI/src/app/app-routing.module.ts
+3
-1
app.component.ts
Breeze.UI/src/app/app.component.ts
+2
-2
app.module.ts
Breeze.UI/src/app/app.module.ts
+4
-1
login.component.css
Breeze.UI/src/app/login/login.component.css
+0
-0
login.component.html
Breeze.UI/src/app/login/login.component.html
+9
-0
login.component.spec.ts
Breeze.UI/src/app/login/login.component.spec.ts
+25
-0
login.component.ts
Breeze.UI/src/app/login/login.component.ts
+36
-0
api.service.ts
Breeze.UI/src/app/shared/api/api.service.ts
+20
-10
send.component.html
Breeze.UI/src/app/wallet/send/send.component.html
+3
-3
wallet.module.ts
Breeze.UI/src/app/wallet/wallet.module.ts
+1
-1
No files found.
Breeze.UI/db.json
View file @
4b2572dd
{
"
status
"
:
"
create
"
:
{
"success"
:
"true"
,
"mnemonic"
:
"foo bar buz"
},
"load"
:
{
"success"
:
"true"
},
"status"
:
{
"success"
:
"false"
,
"connectedNodeCount"
:
"7"
,
"maxConnextedNodeCount"
:
"8"
,
"headerChainHeight"
:
"1048"
,
...
...
Breeze.UI/src/app/app-routing.module.ts
View file @
4b2572dd
import
{
NgModule
}
from
'@angular/core'
;
import
{
RouterModule
,
Routes
}
from
'@angular/router'
;
const
routes
:
Routes
=
[
import
{
LoginComponent
}
from
'./login/login.component'
;
const
routes
:
Routes
=
[
{
path
:
'login'
,
component
:
LoginComponent
}
];
@
NgModule
({
...
...
Breeze.UI/src/app/app.component.ts
View file @
4b2572dd
...
...
@@ -28,9 +28,9 @@ export class AppComponent implements OnInit {
error
=>
this
.
errorMessage
=
<
any
>
error
);
if
(
this
.
response
=
"true"
)
{
if
(
this
.
response
=
==
"true"
)
{
// remote.dialog.showMessageBox({message: remote.app.getPath('userData')})
this
.
router
.
navigate
([
'/
wallet
'
])
this
.
router
.
navigate
([
'/
login
'
])
}
else
{
this
.
router
.
navigate
([
'/setup'
])
}
...
...
Breeze.UI/src/app/app.module.ts
View file @
4b2572dd
...
...
@@ -9,12 +9,14 @@ import { SharedModule } from './shared/shared.module';
import
{
AppRoutingModule
}
from
'./app-routing.module'
;
import
{
AppComponent
}
from
'./app.component'
;
import
{
LoginComponent
}
from
'./login/login.component'
;
import
{
ApiService
}
from
'./shared/api/api.service'
;
@
NgModule
({
imports
:
[
AppRoutingModule
,
BrowserModule
,
HttpModule
,
...
...
@@ -23,7 +25,8 @@ import { ApiService } from './shared/api/api.service';
SharedModule
.
forRoot
()
],
declarations
:
[
AppComponent
AppComponent
,
LoginComponent
],
providers
:
[
ApiService
],
bootstrap
:
[
AppComponent
]
...
...
Breeze.UI/src/app/login/login.component.css
0 → 100644
View file @
4b2572dd
Breeze.UI/src/app/login/login.component.html
0 → 100644
View file @
4b2572dd
<h1>
Welcome back
</h1>
<p>
Please enter your password to decrypt your wallet
</p>
<form
(
ngSubmit
)="
onSubmit
()"
#
passwordForm=
"ngForm"
>
<div
class=
"form-group"
>
<label
for=
"password"
>
Your password:
</label>
<input
type=
"password"
class=
"form-control"
id=
"password"
required
name=
"password"
>
</div>
<button
type=
"submit"
class=
"btn btn-success"
>
Decrypt
</button>
</form>
\ No newline at end of file
Breeze.UI/src/app/login/login.component.spec.ts
0 → 100644
View file @
4b2572dd
import
{
async
,
ComponentFixture
,
TestBed
}
from
'@angular/core/testing'
;
import
{
LoginComponent
}
from
'./login.component'
;
describe
(
'LoginComponent'
,
()
=>
{
let
component
:
LoginComponent
;
let
fixture
:
ComponentFixture
<
LoginComponent
>
;
beforeEach
(
async
(()
=>
{
TestBed
.
configureTestingModule
({
declarations
:
[
LoginComponent
]
})
.
compileComponents
();
}));
beforeEach
(()
=>
{
fixture
=
TestBed
.
createComponent
(
LoginComponent
);
component
=
fixture
.
componentInstance
;
fixture
.
detectChanges
();
});
it
(
'should create'
,
()
=>
{
expect
(
component
).
toBeTruthy
();
});
});
Breeze.UI/src/app/login/login.component.ts
0 → 100644
View file @
4b2572dd
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
Router
}
from
'@angular/router'
;
import
{
ApiService
}
from
'../shared/api/api.service'
;
@
Component
({
selector
:
'app-login'
,
templateUrl
:
'./login.component.html'
,
styleUrls
:
[
'./login.component.css'
]
})
export
class
LoginComponent
implements
OnInit
{
constructor
(
private
apiService
:
ApiService
,
private
router
:
Router
)
{
}
private
response
:
any
;
private
errorMessage
:
string
;
ngOnInit
()
{
}
private
onSubmit
()
{
this
.
apiService
.
loadWallet
(
"123"
)
.
subscribe
(
response
=>
this
.
response
=
response
,
error
=>
this
.
errorMessage
=
error
,
()
=>
this
.
loadWallet
()
);
}
private
loadWallet
()
{
if
(
this
.
response
.
success
===
"true"
)
{
this
.
router
.
navigate
([
'/wallet/send'
]);
}
else
{
alert
(
"Something went wrong."
)
}
}
}
Breeze.UI/src/app/shared/api/api.service.ts
View file @
4b2572dd
...
...
@@ -18,6 +18,26 @@ export class ApiService {
private
webApiUrl
=
'http://localhost:3000/api/v1'
;
private
headers
=
new
Headers
({
'Content-Type'
:
'application/json'
});
/**
* Create a new wallet.
*/
createWallet
(
data
:
SafeCreation
):
Observable
<
any
>
{
console
.
log
(
JSON
.
stringify
(
data
));
return
this
.
http
.
post
(
this
.
webApiUrl
+
'api/safe'
,
JSON
.
stringify
(
data
),
{
headers
:
this
.
headers
})
.
map
(
response
=>
response
.
json
());
}
/**
* Load a wallet
*/
loadWallet
(
password
:
string
):
Observable
<
any
>
{
return
this
.
http
.
get
(
this
.
webApiUrl
+
'/wallet/load/'
,
{
headers
:
this
.
headers
,
body
:
JSON
.
stringify
(
password
)})
.
map
(
response
=>
response
.
json
())
.
catch
(
this
.
handleError
);
}
/**
* Get wallet status info from the API.
*/
...
...
@@ -58,16 +78,6 @@ export class ApiService {
.
catch
(
this
.
handleError
);
}
/**
* Create a new wallet.
*/
createWallet
(
data
:
SafeCreation
):
Observable
<
any
>
{
console
.
log
(
JSON
.
stringify
(
data
));
return
this
.
http
.
post
(
this
.
webApiUrl
+
'api/safe'
,
JSON
.
stringify
(
data
),
{
headers
:
this
.
headers
})
.
map
(
response
=>
response
.
json
());
}
/**
* Handle errors from the API.
* @param error
...
...
Breeze.UI/src/app/wallet/send/send.component.html
View file @
4b2572dd
Breeze.UI/src/app/wallet/wallet.module.ts
View file @
4b2572dd
...
...
@@ -27,7 +27,7 @@ import { WalletRoutingModule } from './wallet-routing.module';
DashboardComponent
,
ReceiveComponent
,
SendComponent
,
HistoryComponent
,
HistoryComponent
],
exports
:
[
WalletComponent
...
...
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