Unverified Commit 2c4a7bb8 authored by 老广's avatar 老广 Committed by GitHub

Merge pull request #132 from jumpserver/dev

Dev
parents 652e47f9 457a6d5a
......@@ -18,15 +18,14 @@
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-form-field *ngIf="!globalSetting.WINDOWS_SKIP_ALL_MANUAL_PASSWORD">
<mat-select [(value)]="setting.isSkipAllManualPassword"
placeholder="{{'Skip manual password'|trans }}" >
<mat-option *ngFor="let s of boolChoices" value="{{s.value}}">{{s.name|trans}}</mat-option>
</mat-select>
</mat-form-field>
<div style="float: right">
<div style="float: right" [style.padding-top]="globalSetting.WINDOWS_SKIP_ALL_MANUAL_PASSWORD ? '20px' : '0'">
<button mat-raised-button (click)="onNoClick()">{{"Cancel"|trans}}</button>
<button mat-raised-button color="primary" (click)="onSubmit()">{{"Confirm"|trans}}</button>
</div>
import {Component, OnInit} from '@angular/core';
import { MatDialogRef} from '@angular/material';
import {SettingService} from '@app/services';
import {Setting} from '@app/model';
import {GlobalSetting, Setting} from '@app/model';
@Component({
......@@ -13,6 +13,7 @@ export class ElementSettingComponent implements OnInit {
solutionsChoices = ['Auto', '1024x768', '1366x768', '1600x900', '1920×1080'];
boolChoices = [{name: 'Yes', value: '1'}, {name: 'No', value: '0'}];
setting: Setting;
globalSetting: GlobalSetting;
constructor(public dialogRef: MatDialogRef<ElementSettingComponent>,
private settingSrv: SettingService) {
......@@ -20,6 +21,7 @@ export class ElementSettingComponent implements OnInit {
ngOnInit() {
this.setting = this.settingSrv.setting;
this.globalSetting = this.settingSrv.globalSetting;
}
onSubmit() {
......
......@@ -186,6 +186,9 @@ export class Monitor {
type: string;
}
export class GlobalSetting {
WINDOWS_SKIP_ALL_MANUAL_PASSWORD: boolean;
}
export class Setting {
rdpSolution: string = 'Auto';
......
......@@ -247,4 +247,6 @@ export class HttpService {
return this.http.get('/api/v1/users/connection-token/', {params: params});
}
}
import {Injectable} from '@angular/core';
import {Setting} from '@app/model';
import {Setting, GlobalSetting} from '@app/model';
import {LocalStorageService} from './share';
import {HttpClient} from '@angular/common/http';
@Injectable()
export class SettingService {
setting: Setting;
globalSetting: GlobalSetting;
settingKey: 'LunaSetting';
constructor(private store: LocalStorageService) {
constructor(private store: LocalStorageService, private _http: HttpClient) {
const settingData = this.store.get(this.settingKey);
if (settingData) {
try {
......@@ -18,6 +20,9 @@ export class SettingService {
} else {
this.setting = new Setting();
}
this._http.get<any>('/api/v1/settings/public/').subscribe(resp => {
this.globalSetting = resp.data;
});
}
save() {
......@@ -29,7 +34,15 @@ export class SettingService {
return this.setting.isLoadTreeAsync === '1';
}
// 全局跳过手动输入windows账号密码
globalSkipAllManualPassword(): boolean {
return this.globalSetting.WINDOWS_SKIP_ALL_MANUAL_PASSWORD;
}
isSkipAllManualPassword(): boolean {
if (this.globalSkipAllManualPassword()) {
return true;
}
return this.setting.isSkipAllManualPassword === '1';
}
}
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