feat: use hideWatermark from tenantConfig (#28085)

## Description

Instead of using the env file to get the value for hideWatermark, we are
moving it to the tenantConfig. Makes it easier to manage and does not
need a server restart while changing the value.

#### PR fixes following issue(s)
Fixes #27922 
https://github.com/appsmithorg/appsmith-ee/pull/2628


#### Type of change
> Please delete options that are not relevant.
- New feature (non-breaking change which adds functionality)
- Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- This change requires a documentation update
>
>
>
## Testing
>
#### How Has This Been Tested?
> Please describe the tests that you ran to verify your changes. Also
list any relevant details for your test configuration.
> Delete anything that is not relevant
- [x] Manual
- [ ] JUnit
- [ ] Jest
- [ ] Cypress
>
>
#### Test Plan
> Add Testsmith test cases links that relate to this PR
>
>
#### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
>
>
>
## Checklist:
#### Dev activity
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
This commit is contained in:
Dipyaman Biswas 2023-10-15 00:04:45 +05:30 committed by GitHub
parent 06542d37d4
commit 6ddcf72efb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 13 additions and 19 deletions

View File

@ -103,8 +103,6 @@ module.exports = {
},
intercomAppID: "APP_ID",
mailEnabled: parseConfig("__APPSMITH_MAIL_ENABLED__"),
hideWatermark: parseConfig("__APPSMITH_HIDE_WATERMARK__"),
disableIframeWidgetSandbox: parseConfig(
"__APPSMITH_DISABLE_IFRAME_WIDGET_SANDBOX__",
),

View File

@ -40,7 +40,6 @@ export interface INJECTED_CONFIGS {
cloudServicesBaseUrl: string;
googleRecaptchaSiteKey: string;
supportEmail: string;
hideWatermark: boolean;
disableIframeWidgetSandbox: boolean;
pricingUrl: string;
customerPortalUrl: string;
@ -107,9 +106,7 @@ export const getConfigsFromEnvVars = (): INJECTED_CONFIGS => {
googleRecaptchaSiteKey:
process.env.REACT_APP_GOOGLE_RECAPTCHA_SITE_KEY || "",
supportEmail: process.env.APPSMITH_SUPPORT_EMAIL || "support@appsmith.com",
hideWatermark: process.env.APPSMITH_HIDE_WATERMARK
? process.env.APPSMITH_HIDE_WATERMARK.length > 0
: false,
disableIframeWidgetSandbox: process.env
.APPSMITH_DISABLE_IFRAME_WIDGET_SANDBOX
? process.env.APPSMITH_DISABLE_IFRAME_WIDGET_SANDBOX.length > 0
@ -261,10 +258,6 @@ export const getAppsmithConfigs = (): AppsmithUIConfigs => {
APPSMITH_FEATURE_CONFIGS?.cloudServicesBaseUrl ||
"",
appsmithSupportEmail: ENV_CONFIG.supportEmail,
hideWatermark:
ENV_CONFIG.hideWatermark ||
APPSMITH_FEATURE_CONFIGS?.hideWatermark ||
false,
disableIframeWidgetSandbox:
ENV_CONFIG.disableIframeWidgetSandbox ||
APPSMITH_FEATURE_CONFIGS?.disableIframeWidgetSandbox ||

View File

@ -60,7 +60,6 @@ export interface AppsmithUIConfigs {
apiKey: string;
};
appsmithSupportEmail: string;
hideWatermark: boolean;
disableIframeWidgetSandbox: boolean;
pricingUrl: string;
customerPortalUrl: string;

View File

@ -4,6 +4,7 @@ export const tenantConfigConnection: string[] = [
"emailVerificationEnabled",
"singleSessionPerUserEnabled",
"showRolesAndGroups",
"hideWatermark",
];
export const RESTART_POLL_TIMEOUT = 2 * 150 * 1000;

View File

@ -73,12 +73,12 @@ export const APPSMITH_DISABLE_TELEMETRY_SETTING: Setting = {
};
export const APPSMITH_HIDE_WATERMARK_SETTING: Setting = {
id: "APPSMITH_HIDE_WATERMARK",
name: "APPSMITH_HIDE_WATERMARK",
id: "hideWatermark",
name: "hideWatermark",
category: SettingCategories.GENERAL,
controlType: SettingTypes.CHECKBOX,
label: "Appsmith watermark",
text: "Show Appsmith watermark",
text: "Hide Appsmith watermark",
isFeatureEnabled: false,
isDisabled: () => true,
textSuffix: <BrandingBadge />,

View File

@ -48,3 +48,6 @@ export const getIsFormLoginEnabled = (state: AppState): boolean =>
export const getInstanceId = (state: AppState): string =>
state.tenant?.instanceId;
export const getHideWatermark = (state: AppState): boolean =>
state.tenant?.tenantConfiguration?.hideWatermark;

View File

@ -16,7 +16,6 @@ import { useHref } from "pages/Editor/utils";
import { APP_MODE } from "entities/App";
import { builderURL, viewerURL } from "@appsmith/RouteBuilder";
import { trimQueryString } from "utils/helpers";
import { getAppsmithConfigs } from "@appsmith/configs";
import type { NavigationSetting } from "constants/AppConstants";
import { NAVIGATION_SETTINGS } from "constants/AppConstants";
import { get } from "lodash";
@ -24,6 +23,7 @@ import { PageMenuContainer, StyledNavLink } from "./PageMenu.styled";
import { StyledCtaContainer } from "./Navigation/Sidebar.styled";
import ShareButton from "./Navigation/components/ShareButton";
import BackToAppsButton from "./Navigation/components/BackToAppsButton";
import { getHideWatermark } from "@appsmith/selectors/tenantSelectors";
interface NavigationProps {
isOpen?: boolean;
@ -41,7 +41,7 @@ export function PageMenu(props: NavigationProps) {
const workspaceID = useSelector(getCurrentWorkspaceId);
const headerHeight = useSelector(getAppViewHeaderHeight);
const [query, setQuery] = useState("");
const { hideWatermark } = getAppsmithConfigs();
const hideWatermark = useSelector(getHideWatermark);
const navColorStyle =
application?.applicationDetail?.navigationSetting?.colorStyle ||
NAVIGATION_SETTINGS.COLOR_STYLE.LIGHT;
@ -147,7 +147,7 @@ export function PageMenu(props: NavigationProps) {
{!hideWatermark && (
<a
className="flex hover:no-underline mt-2"
className="flex mt-2 hover:no-underline"
href="https://appsmith.com"
rel="noreferrer"
target="_blank"

View File

@ -34,7 +34,6 @@ import { getIsBranchUpdated } from "../utils";
import { APP_MODE } from "entities/App";
import { initAppViewer } from "actions/initActions";
import { WidgetGlobaStyles } from "globalStyles/WidgetGlobalStyles";
import { getAppsmithConfigs } from "@appsmith/configs";
import useWidgetFocus from "utils/hooks/useWidgetFocus/useWidgetFocus";
import HtmlTitle from "./AppViewerHtmlTitle";
import BottomBar from "components/BottomBar";
@ -54,6 +53,7 @@ import { showProductRamps } from "@appsmith/selectors/rampSelectors";
import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag";
import { KBViewerFloatingButton } from "@appsmith/pages/AppViewer/KnowledgeBase/KBViewerFloatingButton";
import urlBuilder from "@appsmith/entities/URLRedirect/URLAssembly";
import { getHideWatermark } from "@appsmith/selectors/tenantSelectors";
const AppViewerBody = styled.section<{
hasPages: boolean;
@ -103,7 +103,7 @@ function AppViewer(props: Props) {
const headerHeight = useSelector(getAppViewHeaderHeight);
const branch = getSearchQuery(search, GIT_BRANCH_QUERY_KEY);
const prevValues = usePrevious({ branch, location: props.location, pageId });
const { hideWatermark } = getAppsmithConfigs();
const hideWatermark = useSelector(getHideWatermark);
const pageDescription = useSelector(getCurrentPageDescription);
const currentApplicationDetails: ApplicationPayload | undefined = useSelector(
getCurrentApplication,