Skip to content

Commit ca23c7b

Browse files
committed
Colour non-HTTP mock rule rows appropriately
1 parent 76ec554 commit ca23c7b

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

src/components/mock/mock-rule-row.tsx

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
import { styled, css } from '../../styles';
1515
import { Icon } from '../../icons';
1616

17-
import { getMethodColor } from '../../model/events/categorization';
17+
import { getMethodColor, getSummaryColour } from '../../model/events/categorization';
1818
import {
1919
HtkMockRule,
2020
Matcher,
@@ -306,19 +306,19 @@ export class RuleRow extends React.Component<{
306306
} = this.props.accountStore!;
307307

308308
const ruleType = rule.type;
309-
310-
// Hide non-HTTP rules (...for now)
311-
if (ruleType !== 'http') return null;
312-
313309
const initialMatcher = rule.matchers.length ? rule.matchers[0] : undefined;
314310

315-
let method: string | undefined;
316-
if (initialMatcher instanceof matchers.MethodMatcher) {
317-
method = Method[initialMatcher.method];
318-
} else if (initialMatcher !== undefined) {
319-
method = 'unknown';
311+
let ruleColour: string;
312+
if (ruleType === 'http') {
313+
if (initialMatcher instanceof matchers.MethodMatcher) {
314+
ruleColour = getMethodColor(Method[initialMatcher.method]);
315+
} else if (initialMatcher !== undefined) {
316+
ruleColour = getMethodColor('unknown');
317+
} else {
318+
ruleColour = 'transparent';
319+
}
320320
} else {
321-
method = undefined;
321+
ruleColour = getSummaryColour(ruleType);
322322
}
323323

324324
const serverVersion = serverVersionObservable.state === 'fulfilled'
@@ -343,10 +343,7 @@ export class RuleRow extends React.Component<{
343343
>{ (provided, snapshot) => <Observer>{ () =>
344344
<RowContainer
345345
{...provided.draggableProps}
346-
borderColor={method
347-
? getMethodColor(method)
348-
: 'transparent'
349-
}
346+
borderColor={ruleColour}
350347
ref={(ref: HTMLElement | null) => {
351348
provided.innerRef(ref);
352349
this.containerRef = ref;

0 commit comments

Comments
 (0)