feat: update

parent 70042ffb
...@@ -116,7 +116,8 @@ def asset_groups_assets(): ...@@ -116,7 +116,8 @@ def asset_groups_assets():
"username": "web", "username": "web",
"protocol": "ssh", "protocol": "ssh",
"auth_method": "P", "auth_method": "P",
"auto_push": True "auto_push": True,
"priority": 1
}, },
{ {
"id": 2, "id": 2,
...@@ -124,7 +125,9 @@ def asset_groups_assets(): ...@@ -124,7 +125,9 @@ def asset_groups_assets():
"username": "liuzheng", "username": "liuzheng",
"protocol": "ssh", "protocol": "ssh",
"auth_method": "P", "auth_method": "P",
"auto_push": True "auto_push": True,
"priority": 10
} }
] ]
}, },
...@@ -136,81 +139,13 @@ def asset_groups_assets(): ...@@ -136,81 +139,13 @@ def asset_groups_assets():
"platform": "Windows", "platform": "Windows",
"system_users_granted": [ "system_users_granted": [
{ {
"id": 3, "id": "3",
"name": "web", "name": "web",
"username": "web", "username": "web",
"protocol": "rdp", "protocol": "rdp",
"auth_method": "P", "auth_method": "P",
"auto_push": True "auto_push": True,
} "priority": 10
]
}
]
},
{
"id": 4,
"name": "java",
"comment": "",
"assets_granted": [
{
"id": 2,
"hostname": "192.168.1.6",
"ip": "192.168.2.6",
"port": 22,
"system_users_granted": [
{
"id": 1,
"name": "web",
"username": "web",
"protocol": "ssh",
"auth_method": "P",
"auto_push": True
}
]
}
]
},
{
"id": 3,
"name": "数据库",
"comment": "",
"assets_granted": [
{
"id": 2,
"hostname": "192.168.1.6",
"ip": "192.168.2.6",
"port": 22,
"system_users_granted": [
{
"id": 1,
"name": "web",
"username": "web",
"protocol": "ssh",
"auth_method": "P",
"auto_push": True
}
]
}
]
},
{
"id": 2,
"name": "运维组",
"comment": "",
"assets_granted": [
{
"id": 2,
"hostname": "192.168.1.6",
"ip": "192.168.2.6",
"port": 22,
"system_users_granted": [
{
"id": 1,
"name": "web",
"username": "web",
"protocol": "ssh",
"auth_method": "P",
"auto_push": True
} }
] ]
} }
......
...@@ -8,7 +8,10 @@ ...@@ -8,7 +8,10 @@
import {Component, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {NavList, View, Rdp, ControlComponent} from '../control.component'; import {NavList, View, Rdp, ControlComponent} from '../control.component';
import * as Mstsc from 'mstsc.js/client/js/mstsc.js'; import {Mstsc} from 'mstsc.js/client/js/mstsc.js';
import {Client} from 'mstsc.js/client/js/client.js';
import {Canvas} from 'mstsc.js/client/js/canvas.js';
// declare let Mstsc: any; // declare let Mstsc: any;
@Component({ @Component({
...@@ -19,12 +22,8 @@ import * as Mstsc from 'mstsc.js/client/js/mstsc.js'; ...@@ -19,12 +22,8 @@ import * as Mstsc from 'mstsc.js/client/js/mstsc.js';
export class RdpComponent implements OnInit { export class RdpComponent implements OnInit {
NavList = NavList; NavList = NavList;
static Disconnect(host) { static Disconnect(host) {
host.connected = false; host.connected = false;
// document.getElementById("templatesrc").remove();
} }
static DisconnectAll() { static DisconnectAll() {
...@@ -41,9 +40,9 @@ export class RdpComponent implements OnInit { ...@@ -41,9 +40,9 @@ export class RdpComponent implements OnInit {
const id = NavList.List.length - 1; const id = NavList.List.length - 1;
const canvas = Mstsc.$('canvas-' + id); const canvas = Mstsc.$('canvas-' + id);
canvas.style.display = 'inline'; // canvas.style.display = 'inline';
canvas.width = window.innerWidth; // canvas.width = window.innerWidth;
canvas.height = window.innerHeight; // canvas.height = window.innerHeight;
NavList.List[id].nick = host.name; NavList.List[id].nick = host.name;
NavList.List[id].connected = true; NavList.List[id].connected = true;
...@@ -53,7 +52,7 @@ export class RdpComponent implements OnInit { ...@@ -53,7 +52,7 @@ export class RdpComponent implements OnInit {
NavList.List[id].Rdp = new Rdp; NavList.List[id].Rdp = new Rdp;
NavList.List[id].Rdp.token = host.token; NavList.List[id].Rdp.token = host.token;
NavList.List[id].Rdp.machine = host.uuid; NavList.List[id].Rdp.machine = host.uuid;
NavList.List[id].Rdp.client = Mstsc.client.create(Mstsc.$('canvas-' + id)); NavList.List[id].Rdp.client = new Client.Client(Mstsc.$('canvas-' + id));
NavList.List[id].Rdp.client.connect(host.token, '/rdp/socket.io'); NavList.List[id].Rdp.client.connect(host.token, '/rdp/socket.io');
NavList.List.push(new View()); NavList.List.push(new View());
......
...@@ -22,13 +22,14 @@ export class ElementTermComponent implements OnInit, AfterViewInit { ...@@ -22,13 +22,14 @@ export class ElementTermComponent implements OnInit, AfterViewInit {
ngAfterViewInit() { ngAfterViewInit() {
term.col = Math.floor(jQuery(this.el.nativeElement).width() / jQuery('#liuzheng').width() * 8) - 3; term.col = Math.floor(jQuery(this.el.nativeElement).width() / jQuery('#liuzheng').width() * 8) - 3;
term.row = Math.floor(jQuery(this.el.nativeElement).height() / jQuery('#liuzheng').height()) - 5; term.row = Math.floor(jQuery(this.el.nativeElement).height() / jQuery('#liuzheng').height()) - 5;
term.term.resize(term.col, term.row);
term.term.open(this.el.nativeElement, true); term.term.open(this.el.nativeElement, true);
const that = this; const that = this;
window.onresize = function () { window.onresize = function () {
term.col = Math.floor(jQuery(that.el.nativeElement).width() / jQuery('#liuzheng').width() * 8) - 3; term.col = Math.floor(jQuery(that.el.nativeElement).width() / jQuery('#liuzheng').width() * 8) - 3;
term.row = Math.floor(jQuery(that.el.nativeElement).height() / jQuery('#liuzheng').height()) - 5; term.row = Math.floor(jQuery(that.el.nativeElement).height() / jQuery('#liuzheng').height()) - 3;
console.log(jQuery(that.el.nativeElement).height());
console.log(jQuery('#liuzheng').height());
console.log(term);
if (term.col < 80) { if (term.col < 80) {
term.col = 80; term.col = 80;
} }
...@@ -37,6 +38,7 @@ export class ElementTermComponent implements OnInit, AfterViewInit { ...@@ -37,6 +38,7 @@ export class ElementTermComponent implements OnInit, AfterViewInit {
} }
term.term.resize(term.col, term.row); term.term.resize(term.col, term.row);
}; };
jQuery(window).resize();
} }
} }
...@@ -24,4 +24,6 @@ ...@@ -24,4 +24,6 @@
app-element-term { app-element-term {
position: absolute; position: absolute;
width: 100%;
height: 100%;
} }
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