Skip to content

Commit 44f9f27

Browse files
committed
perf:New directory service menu
1 parent b7905b5 commit 44f9f27

File tree

10 files changed

+64
-5
lines changed

10 files changed

+64
-5
lines changed

i18n/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"Device": "Device",
5656
"Player": "Player",
5757
"Windows": "Windows",
58+
"DirectoryService": "Directory Service",
5859
"Resource": "Resource",
5960
"Database": "Database",
6061
"OfflinePlayer": "Offline Player",

i18n/locales/zh.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"Resource": "资源目录",
5454
"Linux": "Linux",
5555
"Windows": "Windows",
56+
"DirectoryService": "目录服务",
5657
"Database": "数据库",
5758
"Device": "设备",
5859
"Other": "其他",

src-tauri/src/service/asset.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ pub enum Category {
99
#[default]
1010
Linux,
1111
Windows,
12+
#[serde(rename = "windows_ad")]
13+
WindowsAd,
1214
Database,
1315
Device,
1416
}
@@ -41,7 +43,7 @@ impl AssetQuery {
4143
pub fn new(asset_type: Category, org: String) -> Self {
4244
let (r#type, category) = match asset_type {
4345
Category::Database | Category::Device => (None, Some(asset_type)),
44-
Category::Linux | Category::Windows => (Some(asset_type), None),
46+
Category::Linux | Category::Windows | Category::WindowsAd => (Some(asset_type), None),
4547
};
4648

4749
Self {
@@ -110,6 +112,7 @@ impl AssetService {
110112
match self.query.get_category() {
111113
Category::Linux => (Some(Category::Linux), None),
112114
Category::Windows => (Some(Category::Windows), None),
115+
Category::WindowsAd => (Some(Category::WindowsAd), None),
113116
Category::Database => (None, Some(Category::Database)),
114117
Category::Device => (None, Some(Category::Device)),
115118
}

src-tauri/src/service/token.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::commands::requests::{get_with_response, post_with_response, ApiRespon
22
use std::collections::HashMap;
33
use url::Url;
44
use serde::{Deserialize, Serialize};
5-
use serde_json::to_value;
5+
use serde_json::{to_value, Value};
66

77
#[derive(Debug, Serialize, Deserialize, Clone)]
88
pub struct TokenRequestBody {
@@ -12,6 +12,7 @@ pub struct TokenRequestBody {
1212
pub input_username: String,
1313
pub input_secret: String,
1414
pub connect_method: String,
15+
pub connect_options: Option<Value>,
1516
}
1617

1718
pub struct TokenService {

ui/components/BasePage/basePage.vue

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { AssetItem, AssetPageType, CharsetType, LayoutsType, ResolutionType
55
import SkeletonCard from "~/components/Card/GridCard/skeletonCard.vue";
66
77
import ConnectionEditor from "~/components/ConnectionEditor/connectionEditor.vue";
8+
import { useSettingStorage } from "~/composables/useSettingStorage";
89
import { useUserInfoStore } from "~/store/modules/userInfo";
910
1011
const props = defineProps<{
@@ -25,7 +26,17 @@ const contextMenu = useContextMenu();
2526
const userInfoStore = useUserInfoStore();
2627
const assetManagement = useAssetManagement();
2728
const settingManager = useSettingManager();
28-
const { layouts } = settingManager;
29+
const { defaults: settingDefaults } = useSettingStorage();
30+
const {
31+
layouts,
32+
charset,
33+
rdpResolution,
34+
backspaceAsCtrlH,
35+
keyboardLayout,
36+
rdpClientOption,
37+
rdpColorQuality,
38+
rdpSmartSize
39+
} = settingManager;
2940
const {
3041
setCharsetPreference,
3142
setRdpResolutionPreference,
@@ -46,6 +57,27 @@ const { visibleAssets } = useDisplayAssets(
4657
computed(() => props.platform)
4758
);
4859
60+
const isSameArray = (left?: string[], right?: string[]) => {
61+
const l = Array.isArray(left) ? left : [];
62+
const r = Array.isArray(right) ? right : [];
63+
if (l.length !== r.length) return false;
64+
const ls = [...l].sort();
65+
const rs = [...r].sort();
66+
return ls.every((item, idx) => item === rs[idx]);
67+
};
68+
69+
const isUsingLocalDefaults = () => {
70+
return (
71+
(charset.value || settingDefaults.charset) === settingDefaults.charset
72+
&& (rdpResolution.value || settingDefaults.rdpResolution) === settingDefaults.rdpResolution
73+
&& (backspaceAsCtrlH.value ?? settingDefaults.backspaceAsCtrlH) === settingDefaults.backspaceAsCtrlH
74+
&& (keyboardLayout.value || settingDefaults.keyboardLayout) === settingDefaults.keyboardLayout
75+
&& isSameArray(rdpClientOption.value, settingDefaults.rdpClientOption)
76+
&& (rdpColorQuality.value || settingDefaults.rdpColorQuality) === settingDefaults.rdpColorQuality
77+
&& (rdpSmartSize.value || settingDefaults.rdpSmartSize) === settingDefaults.rdpSmartSize
78+
);
79+
};
80+
4981
watch(
5082
() => loggedIn.value,
5183
async (nv: boolean) => {
@@ -165,6 +197,8 @@ const listenTauriEvent = async () => {
165197
166198
userInfoStore.setRdpClientOption(settingConfig.graphics);
167199
200+
if (!isUsingLocalDefaults()) return;
201+
168202
setCharsetPreference((settingConfig.command_line?.charset as CharsetType) || "default");
169203
setBackspacePreference(!!settingConfig.command_line?.is_backspace_as_ctrl_h);
170204
setRdpResolutionPreference((settingConfig.graphics?.rdp_resolution as ResolutionType) || "auto");

ui/components/Card/AssetIcon/assetIcon.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ const imageProps = computed(() => {
2424
redis: "/icons/redis.png",
2525
mongodb: "/icons/mongodb.png",
2626
dameng: "/icons/dameng.png",
27-
clickhouse: "/icons/clickhouse.png"
27+
clickhouse: "/icons/clickhouse.png",
28+
windows_ad: "/icons/windows.png"
2829
};
2930
3031
const src = iconMap[props.type] || "";

ui/components/SideBar/sideBar.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ const sideBarItems = computed<NavigationMenuItem[]>(() => {
3333
to: localePath("windows"),
3434
disabled: isLoading.value
3535
},
36+
{
37+
label: t("Menu.DirectoryService"),
38+
icon: "lucide:folder-tree",
39+
to: localePath("windows_ad"),
40+
disabled: isLoading.value
41+
},
3642
{
3743
label: t("Menu.Database"),
3844
icon: "gravity-ui:database",

ui/composables/useAssetFetcher.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ export const useAssetFetcher = (assetType: AssetPageType, scrollRef?: Ref<HTMLEl
180180
return /\/linux(?:\/|$)/.test(pathLower);
181181
case "windows":
182182
return /\/windows(?:\/|$)/.test(pathLower);
183+
case "windows_ad":
184+
return /\/windows_ad(?:\/|$)/.test(pathLower);
183185
case "database":
184186
return /\/database(?:\/|$)/.test(pathLower);
185187
case "device":
@@ -207,6 +209,11 @@ export const useAssetFetcher = (assetType: AssetPageType, scrollRef?: Ref<HTMLEl
207209
const typeValue = it.type?.value?.toLowerCase();
208210
return typeValue === "windows";
209211
});
212+
case "windows_ad":
213+
return items.filter((it) => {
214+
const typeValue = it.type?.value?.toLowerCase();
215+
return typeValue === "windows_ad";
216+
});
210217
case "database":
211218
return items.filter((it) => {
212219
const typeValue = it.category?.value?.toLowerCase();

ui/pages/windows_ad.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<script setup lang="ts"></script>
2+
3+
<template>
4+
<BasePage type="windows_ad" icon-name="lucide:folder-tree" />
5+
</template>

ui/types/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export type LangType = "zh" | "en";
88
export type LanguagePreference = LangType | "system";
99
export type CharsetType = "default" | "utf8" | "gbk" | "gb2312" | "ios-8859-1";
1010
export type ResolutionType = "auto" | "1024x768" | "1366x768" | "1600x900" | "1920x1080";
11-
export type AssetPageType = "linux" | "windows" | "database" | "device" | "favorite";
11+
export type AssetPageType = "linux" | "windows" | "windows_ad" | "database" | "device" | "favorite";
1212

1313
export interface ActionItem {
1414
key: string

0 commit comments

Comments
 (0)