|
@@ -68,6 +68,7 @@ type Props = {
|
|
|
comparisonType: AlertRuleComparisonType;
|
|
|
dataset: Dataset;
|
|
|
disabled: boolean;
|
|
|
+ isEditing: boolean;
|
|
|
onComparisonDeltaChange: (value: number) => void;
|
|
|
onFilterSearch: (query: string, isQueryValid) => void;
|
|
|
onMonitorTypeSelect: (activatedAlertFields: {
|
|
@@ -402,12 +403,14 @@ class RuleConditionsForm extends PureComponent<Props, State> {
|
|
|
}
|
|
|
|
|
|
renderMonitorTypeSelect() {
|
|
|
+ // TODO: disable select on edit
|
|
|
const {
|
|
|
- onMonitorTypeSelect,
|
|
|
- monitorType,
|
|
|
activationCondition,
|
|
|
- timeWindow,
|
|
|
+ isEditing,
|
|
|
+ monitorType,
|
|
|
+ onMonitorTypeSelect,
|
|
|
onTimeWindowChange,
|
|
|
+ timeWindow,
|
|
|
} = this.props;
|
|
|
|
|
|
return (
|
|
@@ -420,25 +423,32 @@ class RuleConditionsForm extends PureComponent<Props, State> {
|
|
|
<FormRow>
|
|
|
<MonitorSelect>
|
|
|
<MonitorCard
|
|
|
+ disabled={isEditing}
|
|
|
position="left"
|
|
|
isSelected={monitorType === MonitorType.CONTINUOUS}
|
|
|
onClick={() =>
|
|
|
- onMonitorTypeSelect({
|
|
|
- monitorType: MonitorType.CONTINUOUS,
|
|
|
- activationCondition,
|
|
|
- })
|
|
|
+ isEditing
|
|
|
+ ? null
|
|
|
+ : onMonitorTypeSelect({
|
|
|
+ monitorType: MonitorType.CONTINUOUS,
|
|
|
+ activationCondition,
|
|
|
+ })
|
|
|
}
|
|
|
>
|
|
|
<strong>{t('Continuous')}</strong>
|
|
|
<div>{t('Continuously monitor trends for the metrics outlined below')}</div>
|
|
|
</MonitorCard>
|
|
|
<MonitorCard
|
|
|
+ disabled={isEditing}
|
|
|
position="right"
|
|
|
isSelected={monitorType === MonitorType.ACTIVATED}
|
|
|
onClick={() =>
|
|
|
- onMonitorTypeSelect({
|
|
|
- monitorType: MonitorType.ACTIVATED,
|
|
|
- })
|
|
|
+ isEditing
|
|
|
+ ? null
|
|
|
+ : onMonitorTypeSelect({
|
|
|
+ monitorType: MonitorType.ACTIVATED,
|
|
|
+ activationCondition,
|
|
|
+ })
|
|
|
}
|
|
|
>
|
|
|
<strong>Conditional</strong>
|
|
@@ -448,6 +458,7 @@ class RuleConditionsForm extends PureComponent<Props, State> {
|
|
|
<SelectControl
|
|
|
name="activationCondition"
|
|
|
styles={this.selectControlStyles}
|
|
|
+ disabled={isEditing}
|
|
|
options={[
|
|
|
{
|
|
|
value: ActivationConditionType.RELEASE_CREATION,
|
|
@@ -780,6 +791,7 @@ type MonitorCardProps = {
|
|
|
* Adds hover and focus states to the card
|
|
|
*/
|
|
|
position: 'left' | 'right';
|
|
|
+ disabled?: boolean;
|
|
|
};
|
|
|
|
|
|
const MonitorCard = styled('div')<MonitorCardProps>`
|
|
@@ -787,14 +799,20 @@ const MonitorCard = styled('div')<MonitorCardProps>`
|
|
|
display: flex;
|
|
|
flex-grow: 1;
|
|
|
flex-direction: column;
|
|
|
- cursor: pointer;
|
|
|
+ cursor: ${p => (p.disabled || p.isSelected ? 'default' : 'pointer')};
|
|
|
justify-content: center;
|
|
|
+ background-color: ${p =>
|
|
|
+ p.disabled && !p.isSelected ? p.theme.backgroundSecondary : p.theme.background};
|
|
|
|
|
|
&:focus,
|
|
|
&:hover {
|
|
|
- outline: 1px solid ${p => p.theme.purple200};
|
|
|
- background-color: ${p => p.theme.backgroundSecondary};
|
|
|
- margin: 0;
|
|
|
+ ${p =>
|
|
|
+ p.disabled || p.isSelected
|
|
|
+ ? ''
|
|
|
+ : `
|
|
|
+ outline: 1px solid ${p.theme.purple200};
|
|
|
+ background-color: ${p.theme.backgroundSecondary};
|
|
|
+ `}
|
|
|
}
|
|
|
|
|
|
border-top-left-radius: ${p => (p.position === 'left' ? p.theme.borderRadius : 0)};
|