updateSettings(SettingsEnum.DOCUMENTATION_LINK, e.target.value)}
style={{ marginBottom: 12 }}
/>
@@ -607,16 +673,16 @@ export function BrandingSetting() {
- {settings.whatsNew && (
+ {brandingConfig?.config_set?.whatsNew && (
{trans("branding.whatsNewLink")}
updateSettings(SettingsEnum.WHATS_NEW_LINK, e.target.value)}
style={{ marginBottom: 12 }}
/>
diff --git a/client/packages/lowcoder/src/pages/setting/environments/Environments.tsx b/client/packages/lowcoder/src/pages/setting/environments/Environments.tsx
index 8ce18a600..61a73fe24 100644
--- a/client/packages/lowcoder/src/pages/setting/environments/Environments.tsx
+++ b/client/packages/lowcoder/src/pages/setting/environments/Environments.tsx
@@ -1,638 +1,3 @@
-import { EmptyContent } from "components/EmptyContent";
-import { HelpText } from "components/HelpText";
-import { Upload, Switch, Card, Input, message, Divider } from "antd";
-import { TacoButton, CustomSelect, messageInstance } from "lowcoder-design";
-import React, { useEffect, useState } from "react";
-import { useDispatch, useSelector } from "react-redux";
-import styled from "styled-components";
-import { trans } from "i18n";
-import { default as ColorPicker } from "antd/es/color-picker";
-import {
- DetailContainer,
- DetailContent,
- Header,
- } from "../theme/styledComponents";
-import { HeaderBack } from "pages/setting/permission/styledComponents";
-import { LoadingOutlined, PlusOutlined } from '@ant-design/icons';
-import type { UploadChangeParam, RcFile } from "antd/es/upload";
-import MaterialApi, { MaterialUploadTypeEnum } from "@lowcoder-ee/api/materialApi";
-import { validateResponse } from "@lowcoder-ee/api/apiUtils";
-import { buildMaterialPreviewURL } from "@lowcoder-ee/util/materialUtils";
-import { getUser } from "@lowcoder-ee/redux/selectors/usersSelectors";
-import { fetchCommonSettings, setCommonSettings } from "@lowcoder-ee/redux/reduxActions/commonSettingsActions";
-import { useShallowEqualSelector } from "@lowcoder-ee/util/hooks";
-import { BrandingSettings } from "@lowcoder-ee/api/commonSettingApi";
-import { getBrandingSettings } from "@lowcoder-ee/redux/selectors/commonSettingSelectors";
-
-const { TextArea } = Input;
-
-enum SettingsEnum {
- LOGO = "logo",
- SQUARE_LOGO = "squareLogo",
- ERROR_PAGE_IMAGE = "errorPageImage",
- LOGOUT_PAGE_IMAGE = "loggedOutPageImage",
- SIGNUP_PAGE_IMAGE = "signUpPageImage",
- MAIN_BRANDING_COLOR = "mainBrandingColor",
- APP_HEADER_COLOR = "appHeaderColor",
- ADMIN_SIDEBAR_COLOR = "adminSidebarColor",
- ADMIN_SIDEBAR_FONT_COLOR = "adminSidebarFontColor",
- ADMIN_SIDEBAR_ACTIVE_BG_COLOR = "adminSidebarActiveBgColor",
- ADMIN_SIDEBAR_ACTIVE_FONT_COLOR = "adminSidebarActiveFontColor",
- EDITOR_SIDEBAR_COLOR = "editorSidebarColor",
- EDITOR_SIDEBAR_FONT_COLOR = "editorSidebarFontColor",
- EDITOR_SIDEBAR_ACTIVE_BG_COLOR = "editorSidebarActiveBgColor",
- EDITOR_SIDEBAR_ACTIVE_FONT_COLOR = "editorSidebarActiveFontColor",
- FONT = "font",
- ERROR_PAGE_TEXT = "errorPageText",
- SIGNUP_PAGE_TEXT = "signUpPageText",
- LOGGED_OUT_PAGE_TEXT = "loggedOutPageText",
- STANDARD_DESCRIPTION = "standardDescription",
- STANDARD_TITLE = "standardTitle",
- SHOW_DOCUMENTATION = "showDocumentation",
- DOCUMENTATION_LINK = "documentationLink",
- SUBMIT_ISSUE = "submitIssue",
- WHATS_NEW = "whatsNew",
- WHATS_NEW_LINK = "whatsNewLink",
-}
-
-const defaultSettings = {
- logo: null,
- squareLogo: null,
- mainBrandingColor: "#FF5733",
- appHeaderColor: "#2c2c2c",
- adminSidebarColor: "#f7f9fc",
- adminSidebarFontColor: "#000000e0",
- adminSidebarActiveBgColor: "#ebf0f7",
- adminSidebarActiveFontColor: "#4965f2",
- editorSidebarColor: "#f4f4f4",
- editorSidebarFontColor: "",
- editorSidebarActiveBgColor: "",
- editorSidebarActiveFontColor: "",
- font: "Roboto",
- errorPageText: "Oops! Something went wrong.",
- errorPageImage: null,
- signUpPageText: "Join us today to explore new opportunities!",
- signUpPageImage: null,
- loggedOutPageText: "You have been logged out successfully.",
- loggedOutPageImage: null,
- standardDescription: "This is a sample description for SEO.",
- standardTitle: "Welcome to Our Application",
- showDocumentation: true,
- documentationLink: null,
- submitIssue: true,
- whatsNew: false,
- whatsNewLink : null,
-};
-
-// type FileType = Parameters
[0] | undefined;
-
-const BrandingSettingContent = styled.div`
- font-size: 14px;
- color: #8b8fa3;
- flex-grow: 1;
- padding-top: 0px;
- padding-left: 0px;
- max-width: 100%;
-`;
-
-const StyleThemeSettingsCover = styled.div`
- display: flex;
- flex-direction: row;
- background: linear-gradient(34deg, rgba(2, 0, 36, 1) 0%, rgba(102, 9, 121, 1) 35%, rgba(0, 255, 181, 1) 100%);
- padding: 15px;
- height: 80px;
- border-radius: 10px 10px 0 0;
-`;
-
-const StyledRectUploadContainer = styled.div`
- .avatar-uploader {
- width: 240px;
- height: 100px;
- display: flex;
- justify-content: center;
- align-items: center;
- border: 1px dashed #d9d9d9;
- border-radius: 8px;
- overflow: hidden;
- }
-
- img {
- width: 240px;
- height: 100px;
- object-fit: cover;
- border-radius: 8px;
- }
-`;
-
-const StyledSquareUploadContainer = styled.div`
- .avatar-uploader {
- width: 100px;
- height: 100px;
- display: flex;
- justify-content: center;
- align-items: center;
- border: 1px dashed #d9d9d9;
- border-radius: 8px;
- overflow: hidden;
- }
-
- img {
- width: 100px;
- height: 100px;
- object-fit: cover;
- border-radius: 8px;
- }
-`;
-
-const getBase64 = (file: File): Promise => {
- return new Promise((resolve, reject) => {
- const reader = new FileReader();
- reader.readAsBinaryString(file); // Read file as base64
-
- reader.onnload = () => resolve(reader.result as string);
- reader.onerror = error => reject(error);
- });
-};
-
-const beforeUpload = (file: RcFile) => {
- const isJpgOrPng = file.type === "image/jpeg" || file.type === "image/png" || file.type === "image/svg+xml";
- if (!isJpgOrPng) {
- message.error("You can only upload JPG/PNG/SVG files!");
- return Upload.LIST_IGNORE;
- }
- const isLt2M = file.size / 1024 / 1024 < 2;
- if (!isLt2M) {
- message.error("Image must be smaller than 2MB!");
- return Upload.LIST_IGNORE;
- }
- return true;
-};
-
export function Environments() {
- const [settings, setSettings] = useState(defaultSettings);
- const [loading, setLoading] = useState({
- [SettingsEnum.LOGO]: false,
- [SettingsEnum.SQUARE_LOGO]: false,
- [SettingsEnum.ERROR_PAGE_IMAGE]: false,
- [SettingsEnum.LOGOUT_PAGE_IMAGE]: false,
- [SettingsEnum.SIGNUP_PAGE_IMAGE]: false,
- });
- const currentUser = useSelector(getUser);
- const dispatch = useDispatch();
- const brandingSettings = useShallowEqualSelector(getBrandingSettings);
-
- useEffect(() => {
- setSettings(brandingSettings ?? defaultSettings);
- }, [brandingSettings]);
-
- useEffect(() => {
- dispatch(fetchCommonSettings({ orgId: currentUser.currentOrgId }));
- }, [currentUser.currentOrgId, dispatch]);
-
- const updateSettings = (key: keyof BrandingSettings, value: any) => {
- setSettings((prev) => ({ ...prev, [key]: value }));
- };
-
- const handleUpload = async (options: any, imageType: keyof BrandingSettings) => {
- const { onSuccess, onError, file } = options;
-
- try {
- setLoading((loading) => ({
- ...loading,
- [imageType]: true,
- }))
- const base64File = await getBase64(file);
- const resp = await MaterialApi.upload(
- file.name,
- MaterialUploadTypeEnum.COMMON,
- btoa(base64File),
- );
- if (validateResponse(resp)) {
- onSuccess(trans("success"));
- updateSettings(imageType, resp.data.data.id);
- return;
- }
- throw new Error("Something went wrong");
- } catch (error: any) {
- onError(error);
- messageInstance.error(trans("home.fileUploadError"));
- } finally {
- setLoading((loading) => ({
- ...loading,
- [imageType]: false,
- }))
- }
- }
-
- const handleSave = () => {
- dispatch(
- setCommonSettings({
- orgId: currentUser.currentOrgId,
- data: {
- key: 'branding',
- value: settings,
- },
- onSuccess: () => {
- messageInstance.success(trans("advanced.saveSuccess"));
- },
- })
- );
- }
-
- const uploadButton = (loading: boolean) => (
-
- {loading ?
:
}
-
Upload
-
- );
-
- return (
-
-
-
- {trans("branding.title")}
-
-
-
-
-
-
- {trans("branding.logoSection")}
-
-
-
-
{trans("branding.logo")}
-
- handleUpload(options, SettingsEnum.LOGO)}
- >
- {Boolean(settings[SettingsEnum.LOGO])
- ?
- : uploadButton(loading[SettingsEnum.LOGO])
- }
-
- {trans("branding.logoHelp")}
-
-
-
-
-
{trans("branding.squareLogo")}
-
- handleUpload(options, SettingsEnum.SQUARE_LOGO)}
- >
- {Boolean(settings[SettingsEnum.SQUARE_LOGO])
- ?
- : uploadButton(loading[SettingsEnum.SQUARE_LOGO])
- }
-
- {trans("branding.squareLogoHelp")}
-
-
-
-
-
-
-
- {trans("branding.colorFontSection")}
-
-
-
-
{trans("branding.mainBrandingColor")}
- node.parentNode}
- value={settings.mainBrandingColor}
- showText
- allowClear
- format="hex"
- onChange={(_, hex) => updateSettings(SettingsEnum.MAIN_BRANDING_COLOR, hex)}
- />
- {trans("branding.mainBrandingColorHelp")}
-
-
-
-
{trans("branding.editorHeaderColor")}
- node.parentNode}
- value={settings.appHeaderColor}
- showText
- allowClear
- format="hex"
- onChange={(_, hex) => updateSettings(SettingsEnum.APP_HEADER_COLOR, hex)}
- />
- {trans("branding.editorHeaderColorHelp")}
-
-
-
-
{trans("branding.adminSidebarColor")}
- node.parentNode}
- value={settings.adminSidebarColor}
- showText
- allowClear
- format="hex"
- onChange={(_, hex) => updateSettings(SettingsEnum.ADMIN_SIDEBAR_COLOR, hex)}
- />
- {trans("branding.adminSidebarColorHelp")}
-
-
-
-
{trans("branding.adminSidebarFontColor")}
- node.parentNode}
- value={settings.adminSidebarFontColor}
- showText
- allowClear
- format="hex"
- onChange={(_, hex) => updateSettings(SettingsEnum.ADMIN_SIDEBAR_FONT_COLOR, hex)}
- />
- {trans("branding.adminSidebarFontColorHelp")}
-
-
-
-
{trans("branding.adminSidebarActiveBgColor")}
- node.parentNode}
- value={settings.adminSidebarActiveBgColor}
- showText
- allowClear
- format="hex"
- onChange={(_, hex) => updateSettings(SettingsEnum.ADMIN_SIDEBAR_ACTIVE_BG_COLOR, hex)}
- />
- {trans("branding.adminSidebarActiveBgColorHelp")}
-
-
-
-
{trans("branding.adminSidebarActiveFontColor")}
- node.parentNode}
- value={settings.adminSidebarActiveFontColor}
- showText
- allowClear
- format="hex"
- onChange={(_, hex) => updateSettings(SettingsEnum.ADMIN_SIDEBAR_ACTIVE_FONT_COLOR, hex)}
- />
- {trans("branding.adminSidebarActiveFontColorHelp")}
-
-
-
-
{trans("branding.editorSidebarColor")}
- node.parentNode}
- value={settings.editorSidebarColor}
- showText
- allowClear
- format="hex"
- onChange={(_, hex) => updateSettings(SettingsEnum.EDITOR_SIDEBAR_COLOR, hex)}
- />
- {trans("branding.editorSidebarColorHelp")}
-
-
-
-
{trans("branding.editorSidebarFontColor")}
- node.parentNode}
- value={settings.editorSidebarFontColor}
- showText
- allowClear
- format="hex"
- onChange={(_, hex) => updateSettings(SettingsEnum.EDITOR_SIDEBAR_FONT_COLOR, hex)}
- />
- {trans("branding.editorSidebarFontColorHelp")}
-
-
-
-
{trans("branding.editorSidebarActiveBgColor")}
- node.parentNode}
- value={settings.editorSidebarActiveBgColor}
- showText
- allowClear
- format="hex"
- onChange={(_, hex) => updateSettings(SettingsEnum.EDITOR_SIDEBAR_ACTIVE_BG_COLOR, hex)}
- />
- {trans("branding.editorSidebarActiveBgColorHelp")}
-
-
-
-
{trans("branding.editorSidebarActiveFontColor")}
- node.parentNode}
- value={settings.editorSidebarActiveFontColor}
- showText
- allowClear
- format="hex"
- onChange={(_, hex) => updateSettings(SettingsEnum.EDITOR_SIDEBAR_ACTIVE_FONT_COLOR, hex)}
- />
- {trans("branding.editorSidebarActiveFontColorHelp")}
-
-
-
-
{trans("branding.font")}
- updateSettings(SettingsEnum.FONT, font)}
- />
- {trans("branding.fontHelp")}
-
-
-
-
-
-
- {trans("branding.textSection")}
-
-
-
-
{trans("branding.errorPage")}
-
-
-
-
{trans("branding.signUpPage")}
-
-
-
-
{trans("branding.loggedOutPage")}
-
-
-
-
{trans("branding.standardDescription")}
-
-
-
-
{trans("branding.standardTitle")}
-
-
-
-
{trans("branding.submitIssue")}
- updateSettings(SettingsEnum.SUBMIT_ISSUE, checked)}
- />
-
-
-
-
-
-
-
- {trans("branding.showDocumentationSection")}
-
-
-
-
-
{trans("branding.showDocumentation")}
- updateSettings(SettingsEnum.SHOW_DOCUMENTATION, checked)}
- />
-
- {settings.showDocumentation && (
-
-
{trans("branding.documentationLink")}
- updateSettings(SettingsEnum.DOCUMENTATION_LINK, e.target.value)}
- style={{ marginBottom: 12 }}
- />
- {trans("branding.documentationLinkHelp")}
-
- )}
-
-
-
-
- {trans("branding.showWhatsNewSection")}
-
-
-
-
-
{trans("branding.whatsNew")}
- updateSettings(SettingsEnum.WHATS_NEW, checked)}
- />
-
- {settings.whatsNew && (
-
-
{trans("branding.whatsNewLink")}
- updateSettings(SettingsEnum.WHATS_NEW_LINK, e.target.value)}
- style={{ marginBottom: 12 }}
- />
- {trans("branding.whatsNewLinkHelp")}
-
- )}
-
-
-
-
- {trans("branding.saveButton")}
-
-
-
- );
+ return <>>;
}
diff --git a/client/packages/lowcoder/src/pages/userAuth/authComponents.tsx b/client/packages/lowcoder/src/pages/userAuth/authComponents.tsx
index 047e6cfc6..4c4b8ed49 100644
--- a/client/packages/lowcoder/src/pages/userAuth/authComponents.tsx
+++ b/client/packages/lowcoder/src/pages/userAuth/authComponents.tsx
@@ -8,10 +8,13 @@ import { StyledLink } from "pages/common/styledComponent";
import { trans } from "i18n";
import { favicon } from "assets/images";
import { Col, Row, Typography } from "antd";
+import { getBrandingSetting } from "@lowcoder-ee/redux/selectors/enterpriseSelectors";
+import { useSelector } from "react-redux";
+import { buildMaterialPreviewURL } from "@lowcoder-ee/util/materialUtils";
-const StyledBrandingColumn = styled(Col)`
+const StyledBrandingColumn = styled(Col)<{$bgImage?: string | null}>`
background-color: rgb(234, 234, 234);
- background-image: url(https://images.unsplash.com/photo-1589810264340-0ce27bfbf751?q=80&w=3387&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D);
+ background-image: url(${props => props.$bgImage});
background-size: cover;
background-repeat: no-repeat;
padding: 28px 36px;
@@ -178,14 +181,19 @@ const BrandingWrapper = (props: {
isEE?: boolean;
children: ReactNode;
}) => {
+ const brandingSettings = useSelector(getBrandingSetting);
+ const brandingImage = buildMaterialPreviewURL(brandingSettings?.config_set?.signUpPageImage || '');
+ const brandingText = brandingSettings?.config_set?.signUpPageText;
+
if (!props.isEE) {
return <>{props.children}>
}
+
return (
-
+
- Join us today to explore new opportunities!
+ {brandingText}
diff --git a/client/packages/lowcoder/src/pages/userAuth/index.tsx b/client/packages/lowcoder/src/pages/userAuth/index.tsx
index d33b48fde..ff8cc4c77 100644
--- a/client/packages/lowcoder/src/pages/userAuth/index.tsx
+++ b/client/packages/lowcoder/src/pages/userAuth/index.tsx
@@ -12,6 +12,7 @@ import { fetchUserAction } from "redux/reduxActions/userActions";
import LoginAdmin from "./loginAdmin";
import _ from "lodash";
import {LoadingBarHideTrigger} from "@lowcoder-ee/util/hideLoading";
+import { fetchBrandingSetting } from "@lowcoder-ee/redux/reduxActions/enterpriseActions";
export default function UserAuth() {
const dispatch = useDispatch();
const location = useLocation();
@@ -29,6 +30,9 @@ export default function UserAuth() {
useEffect(() => {
if(organizationId) {
dispatch(fetchConfigAction(organizationId));
+ dispatch(fetchBrandingSetting({orgId: organizationId}));
+ } else {
+ dispatch(fetchBrandingSetting({orgId: ''}));
}
}, [organizationId, dispatch])
diff --git a/client/packages/lowcoder/src/pages/userAuth/login.tsx b/client/packages/lowcoder/src/pages/userAuth/login.tsx
index bad534909..acc36e234 100644
--- a/client/packages/lowcoder/src/pages/userAuth/login.tsx
+++ b/client/packages/lowcoder/src/pages/userAuth/login.tsx
@@ -10,6 +10,7 @@ import { AuthContext, getLoginTitle } from "pages/userAuth/authUtils";
import styled from "styled-components";
import { requiresUnAuth } from "pages/userAuth/authHOC";
import FormLoginSteps from "./formLoginSteps";
+import { useEnterpriseContext } from "@lowcoder-ee/util/context/EnterpriseContext";
const ThirdAuthWrapper = styled.div`
display: flex;
@@ -85,6 +86,7 @@ export const ThirdPartyBindCard = () => {
// this is the classic Sign In
function Login() {
const { inviteInfo, systemConfig, thirdPartyAuthError } = useContext(AuthContext);
+ const { isEnterpriseActive } = useEnterpriseContext();
const invitationId = inviteInfo?.invitationId;
const location = useLocation();
const queryParams = new URLSearchParams(location.search);
@@ -143,6 +145,7 @@ function Login() {
diff --git a/client/packages/lowcoder/src/pages/userAuth/register.tsx b/client/packages/lowcoder/src/pages/userAuth/register.tsx
index 62bd7f7c2..ac85354fe 100644
--- a/client/packages/lowcoder/src/pages/userAuth/register.tsx
+++ b/client/packages/lowcoder/src/pages/userAuth/register.tsx
@@ -28,6 +28,7 @@ import LoadingOutlined from "@ant-design/icons/LoadingOutlined";
import Spin from "antd/es/spin";
import { useSelector } from "react-redux";
import { getServerSettings } from "@lowcoder-ee/redux/selectors/applicationSelector";
+import { useEnterpriseContext } from "@lowcoder-ee/util/context/EnterpriseContext";
const StyledFormInput = styled(FormInput)`
margin-bottom: 16px;
@@ -55,6 +56,7 @@ function UserRegister() {
const [lastEmailChecked, setLastEmailChecked] = useState("");
const redirectUrl = useRedirectUrl();
const { systemConfig, inviteInfo, fetchUserAfterAuthSuccess } = useContext(AuthContext);
+ const { isEnterpriseActive } = useEnterpriseContext();
const invitationId = inviteInfo?.invitationId;
const orgId = useParams().orgId;
@@ -130,6 +132,7 @@ function UserRegister() {
heading={registerHeading}
subHeading={registerSubHeading}
type="large"
+ isEE={isEnterpriseActive}
>
;
- }
+ enterprise: EnterpriseLicenseResponse,
+ globalBranding?: BrandingConfig,
+ workspaceBranding?: BrandingConfig,
+}
- const initialState: EnterpriseReduxState = {
+const initialState: EnterpriseReduxState = {
+ enterprise: {
eeActive: false,
remainingAPICalls: 0,
eeLicenses: [],
- };
-
- const enterpriseReducer = (state = initialState, action: ReduxAction): EnterpriseReduxState => {
- switch (action.type) {
- case ReduxActionTypes.SET_ENTERPRISE_LICENSE:
- return {
- ...state,
- ...action.payload,
- };
- default:
- return state;
- }
- };
-
- export default enterpriseReducer;
-
+ }
+};
+
+const enterpriseReducer = createReducer(initialState, {
+ [ReduxActionTypes.SET_ENTERPRISE_LICENSE]: (
+ state: EnterpriseReduxState,
+ action: ReduxAction
+ ) => ({
+ ...state,
+ enterprise: action.payload,
+ }),
+ [ReduxActionTypes.SET_GLOBAL_BRANDING_SETTING]: (
+ state: EnterpriseReduxState,
+ action: ReduxAction
+ ) => ({
+ ...state,
+ globalBranding: action.payload,
+ }),
+ [ReduxActionTypes.SET_WORKSPACE_BRANDING_SETTING]: (
+ state: EnterpriseReduxState,
+ action: ReduxAction
+ ) => ({
+ ...state,
+ workspaceBranding: action.payload,
+ }),
+});
+
+export default enterpriseReducer;
diff --git a/client/packages/lowcoder/src/redux/reduxActions/enterpriseActions.ts b/client/packages/lowcoder/src/redux/reduxActions/enterpriseActions.ts
index 00545bc5d..85e2b9b19 100644
--- a/client/packages/lowcoder/src/redux/reduxActions/enterpriseActions.ts
+++ b/client/packages/lowcoder/src/redux/reduxActions/enterpriseActions.ts
@@ -1,20 +1,18 @@
+import { EnterpriseLicenseResponse, FetchBrandingSettingPayload } from "@lowcoder-ee/api/enterpriseApi";
import { ReduxActionTypes } from "constants/reduxActionConstants";
export const fetchEnterpriseLicense = () => ({
- type: ReduxActionTypes.FETCH_ENTERPRISE_LICENSE,
- });
-
-interface EnterpriseLicenseResponse {
- eeActive: boolean;
- remainingAPICalls: number;
- eeLicenses: Array<{
- uuid: string;
- issuedTo: string;
- apiCallsLimit: number;
- }>;
-}
+ type: ReduxActionTypes.FETCH_ENTERPRISE_LICENSE,
+});
export const setEnterpriseLicense = (licenseData: EnterpriseLicenseResponse) => ({
- type: ReduxActionTypes.SET_ENTERPRISE_LICENSE,
- payload: licenseData,
-});
\ No newline at end of file
+ type: ReduxActionTypes.SET_ENTERPRISE_LICENSE,
+ payload: licenseData,
+});
+
+export const fetchBrandingSetting = (payload: FetchBrandingSettingPayload) => {
+ return {
+ type: ReduxActionTypes.FETCH_BRANDING_SETTING,
+ payload,
+ };
+};
diff --git a/client/packages/lowcoder/src/redux/sagas/enterpriseSagas.ts b/client/packages/lowcoder/src/redux/sagas/enterpriseSagas.ts
index 7b2260ccf..f2ddab998 100644
--- a/client/packages/lowcoder/src/redux/sagas/enterpriseSagas.ts
+++ b/client/packages/lowcoder/src/redux/sagas/enterpriseSagas.ts
@@ -1,29 +1,41 @@
import { call, put, takeLatest } from 'redux-saga/effects';
-import { ReduxActionTypes } from "constants/reduxActionConstants";
+import { ReduxAction, ReduxActionTypes } from "constants/reduxActionConstants";
import { setEnterpriseLicense } from "redux/reduxActions/enterpriseActions";
-import { getEnterpriseLicense } from "api/enterpriseApi";
+import { BrandingSettingResponse, EnterpriseLicenseResponse, FetchBrandingSettingPayload, getBranding, getEnterpriseLicense } from "api/enterpriseApi";
+import { AxiosResponse } from 'axios';
-// Define the type of data returned by the API
-interface EnterpriseLicenseResponse {
- eeActive: boolean;
- remainingAPICalls: number;
- eeLicenses: Array<{
- uuid: string;
- issuedTo: string;
- apiCallsLimit: number;
- }>;
+function* fetchEnterpriseLicenseSaga(): Generator {
+ try {
+ // Type the result from the API call
+ const data: EnterpriseLicenseResponse = yield call(getEnterpriseLicense);
+ yield put(setEnterpriseLicense(data));
+ } catch (error) {
+ console.error('Failed to fetch enterprise license:', error);
+ }
}
-function* fetchEnterpriseLicenseSaga(): Generator {
- try {
- // Type the result from the API call
- const data: EnterpriseLicenseResponse = yield call(getEnterpriseLicense);
- yield put(setEnterpriseLicense(data));
- } catch (error) {
- console.error('Failed to fetch enterprise license:', error);
+function* fetchBrandingSettingSaga(action: ReduxAction) {
+ try {
+ const response: BrandingSettingResponse = yield getBranding(action.payload.orgId);
+ if (response && response.id) {
+ if (action.payload.orgId) {
+ yield put({
+ type: ReduxActionTypes.SET_WORKSPACE_BRANDING_SETTING,
+ payload: response,
+ });
+ return;
+ }
+ yield put({
+ type: ReduxActionTypes.SET_GLOBAL_BRANDING_SETTING,
+ payload: response,
+ });
}
+ } catch (error) {
+ console.error('Failed to fetch branding setting:', error);
+ }
}
export default function* enterpriseSagas() {
- yield takeLatest(ReduxActionTypes.FETCH_ENTERPRISE_LICENSE, fetchEnterpriseLicenseSaga);
+ yield takeLatest(ReduxActionTypes.FETCH_ENTERPRISE_LICENSE, fetchEnterpriseLicenseSaga);
+ yield takeLatest(ReduxActionTypes.FETCH_BRANDING_SETTING, fetchBrandingSettingSaga);
}
diff --git a/client/packages/lowcoder/src/redux/selectors/commonSettingSelectors.ts b/client/packages/lowcoder/src/redux/selectors/commonSettingSelectors.ts
index 35243aa37..1f0ee4645 100644
--- a/client/packages/lowcoder/src/redux/selectors/commonSettingSelectors.ts
+++ b/client/packages/lowcoder/src/redux/selectors/commonSettingSelectors.ts
@@ -27,7 +27,3 @@ export const getDefaultTheme = (state: AppState) => {
export const getDefaultHomePage = (state: AppState) => {
return state.ui.commonSettings.settings.defaultHomePage;
};
-
-export const getBrandingSettings = (state: AppState) => {
- return state.ui.commonSettings.settings.branding;
-}
diff --git a/client/packages/lowcoder/src/redux/selectors/enterpriseSelectors.ts b/client/packages/lowcoder/src/redux/selectors/enterpriseSelectors.ts
index 3000f2f48..485036e75 100644
--- a/client/packages/lowcoder/src/redux/selectors/enterpriseSelectors.ts
+++ b/client/packages/lowcoder/src/redux/selectors/enterpriseSelectors.ts
@@ -1,15 +1,27 @@
import { AppState } from "../reducers";
export const selectEnterpriseEditionStatus = (state: AppState) =>
- state.ui.enterprise?.eeActive ?? false;
+ state.ui.enterprise?.enterprise?.eeActive ?? false;
export const selectRemainingAPICalls = (state: AppState) =>
- state.ui.enterprise?.remainingAPICalls ?? 0;
+ state.ui.enterprise?.enterprise?.remainingAPICalls ?? 0;
export const selectEnterpriseLicenses = (state: AppState) =>
- state.ui.enterprise?.eeLicenses ?? [];
+ state.ui.enterprise?.enterprise?.eeLicenses ?? [];
export const selectIsLicenseActive = (state: AppState) => {
- const enterprise = state.ui.enterprise;
- return enterprise?.eeActive && enterprise?.remainingAPICalls > 0;
+ const enterprise = state.ui.enterprise;
+ return enterprise?.enterprise?.eeActive && enterprise?.enterprise?.remainingAPICalls > 0;
};
+
+export const getBrandingSetting = (state: AppState) => {
+ return state.ui.enterprise?.workspaceBranding || state.ui.enterprise?.globalBranding;
+}
+
+export const getGlobalBrandingSetting = (state: AppState) => {
+ return state.ui.enterprise?.globalBranding;
+}
+
+export const getWorkspaceBrandingSetting = (state: AppState) => {
+ return state.ui.enterprise?.workspaceBranding;
+}
--- a PPN by Garber Painting Akron. With Image Size Reduction included!Fetched URL: http://github.com/lowcoder-org/lowcoder/pull/1494.diff
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy