Commit 51b91f0e authored by ibuler's avatar ibuler

[Update] 设置分辨率

parent 9a02961e
......@@ -26,7 +26,7 @@ import {MAT_LABEL_GLOBAL_OPTIONS} from '@angular/material';
import {Pipes} from './pipes/pipes';
import {PagesComponents} from './pages/pages.component';
import {ElementComponents} from './elements/elements.component';
import {ChangLanWarningDialogComponent} from './elements/nav/nav.component';
import {ChangLanWarningDialogComponent, RDPSolutionDialogComponent} from './elements/nav/nav.component';
import {DialogService, ElementDialogAlertComponent} from './elements/dialog/dialog.service';
import {PluginModules} from './plugins/plugins';
import {TestPageComponent} from './test-page/test-page.component';
......@@ -55,6 +55,7 @@ import {SftpComponent} from './elements/sftp/sftp.component';
AssetTreeDialogComponent,
ElementDialogAlertComponent,
ChangLanWarningDialogComponent,
RDPSolutionDialogComponent,
],
bootstrap: [AppComponent],
providers: [
......
......@@ -94,6 +94,13 @@ export class HttpService {
.set('asset_id', asset_id)
.set('system_user_id', system_user_id)
.set('token', DataStore.guacamole_token);
const solution = localStorage.getItem('rdpSolution') || 'Auto';
if (solution !== 'Auto') {
const width = solution.split('x')[0];
const height = solution.split('x')[1];
params.set('width', width).set('height', height);
}
return this.http.get(
'/guacamole/api/session/ext/jumpserver/asset/add',
{
......@@ -107,6 +114,12 @@ export class HttpService {
const params = new HttpParams()
.set('asset_token', assetToken)
.set('token', token);
const solution = localStorage.getItem('rdpSolution') || 'Auto';
if (solution !== 'Auto') {
const width = solution.split('x')[0];
const height = solution.split('x')[1];
params.set('width', width).set('height', height);
}
return this.http.get(
'/guacamole/api/ext/jumpserver/asset/token/add',
{
......
......@@ -14,6 +14,7 @@ import {ElementDialogAlertComponent} from './dialog/dialog.service';
import {ElementGuacamoleComponent} from './guacamole/guacamole.component';
import {ElementSshTermComponent} from './ssh-term/ssh-term.component';
import {AssetTreeDialogComponent, ElementAssetTreeComponent} from './asset-tree/asset-tree.component';
import {RDPSolutionDialogComponent} from './nav/nav.component';
export const ElementComponents = [
ElementLeftbarComponent,
......@@ -31,5 +32,6 @@ export const ElementComponents = [
ElementGuacamoleComponent,
ElementAssetTreeComponent,
ElementSshTermComponent,
AssetTreeDialogComponent
AssetTreeDialogComponent,
RDPSolutionDialogComponent
];
......@@ -106,6 +106,26 @@ export class ElementNavComponent implements OnInit {
window.open('https://market.aliyun.com/products/53690006/cmgj026011.html?spm=5176.730005.0.0.cY2io1');
break;
}
case 'SetResolution': {
const dialog = this._dialog.open(
RDPSolutionDialogComponent,
{
height: '200px',
width: '300px',
data: {
title: 'Warning',
note: 'The page will be reload, can you acceptable?',
cancel: 'Cancel',
confirm: 'Confirm',
},
});
dialog.afterClosed().subscribe(result => {
if (result) {
console.log(result);
}
});
break;
}
case 'EnterLicense': {
this.EnterLicense();
break;
......@@ -175,12 +195,6 @@ export class ElementNavComponent implements OnInit {
}
getnav() {
this._logger.log('getnav');
// this._http.get('/api/nav')
// .map(res => res.json())
// .subscribe(response => {
// DataStore.Nav = response;
// });
DataStore.Nav = [{
'id': 'File',
'name': 'Server',
......@@ -195,35 +209,6 @@ export class ElementNavComponent implements OnInit {
'click': 'DisconnectAll',
'name': 'Disconnect all'
},
// {
// 'id': 'Duplicate',
// 'href': '',
// 'name': 'Duplicate',
// 'disable': true
// },
// {
// 'id': 'Upload',
// 'href': '',
// 'name': 'Upload',
// 'disable': true
// },
// {
// 'id': 'Download',
// 'href': '',
// 'name': 'Download',
// 'disable': true
// },
// {
// 'id': ' Search',
// 'href': '',
// 'name': 'Search',
// 'disable': true
// },
// {
// 'id': 'Reload',
// 'click': 'ReloadLeftbar',
// 'name': 'Reload'
// }
]
}, {
'id': 'FileManager',
......@@ -245,6 +230,11 @@ export class ElementNavComponent implements OnInit {
'click': 'HideLeft',
'name': 'Hide left manager'
},
{
'id': 'RDPResolution',
'click': 'SetResolution',
'name': 'RDP Resolution'
},
{
'id': 'SplitVertical',
'href': '',
......@@ -369,3 +359,33 @@ export class ChangLanWarningDialogComponent implements OnInit {
this.dialogRef.close();
}
}
@Component({
selector: 'elements-rdp-solution-dialog',
templateUrl: 'rdpSolutionDialog.html',
})
export class RDPSolutionDialogComponent implements OnInit {
solutions = ['Auto', '1024x768', '1366x768', '1400*900'];
solution: string;
cacheKey = 'rdpSolution';
constructor(public dialogRef: MatDialogRef<RDPSolutionDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any) {
}
ngOnInit() {
this.solution = localStorage.getItem(this.cacheKey) || 'Auto';
}
setSolution(value: string) {
localStorage.setItem(this.cacheKey, value);
}
onSubmit() {
this.setSolution(this.solution);
}
onNoClick(): void {
this.dialogRef.close();
}
}
<h1 mat-dialog-title>{{"Set RDP solution"|trans}}</h1>
<mat-form-field>
<mat-select [(value)]="solution"
placeholder="{{'Select a solution'|trans}}" >
<mat-option *ngFor="let s of solutions" value="{{s}}">{{s}}</mat-option>
</mat-select>
<!---->
</mat-form-field>
<div style="float: right">
<button mat-raised-button (click)="onNoClick()">{{"Cancel"|trans}}</button>
<button mat-raised-button color="primary" [mat-dialog-close]="selected" (click)="onSubmit()">{{"Confirm"|trans}}</button>
</div>
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