Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
smart
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangqinghua
smart
Commits
3a805664
Commit
3a805664
authored
Nov 01, 2018
by
wangqinghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
告警模块
parent
59513f59
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
20 additions
and
35 deletions
+20
-35
README.md
README.md
+0
-8
account.service.ts
src/main/webapp/app/shared/auth/account.service.ts
+2
-2
auth-jwt.service.ts
src/main/webapp/app/shared/auth/auth-jwt.service.ts
+4
-2
principal.service.ts
src/main/webapp/app/shared/auth/principal.service.ts
+1
-2
login.component.html
src/main/webapp/app/shared/login/login.component.html
+4
-0
login.component.ts
src/main/webapp/app/shared/login/login.component.ts
+8
-19
login.service.ts
src/main/webapp/app/shared/login/login.service.ts
+1
-2
No files found.
README.md
View file @
3a805664
...
@@ -10,10 +10,3 @@ Class ng g class my-new-class
...
@@ -10,10 +10,3 @@ Class ng g class my-new-class
Interface ng g interface my-new-interface
Interface ng g interface my-new-interface
Enum ng g enum my-new-enum
Enum ng g enum my-new-enum
Module ng g module my-module
Module ng g module my-module
告警管理 alarmManage
当前告警: nowAlarm
告警记录 alarmList
告警推送日志 alarmLog
告警推送设置 alarmSet
发送推送设置: sendSet
\ No newline at end of file
src/main/webapp/app/shared/auth/account.service.ts
View file @
3a805664
...
@@ -7,8 +7,8 @@ import { SERVER_API_URL } from '../../app.constants';
...
@@ -7,8 +7,8 @@ import { SERVER_API_URL } from '../../app.constants';
export
class
AccountService
{
export
class
AccountService
{
constructor
(
private
http
:
HttpClient
)
{
}
constructor
(
private
http
:
HttpClient
)
{
}
get
():
Observable
<
HttpResponse
<
Account
>>
{
get
():
Observable
<
any
>
{
return
this
.
http
.
get
<
Account
>
(
SERVER_API_URL
+
'
'
,
{
observe
:
'response'
});
return
this
.
http
.
post
(
SERVER_API_URL
+
'/login
'
,
{
observe
:
'response'
});
}
}
save
(
account
:
any
):
Observable
<
HttpResponse
<
any
>>
{
save
(
account
:
any
):
Observable
<
HttpResponse
<
any
>>
{
...
...
src/main/webapp/app/shared/auth/auth-jwt.service.ts
View file @
3a805664
...
@@ -29,10 +29,12 @@ export class AuthServerProvider {
...
@@ -29,10 +29,12 @@ export class AuthServerProvider {
password
:
credentials
.
password
,
password
:
credentials
.
password
,
rememberMe
:
credentials
.
rememberMe
rememberMe
:
credentials
.
rememberMe
};
};
return
this
.
http
.
post
(
SERVER_API_URL
+
'/login'
,
data
,
{
observe
:
'response'
}).
map
(
authenticateSuccess
.
bind
(
this
));
return
this
.
http
.
post
(
SERVER_API_URL
+
'/login'
,
data
,
{
observe
:
'response'
}).
map
(
authenticateSuccess
.
bind
(
this
)
);
function
authenticateSuccess
(
resp
)
{
function
authenticateSuccess
(
resp
)
{
const
bearerToken
=
resp
.
body
.
data
;
const
bearerToken
=
resp
.
body
.
data
;
console
.
log
(
'post'
);
if
(
bearerToken
)
{
if
(
bearerToken
)
{
this
.
$localStorage
.
store
(
'accessToken'
,
bearerToken
);
this
.
$localStorage
.
store
(
'accessToken'
,
bearerToken
);
...
...
src/main/webapp/app/shared/auth/principal.service.ts
View file @
3a805664
...
@@ -54,12 +54,11 @@ export class Principal {
...
@@ -54,12 +54,11 @@ export class Principal {
this
.
userIdentity
=
undefined
;
this
.
userIdentity
=
undefined
;
}
}
// check and see if we have retrieved the userIdentity data from the server.
// if we have, reuse it by immediately resolving
if
(
this
.
userIdentity
)
{
if
(
this
.
userIdentity
)
{
return
Promise
.
resolve
(
this
.
userIdentity
);
return
Promise
.
resolve
(
this
.
userIdentity
);
}
}
console
.
log
(
'identity'
);
// retrieve the userIdentity data from the server, update the identity object, and then resolve.
// retrieve the userIdentity data from the server, update the identity object, and then resolve.
return
this
.
account
.
get
().
toPromise
().
then
((
response
)
=>
{
return
this
.
account
.
get
().
toPromise
().
then
((
response
)
=>
{
const
account
=
response
.
body
;
const
account
=
response
.
body
;
...
...
src/main/webapp/app/shared/login/login.component.html
View file @
3a805664
...
@@ -22,5 +22,9 @@
...
@@ -22,5 +22,9 @@
<img
(
click
)="
login
()"
style=
"width: 100%;height: 52px;"
src=
"../../../content/images/btn.png"
alt=
" 登录"
>
<img
(
click
)="
login
()"
style=
"width: 100%;height: 52px;"
src=
"../../../content/images/btn.png"
alt=
" 登录"
>
</nz-form-control>
</nz-form-control>
</nz-form-item>
</nz-form-item>
<nz-form-item
style=
"text-align: center;margin-top: -24px"
>
<nz-spin
[
nzSpinning
]="
isSpinning
"
nzTip=
'登陆中...'
></nz-spin>
</nz-form-item>
</form>
</form>
</div>
</div>
src/main/webapp/app/shared/login/login.component.ts
View file @
3a805664
...
@@ -14,7 +14,6 @@ import {
...
@@ -14,7 +14,6 @@ import {
}
from
'@angular/forms'
;
}
from
'@angular/forms'
;
import
{
EmitService
}
from
"../event/eventEmitter"
;
import
{
EmitService
}
from
"../event/eventEmitter"
;
@
Component
({
@
Component
({
selector
:
'jhi-login-modal'
,
selector
:
'jhi-login-modal'
,
templateUrl
:
'./login.component.html'
templateUrl
:
'./login.component.html'
...
@@ -22,6 +21,7 @@ import {EmitService} from "../event/eventEmitter";
...
@@ -22,6 +21,7 @@ import {EmitService} from "../event/eventEmitter";
export
class
JhiLoginModalComponent
implements
AfterViewInit
,
OnInit
{
export
class
JhiLoginModalComponent
implements
AfterViewInit
,
OnInit
{
validateForm
:
FormGroup
;
validateForm
:
FormGroup
;
isSpinning
=
false
;
authenticationError
:
boolean
;
authenticationError
:
boolean
;
password
:
string
;
password
:
string
;
rememberMe
:
boolean
;
rememberMe
:
boolean
;
...
@@ -50,9 +50,8 @@ export class JhiLoginModalComponent implements AfterViewInit,OnInit {
...
@@ -50,9 +50,8 @@ export class JhiLoginModalComponent implements AfterViewInit,OnInit {
});
});
}
}
submitForm
():
void
{
submitForm
():
void
{
for
(
const
i
in
this
.
validateForm
.
controls
)
{
for
(
const
i
in
this
.
validateForm
.
controls
)
{
this
.
validateForm
.
controls
[
i
].
markAsDirty
();
this
.
validateForm
.
controls
[
i
].
markAsDirty
();
this
.
validateForm
.
controls
[
i
].
updateValueAndValidity
();
this
.
validateForm
.
controls
[
i
].
updateValueAndValidity
();
}
}
...
@@ -81,30 +80,20 @@ export class JhiLoginModalComponent implements AfterViewInit,OnInit {
...
@@ -81,30 +80,20 @@ export class JhiLoginModalComponent implements AfterViewInit,OnInit {
}
}
login
()
{
login
()
{
this
.
isSpinning
=
true
;
this
.
loginService
.
login
({
this
.
loginService
.
login
({
loginName
:
this
.
username
,
loginName
:
this
.
username
,
password
:
this
.
password
,
password
:
this
.
password
,
rememberMe
:
true
rememberMe
:
true
}).
then
(()
=>
{
}).
then
(()
=>
{
console
.
log
(
'login success'
);
this
.
authenticationError
=
false
;
this
.
authenticationError
=
false
;
this
.
activeModal
.
dismiss
(
'login success'
);
this
.
activeModal
.
dismiss
(
'login success'
);
if
(
this
.
router
.
url
===
'/register'
||
(
/^
\/
activate
\/
/
.
test
(
this
.
router
.
url
))
||
//
if (this.router.url === '/register' || (/^\/activate\//.test(this.router.url)) ||
(
/^
\/
reset
\/
/
.
test
(
this
.
router
.
url
)))
{
//
(/^\/reset\//.test(this.router.url))) {
this
.
router
.
navigate
([
'power
'
]);
// this.router.navigate(['app/main/basic
']);
}
//
}
this
.
eventManager
.
broadcast
({
name
:
'authenticationSuccess'
,
content
:
'Sending Authentication Success'
});
// // previousState was set in the authExpiredInterceptor before being redirected to login modal.
// // since login is succesful, go to stored previousState and clear previousState
const
redirect
=
this
.
stateStorageService
.
getUrl
();
if
(
redirect
)
{
this
.
stateStorageService
.
storeUrl
(
null
);
this
.
router
.
navigate
([
redirect
]);
}
}).
catch
(()
=>
{
}).
catch
(()
=>
{
this
.
authenticationError
=
true
;
this
.
authenticationError
=
true
;
});
});
...
...
src/main/webapp/app/shared/login/login.service.ts
View file @
3a805664
...
@@ -12,12 +12,11 @@ export class LoginService {
...
@@ -12,12 +12,11 @@ export class LoginService {
}
}
login
(
credentials
,
callback
?)
{
login
(
credentials
,
callback
?)
{
const
cb
=
callback
||
function
()
{
const
cb
=
callback
||
function
()
{
};
};
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
authServerProvider
.
login
(
credentials
).
subscribe
((
data
)
=>
{
this
.
authServerProvider
.
login
(
credentials
).
subscribe
((
data
)
=>
{
this
.
router
.
navigate
([
'app/main/basic'
]);
this
.
principal
.
identity
(
true
).
then
((
account
)
=>
{
this
.
principal
.
identity
(
true
).
then
((
account
)
=>
{
resolve
(
data
);
resolve
(
data
);
});
});
...
...
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