Skip to content

Commit

Permalink
Add Snapshot recording form
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed May 7, 2020
1 parent 6dacf96 commit 6e68aad
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/app/CreateRecording/CreateRecording.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import * as React from 'react';
import { useHistory } from 'react-router-dom';
import { filter, first } from 'rxjs/operators';
import { Breadcrumb, BreadcrumbHeading, BreadcrumbItem, Card, CardBody, PageSection, Tabs, Tab } from '@patternfly/react-core';
import { Breadcrumb, BreadcrumbHeading, BreadcrumbItem, Card, CardBody, PageSection, Tabs, Tab, Text, TextVariants } from '@patternfly/react-core';
import { ServiceContext } from '@app/Shared/Services/Services';
import { NotificationsContext } from '@app/Notifications/Notifications';
import { CustomRecordingForm } from './CustomRecordingForm';
import { SnapshotRecordingForm } from './SnapshotRecordingForm';

export interface CreateRecordingProps {
recordingName?: string;
Expand Down Expand Up @@ -50,10 +51,13 @@ export const CreateRecording = (props: CreateRecordingProps) => {
</Breadcrumb>
<Card>
<CardBody>
<Tabs activeKey={activeTab} onSelect={(evt, idx) => setActiveTab(idx)}>
<Tabs activeKey={activeTab} onSelect={(evt, idx) => setActiveTab(Number(idx))}>
<Tab eventKey={0} title="Custom Flight Recording">
<CustomRecordingForm onSubmit={handleSubmit} />
</Tab>
<Tab eventKey={1} title="Snapshot Recording">
<SnapshotRecordingForm onSubmit={handleSubmit} />
</Tab>
</Tabs>
</CardBody>
</Card>
Expand Down
2 changes: 1 addition & 1 deletion src/app/CreateRecording/CustomRecordingForm.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { useHistory } from 'react-router-dom';
import { filter, first, map } from 'rxjs/operators';
import { ActionGroup, Breadcrumb, BreadcrumbHeading, BreadcrumbItem, Button, Card, CardBody, CardHeader, Checkbox, Form, FormGroup, FormSelect, FormSelectOption, FormSelectOptionGroup, TextArea, TextInput, Split, SplitItem, Text, TextVariants, Title, Tooltip, TooltipPosition } from '@patternfly/react-core';
import { ActionGroup, Button, Checkbox, Form, FormGroup, FormSelect, FormSelectOption, FormSelectOptionGroup, TextArea, TextInput, Split, SplitItem, Text, TextVariants, Tooltip, TooltipPosition } from '@patternfly/react-core';
import { OutlinedQuestionCircleIcon } from '@patternfly/react-icons';
import { ServiceContext } from '@app/Shared/Services/Services';
import { NotificationsContext } from '@app/Notifications/Notifications';
Expand Down
31 changes: 31 additions & 0 deletions src/app/CreateRecording/SnapshotRecordingForm.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import * as React from 'react';
import { useHistory } from 'react-router-dom';
import { ActionGroup, Button, Form, FormGroup, Text, TextVariants } from '@patternfly/react-core';

export interface SnapshotRecordingFormProps {
onSubmit: (command: string, args: string[]) => void;
};

export const SnapshotRecordingForm = (props) => {
const history = useHistory();

const handleSubmit = () => {
props.onSubmit('snapshot', []);
};

return (<>
<Form>
<Text component={TextVariants.p}>
A Snapshot recording is one which contains all information about all
events that have been captured in the current session by <i>other,&nbsp;
non-snapshot</i> recordings. Snapshots do not themselves define which
events are enabled, their thresholds, or any other options. A Snapshot
is only ever in the STOPPED state from the moment it is created.
</Text>
<ActionGroup>
<Button variant="primary" onClick={handleSubmit}>Create</Button>
<Button variant="secondary" onClick={history.goBack}>Cancel</Button>
</ActionGroup>
</Form>
</>);
}

0 comments on commit 6e68aad

Please sign in to comment.