import React from 'react'; import distanceInWordsToNow from 'date-fns/distance_in_words_to_now'; import Value from 'react-redux-values'; import remcalc from 'remcalc'; import titleCase from 'title-case'; import { Row, Col, Anchor, FormGroup, Input, FormLabel, Checkbox, Button, Table, TableThead, TableTr, TableTh, TableTd, TableTbody, Footer, StatusLoader, Message, MessageTitle, MessageDescription, Popover, PopoverContainer, PopoverTarget, PopoverItem, PopoverDivider, QueryBreakpoints, DotIcon, StartIcon, StopIcon, ResetIcon, DeleteIcon, ActionsIcon } from 'joyent-ui-toolkit'; const { SmallOnly, Medium } = QueryBreakpoints; const stateColor = { PROVISIONING: 'primary', RUNNING: 'green', STOPPING: 'grey', STOPPED: 'grey', DELETED: 'secondaryActive', FAILED: 'red' }; export const MenuForm = ({ handleSubmit, searchable }) => (
Filter instances
); export const Actions = ({ submitting = false, allowedActions = {}, onStart = () => null, onStop = () => null, onReboot = () => null, onDelete = () => null }) => ( ); export const Item = ({ id = '', name, state, created, allowedActions = {}, submitting, onStart, onStop, onReboot, onDelete }) => ( {name} {({ value: mutating }) => mutating ? ( ) : ( {' '} {titleCase(state)} ) } {distanceInWordsToNow(created)} {id.substring(0, 7)} onStart({ id })} > Start onStop({ id })} > Stop onReboot({ id })}>Reboot onDelete({ id })}>Delete ); export default ({ items = [], allowedActions = {}, sortBy = 'name', sortOrder = 'desc', error = null, submitting = false, actionable = false, allSelected = false, toggleSelectAll = () => null, onStart = () => null, onStop = () => null, onReboot = () => null, onDelete = () => null, onSortBy = () => null }) => (
{error ? ( Ooops! {error} ) : null} onSortBy('name')} sortOrder={sortOrder} showSort={sortBy === 'name'} left middle actionable > Name onSortBy('state')} sortOrder={sortOrder} showSort={sortBy === 'state'} left middle actionable > Status onSortBy('created')} sortOrder={sortOrder} showSort={sortBy === 'created'} left middle actionable > Created onSortBy('id')} sortOrder={sortOrder} showSort={sortBy === 'id'} left middle actionable > Short ID {items.map(({ id, ...rest }) => ( ))}
{actionable ? ( ) : null} );