Unverified Commit 1e55448a authored by liuzheng712's avatar liuzheng712

Merge branch 'dev'

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