Commit edb3af8a authored by liuzheng712's avatar liuzheng712

publish

parent 0f0f1fd8
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
*/ */
import {Component, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {Logger} from 'angular2-logger/core'; import {Logger} from 'angular2-logger/core';
import {AppService, DataStore, User} from '../../app.service'; import {AppService} from '../../app.service';
import {DataStore, User} from '../../globals';
@Component({ @Component({
selector: 'app-footer', selector: 'app-footer',
......
...@@ -7,9 +7,10 @@ ...@@ -7,9 +7,10 @@
*/ */
import {Component, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {Logger} from 'angular2-logger/core'; import {Logger} from 'angular2-logger/core';
import {AppService, DataStore, HttpService, User} from '../../app.service'; import {AppService, HttpService} from '../../app.service';
import {NgForm} from '@angular/forms'; import {NgForm} from '@angular/forms';
import {Router} from '@angular/router'; import {Router} from '@angular/router';
import {DataStore, User} from '../../globals';
declare let jQuery: any; declare let jQuery: any;
...@@ -37,7 +38,7 @@ export class LoginComponent implements OnInit { ...@@ -37,7 +38,7 @@ export class LoginComponent implements OnInit {
if (f.valid) { if (f.valid) {
this.login(); this.login();
} else { } else {
this._logger.error("the form not valid") this._logger.error('the form not valid');
} }
} }
......
...@@ -8,11 +8,12 @@ ...@@ -8,11 +8,12 @@
import {Component, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {Logger} from 'angular2-logger/core'; import {Logger} from 'angular2-logger/core';
import {AppService, DataStore, HttpService} from '../../app.service'; import {AppService, HttpService} from '../../app.service';
import {CleftbarComponent} from '../../ControlPage/cleftbar/cleftbar.component'; import {CleftbarComponent} from '../../ControlPage/cleftbar/cleftbar.component';
import {SshComponent} from '../../ControlPage/control/ssh/ssh.component'; import {SshComponent} from '../../ControlPage/control/ssh/ssh.component';
import {RdpComponent} from '../../ControlPage/control/rdp/rdp.component'; import {RdpComponent} from '../../ControlPage/control/rdp/rdp.component';
import {NavList} from '../../ControlPage/control/control.component'; import {NavList} from '../../ControlPage/control/control.component';
import {DataStore} from '../../globals';
declare let layer: any; declare let layer: any;
declare let jQuery: any; declare let jQuery: any;
...@@ -25,11 +26,15 @@ declare let jQuery: any; ...@@ -25,11 +26,15 @@ declare let jQuery: any;
export class NavComponent implements OnInit { export class NavComponent implements OnInit {
DataStore = DataStore; DataStore = DataStore;
static Hide() {
jQuery('app-nav').hide();
}
constructor(private _appService: AppService, constructor(private _appService: AppService,
private _http: HttpService, private _http: HttpService,
private _logger: Logger) { private _logger: Logger) {
this._logger.log('nav.ts:NavComponent'); this._logger.log('nav.ts:NavComponent');
this.getnav() this.getnav();
} }
ngOnInit() { ngOnInit() {
...@@ -38,59 +43,59 @@ export class NavComponent implements OnInit { ...@@ -38,59 +43,59 @@ export class NavComponent implements OnInit {
click(event) { click(event) {
this._logger.debug('nav.ts:NavComponent,click', event); this._logger.debug('nav.ts:NavComponent,click', event);
switch (event) { switch (event) {
case "ReloadLeftbar": { case 'ReloadLeftbar': {
CleftbarComponent.Reload(); CleftbarComponent.Reload();
break break;
} }
case "HideLeft": { case 'HideLeft': {
CleftbarComponent.Hide(); CleftbarComponent.Hide();
break break;
} }
case "ShowLeft": { case 'ShowLeft': {
CleftbarComponent.Show(); CleftbarComponent.Show();
break break;
} }
case "Copy": { case 'Copy': {
// this._appService.copy(); // this._appService.copy();
break break;
} }
case"Disconnect": { case'Disconnect': {
switch (NavList.List[NavList.Active].type) { switch (NavList.List[NavList.Active].type) {
case "ssh": { case 'ssh': {
SshComponent.TerminalDisconnect(NavList.List[NavList.Active]); SshComponent.TerminalDisconnect(NavList.List[NavList.Active]);
break break;
} }
case "rdp": { case 'rdp': {
RdpComponent.Disconnect(NavList.List[NavList.Active]); RdpComponent.Disconnect(NavList.List[NavList.Active]);
break break;
} }
default: { default: {
//statements; // statements;
break; break;
} }
} }
break break;
} }
case"DisconnectAll": { case'DisconnectAll': {
SshComponent.TerminalDisconnectAll(); SshComponent.TerminalDisconnectAll();
RdpComponent.DisconnectAll(); RdpComponent.DisconnectAll();
break break;
} }
case "Website": { case 'Website': {
window.open('http://www.jumpserver.org'); window.open('http://www.jumpserver.org');
break break;
} }
case "BBS": { case 'BBS': {
window.open('http://bbs.jumpserver.org'); window.open('http://bbs.jumpserver.org');
break break;
} }
case "EnterLicense": { case 'EnterLicense': {
this.EnterLicense(); this.EnterLicense();
break break;
} }
default: { default: {
break break;
} }
} }
...@@ -121,119 +126,116 @@ export class NavComponent implements OnInit { ...@@ -121,119 +126,116 @@ export class NavComponent implements OnInit {
// DataStore.Nav = response; // DataStore.Nav = response;
// }); // });
DataStore.Nav = [{ DataStore.Nav = [{
"id": "File", 'id': 'File',
"name": "Server", 'name': 'Server',
"children": [ 'children': [
{ {
"id": "NewConnection", 'id': 'NewConnection',
"href": "", 'href': '',
"name": "New connection", 'name': 'New connection',
"disable": true 'disable': true
}, },
{ {
"id": "Connect", 'id': 'Connect',
"click": "Connect", 'click': 'Connect',
"name": "Connect", 'name': 'Connect',
"disable": true 'disable': true
}, },
{ {
"id": "Disconnect", 'id': 'Disconnect',
"click": "Disconnect", 'click': 'Disconnect',
"name": "Disconnect" 'name': 'Disconnect'
}, },
{ {
"id": "DisconnectAll", 'id': 'DisconnectAll',
"click": "DisconnectAll", 'click': 'DisconnectAll',
"name": "Disconnect all" 'name': 'Disconnect all'
}, },
{ {
"id": "Duplicate", 'id': 'Duplicate',
"href": "", 'href': '',
"name": "Duplicate", 'name': 'Duplicate',
"disable": true 'disable': true
}, },
{ {
"id": "Upload", 'id': 'Upload',
"href": "", 'href': '',
"name": "Upload", 'name': 'Upload',
"disable": true 'disable': true
}, },
{ {
"id": "Download", 'id': 'Download',
"href": "", 'href': '',
"name": "Download", 'name': 'Download',
"disable": true 'disable': true
}, },
{ {
"id": " Search", 'id': ' Search',
"href": "", 'href': '',
"name": "Search", 'name': 'Search',
"disable": true 'disable': true
}, },
{ {
"id": "Reload", 'id': 'Reload',
"click": "ReloadLeftbar", 'click': 'ReloadLeftbar',
"name": "Reload" 'name': 'Reload'
} }
] ]
}, { }, {
"id": "View", 'id': 'View',
"name": "View", 'name': 'View',
"children": [ 'children': [
{ {
"id": "HindLeftManager", 'id': 'HindLeftManager',
"click": "HideLeft", 'click': 'HideLeft',
"name": "Hind left manager" 'name': 'Hind left manager'
}, },
{ {
"id": "SplitVertical", 'id': 'SplitVertical',
"href": "", 'href': '',
"name": "Split vertical", 'name': 'Split vertical',
"disable": true 'disable': true
}, },
{ {
"id": "CommandBar", 'id': 'CommandBar',
"href": "", 'href': '',
"name": "Command bar", 'name': 'Command bar',
"disable": true 'disable': true
}, },
{ {
"id": "ShareSession", 'id': 'ShareSession',
"href": "", 'href': '',
"name": "Share session (read/write)", 'name': 'Share session (read/write)',
"disable": true 'disable': true
}, },
{ {
"id": "Language", 'id': 'Language',
"href": "", 'href': '',
"name": "Language", 'name': 'Language',
"disable": true 'disable': true
}] }]
}, { }, {
"id": "Help", 'id': 'Help',
"name": "Help", 'name': 'Help',
"children": [ 'children': [
{ {
"id": "EnterLicense", 'id': 'EnterLicense',
"click": "EnterLicense", 'click': 'EnterLicense',
"name": "Enter License" 'name': 'Enter License'
}, },
{ {
"id": "Website", 'id': 'Website',
"click": "Website", 'click': 'Website',
"name": "Website" 'name': 'Website'
}, },
{ {
"id": "BBS", 'id': 'BBS',
"click": "BBS", 'click': 'BBS',
"name": "BBS" 'name': 'BBS'
}] }]
}] }];
} }
static Hide() {
jQuery("app-nav").hide()
}
Connect() { Connect() {
layer.prompt({ layer.prompt({
......
...@@ -10,10 +10,11 @@ ...@@ -10,10 +10,11 @@
import {Component, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {Logger} from 'angular2-logger/core'; import {Logger} from 'angular2-logger/core';
import {AppService, DataStore, HttpService} from '../../app.service'; import {AppService, 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';
import {DataStore} from '../../globals';
declare let layer: any; declare let layer: any;
declare let jQuery: any; declare let jQuery: any;
......
...@@ -12,10 +12,9 @@ import {Cookie} from 'ng2-cookies/ng2-cookies'; ...@@ -12,10 +12,9 @@ import {Cookie} from 'ng2-cookies/ng2-cookies';
declare let jQuery: any; declare let jQuery: any;
declare let Terminal: any; declare let Terminal: any;
import {AppService, DataStore} from '../../../app.service'; import {AppService} from '../../../app.service';
import {NavList, View, Term} from '../control.component'; import {NavList, View, Term} from '../control.component';
@Component({ @Component({
selector: 'app-ssh', selector: 'app-ssh',
templateUrl: './ssh.component.html', templateUrl: './ssh.component.html',
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
* @author liuzheng <liuzheng712@gmail.com> * @author liuzheng <liuzheng712@gmail.com>
*/ */
import {Component, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {AppService, DataStore, User} from '../app.service'; import {AppService} from '../app.service';
import {DataStore, User} from '../globals';
@Component({ @Component({
selector: 'app-controllpage', selector: 'app-controllpage',
......
...@@ -9,9 +9,9 @@ import {Component, OnChanges, Input, Pipe, PipeTransform} from '@angular/core'; ...@@ -9,9 +9,9 @@ import {Component, OnChanges, Input, Pipe, PipeTransform} from '@angular/core';
import {Logger} from 'angular2-logger/core'; import {Logger} from 'angular2-logger/core';
import {AppService, DataStore, HttpService} from '../../app.service'; import {AppService, HttpService} from '../../app.service';
export let Q: string = ''; export let Q = '';
@Component({ @Component({
selector: 'app-search', selector: 'app-search',
...@@ -34,7 +34,7 @@ export class SearchComponent implements OnChanges { ...@@ -34,7 +34,7 @@ export class SearchComponent implements OnChanges {
} }
modelChange($event) { modelChange($event) {
this.Search(Q) this.Search(Q);
} }
public Search(q) { public Search(q) {
...@@ -53,7 +53,7 @@ export class SearchComponent implements OnChanges { ...@@ -53,7 +53,7 @@ export class SearchComponent implements OnChanges {
() => { () => {
} }
); );
this._logger.log(q) this._logger.log(q);
} }
} }
...@@ -66,7 +66,7 @@ export class SearchFilter implements PipeTransform { ...@@ -66,7 +66,7 @@ export class SearchFilter implements PipeTransform {
return value.filter(function (el: any) { return value.filter(function (el: any) {
// ToDo: search with a simple SQL like language, and a bug search a group's hosts // ToDo: search with a simple SQL like language, and a bug search a group's hosts
return JSON.stringify(el).toLowerCase().indexOf(input) > -1; return JSON.stringify(el).toLowerCase().indexOf(input) > -1;
}) });
} }
return value; return value;
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
import {Component, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {Logger} from 'angular2-logger/core'; import {Logger} from 'angular2-logger/core';
import {AppService, DataStore} from '../../app.service'; import {AppService} from '../../app.service';
@Component({ @Component({
selector: 'app-ileftbar', selector: 'app-ileftbar',
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
* @author liuzheng <liuzheng712@gmail.com> * @author liuzheng <liuzheng712@gmail.com>
*/ */
import {Component} from '@angular/core'; import {Component} from '@angular/core';
import {AppService, HttpService, DataStore} from './app.service'; import {AppService, HttpService} from './app.service';
import {DataStore} from './globals';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
......
...@@ -12,97 +12,9 @@ import {Cookie} from 'ng2-cookies/ng2-cookies'; ...@@ -12,97 +12,9 @@ import {Cookie} from 'ng2-cookies/ng2-cookies';
import {Logger} from 'angular2-logger/core'; import {Logger} from 'angular2-logger/core';
import 'rxjs/add/operator/map'; import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch'; import 'rxjs/add/operator/catch';
import {DataStore, User, Browser} from './globals';
declare let jQuery: any; declare let jQuery: any;
// declare var Clipboard: any;
import * as io from 'socket.io-client';
export class Group {
id: string;
name: string;
membercount: number;
comment: string;
}
export let User: {
id: string;
name: string;
username: string;
password: string;
phone: string;
avatar: string;
role: string;
email: string;
is_active: boolean;
date_joined: string;
last_login: string;
groups: Array<Group>;
logined: boolean;
} = {
id: '',
name: 'nobody',
username: '',
password: '',
phone: '',
avatar: '',
role: '',
email: '',
is_active: false,
date_joined: '',
last_login: '',
groups: [],
logined: false,
};
export let DataStore: {
socket: any;
Nav: Array<{}>;
NavShow: boolean;
Path: {};
error: {};
msg: {};
loglevel: number;
leftbarshow: boolean;
windowsize: Array<number>;
} = {
socket: io.connect(),
Nav: [{}],
NavShow: true,
Path: {},
error: {},
msg: {},
loglevel: 0,
leftbarshow: true,
windowsize: [],
};
export let CSRF: string = '';
export let Browser: {
userAgent: string;
appCodeName: string;
appName: string;
appVersion: string;
language: string;
platform: string;
product: string;
productSub: string;
vendor: string;
} = {
userAgent: navigator.userAgent,
appCodeName: navigator.appCodeName,
appName: navigator.appName,
appVersion: navigator.appVersion,
language: navigator.language,
platform: navigator.platform,
product: navigator.product,
productSub: navigator.productSub,
vendor: navigator.vendor,
};
export class wsEvent {
event: string;
data: any;
}
@Injectable() @Injectable()
...@@ -125,7 +37,7 @@ export class HttpService { ...@@ -125,7 +37,7 @@ export class HttpService {
options = {}; options = {};
} }
options.headers = this.headers; options.headers = this.headers;
return this._http.get(url, options) return this._http.get(url, options);
} }
post(url: string, body: any, options?: RequestOptionsArgs) { post(url: string, body: any, options?: RequestOptionsArgs) {
...@@ -133,7 +45,7 @@ export class HttpService { ...@@ -133,7 +45,7 @@ export class HttpService {
options = {}; options = {};
} }
options.headers = this.headers; options.headers = this.headers;
return this._http.post(url, body, options) return this._http.post(url, body, options);
} }
put(url: string, body: any, options?: RequestOptionsArgs) { put(url: string, body: any, options?: RequestOptionsArgs) {
...@@ -141,7 +53,7 @@ export class HttpService { ...@@ -141,7 +53,7 @@ export class HttpService {
options = {}; options = {};
} }
options.headers = this.headers; options.headers = this.headers;
return this._http.put(url, body, options) return this._http.put(url, body, options);
} }
delete(url: string, options?: RequestOptionsArgs) { delete(url: string, options?: RequestOptionsArgs) {
...@@ -149,7 +61,7 @@ export class HttpService { ...@@ -149,7 +61,7 @@ export class HttpService {
options = {}; options = {};
} }
options.headers = this.headers; options.headers = this.headers;
return this._http.delete(url, options) return this._http.delete(url, options);
} }
patch(url: string, body: any, options?: RequestOptionsArgs) { patch(url: string, body: any, options?: RequestOptionsArgs) {
...@@ -157,7 +69,7 @@ export class HttpService { ...@@ -157,7 +69,7 @@ export class HttpService {
options = {}; options = {};
} }
options.headers = this.headers; options.headers = this.headers;
return this._http.patch(url, body, options) return this._http.patch(url, body, options);
} }
head(url: string, options?: RequestOptionsArgs) { head(url: string, options?: RequestOptionsArgs) {
...@@ -165,7 +77,7 @@ export class HttpService { ...@@ -165,7 +77,7 @@ export class HttpService {
options = {}; options = {};
} }
options.headers = this.headers; options.headers = this.headers;
return this._http.head(url, options) return this._http.head(url, options);
} }
options(url: string, options?: RequestOptionsArgs) { options(url: string, options?: RequestOptionsArgs) {
...@@ -173,7 +85,7 @@ export class HttpService { ...@@ -173,7 +85,7 @@ export class HttpService {
options = {}; options = {};
} }
options.headers = this.headers; options.headers = this.headers;
return this._http.options(url, options) return this._http.options(url, options);
} }
} }
...@@ -262,7 +174,7 @@ export class AppService implements OnInit { ...@@ -262,7 +174,7 @@ export class AppService implements OnInit {
browser() { browser() {
this._http.post('/api/browser', JSON.stringify(Browser)).map(res => res.json()).subscribe() this._http.post('/api/browser', JSON.stringify(Browser)).map(res => res.json()).subscribe();
} }
......
'use strict'; 'use strict';
import * as io from 'socket.io-client';
export const sep = '/'; export const sep = '/';
export const version = '22.22.2'; export const version = '22.22.2';
...@@ -17,3 +18,90 @@ export let Video: { ...@@ -17,3 +18,90 @@ export let Video: {
timelist: [], timelist: [],
totalTime: 0, totalTime: 0,
}; };
export class Group {
id: string;
name: string;
membercount: number;
comment: string;
}
export let User: {
id: string;
name: string;
username: string;
password: string;
phone: string;
avatar: string;
role: string;
email: string;
is_active: boolean;
date_joined: string;
last_login: string;
groups: Array<Group>;
logined: boolean;
} = {
id: '',
name: 'nobody',
username: '',
password: '',
phone: '',
avatar: '',
role: '',
email: '',
is_active: false,
date_joined: '',
last_login: '',
groups: [],
logined: false,
};
export let DataStore: {
socket: any;
Nav: Array<{}>;
NavShow: boolean;
Path: {};
error: {};
msg: {};
loglevel: number;
leftbarshow: boolean;
windowsize: Array<number>;
} = {
socket: io.connect(),
Nav: [{}],
NavShow: true,
Path: {},
error: {},
msg: {},
loglevel: 0,
leftbarshow: true,
windowsize: [],
};
export let CSRF: string = '';
export let Browser: {
userAgent: string;
appCodeName: string;
appName: string;
appVersion: string;
language: string;
platform: string;
product: string;
productSub: string;
vendor: string;
} = {
userAgent: navigator.userAgent,
appCodeName: navigator.appCodeName,
appName: navigator.appName,
appVersion: navigator.appVersion,
language: navigator.language,
platform: navigator.platform,
product: navigator.product,
productSub: navigator.productSub,
vendor: navigator.vendor,
};
export class wsEvent {
event: string;
data: any;
}
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
*/ */
import {Component, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {ActivatedRoute, Params} from '@angular/router'; import {ActivatedRoute, Params} from '@angular/router';
import {DataStore} from "../app.service"; import {DataStore} from '../globals';
declare let Mstsc: any; declare let Mstsc: any;
......
import {Component, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {Video} from '../../globals'; import {Video} from '../../globals';
import {Term} from '../../ControlPage/control/control.component';
declare let jQuery: any; declare let jQuery: any;
declare let Terminal: any; declare let Terminal: any;
......
...@@ -2,7 +2,7 @@ import {Component, OnInit} from '@angular/core'; ...@@ -2,7 +2,7 @@ import {Component, OnInit} from '@angular/core';
import {ActivatedRoute, Params} from '@angular/router'; import {ActivatedRoute, Params} from '@angular/router';
import {Logger} from 'angular2-logger/core'; import {Logger} from 'angular2-logger/core';
import {HttpService} from '../app.service'; import {HttpService} from '../app.service';
import {Video} from '../globals'; import {Video, DataStore} from '../globals';
@Component({ @Component({
selector: 'app-replay-page', selector: 'app-replay-page',
...@@ -16,6 +16,8 @@ export class ReplayPageComponent implements OnInit { ...@@ -16,6 +16,8 @@ export class ReplayPageComponent implements OnInit {
private _http: HttpService, private _http: HttpService,
private _logger: Logger) { private _logger: Logger) {
// this.video = {'type': 'none'}; // this.video = {'type': 'none'};
DataStore.NavShow = false;
} }
ngOnInit() { ngOnInit() {
......
import {Component, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {ActivatedRoute, Params} from '@angular/router'; import {ActivatedRoute, Params} from '@angular/router';
import {DataStore} from '../app.service'; import {DataStore} from '../globals';
import * as io from 'socket.io-client'; import * as io from 'socket.io-client';
declare let jQuery: any; declare let jQuery: 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