Fleet UI: Fix Android link on SW details page (#36871)
This commit is contained in:
+1
@@ -6,6 +6,7 @@ import { getPathWithQueryParams } from "utilities/url";
|
||||
import { ANDROID_PLAY_STORE_URL } from "utilities/constants";
|
||||
|
||||
interface IAndroidLatestVersionWithTooltipProps {
|
||||
/** e.g. com.android.chrome, Component will build link URL using this ID */
|
||||
androidPlayStoreId: string;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@ describe("InstallerDetailsWidget", () => {
|
||||
version: "v1.2.3",
|
||||
isFma: false,
|
||||
isScriptPackage: false,
|
||||
androidPlayStoreLink: undefined,
|
||||
androidPlayStoreId: undefined,
|
||||
};
|
||||
|
||||
it("renders the package icon when installerType is 'package'", () => {
|
||||
@@ -110,7 +110,7 @@ describe("InstallerDetailsWidget", () => {
|
||||
<InstallerDetailsWidget
|
||||
{...defaultProps}
|
||||
installerType="app-store"
|
||||
androidPlayStoreLink="link-here"
|
||||
androidPlayStoreId="com.android.appname"
|
||||
/>
|
||||
);
|
||||
|
||||
|
||||
+4
-4
@@ -46,12 +46,12 @@ const InstallerName = ({ name }: IInstallerNameProps) => {
|
||||
const renderInstallerDisplayText = (
|
||||
installerType: string,
|
||||
isFma: boolean,
|
||||
androidPlayStoreLink?: string
|
||||
androidPlayStoreId?: string
|
||||
) => {
|
||||
if (installerType === "package") {
|
||||
return isFma ? "Fleet-maintained" : "Custom package";
|
||||
}
|
||||
if (androidPlayStoreLink) {
|
||||
if (androidPlayStoreId) {
|
||||
return "Google Play Store";
|
||||
}
|
||||
return "App Store (VPP)";
|
||||
@@ -66,7 +66,7 @@ interface IInstallerDetailsWidgetProps {
|
||||
sha256?: string | null;
|
||||
isFma: boolean;
|
||||
isScriptPackage: boolean;
|
||||
androidPlayStoreLink?: string;
|
||||
androidPlayStoreId?: string;
|
||||
}
|
||||
|
||||
const InstallerDetailsWidget = ({
|
||||
@@ -78,7 +78,7 @@ const InstallerDetailsWidget = ({
|
||||
version,
|
||||
isFma,
|
||||
isScriptPackage,
|
||||
androidPlayStoreLink: androidPlayStoreId,
|
||||
androidPlayStoreId,
|
||||
}: IInstallerDetailsWidgetProps) => {
|
||||
const classNames = classnames(baseClass, className);
|
||||
|
||||
|
||||
+5
-6
@@ -36,7 +36,6 @@ import {
|
||||
APP_STORE_APP_ACTION_OPTIONS,
|
||||
SOFTWARE_PACKAGE_ACTION_OPTIONS,
|
||||
downloadFile,
|
||||
PLAY_STORE_APP_BASE_URL,
|
||||
} from "./helpers";
|
||||
import InstallerStatusTable from "./InstallerStatusTable";
|
||||
import InstallerPoliciesTable from "./InstallerPoliciesTable";
|
||||
@@ -284,10 +283,6 @@ const SoftwareInstallerCard = ({
|
||||
const showActions =
|
||||
isGlobalAdmin || isGlobalMaintainer || isTeamAdmin || isTeamMaintainer;
|
||||
|
||||
const androidPlayStoreLink = isAndroidPlayStoreApp
|
||||
? `${PLAY_STORE_APP_BASE_URL}${softwareInstaller?.app_store_id}`
|
||||
: undefined;
|
||||
|
||||
return (
|
||||
<Card borderRadiusSize="xxlarge" className={baseClass}>
|
||||
<div className={`${baseClass}__installer-header`}>
|
||||
@@ -301,7 +296,11 @@ const SoftwareInstallerCard = ({
|
||||
sha256={sha256}
|
||||
isFma={isFleetMaintainedApp}
|
||||
isScriptPackage={isScriptPackage}
|
||||
androidPlayStoreLink={androidPlayStoreLink}
|
||||
androidPlayStoreId={
|
||||
isAndroidPlayStoreApp
|
||||
? softwareInstaller?.app_store_id
|
||||
: undefined
|
||||
}
|
||||
/>
|
||||
<div className={`${baseClass}__tags-wrapper`}>
|
||||
{Array.isArray(automaticInstallPolicies) &&
|
||||
|
||||
@@ -48,6 +48,3 @@ export const downloadFile = (url: string, fileName: string) => {
|
||||
// Clean up above-created "a" element
|
||||
downloadLink.remove();
|
||||
};
|
||||
|
||||
export const PLAY_STORE_APP_BASE_URL =
|
||||
"https://play.google.com/store/apps/details?id=";
|
||||
|
||||
Reference in New Issue
Block a user