mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
relates to #19869 > NOTE: API integration will be included in a separate PR This adds the UI updates to support the new VPP feature on the software pages. This includes the software titles page and software titles details page. The new UI includes: **Add Vpp apps tab in Add software modal:**  **Various updates to the SoftwareIcon component to support icons from an external source:**  **Various updates to the SoftwarePackageCard compont to support app store apps.**  - [x] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://fleetdm.com/docs/contributing/committing-changes#changes-files) for more information. - [x] Added/updated testss: - [x] Manual QA for all new/changed functionality
30 lines
1 KiB
TypeScript
30 lines
1 KiB
TypeScript
import {
|
|
IAppStoreApp,
|
|
ISoftwareTitleDetails,
|
|
isSoftwarePackage,
|
|
} from "interfaces/software";
|
|
|
|
/**
|
|
* Generates the data needed to render the package card.
|
|
*/
|
|
// eslint-disable-next-line import/prefer-default-export
|
|
export const getPackageCardInfo = (softwareTitle: ISoftwareTitleDetails) => {
|
|
// we know at this point that softwareTitle.software_package or
|
|
// softwareTitle.app_store_app is not null so we will do a type assertion.
|
|
const packageData = softwareTitle.software_package
|
|
? softwareTitle.software_package
|
|
: (softwareTitle.app_store_app as IAppStoreApp);
|
|
|
|
return {
|
|
softwarePackage: isSoftwarePackage(packageData) ? packageData : undefined,
|
|
name: softwareTitle.name,
|
|
version: isSoftwarePackage(packageData)
|
|
? packageData.version
|
|
: packageData.latest_version,
|
|
uploadedAt: isSoftwarePackage(packageData) ? packageData.uploaded_at : "",
|
|
status: packageData.status,
|
|
isSelfService: isSoftwarePackage(packageData)
|
|
? packageData.self_service
|
|
: false,
|
|
};
|
|
};
|