Commit 0a42143f authored by ibuler's avatar ibuler

Merge branch 'dev_beta' into dev

parents 7eaa5792 23b0491a
......@@ -3,31 +3,11 @@
"target": "http://127.0.0.1:8080",
"secure": false
},
"/luna/i18n": {
"target": "http://127.0.0.1:5001",
"secure": false
},
"/socket.io/": {
"/koko": {
"target": "http://127.0.0.1:5000",
"secure": false,
"ws": true
},
"/coco/": {
"target": "http://127.0.0.1:5000",
"secure:": false,
"ws": true
},
"/static": {
"target": "http://127.0.0.1:5000",
"secure:": false
},
"/rdp/socket.io/": {
"target": "http://localhost:9250",
"pathRewrite": {
"^/rdp": ""
},
"secure": false
},
"/media/": {
"target": "http://127.0.0.1:8080",
"secure": false
......
......@@ -9,7 +9,7 @@ import {MAT_LABEL_GLOBAL_OPTIONS} from '@angular/material';
// service
import {AllServices} from '@app/services';
import {AppRouterModule} from './router/router.module';
import {AppRouterModule} from './router.module';
import {Pipes} from './pipes/pipes';
import {AppComponent} from './pages/app.component';
import {PagesComponents} from './pages/pages.component';
......
......@@ -4,7 +4,6 @@
</ul>
<ul id="remoteAppsTree" class="ztree">
{{ "Loading"|trans }} ...
</ul>
</div>
......
......@@ -97,7 +97,7 @@ export class ElementAssetTreeComponent implements OnInit, OnDestroy {
if (this.isLoadTreeAsync) {
setting['async'] = {
enable: true,
url: '/api/perms/v1/users/nodes/children-with-assets/tree/?cache_policy=1',
url: '/api/v1/perms/users/nodes/children-with-assets/tree/?cache_policy=1',
autoParam: ['id=key', 'name=n', 'level=lv'],
type: 'get'
};
......@@ -134,7 +134,7 @@ export class ElementAssetTreeComponent implements OnInit, OnDestroy {
};
this._http.getMyGrantedRemoteApps().subscribe(
resp => {
if (!resp) {
if (resp.length === 1) {
return;
}
const tree = $.fn.zTree.init($('#remoteAppsTree'), setting, resp);
......
......@@ -41,27 +41,36 @@ export class ElementConnectComponent implements OnInit, OnDestroy {
}
});
const loginTo = this._appSvc.getQueryString('login_to');
if (loginTo && !this.hasLoginTo) {
this._http.filterMyGrantedAssetsById(loginTo).subscribe(
nodes => {
if (nodes.length === 1) {
this.hasLoginTo = true;
const node = nodes[0];
this.Connect(node);
const tp = this._appSvc.getQueryString('type') || 'asset';
if (this.hasLoginTo || !loginTo) {
return;
}
switch (tp) {
case 'asset':
this._http.filterMyGrantedAssetsById(loginTo).subscribe(
nodes => {
if (nodes.length === 1) {
this.hasLoginTo = true;
const node = nodes[0];
this.Connect(node);
}
}
}
);
this._http.getMyGrantedRemoteApps(loginTo).subscribe(
nodes => {
if (nodes.length === 1) {
this.hasLoginTo = true;
const node = nodes[0];
this.Connect(node);
);
break;
case 'remote_app':
this._http.getMyGrantedRemoteApps(loginTo).subscribe(
nodes => {
if (nodes.length === 1) {
this.hasLoginTo = true;
const node = nodes[0];
this.Connect(node);
}
}
}
);
);
break;
}
}
ngOnDestroy(): void {
connectEvt.unsubscribe();
}
......
......@@ -13,8 +13,10 @@ import {ElementDialogAlertComponent} from './dialog/dialog.service';
import {ElementGuacamoleComponent} from './guacamole/guacamole.component';
import {ElementSshTermComponent} from './ssh-term/ssh-term.component';
import {ElementConnectComponent, AssetTreeDialogComponent, ManualPasswordDialogComponent} from './connect/connect.component';
import {ElementSftpComponent} from '@app/elements/sftp/sftp.component';
import {ElementSettingComponent} from '@app/elements/setting/setting.component';
import {ElementSftpComponent} from './sftp/sftp.component';
import {ElementSettingComponent} from './setting/setting.component';
import {ElementReplayGuacamoleComponent} from './replay/guacamole/guacamole.component';
import {ElementReplayJsonComponent} from './replay/json/json.component';
export const ElementComponents = [
ElementLeftBarComponent,
......@@ -33,6 +35,8 @@ export const ElementComponents = [
ElementSshTermComponent,
ElementConnectComponent,
ElementSftpComponent,
ElementReplayGuacamoleComponent,
ElementReplayJsonComponent,
AssetTreeDialogComponent,
ChangLanWarningDialogComponent,
ManualPasswordDialogComponent,
......
......@@ -41,7 +41,7 @@ export class ElementNavComponent implements OnInit {
click(event) {
switch (event) {
case 'ConnectSFTP': {
window.open('/coco/elfinder/sftp/');
window.open('/koko/elfinder/sftp/');
break;
}
case 'HideLeft': {
......
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ReplayGuacamoleComponent } from './guacamole.component';
import { ElementReplayGuacamoleComponent } from './guacamole.component';
describe('ReplayGuacamoleComponent', () => {
let component: ReplayGuacamoleComponent;
let fixture: ComponentFixture<ReplayGuacamoleComponent>;
let component: ElementReplayGuacamoleComponent;
let fixture: ComponentFixture<ElementReplayGuacamoleComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ReplayGuacamoleComponent ]
declarations: [ ElementReplayGuacamoleComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ReplayGuacamoleComponent);
fixture = TestBed.createComponent(ElementReplayGuacamoleComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
......
import { Component, OnInit, Input } from '@angular/core';
import * as Guacamole from 'guacamole-common-js/dist/guacamole-common';
import { Replay } from '../replay.model';
import { Replay } from '@app/model';
function zeroPad(num, minLength) {
let str = num.toString();
......@@ -46,11 +46,11 @@ function formatTime(millis: number) {
@Component({
selector: 'app-replay-guacamole',
selector: 'elements-replay-guacamole',
templateUrl: './guacamole.component.html',
styleUrls: ['./guacamole.component.scss']
})
export class ReplayGuacamoleComponent implements OnInit {
export class ElementReplayGuacamoleComponent implements OnInit {
isPlaying = false;
recording: any;
playerRef: any;
......
import {Component, Input, OnInit} from '@angular/core';
import {Terminal} from 'xterm';
import {HttpService, LogService} from '@app/services';
import {Replay} from '../replay.model';
import {Replay} from '@app/model';
function zeroPad(num, minLength) {
let str = num.toString();
......@@ -47,11 +47,11 @@ function formatTime(millis: number) {
@Component({
selector: 'app-replay-json',
selector: 'elements-replay-json',
templateUrl: './json.component.html',
styleUrls: ['./json.component.css']
})
export class JsonComponent implements OnInit {
export class ElementReplayJsonComponent implements OnInit {
isPlaying = false;
recording: any;
playerRef: any;
......
......@@ -8,7 +8,7 @@
</mat-form-field>
<mat-form-field>
<input [(value)]="setting.fontSize" matInput placeholder='{{"Font size"|trans}}' name="fontSize" type="number" min="5" max="60" >
<input [(ngModel)]="setting.fontSize" matInput placeholder='{{"Font size"|trans}}' name="fontSize" type="number" min="5" max="60" >
</mat-form-field>
<mat-form-field>
......
import {Component, Inject, OnInit} from '@angular/core';
import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material';
import {Component, OnInit} from '@angular/core';
import { MatDialogRef} from '@angular/material';
import {SettingService} from '@app/services';
import {Setting} from '@app/model';
......@@ -10,12 +10,11 @@ import {Setting} from '@app/model';
styles: ['.mat-form-field { width: 100%;}']
})
export class ElementSettingComponent implements OnInit {
solutionsChoices = ['Auto', '1024x768', '1366x768', '1400x900'];
solutionsChoices = ['Auto', '1024x768', '1366x768', '1600x900', '1920×1080'];
boolChoices = [{name: 'Yes', value: '1'}, {name: 'No', value: '0'}];
setting: Setting;
constructor(public dialogRef: MatDialogRef<ElementSettingComponent>,
@Inject(MAT_DIALOG_DATA) public data: any,
private settingSrv: SettingService) {
}
......
import {Component, OnInit, Input, ElementRef, ViewChild} from '@angular/core';
import {DataStore} from '@app/globals';
import {DomSanitizer} from '@angular/platform-browser';
@Component({
......@@ -16,7 +15,7 @@ export class ElementSftpComponent implements OnInit {
}
ngOnInit() {
let _target = '/coco/elfinder/sftp/';
let _target = '/koko/elfinder/sftp/';
if (this.host) {
// _target += 'f5857eee-c114-4564-af8f-96329c400a8a' + '/';
_target += this.host.id + '/';
......
......@@ -8,7 +8,7 @@ import {DataStore as _DataStore, Browser as _Browser, Video as _Video, Monitor a
const scheme = document.location.protocol === 'https:' ? 'wss' : 'ws';
const port = document.location.port ? ':' + document.location.port : '';
const hostname = document.location.hostname;
const wsURL = `${scheme}://${hostname}${port}/socket.io/`;
const wsURL = `${scheme}://${hostname}${port}/koko/ws/`;
export let TermWS = null;
export const emitter = new(EventEmitter);
......
......@@ -188,8 +188,21 @@ export class Monitor {
export class Setting {
rdpSolution: string = '1024x768';
rdpSolution: string = 'Auto';
fontSize: number = 14;
isLoadTreeAsync: string = '1';
isSkipAllManualPassword: string = '0';
}
export class Replay {
id: string;
src: string;
type: string;
status: string;
timelist: Array<number>;
totalTime: number;
json: any;
height: number;
width: number;
}
......@@ -5,20 +5,17 @@ import {PagesMonitorComponent} from './monitor/monitor.component';
import {PagesReplayComponent} from './replay/replay.component';
import {PagesNotFoundComponent} from './not-found/not-found.component';
import {PagesLoginComponent} from './login/login.component';
import {JsonComponent} from './replay/json/json.component';
import {PagesMonitorLinuxComponent} from './monitor/linux/linux.component';
import {PagesMonitorWindowsComponent} from './monitor/windows/windows.component';
import {ReplayGuacamoleComponent} from './replay/guacamole/guacamole.component';
export const PagesComponents = [
PageMainComponent,
PagesBlankComponent,
PagesConnectComponent,
PagesMonitorComponent,
PagesReplayComponent, JsonComponent,
PagesReplayComponent,
PagesNotFoundComponent,
PagesLoginComponent,
PagesMonitorLinuxComponent,
PagesMonitorWindowsComponent,
ReplayGuacamoleComponent
];
<app-replay-json [replay]="replay" *ngIf="replay.type=='json'"></app-replay-json>
<app-replay-guacamole [replay]="replay" *ngIf="replay.type=='guacamole'"></app-replay-guacamole>
<elements-replay-json [replay]="replay" *ngIf="replay.type=='json'"></elements-replay-json>
<elements-replay-guacamole [replay]="replay" *ngIf="replay.type=='guacamole'"></elements-replay-guacamole>
import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {HttpService, LogService} from '@app/services';
import {Replay} from './replay.model';
import {Replay} from '@app/model';
@Component({
selector: 'pages-replay',
......
export class Replay {
id: string;
src: string;
type: string;
status: string;
timelist: Array<number>;
totalTime: number;
json: any;
height: number;
width: number;
}
import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import {PagesBlankComponent} from '../pages/blank/blank.component';
import {PagesConnectComponent} from '../pages/connect/connect.component';
import {PagesReplayComponent} from '../pages/replay/replay.component';
import {PageMainComponent} from '../pages/main/main.component';
import {PagesMonitorComponent} from '../pages/monitor/monitor.component';
import {ElementSftpComponent} from '../elements/sftp/sftp.component';
import {PagesBlankComponent} from './pages/blank/blank.component';
import {PagesConnectComponent} from './pages/connect/connect.component';
import {PagesReplayComponent} from './pages/replay/replay.component';
import {PageMainComponent} from './pages/main/main.component';
import {PagesMonitorComponent} from './pages/monitor/monitor.component';
import {ElementSftpComponent} from './elements/sftp/sftp.component';
const appRoutes: Routes = [
......
......@@ -49,29 +49,29 @@ export class HttpService {
}
getUserProfile() {
return this.http.get<_User>('/api/users/v1/profile/');
return this.http.get<_User>('/api/v1/users/profile/');
}
getMyGrantedAssets(keyword) {
const url = `/api/perms/v1/users/assets/tree/?search=${keyword}`;
const url = `/api/v1/perms/users/assets/tree/?search=${keyword}`;
return this.http.get<Array<TreeNode>>(url);
}
filterMyGrantedAssetsById(id: string) {
const url = `/api/perms/v1/users/assets/tree/?id=${id}`;
const url = `/api/v1/perms/users/assets/tree/?id=${id}`;
return this.http.get<Array<TreeNode>>(url);
}
getMyGrantedNodes(async: boolean, refresh?: boolean) {
const cachePolicy = refresh ? '2' : '1';
const syncUrl = `/api/perms/v1/users/nodes-with-assets/tree/?cache_policy=${cachePolicy}`;
const asyncUrl = `/api/perms/v1/users/nodes/children-with-assets/tree/?cache_policy=${cachePolicy}`;
const syncUrl = `/api/v1/perms/users/nodes-with-assets/tree/?cache_policy=${cachePolicy}`;
const asyncUrl = `/api/v1/perms/users/nodes/children-with-assets/tree/?cache_policy=${cachePolicy}`;
const url = async ? asyncUrl : syncUrl;
return this.http.get<Array<TreeNode>>(url);
}
getMyGrantedRemoteApps(id?: string) {
let url = '/api/perms/v1/user/remote-apps/tree/';
let url = '/api/v1/perms/user/remote-apps/tree/';
if (id) {
url += `?id=${id}&only=1`;
}
......@@ -189,7 +189,7 @@ export class HttpService {
}
getReplay(token: string) {
return this.http.get('/api/terminal/v1/sessions/' + token + '/replay');
return this.http.get('/api/v1/terminal/sessions/' + token + '/replay');
}
// get_replay_json(token: string) {
......@@ -204,7 +204,7 @@ export class HttpService {
const params = new HttpParams()
.set('user-only', '1')
.set('token', token);
return this.http.get('/api/users/v1/connection-token/', {params: params});
return this.http.get('/api/v1/users/connection-token/', {params: params});
}
}
......@@ -9,9 +9,8 @@
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root>Loading...</app-root>
<app-root>加载中...</app-root>
<span id="marker" style="display: none;font-size: 14px">marker</span>
</body>
<script>
window.onload = function (ev) {
......@@ -21,15 +20,15 @@
}
if (navigator.clipboard && navigator.clipboard.readText) {
navigator.clipboard.readText().then(function textRead(text) {
clipboardData = text;
});
navigator.clipboard.readText().then(function textRead(text) {
clipboardData = text;
});
}
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(clipboardData)
}
}
}
</script>
</html>
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