- 필수 기능
- 시작하기
- Glossary
- 표준 속성
- Guides
- Agent
- 통합
- 개방형텔레메트리
- 개발자
- API
- Datadog Mobile App
- CoScreen
- Cloudcraft
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- APM
- Continuous Profiler
- 스팬 시각화
- 데이터 스트림 모니터링
- 데이터 작업 모니터링
- 디지털 경험
- 소프트웨어 제공
- 보안
- AI Observability
- 로그 관리
- 관리
You can use JavaScript (JS) expressions anywhere in App Builder to create custom interactions between the different parts of your app. As you begin an expression, App Builder offers autocomplete suggestions based on the existing queries and components in your app. Click on an autocomplete suggestion to use it in your expression, or use the arrow keys on your keyboard and make a selection with the Enter key.
Some fields, like post-query transformation, display a code editor by default and accept plain JS. In all other fields, enclose your JS expressions in ${}
. For example, to interpolate the values of two text input components named textInput0
and textInput1
into the Content property of a text component (and add an exclamation mark), use the expression ${textInput0.value} ${textInput1.value}!
.
App Builder accepts standard vanilla JavaScript syntax, with the following caveats:
Before you create an expression, it’s helpful to know the available properties and defaults or current values for the component you want to interact with.
You can view the available properties and values for a component in the following ways:
To access App State:
To access Inspect Data:
To access the Admin Console:
Most UI components provide built-in options, such as toggles and text alignment, that cover basic app usage. To add a custom interaction to a component, click the code editor symbol (</>) and enter a JS expression.
You can make the visibility of a component dependent on other components.
For example, if you want a text component to be visible only when two text input components named textInput0
and textInput1
have values, use the expression ${textInput0.value && textInput1.value}
in the Is Visible property.
Similar to visibility, you can disable a component unless conditions are met by other aspects of your app, such as other components or the app context.
If your app has a button that uses the content from a text component to send a message, you can disable the button unless the text component is visible:
${!text0.isVisible}
.The text component is invisible and the button is disabled unless both text input fields have content.
You can also disable a component based on the app context, such as the team that the user is on.
For example, you can enable a component only for users who are in the Product Management team:
${global.user.teams[0].name == 'Product Management'}
.Another common use case is disabling a component while a query is in a loading state. In the EC2 Instance Manager blueprint, the instanceType
select component is disabled while the listInstances
query is loading. To accomplish this, the Is Disabled property uses the expression ${listInstances.isLoading}
.
Similar to components, you can use JS expressions to alter your queries based on user interaction.
The PagerDuty On-call Manager blueprint filters the result of the listSchedules
query based on input from the user. The user selects a team and user from the team
and user
select components.
Inside the listSchedules
query, the following post-query transformation filters the results based on the values of team
and user
:
return outputs.body.schedules.map( s => {
return {
...s,
users: s.users.map(u => u.summary),
teams: s.teams.map(u => u.summary)
}
}).filter(s => {
const matchesName = !name.value.length ? true : s.name.toLowerCase().includes(name.value.toLowerCase());
const matchesTeam = team.value === 'Any Team' ? true : s.teams.includes(team.value);
const matchesUser = user.value === 'Any User' ? true : s.users.includes(user.value);
return matchesName && matchesUser && matchesTeam ;
}) || []
Setting the query’s Run Settings to Auto allows the query to run each time a user changes a value in the team
or user
components.
추가 유용한 문서, 링크 및 기사: