Skip to content

Commit

Permalink
feat: publish
Browse files Browse the repository at this point in the history
  • Loading branch information
liuzheng committed Jan 10, 2018
2 parents 4914507 + 0a63c01 commit 03e0d61
Show file tree
Hide file tree
Showing 31 changed files with 219 additions and 139 deletions.
14 changes: 11 additions & 3 deletions mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ def asset_groups_assets():
"comment": "Default asset group",
"assets_granted": [
{
"id": 2,
"id": 1,
"hostname": "192.168.1.6",
"ip": "192.168.2.6",
"port": 22,
"system": "linux",
"plantform": "Linux",
"system_users_granted": [
{
"id": 1,
Expand All @@ -117,6 +117,14 @@ def asset_groups_assets():
"protocol": "ssh",
"auth_method": "P",
"auto_push": True
},
{
"id": 2,
"name": "liuzheng",
"username": "liuzheng",
"protocol": "ssh",
"auth_method": "P",
"auto_push": True
}
]
},
Expand All @@ -125,7 +133,7 @@ def asset_groups_assets():
"hostname": "windows server",
"ip": "123.57.183.135",
"port": 3389,
"system": "windows",
"plantform": "Windows",
"assets_granted": [
{
"id": 1,
Expand Down
1 change: 0 additions & 1 deletion node_modules/asciinema-player
Submodule asciinema-player deleted from 9e8f94
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"filetree-css": "^1.0.0",
"font-awesome": "^4.7.0",
"handlebars": "^4.0.11",
"inconsolata": "0.0.2",
"jquery": "^3.1.0",
"jquery-slimscroll": "^1.3.8",
"jquery-sparkline": "^2.4.0",
Expand All @@ -44,6 +45,7 @@
"ngx-bootstrap": "^1.6.6",
"node": "^9.3.0",
"npm": "^5.6.0",
"npm-font-open-sans": "^1.1.0",
"peity": "^3.2.1",
"popper.js": "^1.12.9",
"roboto-fontface": "^0.8.0",
Expand Down
12 changes: 8 additions & 4 deletions src/app/ControlPage/cleftbar/cleftbar.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ label {
overflow: hidden;
}

.filetree > li input:checked ~ ul {
.filetree > li input:checked ~ ul, .filetree > li ul.insearch {
height: auto;
}

Expand All @@ -51,7 +51,7 @@ label {

.search {
border-left-width: 0;
border-bottom: gold 2px inset;
border-bottom: #19aa8d 2px inset;
}

.left-search {
Expand All @@ -67,7 +67,11 @@ label {
background: #2f2a2a;
font-size: 9pt;
border-top-width: 1px;
left: 0;
padding: 1px 20px 30px 20px;
left: 0px;
padding: 1px 20px 0 20px;
position: absolute;
}

.fa.fa-undefined:before {
content: "\f26c";
}
6 changes: 3 additions & 3 deletions src/app/ControlPage/cleftbar/cleftbar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
<li *ngFor="let hostGroup of HostGroups | SearchFilter: q; let i = index ">
<input type="checkbox" id="hostgroup-{{i}}">
<label for="hostgroup-{{i}}">{{hostGroup.name}}</label>
<ul>
<ul [ngClass]="{'insearch': q }">
<li *ngFor="let host of hostGroup.assets_granted | SearchFilter: q" (click)="Connect(host)">
<i class="fa" [ngClass]="'fa-'+host.system" id="fa-{{i}}"></i>
<i class="fa" [ngClass]="'fa-'+(host.plantform||'undefined').toLowerCase()" id="fa-{{i}}"></i>
{{host.hostname}}
</li>
</ul>
</li>
</ul>
</div>
<div class="footer">
Version: <strong>{{version}}</strong>
Version <strong>{{version}}</strong>
</div>
31 changes: 28 additions & 3 deletions src/app/ControlPage/cleftbar/cleftbar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,32 @@ export class CleftbarComponent implements OnInit {
.map(res => res.json())
.subscribe(response => {
this.HostGroups = response;
this.autologin();
});
}


autologin() {
const id = this._appService.getQueryString('id');
if (id) {
for (let g of this.HostGroups) {
if (g['assets_granted']) {
for (let u of g['assets_granted']) {
if (u.id.toString() === id.toString()) {
this.Connect(u);
return;
}
}
}
}

}
}

Connect(host) {
console.log(host);
// console.log(host);
let userid: string;
const that = this;
if (host.system_users_granted.length > 1) {
let options = '';
for (let u of host.system_users_granted) {
Expand All @@ -112,6 +132,7 @@ export class CleftbarComponent implements OnInit {
content: '<select id="selectuser">' + options + '</select>',
yes: function (index, layero) {
userid = jQuery('#selectuser').val();
that.login(host, userid);
layer.close(index);
},
btn2: function (index, layero) {
Expand All @@ -123,15 +144,19 @@ export class CleftbarComponent implements OnInit {
});
} else if (host.system_users_granted.length === 1) {
userid = host.system_users_granted[0].id;
this.login(host, userid);
}
}

login(host, userid) {
if (userid === '') {
return;
}
if (host.system === 'linux') {
if (host.plantform.toLowerCase() === 'linux') {
jQuery('app-ssh').show();
jQuery('app-rdp').hide();
this._term.TerminalConnect(host, userid);
} else if (host.system === 'windows') {
} else if (host.plantform.toLowerCase() === 'windows') {
jQuery('app-ssh').hide();
jQuery('app-rdp').show();
this._rdp.Connect(host, userid);
Expand Down
37 changes: 18 additions & 19 deletions src/app/ControlPage/control/controlnav/controlnav.component.css
Original file line number Diff line number Diff line change
@@ -1,42 +1,41 @@

#tabs {
.tabs {
height: 30px;
width: 100%
overflow-y: hidden;
overflow-x: auto;
}

#tabs ul li.disconnected {
.tabs ul li.disconnected {
background-color: darkgray;
}

#tabs ul li.hidden {
.tabs ul li.hidden {
display: none;
}

#tabs ul {
.tabs ul {
list-style-type: none;
height: 30px;
background-color: #3a3333;
overflow-y: hidden;
overflow-x: auto;
width: 100%;
display: inline-flex;
position: absolute;
display: block;
min-width: 100%;
padding-left: 0;
}

#tabs ul li {
.tabs ul li {
display: inline-table;
width: 150px;
height: 30px;
position: relative;
box-sizing: content-box;
float: left;;
}

#tabs ul li.active {
.tabs ul li.active {
box-sizing: border-box;
border-bottom: 3px solid #7f3f98 !important;
border-bottom: 3px solid #19aa8d !important;
}

#tabs ul li span {
.tabs ul li span {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
Expand All @@ -50,7 +49,7 @@
height: 21px;
}

#tabs ul li a.close {
.tabs ul li a.close {
font-family: 'Roboto', sans-serif;
font-size: 13px;
position: absolute;
Expand All @@ -62,17 +61,17 @@
display: inline-block;
}

#tabs ul li.active a {
.tabs ul li.active a {
color: white;
}

#tabs ul li.active span {
.tabs ul li.active span {
padding: 5px 20px 4px 15px;
color: white;
height: 18px;
}

#tabs ul li input {
.tabs ul li input {
font-family: 'Roboto', sans-serif;
font-size: 13px;
width: 115px;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div id="tabs">
<ul>
<div class="tabs">
<ul [ngStyle]="{'width':150*NavList.List.length+'px'}">
<li *ngFor="let m of NavList.List;let i = index"
[ngClass]="{'active':i==NavList.Active,'disconnected':!m.connected, 'hidden': m.closed != false}"
id="termnav-{{i}}" (click)="setActive(i)">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class ControlnavComponent implements OnInit {
} else {
NavList.Active = index;
}
ControlnavComponent.setActive(NavList.Active)
ControlnavComponent.setActive(NavList.Active);
}

static setActive(index) {
Expand Down
10 changes: 5 additions & 5 deletions src/app/ControlPage/control/ssh/ssh.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class SshComponent implements OnInit {
}

TerminalConnect(host, userid) {
console.log(host, userid);
// console.log(host, userid);
const socket = io.connect('/ssh');
let cols = '80';
let rows = '24';
Expand Down Expand Up @@ -77,11 +77,11 @@ export class SshComponent implements OnInit {
screenKeys: true,
});
NavList.List.push(new View());
for (let _i = 0; _i < NavList.List.length; _i++) {
if (id === _i) {
for (let i = 0; i < NavList.List.length; i++) {
if (id === i) {
NavList.List[id].hide = false;
} else {
NavList.List[_i].hide = true;
NavList.List[i].hide = true;
}
}

Expand Down Expand Up @@ -109,7 +109,7 @@ export class SshComponent implements OnInit {
});

socket.on('disconnect', function () {
this.TerminalDisconnect(NavList.List[id]);
SshComponent.TerminalDisconnect(NavList.List[id]);
// TermStore.term[id]["term"].destroy();
// TermStore.term[id]["connected"] = false;
});
Expand Down
2 changes: 2 additions & 0 deletions src/app/ControlPage/controlpage.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ div, term-leftbar, term-body {
div {
background-color: black;
margin: 0;
padding-top: 30px;
position: initial;
}

app-cleftbar {
Expand Down
1 change: 0 additions & 1 deletion src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<app-element-nav *ngIf="DataStore.NavShow"></app-element-nav>
<nav *ngIf="DataStore.NavShow"></nav>
<router-outlet></router-outlet>
<!--<app-element-interactive></app-element-interactive>-->
9 changes: 9 additions & 0 deletions src/app/app.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {Logger} from 'angular2-logger/core';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';
import {DataStore, User, Browser} from './globals';
declare function unescape(s: string): string;

@Injectable()
export class HttpService {
Expand Down Expand Up @@ -174,6 +175,14 @@ export class AppService implements OnInit {
this._http.post('/api/browser', JSON.stringify(Browser)).map(res => res.json()).subscribe();
}

getQueryString(name) {
const reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
const r = window.location.search.substr(1).match(reg);
if (r != null) {
return unescape(r[2]);
}
return null;
}

//
//
Expand Down
2 changes: 1 addition & 1 deletion src/app/elements/nav/nav.component.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="nav">
<ul>
<li><a [routerLink]="['Index']"><img src="static/imgs/logo.png" height="26px"/></a>
<li><a [routerLink]="['']"><img src="static/imgs/logo.png" height="26px"/></a>
</li>
<li *ngFor="let v of DataStore.Nav" [ngClass]="{'dropdown': v.children}">
<a>{{v.name}}</a>
Expand Down
Loading

0 comments on commit 03e0d61

Please sign in to comment.