2023-12-12 22:21:44 +00:00
import { startCase } from "lodash" ;
2021-04-27 20:55:33 +00:00
import PropTypes from "prop-types" ;
2024-07-16 17:16:57 +00:00
import { IconNames } from "components/icons" ;
2025-02-06 16:47:09 +00:00
import { HOST_APPLE_PLATFORMS , Platform } from "./platform" ;
2023-12-12 21:03:33 +00:00
import vulnerabilityInterface from "./vulnerability" ;
2024-12-19 17:09:38 +00:00
import { ILabelSoftwareTitle } from "./label" ;
2021-04-27 20:55:33 +00:00
export default PropTypes . shape ( {
type : PropTypes . string ,
name : PropTypes.string ,
version : PropTypes.string ,
2021-07-15 17:01:52 +00:00
source : PropTypes.string ,
2021-04-27 20:55:33 +00:00
id : PropTypes.number ,
2021-07-15 17:01:52 +00:00
vulnerabilities : PropTypes.arrayOf ( vulnerabilityInterface ) ,
2021-04-27 20:55:33 +00:00
} ) ;
2021-07-15 17:01:52 +00:00
2022-11-18 16:25:39 +00:00
export interface ISoftwareResponse {
counts_updated_at : string ;
software : ISoftware [ ] ;
}
export interface ISoftwareCountResponse {
count : number ;
}
export interface IGetSoftwareByIdResponse {
software : ISoftware ;
}
2023-12-12 21:03:33 +00:00
// TODO: old software interface. replaced with ISoftwareVersion
// check to see if we still need this.
2021-07-15 17:01:52 +00:00
export interface ISoftware {
id : number ;
2021-09-29 04:04:58 +00:00
name : string ; // e.g., "Figma.app"
version : string ; // e.g., "2.1.11"
2023-03-23 16:32:32 +00:00
bundle_identifier? : string | null ; // e.g., "com.figma.Desktop"
2025-01-14 00:45:16 +00:00
source : string ; // "apps" | "ipados_apps" | "ios_apps" | "programs" | "rpm_packages" | "deb_packages" | ?
2021-09-29 04:04:58 +00:00
generated_cpe : string ;
2023-12-12 21:03:33 +00:00
vulnerabilities : ISoftwareVulnerability [ ] | null ;
2023-03-23 16:32:32 +00:00
hosts_count? : number ;
2021-09-29 04:04:58 +00:00
last_opened_at? : string | null ; // e.g., "2021-08-18T15:11:35Z”
2023-05-18 13:35:58 +00:00
installed_paths? : string [ ] ;
2024-08-26 20:59:17 +00:00
browser? : string ;
vendor? : string ;
2021-07-15 17:01:52 +00:00
}
2022-04-07 19:12:38 +00:00
2024-02-08 16:56:32 +00:00
export type IVulnerabilitySoftware = Omit < ISoftware , " vulnerabilities " > & {
resolved_in_version : string ;
} ;
2024-02-07 02:39:49 +00:00
2023-12-12 21:03:33 +00:00
export interface ISoftwareTitleVersion {
id : number ;
version : string ;
vulnerabilities : string [ ] | null ; // TODO: does this return null or is it omitted?
hosts_count? : number ;
}
2025-01-14 00:45:16 +00:00
export interface ISoftwareInstallPolicy {
2024-11-20 11:41:40 +00:00
id : number ;
name : string ;
}
2025-05-02 16:11:48 +00:00
export type SoftwareCategory =
| "Browsers"
| "Communication"
| "Developer tools"
| "Productivity" ;
2025-05-13 17:41:44 +00:00
export interface ISoftwarePackageStatus {
installed : number ;
pending_install : number ;
failed_install : number ;
pending_uninstall : number ;
failed_uninstall : number ;
}
export interface ISoftwareAppStoreAppStatus {
installed : number ;
pending : number ;
failed : number ;
}
2024-05-09 13:06:58 +00:00
export interface ISoftwarePackage {
name : string ;
2025-05-21 15:31:39 +00:00
title_id : number ;
url : string ;
2024-05-09 13:06:58 +00:00
version : string ;
uploaded_at : string ;
install_script : string ;
2024-12-19 21:31:36 +00:00
uninstall_script : string ;
2024-05-09 13:06:58 +00:00
pre_install_query? : string ;
post_install_script? : string ;
2024-12-27 19:19:31 +00:00
automatic_install? : boolean ; // POST only
Update UI for software self-service features (#19244)
Issues https://github.com/fleetdm/fleet/issues/17587,
https://github.com/fleetdm/fleet/issues/18836,
https://github.com/fleetdm/fleet/issues/18837,
https://github.com/fleetdm/fleet/pull/18339, and
https://github.com/fleetdm/fleet/pull/18340
# TODOS
- Integrate backend
- Unit/integration tests
- Various todos noted in comments
- Cleanup styles and organization of components (de-duplicating and
consolidating where possible)
- Activity feed updates (if any)
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
<!-- Note that API documentation changes are now addressed by the
product design team. -->
- [ ] 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.
- [ ] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [ ] Added support on fleet's osquery simulator `cmd/osquery-perf` for
new osquery data ingestion features.
- [ ] Added/updated tests
- [ ] If database migrations are included, checked table schema to
confirm autoupdate
- For database migrations:
- [ ] Checked schema for all modified table for columns that will
auto-update timestamps during migration.
- [ ] Confirmed that updating the timestamps is acceptable, and will not
cause unwanted side effects.
- [ ] Ensured the correct collation is explicitly set for character
columns (`COLLATE utf8mb4_unicode_ci`).
- [ ] Manual QA for all new/changed functionality
- For Orbit and Fleet Desktop changes:
- [ ] Manual QA must be performed in the three main OSs, macOS, Windows
and Linux.
- [ ] Auto-update manual QA, from released version of component to new
version (see [tools/tuf/test](../tools/tuf/test/README.md)).
---------
Co-authored-by: Gabriel Hernandez <ghernandez345@gmail.com>
2024-05-31 10:09:53 +00:00
self_service : boolean ;
2024-07-18 16:04:15 +00:00
icon_url : string | null ;
2025-05-13 17:41:44 +00:00
status : ISoftwarePackageStatus ;
2025-01-14 00:45:16 +00:00
automatic_install_policies? : ISoftwareInstallPolicy [ ] | null ;
2024-10-23 14:57:02 +00:00
install_during_setup? : boolean ;
2024-12-19 17:09:38 +00:00
labels_include_any : ILabelSoftwareTitle [ ] | null ;
labels_exclude_any : ILabelSoftwareTitle [ ] | null ;
2025-05-02 16:11:48 +00:00
categories? : SoftwareCategory [ ] ;
2025-05-13 17:41:44 +00:00
fleet_maintained_app_id? : number | null ;
2025-05-15 16:20:22 +00:00
hash_sha256? : string | null ;
2024-05-09 13:06:58 +00:00
}
2024-07-18 09:20:17 +00:00
export const isSoftwarePackage = (
data : ISoftwarePackage | IAppStoreApp
) : data is ISoftwarePackage = >
( data as ISoftwarePackage ) . install_script !== undefined ;
export interface IAppStoreApp {
name : string ;
app_store_id : number ;
latest_version : string ;
2025-02-24 21:01:55 +00:00
created_at : string ;
2024-07-18 09:20:17 +00:00
icon_url : string ;
2024-08-20 14:51:36 +00:00
self_service : boolean ;
2025-02-03 22:10:22 +00:00
platform : typeof HOST_APPLE_PLATFORMS [ number ] ;
2025-05-13 17:41:44 +00:00
status : ISoftwareAppStoreAppStatus ;
2024-10-23 14:57:02 +00:00
install_during_setup? : boolean ;
2025-01-14 00:45:16 +00:00
automatic_install_policies? : ISoftwareInstallPolicy [ ] | null ;
2025-02-24 21:01:55 +00:00
automatic_install? : boolean ;
2025-06-06 19:40:52 +00:00
last_install? : IAppLastInstall | null ;
2025-01-14 00:45:16 +00:00
last_uninstall ? : {
script_execution_id : string ;
uninstalled_at : string ;
} | null ;
version? : string ;
2025-02-03 22:10:22 +00:00
labels_include_any : ILabelSoftwareTitle [ ] | null ;
labels_exclude_any : ILabelSoftwareTitle [ ] | null ;
2025-05-02 16:11:48 +00:00
categories? : SoftwareCategory [ ] ;
2024-07-18 09:20:17 +00:00
}
export interface ISoftwareTitle {
2023-12-12 21:03:33 +00:00
id : number ;
name : string ;
versions_count : number ;
2024-10-08 19:19:32 +00:00
source : SoftwareSource ;
2023-12-12 21:03:33 +00:00
hosts_count : number ;
2024-02-16 21:50:25 +00:00
versions : ISoftwareTitleVersion [ ] | null ;
2024-07-18 16:04:15 +00:00
software_package : ISoftwarePackage | null ;
app_store_app : IAppStoreApp | null ;
2024-10-08 19:19:32 +00:00
browser? : BrowserType ;
Update UI for software self-service features (#19244)
Issues https://github.com/fleetdm/fleet/issues/17587,
https://github.com/fleetdm/fleet/issues/18836,
https://github.com/fleetdm/fleet/issues/18837,
https://github.com/fleetdm/fleet/pull/18339, and
https://github.com/fleetdm/fleet/pull/18340
# TODOS
- Integrate backend
- Unit/integration tests
- Various todos noted in comments
- Cleanup styles and organization of components (de-duplicating and
consolidating where possible)
- Activity feed updates (if any)
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
<!-- Note that API documentation changes are now addressed by the
product design team. -->
- [ ] 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.
- [ ] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [ ] Added support on fleet's osquery simulator `cmd/osquery-perf` for
new osquery data ingestion features.
- [ ] Added/updated tests
- [ ] If database migrations are included, checked table schema to
confirm autoupdate
- For database migrations:
- [ ] Checked schema for all modified table for columns that will
auto-update timestamps during migration.
- [ ] Confirmed that updating the timestamps is acceptable, and will not
cause unwanted side effects.
- [ ] Ensured the correct collation is explicitly set for character
columns (`COLLATE utf8mb4_unicode_ci`).
- [ ] Manual QA for all new/changed functionality
- For Orbit and Fleet Desktop changes:
- [ ] Manual QA must be performed in the three main OSs, macOS, Windows
and Linux.
- [ ] Auto-update manual QA, from released version of component to new
version (see [tools/tuf/test](../tools/tuf/test/README.md)).
---------
Co-authored-by: Gabriel Hernandez <ghernandez345@gmail.com>
2024-05-31 10:09:53 +00:00
}
2024-07-18 09:20:17 +00:00
export interface ISoftwareTitleDetails {
id : number ;
name : string ;
Update UI for software self-service features (#19244)
Issues https://github.com/fleetdm/fleet/issues/17587,
https://github.com/fleetdm/fleet/issues/18836,
https://github.com/fleetdm/fleet/issues/18837,
https://github.com/fleetdm/fleet/pull/18339, and
https://github.com/fleetdm/fleet/pull/18340
# TODOS
- Integrate backend
- Unit/integration tests
- Various todos noted in comments
- Cleanup styles and organization of components (de-duplicating and
consolidating where possible)
- Activity feed updates (if any)
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
<!-- Note that API documentation changes are now addressed by the
product design team. -->
- [ ] 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.
- [ ] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [ ] Added support on fleet's osquery simulator `cmd/osquery-perf` for
new osquery data ingestion features.
- [ ] Added/updated tests
- [ ] If database migrations are included, checked table schema to
confirm autoupdate
- For database migrations:
- [ ] Checked schema for all modified table for columns that will
auto-update timestamps during migration.
- [ ] Confirmed that updating the timestamps is acceptable, and will not
cause unwanted side effects.
- [ ] Ensured the correct collation is explicitly set for character
columns (`COLLATE utf8mb4_unicode_ci`).
- [ ] Manual QA for all new/changed functionality
- For Orbit and Fleet Desktop changes:
- [ ] Manual QA must be performed in the three main OSs, macOS, Windows
and Linux.
- [ ] Auto-update manual QA, from released version of component to new
version (see [tools/tuf/test](../tools/tuf/test/README.md)).
---------
Co-authored-by: Gabriel Hernandez <ghernandez345@gmail.com>
2024-05-31 10:09:53 +00:00
software_package : ISoftwarePackage | null ;
2024-07-18 09:20:17 +00:00
app_store_app : IAppStoreApp | null ;
2024-10-08 19:19:32 +00:00
source : SoftwareSource ;
2024-07-18 09:20:17 +00:00
hosts_count : number ;
versions : ISoftwareTitleVersion [ ] | null ;
2024-11-05 15:54:02 +00:00
counts_updated_at? : string ;
2024-07-18 09:20:17 +00:00
bundle_identifier? : string ;
2024-10-08 19:19:32 +00:00
browser? : BrowserType ;
2024-07-18 09:20:17 +00:00
versions_count? : number ;
2023-12-12 21:03:33 +00:00
}
export interface ISoftwareVulnerability {
cve : string ;
details_link : string ;
cvss_score? : number | null ;
epss_probability? : number | null ;
cisa_known_exploit? : boolean | null ;
cve_published? : string | null ;
cve_description? : string | null ;
resolved_in_version? : string | null ;
2024-02-08 13:54:00 +00:00
created_at? : string | null ;
2023-12-12 21:03:33 +00:00
}
export interface ISoftwareVersion {
id : number ;
name : string ; // e.g., "Figma.app"
version : string ; // e.g., "2.1.11"
bundle_identifier? : string ; // e.g., "com.figma.Desktop"
2024-10-08 19:19:32 +00:00
source : SoftwareSource ;
browser : BrowserType ;
2023-12-12 21:03:33 +00:00
release : string ; // TODO: on software/verions/:id?
vendor : string ;
arch : string ; // e.g., "x86_64" // TODO: on software/verions/:id?
generated_cpe : string ;
vulnerabilities : ISoftwareVulnerability [ ] | null ;
hosts_count? : number ;
}
2024-10-08 19:19:32 +00:00
export const SOURCE_TYPE_CONVERSION = {
2022-04-07 19:12:38 +00:00
apt_sources : "Package (APT)" ,
deb_packages : "Package (deb)" ,
portage_packages : "Package (Portage)" ,
rpm_packages : "Package (RPM)" ,
yum_sources : "Package (YUM)" ,
npm_packages : "Package (NPM)" ,
2023-12-04 19:26:26 +00:00
atom_packages : "Package (Atom)" , // Atom packages were removed from software inventory. Mapping is maintained for backwards compatibility. (2023-12-04)
2022-04-07 19:12:38 +00:00
python_packages : "Package (Python)" ,
2025-05-02 14:17:09 +00:00
tgz_packages : "Package (tar)" ,
2022-04-07 19:12:38 +00:00
apps : "Application (macOS)" ,
2024-07-30 17:14:25 +00:00
ios_apps : "Application (iOS)" ,
ipados_apps : "Application (iPadOS)" ,
2023-12-12 22:21:44 +00:00
chrome_extensions : "Browser plugin" , // chrome_extensions can include any chrome-based browser (e.g., edge), so we rely instead on the `browser` field computed by Fleet server and fallback to this value if it is not present.
2022-04-07 19:12:38 +00:00
firefox_addons : "Browser plugin (Firefox)" ,
safari_extensions : "Browser plugin (Safari)" ,
homebrew_packages : "Package (Homebrew)" ,
programs : "Program (Windows)" ,
ie_extensions : "Browser plugin (IE)" ,
chocolatey_packages : "Package (Chocolatey)" ,
pkg_packages : "Package (pkg)" ,
2024-03-05 16:59:53 +00:00
vscode_extensions : "IDE extension (VS Code)" ,
2022-06-08 19:01:38 +00:00
} as const ;
2022-04-07 19:12:38 +00:00
2024-10-08 19:19:32 +00:00
export type SoftwareSource = keyof typeof SOURCE_TYPE_CONVERSION ;
2025-01-14 00:45:16 +00:00
/** Map installable software source to platform */
export const INSTALLABLE_SOURCE_PLATFORM_CONVERSION = {
apt_sources : "linux" ,
deb_packages : "linux" ,
portage_packages : "linux" ,
rpm_packages : "linux" ,
yum_sources : "linux" ,
2025-05-02 14:17:09 +00:00
tgz_packages : "linux" ,
2025-01-14 00:45:16 +00:00
npm_packages : null ,
atom_packages : null ,
python_packages : null ,
apps : "darwin" ,
ios_apps : "ios" ,
ipados_apps : "ipados" ,
chrome_extensions : null ,
firefox_addons : null ,
safari_extensions : null ,
homebrew_packages : "darwin" ,
programs : "windows" ,
ie_extensions : null ,
chocolatey_packages : "windows" ,
pkg_packages : "darwin" ,
vscode_extensions : null ,
} as const ;
export type InstallableSoftwareSource = keyof typeof INSTALLABLE_SOURCE_PLATFORM_CONVERSION ;
2024-10-08 19:19:32 +00:00
const BROWSER_TYPE_CONVERSION = {
2023-12-12 22:21:44 +00:00
chrome : "Chrome" ,
chromium : "Chromium" ,
opera : "Opera" ,
yandex : "Yandex" ,
brave : "Brave" ,
edge : "Edge" ,
edge_beta : "Edge Beta" ,
} as const ;
2024-10-08 19:19:32 +00:00
export type BrowserType = keyof typeof BROWSER_TYPE_CONVERSION ;
2023-12-12 22:21:44 +00:00
export const formatSoftwareType = ( {
source ,
browser ,
} : {
2024-10-08 19:19:32 +00:00
source : SoftwareSource ;
browser? : BrowserType ;
2023-12-12 22:21:44 +00:00
} ) = > {
2024-10-08 19:19:32 +00:00
let type : string = SOURCE_TYPE_CONVERSION [ source ] || "Unknown" ;
2023-12-12 22:21:44 +00:00
if ( browser ) {
type = ` Browser plugin ( ${
BROWSER_TYPE_CONVERSION [ browser ] || startCase ( browser )
} ) ` ;
}
return type ;
2022-04-07 19:12:38 +00:00
} ;
2024-05-10 15:57:47 +00:00
/ * *
* This list comprises all possible states of software install operations .
* /
2024-09-12 15:51:59 +00:00
export const SOFTWARE_UNINSTALL_STATUSES = [
"uninstalled" ,
"pending_uninstall" ,
"failed_uninstall" ,
] as const ;
export type SoftwareUninstallStatus = typeof SOFTWARE_UNINSTALL_STATUSES [ number ] ;
2024-05-10 15:57:47 +00:00
export const SOFTWARE_INSTALL_STATUSES = [
"installed" ,
2024-09-04 21:46:48 +00:00
"pending_install" ,
2024-09-12 15:51:59 +00:00
"failed_install" ,
. . . SOFTWARE_UNINSTALL_STATUSES ,
2024-05-10 15:57:47 +00:00
] as const ;
2024-05-09 20:45:53 +00:00
/ *
* SoftwareInstallStatus represents the possible states of software install operations .
* /
2024-05-10 15:57:47 +00:00
export type SoftwareInstallStatus = typeof SOFTWARE_INSTALL_STATUSES [ number ] ;
export const isValidSoftwareInstallStatus = (
2024-09-12 15:51:59 +00:00
s : string | undefined | null
2024-05-10 15:57:47 +00:00
) : s is SoftwareInstallStatus = >
! ! s && SOFTWARE_INSTALL_STATUSES . includes ( s as SoftwareInstallStatus ) ;
2024-05-09 20:45:53 +00:00
2024-09-16 21:24:09 +00:00
export const SOFTWARE_AGGREGATE_STATUSES = [
"installed" ,
"pending" ,
"failed" ,
] as const ;
export type SoftwareAggregateStatus = typeof SOFTWARE_AGGREGATE_STATUSES [ number ] ;
export const isValidSoftwareAggregateStatus = (
s : string | undefined | null
) : s is SoftwareAggregateStatus = >
! ! s && SOFTWARE_AGGREGATE_STATUSES . includes ( s as SoftwareAggregateStatus ) ;
2024-09-12 15:51:59 +00:00
export const isSoftwareUninstallStatus = (
s : string | undefined | null
) : s is SoftwareUninstallStatus = >
! ! s && SOFTWARE_UNINSTALL_STATUSES . includes ( s as SoftwareUninstallStatus ) ;
// not a typeguard, as above 2 functions are
export const isPendingStatus = ( s : string | undefined | null ) = >
[ "pending_install" , "pending_uninstall" ] . includes ( s || "" ) ;
2024-05-09 20:45:53 +00:00
/ * *
* ISoftwareInstallResult is the shape of a software install result object
* returned by the Fleet API .
* /
export interface ISoftwareInstallResult {
2024-09-12 15:51:59 +00:00
host_display_name? : string ;
2024-05-09 20:45:53 +00:00
install_uuid : string ;
software_title : string ;
software_title_id : number ;
software_package : string ;
host_id : number ;
2024-05-10 15:57:47 +00:00
status : SoftwareInstallStatus ;
2024-05-09 20:45:53 +00:00
detail : string ;
output : string ;
pre_install_query_output : string ;
post_install_script_output : string ;
2024-09-12 15:51:59 +00:00
created_at : string ;
updated_at : string | null ;
self_service : boolean ;
2024-05-09 20:45:53 +00:00
}
export interface ISoftwareInstallResults {
results : ISoftwareInstallResult ;
}
2024-05-09 21:44:50 +00:00
// ISoftwareInstallerType defines the supported installer types for
// software uploaded by the IT admin.
2024-10-01 16:02:13 +00:00
export type ISoftwareInstallerType = "pkg" | "msi" | "deb" | "rpm" | "exe" ;
2024-05-09 21:44:50 +00:00
export interface ISoftwareLastInstall {
install_uuid : string ;
installed_at : string ;
}
2024-07-24 19:32:59 +00:00
export interface IAppLastInstall {
command_uuid : string ;
installed_at : string ;
}
2025-05-23 13:09:06 +00:00
interface SignatureInformation {
installed_path : string ;
team_identifier : string ;
hash_sha256 : string | null ;
}
2025-06-06 19:40:52 +00:00
export interface ISoftwareLastUninstall {
install_uuid : string ;
installed_at : string ;
}
2025-05-23 13:09:06 +00:00
2024-05-09 21:44:50 +00:00
export interface ISoftwareInstallVersion {
version : string ;
2025-05-23 13:09:06 +00:00
bundle_identifier : string ;
2024-05-09 21:44:50 +00:00
last_opened_at : string | null ;
2024-05-10 15:18:24 +00:00
vulnerabilities : string [ ] | null ;
2024-05-09 21:44:50 +00:00
installed_paths : string [ ] ;
2025-05-29 11:24:25 +00:00
signature_information? : SignatureInformation [ ] ;
2024-05-09 21:44:50 +00:00
}
2024-07-19 16:10:28 +00:00
export interface IHostSoftwarePackage {
name : string ;
self_service : boolean ;
2025-05-08 13:16:51 +00:00
icon_url : string | null ;
2024-07-19 16:10:28 +00:00
version : string ;
2024-07-24 19:32:59 +00:00
last_install : ISoftwareLastInstall | null ;
2025-06-06 19:40:52 +00:00
last_uninstall : ISoftwareLastUninstall | null ;
2025-05-02 16:11:48 +00:00
categories? : SoftwareCategory [ ] ;
2025-06-23 15:09:20 +00:00
automatic_install_policies? : ISoftwareInstallPolicy [ ] | null ;
2024-07-19 16:10:28 +00:00
}
export interface IHostAppStoreApp {
app_store_id : string ;
self_service : boolean ;
icon_url : string ;
version : string ;
2024-07-24 19:32:59 +00:00
last_install : IAppLastInstall | null ;
2025-05-02 16:11:48 +00:00
categories? : SoftwareCategory [ ] ;
2025-06-23 15:09:20 +00:00
automatic_install_policies? : ISoftwareInstallPolicy [ ] | null ;
2024-07-19 16:10:28 +00:00
}
2024-05-09 21:44:50 +00:00
export interface IHostSoftware {
id : number ;
name : string ;
2024-07-19 16:10:28 +00:00
software_package : IHostSoftwarePackage | null ;
app_store_app : IHostAppStoreApp | null ;
2024-10-08 19:19:32 +00:00
source : SoftwareSource ;
2024-05-10 15:18:24 +00:00
bundle_identifier? : string ;
2024-09-12 15:51:59 +00:00
status : Exclude < SoftwareInstallStatus , " uninstalled " > | null ;
2024-05-09 21:44:50 +00:00
installed_versions : ISoftwareInstallVersion [ ] | null ;
}
Update UI for software self-service features (#19244)
Issues https://github.com/fleetdm/fleet/issues/17587,
https://github.com/fleetdm/fleet/issues/18836,
https://github.com/fleetdm/fleet/issues/18837,
https://github.com/fleetdm/fleet/pull/18339, and
https://github.com/fleetdm/fleet/pull/18340
# TODOS
- Integrate backend
- Unit/integration tests
- Various todos noted in comments
- Cleanup styles and organization of components (de-duplicating and
consolidating where possible)
- Activity feed updates (if any)
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
<!-- Note that API documentation changes are now addressed by the
product design team. -->
- [ ] 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.
- [ ] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [ ] Added support on fleet's osquery simulator `cmd/osquery-perf` for
new osquery data ingestion features.
- [ ] Added/updated tests
- [ ] If database migrations are included, checked table schema to
confirm autoupdate
- For database migrations:
- [ ] Checked schema for all modified table for columns that will
auto-update timestamps during migration.
- [ ] Confirmed that updating the timestamps is acceptable, and will not
cause unwanted side effects.
- [ ] Ensured the correct collation is explicitly set for character
columns (`COLLATE utf8mb4_unicode_ci`).
- [ ] Manual QA for all new/changed functionality
- For Orbit and Fleet Desktop changes:
- [ ] Manual QA must be performed in the three main OSs, macOS, Windows
and Linux.
- [ ] Auto-update manual QA, from released version of component to new
version (see [tools/tuf/test](../tools/tuf/test/README.md)).
---------
Co-authored-by: Gabriel Hernandez <ghernandez345@gmail.com>
2024-05-31 10:09:53 +00:00
2024-07-19 16:10:28 +00:00
export type IDeviceSoftware = IHostSoftware ;
2024-09-12 15:51:59 +00:00
const INSTALL_STATUS_PREDICATES : Record <
SoftwareInstallStatus | "pending" ,
string
> = {
pending : "pending" ,
2024-07-16 17:16:57 +00:00
installed : "installed" ,
2024-09-12 15:51:59 +00:00
uninstalled : "uninstalled" ,
2024-09-04 21:46:48 +00:00
pending_install : "told Fleet to install" ,
2024-09-12 15:51:59 +00:00
failed_install : "failed to install" ,
2024-09-05 19:20:36 +00:00
pending_uninstall : "told Fleet to uninstall" ,
failed_uninstall : "failed to uninstall" ,
2024-07-16 17:16:57 +00:00
} as const ;
export const getInstallStatusPredicate = ( status : string | undefined ) = > {
if ( ! status ) {
return INSTALL_STATUS_PREDICATES . pending ;
}
return (
INSTALL_STATUS_PREDICATES [ status . toLowerCase ( ) as SoftwareInstallStatus ] ||
INSTALL_STATUS_PREDICATES . pending
) ;
} ;
2024-09-16 21:24:09 +00:00
export const aggregateInstallStatusCounts = (
packageStatuses : ISoftwarePackage [ "status" ]
) = > ( {
installed : packageStatuses.installed ,
pending : packageStatuses.pending_install + packageStatuses . pending_uninstall ,
failed : packageStatuses.failed_install + packageStatuses . failed_uninstall ,
} ) ;
2024-09-12 15:51:59 +00:00
export const INSTALL_STATUS_ICONS : Record <
SoftwareInstallStatus | "pending" | "failed" ,
IconNames
> = {
2024-07-16 17:16:57 +00:00
pending : "pending-outline" ,
2024-09-04 21:46:48 +00:00
pending_install : "pending-outline" ,
2024-07-16 17:16:57 +00:00
installed : "success-outline" ,
2024-09-12 15:51:59 +00:00
uninstalled : "success-outline" ,
2024-07-16 17:16:57 +00:00
failed : "error-outline" ,
2024-09-04 21:46:48 +00:00
failed_install : "error-outline" ,
2024-09-05 19:20:36 +00:00
pending_uninstall : "pending-outline" ,
failed_uninstall : "error-outline" ,
2024-07-16 17:16:57 +00:00
} as const ;
2024-07-22 21:07:31 +00:00
2024-07-24 19:32:59 +00:00
type IHostSoftwarePackageWithLastInstall = IHostSoftwarePackage & {
2024-07-22 21:07:31 +00:00
last_install : ISoftwareLastInstall ;
} ;
2024-07-24 19:32:59 +00:00
export const hasHostSoftwarePackageLastInstall = (
software : IHostSoftware
) : software is IHostSoftware & {
software_package : IHostSoftwarePackageWithLastInstall ;
} = > {
return ! ! software . software_package ? . last_install ;
} ;
type IHostAppWithLastInstall = IHostAppStoreApp & {
last_install : IAppLastInstall ;
} ;
export const hasHostSoftwareAppLastInstall = (
2024-07-22 21:07:31 +00:00
software : IHostSoftware
2024-07-24 19:32:59 +00:00
) : software is IHostSoftware & {
app_store_app : IHostAppWithLastInstall ;
} = > {
return ! ! software . app_store_app ? . last_install ;
2024-07-22 21:07:31 +00:00
} ;
2024-08-08 16:46:38 +00:00
export const isIpadOrIphoneSoftwareSource = ( source : string ) = >
[ "ios_apps" , "ipados_apps" ] . includes ( source ) ;
2024-09-20 14:47:01 +00:00
export interface IFleetMaintainedApp {
id : number ;
name : string ;
version : string ;
2025-03-21 13:33:06 +00:00
platform : FleetMaintainedAppPlatform ;
software_title_id? : number ; // null unless the team already has the software added (as a Fleet-maintained app, App Store (app), or custom package)
2024-09-20 14:47:01 +00:00
}
2025-03-21 13:33:06 +00:00
export type FleetMaintainedAppPlatform = Extract <
Platform ,
"darwin" | "windows"
> ;
export interface ICombinedFMA {
name : string ;
macos : Omit < IFleetMaintainedApp , " name " > | null ;
windows : Omit < IFleetMaintainedApp , " name " > | null ;
}
2024-09-20 14:47:01 +00:00
export interface IFleetMaintainedAppDetails {
id : number ;
name : string ;
version : string ;
2025-03-21 13:33:06 +00:00
platform : FleetMaintainedAppPlatform ;
pre_install_script : string ;
2024-09-20 14:47:01 +00:00
install_script : string ;
2025-03-21 13:33:06 +00:00
post_install_script : string ;
2024-09-20 14:47:01 +00:00
uninstall_script : string ;
2025-01-27 21:23:08 +00:00
url : string ;
2025-05-08 13:22:55 +00:00
slug : string ;
2025-03-21 13:33:06 +00:00
software_title_id? : number ; // null unless the team already has the software added (as a Fleet-maintained app, App Store (app), or custom package)
2025-05-02 16:11:48 +00:00
categories : SoftwareCategory [ ] ;
2024-09-20 14:47:01 +00:00
}