chore(prettier): require arrow parens in js files
parent
6b1d09ad08
commit
9380c1583d
|
@ -44,7 +44,7 @@ export const loadOrganizations = ({organizations}) => ({
|
|||
},
|
||||
})
|
||||
|
||||
export const addUser = user => ({
|
||||
export const addUser = (user) => ({
|
||||
type: 'CHRONOGRAF_ADD_USER',
|
||||
payload: {
|
||||
user,
|
||||
|
@ -67,14 +67,14 @@ export const syncUser = (staleUser, syncedUser) => ({
|
|||
},
|
||||
})
|
||||
|
||||
export const removeUser = user => ({
|
||||
export const removeUser = (user) => ({
|
||||
type: 'CHRONOGRAF_REMOVE_USER',
|
||||
payload: {
|
||||
user,
|
||||
},
|
||||
})
|
||||
|
||||
export const addOrganization = organization => ({
|
||||
export const addOrganization = (organization) => ({
|
||||
type: 'CHRONOGRAF_ADD_ORGANIZATION',
|
||||
payload: {
|
||||
organization,
|
||||
|
@ -97,7 +97,7 @@ export const syncOrganization = (staleOrganization, syncedOrganization) => ({
|
|||
},
|
||||
})
|
||||
|
||||
export const removeOrganization = organization => ({
|
||||
export const removeOrganization = (organization) => ({
|
||||
type: 'CHRONOGRAF_REMOVE_ORGANIZATION',
|
||||
payload: {
|
||||
organization,
|
||||
|
@ -119,14 +119,14 @@ export const updateMapping = (staleMapping, updatedMapping) => ({
|
|||
},
|
||||
})
|
||||
|
||||
export const addMapping = mapping => ({
|
||||
export const addMapping = (mapping) => ({
|
||||
type: 'CHRONOGRAF_ADD_MAPPING',
|
||||
payload: {
|
||||
mapping,
|
||||
},
|
||||
})
|
||||
|
||||
export const removeMapping = mapping => ({
|
||||
export const removeMapping = (mapping) => ({
|
||||
type: 'CHRONOGRAF_REMOVE_MAPPING',
|
||||
payload: {
|
||||
mapping,
|
||||
|
@ -134,7 +134,7 @@ export const removeMapping = mapping => ({
|
|||
})
|
||||
|
||||
// async actions (thunks)
|
||||
export const loadUsersAsync = url => async dispatch => {
|
||||
export const loadUsersAsync = (url) => async (dispatch) => {
|
||||
try {
|
||||
const {data} = await getUsersAJAX(url)
|
||||
dispatch(loadUsers(data))
|
||||
|
@ -143,7 +143,7 @@ export const loadUsersAsync = url => async dispatch => {
|
|||
}
|
||||
}
|
||||
|
||||
export const loadOrganizationsAsync = url => async dispatch => {
|
||||
export const loadOrganizationsAsync = (url) => async (dispatch) => {
|
||||
try {
|
||||
const {data} = await getOrganizationsAJAX(url)
|
||||
dispatch(loadOrganizations(data))
|
||||
|
@ -152,7 +152,7 @@ export const loadOrganizationsAsync = url => async dispatch => {
|
|||
}
|
||||
}
|
||||
|
||||
export const loadMappingsAsync = () => async dispatch => {
|
||||
export const loadMappingsAsync = () => async (dispatch) => {
|
||||
try {
|
||||
const {data} = await getMappingsAJAX()
|
||||
dispatch(loadMappings(data))
|
||||
|
@ -161,7 +161,7 @@ export const loadMappingsAsync = () => async dispatch => {
|
|||
}
|
||||
}
|
||||
|
||||
export const createMappingAsync = (url, mapping) => async dispatch => {
|
||||
export const createMappingAsync = (url, mapping) => async (dispatch) => {
|
||||
const mappingWithTempId = {...mapping, _tempID: uuid.v4()}
|
||||
dispatch(addMapping(mappingWithTempId))
|
||||
try {
|
||||
|
@ -179,7 +179,7 @@ export const createMappingAsync = (url, mapping) => async dispatch => {
|
|||
}
|
||||
}
|
||||
|
||||
export const deleteMappingAsync = mapping => async dispatch => {
|
||||
export const deleteMappingAsync = (mapping) => async (dispatch) => {
|
||||
dispatch(removeMapping(mapping))
|
||||
try {
|
||||
await deleteMappingAJAX(mapping)
|
||||
|
@ -190,10 +190,9 @@ export const deleteMappingAsync = mapping => async dispatch => {
|
|||
}
|
||||
}
|
||||
|
||||
export const updateMappingAsync = (
|
||||
staleMapping,
|
||||
updatedMapping
|
||||
) => async dispatch => {
|
||||
export const updateMappingAsync = (staleMapping, updatedMapping) => async (
|
||||
dispatch
|
||||
) => {
|
||||
dispatch(updateMapping(staleMapping, updatedMapping))
|
||||
try {
|
||||
await updateMappingAJAX(updatedMapping)
|
||||
|
@ -203,7 +202,7 @@ export const updateMappingAsync = (
|
|||
}
|
||||
}
|
||||
|
||||
export const createUserAsync = (url, user) => async dispatch => {
|
||||
export const createUserAsync = (url, user) => async (dispatch) => {
|
||||
// temp uuid is added to be able to disambiguate a created user that has the
|
||||
// same scheme, provider, and name as an existing user
|
||||
const userWithTempID = {...user, _tempID: uuid.v4()}
|
||||
|
@ -221,11 +220,9 @@ export const createUserAsync = (url, user) => async dispatch => {
|
|||
}
|
||||
}
|
||||
|
||||
export const updateUserAsync = (
|
||||
user,
|
||||
updatedUser,
|
||||
successMessage
|
||||
) => async dispatch => {
|
||||
export const updateUserAsync = (user, updatedUser, successMessage) => async (
|
||||
dispatch
|
||||
) => {
|
||||
dispatch(updateUser(user, updatedUser))
|
||||
try {
|
||||
// currently the request will be rejected if name, provider, or scheme, or
|
||||
|
@ -249,10 +246,9 @@ export const updateUserAsync = (
|
|||
}
|
||||
}
|
||||
|
||||
export const deleteUserAsync = (
|
||||
user,
|
||||
{isAbsoluteDelete} = {}
|
||||
) => async dispatch => {
|
||||
export const deleteUserAsync = (user, {isAbsoluteDelete} = {}) => async (
|
||||
dispatch
|
||||
) => {
|
||||
dispatch(removeUser(user))
|
||||
try {
|
||||
await deleteUserAJAX(user)
|
||||
|
@ -263,10 +259,9 @@ export const deleteUserAsync = (
|
|||
}
|
||||
}
|
||||
|
||||
export const createOrganizationAsync = (
|
||||
url,
|
||||
organization
|
||||
) => async dispatch => {
|
||||
export const createOrganizationAsync = (url, organization) => async (
|
||||
dispatch
|
||||
) => {
|
||||
// temp uuid is added to be able to disambiguate a created organization with
|
||||
// the same name as an existing organization
|
||||
const organizationWithTempID = {...organization, _tempID: uuid.v4()}
|
||||
|
@ -290,7 +285,7 @@ export const createOrganizationAsync = (
|
|||
export const updateOrganizationAsync = (
|
||||
organization,
|
||||
updatedOrganization
|
||||
) => async dispatch => {
|
||||
) => async (dispatch) => {
|
||||
dispatch(renameOrganization(organization, updatedOrganization.name))
|
||||
try {
|
||||
const {data} = await updateOrganizationAJAX(updatedOrganization)
|
||||
|
@ -303,7 +298,7 @@ export const updateOrganizationAsync = (
|
|||
}
|
||||
}
|
||||
|
||||
export const deleteOrganizationAsync = organization => async dispatch => {
|
||||
export const deleteOrganizationAsync = (organization) => async (dispatch) => {
|
||||
dispatch(removeOrganization(organization))
|
||||
try {
|
||||
await deleteOrganizationAJAX(organization)
|
||||
|
|
|
@ -77,7 +77,7 @@ export const loadPermissions = ({permissions}) => ({
|
|||
},
|
||||
})
|
||||
|
||||
export const loadDatabases = databases => ({
|
||||
export const loadDatabases = (databases) => ({
|
||||
type: 'INFLUXDB_LOAD_DATABASES',
|
||||
payload: {
|
||||
databases,
|
||||
|
@ -96,7 +96,7 @@ export const addDatabase = () => ({
|
|||
type: 'INFLUXDB_ADD_DATABASE',
|
||||
})
|
||||
|
||||
export const addRetentionPolicy = database => ({
|
||||
export const addRetentionPolicy = (database) => ({
|
||||
type: 'INFLUXDB_ADD_RETENTION_POLICY',
|
||||
payload: {
|
||||
database,
|
||||
|
@ -160,21 +160,21 @@ export const editDatabase = (database, updates) => ({
|
|||
},
|
||||
})
|
||||
|
||||
export const killQuery = queryID => ({
|
||||
export const killQuery = (queryID) => ({
|
||||
type: 'INFLUXDB_KILL_QUERY',
|
||||
payload: {
|
||||
queryID,
|
||||
},
|
||||
})
|
||||
|
||||
export const setQueryToKill = queryIDToKill => ({
|
||||
export const setQueryToKill = (queryIDToKill) => ({
|
||||
type: 'INFLUXDB_SET_QUERY_TO_KILL',
|
||||
payload: {
|
||||
queryIDToKill,
|
||||
},
|
||||
})
|
||||
|
||||
export const loadQueries = queries => ({
|
||||
export const loadQueries = (queries) => ({
|
||||
type: 'INFLUXDB_LOAD_QUERIES',
|
||||
payload: {
|
||||
queries,
|
||||
|
@ -182,7 +182,7 @@ export const loadQueries = queries => ({
|
|||
})
|
||||
|
||||
// TODO: change to 'removeUser'
|
||||
export const deleteUser = user => ({
|
||||
export const deleteUser = (user) => ({
|
||||
type: 'INFLUXDB_DELETE_USER',
|
||||
payload: {
|
||||
user,
|
||||
|
@ -190,14 +190,14 @@ export const deleteUser = user => ({
|
|||
})
|
||||
|
||||
// TODO: change to 'removeRole'
|
||||
export const deleteRole = role => ({
|
||||
export const deleteRole = (role) => ({
|
||||
type: 'INFLUXDB_DELETE_ROLE',
|
||||
payload: {
|
||||
role,
|
||||
},
|
||||
})
|
||||
|
||||
export const removeDatabase = database => ({
|
||||
export const removeDatabase = (database) => ({
|
||||
type: 'INFLUXDB_REMOVE_DATABASE',
|
||||
payload: {
|
||||
database,
|
||||
|
@ -212,28 +212,28 @@ export const removeRetentionPolicy = (database, retentionPolicy) => ({
|
|||
},
|
||||
})
|
||||
|
||||
export const filterUsers = text => ({
|
||||
export const filterUsers = (text) => ({
|
||||
type: 'INFLUXDB_FILTER_USERS',
|
||||
payload: {
|
||||
text,
|
||||
},
|
||||
})
|
||||
|
||||
export const filterRoles = text => ({
|
||||
export const filterRoles = (text) => ({
|
||||
type: 'INFLUXDB_FILTER_ROLES',
|
||||
payload: {
|
||||
text,
|
||||
},
|
||||
})
|
||||
|
||||
export const addDatabaseDeleteCode = database => ({
|
||||
export const addDatabaseDeleteCode = (database) => ({
|
||||
type: 'INFLUXDB_ADD_DATABASE_DELETE_CODE',
|
||||
payload: {
|
||||
database,
|
||||
},
|
||||
})
|
||||
|
||||
export const removeDatabaseDeleteCode = database => ({
|
||||
export const removeDatabaseDeleteCode = (database) => ({
|
||||
type: 'INFLUXDB_REMOVE_DATABASE_DELETE_CODE',
|
||||
payload: {
|
||||
database,
|
||||
|
@ -269,7 +269,7 @@ export const editRetentionPolicyFailed = (
|
|||
})
|
||||
|
||||
// async actions
|
||||
export const loadUsersAsync = url => async dispatch => {
|
||||
export const loadUsersAsync = (url) => async (dispatch) => {
|
||||
try {
|
||||
const {data} = await getUsersAJAX(url)
|
||||
dispatch(loadUsers(data))
|
||||
|
@ -278,7 +278,7 @@ export const loadUsersAsync = url => async dispatch => {
|
|||
}
|
||||
}
|
||||
|
||||
export const loadRolesAsync = url => async dispatch => {
|
||||
export const loadRolesAsync = (url) => async (dispatch) => {
|
||||
try {
|
||||
const {data} = await getRolesAJAX(url)
|
||||
dispatch(loadRoles(data))
|
||||
|
@ -287,7 +287,7 @@ export const loadRolesAsync = url => async dispatch => {
|
|||
}
|
||||
}
|
||||
|
||||
export const loadPermissionsAsync = url => async dispatch => {
|
||||
export const loadPermissionsAsync = (url) => async (dispatch) => {
|
||||
try {
|
||||
const {data} = await getPermissionsAJAX(url)
|
||||
dispatch(loadPermissions(data))
|
||||
|
@ -296,7 +296,7 @@ export const loadPermissionsAsync = url => async dispatch => {
|
|||
}
|
||||
}
|
||||
|
||||
export const loadDBsAndRPsAsync = url => async dispatch => {
|
||||
export const loadDBsAndRPsAsync = (url) => async (dispatch) => {
|
||||
try {
|
||||
const {
|
||||
data: {databases},
|
||||
|
@ -307,7 +307,7 @@ export const loadDBsAndRPsAsync = url => async dispatch => {
|
|||
}
|
||||
}
|
||||
|
||||
export const createUserAsync = (url, user) => async dispatch => {
|
||||
export const createUserAsync = (url, user) => async (dispatch) => {
|
||||
try {
|
||||
const {data} = await createUserAJAX(url, user)
|
||||
dispatch(notify(notifyDBUserCreated()))
|
||||
|
@ -319,7 +319,7 @@ export const createUserAsync = (url, user) => async dispatch => {
|
|||
}
|
||||
}
|
||||
|
||||
export const createRoleAsync = (url, role) => async dispatch => {
|
||||
export const createRoleAsync = (url, role) => async (dispatch) => {
|
||||
try {
|
||||
const {data} = await createRoleAJAX(url, role)
|
||||
dispatch(notify(notifyRoleCreated()))
|
||||
|
@ -331,7 +331,7 @@ export const createRoleAsync = (url, role) => async dispatch => {
|
|||
}
|
||||
}
|
||||
|
||||
export const createDatabaseAsync = (url, database) => async dispatch => {
|
||||
export const createDatabaseAsync = (url, database) => async (dispatch) => {
|
||||
try {
|
||||
const {data} = await createDatabaseAJAX(url, database)
|
||||
dispatch(syncDatabase(database, data))
|
||||
|
@ -343,10 +343,9 @@ export const createDatabaseAsync = (url, database) => async dispatch => {
|
|||
}
|
||||
}
|
||||
|
||||
export const createRetentionPolicyAsync = (
|
||||
database,
|
||||
retentionPolicy
|
||||
) => async dispatch => {
|
||||
export const createRetentionPolicyAsync = (database, retentionPolicy) => async (
|
||||
dispatch
|
||||
) => {
|
||||
try {
|
||||
const {data} = await createRetentionPolicyAJAX(
|
||||
database.links.retentionPolicies,
|
||||
|
@ -367,11 +366,9 @@ export const createRetentionPolicyAsync = (
|
|||
}
|
||||
}
|
||||
|
||||
export const updateRetentionPolicyAsync = (
|
||||
database,
|
||||
oldRP,
|
||||
newRP
|
||||
) => async dispatch => {
|
||||
export const updateRetentionPolicyAsync = (database, oldRP, newRP) => async (
|
||||
dispatch
|
||||
) => {
|
||||
try {
|
||||
dispatch(editRetentionPolicyRequested(database, oldRP, newRP))
|
||||
const {data} = await updateRetentionPolicyAJAX(oldRP.links.self, newRP)
|
||||
|
@ -385,7 +382,7 @@ export const updateRetentionPolicyAsync = (
|
|||
}
|
||||
}
|
||||
|
||||
export const killQueryAsync = (source, query) => async dispatch => {
|
||||
export const killQueryAsync = (source, query) => async (dispatch) => {
|
||||
// optimistic update
|
||||
dispatch(killQuery(query.id))
|
||||
dispatch(setQueryToKill(null))
|
||||
|
@ -398,7 +395,7 @@ export const killQueryAsync = (source, query) => async dispatch => {
|
|||
}
|
||||
}
|
||||
|
||||
export const deleteRoleAsync = role => async dispatch => {
|
||||
export const deleteRoleAsync = (role) => async (dispatch) => {
|
||||
dispatch(deleteRole(role))
|
||||
try {
|
||||
await deleteRoleAJAX(role.links.self)
|
||||
|
@ -408,7 +405,7 @@ export const deleteRoleAsync = role => async dispatch => {
|
|||
}
|
||||
}
|
||||
|
||||
export const deleteUserAsync = user => async dispatch => {
|
||||
export const deleteUserAsync = (user) => async (dispatch) => {
|
||||
dispatch(deleteUser(user))
|
||||
try {
|
||||
await deleteUserAJAX(user.links.self)
|
||||
|
@ -418,7 +415,7 @@ export const deleteUserAsync = user => async dispatch => {
|
|||
}
|
||||
}
|
||||
|
||||
export const deleteDatabaseAsync = database => async dispatch => {
|
||||
export const deleteDatabaseAsync = (database) => async (dispatch) => {
|
||||
dispatch(removeDatabase(database))
|
||||
try {
|
||||
await deleteDatabaseAJAX(database.links.self)
|
||||
|
@ -428,10 +425,9 @@ export const deleteDatabaseAsync = database => async dispatch => {
|
|||
}
|
||||
}
|
||||
|
||||
export const deleteRetentionPolicyAsync = (
|
||||
database,
|
||||
retentionPolicy
|
||||
) => async dispatch => {
|
||||
export const deleteRetentionPolicyAsync = (database, retentionPolicy) => async (
|
||||
dispatch
|
||||
) => {
|
||||
dispatch(removeRetentionPolicy(database, retentionPolicy))
|
||||
try {
|
||||
await deleteRetentionPolicyAJAX(retentionPolicy.links.self)
|
||||
|
@ -443,7 +439,7 @@ export const deleteRetentionPolicyAsync = (
|
|||
}
|
||||
}
|
||||
|
||||
export const updateRoleUsersAsync = (role, users) => async dispatch => {
|
||||
export const updateRoleUsersAsync = (role, users) => async (dispatch) => {
|
||||
try {
|
||||
const {data} = await updateRoleAJAX(
|
||||
role.links.self,
|
||||
|
@ -459,10 +455,9 @@ export const updateRoleUsersAsync = (role, users) => async dispatch => {
|
|||
}
|
||||
}
|
||||
|
||||
export const updateRolePermissionsAsync = (
|
||||
role,
|
||||
permissions
|
||||
) => async dispatch => {
|
||||
export const updateRolePermissionsAsync = (role, permissions) => async (
|
||||
dispatch
|
||||
) => {
|
||||
try {
|
||||
const {data} = await updateRoleAJAX(
|
||||
role.links.self,
|
||||
|
@ -478,10 +473,9 @@ export const updateRolePermissionsAsync = (
|
|||
}
|
||||
}
|
||||
|
||||
export const updateUserPermissionsAsync = (
|
||||
user,
|
||||
permissions
|
||||
) => async dispatch => {
|
||||
export const updateUserPermissionsAsync = (user, permissions) => async (
|
||||
dispatch
|
||||
) => {
|
||||
try {
|
||||
const {data} = await updateUserAJAX(user.links.self, {permissions})
|
||||
dispatch(notify(notifyDBUserPermissionsUpdated()))
|
||||
|
@ -496,7 +490,7 @@ export const updateUserPermissionsAsync = (
|
|||
}
|
||||
}
|
||||
|
||||
export const updateUserRolesAsync = (user, roles) => async dispatch => {
|
||||
export const updateUserRolesAsync = (user, roles) => async (dispatch) => {
|
||||
try {
|
||||
const {data} = await updateUserAJAX(user.links.self, {roles})
|
||||
dispatch(notify(notifyDBUserRolesUpdated()))
|
||||
|
@ -508,7 +502,7 @@ export const updateUserRolesAsync = (user, roles) => async dispatch => {
|
|||
}
|
||||
}
|
||||
|
||||
export const updateUserPasswordAsync = (user, password) => async dispatch => {
|
||||
export const updateUserPasswordAsync = (user, password) => async (dispatch) => {
|
||||
try {
|
||||
const {data} = await updateUserAJAX(user.links.self, {password})
|
||||
dispatch(notify(notifyDBUserPasswordUpdated()))
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import AJAX from 'src/utils/ajax'
|
||||
|
||||
export const getUsers = async url => {
|
||||
export const getUsers = async (url) => {
|
||||
try {
|
||||
return await AJAX({
|
||||
method: 'GET',
|
||||
|
@ -12,7 +12,7 @@ export const getUsers = async url => {
|
|||
}
|
||||
}
|
||||
|
||||
export const getOrganizations = async url => {
|
||||
export const getOrganizations = async (url) => {
|
||||
try {
|
||||
return await AJAX({
|
||||
method: 'GET',
|
||||
|
@ -40,7 +40,7 @@ export const createUser = async (url, user) => {
|
|||
// TODO: change updatedUserWithRolesOnly to a whole user that can have the
|
||||
// original name, provider, and scheme once the change to allow this is
|
||||
// implemented server-side
|
||||
export const updateUser = async updatedUserWithRolesOnly => {
|
||||
export const updateUser = async (updatedUserWithRolesOnly) => {
|
||||
try {
|
||||
return await AJAX({
|
||||
method: 'PATCH',
|
||||
|
@ -53,7 +53,7 @@ export const updateUser = async updatedUserWithRolesOnly => {
|
|||
}
|
||||
}
|
||||
|
||||
export const deleteUser = async user => {
|
||||
export const deleteUser = async (user) => {
|
||||
try {
|
||||
return await AJAX({
|
||||
method: 'DELETE',
|
||||
|
@ -78,7 +78,7 @@ export const createOrganization = async (url, organization) => {
|
|||
}
|
||||
}
|
||||
|
||||
export const updateOrganization = async organization => {
|
||||
export const updateOrganization = async (organization) => {
|
||||
try {
|
||||
return await AJAX({
|
||||
method: 'PATCH',
|
||||
|
@ -91,7 +91,7 @@ export const updateOrganization = async organization => {
|
|||
}
|
||||
}
|
||||
|
||||
export const deleteOrganization = async organization => {
|
||||
export const deleteOrganization = async (organization) => {
|
||||
try {
|
||||
return await AJAX({
|
||||
method: 'DELETE',
|
||||
|
@ -129,7 +129,7 @@ export const getMappings = async () => {
|
|||
}
|
||||
}
|
||||
|
||||
export const updateMapping = async mapping => {
|
||||
export const updateMapping = async (mapping) => {
|
||||
try {
|
||||
return await AJAX({
|
||||
method: 'PUT',
|
||||
|
@ -142,7 +142,7 @@ export const updateMapping = async mapping => {
|
|||
}
|
||||
}
|
||||
|
||||
export const deleteMapping = async mapping => {
|
||||
export const deleteMapping = async (mapping) => {
|
||||
try {
|
||||
return await AJAX({
|
||||
method: 'DELETE',
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import AJAX from 'src/utils/ajax'
|
||||
|
||||
export const getUsers = async url => {
|
||||
export const getUsers = async (url) => {
|
||||
try {
|
||||
return await AJAX({
|
||||
method: 'GET',
|
||||
|
@ -12,7 +12,7 @@ export const getUsers = async url => {
|
|||
}
|
||||
}
|
||||
|
||||
export const getRoles = async url => {
|
||||
export const getRoles = async (url) => {
|
||||
try {
|
||||
return await AJAX({
|
||||
method: 'GET',
|
||||
|
@ -24,7 +24,7 @@ export const getRoles = async url => {
|
|||
}
|
||||
}
|
||||
|
||||
export const getPermissions = async url => {
|
||||
export const getPermissions = async (url) => {
|
||||
try {
|
||||
return await AJAX({
|
||||
method: 'GET',
|
||||
|
@ -36,7 +36,7 @@ export const getPermissions = async url => {
|
|||
}
|
||||
}
|
||||
|
||||
export const getDbsAndRps = async url => {
|
||||
export const getDbsAndRps = async (url) => {
|
||||
try {
|
||||
return await AJAX({
|
||||
method: 'GET',
|
||||
|
@ -96,7 +96,7 @@ export const createRetentionPolicy = async (url, retentionPolicy) => {
|
|||
}
|
||||
}
|
||||
|
||||
export const deleteRetentionPolicy = async url => {
|
||||
export const deleteRetentionPolicy = async (url) => {
|
||||
try {
|
||||
return await AJAX({
|
||||
method: 'DELETE',
|
||||
|
@ -107,7 +107,7 @@ export const deleteRetentionPolicy = async url => {
|
|||
}
|
||||
}
|
||||
|
||||
export const deleteRole = async url => {
|
||||
export const deleteRole = async (url) => {
|
||||
try {
|
||||
return await AJAX({
|
||||
method: 'DELETE',
|
||||
|
@ -119,7 +119,7 @@ export const deleteRole = async url => {
|
|||
}
|
||||
}
|
||||
|
||||
export const deleteUser = async url => {
|
||||
export const deleteUser = async (url) => {
|
||||
try {
|
||||
return await AJAX({
|
||||
method: 'DELETE',
|
||||
|
@ -131,7 +131,7 @@ export const deleteUser = async url => {
|
|||
}
|
||||
}
|
||||
|
||||
export const deleteDatabase = async url => {
|
||||
export const deleteDatabase = async (url) => {
|
||||
try {
|
||||
return await AJAX({
|
||||
method: 'DELETE',
|
||||
|
|
|
@ -25,21 +25,21 @@ class ChangePassRow extends Component {
|
|||
this.setState({showForm: false})
|
||||
}
|
||||
|
||||
handleSubmit = user => {
|
||||
handleSubmit = (user) => {
|
||||
this.props.onApply(user)
|
||||
this.setState({showForm: false})
|
||||
}
|
||||
|
||||
handleKeyPress = user => {
|
||||
return e => {
|
||||
handleKeyPress = (user) => {
|
||||
return (e) => {
|
||||
if (e.key === 'Enter') {
|
||||
this.handleSubmit(user)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
handleEdit = user => {
|
||||
return e => {
|
||||
handleEdit = (user) => {
|
||||
return (e) => {
|
||||
this.props.onEdit(user, {[e.target.name]: e.target.value})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ const DatabaseManager = ({
|
|||
</button>
|
||||
</div>
|
||||
<div className="panel-body">
|
||||
{databases.map(db => (
|
||||
{databases.map((db) => (
|
||||
<DatabaseTable
|
||||
key={db.links.self}
|
||||
database={db}
|
||||
|
|
|
@ -71,7 +71,7 @@ class DatabaseRow extends Component {
|
|||
this.handleEndEdit()
|
||||
}
|
||||
|
||||
handleKeyDown = e => {
|
||||
handleKeyDown = (e) => {
|
||||
const {key} = e
|
||||
const {retentionPolicy, database, onRemove} = this.props
|
||||
|
||||
|
@ -146,7 +146,7 @@ class DatabaseRow extends Component {
|
|||
defaultValue={name}
|
||||
placeholder="Name this RP"
|
||||
onKeyDown={this.handleKeyDown}
|
||||
ref={r => (this.name = r)}
|
||||
ref={(r) => (this.name = r)}
|
||||
autoFocus={true}
|
||||
spellCheck={false}
|
||||
autoComplete="false"
|
||||
|
@ -163,7 +163,7 @@ class DatabaseRow extends Component {
|
|||
defaultValue={formattedDuration}
|
||||
placeholder="INF, 1h30m, 1d, etc"
|
||||
onKeyDown={this.handleKeyDown}
|
||||
ref={r => (this.duration = r)}
|
||||
ref={(r) => (this.duration = r)}
|
||||
autoFocus={!isNew}
|
||||
spellCheck={false}
|
||||
autoComplete="false"
|
||||
|
@ -179,7 +179,7 @@ class DatabaseRow extends Component {
|
|||
defaultValue={replication || 1}
|
||||
placeholder="# of Nodes"
|
||||
onKeyDown={this.handleKeyDown}
|
||||
ref={r => (this.replication = r)}
|
||||
ref={(r) => (this.replication = r)}
|
||||
spellCheck={false}
|
||||
autoComplete="false"
|
||||
/>
|
||||
|
@ -266,10 +266,11 @@ DatabaseRow.propTypes = {
|
|||
isRFDisplayed: bool,
|
||||
}
|
||||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
notify: bindActionCreators(notifyAction, dispatch),
|
||||
})
|
||||
|
||||
export default connect(null, mapDispatchToProps)(
|
||||
onClickOutside(ErrorHandling(DatabaseRow))
|
||||
)
|
||||
export default connect(
|
||||
null,
|
||||
mapDispatchToProps
|
||||
)(onClickOutside(ErrorHandling(DatabaseRow)))
|
||||
|
|
|
@ -45,7 +45,7 @@ const DatabaseTable = ({
|
|||
onAddRetentionPolicy={onAddRetentionPolicy}
|
||||
onDeleteRetentionPolicy={onDeleteRetentionPolicy}
|
||||
onDatabaseDeleteConfirm={onDatabaseDeleteConfirm}
|
||||
isAddRPDisabled={!!database.retentionPolicies.some(rp => rp.isNew)}
|
||||
isAddRPDisabled={!!database.retentionPolicies.some((rp) => rp.isNew)}
|
||||
/>
|
||||
{!database.isNew && (
|
||||
<div className="db-manager-table">
|
||||
|
@ -69,7 +69,7 @@ const DatabaseTable = ({
|
|||
<tbody>
|
||||
{_.sortBy(database.retentionPolicies, ({name}) =>
|
||||
name.toLowerCase()
|
||||
).map(rp => {
|
||||
).map((rp) => {
|
||||
return (
|
||||
<DatabaseRow
|
||||
key={rp.links.self}
|
||||
|
|
|
@ -178,7 +178,7 @@ EditHeader.propTypes = {
|
|||
isRFDisplayed: bool,
|
||||
}
|
||||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
notify: bindActionCreators(notifyAction, dispatch),
|
||||
})
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ class FilterBar extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
handleText = e => {
|
||||
handleText = (e) => {
|
||||
this.setState(
|
||||
{filterText: e.target.value},
|
||||
this.props.onFilter(e.target.value)
|
||||
|
@ -24,7 +24,7 @@ class FilterBar extends Component {
|
|||
|
||||
render() {
|
||||
const {type, isEditing, onClickCreate} = this.props
|
||||
const placeholderText = type.replace(/\w\S*/g, function(txt) {
|
||||
const placeholderText = type.replace(/\w\S*/g, function (txt) {
|
||||
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase()
|
||||
})
|
||||
return (
|
||||
|
|
|
@ -20,7 +20,7 @@ const QueriesTable = ({queries, onKillQuery}) => (
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{queries.map(q => (
|
||||
{queries.map((q) => (
|
||||
<QueryRow key={q.id} query={q} onKill={onKillQuery} />
|
||||
))}
|
||||
</tbody>
|
||||
|
|
|
@ -9,16 +9,16 @@ class RoleEditingRow extends Component {
|
|||
super(props)
|
||||
}
|
||||
|
||||
handleKeyPress = role => {
|
||||
return e => {
|
||||
handleKeyPress = (role) => {
|
||||
return (e) => {
|
||||
if (e.key === 'Enter') {
|
||||
this.props.onSave(role)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
handleEdit = role => {
|
||||
return e => {
|
||||
handleEdit = (role) => {
|
||||
return (e) => {
|
||||
this.props.onEdit(role, {[e.target.name]: e.target.value})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,8 +72,8 @@ const RoleRow = ({
|
|||
<td>
|
||||
{allPermissions && allPermissions.length ? (
|
||||
<MultiSelectDropdown
|
||||
items={allPermissions.map(name => ({name}))}
|
||||
selectedItems={perms.map(name => ({name}))}
|
||||
items={allPermissions.map((name) => ({name}))}
|
||||
selectedItems={perms.map((name) => ({name}))}
|
||||
label={perms.length ? '' : 'Select Permissions'}
|
||||
onApply={handleUpdatePermissions}
|
||||
buttonSize="btn-xs"
|
||||
|
|
|
@ -38,8 +38,8 @@ const RolesTable = ({
|
|||
<tbody>
|
||||
{roles.length ? (
|
||||
roles
|
||||
.filter(r => !r.hidden)
|
||||
.map(role => (
|
||||
.filter((r) => !r.hidden)
|
||||
.map((role) => (
|
||||
<RoleRow
|
||||
key={role.links.self}
|
||||
allUsers={allUsers}
|
||||
|
|
|
@ -9,16 +9,16 @@ class UserEditName extends Component {
|
|||
super(props)
|
||||
}
|
||||
|
||||
handleKeyPress = user => {
|
||||
return e => {
|
||||
handleKeyPress = (user) => {
|
||||
return (e) => {
|
||||
if (e.key === 'Enter') {
|
||||
this.props.onSave(user)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
handleEdit = user => {
|
||||
return e => {
|
||||
handleEdit = (user) => {
|
||||
return (e) => {
|
||||
this.props.onEdit(user, {[e.target.name]: e.target.value})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,16 +5,16 @@ import {USERS_TABLE} from 'src/admin/constants/tableSizing'
|
|||
import {ErrorHandling} from 'src/shared/decorators/errors'
|
||||
|
||||
class UserNewPassword extends Component {
|
||||
handleKeyPress = user => {
|
||||
return e => {
|
||||
handleKeyPress = (user) => {
|
||||
return (e) => {
|
||||
if (e.key === 'Enter') {
|
||||
this.props.onSave(user)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
handleEdit = user => {
|
||||
return e => {
|
||||
handleEdit = (user) => {
|
||||
return (e) => {
|
||||
this.props.onEdit(user, {[e.target.name]: e.target.value})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,8 +42,8 @@ const UsersTable = ({
|
|||
<tbody>
|
||||
{users.length ? (
|
||||
users
|
||||
.filter(u => !u.hidden)
|
||||
.map(user => (
|
||||
.filter((u) => !u.hidden)
|
||||
.map((user) => (
|
||||
<UserRow
|
||||
key={user.links.self}
|
||||
user={user}
|
||||
|
|
|
@ -33,7 +33,7 @@ class AllUsersTable extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
handleUpdateAuthConfig = fieldName => updatedValue => {
|
||||
handleUpdateAuthConfig = (fieldName) => (updatedValue) => {
|
||||
const {
|
||||
actionsConfig: {updateAuthConfigAsync},
|
||||
authConfig,
|
||||
|
@ -46,7 +46,7 @@ class AllUsersTable extends Component {
|
|||
updateAuthConfigAsync(links.config.auth, authConfig, updatedAuthConfig)
|
||||
}
|
||||
|
||||
handleAddToOrganization = user => organization => {
|
||||
handleAddToOrganization = (user) => (organization) => {
|
||||
// '*' tells the server to fill in the current defaultRole of that org
|
||||
const newRoles = user.roles.concat({
|
||||
organization: organization.id,
|
||||
|
@ -59,12 +59,12 @@ class AllUsersTable extends Component {
|
|||
)
|
||||
}
|
||||
|
||||
handleRemoveFromOrganization = user => role => {
|
||||
handleRemoveFromOrganization = (user) => (role) => {
|
||||
const newRoles = user.roles.filter(
|
||||
r => r.organization !== role.organization
|
||||
(r) => r.organization !== role.organization
|
||||
)
|
||||
const {name} = this.props.organizations.find(
|
||||
o => o.id === role.organization
|
||||
(o) => o.id === role.organization
|
||||
)
|
||||
this.props.onUpdateUserRoles(
|
||||
user,
|
||||
|
@ -73,7 +73,7 @@ class AllUsersTable extends Component {
|
|||
)
|
||||
}
|
||||
|
||||
handleChangeSuperAdmin = user => {
|
||||
handleChangeSuperAdmin = (user) => {
|
||||
const newStatus = !user.superAdmin
|
||||
this.props.onUpdateUserSuperAdmin(user, newStatus)
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ class AllUsersTable extends Component {
|
|||
</thead>
|
||||
<tbody>
|
||||
{users.length ? (
|
||||
users.map(user => (
|
||||
users.map((user) => (
|
||||
<AllUsersTableRow
|
||||
user={user}
|
||||
key={uuid.v4()}
|
||||
|
|
|
@ -34,7 +34,7 @@ class AllUsersTableRowNew extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
handleInputChange = fieldName => e => {
|
||||
handleInputChange = (fieldName) => (e) => {
|
||||
this.setState({[fieldName]: e.target.value.trim()})
|
||||
}
|
||||
|
||||
|
@ -55,11 +55,11 @@ class AllUsersTableRowNew extends Component {
|
|||
onBlur()
|
||||
}
|
||||
|
||||
handleInputFocus = e => {
|
||||
handleInputFocus = (e) => {
|
||||
e.target.select()
|
||||
}
|
||||
|
||||
handleSelectOrganization = newOrganization => {
|
||||
handleSelectOrganization = (newOrganization) => {
|
||||
// if "None" was selected for organization, create a "null role" from the predefined null role
|
||||
// else create a new role with the organization as the newOrganization's id
|
||||
const newRole =
|
||||
|
@ -74,7 +74,7 @@ class AllUsersTableRowNew extends Component {
|
|||
this.setState({role: newRole})
|
||||
}
|
||||
|
||||
handleKeyDown = e => {
|
||||
handleKeyDown = (e) => {
|
||||
const {name, provider} = this.state
|
||||
const preventCreate = !name || !provider
|
||||
|
||||
|
@ -97,12 +97,12 @@ class AllUsersTableRowNew extends Component {
|
|||
const dropdownOrganizationsItems = [
|
||||
{...nullOrganization},
|
||||
...organizations,
|
||||
].map(o => ({
|
||||
].map((o) => ({
|
||||
...o,
|
||||
text: o.name,
|
||||
}))
|
||||
const selectedRole = dropdownOrganizationsItems.find(
|
||||
o => role.organization === o.id
|
||||
(o) => role.organization === o.id
|
||||
)
|
||||
|
||||
const preventCreate = !name || !provider
|
||||
|
@ -183,10 +183,11 @@ AllUsersTableRowNew.propTypes = {
|
|||
notify: func.isRequired,
|
||||
}
|
||||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
notify: bindActionCreators(notifyAction, dispatch),
|
||||
})
|
||||
|
||||
export default connect(null, mapDispatchToProps)(
|
||||
ErrorHandling(AllUsersTableRowNew)
|
||||
)
|
||||
export default connect(
|
||||
null,
|
||||
mapDispatchToProps
|
||||
)(ErrorHandling(AllUsersTableRowNew))
|
||||
|
|
|
@ -32,7 +32,7 @@ class OrganizationsTable extends Component {
|
|||
this.setState({isCreatingOrganization: false})
|
||||
}
|
||||
|
||||
handleCreateOrganization = organization => {
|
||||
handleCreateOrganization = (organization) => {
|
||||
const {onCreateOrg} = this.props
|
||||
onCreateOrg(organization)
|
||||
this.setState({isCreatingOrganization: false})
|
||||
|
@ -88,7 +88,7 @@ class OrganizationsTable extends Component {
|
|||
onCancelCreateOrganization={this.handleCancelCreateOrganization}
|
||||
/>
|
||||
) : null}
|
||||
{organizations.map(org => (
|
||||
{organizations.map((org) => (
|
||||
<OrganizationsTableRow
|
||||
key={uuid.v4()}
|
||||
organization={org}
|
||||
|
|
|
@ -18,7 +18,7 @@ class OrganizationsTableRowNew extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
handleKeyDown = e => {
|
||||
handleKeyDown = (e) => {
|
||||
const {onCancelCreateOrganization} = this.props
|
||||
|
||||
if (e.key === 'Escape') {
|
||||
|
@ -29,11 +29,11 @@ class OrganizationsTableRowNew extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
handleInputChange = e => {
|
||||
handleInputChange = (e) => {
|
||||
this.setState({name: e.target.value})
|
||||
}
|
||||
|
||||
handleInputFocus = e => {
|
||||
handleInputFocus = (e) => {
|
||||
e.target.select()
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ class OrganizationsTableRowNew extends Component {
|
|||
onCreateOrganization({name: name.trim(), defaultRole})
|
||||
}
|
||||
|
||||
handleChooseDefaultRole = role => {
|
||||
handleChooseDefaultRole = (role) => {
|
||||
this.setState({defaultRole: role.name})
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ class OrganizationsTableRowNew extends Component {
|
|||
|
||||
const isSaveDisabled = name === null || name === ''
|
||||
|
||||
const dropdownRolesItems = USER_ROLES.map(role => ({
|
||||
const dropdownRolesItems = USER_ROLES.map((role) => ({
|
||||
...role,
|
||||
text: role.name,
|
||||
}))
|
||||
|
@ -72,7 +72,7 @@ class OrganizationsTableRowNew extends Component {
|
|||
onFocus={this.handleInputFocus}
|
||||
placeholder="Name this Organization..."
|
||||
autoFocus={true}
|
||||
ref={r => (this.inputRef = r)}
|
||||
ref={(r) => (this.inputRef = r)}
|
||||
/>
|
||||
</div>
|
||||
<div className="fancytable--td orgs-table--default-role creating">
|
||||
|
|
|
@ -23,7 +23,7 @@ class ProvidersTable extends Component {
|
|||
this.setState({isCreatingMap: false})
|
||||
}
|
||||
|
||||
handleCreateMap = newMap => {
|
||||
handleCreateMap = (newMap) => {
|
||||
this.props.onCreateMap(newMap)
|
||||
this.setState({isCreatingMap: false})
|
||||
}
|
||||
|
@ -105,7 +105,8 @@ class ProvidersTable extends Component {
|
|||
<div className="panel-body">
|
||||
<div className="generic-empty-state">
|
||||
<h4 style={{margin: '50px 0'}}>
|
||||
Looks like you have no mappings<br />
|
||||
Looks like you have no mappings
|
||||
<br />
|
||||
New users will not be able to sign up automatically
|
||||
</h4>
|
||||
<button
|
||||
|
|
|
@ -22,16 +22,16 @@ class ProvidersTableRow extends Component {
|
|||
onDelete(mapping)
|
||||
}
|
||||
|
||||
handleUpdateMapping = changes => {
|
||||
handleUpdateMapping = (changes) => {
|
||||
const {onUpdate, mapping} = this.props
|
||||
const newState = {...mapping, ...changes}
|
||||
this.setState(newState)
|
||||
onUpdate(mapping, newState)
|
||||
}
|
||||
|
||||
handleChangeProvider = provider => this.handleUpdateMapping({provider})
|
||||
handleChangeProvider = (provider) => this.handleUpdateMapping({provider})
|
||||
|
||||
handleChangeProviderOrg = providerOrganization =>
|
||||
handleChangeProviderOrg = (providerOrganization) =>
|
||||
this.handleUpdateMapping({providerOrganization})
|
||||
|
||||
handleChooseOrganization = ({id: organizationId}) =>
|
||||
|
@ -49,8 +49,8 @@ class ProvidersTableRow extends Component {
|
|||
} = this.state
|
||||
const {organizations, mapping, schemes, rowIndex} = this.props
|
||||
|
||||
const selectedOrg = organizations.find(o => o.id === organizationId)
|
||||
const orgDropdownItems = organizations.map(role => ({
|
||||
const selectedOrg = organizations.find((o) => o.id === organizationId)
|
||||
const orgDropdownItems = organizations.map((role) => ({
|
||||
...role,
|
||||
text: role.name,
|
||||
}))
|
||||
|
|
|
@ -27,11 +27,11 @@ class UsersTable extends Component {
|
|||
)
|
||||
}
|
||||
|
||||
handleChangeUserRole = (user, currentRole) => newRole => {
|
||||
handleChangeUserRole = (user, currentRole) => (newRole) => {
|
||||
this.props.onUpdateUserRole(user, currentRole, newRole)
|
||||
}
|
||||
|
||||
handleDeleteUser = user => {
|
||||
handleDeleteUser = (user) => {
|
||||
this.props.onDeleteUser(user)
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ class UsersTable extends Component {
|
|||
/>
|
||||
) : null}
|
||||
{users.length ? (
|
||||
users.map(user => (
|
||||
users.map((user) => (
|
||||
<UsersTableRow
|
||||
user={user}
|
||||
key={uuid.v4()}
|
||||
|
|
|
@ -24,7 +24,7 @@ class UsersTableRowNew extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
handleInputChange = fieldName => e => {
|
||||
handleInputChange = (fieldName) => (e) => {
|
||||
this.setState({[fieldName]: e.target.value.trim()})
|
||||
}
|
||||
|
||||
|
@ -48,15 +48,15 @@ class UsersTableRowNew extends Component {
|
|||
onBlur()
|
||||
}
|
||||
|
||||
handleInputFocus = e => {
|
||||
handleInputFocus = (e) => {
|
||||
e.target.select()
|
||||
}
|
||||
|
||||
handleSelectRole = newRole => {
|
||||
handleSelectRole = (newRole) => {
|
||||
this.setState({role: newRole.text})
|
||||
}
|
||||
|
||||
handleKeyDown = e => {
|
||||
handleKeyDown = (e) => {
|
||||
const {name, provider} = this.state
|
||||
const preventCreate = !name || !provider
|
||||
|
||||
|
@ -77,7 +77,7 @@ class UsersTableRowNew extends Component {
|
|||
const {onBlur} = this.props
|
||||
const {name, provider, scheme, role} = this.state
|
||||
|
||||
const dropdownRolesItems = USER_ROLES.map(r => ({...r, text: r.name}))
|
||||
const dropdownRolesItems = USER_ROLES.map((r) => ({...r, text: r.name}))
|
||||
const preventCreate = !name || !provider
|
||||
|
||||
return (
|
||||
|
@ -151,10 +151,11 @@ UsersTableRowNew.propTypes = {
|
|||
notify: func.isRequired,
|
||||
}
|
||||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
notify: bindActionCreators(notifyAction, dispatch),
|
||||
})
|
||||
|
||||
export default connect(null, mapDispatchToProps)(
|
||||
ErrorHandling(UsersTableRowNew)
|
||||
)
|
||||
export default connect(
|
||||
null,
|
||||
mapDispatchToProps
|
||||
)(ErrorHandling(UsersTableRowNew))
|
||||
|
|
|
@ -36,15 +36,15 @@ class DatabaseManagerPage extends Component {
|
|||
this.props.actions.deleteRetentionPolicyAsync(db, rp)
|
||||
}
|
||||
|
||||
handleStartDeleteDatabase = database => () => {
|
||||
handleStartDeleteDatabase = (database) => () => {
|
||||
this.props.actions.addDatabaseDeleteCode(database)
|
||||
}
|
||||
|
||||
handleEditDatabase = database => e => {
|
||||
handleEditDatabase = (database) => (e) => {
|
||||
this.props.actions.editDatabase(database, {name: e.target.value})
|
||||
}
|
||||
|
||||
handleCreateDatabase = database => {
|
||||
handleCreateDatabase = (database) => {
|
||||
const {actions, notify, source, databases} = this.props
|
||||
if (!database.name) {
|
||||
return notify(notifyDatabaseNameInvalid())
|
||||
|
@ -57,12 +57,12 @@ class DatabaseManagerPage extends Component {
|
|||
actions.createDatabaseAsync(source.links.databases, database)
|
||||
}
|
||||
|
||||
handleAddRetentionPolicy = database => () => {
|
||||
handleAddRetentionPolicy = (database) => () => {
|
||||
const {addRetentionPolicy} = this.props.actions
|
||||
addRetentionPolicy(database)
|
||||
}
|
||||
|
||||
handleKeyDownDatabase = database => e => {
|
||||
handleKeyDownDatabase = (database) => (e) => {
|
||||
const {key} = e
|
||||
const {actions, notify, source, databases} = this.props
|
||||
|
||||
|
@ -83,7 +83,7 @@ class DatabaseManagerPage extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
handleDatabaseDeleteConfirm = database => e => {
|
||||
handleDatabaseDeleteConfirm = (database) => (e) => {
|
||||
const {
|
||||
key,
|
||||
target: {value},
|
||||
|
@ -121,7 +121,7 @@ class DatabaseManagerPage extends Component {
|
|||
onAddRetentionPolicy={this.handleAddRetentionPolicy}
|
||||
onRemoveDeleteCode={actions.removeDatabaseDeleteCode}
|
||||
onStartDeleteDatabase={this.handleStartDeleteDatabase}
|
||||
isAddDBDisabled={!!databases.some(db => db.isEditing)}
|
||||
isAddDBDisabled={!!databases.some((db) => db.isEditing)}
|
||||
onRemoveRetentionPolicy={actions.removeRetentionPolicy}
|
||||
onDeleteRetentionPolicy={this.handleDeleteRetentionPolicy}
|
||||
onDatabaseDeleteConfirm={this.handleDatabaseDeleteConfirm}
|
||||
|
@ -176,11 +176,12 @@ const mapStateToProps = ({adminInfluxDB: {databases, retentionPolicies}}) => ({
|
|||
retentionPolicies,
|
||||
})
|
||||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
actions: bindActionCreators(adminActionCreators, dispatch),
|
||||
notify: bindActionCreators(notifyAction, dispatch),
|
||||
})
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(
|
||||
ErrorHandling(DatabaseManagerPage)
|
||||
)
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(ErrorHandling(DatabaseManagerPage))
|
||||
|
|
|
@ -30,7 +30,7 @@ class ProvidersPage extends Component {
|
|||
this.setState({isLoading: false})
|
||||
}
|
||||
|
||||
handleCreateMap = mapping => {
|
||||
handleCreateMap = (mapping) => {
|
||||
this.props.actions.createMappingAsync(this.props.links.mappings, mapping)
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ class ProvidersPage extends Component {
|
|||
this.props.actions.updateMappingAsync(staleMap, updatedMap)
|
||||
}
|
||||
|
||||
handleDeleteMap = mapping => {
|
||||
handleDeleteMap = (mapping) => {
|
||||
this.props.actions.deleteMappingAsync(mapping)
|
||||
}
|
||||
|
||||
|
@ -95,11 +95,12 @@ const mapStateToProps = ({
|
|||
mappings,
|
||||
})
|
||||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
actions: bindActionCreators(adminChronografActionCreators, dispatch),
|
||||
notify: bindActionCreators(notifyAction, dispatch),
|
||||
})
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(
|
||||
ErrorHandling(ProvidersPage)
|
||||
)
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(ErrorHandling(ProvidersPage))
|
||||
|
|
|
@ -42,16 +42,16 @@ class QueriesPage extends Component {
|
|||
|
||||
updateQueries = () => {
|
||||
const {source, notify, loadQueries} = this.props
|
||||
showDatabases(source.links.proxy).then(resp => {
|
||||
showDatabases(source.links.proxy).then((resp) => {
|
||||
const {databases, errors} = showDatabasesParser(resp.data)
|
||||
if (errors.length) {
|
||||
errors.forEach(message => notify(notifyQueriesError(message)))
|
||||
errors.forEach((message) => notify(notifyQueriesError(message)))
|
||||
return
|
||||
}
|
||||
|
||||
const fetches = databases.map(db => showQueries(source.links.proxy, db))
|
||||
const fetches = databases.map((db) => showQueries(source.links.proxy, db))
|
||||
|
||||
Promise.allSettled(fetches).then(results => {
|
||||
Promise.allSettled(fetches).then((results) => {
|
||||
const allQueries = []
|
||||
results.forEach((settledResponse, i) => {
|
||||
if (!settledResponse.value) {
|
||||
|
@ -63,7 +63,7 @@ class QueriesPage extends Component {
|
|||
}
|
||||
const result = showQueriesParser(settledResponse.value.data)
|
||||
if (result.errors.length) {
|
||||
result.errors.forEach(message =>
|
||||
result.errors.forEach((message) =>
|
||||
notify(notifyQueriesError(message))
|
||||
)
|
||||
}
|
||||
|
@ -71,12 +71,12 @@ class QueriesPage extends Component {
|
|||
allQueries.push(...result.queries)
|
||||
})
|
||||
|
||||
const queries = uniqBy(flatten(allQueries), q => q.id)
|
||||
const queries = uniqBy(flatten(allQueries), (q) => q.id)
|
||||
|
||||
// sorting queries by magnitude, so generally longer queries will appear atop the list
|
||||
const sortedQueries = queries.sort((a, b) => {
|
||||
const aTime = TIMES.find(t => a.duration.match(t.test))
|
||||
const bTime = TIMES.find(t => b.duration.match(t.test))
|
||||
const aTime = TIMES.find((t) => a.duration.match(t.test))
|
||||
const bTime = TIMES.find((t) => b.duration.match(t.test))
|
||||
return +aTime.magnitude <= +bTime.magnitude
|
||||
})
|
||||
|
||||
|
@ -85,7 +85,7 @@ class QueriesPage extends Component {
|
|||
})
|
||||
}
|
||||
|
||||
handleKillQuery = query => {
|
||||
handleKillQuery = (query) => {
|
||||
const {source, killQuery} = this.props
|
||||
killQuery(source.links.proxy, query)
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ const mapStateToProps = ({adminInfluxDB: {queries, queryIDToKill}}) => ({
|
|||
queryIDToKill,
|
||||
})
|
||||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
loadQueries: bindActionCreators(loadQueriesAction, dispatch),
|
||||
setQueryToKill: bindActionCreators(setQueryToKillAction, dispatch),
|
||||
killQuery: bindActionCreators(killQueryAsync, dispatch),
|
||||
|
|
|
@ -16,7 +16,7 @@ import {
|
|||
SUPERADMIN_ROLE,
|
||||
} from 'src/auth/Authorized'
|
||||
|
||||
const sections = me => [
|
||||
const sections = (me) => [
|
||||
{
|
||||
url: 'current-organization',
|
||||
name: 'Current Org',
|
||||
|
|
|
@ -18,7 +18,7 @@ class OrganizationsPage extends Component {
|
|||
loadOrganizationsAsync(links.organizations)
|
||||
}
|
||||
|
||||
handleCreateOrganization = async organization => {
|
||||
handleCreateOrganization = async (organization) => {
|
||||
const {
|
||||
links,
|
||||
actionsAdmin: {createOrganizationAsync},
|
||||
|
@ -35,7 +35,7 @@ class OrganizationsPage extends Component {
|
|||
this.refreshMe()
|
||||
}
|
||||
|
||||
handleDeleteOrganization = organization => {
|
||||
handleDeleteOrganization = (organization) => {
|
||||
const {
|
||||
actionsAdmin: {deleteOrganizationAsync},
|
||||
} = this.props
|
||||
|
@ -61,7 +61,7 @@ class OrganizationsPage extends Component {
|
|||
const {meCurrentOrganization, organizations, me} = this.props
|
||||
|
||||
const organization = organizations.find(
|
||||
o => o.id === meCurrentOrganization.id
|
||||
(o) => o.id === meCurrentOrganization.id
|
||||
)
|
||||
|
||||
return (
|
||||
|
@ -126,11 +126,12 @@ const mapStateToProps = ({
|
|||
me,
|
||||
})
|
||||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
actionsAdmin: bindActionCreators(adminChronografActionCreators, dispatch),
|
||||
getMe: bindActionCreators(getMeAsync, dispatch),
|
||||
})
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(
|
||||
ErrorHandling(OrganizationsPage)
|
||||
)
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(ErrorHandling(OrganizationsPage))
|
||||
|
|
|
@ -18,7 +18,7 @@ class UsersPage extends PureComponent {
|
|||
}
|
||||
}
|
||||
|
||||
handleCreateUser = user => {
|
||||
handleCreateUser = (user) => {
|
||||
const {
|
||||
links,
|
||||
actions: {createUserAsync},
|
||||
|
@ -31,8 +31,8 @@ class UsersPage extends PureComponent {
|
|||
actions: {updateUserAsync},
|
||||
} = this.props
|
||||
const updatedRole = {...currentRole, name}
|
||||
const newRoles = user.roles.map(
|
||||
r => (r.organization === currentRole.organization ? updatedRole : r)
|
||||
const newRoles = user.roles.map((r) =>
|
||||
r.organization === currentRole.organization ? updatedRole : r
|
||||
)
|
||||
updateUserAsync(
|
||||
user,
|
||||
|
@ -41,7 +41,7 @@ class UsersPage extends PureComponent {
|
|||
)
|
||||
}
|
||||
|
||||
handleDeleteUser = user => {
|
||||
handleDeleteUser = (user) => {
|
||||
const {
|
||||
actions: {deleteUserAsync},
|
||||
} = this.props
|
||||
|
@ -75,7 +75,7 @@ class UsersPage extends PureComponent {
|
|||
const {isLoading} = this.state
|
||||
|
||||
const organization = organizations.find(
|
||||
o => o.id === meCurrentOrganization.id
|
||||
(o) => o.id === meCurrentOrganization.id
|
||||
)
|
||||
|
||||
return (
|
||||
|
@ -122,11 +122,12 @@ const mapStateToProps = ({links, adminChronograf: {organizations, users}}) => ({
|
|||
users,
|
||||
})
|
||||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
actions: bindActionCreators(adminChronografActionCreators, dispatch),
|
||||
notify: bindActionCreators(notifyAction, dispatch),
|
||||
})
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(
|
||||
ErrorHandling(UsersPage)
|
||||
)
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(ErrorHandling(UsersPage))
|
||||
|
|
|
@ -28,8 +28,8 @@ const adminChronograf = (state = initialState, action) => {
|
|||
const {user, updatedUser} = action.payload
|
||||
return {
|
||||
...state,
|
||||
users: state.users.map(
|
||||
u => (u.links.self === user.links.self ? {...updatedUser} : u)
|
||||
users: state.users.map((u) =>
|
||||
u.links.self === user.links.self ? {...updatedUser} : u
|
||||
),
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ const adminChronograf = (state = initialState, action) => {
|
|||
...state,
|
||||
users: state.users.map(
|
||||
// stale user does not have links, so uniqueness is on name, provider, & scheme
|
||||
u => (isSameUser(u, staleUser) ? {...syncedUser} : u)
|
||||
(u) => (isSameUser(u, staleUser) ? {...syncedUser} : u)
|
||||
),
|
||||
}
|
||||
}
|
||||
|
@ -51,8 +51,8 @@ const adminChronograf = (state = initialState, action) => {
|
|||
// stale user does not necessarily have links, so uniqueness is on name,
|
||||
// provider, & scheme, except for a created users that is a duplicate
|
||||
// of an existing user, in which case a temp uuid is used to match
|
||||
users: state.users.filter(
|
||||
u => (user._tempID ? u._tempID !== user._tempID : u.id !== user.id)
|
||||
users: state.users.filter((u) =>
|
||||
user._tempID ? u._tempID !== user._tempID : u.id !== user.id
|
||||
),
|
||||
}
|
||||
}
|
||||
|
@ -69,9 +69,8 @@ const adminChronograf = (state = initialState, action) => {
|
|||
const {organization, newName} = action.payload
|
||||
return {
|
||||
...state,
|
||||
organizations: state.organizations.map(
|
||||
o =>
|
||||
o.links.self === organization.links.self ? {...o, name: newName} : o
|
||||
organizations: state.organizations.map((o) =>
|
||||
o.links.self === organization.links.self ? {...o, name: newName} : o
|
||||
),
|
||||
}
|
||||
}
|
||||
|
@ -80,8 +79,8 @@ const adminChronograf = (state = initialState, action) => {
|
|||
const {staleOrganization, syncedOrganization} = action.payload
|
||||
return {
|
||||
...state,
|
||||
organizations: state.organizations.map(
|
||||
o => (o.name === staleOrganization.name ? {...syncedOrganization} : o)
|
||||
organizations: state.organizations.map((o) =>
|
||||
o.name === staleOrganization.name ? {...syncedOrganization} : o
|
||||
),
|
||||
}
|
||||
}
|
||||
|
@ -90,11 +89,10 @@ const adminChronograf = (state = initialState, action) => {
|
|||
const {organization} = action.payload
|
||||
return {
|
||||
...state,
|
||||
organizations: state.organizations.filter(
|
||||
o =>
|
||||
organization._tempID
|
||||
? o._tempID !== organization._tempID
|
||||
: o.id !== organization.id
|
||||
organizations: state.organizations.filter((o) =>
|
||||
organization._tempID
|
||||
? o._tempID !== organization._tempID
|
||||
: o.id !== organization.id
|
||||
),
|
||||
}
|
||||
}
|
||||
|
@ -111,7 +109,7 @@ const adminChronograf = (state = initialState, action) => {
|
|||
const {staleMapping, updatedMapping} = action.payload
|
||||
return {
|
||||
...state,
|
||||
mappings: state.mappings.map(m =>
|
||||
mappings: state.mappings.map((m) =>
|
||||
replaceMapping(m, staleMapping, updatedMapping)
|
||||
),
|
||||
}
|
||||
|
@ -129,11 +127,8 @@ const adminChronograf = (state = initialState, action) => {
|
|||
const {mapping} = action.payload
|
||||
return {
|
||||
...state,
|
||||
mappings: state.mappings.filter(
|
||||
m =>
|
||||
mapping._tempID
|
||||
? m._tempID !== mapping._tempID
|
||||
: m.id !== mapping.id
|
||||
mappings: state.mappings.filter((m) =>
|
||||
mapping._tempID ? m._tempID !== mapping._tempID : m.id !== mapping.id
|
||||
),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,17 +65,16 @@ const adminInfluxDB = (state = initialState, action) => {
|
|||
|
||||
case 'INFLUXDB_ADD_RETENTION_POLICY': {
|
||||
const {database} = action.payload
|
||||
const databases = state.databases.map(
|
||||
db =>
|
||||
db.links.self === database.links.self
|
||||
? {
|
||||
...database,
|
||||
retentionPolicies: [
|
||||
{...NEW_EMPTY_RP},
|
||||
...database.retentionPolicies,
|
||||
],
|
||||
}
|
||||
: db
|
||||
const databases = state.databases.map((db) =>
|
||||
db.links.self === database.links.self
|
||||
? {
|
||||
...database,
|
||||
retentionPolicies: [
|
||||
{...NEW_EMPTY_RP},
|
||||
...database.retentionPolicies,
|
||||
],
|
||||
}
|
||||
: db
|
||||
)
|
||||
|
||||
return {...state, databases}
|
||||
|
@ -84,8 +83,8 @@ const adminInfluxDB = (state = initialState, action) => {
|
|||
case 'INFLUXDB_SYNC_USER': {
|
||||
const {staleUser, syncedUser} = action.payload
|
||||
const newState = {
|
||||
users: state.users.map(
|
||||
u => (u.links.self === staleUser.links.self ? {...syncedUser} : u)
|
||||
users: state.users.map((u) =>
|
||||
u.links.self === staleUser.links.self ? {...syncedUser} : u
|
||||
),
|
||||
}
|
||||
return {...state, ...newState}
|
||||
|
@ -94,8 +93,8 @@ const adminInfluxDB = (state = initialState, action) => {
|
|||
case 'INFLUXDB_SYNC_ROLE': {
|
||||
const {staleRole, syncedRole} = action.payload
|
||||
const newState = {
|
||||
roles: state.roles.map(
|
||||
r => (r.links.self === staleRole.links.self ? {...syncedRole} : r)
|
||||
roles: state.roles.map((r) =>
|
||||
r.links.self === staleRole.links.self ? {...syncedRole} : r
|
||||
),
|
||||
}
|
||||
return {...state, ...newState}
|
||||
|
@ -104,8 +103,8 @@ const adminInfluxDB = (state = initialState, action) => {
|
|||
case 'INFLUXDB_SYNC_DATABASE': {
|
||||
const {stale, synced} = action.payload
|
||||
const newState = {
|
||||
databases: state.databases.map(
|
||||
db => (db.links.self === stale.links.self ? {...synced} : db)
|
||||
databases: state.databases.map((db) =>
|
||||
db.links.self === stale.links.self ? {...synced} : db
|
||||
),
|
||||
}
|
||||
|
||||
|
@ -115,17 +114,15 @@ const adminInfluxDB = (state = initialState, action) => {
|
|||
case 'INFLUXDB_SYNC_RETENTION_POLICY': {
|
||||
const {database, stale, synced} = action.payload
|
||||
const newState = {
|
||||
databases: state.databases.map(
|
||||
db =>
|
||||
db.links.self === database.links.self
|
||||
? {
|
||||
...db,
|
||||
retentionPolicies: db.retentionPolicies.map(
|
||||
rp =>
|
||||
rp.links.self === stale.links.self ? {...synced} : rp
|
||||
),
|
||||
}
|
||||
: db
|
||||
databases: state.databases.map((db) =>
|
||||
db.links.self === database.links.self
|
||||
? {
|
||||
...db,
|
||||
retentionPolicies: db.retentionPolicies.map((rp) =>
|
||||
rp.links.self === stale.links.self ? {...synced} : rp
|
||||
),
|
||||
}
|
||||
: db
|
||||
),
|
||||
}
|
||||
|
||||
|
@ -135,8 +132,8 @@ const adminInfluxDB = (state = initialState, action) => {
|
|||
case 'INFLUXDB_EDIT_USER': {
|
||||
const {user, updates} = action.payload
|
||||
const newState = {
|
||||
users: state.users.map(
|
||||
u => (u.links.self === user.links.self ? {...u, ...updates} : u)
|
||||
users: state.users.map((u) =>
|
||||
u.links.self === user.links.self ? {...u, ...updates} : u
|
||||
),
|
||||
}
|
||||
return {...state, ...newState}
|
||||
|
@ -145,8 +142,8 @@ const adminInfluxDB = (state = initialState, action) => {
|
|||
case 'INFLUXDB_EDIT_ROLE': {
|
||||
const {role, updates} = action.payload
|
||||
const newState = {
|
||||
roles: state.roles.map(
|
||||
r => (r.links.self === role.links.self ? {...r, ...updates} : r)
|
||||
roles: state.roles.map((r) =>
|
||||
r.links.self === role.links.self ? {...r, ...updates} : r
|
||||
),
|
||||
}
|
||||
return {...state, ...newState}
|
||||
|
@ -155,9 +152,8 @@ const adminInfluxDB = (state = initialState, action) => {
|
|||
case 'INFLUXDB_EDIT_DATABASE': {
|
||||
const {database, updates} = action.payload
|
||||
const newState = {
|
||||
databases: state.databases.map(
|
||||
db =>
|
||||
db.links.self === database.links.self ? {...db, ...updates} : db
|
||||
databases: state.databases.map((db) =>
|
||||
db.links.self === database.links.self ? {...db, ...updates} : db
|
||||
),
|
||||
}
|
||||
|
||||
|
@ -168,19 +164,17 @@ const adminInfluxDB = (state = initialState, action) => {
|
|||
const {database, retentionPolicy, updates} = action.payload
|
||||
|
||||
const newState = {
|
||||
databases: state.databases.map(
|
||||
db =>
|
||||
db.links.self === database.links.self
|
||||
? {
|
||||
...db,
|
||||
retentionPolicies: db.retentionPolicies.map(
|
||||
rp =>
|
||||
rp.links.self === retentionPolicy.links.self
|
||||
? {...rp, ...updates}
|
||||
: rp
|
||||
),
|
||||
}
|
||||
: db
|
||||
databases: state.databases.map((db) =>
|
||||
db.links.self === database.links.self
|
||||
? {
|
||||
...db,
|
||||
retentionPolicies: db.retentionPolicies.map((rp) =>
|
||||
rp.links.self === retentionPolicy.links.self
|
||||
? {...rp, ...updates}
|
||||
: rp
|
||||
),
|
||||
}
|
||||
: db
|
||||
),
|
||||
}
|
||||
|
||||
|
@ -191,19 +185,17 @@ const adminInfluxDB = (state = initialState, action) => {
|
|||
const {database, retentionPolicy} = action.payload
|
||||
|
||||
const newState = {
|
||||
databases: state.databases.map(
|
||||
db =>
|
||||
db.links.self === database.links.self
|
||||
? {
|
||||
...db,
|
||||
retentionPolicies: db.retentionPolicies.map(
|
||||
rp =>
|
||||
rp.links.self === retentionPolicy.links.self
|
||||
? {...rp, ...retentionPolicy}
|
||||
: rp
|
||||
),
|
||||
}
|
||||
: db
|
||||
databases: state.databases.map((db) =>
|
||||
db.links.self === database.links.self
|
||||
? {
|
||||
...db,
|
||||
retentionPolicies: db.retentionPolicies.map((rp) =>
|
||||
rp.links.self === retentionPolicy.links.self
|
||||
? {...rp, ...retentionPolicy}
|
||||
: rp
|
||||
),
|
||||
}
|
||||
: db
|
||||
),
|
||||
}
|
||||
|
||||
|
@ -213,7 +205,7 @@ const adminInfluxDB = (state = initialState, action) => {
|
|||
case 'INFLUXDB_DELETE_USER': {
|
||||
const {user} = action.payload
|
||||
const newState = {
|
||||
users: state.users.filter(u => u.links.self !== user.links.self),
|
||||
users: state.users.filter((u) => u.links.self !== user.links.self),
|
||||
}
|
||||
|
||||
return {...state, ...newState}
|
||||
|
@ -222,7 +214,7 @@ const adminInfluxDB = (state = initialState, action) => {
|
|||
case 'INFLUXDB_DELETE_ROLE': {
|
||||
const {role} = action.payload
|
||||
const newState = {
|
||||
roles: state.roles.filter(r => r.links.self !== role.links.self),
|
||||
roles: state.roles.filter((r) => r.links.self !== role.links.self),
|
||||
}
|
||||
|
||||
return {...state, ...newState}
|
||||
|
@ -232,7 +224,7 @@ const adminInfluxDB = (state = initialState, action) => {
|
|||
const {database} = action.payload
|
||||
const newState = {
|
||||
databases: state.databases.filter(
|
||||
db => db.links.self !== database.links.self
|
||||
(db) => db.links.self !== database.links.self
|
||||
),
|
||||
}
|
||||
|
||||
|
@ -242,16 +234,15 @@ const adminInfluxDB = (state = initialState, action) => {
|
|||
case 'INFLUXDB_REMOVE_RETENTION_POLICY': {
|
||||
const {database, retentionPolicy} = action.payload
|
||||
const newState = {
|
||||
databases: state.databases.map(
|
||||
db =>
|
||||
db.links.self === database.links.self
|
||||
? {
|
||||
...db,
|
||||
retentionPolicies: db.retentionPolicies.filter(
|
||||
rp => rp.links.self !== retentionPolicy.links.self
|
||||
),
|
||||
}
|
||||
: db
|
||||
databases: state.databases.map((db) =>
|
||||
db.links.self === database.links.self
|
||||
? {
|
||||
...db,
|
||||
retentionPolicies: db.retentionPolicies.filter(
|
||||
(rp) => rp.links.self !== retentionPolicy.links.self
|
||||
),
|
||||
}
|
||||
: db
|
||||
),
|
||||
}
|
||||
|
||||
|
@ -261,9 +252,8 @@ const adminInfluxDB = (state = initialState, action) => {
|
|||
case 'INFLUXDB_ADD_DATABASE_DELETE_CODE': {
|
||||
const {database} = action.payload
|
||||
const newState = {
|
||||
databases: state.databases.map(
|
||||
db =>
|
||||
db.links.self === database.links.self ? {...db, deleteCode: ''} : db
|
||||
databases: state.databases.map((db) =>
|
||||
db.links.self === database.links.self ? {...db, deleteCode: ''} : db
|
||||
),
|
||||
}
|
||||
|
||||
|
@ -275,8 +265,8 @@ const adminInfluxDB = (state = initialState, action) => {
|
|||
delete database.deleteCode
|
||||
|
||||
const newState = {
|
||||
databases: state.databases.map(
|
||||
db => (db.links.self === database.links.self ? {...database} : db)
|
||||
databases: state.databases.map((db) =>
|
||||
db.links.self === database.links.self ? {...database} : db
|
||||
),
|
||||
}
|
||||
|
||||
|
@ -290,7 +280,7 @@ const adminInfluxDB = (state = initialState, action) => {
|
|||
case 'INFLUXDB_FILTER_USERS': {
|
||||
const {text} = action.payload
|
||||
const newState = {
|
||||
users: state.users.map(u => {
|
||||
users: state.users.map((u) => {
|
||||
u.hidden = !u.name.toLowerCase().includes(text)
|
||||
return u
|
||||
}),
|
||||
|
@ -301,7 +291,7 @@ const adminInfluxDB = (state = initialState, action) => {
|
|||
case 'INFLUXDB_FILTER_ROLES': {
|
||||
const {text} = action.payload
|
||||
const newState = {
|
||||
roles: state.roles.map(r => {
|
||||
roles: state.roles.map((r) => {
|
||||
r.hidden = !r.name.toLowerCase().includes(text)
|
||||
return r
|
||||
}),
|
||||
|
@ -312,7 +302,7 @@ const adminInfluxDB = (state = initialState, action) => {
|
|||
case 'INFLUXDB_KILL_QUERY': {
|
||||
const {queryID} = action.payload
|
||||
const nextState = {
|
||||
queries: reject(state.queries, q => +q.id === +queryID),
|
||||
queries: reject(state.queries, (q) => +q.id === +queryID),
|
||||
}
|
||||
|
||||
return {...state, ...nextState}
|
||||
|
|
|
@ -9,7 +9,11 @@ import SplashPage from 'shared/components/SplashPage'
|
|||
const VERSION = process.env.npm_package_version
|
||||
|
||||
const Login = ({authData: {auth}}) => {
|
||||
if (Array.isArray(auth.links) && auth.links.length === 1 && auth.links[0].redirectLogin) {
|
||||
if (
|
||||
Array.isArray(auth.links) &&
|
||||
auth.links.length === 1 &&
|
||||
auth.links[0].redirectLogin
|
||||
) {
|
||||
window.location.href = auth.links[0].login
|
||||
}
|
||||
|
||||
|
|
|
@ -11,11 +11,11 @@ import SplashPage from 'shared/components/SplashPage'
|
|||
import PurgatoryAuthItem from 'src/auth/PurgatoryAuthItem'
|
||||
|
||||
const getRoleNameByOrgID = (id, roles) => {
|
||||
const role = roles.find(r => r.organization === id)
|
||||
const role = roles.find((r) => r.organization === id)
|
||||
return (role && role.name) || 'ghost'
|
||||
}
|
||||
|
||||
const handleClickLogin = props => organization => async e => {
|
||||
const handleClickLogin = (props) => (organization) => async (e) => {
|
||||
e.preventDefault()
|
||||
const {router, links, meChangeOrganization} = props
|
||||
|
||||
|
@ -49,7 +49,7 @@ class Purgatory extends Component {
|
|||
superAdmin,
|
||||
} = me
|
||||
|
||||
const rolesAndOrgs = organizations.map(organization => ({
|
||||
const rolesAndOrgs = organizations.map((organization) => ({
|
||||
organization,
|
||||
role: getRoleNameByOrgID(organization.id, roles),
|
||||
currentOrganization: organization.id === currentOrganization.id,
|
||||
|
@ -141,10 +141,11 @@ const mapStateToProps = ({links, auth: {me, logoutLink}}) => ({
|
|||
me,
|
||||
})
|
||||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
meChangeOrganization: bindActionCreators(meChangeOrganizationAsync, dispatch),
|
||||
})
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(
|
||||
withRouter(Purgatory)
|
||||
)
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withRouter(Purgatory))
|
||||
|
|
|
@ -24,7 +24,9 @@ const PurgatoryAuthItem = ({roleAndOrg, onClickLogin, superAdmin}) => (
|
|||
</button>
|
||||
) : (
|
||||
<span className="auth--list-blocked">
|
||||
Contact your Admin<br />for access
|
||||
Contact your Admin
|
||||
<br />
|
||||
for access
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
@ -21,12 +21,12 @@ const Dashboard = ({
|
|||
setScrollTop,
|
||||
inView,
|
||||
}) => {
|
||||
const cells = dashboard.cells.map(cell => {
|
||||
const cells = dashboard.cells.map((cell) => {
|
||||
const dashboardCell = {
|
||||
...cell,
|
||||
inView: inView(cell),
|
||||
}
|
||||
dashboardCell.queries = dashboardCell.queries.map(q => ({
|
||||
dashboardCell.queries = dashboardCell.queries.map((q) => ({
|
||||
...q,
|
||||
database: q.db,
|
||||
text: q.query,
|
||||
|
|
|
@ -32,7 +32,7 @@ class MeasurementDropdown extends Component {
|
|||
const {measurement, onSelectMeasurement, onStartEdit} = this.props
|
||||
return (
|
||||
<Dropdown
|
||||
items={measurements.map(text => ({text}))}
|
||||
items={measurements.map((text) => ({text}))}
|
||||
selected={measurement || 'Select Measurement'}
|
||||
onChoose={onSelectMeasurement}
|
||||
onClick={onStartEdit}
|
||||
|
|
|
@ -35,7 +35,7 @@ class TagKeyDropdown extends Component {
|
|||
const {tagKey, onSelectTagKey} = this.props
|
||||
return (
|
||||
<Dropdown
|
||||
items={tagKeys.map(text => ({text}))}
|
||||
items={tagKeys.map((text) => ({text}))}
|
||||
selected={tagKey || 'Select Tag Key'}
|
||||
onChoose={onSelectTagKey}
|
||||
onClick={this.handleStartEdit}
|
||||
|
|
|
@ -5,9 +5,9 @@ export const minDropdownWidth = 120
|
|||
export const maxDropdownWidth = 330
|
||||
export const dropdownPadding = 30
|
||||
|
||||
const valueLength = a => _.size(a.value)
|
||||
const valueLength = (a) => _.size(a.value)
|
||||
|
||||
export const calculateDropdownWidth = values => {
|
||||
export const calculateDropdownWidth = (values) => {
|
||||
if (!values || !values.length) {
|
||||
return minDropdownWidth
|
||||
}
|
||||
|
|
|
@ -62,8 +62,10 @@ CodeMirror.simpleMode = function (config, states) {
|
|||
s.persistentStates = {
|
||||
mode: pers.mode,
|
||||
spec: pers.spec,
|
||||
state: pers.state === state.localState ?
|
||||
s.localState : CodeMirror.copyState(pers.mode, pers.state),
|
||||
state:
|
||||
pers.state === state.localState
|
||||
? s.localState
|
||||
: CodeMirror.copyState(pers.mode, pers.state),
|
||||
next: s.persistentStates,
|
||||
}
|
||||
}
|
||||
|
@ -71,10 +73,12 @@ CodeMirror.simpleMode = function (config, states) {
|
|||
},
|
||||
token: tokenFunction(states_, config),
|
||||
innerMode(state) {
|
||||
return state.local && {
|
||||
mode: state.local.mode,
|
||||
state: state.localState
|
||||
}
|
||||
return (
|
||||
state.local && {
|
||||
mode: state.local.mode,
|
||||
state: state.localState,
|
||||
}
|
||||
)
|
||||
},
|
||||
indent: indentFunction(states_, meta),
|
||||
}
|
||||
|
@ -88,57 +92,61 @@ CodeMirror.simpleMode = function (config, states) {
|
|||
return mode
|
||||
}
|
||||
|
||||
CodeMirror.defineOption("placeholder", "", function (cm, val, old) {
|
||||
var prev = old && old != CodeMirror.Init;
|
||||
CodeMirror.defineOption('placeholder', '', function (cm, val, old) {
|
||||
var prev = old && old != CodeMirror.Init
|
||||
if (val && !prev) {
|
||||
cm.on("blur", onBlur);
|
||||
cm.on("change", onChange);
|
||||
cm.on("swapDoc", onChange);
|
||||
onChange(cm);
|
||||
cm.on('blur', onBlur)
|
||||
cm.on('change', onChange)
|
||||
cm.on('swapDoc', onChange)
|
||||
onChange(cm)
|
||||
} else if (!val && prev) {
|
||||
cm.off("blur", onBlur);
|
||||
cm.off("change", onChange);
|
||||
cm.off("swapDoc", onChange);
|
||||
clearPlaceholder(cm);
|
||||
var wrapper = cm.getWrapperElement();
|
||||
wrapper.className = wrapper.className.replace(" CodeMirror-empty", "");
|
||||
cm.off('blur', onBlur)
|
||||
cm.off('change', onChange)
|
||||
cm.off('swapDoc', onChange)
|
||||
clearPlaceholder(cm)
|
||||
var wrapper = cm.getWrapperElement()
|
||||
wrapper.className = wrapper.className.replace(' CodeMirror-empty', '')
|
||||
}
|
||||
|
||||
if (val && !cm.hasFocus()) onBlur(cm);
|
||||
});
|
||||
if (val && !cm.hasFocus()) onBlur(cm)
|
||||
})
|
||||
|
||||
function clearPlaceholder(cm) {
|
||||
if (cm.state.placeholder) {
|
||||
cm.state.placeholder.parentNode.removeChild(cm.state.placeholder);
|
||||
cm.state.placeholder = null;
|
||||
cm.state.placeholder.parentNode.removeChild(cm.state.placeholder)
|
||||
cm.state.placeholder = null
|
||||
}
|
||||
}
|
||||
function setPlaceholder(cm) {
|
||||
clearPlaceholder(cm);
|
||||
var elt = cm.state.placeholder = document.createElement("pre");
|
||||
elt.style.cssText = "height: 0; overflow: visible";
|
||||
elt.style.direction = cm.getOption("direction");
|
||||
elt.className = "CodeMirror-placeholder";
|
||||
var placeHolder = cm.getOption("placeholder")
|
||||
if (typeof placeHolder == "string") placeHolder = document.createTextNode(placeHolder)
|
||||
clearPlaceholder(cm)
|
||||
var elt = (cm.state.placeholder = document.createElement('pre'))
|
||||
elt.style.cssText = 'height: 0; overflow: visible'
|
||||
elt.style.direction = cm.getOption('direction')
|
||||
elt.className = 'CodeMirror-placeholder'
|
||||
var placeHolder = cm.getOption('placeholder')
|
||||
if (typeof placeHolder == 'string')
|
||||
placeHolder = document.createTextNode(placeHolder)
|
||||
elt.appendChild(placeHolder)
|
||||
cm.display.lineSpace.insertBefore(elt, cm.display.lineSpace.firstChild);
|
||||
cm.display.lineSpace.insertBefore(elt, cm.display.lineSpace.firstChild)
|
||||
}
|
||||
|
||||
function onBlur(cm) {
|
||||
if (isEmpty(cm)) setPlaceholder(cm);
|
||||
if (isEmpty(cm)) setPlaceholder(cm)
|
||||
}
|
||||
|
||||
function onChange(cm) {
|
||||
var wrapper = cm.getWrapperElement(), empty = isEmpty(cm);
|
||||
wrapper.className = wrapper.className.replace(" CodeMirror-empty", "") + (empty ? " CodeMirror-empty" : "");
|
||||
var wrapper = cm.getWrapperElement(),
|
||||
empty = isEmpty(cm)
|
||||
wrapper.className =
|
||||
wrapper.className.replace(' CodeMirror-empty', '') +
|
||||
(empty ? ' CodeMirror-empty' : '')
|
||||
|
||||
if (empty) setPlaceholder(cm);
|
||||
else clearPlaceholder(cm);
|
||||
if (empty) setPlaceholder(cm)
|
||||
else clearPlaceholder(cm)
|
||||
}
|
||||
|
||||
function isEmpty(cm) {
|
||||
return (cm.lineCount() === 1) && (cm.getLine(0) === "");
|
||||
return cm.lineCount() === 1 && cm.getLine(0) === ''
|
||||
}
|
||||
|
||||
function ensureState(states, name) {
|
||||
|
@ -226,8 +234,8 @@ function tokenFunction(states, config) {
|
|||
if (matches) {
|
||||
if (rule.data.next) {
|
||||
state.state = rule.data.next
|
||||
} else if (rule.data.push) {;
|
||||
(state.stack || (state.stack = [])).push(state.state)
|
||||
} else if (rule.data.push) {
|
||||
;(state.stack || (state.stack = [])).push(state.state)
|
||||
state.state = rule.data.push
|
||||
} else if (rule.data.pop && state.stack && state.stack.length) {
|
||||
state.state = state.stack.pop()
|
||||
|
@ -252,7 +260,7 @@ function tokenFunction(states, config) {
|
|||
if (matches[j]) {
|
||||
state.pending.push({
|
||||
text: matches[j],
|
||||
token: rule.token[j - 1]
|
||||
token: rule.token[j - 1],
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -304,9 +312,9 @@ function enterLocalMode(config, state, spec, token) {
|
|||
}
|
||||
}
|
||||
}
|
||||
const mode = pers ?
|
||||
pers.mode :
|
||||
spec.mode || CodeMirror.getMode(config, spec.spec)
|
||||
const mode = pers
|
||||
? pers.mode
|
||||
: spec.mode || CodeMirror.getMode(config, spec.spec)
|
||||
const lState = pers ? pers.state : CodeMirror.startState(mode)
|
||||
if (spec.persistent && !pers) {
|
||||
state.persistentStates = {
|
||||
|
@ -376,4 +384,4 @@ CodeMirror.defineSimpleMode('flux', modeFlux)
|
|||
CodeMirror.defineSimpleMode('tickscript', modeTickscript)
|
||||
CodeMirror.defineSimpleMode('influxQL', modeInfluxQL)
|
||||
CodeMirror.defineSimpleMode('influxQLReadOnly', modeInfluxQLReadOnly)
|
||||
CodeMirror.defineSimpleMode('markdown', modeMarkdown)
|
||||
CodeMirror.defineSimpleMode('markdown', modeMarkdown)
|
||||
|
|
|
@ -29,7 +29,7 @@ const download = (data, strFileName, strMimeType) => {
|
|||
let payload = data
|
||||
let url = !strFileName && !strMimeType && payload
|
||||
const anchor = document.createElement('a')
|
||||
const toString = a => `${a}`
|
||||
const toString = (a) => `${a}`
|
||||
let myBlob = _window.Blob || _window.MozBlob || _window.WebKitBlob || toString
|
||||
let fileName = strFileName || 'download'
|
||||
let reader
|
||||
|
@ -37,20 +37,17 @@ const download = (data, strFileName, strMimeType) => {
|
|||
|
||||
if (url && url.length < 2048) {
|
||||
// if no filename and no mime, assume a url was passed as the only argument
|
||||
fileName = url
|
||||
.split('/')
|
||||
.pop()
|
||||
.split('?')[0]
|
||||
fileName = url.split('/').pop().split('?')[0]
|
||||
anchor.href = url // assign href prop to temp anchor
|
||||
if (anchor.href.indexOf(url) !== -1) {
|
||||
// if the browser determines that it's a potentially valid url path:
|
||||
const ajax = new XMLHttpRequest()
|
||||
ajax.open('GET', url, true)
|
||||
ajax.responseType = 'blob'
|
||||
ajax.onload = function(e) {
|
||||
ajax.onload = function (e) {
|
||||
download(e.target.response, fileName, defaultMime)
|
||||
}
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
ajax.send()
|
||||
}, 0) // allows setting custom ajax headers using the return:
|
||||
return ajax
|
||||
|
@ -66,11 +63,11 @@ const download = (data, strFileName, strMimeType) => {
|
|||
anchor.innerHTML = 'downloading...'
|
||||
anchor.style.display = 'none'
|
||||
document.body.appendChild(anchor)
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
anchor.click()
|
||||
document.body.removeChild(anchor)
|
||||
if (winMode === true) {
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
_window.URL.revokeObjectURL(anchor.href)
|
||||
}, 250)
|
||||
}
|
||||
|
@ -87,7 +84,7 @@ const download = (data, strFileName, strMimeType) => {
|
|||
url = `data:${url.replace(/^data:([\w/\-+]+)/, defaultMime)}`
|
||||
}
|
||||
f.src = url
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
document.body.removeChild(f)
|
||||
}, 333)
|
||||
} // end saver
|
||||
|
@ -129,7 +126,7 @@ const download = (data, strFileName, strMimeType) => {
|
|||
|
||||
// Blob but not URL support:
|
||||
reader = new FileReader()
|
||||
reader.onload = function() {
|
||||
reader.onload = function () {
|
||||
saver(this.result)
|
||||
}
|
||||
reader.readAsDataURL(blob)
|
||||
|
|
|
@ -34,7 +34,7 @@ import Dygraph from 'dygraphs/src-es5/dygraph'
|
|||
* The `range` option has no effect unless `zoom` is true (the default).
|
||||
*/
|
||||
|
||||
var synchronize = function(/* dygraphs..., opts */) {
|
||||
var synchronize = function (/* dygraphs..., opts */) {
|
||||
if (arguments.length === 0) {
|
||||
throw 'Invalid invocation of Dygraph.synchronize(). Need >= 1 argument.'
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ var synchronize = function(/* dygraphs..., opts */) {
|
|||
var dygraphs = []
|
||||
var prevCallbacks = []
|
||||
|
||||
var parseOpts = function(obj) {
|
||||
var parseOpts = function (obj) {
|
||||
if (!(obj instanceof Object)) {
|
||||
throw 'Last argument must be either Dygraph or Object.'
|
||||
} else {
|
||||
|
@ -69,8 +69,10 @@ var synchronize = function(/* dygraphs..., opts */) {
|
|||
}
|
||||
}
|
||||
if (i < arguments.length - 1) {
|
||||
throw 'Invalid invocation of Dygraph.synchronize(). ' +
|
||||
throw (
|
||||
'Invalid invocation of Dygraph.synchronize(). ' +
|
||||
'All but the last argument must be Dygraph objects.'
|
||||
)
|
||||
} else if (i == arguments.length - 1) {
|
||||
parseOpts(arguments[arguments.length - 1])
|
||||
}
|
||||
|
@ -82,23 +84,29 @@ var synchronize = function(/* dygraphs..., opts */) {
|
|||
if (arguments.length == 2) {
|
||||
parseOpts(arguments[1])
|
||||
} else if (arguments.length > 2) {
|
||||
throw 'Invalid invocation of Dygraph.synchronize(). ' +
|
||||
throw (
|
||||
'Invalid invocation of Dygraph.synchronize(). ' +
|
||||
'Expected two arguments: array and optional options argument.'
|
||||
)
|
||||
} // otherwise arguments.length == 1, which is fine.
|
||||
} else {
|
||||
throw 'Invalid invocation of Dygraph.synchronize(). ' +
|
||||
throw (
|
||||
'Invalid invocation of Dygraph.synchronize(). ' +
|
||||
'First parameter must be either Dygraph or list of Dygraphs.'
|
||||
)
|
||||
}
|
||||
|
||||
if (dygraphs.length < 2) {
|
||||
throw 'Invalid invocation of Dygraph.synchronize(). ' +
|
||||
throw (
|
||||
'Invalid invocation of Dygraph.synchronize(). ' +
|
||||
'Need two or more dygraphs to synchronize.'
|
||||
)
|
||||
}
|
||||
|
||||
var readycount = dygraphs.length
|
||||
for (var i = 0; i < dygraphs.length; i++) {
|
||||
var g = dygraphs[i]
|
||||
g.ready(function() {
|
||||
g.ready(function () {
|
||||
if (--readycount == 0) {
|
||||
// store original callbacks
|
||||
var callBackTypes = [
|
||||
|
@ -130,7 +138,7 @@ var synchronize = function(/* dygraphs..., opts */) {
|
|||
}
|
||||
|
||||
return {
|
||||
detach: function() {
|
||||
detach: function () {
|
||||
for (var i = 0; i < dygraphs.length; i++) {
|
||||
var g = dygraphs[i]
|
||||
if (opts.zoom) {
|
||||
|
@ -167,7 +175,7 @@ function attachZoomHandlers(gs, syncOpts, prevCallbacks) {
|
|||
var g = gs[i]
|
||||
g.updateOptions(
|
||||
{
|
||||
drawCallback: function(me, initial) {
|
||||
drawCallback: function (me, initial) {
|
||||
if (block || initial) return
|
||||
block = true
|
||||
// In the original code, the following assignment was originally
|
||||
|
@ -209,7 +217,7 @@ function attachSelectionHandlers(gs, prevCallbacks) {
|
|||
|
||||
g.updateOptions(
|
||||
{
|
||||
highlightCallback: function(event, x, points, row, seriesName) {
|
||||
highlightCallback: function (event, x, points, row, seriesName) {
|
||||
if (block) return
|
||||
block = true
|
||||
var me = this
|
||||
|
@ -227,7 +235,7 @@ function attachSelectionHandlers(gs, prevCallbacks) {
|
|||
}
|
||||
block = false
|
||||
},
|
||||
unhighlightCallback: function(event) {
|
||||
unhighlightCallback: function (event) {
|
||||
if (block) return
|
||||
block = true
|
||||
var me = this
|
||||
|
@ -257,7 +265,7 @@ function isValidPoint(p, opt_allowNaNY) {
|
|||
return true
|
||||
}
|
||||
|
||||
Dygraph.prototype.findClosestPoint = function(domX, domY) {
|
||||
Dygraph.prototype.findClosestPoint = function (domX, domY) {
|
||||
if (Dygraph.VERSION !== '2.0.0') {
|
||||
console.error(
|
||||
`Dygraph version changed to ${Dygraph.VERSION} - re-copy findClosestPoint`
|
||||
|
@ -303,7 +311,7 @@ Dygraph.prototype.findClosestPoint = function(domX, domY) {
|
|||
|
||||
Dygraph.synchronize = synchronize
|
||||
|
||||
Dygraph.Plugins.Crosshair = (function() {
|
||||
Dygraph.Plugins.Crosshair = (function () {
|
||||
'use strict'
|
||||
/**
|
||||
* Creates the crosshair
|
||||
|
@ -311,13 +319,13 @@ Dygraph.Plugins.Crosshair = (function() {
|
|||
* @constructor
|
||||
*/
|
||||
|
||||
var crosshair = function(opt_options) {
|
||||
var crosshair = function (opt_options) {
|
||||
this.canvas_ = document.createElement('canvas')
|
||||
opt_options = opt_options || {}
|
||||
this.direction_ = opt_options.direction || null
|
||||
}
|
||||
|
||||
crosshair.prototype.toString = function() {
|
||||
crosshair.prototype.toString = function () {
|
||||
return 'Crosshair Plugin'
|
||||
}
|
||||
|
||||
|
@ -325,7 +333,7 @@ Dygraph.Plugins.Crosshair = (function() {
|
|||
* @param {Dygraph} g Graph instance.
|
||||
* @return {object.<string, function(ev)>} Mapping of event names to callbacks.
|
||||
*/
|
||||
crosshair.prototype.activate = function(g) {
|
||||
crosshair.prototype.activate = function (g) {
|
||||
g.graphDiv.appendChild(this.canvas_)
|
||||
|
||||
return {
|
||||
|
@ -334,7 +342,7 @@ Dygraph.Plugins.Crosshair = (function() {
|
|||
}
|
||||
}
|
||||
|
||||
crosshair.prototype.select = function(e) {
|
||||
crosshair.prototype.select = function (e) {
|
||||
if (this.direction_ === null) {
|
||||
return
|
||||
}
|
||||
|
@ -378,12 +386,12 @@ Dygraph.Plugins.Crosshair = (function() {
|
|||
}
|
||||
}
|
||||
|
||||
crosshair.prototype.deselect = function(e) {
|
||||
crosshair.prototype.deselect = function (e) {
|
||||
var ctx = this.canvas_.getContext('2d')
|
||||
ctx.clearRect(0, 0, this.canvas_.width, this.canvas_.height)
|
||||
}
|
||||
|
||||
crosshair.prototype.destroy = function() {
|
||||
crosshair.prototype.destroy = function () {
|
||||
this.canvas_ = null
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ const exprStr = ({expr, val, type}) => {
|
|||
}
|
||||
}
|
||||
|
||||
const recurse = root => {
|
||||
const recurse = (root) => {
|
||||
const {expr} = root
|
||||
|
||||
if (expr === 'binary') {
|
||||
|
@ -40,7 +40,7 @@ const recurse = root => {
|
|||
return exprStr(root)
|
||||
}
|
||||
|
||||
export const toString = ast => {
|
||||
export const toString = (ast) => {
|
||||
const {fields, sources, condition, groupBy, orderbys, limits} = ast
|
||||
|
||||
const strs = ['SELECT']
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {toString} from './ast'
|
||||
|
||||
const InfluxQL = ast => {
|
||||
const InfluxQL = (ast) => {
|
||||
return {
|
||||
// select: () =>
|
||||
toString: () => toString(ast),
|
||||
|
|
|
@ -22,7 +22,7 @@ import {
|
|||
notifyTickscriptUpdateFailed,
|
||||
} from 'shared/copy/notifications'
|
||||
|
||||
const loadQuery = query => ({
|
||||
const loadQuery = (query) => ({
|
||||
type: 'KAPA_LOAD_QUERY',
|
||||
payload: {
|
||||
query,
|
||||
|
@ -30,8 +30,8 @@ const loadQuery = query => ({
|
|||
})
|
||||
|
||||
export function fetchRule(source, ruleID) {
|
||||
return dispatch => {
|
||||
getActiveKapacitor(source).then(kapacitor => {
|
||||
return (dispatch) => {
|
||||
getActiveKapacitor(source).then((kapacitor) => {
|
||||
getRuleAJAX(kapacitor, ruleID).then(({data: rule}) => {
|
||||
dispatch({
|
||||
type: 'LOAD_RULE',
|
||||
|
@ -45,14 +45,14 @@ export function fetchRule(source, ruleID) {
|
|||
}
|
||||
}
|
||||
|
||||
const addQuery = queryID => ({
|
||||
const addQuery = (queryID) => ({
|
||||
type: 'KAPA_ADD_QUERY',
|
||||
payload: {
|
||||
queryID,
|
||||
},
|
||||
})
|
||||
|
||||
export const getRule = (kapacitor, ruleID) => async dispatch => {
|
||||
export const getRule = (kapacitor, ruleID) => async (dispatch) => {
|
||||
try {
|
||||
const {data: rule} = await getRuleAJAX(kapacitor, ruleID)
|
||||
|
||||
|
@ -78,7 +78,7 @@ export const getRule = (kapacitor, ruleID) => async dispatch => {
|
|||
}
|
||||
|
||||
export const loadDefaultRule = () => {
|
||||
return dispatch => {
|
||||
return (dispatch) => {
|
||||
const queryID = uuid.v4()
|
||||
dispatch({
|
||||
type: 'LOAD_DEFAULT_RULE',
|
||||
|
@ -90,7 +90,7 @@ export const loadDefaultRule = () => {
|
|||
}
|
||||
}
|
||||
|
||||
export const fetchRules = kapacitor => async dispatch => {
|
||||
export const fetchRules = (kapacitor) => async (dispatch) => {
|
||||
try {
|
||||
const {
|
||||
data: {rules},
|
||||
|
@ -117,7 +117,7 @@ export const addEvery = (ruleID, frequency) => ({
|
|||
},
|
||||
})
|
||||
|
||||
export const removeEvery = ruleID => ({
|
||||
export const removeEvery = (ruleID) => ({
|
||||
type: 'REMOVE_EVERY',
|
||||
payload: {
|
||||
ruleID,
|
||||
|
@ -164,7 +164,7 @@ export const updateRuleName = (ruleID, name) => ({
|
|||
},
|
||||
})
|
||||
|
||||
export const deleteRuleSuccess = ruleID => ({
|
||||
export const deleteRuleSuccess = (ruleID) => ({
|
||||
type: 'DELETE_RULE_SUCCESS',
|
||||
payload: {
|
||||
ruleID,
|
||||
|
@ -179,7 +179,7 @@ export const updateRuleStatusSuccess = (ruleID, status) => ({
|
|||
},
|
||||
})
|
||||
|
||||
export const deleteRule = rule => dispatch => {
|
||||
export const deleteRule = (rule) => (dispatch) => {
|
||||
deleteRuleAPI(rule)
|
||||
.then(() => {
|
||||
dispatch(deleteRuleSuccess(rule.id))
|
||||
|
@ -190,7 +190,7 @@ export const deleteRule = rule => dispatch => {
|
|||
})
|
||||
}
|
||||
|
||||
export const updateRuleStatus = (rule, status) => dispatch => {
|
||||
export const updateRuleStatus = (rule, status) => (dispatch) => {
|
||||
updateRuleStatusAPI(rule, status)
|
||||
.then(() => {
|
||||
dispatch(notify(notifyAlertRuleStatusUpdated(rule.name, status)))
|
||||
|
@ -200,7 +200,7 @@ export const updateRuleStatus = (rule, status) => dispatch => {
|
|||
})
|
||||
}
|
||||
|
||||
export const createTask = (kapacitor, task) => async dispatch => {
|
||||
export const createTask = (kapacitor, task) => async (dispatch) => {
|
||||
try {
|
||||
const {data} = await createTaskAJAX(kapacitor, task)
|
||||
dispatch(notify(notifyTickScriptCreated()))
|
||||
|
@ -215,12 +215,9 @@ export const createTask = (kapacitor, task) => async dispatch => {
|
|||
}
|
||||
}
|
||||
|
||||
export const updateTask = (
|
||||
kapacitor,
|
||||
task,
|
||||
ruleID,
|
||||
sourceID
|
||||
) => async dispatch => {
|
||||
export const updateTask = (kapacitor, task, ruleID, sourceID) => async (
|
||||
dispatch
|
||||
) => {
|
||||
try {
|
||||
const {data} = await updateTaskAJAX(kapacitor, task, ruleID, sourceID)
|
||||
dispatch(notify(notifyTickscriptUpdated()))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import AJAX from 'utils/ajax'
|
||||
import {cloneDeep, get} from 'lodash'
|
||||
|
||||
const outRule = rule => {
|
||||
const outRule = (rule) => {
|
||||
// fit into range
|
||||
const {value, rangeValue, operator} = rule.values
|
||||
|
||||
|
@ -12,7 +12,7 @@ const outRule = rule => {
|
|||
// remap serviceNow from '_type' back to 'type', see getRule/getRules
|
||||
if (Array.isArray(get(rule, ['alertNodes', 'serviceNow']))) {
|
||||
rule = cloneDeep(rule)
|
||||
rule.alertNodes.serviceNow = rule.alertNodes.serviceNow.map(val => ({
|
||||
rule.alertNodes.serviceNow = rule.alertNodes.serviceNow.map((val) => ({
|
||||
...val,
|
||||
type: val._type,
|
||||
_type: undefined,
|
||||
|
@ -30,17 +30,17 @@ export const createRule = (kapacitor, rule) => {
|
|||
})
|
||||
}
|
||||
|
||||
export const getRules = kapacitor => {
|
||||
export const getRules = (kapacitor) => {
|
||||
return AJAX({
|
||||
method: 'GET',
|
||||
url: kapacitor.links.rules,
|
||||
}).then(response => {
|
||||
}).then((response) => {
|
||||
// remap serviceNow 'type' to '_type', it conflicts with UI property
|
||||
const rules = get(response, ['data', 'rules'])
|
||||
if (Array.isArray(rules)) {
|
||||
rules.forEach(rule => {
|
||||
rules.forEach((rule) => {
|
||||
if (Array.isArray(rule.alertNodes.serviceNow)) {
|
||||
rule.alertNodes.serviceNow.forEach(x => {
|
||||
rule.alertNodes.serviceNow.forEach((x) => {
|
||||
if (x.type !== undefined) {
|
||||
x._type = x.type
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ export const getRule = async (kapacitor, ruleID) => {
|
|||
// remap serviceNow 'type' to '_type', it conflicts with UI property
|
||||
const serviceNow = get(response, ['data', 'alertNodes', 'serviceNow'])
|
||||
if (Array.isArray(serviceNow)) {
|
||||
serviceNow.forEach(x => {
|
||||
serviceNow.forEach((x) => {
|
||||
if (x.type !== undefined) {
|
||||
x._type = x.type
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ export const getRule = async (kapacitor, ruleID) => {
|
|||
}
|
||||
}
|
||||
|
||||
export const editRule = rule => {
|
||||
export const editRule = (rule) => {
|
||||
return AJAX({
|
||||
method: 'PUT',
|
||||
url: rule.links.self,
|
||||
|
@ -82,7 +82,7 @@ export const editRule = rule => {
|
|||
})
|
||||
}
|
||||
|
||||
export const deleteRule = rule => {
|
||||
export const deleteRule = (rule) => {
|
||||
return AJAX({
|
||||
method: 'DELETE',
|
||||
url: rule.links.self,
|
||||
|
@ -156,7 +156,7 @@ export const getLogStreamByRuleID = (kapacitor, ruleID, signal) => {
|
|||
})
|
||||
}
|
||||
|
||||
export const pingKapacitorVersion = async kapacitor => {
|
||||
export const pingKapacitorVersion = async (kapacitor) => {
|
||||
try {
|
||||
const result = await AJAX({
|
||||
method: 'GET',
|
||||
|
|
|
@ -25,7 +25,7 @@ export default function rules(state = {}, action) {
|
|||
|
||||
case 'LOAD_RULES': {
|
||||
const theRules = action.payload.rules
|
||||
const ruleIDs = theRules.map(r => r.id)
|
||||
const ruleIDs = theRules.map((r) => r.id)
|
||||
return _.zipObject(ruleIDs, theRules)
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ export default function rules(state = {}, action) {
|
|||
case 'UPDATE_RULE_ALERT_NODES': {
|
||||
const {ruleID, alerts} = action.payload
|
||||
const alertNodesByType = {}
|
||||
_.forEach(alerts, h => {
|
||||
_.forEach(alerts, (h) => {
|
||||
if (h.enabled) {
|
||||
if (h.type === 'post') {
|
||||
if (h.url === '') {
|
||||
|
|
|
@ -5,7 +5,7 @@ const dashrefresh = (refreshes) => {
|
|||
return []
|
||||
}
|
||||
|
||||
const normalized = refreshes.filter(r => {
|
||||
const normalized = refreshes.filter((r) => {
|
||||
if (!isObject(r)) {
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import _ from 'lodash'
|
||||
|
||||
const dashtime = ranges => {
|
||||
const dashtime = (ranges) => {
|
||||
if (!Array.isArray(ranges)) {
|
||||
return []
|
||||
}
|
||||
|
||||
const normalized = ranges.filter(r => {
|
||||
const normalized = ranges.filter((r) => {
|
||||
if (!_.isObject(r)) {
|
||||
return false
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ const dashtime = ranges => {
|
|||
return false
|
||||
}
|
||||
|
||||
const isCorrectType = bound =>
|
||||
const isCorrectType = (bound) =>
|
||||
_.isString(bound) || _.isNull(bound) || _.isInteger(bound)
|
||||
|
||||
if (!isCorrectType(lower) || !isCorrectType(upper)) {
|
||||
|
|
|
@ -9,7 +9,7 @@ export const getAuthConfigRequested = () => ({
|
|||
type: 'CHRONOGRAF_GET_AUTH_CONFIG_REQUESTED',
|
||||
})
|
||||
|
||||
export const getAuthConfigCompleted = authConfig => ({
|
||||
export const getAuthConfigCompleted = (authConfig) => ({
|
||||
type: 'CHRONOGRAF_GET_AUTH_CONFIG_COMPLETED',
|
||||
payload: {
|
||||
authConfig,
|
||||
|
@ -20,7 +20,7 @@ export const getAuthConfigFailed = () => ({
|
|||
type: 'CHRONOGRAF_GET_AUTH_CONFIG_FAILED',
|
||||
})
|
||||
|
||||
export const updateAuthConfigRequested = authConfig => ({
|
||||
export const updateAuthConfigRequested = (authConfig) => ({
|
||||
type: 'CHRONOGRAF_UPDATE_AUTH_CONFIG_REQUESTED',
|
||||
payload: {
|
||||
authConfig,
|
||||
|
@ -31,7 +31,7 @@ export const updateAuthConfigCompleted = () => ({
|
|||
type: 'CHRONOGRAF_UPDATE_AUTH_CONFIG_COMPLETED',
|
||||
})
|
||||
|
||||
export const updateAuthConfigFailed = authConfig => ({
|
||||
export const updateAuthConfigFailed = (authConfig) => ({
|
||||
type: 'CHRONOGRAF_UPDATE_AUTH_CONFIG_FAILED',
|
||||
payload: {
|
||||
authConfig,
|
||||
|
@ -39,7 +39,7 @@ export const updateAuthConfigFailed = authConfig => ({
|
|||
})
|
||||
|
||||
// async actions (thunks)
|
||||
export const getAuthConfigAsync = url => async dispatch => {
|
||||
export const getAuthConfigAsync = (url) => async (dispatch) => {
|
||||
dispatch(getAuthConfigRequested())
|
||||
try {
|
||||
const {data} = await getAuthConfigAJAX(url)
|
||||
|
@ -54,7 +54,7 @@ export const updateAuthConfigAsync = (
|
|||
url,
|
||||
oldAuthConfig,
|
||||
updatedAuthConfig
|
||||
) => async dispatch => {
|
||||
) => async (dispatch) => {
|
||||
const newAuthConfig = {...oldAuthConfig, ...updatedAuthConfig}
|
||||
dispatch(updateAuthConfigRequested(newAuthConfig))
|
||||
try {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import AJAX from 'src/utils/ajax'
|
||||
|
||||
export const getAuthConfig = async url => {
|
||||
export const getAuthConfig = async (url) => {
|
||||
try {
|
||||
return await AJAX({
|
||||
method: 'GET',
|
||||
|
|
|
@ -2,7 +2,7 @@ import AJAX from 'src/utils/ajax'
|
|||
import _ from 'lodash'
|
||||
import {buildInfluxUrl, proxy} from 'utils/queryUrlGenerator'
|
||||
|
||||
export const showDatabases = async source => {
|
||||
export const showDatabases = async (source) => {
|
||||
const query = 'SHOW DATABASES'
|
||||
return await proxy({source, query})
|
||||
}
|
||||
|
@ -11,11 +11,11 @@ export const showRetentionPolicies = async (source, databases) => {
|
|||
let query
|
||||
if (Array.isArray(databases)) {
|
||||
query = databases
|
||||
.map(db => `SHOW RETENTION POLICIES ON "${_.escape(db)}"`)
|
||||
.map((db) => `SHOW RETENTION POLICIES ON "${_.escape(db)}"`)
|
||||
.join(';')
|
||||
} else {
|
||||
const dbs = _.split(databases, ',')
|
||||
.map(d => `${_.escape(d)}`)
|
||||
.map((d) => `${_.escape(d)}`)
|
||||
.join(',')
|
||||
query = `SHOW RETENTION POLICIES ON "${dbs}"`
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ export const showTagValues = async ({
|
|||
}) => {
|
||||
const keys = tagKeys
|
||||
.sort()
|
||||
.map(k => `"${_.escape(k)}"`)
|
||||
.map((k) => `"${_.escape(k)}"`)
|
||||
.join(', ')
|
||||
const rp = _.toString(retentionPolicy)
|
||||
const query = `SHOW TAG VALUES FROM "${rp}"."${_.escape(
|
||||
|
|
|
@ -64,7 +64,7 @@ class CustomTimeRange extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
getInitialDate = time => {
|
||||
getInitialDate = (time) => {
|
||||
const {upper, lower} = this.props.timeRange
|
||||
|
||||
if (upper || lower) {
|
||||
|
@ -97,10 +97,10 @@ class CustomTimeRange extends Component {
|
|||
/*
|
||||
* Upper and lower time ranges are passed in with single quotes as part of
|
||||
* the string literal, i.e. "'2015-09-23T18:00:00.000Z'". Remove them
|
||||
* before passing the string to be parsed. Additionally, return the moment
|
||||
* before passing the string to be parsed. Additionally, return the moment
|
||||
* in the timeZone so that it is formatted well.
|
||||
*/
|
||||
_toMoment = timeRange => {
|
||||
_toMoment = (timeRange) => {
|
||||
const strVal = formatTimeRange(timeRange)
|
||||
const retVal = moment(strVal, dateFormat)
|
||||
if (this.props.timeZone === TimeZones.UTC) {
|
||||
|
@ -115,12 +115,12 @@ class CustomTimeRange extends Component {
|
|||
|
||||
const lowerMoment = this.lowerCal.getMoment()
|
||||
const upperMoment = this.upperCal.getMoment()
|
||||
if (this.props.timeZone === TimeZones.UTC){
|
||||
if (this.props.timeZone === TimeZones.UTC) {
|
||||
// rome calendar does not respect that UTC moment was set
|
||||
if (!lowerMoment.creationData().isUTC){
|
||||
if (!lowerMoment.creationData().isUTC) {
|
||||
lowerMoment.utc(true)
|
||||
}
|
||||
if (!upperMoment.creationData().isUTC){
|
||||
if (!upperMoment.creationData().isUTC) {
|
||||
upperMoment.utc(true)
|
||||
}
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ class CustomTimeRange extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
handleTimeRangeShortcut = shortcut => {
|
||||
handleTimeRangeShortcut = (shortcut) => {
|
||||
return () => {
|
||||
let lower
|
||||
const upper = this.timeZoned(moment())
|
||||
|
@ -202,18 +202,18 @@ class CustomTimeRange extends Component {
|
|||
<div className="custom-time--dates" onClick={this.handleRefreshCals}>
|
||||
<div
|
||||
className="custom-time--lower-container"
|
||||
ref={r => (this.lowerContainer = r)}
|
||||
ref={(r) => (this.lowerContainer = r)}
|
||||
>
|
||||
<input
|
||||
className="custom-time--lower form-control input-sm"
|
||||
ref={r => (this.lower = r)}
|
||||
ref={(r) => (this.lower = r)}
|
||||
placeholder="from"
|
||||
onKeyUp={this.handleRefreshCals}
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
className="custom-time--upper-container"
|
||||
ref={r => (this.upperContainer = r)}
|
||||
ref={(r) => (this.upperContainer = r)}
|
||||
disabled={isNow}
|
||||
>
|
||||
{isNowDisplayed ? (
|
||||
|
@ -228,7 +228,7 @@ class CustomTimeRange extends Component {
|
|||
) : null}
|
||||
<input
|
||||
className="custom-time--upper form-control input-sm"
|
||||
ref={r => (this.upper = r)}
|
||||
ref={(r) => (this.upper = r)}
|
||||
placeholder="to"
|
||||
onKeyUp={this.handleRefreshCals}
|
||||
disabled={isNow}
|
||||
|
@ -270,7 +270,7 @@ CustomTimeRange.propTypes = {
|
|||
page: string,
|
||||
timeZone: string,
|
||||
}
|
||||
const mstp = state => ({
|
||||
const mstp = (state) => ({
|
||||
timeZone: _.get(state, ['app', 'persisted', 'timeZone']),
|
||||
})
|
||||
export default ErrorHandling(connect(mstp)(CustomTimeRange))
|
||||
|
|
|
@ -74,7 +74,7 @@ class InfiniteScroll extends Component {
|
|||
|
||||
throttledHandleResize = _.throttle(this.handleResize, 100)
|
||||
|
||||
handleMakeDiv = className => props => (
|
||||
handleMakeDiv = (className) => (props) => (
|
||||
<div {...props} className={`fancy-scroll--${className}`} />
|
||||
)
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import {ErrorHandling} from 'src/shared/decorators/errors'
|
|||
|
||||
const labelText = ({localSelectedItems, isOpen, label}) => {
|
||||
if (localSelectedItems.length) {
|
||||
return localSelectedItems.map(s => s.name).join(', ')
|
||||
return localSelectedItems.map((s) => s.name).join(', ')
|
||||
}
|
||||
|
||||
if (label) {
|
||||
|
@ -51,7 +51,7 @@ class MultiSelectDropdown extends Component {
|
|||
this.setState({localSelectedItems: nextProps.selectedItems})
|
||||
}
|
||||
|
||||
toggleMenu = e => {
|
||||
toggleMenu = (e) => {
|
||||
e.stopPropagation()
|
||||
this.setState({isOpen: !this.state.isOpen})
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ class MultiSelectDropdown extends Component {
|
|||
|
||||
let nextItems
|
||||
if (this.isSelected(item)) {
|
||||
nextItems = localSelectedItems.filter(i => i.name !== item.name)
|
||||
nextItems = localSelectedItems.filter((i) => i.name !== item.name)
|
||||
} else {
|
||||
nextItems = [...localSelectedItems, item]
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ class MultiSelectDropdown extends Component {
|
|||
return !!this.state.localSelectedItems.find(({name}) => name === item.name)
|
||||
}
|
||||
|
||||
handleApply = e => {
|
||||
handleApply = (e) => {
|
||||
e.stopPropagation()
|
||||
|
||||
this.setState({isOpen: false})
|
||||
|
|
|
@ -11,7 +11,7 @@ export default function enhanceWithClickOutside(WrappedComponent) {
|
|||
document.removeEventListener('click', this.handleClickOutside, true)
|
||||
}
|
||||
|
||||
handleClickOutside = e => {
|
||||
handleClickOutside = (e) => {
|
||||
const domNode = ReactDOM.findDOMNode(this)
|
||||
if (
|
||||
(!domNode || !domNode.contains(e.target)) &&
|
||||
|
@ -25,7 +25,7 @@ export default function enhanceWithClickOutside(WrappedComponent) {
|
|||
return (
|
||||
<WrappedComponent
|
||||
{...this.props}
|
||||
ref={ref => (this.wrappedComponent = ref)}
|
||||
ref={(ref) => (this.wrappedComponent = ref)}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -46,10 +46,13 @@ class TimeRangeDropdown extends Component {
|
|||
return `${format(lower, this.props.timeZone)} - Now`
|
||||
}
|
||||
|
||||
return `${format(lower, this.props.timeZone)} - ${format(upper, this.props.timeZone)}`
|
||||
return `${format(lower, this.props.timeZone)} - ${format(
|
||||
upper,
|
||||
this.props.timeZone
|
||||
)}`
|
||||
}
|
||||
|
||||
const selected = timeRanges.find(range => range.lower === lower)
|
||||
const selected = timeRanges.find((range) => range.lower === lower)
|
||||
return selected ? selected.inputValue : 'Custom'
|
||||
}
|
||||
|
||||
|
@ -57,7 +60,7 @@ class TimeRangeDropdown extends Component {
|
|||
this.setState({isOpen: false})
|
||||
}
|
||||
|
||||
handleSelection = timeRange => () => {
|
||||
handleSelection = (timeRange) => () => {
|
||||
this.setState({customTimeRange: emptyTime, isOpen: false}, () => {
|
||||
window.setTimeout(() => {
|
||||
this.props.onChooseTimeRange(timeRange)
|
||||
|
@ -73,7 +76,7 @@ class TimeRangeDropdown extends Component {
|
|||
this.setState({isCustomTimeRangeOpen: true})
|
||||
}
|
||||
|
||||
handleApplyCustomTimeRange = customTimeRange => {
|
||||
handleApplyCustomTimeRange = (customTimeRange) => {
|
||||
this.props.onChooseTimeRange({...customTimeRange})
|
||||
this.setState({customTimeRange, isOpen: false})
|
||||
}
|
||||
|
@ -137,7 +140,7 @@ class TimeRangeDropdown extends Component {
|
|||
<li className="dropdown-header">
|
||||
{preventCustomTimeRange ? '' : 'Relative '}Time
|
||||
</li>
|
||||
{timeRanges.map(item => {
|
||||
{timeRanges.map((item) => {
|
||||
return (
|
||||
<li className="dropdown-item" key={item.menuOption}>
|
||||
<a href="#" onClick={this.handleSelection(item)}>
|
||||
|
@ -181,7 +184,7 @@ TimeRangeDropdown.propTypes = {
|
|||
timeZone: string,
|
||||
}
|
||||
|
||||
const mstp = state => ({
|
||||
const mstp = (state) => ({
|
||||
timeZone: _.get(state, ['app', 'persisted', 'timeZone']),
|
||||
})
|
||||
export default OnClickOutside(ErrorHandling(connect(mstp)(TimeRangeDropdown)))
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
export default function makeAppStorage(localStorage) {
|
||||
return () => {
|
||||
// eslint-disable-line no-unused-vars
|
||||
return next => {
|
||||
return action => {
|
||||
return (next) => {
|
||||
return (action) => {
|
||||
if (action.meta && action.meta.appStorage) {
|
||||
const stuffToStore = action.meta.appStorage
|
||||
if (Array.isArray(stuffToStore)) {
|
||||
|
|
|
@ -22,7 +22,7 @@ const actionsAllowedDuringBlackout = [
|
|||
const notificationsBlackoutDuration = 5000
|
||||
let allowNotifications = true // eslint-disable-line
|
||||
|
||||
const errorsMiddleware = store => next => action => {
|
||||
const errorsMiddleware = (store) => (next) => (action) => {
|
||||
const {
|
||||
auth: {me},
|
||||
} = store.getState()
|
||||
|
@ -81,7 +81,7 @@ const errorsMiddleware = store => next => action => {
|
|||
// AJAX requests pre-auth expiration and whose response returns post-logout
|
||||
if (
|
||||
me === null &&
|
||||
!actionsAllowedDuringBlackout.some(allowedAction =>
|
||||
!actionsAllowedDuringBlackout.some((allowedAction) =>
|
||||
action.type.includes(allowedAction)
|
||||
)
|
||||
) {
|
||||
|
|
|
@ -3,7 +3,7 @@ import qs from 'qs'
|
|||
|
||||
import {enablePresentationMode} from 'src/shared/actions/app'
|
||||
|
||||
export const queryStringConfig = () => dispatch => action => {
|
||||
export const queryStringConfig = () => (dispatch) => (action) => {
|
||||
dispatch(action)
|
||||
|
||||
const urlQueryParams = qs.parse(window.location.search, {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Trigger resize event to relayout the React Layout plugin
|
||||
export const resizeLayout = () => next => action => {
|
||||
export const resizeLayout = () => (next) => (action) => {
|
||||
next(action)
|
||||
|
||||
if (
|
||||
|
|
|
@ -2,7 +2,7 @@ import _ from 'lodash'
|
|||
import moment from 'moment'
|
||||
import {map} from 'fast.js'
|
||||
|
||||
export const formatDate = timestamp =>
|
||||
export const formatDate = (timestamp) =>
|
||||
moment(timestamp).format('M/D/YYYY h:mm:ss.SSSSSSSSS A')
|
||||
|
||||
export const dataToCSV = ([titleRow, ...valueRows]) => {
|
||||
|
@ -21,6 +21,6 @@ export const dataToCSV = ([titleRow, ...valueRows]) => {
|
|||
return `${titlesString}\n${valuesString}`
|
||||
}
|
||||
const allRows = [titleRow, ...valueRows]
|
||||
const allRowsStringArray = map(allRows, r => r.join(','))
|
||||
const allRowsStringArray = map(allRows, (r) => r.join(','))
|
||||
return allRowsStringArray.join('\n')
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ export function diskBytesFromShard(response) {
|
|||
}
|
||||
|
||||
let sumBytes = 0
|
||||
response.results.forEach(result => {
|
||||
result.series.forEach(series => {
|
||||
response.results.forEach((result) => {
|
||||
result.series.forEach((series) => {
|
||||
const bytesIndex = series.columns.indexOf('last')
|
||||
sumBytes += series.values[0][bytesIndex]
|
||||
})
|
||||
|
@ -55,7 +55,10 @@ export function diskBytesFromShardForDatabase(response) {
|
|||
//
|
||||
|
||||
if (data[shardID]) {
|
||||
const index = _.findIndex(data[shardID], shard => shard.nodeID === nodeID)
|
||||
const index = _.findIndex(
|
||||
data[shardID],
|
||||
(shard) => shard.nodeID === nodeID
|
||||
)
|
||||
if (index > -1) {
|
||||
data[shardID][index].diskUsage += diskUsage
|
||||
} else {
|
||||
|
|
|
@ -5,17 +5,17 @@ import {
|
|||
MAP_KEYS_FROM_CONFIG,
|
||||
} from 'src/kapacitor/constants'
|
||||
|
||||
const getElementOptions = section => {
|
||||
const getElementOptions = (section) => {
|
||||
const elements = _.get(section, 'elements', [])
|
||||
|
||||
if (elements.length === 0) {
|
||||
return {}
|
||||
}
|
||||
|
||||
return _.map(elements, element => _.get(element, 'options', {}))
|
||||
return _.map(elements, (element) => _.get(element, 'options', {}))
|
||||
}
|
||||
|
||||
const parseHandlersFromConfig = config => {
|
||||
const parseHandlersFromConfig = (config) => {
|
||||
const {
|
||||
data: {sections},
|
||||
} = config
|
||||
|
@ -26,7 +26,7 @@ const parseHandlersFromConfig = config => {
|
|||
const options = getElementOptions(v)
|
||||
const type = _.get(MAP_KEYS_FROM_CONFIG, k, k)
|
||||
|
||||
_.forEach(options, option => {
|
||||
_.forEach(options, (option) => {
|
||||
acc.push({
|
||||
// fill type with handler names in rule
|
||||
type,
|
||||
|
@ -46,16 +46,16 @@ const parseHandlersFromConfig = config => {
|
|||
// filter out any handlers from config that are not allowed
|
||||
const allowedHandlers = _.filter(
|
||||
mappedHandlers,
|
||||
h => h.type in ALERTS_FROM_CONFIG
|
||||
(h) => h.type in ALERTS_FROM_CONFIG
|
||||
)
|
||||
|
||||
// filter out any fields of handlers that are not allowed
|
||||
const pickedHandlers = _.map(allowedHandlers, h => {
|
||||
const pickedHandlers = _.map(allowedHandlers, (h) => {
|
||||
return _.pick(h, ['type', 'enabled', ...ALERTS_FROM_CONFIG[h.type]])
|
||||
})
|
||||
|
||||
// map field names from config to field names in rule
|
||||
const fieldKeyMappedHandlers = _.map(pickedHandlers, h => {
|
||||
const fieldKeyMappedHandlers = _.map(pickedHandlers, (h) => {
|
||||
return _.mapKeys(h, (v, k) => {
|
||||
return _.get(MAP_FIELD_KEYS_FROM_CONFIG[h.type], k, k)
|
||||
})
|
||||
|
|
|
@ -12,10 +12,10 @@ export const parseHandlersFromRule = (rule, handlersFromConfig) => {
|
|||
_.forEach(handlersFromRule, (v, alertKind) => {
|
||||
const thisAlertFromConfig = _.find(
|
||||
handlersFromConfig,
|
||||
h => h.type === alertKind
|
||||
(h) => h.type === alertKind
|
||||
)
|
||||
|
||||
_.forEach(v, alertOptions => {
|
||||
_.forEach(v, (alertOptions) => {
|
||||
const count = _.get(handlersOfKind, alertKind, 0) + 1
|
||||
handlersOfKind[alertKind] = count
|
||||
|
||||
|
@ -42,7 +42,7 @@ export const parseHandlersFromRule = (rule, handlersFromConfig) => {
|
|||
return {handlersOnThisAlert, selectedHandler, handlersOfKind}
|
||||
}
|
||||
|
||||
export const parseAlertNodeList = rule => {
|
||||
export const parseAlertNodeList = (rule) => {
|
||||
const nodeList = _.transform(
|
||||
rule.alertNodes,
|
||||
(acc, v, k) => {
|
||||
|
@ -52,21 +52,21 @@ export const parseAlertNodeList = rule => {
|
|||
case AlertTypes.slack:
|
||||
alerts = _.uniqBy(
|
||||
v,
|
||||
alert => _.get(alert, 'workspace') || 'default'
|
||||
(alert) => _.get(alert, 'workspace') || 'default'
|
||||
)
|
||||
|
||||
acc.push(
|
||||
..._.map(alerts, alert => {
|
||||
..._.map(alerts, (alert) => {
|
||||
const nickname = _.get(alert, 'workspace') || 'default'
|
||||
return `${k} (${nickname})`
|
||||
})
|
||||
)
|
||||
break
|
||||
case AlertTypes.kafka:
|
||||
alerts = _.uniqBy(v, alert => _.get(alert, 'cluster'))
|
||||
alerts = _.uniqBy(v, (alert) => _.get(alert, 'cluster'))
|
||||
|
||||
acc.push(
|
||||
..._.map(alerts, alert => {
|
||||
..._.map(alerts, (alert) => {
|
||||
const nickname = _.get(alert, 'cluster')
|
||||
return `${k} (${nickname})`
|
||||
})
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const parseShowDatabases = response => {
|
||||
const parseShowDatabases = (response) => {
|
||||
const results = response.results[0]
|
||||
if (results.error) {
|
||||
return {errors: [results.error], databases: []}
|
||||
|
@ -9,7 +9,7 @@ const parseShowDatabases = response => {
|
|||
return {errors: [], databases: []}
|
||||
}
|
||||
|
||||
const databases = series.values.map(s => {
|
||||
const databases = series.values.map((s) => {
|
||||
return s[0]
|
||||
})
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ export default function parseShowFieldKeys(response) {
|
|||
const errors = []
|
||||
const fieldSets = {}
|
||||
|
||||
response.results.forEach(result => {
|
||||
response.results.forEach((result) => {
|
||||
if (result.error) {
|
||||
errors.push(result.error)
|
||||
return
|
||||
|
@ -14,7 +14,7 @@ export default function parseShowFieldKeys(response) {
|
|||
|
||||
const series = result.series[0]
|
||||
const fieldKeyIndex = series.columns.indexOf('fieldKey')
|
||||
const fields = series.values.map(value => {
|
||||
const fields = series.values.map((value) => {
|
||||
return value[fieldKeyIndex]
|
||||
})
|
||||
const measurement = series.name
|
||||
|
|
|
@ -21,7 +21,9 @@ export default function parseShowMeasurements(response) {
|
|||
|
||||
const series = result.series[0]
|
||||
const measurementNameIndex = series.columns.indexOf('name')
|
||||
const measurements = series.values.map(value => value[measurementNameIndex])
|
||||
const measurements = series.values.map(
|
||||
(value) => value[measurementNameIndex]
|
||||
)
|
||||
|
||||
measurementSets.push({
|
||||
index,
|
||||
|
|
|
@ -9,7 +9,7 @@ export default function parseshowQueries(response) {
|
|||
return {errors: [], queries: []}
|
||||
}
|
||||
|
||||
const queries = series.values.map(value => {
|
||||
const queries = series.values.map((value) => {
|
||||
return {
|
||||
id: value[series.columns.indexOf('qid')],
|
||||
database: value[series.columns.indexOf('database')],
|
||||
|
|
|
@ -16,7 +16,7 @@ export default function parseShowRetentionPolicies(result) {
|
|||
const replicationIndex = columns.indexOf('replicaN')
|
||||
const defaultIndex = columns.indexOf('default')
|
||||
|
||||
const retentionPolicies = series.values.map(arr => {
|
||||
const retentionPolicies = series.values.map((arr) => {
|
||||
return {
|
||||
name: arr[nameIndex],
|
||||
duration: arr[durationIndex],
|
||||
|
|
|
@ -2,7 +2,7 @@ import moment from 'moment'
|
|||
|
||||
export default function parseShowShards(results) {
|
||||
const shards = {}
|
||||
results.forEach(result => {
|
||||
results.forEach((result) => {
|
||||
if (!result.owners.length) {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ export default function parseShowTagKeys(response) {
|
|||
return {errors: [], tagKeys: []}
|
||||
}
|
||||
|
||||
const tagKeys = series.values.map(v => {
|
||||
const tagKeys = series.values.map((v) => {
|
||||
return v[0]
|
||||
})
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ export default function parseShowTagValues(response) {
|
|||
|
||||
const tags = {}
|
||||
;(result.series || []).forEach(({columns, values}) => {
|
||||
values.forEach(v => {
|
||||
values.forEach((v) => {
|
||||
const tagKey = v[columns.indexOf('key')]
|
||||
const tagValue = v[columns.indexOf('value')]
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
export default function walAndFilestoreBytes(response) {
|
||||
let totalDiskBytes = 0
|
||||
|
||||
response.results.forEach(result => {
|
||||
response.results.forEach((result) => {
|
||||
if (!result.series) {
|
||||
return
|
||||
}
|
||||
result.series.forEach(series => {
|
||||
result.series.forEach((series) => {
|
||||
if (!series.values) {
|
||||
return
|
||||
}
|
||||
series.values.forEach(value => {
|
||||
series.values.forEach((value) => {
|
||||
totalDiskBytes += (value && value[1]) || 0
|
||||
})
|
||||
})
|
||||
|
|
|
@ -4,7 +4,7 @@ import {fieldWalk} from 'src/shared/reducers/helpers/fields'
|
|||
import {PERMISSIONS} from 'shared/constants'
|
||||
|
||||
export function buildRoles(roles) {
|
||||
return roles.map(role => {
|
||||
return roles.map((role) => {
|
||||
return Object.assign({}, role, {
|
||||
permissions: buildPermissionsWithResources(role.permissions),
|
||||
users: role.users || [],
|
||||
|
@ -15,7 +15,7 @@ export function buildRoles(roles) {
|
|||
function buildPermissionsWithResources(rawPermissions) {
|
||||
const nextPermissions = {}
|
||||
_.each(rawPermissions, (permissions, resource) => {
|
||||
permissions.forEach(p => {
|
||||
permissions.forEach((p) => {
|
||||
if (nextPermissions[p]) {
|
||||
nextPermissions[p].push(resource)
|
||||
} else {
|
||||
|
@ -92,7 +92,7 @@ export function buildPermission(permissionName, resources) {
|
|||
}
|
||||
|
||||
export function buildClusterAccounts(users = [], roles = []) {
|
||||
return users.map(user => {
|
||||
return users.map((user) => {
|
||||
return Object.assign({}, user, {
|
||||
roles: getRolesForUser(roles, user),
|
||||
permissions: buildPermissionsWithResources(user.permissions),
|
||||
|
@ -101,7 +101,7 @@ export function buildClusterAccounts(users = [], roles = []) {
|
|||
}
|
||||
|
||||
function getRolesForUser(roles, user) {
|
||||
const userRoles = roles.filter(role => {
|
||||
const userRoles = roles.filter((role) => {
|
||||
if (!role.users) {
|
||||
return false
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ function getRolesForUser(roles, user) {
|
|||
return buildRoles(userRoles)
|
||||
}
|
||||
|
||||
export const buildDefaultYLabel = queryConfig => {
|
||||
export const buildDefaultYLabel = (queryConfig) => {
|
||||
const {measurement} = queryConfig
|
||||
const fields = _.get(queryConfig, ['fields', '0'], [])
|
||||
const isEmpty = !measurement && !fields.length
|
||||
|
@ -120,7 +120,7 @@ export const buildDefaultYLabel = queryConfig => {
|
|||
return ''
|
||||
}
|
||||
|
||||
const walkZerothArgs = f => {
|
||||
const walkZerothArgs = (f) => {
|
||||
if (f.type === 'field') {
|
||||
return f.value
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ export const shiftTimeRange = (timeRange, shift) => {
|
|||
}
|
||||
}
|
||||
|
||||
const getMomentUnit = unit => {
|
||||
const getMomentUnit = (unit) => {
|
||||
switch (unit) {
|
||||
case 'ms': {
|
||||
return 'milliseconds' // (1 thousandth of a second)
|
||||
|
|
|
@ -12,19 +12,20 @@ export const fieldWalk = (fields, fn, acc = []) =>
|
|||
|
||||
// ofType returns all top-level fields with type
|
||||
export const ofType = (fields, type) =>
|
||||
_.filter(fields, f => _.get(f, 'type') === type)
|
||||
_.filter(fields, (f) => _.get(f, 'type') === type)
|
||||
|
||||
// getFields returns all of the top-level fields of type field
|
||||
export const getFields = fields => ofType(fields, 'field')
|
||||
export const getFields = (fields) => ofType(fields, 'field')
|
||||
|
||||
// getFunctions returns all top-level functions in fields
|
||||
export const getFunctions = fields => ofType(fields, 'func')
|
||||
export const getFunctions = (fields) => ofType(fields, 'func')
|
||||
|
||||
// numFunctions searches queryConfig fields for functions and counts them
|
||||
export const numFunctions = fields => _.size(getFunctions(fields))
|
||||
export const numFunctions = (fields) => _.size(getFunctions(fields))
|
||||
|
||||
// functionNames returns the value of all top-level functions
|
||||
export const functionNames = fields => getFunctions(fields).map(f => f.value)
|
||||
export const functionNames = (fields) =>
|
||||
getFunctions(fields).map((f) => f.value)
|
||||
|
||||
/**
|
||||
* getAllFields and funcs with fieldName
|
||||
|
@ -32,20 +33,20 @@ export const functionNames = fields => getFunctions(fields).map(f => f.value)
|
|||
* @returns {Field[]}
|
||||
*/
|
||||
// returns a flattened list of all fieldNames in a queryConfig
|
||||
export const getFieldsDeep = fields =>
|
||||
export const getFieldsDeep = (fields) =>
|
||||
_.uniqBy(
|
||||
fieldWalk(fields, f => (_.get(f, 'type') === 'field' ? f : null)),
|
||||
fieldWalk(fields, (f) => (_.get(f, 'type') === 'field' ? f : null)),
|
||||
'value'
|
||||
)
|
||||
|
||||
export const fieldNamesDeep = fields =>
|
||||
getFieldsDeep(fields).map(f => _.get(f, 'value'))
|
||||
export const fieldNamesDeep = (fields) =>
|
||||
getFieldsDeep(fields).map((f) => _.get(f, 'value'))
|
||||
|
||||
// firstFieldName returns the value of the first of type field
|
||||
export const firstFieldName = fields => _.head(fieldNamesDeep(fields))
|
||||
export const firstFieldName = (fields) => _.head(fieldNamesDeep(fields))
|
||||
|
||||
export const hasField = (fieldName, fields) =>
|
||||
fieldNamesDeep(fields).some(f => f === fieldName)
|
||||
fieldNamesDeep(fields).some((f) => f === fieldName)
|
||||
|
||||
/**
|
||||
* getAllFields and funcs with fieldName
|
||||
|
@ -55,28 +56,28 @@ export const hasField = (fieldName, fields) =>
|
|||
*/
|
||||
// getAllFields and funcs with fieldName
|
||||
export const getFieldsWithName = (fieldName, fields) =>
|
||||
getFieldsDeep(fields).filter(f => f.value === fieldName)
|
||||
getFieldsDeep(fields).filter((f) => f.value === fieldName)
|
||||
|
||||
// everyOfType returns true if all top-level field types are type
|
||||
export const everyOfType = (fields, type) =>
|
||||
fields.every(f => _.get(f, 'type') === type)
|
||||
fields.every((f) => _.get(f, 'type') === type)
|
||||
|
||||
// everyTopField returns if all top-level field types are field
|
||||
export const everyTopField = fields => everyOfType(fields, 'field')
|
||||
export const everyTopField = (fields) => everyOfType(fields, 'field')
|
||||
|
||||
// everyTopFunction returns if all top-level field types are functions
|
||||
export const everyTopFunction = fields => everyOfType(fields, 'func')
|
||||
export const everyTopFunction = (fields) => everyOfType(fields, 'func')
|
||||
|
||||
export const getFuncsByFieldName = (fieldName, fields) =>
|
||||
getFunctions(fields).filter(f =>
|
||||
_.get(f, 'args', []).some(a => a.value === fieldName)
|
||||
getFunctions(fields).filter((f) =>
|
||||
_.get(f, 'args', []).some((a) => a.value === fieldName)
|
||||
)
|
||||
|
||||
// removeField will remove the field or function from the field list with the
|
||||
// given fieldName. Preconditions: only type field OR only type func
|
||||
export const removeField = (fieldName, fields) => {
|
||||
if (everyTopField(fields)) {
|
||||
return fields.filter(f => f.value !== fieldName)
|
||||
return fields.filter((f) => f.value !== fieldName)
|
||||
}
|
||||
|
||||
return fields.reduce((acc, f) => {
|
||||
|
|
|
@ -11,7 +11,7 @@ import {saveToLocalStorage} from '../localStorage'
|
|||
*/
|
||||
|
||||
export default function persistState() {
|
||||
return next => (reducer, initialState, enhancer) => {
|
||||
return (next) => (reducer, initialState, enhancer) => {
|
||||
const store = next(reducer, initialState, enhancer)
|
||||
const throttleMs = 1000
|
||||
|
||||
|
|
Loading…
Reference in New Issue