Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"Device": "Device",
"Player": "Player",
"Windows": "Windows",
"DirectoryService": "Directory Service",
"Resource": "Resource",
"Database": "Database",
"OfflinePlayer": "Offline Player",
Expand Down
1 change: 1 addition & 0 deletions i18n/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"Resource": "资源目录",
"Linux": "Linux",
"Windows": "Windows",
"DirectoryService": "目录服务",
"Database": "数据库",
"Device": "设备",
"Other": "其他",
Expand Down
5 changes: 4 additions & 1 deletion src-tauri/src/service/asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ pub enum Category {
#[default]
Linux,
Windows,
#[serde(rename = "windows_ad")]
WindowsAd,
Database,
Device,
}
Expand Down Expand Up @@ -41,7 +43,7 @@ impl AssetQuery {
pub fn new(asset_type: Category, org: String) -> Self {
let (r#type, category) = match asset_type {
Category::Database | Category::Device => (None, Some(asset_type)),
Category::Linux | Category::Windows => (Some(asset_type), None),
Category::Linux | Category::Windows | Category::WindowsAd => (Some(asset_type), None),
};

Self {
Expand Down Expand Up @@ -110,6 +112,7 @@ impl AssetService {
match self.query.get_category() {
Category::Linux => (Some(Category::Linux), None),
Category::Windows => (Some(Category::Windows), None),
Category::WindowsAd => (Some(Category::WindowsAd), None),
Category::Database => (None, Some(Category::Database)),
Category::Device => (None, Some(Category::Device)),
}
Expand Down
3 changes: 2 additions & 1 deletion src-tauri/src/service/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::commands::requests::{get_with_response, post_with_response, ApiRespon
use std::collections::HashMap;
use url::Url;
use serde::{Deserialize, Serialize};
use serde_json::to_value;
use serde_json::{to_value, Value};

#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct TokenRequestBody {
Expand All @@ -12,6 +12,7 @@ pub struct TokenRequestBody {
pub input_username: String,
pub input_secret: String,
pub connect_method: String,
pub connect_options: Option<Value>,
}

pub struct TokenService {
Expand Down
36 changes: 35 additions & 1 deletion ui/components/BasePage/basePage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { AssetItem, AssetPageType, CharsetType, LayoutsType, ResolutionType
import SkeletonCard from "~/components/Card/GridCard/skeletonCard.vue";

import ConnectionEditor from "~/components/ConnectionEditor/connectionEditor.vue";
import { useSettingStorage } from "~/composables/useSettingStorage";
import { useUserInfoStore } from "~/store/modules/userInfo";

const props = defineProps<{
Expand All @@ -25,7 +26,17 @@ const contextMenu = useContextMenu();
const userInfoStore = useUserInfoStore();
const assetManagement = useAssetManagement();
const settingManager = useSettingManager();
const { layouts } = settingManager;
const { defaults: settingDefaults } = useSettingStorage();
const {
layouts,
charset,
rdpResolution,
backspaceAsCtrlH,
keyboardLayout,
rdpClientOption,
rdpColorQuality,
rdpSmartSize
} = settingManager;
const {
setCharsetPreference,
setRdpResolutionPreference,
Expand All @@ -46,6 +57,27 @@ const { visibleAssets } = useDisplayAssets(
computed(() => props.platform)
);

const isSameArray = (left?: string[], right?: string[]) => {
const l = Array.isArray(left) ? left : [];
const r = Array.isArray(right) ? right : [];
if (l.length !== r.length) return false;
const ls = [...l].sort();
const rs = [...r].sort();
return ls.every((item, idx) => item === rs[idx]);
};

const isUsingLocalDefaults = () => {
return (
(charset.value || settingDefaults.charset) === settingDefaults.charset
&& (rdpResolution.value || settingDefaults.rdpResolution) === settingDefaults.rdpResolution
&& (backspaceAsCtrlH.value ?? settingDefaults.backspaceAsCtrlH) === settingDefaults.backspaceAsCtrlH
&& (keyboardLayout.value || settingDefaults.keyboardLayout) === settingDefaults.keyboardLayout
&& isSameArray(rdpClientOption.value, settingDefaults.rdpClientOption)
&& (rdpColorQuality.value || settingDefaults.rdpColorQuality) === settingDefaults.rdpColorQuality
&& (rdpSmartSize.value || settingDefaults.rdpSmartSize) === settingDefaults.rdpSmartSize
);
};

watch(
() => loggedIn.value,
async (nv: boolean) => {
Expand Down Expand Up @@ -165,6 +197,8 @@ const listenTauriEvent = async () => {

userInfoStore.setRdpClientOption(settingConfig.graphics);

if (!isUsingLocalDefaults()) return;

setCharsetPreference((settingConfig.command_line?.charset as CharsetType) || "default");
setBackspacePreference(!!settingConfig.command_line?.is_backspace_as_ctrl_h);
setRdpResolutionPreference((settingConfig.graphics?.rdp_resolution as ResolutionType) || "auto");
Expand Down
3 changes: 2 additions & 1 deletion ui/components/Card/AssetIcon/assetIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ const imageProps = computed(() => {
redis: "/icons/redis.png",
mongodb: "/icons/mongodb.png",
dameng: "/icons/dameng.png",
clickhouse: "/icons/clickhouse.png"
clickhouse: "/icons/clickhouse.png",
windows_ad: "/icons/windows.png"
};

const src = iconMap[props.type] || "";
Expand Down
6 changes: 6 additions & 0 deletions ui/components/SideBar/sideBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ const sideBarItems = computed<NavigationMenuItem[]>(() => {
to: localePath("windows"),
disabled: isLoading.value
},
{
label: t("Menu.DirectoryService"),
icon: "lucide:folder-tree",
to: localePath("windows_ad"),
disabled: isLoading.value
},
{
label: t("Menu.Database"),
icon: "gravity-ui:database",
Expand Down
7 changes: 7 additions & 0 deletions ui/composables/useAssetFetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ export const useAssetFetcher = (assetType: AssetPageType, scrollRef?: Ref<HTMLEl
return /\/linux(?:\/|$)/.test(pathLower);
case "windows":
return /\/windows(?:\/|$)/.test(pathLower);
case "windows_ad":
return /\/windows_ad(?:\/|$)/.test(pathLower);
case "database":
return /\/database(?:\/|$)/.test(pathLower);
case "device":
Expand Down Expand Up @@ -207,6 +209,11 @@ export const useAssetFetcher = (assetType: AssetPageType, scrollRef?: Ref<HTMLEl
const typeValue = it.type?.value?.toLowerCase();
return typeValue === "windows";
});
case "windows_ad":
return items.filter((it) => {
const typeValue = it.type?.value?.toLowerCase();
return typeValue === "windows_ad";
});
case "database":
return items.filter((it) => {
const typeValue = it.category?.value?.toLowerCase();
Expand Down
5 changes: 5 additions & 0 deletions ui/pages/windows_ad.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script setup lang="ts"></script>

<template>
<BasePage type="windows_ad" icon-name="lucide:folder-tree" />
</template>
2 changes: 1 addition & 1 deletion ui/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export type LangType = "zh" | "en";
export type LanguagePreference = LangType | "system";
export type CharsetType = "default" | "utf8" | "gbk" | "gb2312" | "ios-8859-1";
export type ResolutionType = "auto" | "1024x768" | "1366x768" | "1600x900" | "1920x1080";
export type AssetPageType = "linux" | "windows" | "database" | "device" | "favorite";
export type AssetPageType = "linux" | "windows" | "windows_ad" | "database" | "device" | "favorite";

export interface ActionItem {
key: string
Expand Down