Commit af6025c9 authored by liuzheng712's avatar liuzheng712

feat: tree update

parent 5b404ced
...@@ -188,6 +188,7 @@ server.run = function (options) { ...@@ -188,6 +188,7 @@ server.run = function (options) {
"hostname": "192.168.1.6", "hostname": "192.168.1.6",
"ip": "192.168.2.6", "ip": "192.168.2.6",
"port": 22, "port": 22,
"system": "windows",
"system_users": [ "system_users": [
{ {
"id": 1, "id": 1,
...@@ -204,6 +205,7 @@ server.run = function (options) { ...@@ -204,6 +205,7 @@ server.run = function (options) {
"hostname": "testserver123", "hostname": "testserver123",
"ip": "123.57.183.135", "ip": "123.57.183.135",
"port": 8022, "port": 8022,
"system": "linux",
"system_users": [ "system_users": [
{ {
"id": 1, "id": 1,
......
...@@ -6,10 +6,29 @@ ...@@ -6,10 +6,29 @@
font-family: "Hiragino Kaku Gothic ProN", Meiryo, sans-serif; font-family: "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
} }
.filetree {
padding-left: 20px;
}
.filetree input[type="checkbox"] { .filetree input[type="checkbox"] {
display: none; display: none;
} }
.filetree input[type=checkbox] + label:before {
font-family: FontAwesome;
display: inline-block;
}
.filetree input[type=checkbox] + label:before {
content: "\f1b3";
letter-spacing: 10px;
width: 30px;
}
.filetree input[type=checkbox]:checked + label:before {
content: "\f085";
}
.filetree ul { .filetree ul {
height: 0; height: 0;
overflow: hidden; overflow: hidden;
...@@ -26,40 +45,10 @@ ...@@ -26,40 +45,10 @@
} }
.filetree label { .filetree label {
padding-left: 33px;
line-height: 33px; line-height: 33px;
display: inline-block; display: inline-block;
} }
/**
* Icon
* */
.filetree label {
background-image: url('./icon.png');
background-repeat: no-repeat;
}
.filetree input[type="checkbox"] + label {
background-position: 0 0;
width: 100%;
height: 33px;
}
.filetree input[type="checkbox"]:checked + label {
background-position: 0 -33px;
width: 100%;
height: 30px;
}
@media screen and (-webkit-min-device-pixel-ratio: 1.0), screen and (min--moz-device-pixel-ratio: 1.0), screen and (-o-min-device-pixel-ratio: 100/100), screen and (min-device-pixel-ratio: 1.0), screen and (min-resolution: 1.0dppx) {
filetree label {
background-image: url('./icon.png');
-webkit-background-size: 33px 63px;
-moz-background-size: 33px 63px;
background-size: 33px 63px;
}
}
.search { .search {
border-left-width: 0; border-left-width: 0;
border-bottom: gold 2px inset; border-bottom: gold 2px inset;
...@@ -71,4 +60,5 @@ ...@@ -71,4 +60,5 @@
border: none; border: none;
height: 28px; height: 28px;
background: #2f2a2a; background: #2f2a2a;
color: #ffffff;
} }
...@@ -9,7 +9,10 @@ ...@@ -9,7 +9,10 @@
<input type="checkbox" id="hostgroup-{{i}}"> <input type="checkbox" id="hostgroup-{{i}}">
<label for="hostgroup-{{i}}">{{hostGroup.name}}</label> <label for="hostgroup-{{i}}">{{hostGroup.name}}</label>
<ul> <ul>
<li *ngFor="let host of hostGroup.assets | SearchFilter: q" (click)="Connect(host)">{{host.hostname}}</li> <li *ngFor="let host of hostGroup.assets | SearchFilter: q" (click)="Connect(host)">
<i class="fa" [ngClass]="'fa-'+host.system" id="rdp-{{i}}"></i>
{{host.hostname}}
</li>
</ul> </ul>
</li> </li>
</ul> </ul>
......
...@@ -13,7 +13,7 @@ import {Logger} from 'angular2-logger/core'; ...@@ -13,7 +13,7 @@ import {Logger} from 'angular2-logger/core';
import {AppService, DataStore, HttpService} from '../../app.service'; import {AppService, DataStore, HttpService} from '../../app.service';
import {SshComponent} from '../control/ssh/ssh.component'; import {SshComponent} from '../control/ssh/ssh.component';
import {RdpComponent} from '../control/rdp/rdp.component'; import {RdpComponent} from '../control/rdp/rdp.component';
import {SearchComponent} from "../search/search.component"; import {SearchComponent} from '../search/search.component';
declare let layer: any; declare let layer: any;
declare let jQuery: any; declare let jQuery: any;
...@@ -47,31 +47,31 @@ export class CleftbarComponent implements OnInit { ...@@ -47,31 +47,31 @@ export class CleftbarComponent implements OnInit {
static Hide() { static Hide() {
DataStore.leftbarshow = false; DataStore.leftbarshow = false;
DataStore.Nav.map(function (value, i) { DataStore.Nav.map(function (value, i) {
for (var ii in value["children"]) { for (var ii in value['children']) {
if (DataStore.Nav[i]["children"][ii]["id"] === "HindLeftManager") { if (DataStore.Nav[i]['children'][ii]['id'] === 'HindLeftManager') {
DataStore.Nav[i]["children"][ii] = { DataStore.Nav[i]['children'][ii] = {
"id": "ShowLeftManager", 'id': 'ShowLeftManager',
"click": "ShowLeft", 'click': 'ShowLeft',
"name": "Show left manager" 'name': 'Show left manager'
};
} }
} }
} });
})
} }
static Show() { static Show() {
DataStore.leftbarshow = true; DataStore.leftbarshow = true;
DataStore.Nav.map(function (value, i) { DataStore.Nav.map(function (value, i) {
for (var ii in value["children"]) { for (var ii in value['children']) {
if (DataStore.Nav[i]["children"][ii]["id"] === "ShowLeftManager") { if (DataStore.Nav[i]['children'][ii]['id'] === 'ShowLeftManager') {
DataStore.Nav[i]["children"][ii] = { DataStore.Nav[i]['children'][ii] = {
"id": "HindLeftManager", 'id': 'HindLeftManager',
"click": "HideLeft", 'click': 'HideLeft',
"name": "Hind left manager" 'name': 'Hind left manager'
};
} }
} }
} });
})
} }
constructor(private _appService: AppService, constructor(private _appService: AppService,
...@@ -96,47 +96,47 @@ export class CleftbarComponent implements OnInit { ...@@ -96,47 +96,47 @@ export class CleftbarComponent implements OnInit {
console.log(host); console.log(host);
let username: string; let username: string;
if (host.system_users.length > 1) { if (host.system_users.length > 1) {
let options = ""; let options = '';
for (let u of host.system_users) { for (let u of host.system_users) {
options += "<option value='" + u.username + "'>" + u.username + "</option>" options += '<option value="' + u.username + '">' + u.username + '</option>';
} }
layer.open({ layer.open({
title: 'Please Choose a User', title: 'Please Choose a User',
scrollbar: false, scrollbar: false,
moveOut: true, moveOut: true,
moveType: 1, moveType: 1,
btn: ["确定", "取消"], btn: ['确定', '取消'],
content: "<select id='selectuser'>" + options + "</select>", content: '<select id="selectuser">' + options + '</select>',
yes: function (index, layero) { yes: function (index, layero) {
username = jQuery("#selectuser").val(); username = jQuery('#selectuser').val();
layer.close(index); layer.close(index);
}, },
btn2: function (index, layero) { btn2: function (index, layero) {
}, },
cancel: function () { cancel: function () {
//右上角关闭回调 // 右上角关闭回调
//return false 开启该代码可禁止点击该按钮关闭 // return false 开启该代码可禁止点击该按钮关闭
} }
}); });
} else if (host.system_users.length === 1) { } else if (host.system_users.length === 1) {
username = host.system_users[0].username username = host.system_users[0].username;
} }
if (username === "") { if (username === '') {
return return;
} }
if (host.type === 'ssh') { if (host.type === 'ssh') {
jQuery("app-ssh").show(); jQuery('app-ssh').show();
jQuery("app-rdp").hide(); jQuery('app-rdp').hide();
this._term.TerminalConnect(host, username); this._term.TerminalConnect(host, username);
} else { } else {
jQuery("app-ssh").hide(); jQuery('app-ssh').hide();
jQuery("app-rdp").show(); jQuery('app-rdp').show();
this._rdp.Connect(host, username); this._rdp.Connect(host, username);
} }
} }
Search(q) { Search(q) {
this._search.Search(q) this._search.Search(q);
} }
} }
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