Unverified Commit 1e55448a authored by liuzheng712's avatar liuzheng712

Merge branch 'dev'

parents 1b94bf17 cecbc7a4
...@@ -16683,11 +16683,6 @@ ...@@ -16683,11 +16683,6 @@
"inherits": "2.0.3" "inherits": "2.0.3"
} }
}, },
"term.js": {
"version": "0.0.7",
"resolved": "https://registry.npmjs.org/term.js/-/term.js-0.0.7.tgz",
"integrity": "sha1-Um8kz8Dy72+A9RfJ4n2ulHvIcxU="
},
"tether": { "tether": {
"version": "1.4.0", "version": "1.4.0",
"resolved": "https://registry.npmjs.org/tether/-/tether-1.4.0.tgz", "resolved": "https://registry.npmjs.org/tether/-/tether-1.4.0.tgz",
......
...@@ -61,7 +61,6 @@ ...@@ -61,7 +61,6 @@
"socket.io": "^2.0.3", "socket.io": "^2.0.3",
"socket.io-client": "^2.0.4", "socket.io-client": "^2.0.4",
"ssh-keygen": "^0.4.1", "ssh-keygen": "^0.4.1",
"term.js": "0.0.7",
"tether": "^1.4.0", "tether": "^1.4.0",
"uuid-js": "^0.7.5", "uuid-js": "^0.7.5",
"xterm": "^2.9.2", "xterm": "^2.9.2",
......
...@@ -13,11 +13,9 @@ import {SearchComponent} from '../search/search.component'; ...@@ -13,11 +13,9 @@ import {SearchComponent} from '../search/search.component';
import {DataStore} from '../../globals'; import {DataStore} from '../../globals';
import {version} from '../../../environments/environment'; import {version} from '../../../environments/environment';
import * as jQuery from 'jquery/dist/jquery.min.js'; import * as jQuery from 'jquery/dist/jquery.min.js';
import * as layer from 'layui-layer/src/layer.js';
import * as UUID from 'uuid-js/lib/uuid.js';
import {ElementServerMenuComponent} from '../../elements/server-menu/server-menu.component'; import {ElementServerMenuComponent} from '../../elements/server-menu/server-menu.component';
import {NavList, View} from '../control/control.component'; import {NavList, View} from '../control/control.component';
import {logger} from 'codelyzer/util/logger'; import {LayerService} from '../../elements/layer/layer.service';
export interface HostGroup { export interface HostGroup {
...@@ -84,7 +82,8 @@ export class CleftbarComponent implements OnInit { ...@@ -84,7 +82,8 @@ export class CleftbarComponent implements OnInit {
private _http: HttpService, private _http: HttpService,
private _search: SearchComponent, private _search: SearchComponent,
private _logger: LogService, private _logger: LogService,
private _menu: ElementServerMenuComponent) { private _menu: ElementServerMenuComponent,
private _layer: LayerService) {
this._logger.log('nav.ts:NavComponent'); this._logger.log('nav.ts:NavComponent');
// this._appService.getnav() // this._appService.getnav()
} }
...@@ -127,7 +126,7 @@ export class CleftbarComponent implements OnInit { ...@@ -127,7 +126,7 @@ export class CleftbarComponent implements OnInit {
for (const u of host.system_users_granted) { for (const u of host.system_users_granted) {
options += '<option value="' + u.id + '">' + u.username + '</option>'; options += '<option value="' + u.id + '">' + u.username + '</option>';
} }
layer.open({ this._layer.open({
title: 'Please Choose a User', title: 'Please Choose a User',
scrollbar: false, scrollbar: false,
moveOut: true, moveOut: true,
...@@ -143,7 +142,7 @@ export class CleftbarComponent implements OnInit { ...@@ -143,7 +142,7 @@ export class CleftbarComponent implements OnInit {
} }
} }
that.login(host, user); that.login(host, user);
layer.close(index); that._layer.close(index);
}, },
btn2: function (index, layero) { btn2: function (index, layero) {
}, },
......
...@@ -18,7 +18,7 @@ import {AppRoutingModule} from './app-routing.module'; ...@@ -18,7 +18,7 @@ import {AppRoutingModule} from './app-routing.module';
import {AppComponent} from './app.component'; import {AppComponent} from './app.component';
// service // service
import {AppService, HttpService, LogService} from './app.service'; import {AppService, HttpService, LogService, UUIDService} from './app.service';
import {LayerService} from './elements/layer/layer.service'; import {LayerService} from './elements/layer/layer.service';
// Elements // Elements
...@@ -103,6 +103,7 @@ import {HttpClientModule} from '@angular/common/http'; ...@@ -103,6 +103,7 @@ import {HttpClientModule} from '@angular/common/http';
AppService, AppService,
HttpService, HttpService,
LogService, LogService,
UUIDService,
LayerService, LayerService,
NGXLogger NGXLogger
] ]
......
...@@ -15,6 +15,7 @@ import {environment} from '../environments/environment'; ...@@ -15,6 +15,7 @@ import {environment} from '../environments/environment';
import {HttpClient, HttpHeaders} from '@angular/common/http'; import {HttpClient, HttpHeaders} from '@angular/common/http';
import {NGXLogger} from 'ngx-logger'; import {NGXLogger} from 'ngx-logger';
import {HostGroup} from './ControlPage/cleftbar/cleftbar.component'; import {HostGroup} from './ControlPage/cleftbar/cleftbar.component';
import * as UUID from 'uuid-js/lib/uuid.js';
declare function unescape(s: string): string; declare function unescape(s: string): string;
...@@ -70,8 +71,10 @@ export class HttpService { ...@@ -70,8 +71,10 @@ export class HttpService {
} }
get_guacamole_token(username: string, assetID: string, systemUserID: string) { get_guacamole_token(username: string, assetID: string, systemUserID: string) {
return this.get('/guacamole/api/tokens?username=' + username + '&password=zheng&asset_id=' + return this.http.post('/guacamole/api/tokens', {
assetID + '&system_user_id=' + systemUserID, {headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded')}); username: username, password: 'zheng', asset_id:
assetID, system_user_id: systemUserID
}, {headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded')});
} }
search(q: string) { search(q: string) {
...@@ -357,3 +360,13 @@ export class AppService implements OnInit { ...@@ -357,3 +360,13 @@ export class AppService implements OnInit {
// } // }
} }
@Injectable()
export class UUIDService {
constructor() {
}
gen() {
return UUID.create()['hex'];
}
}
import {Injectable} from '@angular/core'; import {Injectable} from '@angular/core';
import * as layer from 'layui-layer/src/layer.js';
@Injectable() @Injectable()
export class LayerService { export class LayerService {
...@@ -7,6 +7,10 @@ export class LayerService { ...@@ -7,6 +7,10 @@ export class LayerService {
constructor() { constructor() {
} }
open(options: any) {
layer.open(options);
}
dialog() { dialog() {
} }
...@@ -23,4 +27,8 @@ export class LayerService { ...@@ -23,4 +27,8 @@ export class LayerService {
alert() { alert() {
// alert('sss'); // alert('sss');
} }
close(index: any) {
layer.close(index);
}
} }
...@@ -4,7 +4,7 @@ import {term, Terminal, TermWS} from '../../globals'; ...@@ -4,7 +4,7 @@ import {term, Terminal, TermWS} from '../../globals';
import {Cookie} from 'ng2-cookies/ng2-cookies'; import {Cookie} from 'ng2-cookies/ng2-cookies';
import {NavList} from '../../ControlPage/control/control.component'; import {NavList} from '../../ControlPage/control/control.component';
import * as jQuery from 'jquery/dist/jquery.min.js'; import * as jQuery from 'jquery/dist/jquery.min.js';
import * as UUID from 'uuid-js/lib/uuid.js'; import {UUIDService} from '../../app.service';
@Component({ @Component({
selector: 'app-element-term', selector: 'app-element-term',
...@@ -20,11 +20,11 @@ export class ElementTermComponent implements OnInit, AfterViewInit { ...@@ -20,11 +20,11 @@ export class ElementTermComponent implements OnInit, AfterViewInit {
secret: string; secret: string;
term: any; term: any;
constructor() { constructor(private _uuid: UUIDService) {
} }
ngOnInit() { ngOnInit() {
this.secret = UUID.create()['hex']; this.secret = this._uuid.gen();
this.term = Terminal({ this.term = Terminal({
cols: 80, cols: 80,
rows: 24, rows: 24,
......
'use strict'; 'use strict';
import * as terminal from 'term.js/src/term.js'; import * as terminal from 'xterm/dist/xterm';
import * as io from 'socket.io-client'; import * as io from 'socket.io-client';
export function Terminal(xargs: any) { export function Terminal(xargs: any) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment