https://github.com/crowdstrike/alloy-react
React + PatternFly building blocks for Foundry UI's
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.3%) to scientific vocabulary
Keywords from Contributors
Repository
React + PatternFly building blocks for Foundry UI's
Basic Info
- Host: GitHub
- Owner: CrowdStrike
- License: mit
- Language: TypeScript
- Default Branch: main
- Size: 1.38 MB
Statistics
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 16
- Releases: 5
Metadata Files
README.md
alloy-react
React + PatternFly building blocks for Foundry UI's
This project is meant to make it much easier to start building robust UI's within Foundry applications, and is opinionated on the use of React.js and PatternFly.
Support
This repository is an open source project, not a CrowdStrike product. As such, it carries no formal support, expressed or implied.
Getting Started
If you have an existing Foundry app where you want to use Alloy's React bindings, you can npm install --save @crowdstrike/alloy-react. Then refer to the reference below.
However, if you're just getting started, you're better off cloning the alloy-quickstart app, which contains Alloy's opinionated project structure and a few examples. You can still come back here and use the reference as you build.
Component Reference
ConsoleExtension
Represents what Foundry refer to as a "UI extension." This component provides base styling needed for the extension (e.g. PatternFly base CSS, padding to match other Falcon detail panes, etc.). Normally, you'll wrap all your extension content with a <ConsoleExtension> in App.tsx:
jsx
// App.tsx
return (
<ConsoleExtension>
<Title headingLevel="h1">Hello, extension</Title>
ConsolePage
Represents what Foundry refers to as a "UI page." This component provides base styling needed for the UI page, including a PatternFly ConsolePage may be a single, simple page; or it can be a full multi-page application with its own routing system.
To create a simple page:
jsx
// App.tsx
return (
<ConsolePage title="App Title">
<PageSection>
<Title headingLevel="h3">Single Page</Title>
To create a multi-page application with a sidebar:
```jsx
const routes = [
{
title: "Home",
path: "/home",
element:
return
[!TIP] When you create Falcon navigation links for this multi-page application, make sure the
navigation.links[].pathinmanifest.ymlmatch thepathprovided in theroutesattribute.
CollectionEditor
Component that allows collection objects to be read, modified, and deleted as JSON. You can determine the extent to which an end user can modify collection name and object name to interact with, as well as which actions are available to the user. (Note that the editor doesn't support selecting existing collections or objects from a dropdown, so the user will need to know the exact name for the items they want to edit.)
[!IMPORTANT] The CollectionEditor can't create collections, it can only create objects in an existing collection. To create a collection, use either the Foundry CLI or App Builder UI. See the Foundry collection docs for more help.
Basic collection editor
In this example, the user has full control over the collection name and object name, as well as whether to load, save, or delete the object.

jsx
<CollectionEditor />
Limited to one object
In this example, the user can only interact with the object specified by the app author. The object value is loaded immediately on render and cannot be deleted. A default value is populated in the editor if the object doesn't exist yet. This is useful for allowing users to interact with "global settings" for the application.

jsx
<CollectionEditor
collectionNameDefault="config"
collectionNameEditable={false}
objectNameDefault="default"
objectNameEditable={false}
loadObjectValue={true}
loadButtonVisible={false}
deleteButtonVisible={false}
objectValueDefault={{ special_key: "PLACEHOLDER" }}
/>
API Reference
Foundry context: FoundryProvider and useFoundry
Alloy provides a React-ified wrapper of the foundry-js FalconApi and data objects via a React context. The context provider <FoundryProvider> should wrap your entire <App /> in index.tsx:
jsx
// index.tsx
root.render(
<React.StrictMode>
<FoundryProvider>
<App />
</FoundryProvider>
</React.StrictMode>
);
With this provider in place, you can use the custom hook useFoundry() to get the values of this context, which includes: falcon, data, and isInitialized:
```jsx // App.tsx const { data, isInitialized } = useFoundry();
if (!isInitialized) { return null; }
return (
[!IMPORTANT] Note that the
dataobject returned byuseFoundry()is a React state object, which the Foundry provider correctly updates via afalcon.events.on('data')event handler. Do not use thefalcon.dataobject, since it will not correctly re-render your UI when a data event occurs.
useCollectionObject
Query a collection object. This hook is useful to look up a well known value when a component renders, for example a configuration value.
javascript
const [config, configReady, configError] = useCollectionObject(
"config",
"default"
);
useEffect(() => {
if (!configReady) return;
if (configError) return; // TODO: handle error
// TODO: use config value
}, [configReady]);
Types
Use these types to perform type assertions on responses from foundry-js and safely interact with those responses (rather than asserting them as any). See the documentation for each type for more details.
CollectionReadResponse- Returned fromfalcon.collection().read().CollectionWriteResponse- Returned fromfalcon.collection().write().CollectionDeleteResponse- Returned fromfalcon.collection().delete().
Owner
- Name: CrowdStrike
- Login: CrowdStrike
- Kind: organization
- Email: github@crowdstrike.com
- Location: United States of America
- Website: https://www.crowdstrike.com
- Repositories: 183
- Profile: https://github.com/CrowdStrike
GitHub Events
Total
- Create event: 67
- Release event: 5
- Issues event: 7
- Delete event: 50
- Issue comment event: 34
- Push event: 54
- Public event: 1
- Pull request review comment event: 3
- Pull request review event: 11
- Pull request event: 108
Last Year
- Create event: 67
- Release event: 5
- Issues event: 7
- Delete event: 50
- Issue comment event: 34
- Push event: 54
- Public event: 1
- Pull request review comment event: 3
- Pull request review event: 11
- Pull request event: 108
Committers
Last synced: about 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Evan Stoner | e****r@c****m | 31 |
| dependabot[bot] | 4****] | 10 |
| Carlos Matos | c****s@c****m | 2 |
| Gabe Alford | r****s@g****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 6
- Total pull requests: 116
- Average time to close issues: 13 days
- Average time to close pull requests: 10 days
- Total issue authors: 2
- Total pull request authors: 4
- Average comments per issue: 0.33
- Average comments per pull request: 0.38
- Merged pull requests: 36
- Bot issues: 0
- Bot pull requests: 97
Past Year
- Issues: 6
- Pull requests: 116
- Average time to close issues: 13 days
- Average time to close pull requests: 10 days
- Issue authors: 2
- Pull request authors: 4
- Average comments per issue: 0.33
- Average comments per pull request: 0.38
- Merged pull requests: 36
- Bot issues: 0
- Bot pull requests: 97
Top Authors
Issue Authors
- evanstoner (5)
- carlosmmatos (1)
Pull Request Authors
- dependabot[bot] (97)
- evanstoner (13)
- carlosmmatos (4)
- redhatrises (2)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- npm 39 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 4
- Total maintainers: 2
npmjs.org: @crowdstrike/alloy-react
React + PatternFly building blocks for Foundry UI's
- Homepage: https://github.com/CrowdStrike/alloy-react
- License: MIT
-
Latest release: 0.0.5
published over 1 year ago