feat: Add Option to export app in Navigation Menu (#6913)

Now the user will be able to export applications inside the editor also. Added Option in Navigation Header.
This commit is contained in:
Rishabh Rathod 2021-08-27 12:49:21 +05:30 committed by GitHub
parent 1109ecb37f
commit 1d63add091
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 1 deletions

View File

@ -29,3 +29,6 @@ export const GithubOAuthURL = `${OAuthURL}/github`;
export const LOGIN_SUBMIT_PATH = "login";
export const SIGNUP_SUBMIT_PATH = "users";
export const getExportAppAPIRoute = (applicationId: string) =>
`/api/v1/applications/export/${applicationId}`;

View File

@ -49,6 +49,7 @@ import { isEllipsisActive } from "utils/helpers";
import ForkApplicationModal from "./ForkApplicationModal";
import { Toaster } from "components/ads/Toast";
import { Variant } from "components/ads/common";
import { getExportAppAPIRoute } from "constants/ApiConstants";
type NameWrapperProps = {
hasReadPermission: boolean;
@ -355,7 +356,8 @@ export function ApplicationCard(props: ApplicationCardProps) {
const existingLink = document.getElementById(id);
existingLink && existingLink.remove();
const link = document.createElement("a");
link.href = `/api/v1/applications/export/${props.application.id}`;
link.href = getExportAppAPIRoute(props.application.id);
link.id = id;
document.body.appendChild(link);
// will fetch the file manually during cypress test run.

View File

@ -15,6 +15,7 @@ import { APPLICATIONS_URL, PAGE_LIST_EDITOR_URL } from "constants/routes";
import { MenuItemData, MenuTypes } from "./NavigationMenuItem";
import { useCallback } from "react";
import { ExplorerURLParams } from "../Explorer/helpers";
import { getExportAppAPIRoute } from "constants/ApiConstants";
type NavigationMenuDataProps = ThemeProp & {
applicationId: string | undefined;
@ -152,6 +153,13 @@ export const GetNavigationMenuData = ({
},
],
},
{
text: "Export Application",
onClick: () =>
applicationId && openExternalLink(getExportAppAPIRoute(applicationId)),
type: MenuTypes.MENU,
isVisible: isApplicationIdPresent,
},
{
text: "Delete Application",
confirmText: "Are you sure?",