diff --git a/ui/src/App.js b/ui/src/App.js index 43c609431a..f990ba6362 100644 --- a/ui/src/App.js +++ b/ui/src/App.js @@ -4,12 +4,13 @@ import PropTypes from 'prop-types' import SideNav from 'src/side_nav' import Notifications from 'shared/components/Notifications' -const App = ({children}) => +const App = ({children}) => (
{children}
+) const {node} = PropTypes diff --git a/ui/src/admin/actions/chronograf.js b/ui/src/admin/actions/chronograf.js index 4e155fe1f6..3f05b4e39d 100644 --- a/ui/src/admin/actions/chronograf.js +++ b/ui/src/admin/actions/chronograf.js @@ -168,9 +168,9 @@ export const createMappingAsync = (url, mapping) => async dispatch => { const {data} = await createMappingAJAX(url, mapping) dispatch(updateMapping(mappingWithTempId, data)) } catch (error) { - const message = `${_.upperFirst( - _.toLower(error.data.message) - )}: Scheme: ${mapping.scheme} Provider: ${mapping.provider}` + const message = `${_.upperFirst(_.toLower(error.data.message))}: Scheme: ${ + mapping.scheme + } Provider: ${mapping.provider}` dispatch(errorThrown(error, message)) setTimeout( () => dispatch(removeMapping(mappingWithTempId)), @@ -212,9 +212,9 @@ export const createUserAsync = (url, user) => async dispatch => { const {data} = await createUserAJAX(url, user) dispatch(syncUser(userWithTempID, data)) } catch (error) { - const message = `${_.upperFirst( - _.toLower(error.data.message) - )}: ${user.scheme}::${user.provider}::${user.name}` + const message = `${_.upperFirst(_.toLower(error.data.message))}: ${ + user.scheme + }::${user.provider}::${user.name}` dispatch(errorThrown(error, message)) // undo optimistic update setTimeout(() => dispatch(removeUser(userWithTempID)), REVERT_STATE_DELAY) @@ -277,9 +277,9 @@ export const createOrganizationAsync = ( const {data} = await createOrganizationAJAX(url, organization) dispatch(syncOrganization(organization, data)) } catch (error) { - const message = `${_.upperFirst( - _.toLower(error.data.message) - )}: ${organization.name}` + const message = `${_.upperFirst(_.toLower(error.data.message))}: ${ + organization.name + }` dispatch(errorThrown(error, message)) // undo optimistic update setTimeout( diff --git a/ui/src/admin/components/AdminTabs.js b/ui/src/admin/components/AdminTabs.js index 8087a1b559..1296be1b21 100644 --- a/ui/src/admin/components/AdminTabs.js +++ b/ui/src/admin/components/AdminTabs.js @@ -89,18 +89,12 @@ const AdminTabs = ({ return ( - {tabs.map((t, i) => - - {tabs[i].type} - - )} + {tabs.map((t, i) => {tabs[i].type})} - {tabs.map((t, i) => - - {t.component} - - )} + {tabs.map((t, i) => ( + {t.component} + ))} ) diff --git a/ui/src/admin/components/DatabaseManager.js b/ui/src/admin/components/DatabaseManager.js index f8e27b34bd..12ee089b79 100644 --- a/ui/src/admin/components/DatabaseManager.js +++ b/ui/src/admin/components/DatabaseManager.js @@ -41,7 +41,7 @@ const DatabaseManager = ({
- {databases.map(db => + {databases.map(db => ( - )} + ))}
) diff --git a/ui/src/admin/components/DatabaseRow.js b/ui/src/admin/components/DatabaseRow.js index 11943c7464..fc5761db24 100644 --- a/ui/src/admin/components/DatabaseRow.js +++ b/ui/src/admin/components/DatabaseRow.js @@ -148,19 +148,21 @@ class DatabaseRow extends Component { return ( - {isNew - ? (this.name = r)} - autoFocus={true} - spellCheck={false} - autoComplete={false} - /> - : name} + {isNew ? ( + (this.name = r)} + autoFocus={true} + spellCheck={false} + autoComplete={false} + /> + ) : ( + name + )} - {isRFDisplayed - ? - (this.replication = r)} - spellCheck={false} - autoComplete={false} - /> - - : null} + {isRFDisplayed ? ( + + (this.replication = r)} + spellCheck={false} + autoComplete={false} + /> + + ) : null} {`${name} `} - {isDefault - ? default - : null} + {isDefault ? ( + default + ) : null} {formattedDuration} - {isRFDisplayed - ? - {replication} - - : null} + {isRFDisplayed ? ( + + {replication} + + ) : null} - {isDeleting - ? - : } + {isDeleting ? ( + + ) : ( + + )} ) diff --git a/ui/src/admin/components/DatabaseTable.js b/ui/src/admin/components/DatabaseTable.js index 8e97bb5a1d..44d5ac7334 100644 --- a/ui/src/admin/components/DatabaseTable.js +++ b/ui/src/admin/components/DatabaseTable.js @@ -57,11 +57,11 @@ const DatabaseTable = ({ Duration - {isRFDisplayed - ? - Replication Factor - - : null} + {isRFDisplayed ? ( + + Replication Factor + + ) : null} diff --git a/ui/src/admin/components/DatabaseTableHeader.js b/ui/src/admin/components/DatabaseTableHeader.js index 75da4b38d8..a18094f136 100644 --- a/ui/src/admin/components/DatabaseTableHeader.js +++ b/ui/src/admin/components/DatabaseTableHeader.js @@ -68,14 +68,14 @@ const Header = ({ > Add Retention Policy - {database.name === '_internal' - ? null - : } + {database.name === '_internal' ? null : ( + + )} ) @@ -112,15 +112,13 @@ const Header = ({ return (
-

- {database.name} -

+

{database.name}

{database.hasOwnProperty('deleteCode') ? deleteConfirmation : buttons}
) } -const EditHeader = ({database, onEdit, onKeyDown, onConfirm, onCancel}) => +const EditHeader = ({database, onEdit, onKeyDown, onConfirm, onCancel}) => (
/>
+) const {func, shape, bool} = PropTypes diff --git a/ui/src/admin/components/EmptyRow.js b/ui/src/admin/components/EmptyRow.js index b8ffe09d48..af21790388 100644 --- a/ui/src/admin/components/EmptyRow.js +++ b/ui/src/admin/components/EmptyRow.js @@ -1,7 +1,7 @@ import React from 'react' import PropTypes from 'prop-types' -const EmptyRow = ({tableName}) => +const EmptyRow = ({tableName}) => (

@@ -9,6 +9,7 @@ const EmptyRow = ({tableName}) =>

+) const {string} = PropTypes diff --git a/ui/src/admin/components/QueriesTable.js b/ui/src/admin/components/QueriesTable.js index 9410851411..637a8741c6 100644 --- a/ui/src/admin/components/QueriesTable.js +++ b/ui/src/admin/components/QueriesTable.js @@ -4,7 +4,7 @@ import PropTypes from 'prop-types' import QueryRow from 'src/admin/components/QueryRow' import {QUERIES_TABLE} from 'src/admin/constants/tableSizing' -const QueriesTable = ({queries, onKillQuery}) => +const QueriesTable = ({queries, onKillQuery}) => (
@@ -20,14 +20,15 @@ const QueriesTable = ({queries, onKillQuery}) => - {queries.map(q => + {queries.map(q => ( - )} + ))}
+) const {arrayOf, func, shape} = PropTypes diff --git a/ui/src/admin/components/QueryRow.js b/ui/src/admin/components/QueryRow.js index 2bb9154d9c..a2f4af12dc 100644 --- a/ui/src/admin/components/QueryRow.js +++ b/ui/src/admin/components/QueryRow.js @@ -37,9 +37,7 @@ class QueryRow extends Component { {database} - - {query} - + {query} - {this.state.confirmingKill - ? - : } + {this.state.confirmingKill ? ( + + ) : ( + + )} ) diff --git a/ui/src/admin/components/RoleRow.js b/ui/src/admin/components/RoleRow.js index 3a5197cfb3..94afb37db8 100644 --- a/ui/src/admin/components/RoleRow.js +++ b/ui/src/admin/components/RoleRow.js @@ -64,41 +64,36 @@ const RoleRow = ({ return ( - - {roleName} + {roleName} + + {allPermissions && allPermissions.length ? ( + ({name}))} + selectedItems={perms.map(name => ({name}))} + label={perms.length ? '' : 'Select Permissions'} + onApply={handleUpdatePermissions} + buttonSize="btn-xs" + buttonColor="btn-primary" + customClass={classnames(`dropdown-${ROLES_TABLE.colPermissions}`, { + 'admin-table--multi-select-empty': !permissions.length, + })} + /> + ) : null} - {allPermissions && allPermissions.length - ? ({name}))} - selectedItems={perms.map(name => ({name}))} - label={perms.length ? '' : 'Select Permissions'} - onApply={handleUpdatePermissions} - buttonSize="btn-xs" - buttonColor="btn-primary" - customClass={classnames( - `dropdown-${ROLES_TABLE.colPermissions}`, - { - 'admin-table--multi-select-empty': !permissions.length, - } - )} - /> - : null} - - - {allUsers && allUsers.length - ? - : null} + {allUsers && allUsers.length ? ( + + ) : null} +}) => (
- {roles.length - ? roles - .filter(r => !r.hidden) - .map(role => - - ) - : } + {roles.length ? ( + roles + .filter(r => !r.hidden) + .map(role => ( + + )) + ) : ( + + )}
+) const {arrayOf, bool, func, shape, string} = PropTypes diff --git a/ui/src/admin/components/UserNewPassword.js b/ui/src/admin/components/UserNewPassword.js index f251ffea00..1375fccb04 100644 --- a/ui/src/admin/components/UserNewPassword.js +++ b/ui/src/admin/components/UserNewPassword.js @@ -22,19 +22,21 @@ class UserNewPassword extends Component { const {user, isNew} = this.props return ( - {isNew - ? - : '--'} + {isNew ? ( + + ) : ( + '--' + )} ) } diff --git a/ui/src/admin/components/UserRow.js b/ui/src/admin/components/UserRow.js index b7cd76af53..d35b69280e 100644 --- a/ui/src/admin/components/UserRow.js +++ b/ui/src/admin/components/UserRow.js @@ -75,9 +75,7 @@ const UserRow = ({ return ( - - {name} - + {name} - {hasRoles - ? - ({name: r.name}))} - label={roles.length ? '' : 'Select Roles'} - onApply={handleUpdateRoles} - buttonSize="btn-xs" - buttonColor="btn-primary" - customClass={classnames(`dropdown-${USERS_TABLE.colRoles}`, { - 'admin-table--multi-select-empty': !roles.length, - })} - /> - - : null} + {hasRoles ? ( + + ({name: r.name}))} + label={roles.length ? '' : 'Select Roles'} + onApply={handleUpdateRoles} + buttonSize="btn-xs" + buttonColor="btn-primary" + customClass={classnames(`dropdown-${USERS_TABLE.colRoles}`, { + 'admin-table--multi-select-empty': !roles.length, + })} + /> + + ) : null} - {allPermissions && allPermissions.length - ? ({name: p}))} - selectedItems={perms.map(p => ({name: p}))} - label={ - permissions && permissions.length ? '' : 'Select Permissions' - } - onApply={handleUpdatePermissions} - buttonSize="btn-xs" - buttonColor="btn-primary" - customClass={classnames( - `dropdown-${USERS_TABLE.colPermissions}`, - { - 'admin-table--multi-select-empty': !permissions.length, - } - )} - /> - : null} + {allPermissions && allPermissions.length ? ( + ({name: p}))} + selectedItems={perms.map(p => ({name: p}))} + label={ + permissions && permissions.length ? '' : 'Select Permissions' + } + onApply={handleUpdatePermissions} + buttonSize="btn-xs" + buttonColor="btn-primary" + customClass={classnames(`dropdown-${USERS_TABLE.colPermissions}`, { + 'admin-table--multi-select-empty': !permissions.length, + })} + /> + ) : null} +}) => (
- {users.length - ? users - .filter(u => !u.hidden) - .map(user => - - ) - : } + {users.length ? ( + users + .filter(u => !u.hidden) + .map(user => ( + + )) + ) : ( + + )}
+) const {arrayOf, bool, func, shape, string} = PropTypes diff --git a/ui/src/admin/components/chronograf/AdminTabs.js b/ui/src/admin/components/chronograf/AdminTabs.js index b40e46fa7a..48ac81fd83 100644 --- a/ui/src/admin/components/chronograf/AdminTabs.js +++ b/ui/src/admin/components/chronograf/AdminTabs.js @@ -51,18 +51,12 @@ const AdminTabs = ({ return ( - {tabs.map((t, i) => - - {tabs[i].type} - - )} + {tabs.map((t, i) => {tabs[i].type})} - {tabs.map((t, i) => - - {t.component} - - )} + {tabs.map((t, i) => ( + {t.component} + ))} ) diff --git a/ui/src/admin/components/chronograf/AllUsersTable.js b/ui/src/admin/components/chronograf/AllUsersTable.js index 9ae1c259a6..974f3f94b1 100644 --- a/ui/src/admin/components/chronograf/AllUsersTable.js +++ b/ui/src/admin/components/chronograf/AllUsersTable.js @@ -133,33 +133,33 @@ class AllUsersTable extends Component { - {users.length - ? users.map(user => - - ) - : - -

No Users to display

- - } - {isCreatingUser - ? ( + - : null} + )) + ) : ( + + +

No Users to display

+ + + )} + {isCreatingUser ? ( + + ) : null} diff --git a/ui/src/admin/components/chronograf/AllUsersTableHeader.js b/ui/src/admin/components/chronograf/AllUsersTableHeader.js index b1ef0d0eca..e76927d62b 100644 --- a/ui/src/admin/components/chronograf/AllUsersTableHeader.js +++ b/ui/src/admin/components/chronograf/AllUsersTableHeader.js @@ -12,10 +12,9 @@ const AllUsersTableHeader = ({ onChangeAuthConfig, }) => { const numUsersString = `${numUsers} User${numUsers === 1 ? '' : 's'}` - const numOrganizationsString = `${numOrganizations} Org${numOrganizations === - 1 - ? '' - : 's'}` + const numOrganizationsString = `${numOrganizations} Org${ + numOrganizations === 1 ? '' : 's' + }` return (
diff --git a/ui/src/admin/components/chronograf/AllUsersTableRow.js b/ui/src/admin/components/chronograf/AllUsersTableRow.js index 757e0a243b..c42203686f 100644 --- a/ui/src/admin/components/chronograf/AllUsersTableRow.js +++ b/ui/src/admin/components/chronograf/AllUsersTableRow.js @@ -47,14 +47,14 @@ const AllUsersTableRow = ({ return ( - {userIsMe - ? - - {user.name} - - : - {user.name} - } + {userIsMe ? ( + + + {user.name} + + ) : ( + {user.name} + )} - - {user.provider} - - - {user.scheme} - + {user.provider} + {user.scheme}
-

- {tableTitle} -

+

{tableTitle}

) diff --git a/ui/src/admin/components/chronograf/OrganizationsTableRow.js b/ui/src/admin/components/chronograf/OrganizationsTableRow.js index 720c2fdaf0..ccd82859f2 100644 --- a/ui/src/admin/components/chronograf/OrganizationsTableRow.js +++ b/ui/src/admin/components/chronograf/OrganizationsTableRow.js @@ -14,19 +14,21 @@ import {DEFAULT_ORG_ID} from 'src/admin/constants/chronografAdmin' import {USER_ROLES} from 'src/admin/constants/chronografAdmin' const OrganizationsTableRowDeleteButton = ({organization, onClickDelete}) => - organization.id === DEFAULT_ORG_ID - ? - : + organization.id === DEFAULT_ORG_ID ? ( + + ) : ( + + ) class OrganizationsTableRow extends Component { constructor(props) { @@ -81,16 +83,18 @@ class OrganizationsTableRow extends Component { return (
- {organization.id === currentOrganization.id - ? - : } + {organization.id === currentOrganization.id ? ( + + ) : ( + + )}
- {isDeleting - ? - : } + {isDeleting ? ( + + ) : ( + + )} ) } diff --git a/ui/src/admin/components/chronograf/ProvidersTable.js b/ui/src/admin/components/chronograf/ProvidersTable.js index b7a4eec3c2..f44ea8c79b 100644 --- a/ui/src/admin/components/chronograf/ProvidersTable.js +++ b/ui/src/admin/components/chronograf/ProvidersTable.js @@ -55,9 +55,7 @@ class ProvidersTable extends Component { return (
-

- {tableTitle} -

+

{tableTitle}

- {mappings.length || isCreatingMap - ?
-
-
Scheme
-
- Provider -
-
- Provider Org -
-
-
- Organization -
-
+ {mappings.length || isCreatingMap ? ( +
+
+
Scheme
+
Provider
+
+ Provider Org
- {mappings.map((mapping, i) => - - )} - {isCreatingMap - ? - : null} +
+
+ Organization +
+
- :
-
-

- Looks like you have no mappings
- New users will not be able to sign up automatically -

- -
-
} + {mappings.map((mapping, i) => ( + + ))} + {isCreatingMap ? ( + + ) : null} +
+ ) : ( +
+
+

+ Looks like you have no mappings
+ New users will not be able to sign up automatically +

+ +
+
+ )}
) } diff --git a/ui/src/admin/components/chronograf/ProvidersTableRow.js b/ui/src/admin/components/chronograf/ProvidersTableRow.js index 8667bc14c7..b550812c30 100644 --- a/ui/src/admin/components/chronograf/ProvidersTableRow.js +++ b/ui/src/admin/components/chronograf/ProvidersTableRow.js @@ -106,20 +106,22 @@ class ProvidersTableRow extends Component { disabled={isDefaultMapping} />
- {isDeleting - ? - : } + {isDeleting ? ( + + ) : ( + + )}
) } diff --git a/ui/src/admin/components/chronograf/UsersTable.js b/ui/src/admin/components/chronograf/UsersTable.js index cea56a139e..6fb3a0893d 100644 --- a/ui/src/admin/components/chronograf/UsersTable.js +++ b/ui/src/admin/components/chronograf/UsersTable.js @@ -71,29 +71,31 @@ class UsersTable extends Component { - {isCreatingUser - ? + ) : null} + {users.length ? ( + users.map(user => ( + - : null} - {users.length - ? users.map(user => - - ) - : - -

No Users to display

- - } + )) + ) : ( + + +

No Users to display

+ + + )}
diff --git a/ui/src/admin/components/chronograf/UsersTableRow.js b/ui/src/admin/components/chronograf/UsersTableRow.js index dbf6aebfef..5edc1cbbe2 100644 --- a/ui/src/admin/components/chronograf/UsersTableRow.js +++ b/ui/src/admin/components/chronograf/UsersTableRow.js @@ -29,14 +29,14 @@ const UsersTableRow = ({ return ( - {userIsMe - ? - - {user.name} - - : - {user.name} - } + {userIsMe ? ( + + + {user.name} + + ) : ( + {user.name} + )} @@ -50,12 +50,8 @@ const UsersTableRow = ({ /> - - {user.provider} - - - {user.scheme} - + {user.provider} + {user.scheme}
- {users - ?
-
- u.isEditing)} - isEditingRoles={roles.some(r => r.isEditing)} - onUpdateRoleUsers={this.handleUpdateRoleUsers} - onUpdateUserRoles={this.handleUpdateUserRoles} - onUpdateUserPassword={this.handleUpdateUserPassword} - onUpdateRolePermissions={this.handleUpdateRolePermissions} - onUpdateUserPermissions={this.handleUpdateUserPermissions} - /> -
+ {users ? ( +
+
+ u.isEditing)} + isEditingRoles={roles.some(r => r.isEditing)} + onUpdateRoleUsers={this.handleUpdateRoleUsers} + onUpdateUserRoles={this.handleUpdateUserRoles} + onUpdateUserPassword={this.handleUpdateUserPassword} + onUpdateRolePermissions={this.handleUpdateRolePermissions} + onUpdateUserPermissions={this.handleUpdateUserPermissions} + />
- :
} +
+ ) : ( +
+ )}
) diff --git a/ui/src/admin/containers/chronograf/AdminChronografPage.js b/ui/src/admin/containers/chronograf/AdminChronografPage.js index 7db66e2a2b..2815bd1fa4 100644 --- a/ui/src/admin/containers/chronograf/AdminChronografPage.js +++ b/ui/src/admin/containers/chronograf/AdminChronografPage.js @@ -5,7 +5,7 @@ import {connect} from 'react-redux' import AdminTabs from 'src/admin/components/chronograf/AdminTabs' import FancyScrollbar from 'shared/components/FancyScrollbar' -const AdminChronografPage = ({me}) => +const AdminChronografPage = ({me}) => (
@@ -22,6 +22,7 @@ const AdminChronografPage = ({me}) =>
+) const {shape, string} = PropTypes diff --git a/ui/src/alerts/apis/index.js b/ui/src/alerts/apis/index.js index 1d4d8c29b7..4c41ce09e0 100644 --- a/ui/src/alerts/apis/index.js +++ b/ui/src/alerts/apis/index.js @@ -3,8 +3,10 @@ import {proxy} from 'utils/queryUrlGenerator' export const getAlerts = (source, timeRange, limit) => proxy({ source, - query: `SELECT host, value, level, alertName FROM alerts WHERE time >= '${timeRange.lower}' AND time <= '${timeRange.upper}' ORDER BY time desc ${limit - ? `LIMIT ${limit}` - : ''}`, + query: `SELECT host, value, level, alertName FROM alerts WHERE time >= '${ + timeRange.lower + }' AND time <= '${timeRange.upper}' ORDER BY time desc ${ + limit ? `LIMIT ${limit}` : '' + }`, db: 'chronograf', }) diff --git a/ui/src/alerts/components/AlertsTable.js b/ui/src/alerts/components/AlertsTable.js index 1e52e39154..f8fbc1f443 100644 --- a/ui/src/alerts/components/AlertsTable.js +++ b/ui/src/alerts/components/AlertsTable.js @@ -79,121 +79,125 @@ class AlertsTable extends Component { this.state.sortDirection ) const {colName, colLevel, colTime, colHost, colValue} = ALERTS_TABLE - return this.props.alerts.length - ?
-
-
- Name -
-
- Level -
-
- Time -
-
- Host -
-
- Value -
+ return this.props.alerts.length ? ( +
+
+
+ Name +
+
+ Level +
+
+ Time +
+
+ Host +
+
+ Value
- { - return ( -
-
- {name} -
-
- -
-
- {new Date(Number(time)).toISOString()} -
-
- - {host} - -
-
- {value} -
-
- ) - })} - />
- : this.renderTableEmpty() + { + return ( +
+
+ {name} +
+
+ +
+
+ {new Date(Number(time)).toISOString()} +
+
+ + {host} + +
+
+ {value} +
+
+ ) + })} + /> +
+ ) : ( + this.renderTableEmpty() + ) } renderTableEmpty() { const {source: {id}, shouldNotBeFilterable} = this.props - return shouldNotBeFilterable - ?
-

- Learn how to configure your first Rule in
- the Getting Started guide -

-
- :
-

There are no Alerts to display

-
-
- Try changing the Time Range or - - Create an Alert Rule - -
-
+ return shouldNotBeFilterable ? ( +
+

+ Learn how to configure your first Rule in
+ the Getting Started guide +

+
+ ) : ( +
+

There are no Alerts to display

+
+
+ Try changing the Time Range or + + Create an Alert Rule + +
+
+ ) } render() { @@ -205,35 +209,33 @@ class AlertsTable extends Component { alertsCount, } = this.props - return shouldNotBeFilterable - ?
- {this.renderTable()} - {limit && alertsCount - ? - : null} -
- :
-
-

- {this.props.alerts.length} Alerts -

- {this.props.alerts.length - ? - : null} -
-
- {this.renderTable()} -
+ return shouldNotBeFilterable ? ( +
+ {this.renderTable()} + {limit && alertsCount ? ( + + ) : null} +
+ ) : ( +
+
+

{this.props.alerts.length} Alerts

+ {this.props.alerts.length ? ( + + ) : null}
+
{this.renderTable()}
+
+ ) } } diff --git a/ui/src/alerts/containers/AlertsApp.js b/ui/src/alerts/containers/AlertsApp.js index e0a5588f67..ed90e01b77 100644 --- a/ui/src/alerts/containers/AlertsApp.js +++ b/ui/src/alerts/containers/AlertsApp.js @@ -30,7 +30,9 @@ class AlertsApp extends Component { alerts: [], timeRange: { upper: moment().format(), - lower: moment().subtract(lowerInSec || oneDayInSec, 'seconds').format(), + lower: moment() + .subtract(lowerInSec || oneDayInSec, 'seconds') + .format(), }, limit: props.limit || 0, // only used if AlertsApp receives a limit prop limitMultiplier: 1, // only used if AlertsApp receives a limit prop @@ -118,17 +120,19 @@ class AlertsApp extends Component { const {source, isWidget, limit} = this.props const {isAlertsMaxedOut, alerts} = this.state - return this.state.hasKapacitor - ? - : + return this.state.hasKapacitor ? ( + + ) : ( + + ) } handleApplyTime = timeRange => { @@ -143,33 +147,33 @@ class AlertsApp extends Component { return
} - return isWidget - ? this.renderSubComponents() - :
-
-
-
-

Alert History

-
-
- - -
+ return isWidget ? ( + this.renderSubComponents() + ) : ( +
+
+
+
+

Alert History

-
-
-
-
-
- {this.renderSubComponents()} -
-
+
+ +
+
+
+
+
{this.renderSubComponents()}
+
+
+
+
+ ) } } diff --git a/ui/src/auth/Login.js b/ui/src/auth/Login.js index 27487689d2..381e946df8 100644 --- a/ui/src/auth/Login.js +++ b/ui/src/auth/Login.js @@ -20,12 +20,12 @@ const Login = ({authData: {auth}}) => { {VERSION} / Time-Series Data Visualization

{auth.links && - auth.links.map(({name, login, label}) => + auth.links.map(({name, login, label}) => ( Log in with {label} - )} + ))}
) diff --git a/ui/src/auth/Purgatory.js b/ui/src/auth/Purgatory.js index 18dd7abe4f..1aa6802437 100644 --- a/ui/src/auth/Purgatory.js +++ b/ui/src/auth/Purgatory.js @@ -65,31 +65,31 @@ class Purgatory extends Component {
-

- {name} -

+

{name}

{subHeading}{' '} {scheme}/{provider}
- {rolesAndOrgs.length - ?
- {rolesAndOrgs.map((rag, i) => - - )} -
- :

You are a Lost Soul

} + {rolesAndOrgs.length ? ( +
+ {rolesAndOrgs.map((rag, i) => ( + + ))} +
+ ) : ( +

You are a Lost Soul

+ )} Log out diff --git a/ui/src/auth/PurgatoryAuthItem.js b/ui/src/auth/PurgatoryAuthItem.js index 88e8eb2232..fd02b2dd2b 100644 --- a/ui/src/auth/PurgatoryAuthItem.js +++ b/ui/src/auth/PurgatoryAuthItem.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types' import {isUserAuthorized, VIEWER_ROLE} from 'src/auth/Authorized' -const PurgatoryAuthItem = ({roleAndOrg, onClickLogin, superAdmin}) => +const PurgatoryAuthItem = ({roleAndOrg, onClickLogin, superAdmin}) => (
} >
-
- {roleAndOrg.organization.name} -
-
- {roleAndOrg.role} -
+
{roleAndOrg.organization.name}
+
{roleAndOrg.role}
- {superAdmin || isUserAuthorized(roleAndOrg.role, VIEWER_ROLE) - ? - : - Contact your Admin
for access -
} + {superAdmin || isUserAuthorized(roleAndOrg.role, VIEWER_ROLE) ? ( + + ) : ( + + Contact your Admin
for access +
+ )}
+) const {bool, func, shape, string} = PropTypes diff --git a/ui/src/dashboards/components/AxesOptions.js b/ui/src/dashboards/components/AxesOptions.js index 4f48a7e037..c0e5019a7d 100644 --- a/ui/src/dashboards/components/AxesOptions.js +++ b/ui/src/dashboards/components/AxesOptions.js @@ -91,9 +91,7 @@ class AxesOptions extends Component { autoHide={false} >
-
- {menuOption} Controls -
+
{menuOption} Controls
diff --git a/ui/src/dashboards/components/CellEditorOverlay.js b/ui/src/dashboards/components/CellEditorOverlay.js index f866f61bb9..e0792ca532 100644 --- a/ui/src/dashboards/components/CellEditorOverlay.js +++ b/ui/src/dashboards/components/CellEditorOverlay.js @@ -318,27 +318,29 @@ class CellEditorOverlay extends Component { isDisplayOptionsTabActive={isDisplayOptionsTabActive} onClickDisplayOptions={this.handleClickDisplayOptionsTab} /> - {isDisplayOptionsTabActive - ? - : } + {isDisplayOptionsTabActive ? ( + + ) : ( + + )}
@@ -346,10 +348,9 @@ class CellEditorOverlay extends Component { } } -const CEOBottom = ({children}) => -
- {children} -
+const CEOBottom = ({children}) => ( +
{children}
+) const {arrayOf, func, node, number, shape, string} = PropTypes diff --git a/ui/src/dashboards/components/Dashboard.js b/ui/src/dashboards/components/Dashboard.js index 4aae1b459e..2d66fd847e 100644 --- a/ui/src/dashboards/components/Dashboard.js +++ b/ui/src/dashboards/components/Dashboard.js @@ -49,37 +49,39 @@ const Dashboard = ({ setScrollTop={setScrollTop} >
- {inPresentationMode - ? null - : } - {cells.length - ? - :
-

This Dashboard has no Cells

- -
} + {inPresentationMode ? null : ( + + )} + {cells.length ? ( + + ) : ( +
+

This Dashboard has no Cells

+ +
+ )}
) diff --git a/ui/src/dashboards/components/DashboardHeader.js b/ui/src/dashboards/components/DashboardHeader.js index 9bd7c94dbb..1808766891 100644 --- a/ui/src/dashboards/components/DashboardHeader.js +++ b/ui/src/dashboards/components/DashboardHeader.js @@ -31,90 +31,85 @@ const DashboardHeader = ({ handleClickPresentationButton, zoomedTimeRange: {zoomedLower, zoomedUpper}, }) => - isHidden - ? null - :
-
-
- {names && names.length > 1 - ? - : null} - {dashboard - ? - {activeDashboard} - - } - > - - - :

- {activeDashboard} -

} -
-
- - - {dashboard - ? - - - : null} - {dashboard - ?
- Template Variables -
- : null} - +
+
+ {names && names.length > 1 ? ( + - -
{activeDashboard} + } > - + + + ) : ( +

{activeDashboard}

+ )} +
+
+ + + {dashboard ? ( + + + + ) : null} + {dashboard ? ( +
+ Template Variables
+ ) : null} + + +
+
+
+ ) const {arrayOf, bool, func, number, shape, string} = PropTypes diff --git a/ui/src/dashboards/components/DashboardHeaderEdit.js b/ui/src/dashboards/components/DashboardHeaderEdit.js index 763c18f0b8..a9a5eaad9e 100644 --- a/ui/src/dashboards/components/DashboardHeaderEdit.js +++ b/ui/src/dashboards/components/DashboardHeaderEdit.js @@ -46,24 +46,24 @@ class DashboardEditHeader extends Component { return (
- {isEditMode - ? (this.inputRef = r)} - /> - :

- {activeDashboard} -

} + {isEditMode ? ( + (this.inputRef = r)} + /> + ) : ( +

{activeDashboard}

+ )}
) } diff --git a/ui/src/dashboards/components/DashboardSwitcher.js b/ui/src/dashboards/components/DashboardSwitcher.js index 26cc036ff2..58153bf86a 100644 --- a/ui/src/dashboards/components/DashboardSwitcher.js +++ b/ui/src/dashboards/components/DashboardSwitcher.js @@ -42,7 +42,7 @@ class DashboardSwitcher extends Component {
    - {sorted.map(({name, link}) => + {sorted.map(({name, link}) => ( - )} + ))}
) } } -const NameLink = ({name, link, activeName, onClose}) => +const NameLink = ({name, link, activeName, onClose}) => (
  • {name}
  • +) const {arrayOf, func, shape, string} = PropTypes diff --git a/ui/src/dashboards/components/DashboardsHeader.js b/ui/src/dashboards/components/DashboardsHeader.js index d66b61f5eb..d0e1bcb55b 100644 --- a/ui/src/dashboards/components/DashboardsHeader.js +++ b/ui/src/dashboards/components/DashboardsHeader.js @@ -2,7 +2,7 @@ import React from 'react' import SourceIndicator from 'shared/components/SourceIndicator' -const DashboardsHeader = () => +const DashboardsHeader = () => (
    @@ -13,5 +13,6 @@ const DashboardsHeader = () =>
    +) export default DashboardsHeader diff --git a/ui/src/dashboards/components/DashboardsPageContents.js b/ui/src/dashboards/components/DashboardsPageContents.js index 35eeb45eb4..79c91095ad 100644 --- a/ui/src/dashboards/components/DashboardsPageContents.js +++ b/ui/src/dashboards/components/DashboardsPageContents.js @@ -48,9 +48,7 @@ class DashboardsPageContents extends Component {
    -

    - {tableHeader} -

    +

    {tableHeader}

    +const AuthorizedEmptyState = ({onCreateDashboard}) => (

    Looks like you don’t have any dashboards @@ -21,6 +21,7 @@ const AuthorizedEmptyState = ({onCreateDashboard}) => Create Dashboard

    +) const unauthorizedEmptyState = (
    @@ -34,52 +35,56 @@ const DashboardsTable = ({ onCreateDashboard, dashboardLink, }) => { - return dashboards && dashboards.length - ? - - - - -
    NameTemplate Variables + return dashboards && dashboards.length ? ( + + + + + + + + + {_.sortBy(dashboards, d => d.name.toLowerCase()).map(dashboard => ( + + + + } + > + + - - - {_.sortBy(dashboards, d => d.name.toLowerCase()).map(dashboard => - - - - } - > - - - - )} - -
    NameTemplate Variables +
    + + {dashboard.name} + + + {dashboard.templates.length ? ( + dashboard.templates.map(tv => ( + + {tv.tempVar} + + )) + ) : ( + None + )} +
    - - {dashboard.name} - - - {dashboard.templates.length - ? dashboard.templates.map(tv => - - {tv.tempVar} - - ) - : None} -
    - : - - + ))} + +
    + ) : ( + + + + ) } const {arrayOf, func, shape, string} = PropTypes diff --git a/ui/src/dashboards/components/DisplayOptionsInput.js b/ui/src/dashboards/components/DisplayOptionsInput.js index 4f95f78a79..1602a060dc 100644 --- a/ui/src/dashboards/components/DisplayOptionsInput.js +++ b/ui/src/dashboards/components/DisplayOptionsInput.js @@ -9,11 +9,9 @@ const DisplayOptionsInput = ({ labelText, colWidth, placeholder, -}) => +}) => (
    - +
    +) const {func, string} = PropTypes diff --git a/ui/src/dashboards/components/GaugeOptions.js b/ui/src/dashboards/components/GaugeOptions.js index eb3881517e..3197464465 100644 --- a/ui/src/dashboards/components/GaugeOptions.js +++ b/ui/src/dashboards/components/GaugeOptions.js @@ -173,7 +173,7 @@ class GaugeOptions extends Component { > Add Threshold - {gaugeColors.map(color => + {gaugeColors.map(color => ( - )} + ))}
    diff --git a/ui/src/dashboards/components/GraphOptionsTextWrapping.js b/ui/src/dashboards/components/GraphOptionsTextWrapping.js index 601d1c16ef..37476fd44c 100644 --- a/ui/src/dashboards/components/GraphOptionsTextWrapping.js +++ b/ui/src/dashboards/components/GraphOptionsTextWrapping.js @@ -16,25 +16,25 @@ const GraphOptionsTextWrapping = ({
    • Truncate
    • Wrap
    • Single Line diff --git a/ui/src/dashboards/components/GraphOptionsTimeAxis.js b/ui/src/dashboards/components/GraphOptionsTimeAxis.js index e92e3ac295..01171d6ce6 100644 --- a/ui/src/dashboards/components/GraphOptionsTimeAxis.js +++ b/ui/src/dashboards/components/GraphOptionsTimeAxis.js @@ -1,7 +1,7 @@ import React from 'react' import PropTypes from 'prop-types' -const GraphOptionsTimeAxis = ({verticalTimeAxis, onToggleVerticalTimeAxis}) => +const GraphOptionsTimeAxis = ({verticalTimeAxis, onToggleVerticalTimeAxis}) => (
        @@ -19,6 +19,7 @@ const GraphOptionsTimeAxis = ({verticalTimeAxis, onToggleVerticalTimeAxis}) =>
      +) const {bool, func} = PropTypes diff --git a/ui/src/dashboards/components/GraphTypeSelector.js b/ui/src/dashboards/components/GraphTypeSelector.js index e33c01ed6d..162361ff7b 100644 --- a/ui/src/dashboards/components/GraphTypeSelector.js +++ b/ui/src/dashboards/components/GraphTypeSelector.js @@ -23,7 +23,7 @@ const GraphTypeSelector = ({type, handleChangeCellType}) => {
      Visualization Type
      - {GRAPH_TYPES.map(graphType => + {GRAPH_TYPES.map(graphType => (
      { >
      {graphType.graphic} -

      - {graphType.menuOption} -

      +

      {graphType.menuOption}

      - )} + ))}
      diff --git a/ui/src/dashboards/components/OverlayControls.js b/ui/src/dashboards/components/OverlayControls.js index 30b23170a2..bc28525a3b 100644 --- a/ui/src/dashboards/components/OverlayControls.js +++ b/ui/src/dashboards/components/OverlayControls.js @@ -15,7 +15,7 @@ const OverlayControls = ({ onSetQuerySource, isDisplayOptionsTabActive, onClickDisplayOptions, -}) => +}) => (
    +) const {arrayOf, bool, func, shape, string} = PropTypes diff --git a/ui/src/dashboards/components/QueryMaker.js b/ui/src/dashboards/components/QueryMaker.js index b50b68522b..0658a4df40 100644 --- a/ui/src/dashboards/components/QueryMaker.js +++ b/ui/src/dashboards/components/QueryMaker.js @@ -26,7 +26,7 @@ const QueryMaker = ({ activeQueryIndex, initialGroupByTime, setActiveQueryIndex, -}) => +}) => (
    - {activeQuery && activeQuery.id - ?
    - - -
    - : } + {activeQuery && activeQuery.id ? ( +
    + + +
    + ) : ( + + )}
    +) const {arrayOf, func, number, shape, string} = PropTypes diff --git a/ui/src/dashboards/components/QueryTextArea.js b/ui/src/dashboards/components/QueryTextArea.js index 65845b5579..e16bc25065 100644 --- a/ui/src/dashboards/components/QueryTextArea.js +++ b/ui/src/dashboards/components/QueryTextArea.js @@ -215,15 +215,15 @@ class QueryTextArea extends Component {
    - {isTemplating - ? - : null} + {isTemplating ? ( + + ) : null}
    diff --git a/ui/src/dashboards/components/SourceSelector.js b/ui/src/dashboards/components/SourceSelector.js index 2137aba0c4..0a5487c3e7 100644 --- a/ui/src/dashboards/components/SourceSelector.js +++ b/ui/src/dashboards/components/SourceSelector.js @@ -3,20 +3,22 @@ import PropTypes from 'prop-types' import Dropdown from 'shared/components/Dropdown' const SourceSelector = ({sources = [], selected, onSetQuerySource, queries}) => - sources.length > 1 && queries.length - ?
    -

    Source:

    - -
    - :
    + sources.length > 1 && queries.length ? ( +
    +

    Source:

    + +
    + ) : ( +
    + ) const {array, arrayOf, func, shape, string} = PropTypes diff --git a/ui/src/dashboards/components/Tabber.js b/ui/src/dashboards/components/Tabber.js index ae9f09591d..1bc02313c5 100644 --- a/ui/src/dashboards/components/Tabber.js +++ b/ui/src/dashboards/components/Tabber.js @@ -2,23 +2,23 @@ import React from 'react' import PropTypes from 'prop-types' import QuestionMarkTooltip from 'src/shared/components/QuestionMarkTooltip' -export const Tabber = ({labelText, children, tipID, tipContent}) => +export const Tabber = ({labelText, children, tipID, tipContent}) => (
    -
      - {children} -
    +
      {children}
    +) -export const Tab = ({isActive, onClickTab, text}) => +export const Tab = ({isActive, onClickTab, text}) => (
  • {text}
  • +) const {bool, func, node, string} = PropTypes diff --git a/ui/src/dashboards/components/TemplateControlBar.js b/ui/src/dashboards/components/TemplateControlBar.js index a1de8bba31..3c08b74698 100644 --- a/ui/src/dashboards/components/TemplateControlBar.js +++ b/ui/src/dashboards/components/TemplateControlBar.js @@ -16,67 +16,67 @@ const TemplateControlBar = ({ templates, onSelectTemplate, onOpenTemplateManager, -}) => +}) => (
    - {templates.length - ? templates.map(({id, values, tempVar}) => { - const items = values.map(value => ({...value, text: value.value})) - const itemValues = values.map(value => value.value) - const selectedItem = items.find(item => item.selected) || items[0] - const selectedText = selectedItem && selectedItem.text - let customDropdownWidth = 0 - if (itemValues.length > 1) { - const longest = itemValues.reduce( - (a, b) => (a.length > b.length ? a : b) - ) - const longestLengthPixels = - calculateSize(longest, { - font: 'Monospace', - fontSize: '12px', - }).width + tempVarDropdownPadding - - if ( - longestLengthPixels > minTempVarDropdownWidth && - longestLengthPixels < maxTempVarDropdownWidth - ) { - customDropdownWidth = longestLengthPixels - } else if (longestLengthPixels > maxTempVarDropdownWidth) { - customDropdownWidth = maxTempVarDropdownWidth - } - } - - // TODO: change Dropdown to a MultiSelectDropdown, `selected` to - // the full array, and [item] to all `selected` values when we update - // this component to support multiple values - return ( -
    0 - ? {minWidth: customDropdownWidth} - : null - } - > - - -
    + {templates.length ? ( + templates.map(({id, values, tempVar}) => { + const items = values.map(value => ({...value, text: value.value})) + const itemValues = values.map(value => value.value) + const selectedItem = items.find(item => item.selected) || items[0] + const selectedText = selectedItem && selectedItem.text + let customDropdownWidth = 0 + if (itemValues.length > 1) { + const longest = itemValues.reduce( + (a, b) => (a.length > b.length ? a : b) ) - }) - :
    - This dashboard does not have any Template Variables -
    } + const longestLengthPixels = + calculateSize(longest, { + font: 'Monospace', + fontSize: '12px', + }).width + tempVarDropdownPadding + + if ( + longestLengthPixels > minTempVarDropdownWidth && + longestLengthPixels < maxTempVarDropdownWidth + ) { + customDropdownWidth = longestLengthPixels + } else if (longestLengthPixels > maxTempVarDropdownWidth) { + customDropdownWidth = maxTempVarDropdownWidth + } + } + + // TODO: change Dropdown to a MultiSelectDropdown, `selected` to + // the full array, and [item] to all `selected` values when we update + // this component to support multiple values + return ( +
    0 + ? {minWidth: customDropdownWidth} + : null + } + > + + +
    + ) + }) + ) : ( +
    + This dashboard does not have any Template Variables +
    + )}
    +) const {arrayOf, bool, func, shape, string} = PropTypes diff --git a/ui/src/dashboards/components/Threshold.js b/ui/src/dashboards/components/Threshold.js index 8f34dbf1c6..b4e1e237f0 100644 --- a/ui/src/dashboards/components/Threshold.js +++ b/ui/src/dashboards/components/Threshold.js @@ -78,17 +78,15 @@ class Threshold extends Component { return (
    -
    - {label} -
    - {canBeDeleted - ? - : null} +
    {label}
    + {canBeDeleted ? ( + + ) : null} - {isEditing - ? - :
    - {name} -
    } + {isEditing ? ( + + ) : ( +
    + {name} +
    + )}
    ) } diff --git a/ui/src/dashboards/components/template_variables/Manager.js b/ui/src/dashboards/components/template_variables/Manager.js index 73e9383b0f..a52aa11a6b 100644 --- a/ui/src/dashboards/components/template_variables/Manager.js +++ b/ui/src/dashboards/components/template_variables/Manager.js @@ -19,7 +19,7 @@ const TemplateVariableManager = ({ tempVarAlreadyExists, onSaveTemplatesSuccess, onEditTemplateVariables, -}) => +}) => (
    @@ -56,6 +56,7 @@ const TemplateVariableManager = ({ />
    +) class TemplateVariableManagerWrapper extends Component { constructor(props) { diff --git a/ui/src/dashboards/components/template_variables/Row.js b/ui/src/dashboards/components/template_variables/Row.js index f75c8afdfe..7d6f28ad61 100644 --- a/ui/src/dashboards/components/template_variables/Row.js +++ b/ui/src/dashboards/components/template_variables/Row.js @@ -45,7 +45,7 @@ const TemplateVariableRow = ({ onSubmit, onErrorThrown, onDeleteTempVar, -}) => +}) => (
    +) class RowWrapper extends Component { constructor(props) { diff --git a/ui/src/dashboards/components/template_variables/Table.js b/ui/src/dashboards/components/template_variables/Table.js index f1a81c7e8b..252d0f72a2 100644 --- a/ui/src/dashboards/components/template_variables/Table.js +++ b/ui/src/dashboards/components/template_variables/Table.js @@ -10,36 +10,39 @@ const TemplateVariableTable = ({ onRunQueryFailure, onDelete, tempVarAlreadyExists, -}) => +}) => (
    - {templates.length - ?
    -
    -
    Variable
    -
    Type
    -
    Definition / Values
    -
    -
    -
    - {templates.map(t => - - )} -
    + {templates.length ? ( +
    +
    +
    Variable
    +
    Type
    +
    Definition / Values
    +
    - :
    -

    - You have no Template Variables, why not create one? -

    -
    } +
    + {templates.map(t => ( + + ))} +
    +
    + ) : ( +
    +

    + You have no Template Variables, why not create one? +

    +
    + )}
    +) const {arrayOf, bool, func, shape, string} = PropTypes diff --git a/ui/src/dashboards/components/template_variables/TableInput.js b/ui/src/dashboards/components/template_variables/TableInput.js index 908817a49f..ebc50d612f 100644 --- a/ui/src/dashboards/components/template_variables/TableInput.js +++ b/ui/src/dashboards/components/template_variables/TableInput.js @@ -8,26 +8,26 @@ const TableInput = ({ onStartEdit, autoFocusTarget, }) => { - return isEditing - ?
    - -
    - :
    -
    - {defaultValue} -
    -
    + return isEditing ? ( +
    + +
    + ) : ( +
    +
    {defaultValue}
    +
    + ) } const {bool, func, string} = PropTypes diff --git a/ui/src/dashboards/components/template_variables/TemplateQueryBuilder.js b/ui/src/dashboards/components/template_variables/TemplateQueryBuilder.js index ac6fcb11a5..fb79e2b454 100644 --- a/ui/src/dashboards/components/template_variables/TemplateQueryBuilder.js +++ b/ui/src/dashboards/components/template_variables/TemplateQueryBuilder.js @@ -46,15 +46,17 @@ const TemplateQueryBuilder = ({ onErrorThrown={onErrorThrown} /> FROM - {selectedDatabase - ? - :
    No database selected
    } + {selectedDatabase ? ( + + ) : ( +
    No database selected
    + )}
    ) case 'tagValues': @@ -68,26 +70,30 @@ const TemplateQueryBuilder = ({ onErrorThrown={onErrorThrown} /> FROM - {selectedDatabase - ? - : 'Pick a DB'} + {selectedDatabase ? ( + + ) : ( + 'Pick a DB' + )} WITH KEY = - {selectedMeasurement - ? - : 'Pick a Tag Key'} + {selectedMeasurement ? ( + + ) : ( + 'Pick a Tag Key' + )}
    ) default: diff --git a/ui/src/dashboards/containers/DashboardPage.js b/ui/src/dashboards/containers/DashboardPage.js index 64350b1657..19b85e6a26 100644 --- a/ui/src/dashboards/containers/DashboardPage.js +++ b/ui/src/dashboards/containers/DashboardPage.js @@ -356,35 +356,35 @@ class DashboardPage extends Component { return (
    - {isTemplating - ? - - - : null} - {selectedCell - ? + - : null} + + ) : null} + {selectedCell ? ( + + ) : null} - {dashboard - ? - : null} + {dashboard ? ( + + ) : null}
    ) } diff --git a/ui/src/data_explorer/components/FieldListItem.js b/ui/src/data_explorer/components/FieldListItem.js index be8690a0ec..38ffad0785 100644 --- a/ui/src/data_explorer/components/FieldListItem.js +++ b/ui/src/data_explorer/components/FieldListItem.js @@ -90,27 +90,27 @@ class FieldListItem extends Component {
    {fieldName} - {isSelected - ?
    - {fieldFuncsLabel} -
    - : null} + {isSelected ? ( +
    + {fieldFuncsLabel} +
    + ) : null}
    - {isSelected && isOpen - ? - : null} + {isSelected && isOpen ? ( + + ) : null}
    ) } diff --git a/ui/src/data_explorer/components/GroupByTimeDropdown.js b/ui/src/data_explorer/components/GroupByTimeDropdown.js index 7ca6856a85..3bc0614dee 100644 --- a/ui/src/data_explorer/components/GroupByTimeDropdown.js +++ b/ui/src/data_explorer/components/GroupByTimeDropdown.js @@ -19,7 +19,7 @@ const GroupByTimeDropdown = ({ selected, onChooseGroupByTime, location: {pathname}, -}) => +}) => (
    +) const {func, string, shape} = PropTypes diff --git a/ui/src/data_explorer/components/NoDataNodeError.js b/ui/src/data_explorer/components/NoDataNodeError.js index 51eade84f4..3410e71f4c 100644 --- a/ui/src/data_explorer/components/NoDataNodeError.js +++ b/ui/src/data_explorer/components/NoDataNodeError.js @@ -8,12 +8,8 @@ const NoDataNodeError = React.createClass({ render() { return ( - - {errorCopy.noData.head} - - - {errorCopy.noData.body} - + {errorCopy.noData.head} + {errorCopy.noData.body} ) }, diff --git a/ui/src/data_explorer/components/QueryMaker.js b/ui/src/data_explorer/components/QueryMaker.js index c4b0275924..d3d17cb316 100644 --- a/ui/src/data_explorer/components/QueryMaker.js +++ b/ui/src/data_explorer/components/QueryMaker.js @@ -14,7 +14,7 @@ const QueryMaker = ({ timeRange, activeQuery, initialGroupByTime, -}) => +}) => (
    +) const {func, shape, string} = PropTypes diff --git a/ui/src/data_explorer/components/QueryMakerTab.js b/ui/src/data_explorer/components/QueryMakerTab.js index 3c65d327e6..51ed74a23f 100644 --- a/ui/src/data_explorer/components/QueryMakerTab.js +++ b/ui/src/data_explorer/components/QueryMakerTab.js @@ -31,9 +31,7 @@ const QueryMakerTab = React.createClass({ })} onClick={this.handleSelect} > - + - {series.length < maximumTabsCount - ?
    - {series.map((s, i) => - - )} -
    - : ({ - ...s, - text: this.makeTabName(s), - index, - }))} - onChoose={this.handleClickDropdown} - selected={this.makeTabName(series[activeSeriesIndex])} - buttonSize="btn-xs" - />} + {series.length < maximumTabsCount ? ( +
    + {series.map((s, i) => ( + + ))} +
    + ) : ( + ({ + ...s, + text: this.makeTabName(s), + index, + }))} + onChoose={this.handleClickDropdown} + selected={this.makeTabName(series[activeSeriesIndex])} + buttonSize="btn-xs" + /> + )}
    - {(columns && !columns.length) || (values && !values.length) - ?
    This series is empty
    - : - {columns.map((columnName, colIndex) => { - return ( - - {columnName} - - } - cell={this.handleCustomCell(columnName, values, colIndex)} - width={columnWidths[columnName] || width} - minWidth={minWidth} - /> - ) - })} -
    } + {(columns && !columns.length) || (values && !values.length) ? ( +
    This series is empty
    + ) : ( + + {columns.map((columnName, colIndex) => { + return ( + {columnName}} + cell={this.handleCustomCell(columnName, values, colIndex)} + width={columnWidths[columnName] || width} + minWidth={minWidth} + /> + ) + })} +
    + )}
    ) diff --git a/ui/src/data_explorer/components/TableTabItem.js b/ui/src/data_explorer/components/TableTabItem.js index 97ef431dc1..3cbcec0c86 100644 --- a/ui/src/data_explorer/components/TableTabItem.js +++ b/ui/src/data_explorer/components/TableTabItem.js @@ -2,13 +2,14 @@ import React from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' -const TableTabItem = ({name, index, onClickTab, isActive}) => +const TableTabItem = ({name, index, onClickTab, isActive}) => (
    {name}
    +) const {bool, func, number, string} = PropTypes diff --git a/ui/src/data_explorer/components/VisHeader.js b/ui/src/data_explorer/components/VisHeader.js index e602d7bfa2..057f11086c 100644 --- a/ui/src/data_explorer/components/VisHeader.js +++ b/ui/src/data_explorer/components/VisHeader.js @@ -27,32 +27,33 @@ const getCSV = (query, errorThrown) => async () => { } } -const VisHeader = ({views, view, onToggleView, query, errorThrown}) => +const VisHeader = ({views, view, onToggleView, query, errorThrown}) => (
    - {views.length - ?
      - {views.map(v => -
    • - {_.upperFirst(v)} -
    • - )} -
    - : null} - {query - ?
    - - .csv -
    - : null} + {views.length ? ( +
      + {views.map(v => ( +
    • + {_.upperFirst(v)} +
    • + ))} +
    + ) : null} + {query ? ( +
    + + .csv +
    + ) : null}
    +) const {arrayOf, func, shape, string} = PropTypes diff --git a/ui/src/data_explorer/components/WriteDataBody.js b/ui/src/data_explorer/components/WriteDataBody.js index 5b0f730b15..3dfc429df5 100644 --- a/ui/src/data_explorer/components/WriteDataBody.js +++ b/ui/src/data_explorer/components/WriteDataBody.js @@ -15,70 +15,75 @@ const WriteDataBody = ({ fileInput, handleFileOpen, isUploading, -}) => +}) => (
    - {isManual - ?