Skip to content

Commit

Permalink
Merge pull request #1087 from jumpserver/master
Browse files Browse the repository at this point in the history
v3.10.8 master to v3.10
  • Loading branch information
BaiJiangJie committed Apr 18, 2024
2 parents 052bdd1 + 2be976f commit a995ede
Show file tree
Hide file tree
Showing 36 changed files with 784 additions and 255 deletions.
391 changes: 271 additions & 120 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion src/app/elements/asset-tree/asset-tree.component.ts
Expand Up @@ -102,6 +102,7 @@ export class ElementAssetTreeComponent implements OnInit {
isShowRMenu = false;
rightClickSelectNode: any;
isLoadTreeAsync: boolean;
isOpenNewWindow: boolean;
filterAssetCancel$: Subject<boolean> = new Subject();
favoriteAssets = [];
searchValue = '';
Expand Down Expand Up @@ -221,6 +222,8 @@ export class ElementAssetTreeComponent implements OnInit {
this.currentOrgID = this._cookie.get('X-JMS-LUNA-ORG') || this._cookie.get('X-JMS-ORG');
this._settingSvc.afterInited().then((state) => {
this.isLoadTreeAsync = this._settingSvc.isLoadTreeAsync();
this.isOpenNewWindow = this._settingSvc.isOpenNewWindow();

if (state) {
if (!this._settingSvc.hasXPack() && this.currentOrgID === SYSTEM_ORG_ID) {
this.currentOrgID = DEFAULT_ORG_ID;
Expand Down Expand Up @@ -255,7 +258,11 @@ export class ElementAssetTreeComponent implements OnInit {
this._dialog.open(DisabledAssetsDialogComponent, config);
return;
}
this.connectAsset(treeNode).then();
if (this.isOpenNewWindow) {
connectOnNewPage(treeNode, 'auto');
} else {
this.connectAsset(treeNode).then();
}
}

onAssetTreeCheck(event, treeId) {
Expand Down
18 changes: 9 additions & 9 deletions src/app/elements/chat/chat.component.html
@@ -1,25 +1,25 @@
<div id="chatContainer" class="chat-container" [ngClass]="{'show': !isShow}">
<div class="modal" (click)="toggle()"></div>
<div [ngClass]="{'show': !isShow}" class="chat-container" id="chatContainer">
<div (click)="toggle()" class="modal"></div>
<div class="drawer-panel">
<div id="dragBox" [hidden]="!isShow">
<div [hidden]="!isShow" id="dragBox">
<div
class="drag-setting"
[hidden]="!isShowSetting || subViews.length > 1"
(click)="onSettingOpenDrawer()"
[hidden]="!isShowSetting || subViews.length > 1"
class="drag-setting"
>
<i class="fa fa-cog"></i>
</div>
<div [hidden]="!chatAiEnabled" class="drag-button">
<img src="assets/icons/robot-assistant.png" alt="" />
<img alt="" src="assets/icons/chat-ai.png"/>
</div>
</div>
<div class="content">
<div *ngIf="chatAiEnabled" class="content">
<iframe
[src]="iframeURL | safeUrl"
title="chat"
height="100%"
title="chat"
width="100%"
></iframe>
</div>
</div>
</div>
</div>
60 changes: 35 additions & 25 deletions src/app/elements/chat/chat.component.scss
@@ -1,7 +1,9 @@
.chat-container {
overflow: hidden;

.content {
height: 100%;

iframe {
border: none;
}
Expand All @@ -12,7 +14,6 @@
position: fixed;
top: 0;
right: 0;
width: 100%;
width: 440px;
min-width: 260px;
height: 100vh;
Expand All @@ -23,11 +24,12 @@
transform: translate(100%);
background: #FFFFFF;
z-index: 120;
opacity: 0.95;
}

#dragBox {
position: absolute;
top: 30%;
bottom: 20%;
left: -48px;
}

Expand All @@ -42,53 +44,65 @@
z-index: 0;
pointer-events: auto;
color: #fff;
background-color: #FFFFFF;
background-color: rgba(88, 88, 88, .8);
box-shadow: 0 0 8px 4px #00000014;
cursor: pointer;

&:hover {
left: -50px !important;
width: 50px !important;
transform: translateZ(0) scale(1.06);
transform-style: preserve-3d;
backface-visibility: hidden;

img {
opacity: 1;
}
}

i {
font-size: 20px;
line-height: 45px;
opacity: 0.8;
}

img {
width: 22px;
height: 22px;
width: 20px;
height: 20px;
transform: translateY(10%);
margin-left: 3px;
opacity: 0.8;
}
}

.drag-setting {
width: 36px;
height: 36px;
line-height: 38px;
margin-bottom: 10px;
margin-bottom: 2px;
text-align: center;
border-radius: 50%;
cursor: pointer;
transform: translateX(20%);
background-color: #FFFFFF;
background-color: rgba(88, 88, 88, .8);
border: 1px solid transparent;
transition: border-color 0.3s ease;
position: relative;

&:hover {
background-color: #f0f1f5;
border-color: #a0a0a0;
.setting-list {
display: block;
transform: translateY(0);
}

i {
opacity: 1;
transform: rotate(45deg);
}
}

i {
font-size: 18px;
color: white;
opacity: 0.8;
}
}

.drag-setting {
position: relative;
transition: all 1s;
.setting-list {
position: absolute;
bottom: 35px;
Expand All @@ -99,6 +113,7 @@
list-style-type: none;
transition: all 0.3s ease;
transform: translateY(100%);

.setting-item {
width: 28px;
height: 28px;
Expand All @@ -108,19 +123,14 @@
margin-bottom: 2px;
overflow: hidden;
background-color: #FFFFFF;

&:hover {
background-color: #f0f1f5;
border-color: #a0a0a0;
}
}
}
&:hover {
.setting-list {
display: block;
transform: translateY(0);
}
}
}
}

.show {
transition: all .3s cubic-bezier(.7, .3, .1, 1);
Expand All @@ -137,4 +147,4 @@

.show .drawer-panel {
transform: translate(0);
}
}
21 changes: 11 additions & 10 deletions src/app/elements/chat/chat.component.ts
@@ -1,5 +1,5 @@
import {OnInit, OnDestroy, Component} from '@angular/core';
import {ViewService, SettingService} from '@app/services';
import {Component, OnDestroy, OnInit} from '@angular/core';
import {SettingService, ViewService} from '@app/services';
import {View} from '@app/model';

@Component({
Expand All @@ -11,13 +11,14 @@ import {View} from '@app/model';
export class ElementChatComponent implements OnInit, OnDestroy {
isShow = true;
element: any;
iframeURL: String;
iframeURL: string;
currentView: View;

constructor(
public viewSrv: ViewService,
public _settingSvc: SettingService
) {}
) {
}

get isShowSetting() {
const connectMethods = ['koko', 'lion', 'tinker', 'panda'];
Expand Down Expand Up @@ -62,7 +63,7 @@ export class ElementChatComponent implements OnInit, OnDestroy {

clientOffset.clientX = event.clientX;
clientOffset.clientY = event.clientY;
document.onmousemove = function(ev: any) {
document.onmousemove = function (ev: any) {
dragBox.style.left = ev.clientX - innerX + 'px';
dragBox.style.top = ev.clientY - innerY + 'px';
const dragDivTop = window.innerHeight - dragBox.getBoundingClientRect().height;
Expand All @@ -78,7 +79,7 @@ export class ElementChatComponent implements OnInit, OnDestroy {
ev.preventDefault();
ev.stopPropagation();
};
document.onmouseup = function() {
document.onmouseup = function () {
document.onmousemove = null;
document.onmouseup = null;
};
Expand All @@ -87,10 +88,10 @@ export class ElementChatComponent implements OnInit, OnDestroy {
const clientX = event.clientX;
const clientY = event.clientY;
if (
this.isDifferenceWithinThreshold(clientX, clientOffset.clientX)
&& this.isDifferenceWithinThreshold(clientY, clientOffset.clientY)
&& (event.target === dragButton || this.isDescendant(event.target, dragButton))
) {
this.isDifferenceWithinThreshold(clientX, clientOffset.clientX)
&& this.isDifferenceWithinThreshold(clientY, clientOffset.clientY)
&& (event.target === dragButton || this.isDescendant(event.target, dragButton))
) {
this.isShow = !this.isShow;
}
});
Expand Down
Expand Up @@ -9,34 +9,40 @@

<div *ngIf="isShowAdvancedOption" class="options-container">
<ng-container *ngFor="let item of advancedOptions">
<div *ngIf="item.type === 'checkbox'" class="option-item">
<mat-checkbox
[(ngModel)]="connectOption[item.field]"
[name]="item.field"
>
{{ item.label | translate }}
</mat-checkbox>
</div>
<ng-container *ngIf="item.type === 'select'">
<mat-form-field class="option-item">
<mat-label>{{ item.label | translate }}</mat-label>
<mat-select [(ngModel)]="connectOption[item.field]" [name]="item.field">
<mat-option *ngFor="let option of item.options" [value]="option.value">
{{ option.label | translate }}
</mat-option>
</mat-select>
</mat-form-field>
</ng-container>
<ng-container *ngIf="item.type === 'radio'">
<div class="option-item">
<mat-radio-group [(ngModel)]="connectOption[item.field]" [name]="item.field">
<mat-label style="margin-right: 10px">{{ item.label | translate }}</mat-label>
<mat-radio-button *ngFor="let option of item.options" [value]="option.value">
{{ option.label | translate }}
</mat-radio-button>
</mat-radio-group>
<span>
<div *ngIf="item.type === 'checkbox'" class="option-item">
<mat-checkbox
(change)="onChange()"
[(ngModel)]="connectOption[item.field]"
[name]="item.field"
>
{{ item.label | translate }}
</mat-checkbox>
</div>
</ng-container>
<ng-container *ngIf="item.type === 'select'">
<mat-form-field class="option-item">
<mat-label>{{ item.label | translate }}</mat-label>
<mat-select (selectionChange)="onChange()" [(ngModel)]="connectOption[item.field]"
[name]="item.field"
>
<mat-option *ngFor="let option of item.options" [value]="option.value">
{{ option.label | translate }}
</mat-option>
</mat-select>
</mat-form-field>
</ng-container>
<ng-container *ngIf="item.type === 'radio'">
<div class="option-item">
<mat-radio-group (change)="onChange()" [(ngModel)]="connectOption[item.field]"
[name]="item.field">
<mat-label style="margin-right: 10px">{{ item.label | translate }}</mat-label>
<mat-radio-button *ngFor="let option of item.options" [value]="option.value">
{{ option.label | translate }}
</mat-radio-button>
</mat-radio-group>
</div>
</ng-container>
</span>
</ng-container>
</div>
</mat-expansion-panel>
Expand Down

0 comments on commit a995ede

Please sign in to comment.