From e60eb83c93cc3973a7db12410cbc9419440059b9 Mon Sep 17 00:00:00 2001
From: Michael An <2331806369@qq.com>
Date: Mon, 17 Mar 2025 11:17:22 +0800
Subject: [PATCH] Add repo setting tip when disable Metadata (#7623)
* Add repo setting tip when disable Metadata
* can not use button when disable metadata
---
.../components/dialog/image-dialog/index.js | 1 -
.../src/components/dialog/lib-settings.js | 132 ++++++++++++------
frontend/src/components/switch/index.css | 9 +-
frontend/src/components/switch/index.js | 2 +-
.../metadata-face-recognition-dialog/index.js | 8 +-
.../index.js | 8 +-
.../metadata-tags-status-dialog/index.js | 8 +-
7 files changed, 113 insertions(+), 55 deletions(-)
diff --git a/frontend/src/components/dialog/image-dialog/index.js b/frontend/src/components/dialog/image-dialog/index.js
index 710fa44fba..e36e3c674d 100644
--- a/frontend/src/components/dialog/image-dialog/index.js
+++ b/frontend/src/components/dialog/image-dialog/index.js
@@ -5,7 +5,6 @@ import Lightbox from '@seafile/react-image-lightbox';
import { useMetadataAIOperations } from '../../../hooks/metadata-ai-operation';
import EmbeddedFileDetails from '../../dirent-detail/embedded-file-details';
import { SYSTEM_FOLDERS } from '../../../constants';
-import { Utils } from '../../../utils/utils';
import Icon from '../../icon';
import '@seafile/react-image-lightbox/style.css';
diff --git a/frontend/src/components/dialog/lib-settings.js b/frontend/src/components/dialog/lib-settings.js
index bc2b3e53c7..261622ae20 100644
--- a/frontend/src/components/dialog/lib-settings.js
+++ b/frontend/src/components/dialog/lib-settings.js
@@ -51,7 +51,6 @@ const LibSettingsDialog = ({ repoID, currentRepoInfo, toggleDialog, tab }) => {
const enableHistorySetting = is_admin; // repo owner, admin of the department which the repo belongs to, and ...
const enableAutoDelSetting = is_admin && enableRepoAutoDel;
const enableExtendedPropertiesSetting = !encrypted && is_admin && enableMetadataManagement;
- const enableMetadataOtherSettings = enableExtendedPropertiesSetting && enableMetadata;
return (
@@ -63,48 +62,98 @@ const LibSettingsDialog = ({ repoID, currentRepoInfo, toggleDialog, tab }) => {
@@ -134,17 +183,18 @@ const LibSettingsDialog = ({ repoID, currentRepoInfo, toggleDialog, tab }) => {
/>
)}
- {(enableMetadataOtherSettings && activeTab === TAB.FACE_RECOGNITION_SETTING) && (
+ {(enableExtendedPropertiesSetting && activeTab === TAB.FACE_RECOGNITION_SETTING) && (
)}
- {(enableMetadataOtherSettings && activeTab === TAB.TAGS_SETTING) && (
+ {(enableExtendedPropertiesSetting && activeTab === TAB.TAGS_SETTING) && (
{
lang={tagsLang}
submit={updateEnableTags}
toggleDialog={toggleDialog}
+ enableMetadata={enableMetadata}
/>
)}
- {(enableMetadataOtherSettings && activeTab === TAB.OCR_SETTING) && (
+ {(enableExtendedPropertiesSetting && activeTab === TAB.OCR_SETTING) && (
{
lang={tagsLang}
submit={updateEnableOCR}
toggleDialog={toggleDialog}
+ enableMetadata={enableMetadata}
/>
)}
diff --git a/frontend/src/components/switch/index.css b/frontend/src/components/switch/index.css
index 6bf17c2b39..e88d6284e6 100644
--- a/frontend/src/components/switch/index.css
+++ b/frontend/src/components/switch/index.css
@@ -9,10 +9,6 @@
cursor: pointer;
}
-.seahub-switch.small .custom-switch-indicator.disabled {
- cursor: default;
-}
-
.seahub-switch.small .custom-switch-indicator:before {
height: 8px;
width: 8px;
@@ -21,3 +17,8 @@
.seahub-switch.small .custom-switch-input:checked~.custom-switch-indicator:before {
left: 12px;
}
+
+.seahub-switch.disabled .custom-switch,
+.seahub-switch .custom-switch-indicator.disabled {
+ cursor: not-allowed;
+}
diff --git a/frontend/src/components/switch/index.js b/frontend/src/components/switch/index.js
index 499e33b7fb..9d02f65f3a 100644
--- a/frontend/src/components/switch/index.js
+++ b/frontend/src/components/switch/index.js
@@ -6,7 +6,7 @@ import './index.css';
function Switch({ onChange, checked, placeholder, disabled, className, size, textPosition = 'left', setRef }) {
return (
-
+