Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
L
luna
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
ops
luna
Commits
fcaa7f77
Unverified
Commit
fcaa7f77
authored
Mar 08, 2018
by
liuzheng
Committed by
GitHub
Mar 08, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #24 from jumpserver/dev
Dev
parents
4bf0df31
22eab8ea
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
142 additions
and
30 deletions
+142
-30
cn.json
i18n/cn.json
+7
-1
nginx.conf
nginx.conf
+0
-4
dialog.html
src/app/ControlPage/cleftbar/dialog.html
+5
-5
control.component.html
src/app/ControlPage/control/control.component.html
+2
-2
control.component.ts
src/app/ControlPage/control/control.component.ts
+2
-6
controlnav.component.ts
...pp/ControlPage/control/controlnav/controlnav.component.ts
+2
-1
app.module.ts
src/app/app.module.ts
+2
-0
guacamole.component.html
src/app/elements/guacamole/guacamole.component.html
+1
-0
guacamole.component.scss
src/app/elements/guacamole/guacamole.component.scss
+6
-0
guacamole.component.spec.ts
src/app/elements/guacamole/guacamole.component.spec.ts
+25
-0
guacamole.component.ts
src/app/elements/guacamole/guacamole.component.ts
+65
-0
iframe.component.ts
src/app/elements/iframe/iframe.component.ts
+23
-11
globals.ts
src/app/globals.ts
+2
-0
No files found.
i18n/cn.json
View file @
fcaa7f77
...
@@ -40,5 +40,11 @@
...
@@ -40,5 +40,11 @@
"user"
:
"用户"
,
"user"
:
"用户"
,
"user group"
:
"用户组"
,
"user group"
:
"用户组"
,
"login logs"
:
"登陆日志"
,
"login logs"
:
"登陆日志"
,
"language"
:
"语言选择"
"language"
:
"语言选择"
,
"found"
:
"发现"
,
"users "
:
"用户"
,
"choose a user"
:
"选择一个用户"
,
"please choose a user"
:
"请选择一个用户"
,
"cancel"
:
"取消"
,
"confirm"
:
"确认"
}
}
nginx.conf
View file @
fcaa7f77
...
@@ -5,8 +5,4 @@ server {
...
@@ -5,8 +5,4 @@ server {
try_files
$uri
/
/index.html
;
try_files
$uri
/
/index.html
;
alias
/opt/luna/
;
alias
/opt/luna/
;
}
}
location
/i18n/
{
root
/opt/luna/i18n
;
}
}
}
src/app/ControlPage/cleftbar/dialog.html
View file @
fcaa7f77
<h1
mat-dialog-title
>
Found {{data.users.length}} Users
</h1>
<h1
mat-dialog-title
>
{{"Found"|trans}} {{data.users.length}} {{"Users "|trans}}
</h1>
<mat-form-field>
<mat-form-field>
<mat-select
[(
value
)]="
selected
"
<mat-select
[(
value
)]="
selected
"
[
compareWith
]="
compareFn
"
[
compareWith
]="
compareFn
"
[
formControl
]="
UserSelectControl
"
[
formControl
]="
UserSelectControl
"
placeholder=
"
Choose a User
"
required
>
placeholder=
"
{{'Choose a User'|trans}}
"
required
>
<mat-option
*
ngFor=
"let u of data.users"
value=
"{{u.id}}"
>
{{u.username}}
</mat-option>
<mat-option
*
ngFor=
"let u of data.users"
value=
"{{u.id}}"
>
{{u.username}}
</mat-option>
</mat-select>
</mat-select>
<mat-error
*
ngIf=
"UserSelectControl.hasError('required')"
>
Please choose a User
</mat-error>
<mat-error
*
ngIf=
"UserSelectControl.hasError('required')"
>
{{"Please choose a User"|trans}}
</mat-error>
</mat-form-field>
</mat-form-field>
<div
style=
"float: right"
>
<div
style=
"float: right"
>
<button
mat-raised-button
(
click
)="
onNoClick
()"
>
Cancel
</button>
<button
mat-raised-button
(
click
)="
onNoClick
()"
>
{{"Cancel"|trans}}
</button>
<button
mat-raised-button
color=
"primary"
[
mat-dialog-close
]="
selected
"
cdkFocusInitial
>
Confirm
</button>
<button
mat-raised-button
color=
"primary"
[
mat-dialog-close
]="
selected
"
cdkFocusInitial
>
{{"Confirm"|trans}}
</button>
</div>
</div>
src/app/ControlPage/control/control.component.html
View file @
fcaa7f77
...
@@ -7,9 +7,9 @@
...
@@ -7,9 +7,9 @@
[
index
]="
i
"
[
index
]="
i
"
*
ngIf=
"m.type=='ssh'"
>
*
ngIf=
"m.type=='ssh'"
>
</app-element-term>
</app-element-term>
<app-element-
ifram
e
[
host
]="
m
.
host
"
<app-element-
guacamol
e
[
host
]="
m
.
host
"
[
userid
]="
m
.
user
.
id
"
[
userid
]="
m
.
user
.
id
"
[
index
]="
i
"
[
index
]="
i
"
*
ngIf=
"m.type=='rdp'"
>
*
ngIf=
"m.type=='rdp'"
>
</app-element-
ifram
e>
</app-element-
guacamol
e>
</div>
</div>
src/app/ControlPage/control/control.component.ts
View file @
fcaa7f77
...
@@ -16,11 +16,7 @@ import {TermWS} from '../../globals';
...
@@ -16,11 +16,7 @@ import {TermWS} from '../../globals';
// term: any;
// term: any;
// }
// }
export
class
Rdp
{
machine
:
string
;
token
:
string
;
client
:
any
;
}
export
class
View
{
export
class
View
{
nick
:
string
;
nick
:
string
;
...
@@ -32,7 +28,7 @@ export class View {
...
@@ -32,7 +28,7 @@ export class View {
host
:
any
;
host
:
any
;
user
:
any
;
user
:
any
;
room
:
string
;
room
:
string
;
Rdp
:
Rdp
;
Rdp
:
any
;
Term
:
any
;
Term
:
any
;
}
}
...
...
src/app/ControlPage/control/controlnav/controlnav.component.ts
View file @
fcaa7f77
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* @author liuzheng <liuzheng712@gmail.com>
* @author liuzheng <liuzheng712@gmail.com>
*/
*/
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
Component
,
ElementRef
,
OnInit
,
ViewChild
}
from
'@angular/core'
;
import
{
ControlComponent
,
NavList
}
from
'../control.component'
;
import
{
ControlComponent
,
NavList
}
from
'../control.component'
;
import
*
as
jQuery
from
'jquery/dist/jquery.min.js'
;
import
*
as
jQuery
from
'jquery/dist/jquery.min.js'
;
...
@@ -44,6 +44,7 @@ export class ControlnavComponent implements OnInit {
...
@@ -44,6 +44,7 @@ export class ControlnavComponent implements OnInit {
if
(
NavList
.
List
[
index
].
type
===
'ssh'
)
{
if
(
NavList
.
List
[
index
].
type
===
'ssh'
)
{
NavList
.
List
[
index
].
Term
.
focus
();
NavList
.
List
[
index
].
Term
.
focus
();
}
else
if
(
NavList
.
List
[
index
].
type
===
'rdp'
)
{
}
else
if
(
NavList
.
List
[
index
].
type
===
'rdp'
)
{
NavList
.
List
[
index
].
Rdp
.
focus
();
}
}
}
else
{
}
else
{
...
...
src/app/app.module.ts
View file @
fcaa7f77
...
@@ -65,6 +65,7 @@ import {SettingPageTerminalComponent} from './setting-page/terminal/terminal.com
...
@@ -65,6 +65,7 @@ import {SettingPageTerminalComponent} from './setting-page/terminal/terminal.com
import
{
SettingPageS3Component
}
from
'./setting-page/s3/s3.component'
;
import
{
SettingPageS3Component
}
from
'./setting-page/s3/s3.component'
;
import
{
TransPipe
}
from
'./trans.pipe'
;
import
{
TransPipe
}
from
'./trans.pipe'
;
import
{
MAT_LABEL_GLOBAL_OPTIONS
}
from
'@angular/material'
;
import
{
MAT_LABEL_GLOBAL_OPTIONS
}
from
'@angular/material'
;
import
{
ElementGuacamoleComponent
}
from
'./elements/guacamole/guacamole.component'
;
@
NgModule
({
@
NgModule
({
imports
:
[
imports
:
[
...
@@ -93,6 +94,7 @@ import {MAT_LABEL_GLOBAL_OPTIONS} from '@angular/material';
...
@@ -93,6 +94,7 @@ import {MAT_LABEL_GLOBAL_OPTIONS} from '@angular/material';
ElementTableComponent
,
ElementTableComponent
,
ElementLeftbarComponent
,
ElementLeftbarComponent
,
ElementOfooterComponent
,
ElementOfooterComponent
,
ElementGuacamoleComponent
,
LoginComponent
,
LoginComponent
,
SearchComponent
,
SearchComponent
,
SearchFilter
,
SearchFilter
,
...
...
src/app/elements/guacamole/guacamole.component.html
0 → 100644
View file @
fcaa7f77
<iframe
#
rdp
[
src
]="
trust
(
target
)"
(
mouseenter
)="
active
()"
></iframe>
src/app/elements/guacamole/guacamole.component.scss
0 → 100644
View file @
fcaa7f77
iframe
{
width
:
100%
;
height
:
100%
;
border
:
none
;
background-color
:
white
;
}
src/app/elements/guacamole/guacamole.component.spec.ts
0 → 100644
View file @
fcaa7f77
import
{
async
,
ComponentFixture
,
TestBed
}
from
'@angular/core/testing'
;
import
{
ElementGuacamoleComponent
}
from
'./guacamole.component'
;
describe
(
'ElementGuacamoleComponent'
,
()
=>
{
let
component
:
ElementGuacamoleComponent
;
let
fixture
:
ComponentFixture
<
ElementGuacamoleComponent
>
;
beforeEach
(
async
(()
=>
{
TestBed
.
configureTestingModule
({
declarations
:
[
ElementGuacamoleComponent
]
})
.
compileComponents
();
}));
beforeEach
(()
=>
{
fixture
=
TestBed
.
createComponent
(
ElementGuacamoleComponent
);
component
=
fixture
.
componentInstance
;
fixture
.
detectChanges
();
});
it
(
'should create'
,
()
=>
{
expect
(
component
).
toBeTruthy
();
});
});
src/app/elements/guacamole/guacamole.component.ts
0 → 100644
View file @
fcaa7f77
import
{
Component
,
ElementRef
,
Input
,
OnInit
,
ViewChild
}
from
'@angular/core'
;
import
{
CookieService
}
from
'ngx-cookie-service'
;
import
{
HttpService
,
LogService
}
from
'../../app.service'
;
import
{
DataStore
,
User
}
from
'../../globals'
;
import
{
DomSanitizer
}
from
'@angular/platform-browser'
;
import
{
environment
}
from
'../../../environments/environment'
;
import
{
NavList
}
from
'../../ControlPage/control/control.component'
;
@
Component
({
selector
:
'app-element-guacamole'
,
templateUrl
:
'./guacamole.component.html'
,
styleUrls
:
[
'./guacamole.component.scss'
]
})
export
class
ElementGuacamoleComponent
implements
OnInit
{
@
Input
()
host
:
any
;
@
Input
()
userid
:
any
;
@
Input
()
index
:
number
;
target
:
string
;
@
ViewChild
(
'rdp'
)
el
:
ElementRef
;
constructor
(
private
sanitizer
:
DomSanitizer
,
private
_http
:
HttpService
,
private
_cookie
:
CookieService
,
private
_logger
:
LogService
)
{
}
ngOnInit
()
{
// /guacamole/api/tokens will redirect to http://guacamole/api/tokens
const
base
=
window
.
btoa
(
this
.
host
.
id
+
'
\
0'
+
'c'
+
'
\
0'
+
'jumpserver'
);
if
(
environment
.
production
)
{
if
(
DataStore
.
guacamole_token
)
{
this
.
target
=
document
.
location
.
origin
+
'/guacamole/#/client/'
+
base
+
'?token='
+
DataStore
.
guacamole_token
;
}
else
{
this
.
_http
.
get_guacamole_token
(
User
.
name
,
this
.
host
.
id
,
this
.
userid
).
subscribe
(
data
=>
{
// /guacamole/client will redirect to http://guacamole/#/client
this
.
target
=
document
.
location
.
origin
+
'/guacamole/#/client/'
+
base
+
'?token='
+
data
[
'authToken'
];
DataStore
.
guacamole_token
=
data
[
'authToken'
];
},
error2
=>
{
this
.
_logger
.
error
(
error2
);
}
);
}
}
else
{
this
.
target
=
this
.
_cookie
.
get
(
'guacamole'
);
}
NavList
.
List
[
this
.
index
].
Rdp
=
this
.
el
.
nativeElement
;
}
trust
(
url
)
{
return
this
.
sanitizer
.
bypassSecurityTrustResourceUrl
(
url
);
}
Disconnect
()
{
NavList
.
List
[
this
.
index
].
connected
=
false
;
}
active
()
{
this
.
_logger
.
debug
(
'focus'
);
this
.
el
.
nativeElement
.
focus
();
}
}
src/app/elements/iframe/iframe.component.ts
View file @
fcaa7f77
...
@@ -2,8 +2,10 @@ import {Component, Input, OnInit} from '@angular/core';
...
@@ -2,8 +2,10 @@ import {Component, Input, OnInit} from '@angular/core';
import
{
DomSanitizer
}
from
'@angular/platform-browser'
;
import
{
DomSanitizer
}
from
'@angular/platform-browser'
;
import
{
NavList
}
from
'../../ControlPage/control/control.component'
;
import
{
NavList
}
from
'../../ControlPage/control/control.component'
;
import
{
User
}
from
'../../globals'
;
import
{
User
,
DataStore
}
from
'../../globals'
;
import
{
HttpService
,
LogService
}
from
'../../app.service'
;
import
{
HttpService
,
LogService
}
from
'../../app.service'
;
import
{
environment
}
from
'../../../environments/environment'
;
import
{
CookieService
}
from
'ngx-cookie-service'
;
@
Component
({
@
Component
({
selector
:
'app-element-iframe'
,
selector
:
'app-element-iframe'
,
...
@@ -18,22 +20,32 @@ export class ElementIframeComponent implements OnInit {
...
@@ -18,22 +20,32 @@ export class ElementIframeComponent implements OnInit {
constructor
(
private
sanitizer
:
DomSanitizer
,
constructor
(
private
sanitizer
:
DomSanitizer
,
private
_http
:
HttpService
,
private
_http
:
HttpService
,
private
_cookie
:
CookieService
,
private
_logger
:
LogService
)
{
private
_logger
:
LogService
)
{
}
}
ngOnInit
()
{
ngOnInit
()
{
// /guacamole/api/tokens will redirect to http://guacamole/api/tokens
// /guacamole/api/tokens will redirect to http://guacamole/api/tokens
this
.
_http
.
get_guacamole_token
(
User
.
name
,
this
.
host
.
id
,
this
.
userid
).
subscribe
(
const
base
=
window
.
btoa
(
this
.
host
.
id
+
'
\
0'
+
'c'
+
'
\
0'
+
'jumpserver'
);
data
=>
{
if
(
environment
.
production
)
{
const
base
=
window
.
btoa
(
this
.
host
.
hostname
+
'
\
0'
+
'c'
+
'
\
0'
+
'jumpserver'
);
if
(
DataStore
.
guacamole_token
)
{
// /guacamole/client will redirect to http://guacamole/#/client
this
.
target
=
document
.
location
.
origin
+
'/guacamole/#/client/'
+
base
+
'?token='
+
DataStore
.
guacamole_token
;
this
.
target
=
document
.
location
.
origin
+
}
else
{
'/guacamole/#/client/'
+
base
+
'?token='
+
data
[
'authToken'
];
this
.
_http
.
get_guacamole_token
(
User
.
name
,
this
.
host
.
id
,
this
.
userid
).
subscribe
(
},
data
=>
{
error2
=>
{
// /guacamole/client will redirect to http://guacamole/#/client
this
.
_logger
.
error
(
error2
);
this
.
target
=
document
.
location
.
origin
+
'/guacamole/#/client/'
+
base
+
'?token='
+
data
[
'authToken'
];
DataStore
.
guacamole_token
=
data
[
'authToken'
];
},
error2
=>
{
this
.
_logger
.
error
(
error2
);
}
);
}
}
);
}
else
{
this
.
target
=
this
.
_cookie
.
get
(
'guacamole'
);
}
}
}
trust
(
url
)
{
trust
(
url
)
{
...
...
src/app/globals.ts
View file @
fcaa7f77
...
@@ -104,6 +104,7 @@ export let DataStore: {
...
@@ -104,6 +104,7 @@ export let DataStore: {
leftbarshow
:
boolean
;
leftbarshow
:
boolean
;
windowsize
:
Array
<
number
>
;
windowsize
:
Array
<
number
>
;
autologin
:
boolean
;
autologin
:
boolean
;
guacamole_token
:
string
;
}
=
{
}
=
{
socket
:
io
.
connect
(),
socket
:
io
.
connect
(),
Nav
:
[{}],
Nav
:
[{}],
...
@@ -115,6 +116,7 @@ export let DataStore: {
...
@@ -115,6 +116,7 @@ export let DataStore: {
leftbarshow
:
true
,
leftbarshow
:
true
,
windowsize
:
[],
windowsize
:
[],
autologin
:
false
,
autologin
:
false
,
guacamole_token
:
''
};
};
export
let
CSRF
=
''
;
export
let
CSRF
=
''
;
...
...
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