Commit edb3af8a authored by liuzheng712's avatar liuzheng712

publish

parent 0f0f1fd8
......@@ -7,7 +7,8 @@
*/
import {Component, OnInit} from '@angular/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({
selector: 'app-footer',
......
......@@ -7,9 +7,10 @@
*/
import {Component, OnInit} from '@angular/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 {Router} from '@angular/router';
import {DataStore, User} from '../../globals';
declare let jQuery: any;
......@@ -37,7 +38,7 @@ export class LoginComponent implements OnInit {
if (f.valid) {
this.login();
} else {
this._logger.error("the form not valid")
this._logger.error('the form not valid');
}
}
......
......@@ -8,11 +8,12 @@
import {Component, OnInit} from '@angular/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 {SshComponent} from '../../ControlPage/control/ssh/ssh.component';
import {RdpComponent} from '../../ControlPage/control/rdp/rdp.component';
import {NavList} from '../../ControlPage/control/control.component';
import {DataStore} from '../../globals';
declare let layer: any;
declare let jQuery: any;
......@@ -25,11 +26,15 @@ declare let jQuery: any;
export class NavComponent implements OnInit {
DataStore = DataStore;
static Hide() {
jQuery('app-nav').hide();
}
constructor(private _appService: AppService,
private _http: HttpService,
private _logger: Logger) {
this._logger.log('nav.ts:NavComponent');
this.getnav()
this.getnav();
}
ngOnInit() {
......@@ -38,59 +43,59 @@ export class NavComponent implements OnInit {
click(event) {
this._logger.debug('nav.ts:NavComponent,click', event);
switch (event) {
case "ReloadLeftbar": {
case 'ReloadLeftbar': {
CleftbarComponent.Reload();
break
break;
}
case "HideLeft": {
case 'HideLeft': {
CleftbarComponent.Hide();
break
break;
}
case "ShowLeft": {
case 'ShowLeft': {
CleftbarComponent.Show();
break
break;
}
case "Copy": {
case 'Copy': {
// this._appService.copy();
break
break;
}
case"Disconnect": {
case'Disconnect': {
switch (NavList.List[NavList.Active].type) {
case "ssh": {
case 'ssh': {
SshComponent.TerminalDisconnect(NavList.List[NavList.Active]);
break
break;
}
case "rdp": {
case 'rdp': {
RdpComponent.Disconnect(NavList.List[NavList.Active]);
break
break;
}
default: {
//statements;
// statements;
break;
}
}
break
break;
}
case"DisconnectAll": {
case'DisconnectAll': {
SshComponent.TerminalDisconnectAll();
RdpComponent.DisconnectAll();
break
break;
}
case "Website": {
case 'Website': {
window.open('http://www.jumpserver.org');
break
break;
}
case "BBS": {
case 'BBS': {
window.open('http://bbs.jumpserver.org');
break
break;
}
case "EnterLicense": {
case 'EnterLicense': {
this.EnterLicense();
break
break;
}
default: {
break
break;
}
}
......@@ -121,119 +126,116 @@ export class NavComponent implements OnInit {
// DataStore.Nav = response;
// });
DataStore.Nav = [{
"id": "File",
"name": "Server",
"children": [
{
"id": "NewConnection",
"href": "",
"name": "New connection",
"disable": true
'id': 'File',
'name': 'Server',
'children': [
{
'id': 'NewConnection',
'href': '',
'name': 'New connection',
'disable': true
},
{
"id": "Connect",
"click": "Connect",
"name": "Connect",
"disable": true
'id': 'Connect',
'click': 'Connect',
'name': 'Connect',
'disable': true
},
{
"id": "Disconnect",
"click": "Disconnect",
"name": "Disconnect"
'id': 'Disconnect',
'click': 'Disconnect',
'name': 'Disconnect'
},
{
"id": "DisconnectAll",
"click": "DisconnectAll",
"name": "Disconnect all"
'id': 'DisconnectAll',
'click': 'DisconnectAll',
'name': 'Disconnect all'
},
{
"id": "Duplicate",
"href": "",
"name": "Duplicate",
"disable": true
'id': 'Duplicate',
'href': '',
'name': 'Duplicate',
'disable': true
},
{
"id": "Upload",
"href": "",
"name": "Upload",
"disable": true
'id': 'Upload',
'href': '',
'name': 'Upload',
'disable': true
},
{
"id": "Download",
"href": "",
"name": "Download",
"disable": true
'id': 'Download',
'href': '',
'name': 'Download',
'disable': true
},
{
"id": " Search",
"href": "",
"name": "Search",
"disable": true
'id': ' Search',
'href': '',
'name': 'Search',
'disable': true
},
{
"id": "Reload",
"click": "ReloadLeftbar",
"name": "Reload"
'id': 'Reload',
'click': 'ReloadLeftbar',
'name': 'Reload'
}
]
}, {
"id": "View",
"name": "View",
"children": [
'id': 'View',
'name': 'View',
'children': [
{
"id": "HindLeftManager",
"click": "HideLeft",
"name": "Hind left manager"
'id': 'HindLeftManager',
'click': 'HideLeft',
'name': 'Hind left manager'
},
{
"id": "SplitVertical",
"href": "",
"name": "Split vertical",
"disable": true
'id': 'SplitVertical',
'href': '',
'name': 'Split vertical',
'disable': true
},
{
"id": "CommandBar",
"href": "",
"name": "Command bar",
"disable": true
'id': 'CommandBar',
'href': '',
'name': 'Command bar',
'disable': true
},
{
"id": "ShareSession",
"href": "",
"name": "Share session (read/write)",
"disable": true
'id': 'ShareSession',
'href': '',
'name': 'Share session (read/write)',
'disable': true
},
{
"id": "Language",
"href": "",
"name": "Language",
"disable": true
'id': 'Language',
'href': '',
'name': 'Language',
'disable': true
}]
}, {
"id": "Help",
"name": "Help",
"children": [
'id': 'Help',
'name': 'Help',
'children': [
{
"id": "EnterLicense",
"click": "EnterLicense",
"name": "Enter License"
'id': 'EnterLicense',
'click': 'EnterLicense',
'name': 'Enter License'
},
{
"id": "Website",
"click": "Website",
"name": "Website"
'id': 'Website',
'click': 'Website',
'name': 'Website'
},
{
"id": "BBS",
"click": "BBS",
"name": "BBS"
'id': 'BBS',
'click': 'BBS',
'name': 'BBS'
}]
}]
}];
}
static Hide() {
jQuery("app-nav").hide()
}
Connect() {
layer.prompt({
......
......@@ -10,10 +10,11 @@
import {Component, OnInit} from '@angular/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 {RdpComponent} from '../control/rdp/rdp.component';
import {SearchComponent} from '../search/search.component';
import {DataStore} from '../../globals';
declare let layer: any;
declare let jQuery: any;
......
......@@ -12,10 +12,9 @@ import {Cookie} from 'ng2-cookies/ng2-cookies';
declare let jQuery: any;
declare let Terminal: any;
import {AppService, DataStore} from '../../../app.service';
import {AppService} from '../../../app.service';
import {NavList, View, Term} from '../control.component';
@Component({
selector: 'app-ssh',
templateUrl: './ssh.component.html',
......
......@@ -6,7 +6,8 @@
* @author liuzheng <liuzheng712@gmail.com>
*/
import {Component, OnInit} from '@angular/core';
import {AppService, DataStore, User} from '../app.service';
import {AppService} from '../app.service';
import {DataStore, User} from '../globals';
@Component({
selector: 'app-controllpage',
......
......@@ -9,9 +9,9 @@ import {Component, OnChanges, Input, Pipe, PipeTransform} from '@angular/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({
selector: 'app-search',
......@@ -34,7 +34,7 @@ export class SearchComponent implements OnChanges {
}
modelChange($event) {
this.Search(Q)
this.Search(Q);
}
public Search(q) {
......@@ -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 {
return value.filter(function (el: any) {
// 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 value;
}
......
......@@ -8,7 +8,7 @@
import {Component, OnInit} from '@angular/core';
import {Logger} from 'angular2-logger/core';
import {AppService, DataStore} from '../../app.service';
import {AppService} from '../../app.service';
@Component({
selector: 'app-ileftbar',
......
......@@ -6,7 +6,8 @@
* @author liuzheng <liuzheng712@gmail.com>
*/
import {Component} from '@angular/core';
import {AppService, HttpService, DataStore} from './app.service';
import {AppService, HttpService} from './app.service';
import {DataStore} from './globals';
@Component({
selector: 'app-root',
......
......@@ -12,97 +12,9 @@ import {Cookie} from 'ng2-cookies/ng2-cookies';
import {Logger} from 'angular2-logger/core';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';
import {DataStore, User, Browser} from './globals';
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()
......@@ -125,7 +37,7 @@ export class HttpService {
options = {};
}
options.headers = this.headers;
return this._http.get(url, options)
return this._http.get(url, options);
}
post(url: string, body: any, options?: RequestOptionsArgs) {
......@@ -133,7 +45,7 @@ export class HttpService {
options = {};
}
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) {
......@@ -141,7 +53,7 @@ export class HttpService {
options = {};
}
options.headers = this.headers;
return this._http.put(url, body, options)
return this._http.put(url, body, options);
}
delete(url: string, options?: RequestOptionsArgs) {
......@@ -149,7 +61,7 @@ export class HttpService {
options = {};
}
options.headers = this.headers;
return this._http.delete(url, options)
return this._http.delete(url, options);
}
patch(url: string, body: any, options?: RequestOptionsArgs) {
......@@ -157,7 +69,7 @@ export class HttpService {
options = {};
}
options.headers = this.headers;
return this._http.patch(url, body, options)
return this._http.patch(url, body, options);
}
head(url: string, options?: RequestOptionsArgs) {
......@@ -165,7 +77,7 @@ export class HttpService {
options = {};
}
options.headers = this.headers;
return this._http.head(url, options)
return this._http.head(url, options);
}
options(url: string, options?: RequestOptionsArgs) {
......@@ -173,7 +85,7 @@ export class HttpService {
options = {};
}
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 {
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';
import * as io from 'socket.io-client';
export const sep = '/';
export const version = '22.22.2';
......@@ -17,3 +18,90 @@ export let Video: {
timelist: [],
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 @@
*/
import {Component, OnInit} from '@angular/core';
import {ActivatedRoute, Params} from '@angular/router';
import {DataStore} from "../app.service";
import {DataStore} from '../globals';
declare let Mstsc: any;
......
import {Component, OnInit} from '@angular/core';
import {Video} from '../../globals';
import {Term} from '../../ControlPage/control/control.component';
declare let jQuery: any;
declare let Terminal: any;
......
......@@ -2,7 +2,7 @@ import {Component, OnInit} from '@angular/core';
import {ActivatedRoute, Params} from '@angular/router';
import {Logger} from 'angular2-logger/core';
import {HttpService} from '../app.service';
import {Video} from '../globals';
import {Video, DataStore} from '../globals';
@Component({
selector: 'app-replay-page',
......@@ -16,6 +16,8 @@ export class ReplayPageComponent implements OnInit {
private _http: HttpService,
private _logger: Logger) {
// this.video = {'type': 'none'};
DataStore.NavShow = false;
}
ngOnInit() {
......
import {Component, OnInit} from '@angular/core';
import {ActivatedRoute, Params} from '@angular/router';
import {DataStore} from '../app.service';
import {DataStore} from '../globals';
import * as io from 'socket.io-client';
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