PromucFlow_constructor/app/client/src/ce/actions/applicationActions.ts
Dhruvik Neharia 9d5e2e0246
feat: App navigation - Logo upload (#22297)
## Description

Allowing users to upload a logo to show in the navigation along with
toggles to hide logo or application title.

Fixes #20134
Fixes #21946
Fixes #22260

## Media
<video
src="https://user-images.githubusercontent.com/22471214/235613131-129ac2ed-b994-4eab-8eba-7db297c2f7fd.mp4"><video>

## Type of change
- New feature (non-breaking change which adds functionality)

## How Has This Been Tested?
- Manual

### Test Plan
> https://github.com/appsmithorg/TestSmith/issues/2376

### 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
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


### QA activity:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
2023-05-05 12:19:20 +05:30

230 lines
5.2 KiB
TypeScript

import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";
import type {
AppEmbedSetting,
ApplicationResponsePayload,
UpdateApplicationPayload,
ImportApplicationRequest,
FetchApplicationPayload,
} from "@appsmith/api/ApplicationApi";
import type { NavigationSetting } from "constants/AppConstants";
import type { AppIconName } from "design-system-old";
import type { Datasource } from "entities/Datasource";
export enum ApplicationVersion {
DEFAULT = 1,
SLUG_URL = 2,
}
export const changeAppViewAccessInit = (
applicationId: string,
publicAccess: boolean,
) => {
return {
type: ReduxActionTypes.CHANGE_APPVIEW_ACCESS_INIT,
payload: {
applicationId,
publicAccess,
},
};
};
export const setDefaultApplicationPageSuccess = (
pageId: string,
applicationId: string,
) => {
return {
type: ReduxActionTypes.SET_DEFAULT_APPLICATION_PAGE_SUCCESS,
payload: {
pageId,
applicationId,
},
};
};
export const fetchApplication = (payload: FetchApplicationPayload) => {
return {
type: ReduxActionTypes.FETCH_APPLICATION_INIT,
payload,
};
};
export const updateApplicationLayout = (
id: string,
data: UpdateApplicationPayload,
) => {
return {
type: ReduxActionTypes.UPDATE_APP_LAYOUT,
payload: {
id,
...data,
},
};
};
export const updateApplication = (
id: string,
data: UpdateApplicationPayload,
callback?: () => void,
) => {
return {
type: ReduxActionTypes.UPDATE_APPLICATION,
payload: {
id,
...data,
callback,
},
};
};
export const updateCurrentApplicationIcon = (icon: AppIconName) => {
return {
type: ReduxActionTypes.CURRENT_APPLICATION_ICON_UPDATE,
payload: icon,
};
};
export const updateCurrentApplicationEmbedSetting = (
embedSetting: AppEmbedSetting,
) => {
return {
type: ReduxActionTypes.CURRENT_APPLICATION_EMBED_SETTING_UPDATE,
payload: embedSetting,
};
};
export const updateApplicationNavigationSettingAction = (
navigationSetting: NavigationSetting,
) => {
return {
type: ReduxActionTypes.UPDATE_NAVIGATION_SETTING,
payload: navigationSetting,
};
};
export const updateApplicationNavigationLogoAction = (logo: string) => {
return {
type: ReduxActionTypes.UPLOAD_NAVIGATION_LOGO_INIT,
payload: logo,
};
};
export const updateApplicationNavigationLogoSuccessAction = (
logoAssetId: string,
) => {
return {
type: ReduxActionTypes.UPLOAD_NAVIGATION_LOGO_SUCCESS,
payload: logoAssetId,
};
};
export const deleteApplicationNavigationLogoAction = () => {
return {
type: ReduxActionTypes.DELETE_NAVIGATION_LOGO_INIT,
};
};
export const deleteApplicationNavigationLogoSuccessAction = () => {
return {
type: ReduxActionTypes.DELETE_NAVIGATION_LOGO_SUCCESS,
};
};
export const publishApplication = (applicationId: string) => {
return {
type: ReduxActionTypes.PUBLISH_APPLICATION_INIT,
payload: {
applicationId,
},
};
};
export const duplicateApplication = (applicationId: string) => {
return {
type: ReduxActionTypes.DUPLICATE_APPLICATION_INIT,
payload: {
applicationId,
},
};
};
export const importApplication = (appDetails: ImportApplicationRequest) => {
return {
type: ReduxActionTypes.IMPORT_APPLICATION_INIT,
payload: appDetails,
};
};
export const importApplicationSuccess = (
importedApp: ApplicationResponsePayload,
) => {
return {
type: ReduxActionTypes.IMPORT_APPLICATION_SUCCESS,
payload: importedApp,
};
};
export const getAllApplications = () => {
return {
type: ReduxActionTypes.GET_ALL_APPLICATION_INIT,
};
};
export const resetCurrentApplication = () => {
return {
type: ReduxActionTypes.RESET_CURRENT_APPLICATION,
};
};
export const setShowAppInviteUsersDialog = (payload: boolean) => ({
type: ReduxActionTypes.SET_SHOW_APP_INVITE_USERS_MODAL,
payload,
});
export const initDatasourceConnectionDuringImportRequest = (
payload: string,
) => ({
type: ReduxActionTypes.INIT_DATASOURCE_CONNECTION_DURING_IMPORT_REQUEST,
payload,
});
export const initDatasourceConnectionDuringImportSuccess = () => ({
type: ReduxActionTypes.INIT_DATASOURCE_CONNECTION_DURING_IMPORT_SUCCESS,
});
export const resetDatasourceConfigForImportFetchedFlag = () => ({
type: ReduxActionTypes.RESET_DATASOURCE_CONFIG_FETCHED_FOR_IMPORT_FLAG,
});
export const setIsReconnectingDatasourcesModalOpen = (payload: {
isOpen: boolean;
}) => ({
type: ReduxActionTypes.SET_IS_RECONNECTING_DATASOURCES_MODAL_OPEN,
payload,
});
export const setWorkspaceIdForImport = (workspaceId?: string) => ({
type: ReduxActionTypes.SET_WORKSPACE_ID_FOR_IMPORT,
payload: workspaceId,
});
export const setPageIdForImport = (pageId?: string) => ({
type: ReduxActionTypes.SET_PAGE_ID_FOR_IMPORT,
payload: pageId,
});
// pageId can be used to navigate to a particular page instead of the default one
export const showReconnectDatasourceModal = (payload: {
application: ApplicationResponsePayload;
unConfiguredDatasourceList: Datasource[];
workspaceId: string;
pageId?: string;
}) => ({
type: ReduxActionTypes.SHOW_RECONNECT_DATASOURCE_MODAL,
payload,
});
export const setIsAppSidebarPinned = (payload: boolean) => ({
type: ReduxActionTypes.SET_APP_SIDEBAR_PINNED,
payload,
});