diff --git a/ui/cypress/e2e/flows.test.ts b/ui/cypress/e2e/flows.test.ts new file mode 100644 index 0000000000..6386fe18ba --- /dev/null +++ b/ui/cypress/e2e/flows.test.ts @@ -0,0 +1,26 @@ +describe('Flows', () => { + beforeEach(() => { + cy.flush() + cy.signin().then(({body}) => { + const { + org: {id}, + bucket, + } = body + cy.wrap(body.org).as('org') + cy.wrap(bucket).as('bucket') + cy.fixture('routes').then(({orgs, flows}) => { + cy.visit(`${orgs}/${id}${flows}`) + }) + }) + }) + + // TODO: unskip when no longer blocked by feature flag + it.skip('CRUD a flow from the index page', () => { + cy.getByTestID('create-flow--button') + .first() + .click() + + cy.getByTestID('page-title').click() + cy.getByTestID('renamable-page-title--input').type('My Flow {enter}') + }) +}) diff --git a/ui/cypress/fixtures/routes.json b/ui/cypress/fixtures/routes.json index f58ecaec35..4a97191304 100644 --- a/ui/cypress/fixtures/routes.json +++ b/ui/cypress/fixtures/routes.json @@ -7,5 +7,6 @@ "endpoints": "/endpoints", "rules": "/rules", "buckets": "/load-data/buckets", - "telegrafs": "/load-data/telegrafs" + "telegrafs": "/load-data/telegrafs", + "flows": "/flows" } diff --git a/ui/src/notebooks/components/FlowCard.tsx b/ui/src/notebooks/components/FlowCard.tsx new file mode 100644 index 0000000000..996e62c7b3 --- /dev/null +++ b/ui/src/notebooks/components/FlowCard.tsx @@ -0,0 +1,30 @@ +import React, {FC} from 'react' +import {useParams, useHistory} from 'react-router-dom' + +// Components +import {ResourceCard} from '@influxdata/clockface' + +interface Props { + id: string + name: string +} + +const FlowCard: FC = ({id, name}) => { + const {orgID} = useParams() + const history = useHistory() + + const handleClick = () => { + history.push(`/orgs/${orgID}/notebooks/${id}`) + } + + return ( + + + + ) +} + +export default FlowCard diff --git a/ui/src/notebooks/components/FlowCards.tsx b/ui/src/notebooks/components/FlowCards.tsx new file mode 100644 index 0000000000..6008a797e1 --- /dev/null +++ b/ui/src/notebooks/components/FlowCards.tsx @@ -0,0 +1,32 @@ +import React, {useContext} from 'react' + +import {ResourceList, Grid, Columns} from '@influxdata/clockface' +import {NotebookListContext} from 'src/notebooks/context/notebook.list' +import FlowsIndexEmpty from 'src/notebooks/components/FlowsIndexEmpty' + +import FlowCard from 'src/notebooks/components/FlowCard' + +const FlowCards = () => { + const {notebooks} = useContext(NotebookListContext) + return ( + + + + + }> + {Object.entries(notebooks).map(([id, {name}]) => { + return + })} + + + + + + ) +} + +export default FlowCards diff --git a/ui/src/notebooks/components/FlowCreateButton.tsx b/ui/src/notebooks/components/FlowCreateButton.tsx new file mode 100644 index 0000000000..b1deac397c --- /dev/null +++ b/ui/src/notebooks/components/FlowCreateButton.tsx @@ -0,0 +1,31 @@ +// Libraries +import React, {useContext} from 'react' +import {useHistory, useParams} from 'react-router-dom' + +// Components +import {Button, IconFont, ComponentColor} from '@influxdata/clockface' +import {NotebookListContext} from 'src/notebooks/context/notebook.list' + +const FlowCreateButton = () => { + const history = useHistory() + const {orgID} = useParams() + const {add} = useContext(NotebookListContext) + + const handleCreate = async () => { + const id = await add() + history.push(`/orgs/${orgID}/notebooks/${id}`) + } + + return ( +