Skip to content

Commit

Permalink
Moved constat values to constants file
Browse files Browse the repository at this point in the history
  • Loading branch information
michal-gasiorek-wttech committed Jun 28, 2021
1 parent 297f448 commit 9873110
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
18 changes: 11 additions & 7 deletions cogboard-webapp/src/components/PopoverWithControls.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import React, { useState } from 'react';
import {
SERVICE_CHECK_RESPONSES,
NO_MATCHING_SERVICE_CHECK_RESPONSE
} from '../constants';
import copy from 'copy-to-clipboard';
import {
CaptionWithPointer,
Expand All @@ -8,10 +12,6 @@ import {
} from './styled';
import { Button, Popover } from '@material-ui/core';

const NO_MATCHING_RESPONSE = 'NO MATCH';
const RECEIVED_RESPONSE = 'ACTUAL RESPONSE';
const EXPECTED_RESPONSE = 'EXPECTED RESPONSE';

export const PopoverWithControls = ({
title,
titleHover,
Expand Down Expand Up @@ -50,14 +50,18 @@ export const PopoverWithControls = ({
>
{withCopy ? <Button onClick={copyBody}>Copy</Button> : null}
<Button onClick={handlePopoverClose}>Close</Button>
{bodyMessage === NO_MATCHING_RESPONSE ? (
{bodyMessage === NO_MATCHING_SERVICE_CHECK_RESPONSE ? (
<StyledPopoverTextWrapper>
<StyledPopoverText>
<StyledPopoverHeader>{EXPECTED_RESPONSE}</StyledPopoverHeader>
<StyledPopoverHeader>
{SERVICE_CHECK_RESPONSES.expected}
</StyledPopoverHeader>
{expectedResponseBody}
</StyledPopoverText>
<StyledPopoverText>
<StyledPopoverHeader>{RECEIVED_RESPONSE}</StyledPopoverHeader>
<StyledPopoverHeader>
{SERVICE_CHECK_RESPONSES.received}
</StyledPopoverHeader>
{body}
</StyledPopoverText>
</StyledPopoverTextWrapper>
Expand Down
6 changes: 6 additions & 0 deletions cogboard-webapp/src/constants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,3 +339,9 @@ export const NOTIFICATIONS = {
duration: 3000
})
};

export const NO_MATCHING_SERVICE_CHECK_RESPONSE = 'NO MATCH';
export const SERVICE_CHECK_RESPONSES = {
received: 'ACTUAL RESPONSE',
expected: 'EXPECTED RESPONSE'
};

0 comments on commit 9873110

Please sign in to comment.