Prefix InfluxDB actions with 'INFLUXDB_'

pull/10616/head
Jared Scheib 2017-10-31 21:35:18 -07:00
parent bb56b0ef45
commit 5f457ca673
2 changed files with 55 additions and 55 deletions

View File

@ -25,54 +25,54 @@ import {REVERT_STATE_DELAY} from 'shared/constants'
import _ from 'lodash'
export const loadUsers = ({users}) => ({
type: 'LOAD_USERS',
type: 'INFLUXDB_LOAD_USERS',
payload: {
users,
},
})
export const loadRoles = ({roles}) => ({
type: 'LOAD_ROLES',
type: 'INFLUXDB_LOAD_ROLES',
payload: {
roles,
},
})
export const loadPermissions = ({permissions}) => ({
type: 'LOAD_PERMISSIONS',
type: 'INFLUXDB_LOAD_PERMISSIONS',
payload: {
permissions,
},
})
export const loadDatabases = databases => ({
type: 'LOAD_DATABASES',
type: 'INFLUXDB_LOAD_DATABASES',
payload: {
databases,
},
})
export const addUser = () => ({
type: 'ADD_USER',
type: 'INFLUXDB_ADD_USER',
})
export const addRole = () => ({
type: 'ADD_ROLE',
type: 'INFLUXDB_ADD_ROLE',
})
export const addDatabase = () => ({
type: 'ADD_DATABASE',
type: 'INFLUXDB_ADD_DATABASE',
})
export const addRetentionPolicy = database => ({
type: 'ADD_RETENTION_POLICY',
type: 'INFLUXDB_ADD_RETENTION_POLICY',
payload: {
database,
},
})
export const syncUser = (staleUser, syncedUser) => ({
type: 'SYNC_USER',
type: 'INFLUXDB_SYNC_USER',
payload: {
staleUser,
syncedUser,
@ -80,7 +80,7 @@ export const syncUser = (staleUser, syncedUser) => ({
})
export const syncRole = (staleRole, syncedRole) => ({
type: 'SYNC_ROLE',
type: 'INFLUXDB_SYNC_ROLE',
payload: {
staleRole,
syncedRole,
@ -88,7 +88,7 @@ export const syncRole = (staleRole, syncedRole) => ({
})
export const syncDatabase = (stale, synced) => ({
type: 'SYNC_DATABASE',
type: 'INFLUXDB_SYNC_DATABASE',
payload: {
stale,
synced,
@ -96,7 +96,7 @@ export const syncDatabase = (stale, synced) => ({
})
export const syncRetentionPolicy = (database, stale, synced) => ({
type: 'SYNC_RETENTION_POLICY',
type: 'INFLUXDB_SYNC_RETENTION_POLICY',
payload: {
database,
stale,
@ -105,7 +105,7 @@ export const syncRetentionPolicy = (database, stale, synced) => ({
})
export const editUser = (user, updates) => ({
type: 'EDIT_USER',
type: 'INFLUXDB_EDIT_USER',
payload: {
user,
updates,
@ -113,7 +113,7 @@ export const editUser = (user, updates) => ({
})
export const editRole = (role, updates) => ({
type: 'EDIT_ROLE',
type: 'INFLUXDB_EDIT_ROLE',
payload: {
role,
updates,
@ -121,7 +121,7 @@ export const editRole = (role, updates) => ({
})
export const editDatabase = (database, updates) => ({
type: 'EDIT_DATABASE',
type: 'INFLUXDB_EDIT_DATABASE',
payload: {
database,
updates,
@ -129,21 +129,21 @@ export const editDatabase = (database, updates) => ({
})
export const killQuery = queryID => ({
type: 'KILL_QUERY',
type: 'INFLUXDB_KILL_QUERY',
payload: {
queryID,
},
})
export const setQueryToKill = queryIDToKill => ({
type: 'SET_QUERY_TO_KILL',
type: 'INFLUXDB_SET_QUERY_TO_KILL',
payload: {
queryIDToKill,
},
})
export const loadQueries = queries => ({
type: 'LOAD_QUERIES',
type: 'INFLUXDB_LOAD_QUERIES',
payload: {
queries,
},
@ -151,7 +151,7 @@ export const loadQueries = queries => ({
// TODO: change to 'removeUser'
export const deleteUser = user => ({
type: 'DELETE_USER',
type: 'INFLUXDB_DELETE_USER',
payload: {
user,
},
@ -159,21 +159,21 @@ export const deleteUser = user => ({
// TODO: change to 'removeRole'
export const deleteRole = role => ({
type: 'DELETE_ROLE',
type: 'INFLUXDB_DELETE_ROLE',
payload: {
role,
},
})
export const removeDatabase = database => ({
type: 'REMOVE_DATABASE',
type: 'INFLUXDB_REMOVE_DATABASE',
payload: {
database,
},
})
export const removeRetentionPolicy = (database, retentionPolicy) => ({
type: 'REMOVE_RETENTION_POLICY',
type: 'INFLUXDB_REMOVE_RETENTION_POLICY',
payload: {
database,
retentionPolicy,
@ -181,35 +181,35 @@ export const removeRetentionPolicy = (database, retentionPolicy) => ({
})
export const filterUsers = text => ({
type: 'FILTER_USERS',
type: 'INFLUXDB_FILTER_USERS',
payload: {
text,
},
})
export const filterRoles = text => ({
type: 'FILTER_ROLES',
type: 'INFLUXDB_FILTER_ROLES',
payload: {
text,
},
})
export const addDatabaseDeleteCode = database => ({
type: 'ADD_DATABASE_DELETE_CODE',
type: 'INFLUXDB_ADD_DATABASE_DELETE_CODE',
payload: {
database,
},
})
export const removeDatabaseDeleteCode = database => ({
type: 'REMOVE_DATABASE_DELETE_CODE',
type: 'INFLUXDB_REMOVE_DATABASE_DELETE_CODE',
payload: {
database,
},
})
export const editRetentionPolicy = (database, retentionPolicy, updates) => ({
type: 'EDIT_RETENTION_POLICY',
type: 'INFLUXDB_EDIT_RETENTION_POLICY',
payload: {
database,
retentionPolicy,

View File

@ -16,25 +16,25 @@ const initialState = {
databases: [],
}
export default function admin(state = initialState, action) {
export default function adminInfluxDB(state = initialState, action) {
switch (action.type) {
case 'LOAD_USERS': {
case 'INFLUXDB_LOAD_USERS': {
return {...state, ...action.payload}
}
case 'LOAD_ROLES': {
case 'INFLUXDB_LOAD_ROLES': {
return {...state, ...action.payload}
}
case 'LOAD_PERMISSIONS': {
case 'INFLUXDB_LOAD_PERMISSIONS': {
return {...state, ...action.payload}
}
case 'LOAD_DATABASES': {
case 'INFLUXDB_LOAD_DATABASES': {
return {...state, ...action.payload}
}
case 'ADD_USER': {
case 'INFLUXDB_ADD_USER': {
const newUser = {...NEW_DEFAULT_USER, isEditing: true}
return {
...state,
@ -42,7 +42,7 @@ export default function admin(state = initialState, action) {
}
}
case 'ADD_ROLE': {
case 'INFLUXDB_ADD_ROLE': {
const newRole = {...NEW_DEFAULT_ROLE, isEditing: true}
return {
...state,
@ -50,7 +50,7 @@ export default function admin(state = initialState, action) {
}
}
case 'ADD_DATABASE': {
case 'INFLUXDB_ADD_DATABASE': {
const newDatabase = {
...NEW_DEFAULT_DATABASE,
links: {self: `temp-ID${uuid.v4()}`},
@ -63,7 +63,7 @@ export default function admin(state = initialState, action) {
}
}
case 'ADD_RETENTION_POLICY': {
case 'INFLUXDB_ADD_RETENTION_POLICY': {
const {database} = action.payload
const databases = state.databases.map(
db =>
@ -81,7 +81,7 @@ export default function admin(state = initialState, action) {
return {...state, databases}
}
case 'SYNC_USER': {
case 'INFLUXDB_SYNC_USER': {
const {staleUser, syncedUser} = action.payload
const newState = {
users: state.users.map(
@ -91,7 +91,7 @@ export default function admin(state = initialState, action) {
return {...state, ...newState}
}
case 'SYNC_ROLE': {
case 'INFLUXDB_SYNC_ROLE': {
const {staleRole, syncedRole} = action.payload
const newState = {
roles: state.roles.map(
@ -101,7 +101,7 @@ export default function admin(state = initialState, action) {
return {...state, ...newState}
}
case 'SYNC_DATABASE': {
case 'INFLUXDB_SYNC_DATABASE': {
const {stale, synced} = action.payload
const newState = {
databases: state.databases.map(
@ -112,7 +112,7 @@ export default function admin(state = initialState, action) {
return {...state, ...newState}
}
case 'SYNC_RETENTION_POLICY': {
case 'INFLUXDB_SYNC_RETENTION_POLICY': {
const {database, stale, synced} = action.payload
const newState = {
databases: state.databases.map(
@ -132,7 +132,7 @@ export default function admin(state = initialState, action) {
return {...state, ...newState}
}
case 'EDIT_USER': {
case 'INFLUXDB_EDIT_USER': {
const {user, updates} = action.payload
const newState = {
users: state.users.map(
@ -142,7 +142,7 @@ export default function admin(state = initialState, action) {
return {...state, ...newState}
}
case 'EDIT_ROLE': {
case 'INFLUXDB_EDIT_ROLE': {
const {role, updates} = action.payload
const newState = {
roles: state.roles.map(
@ -152,7 +152,7 @@ export default function admin(state = initialState, action) {
return {...state, ...newState}
}
case 'EDIT_DATABASE': {
case 'INFLUXDB_EDIT_DATABASE': {
const {database, updates} = action.payload
const newState = {
databases: state.databases.map(
@ -164,7 +164,7 @@ export default function admin(state = initialState, action) {
return {...state, ...newState}
}
case 'EDIT_RETENTION_POLICY': {
case 'INFLUXDB_EDIT_RETENTION_POLICY': {
const {database, retentionPolicy, updates} = action.payload
const newState = {
@ -187,7 +187,7 @@ export default function admin(state = initialState, action) {
return {...state, ...newState}
}
case 'DELETE_USER': {
case 'INFLUXDB_DELETE_USER': {
const {user} = action.payload
const newState = {
users: state.users.filter(u => u.links.self !== user.links.self),
@ -196,7 +196,7 @@ export default function admin(state = initialState, action) {
return {...state, ...newState}
}
case 'DELETE_ROLE': {
case 'INFLUXDB_DELETE_ROLE': {
const {role} = action.payload
const newState = {
roles: state.roles.filter(r => r.links.self !== role.links.self),
@ -205,7 +205,7 @@ export default function admin(state = initialState, action) {
return {...state, ...newState}
}
case 'REMOVE_DATABASE': {
case 'INFLUXDB_REMOVE_DATABASE': {
const {database} = action.payload
const newState = {
databases: state.databases.filter(
@ -216,7 +216,7 @@ export default function admin(state = initialState, action) {
return {...state, ...newState}
}
case 'REMOVE_RETENTION_POLICY': {
case 'INFLUXDB_REMOVE_RETENTION_POLICY': {
const {database, retentionPolicy} = action.payload
const newState = {
databases: state.databases.map(
@ -235,7 +235,7 @@ export default function admin(state = initialState, action) {
return {...state, ...newState}
}
case 'ADD_DATABASE_DELETE_CODE': {
case 'INFLUXDB_ADD_DATABASE_DELETE_CODE': {
const {database} = action.payload
const newState = {
databases: state.databases.map(
@ -247,7 +247,7 @@ export default function admin(state = initialState, action) {
return {...state, ...newState}
}
case 'REMOVE_DATABASE_DELETE_CODE': {
case 'INFLUXDB_REMOVE_DATABASE_DELETE_CODE': {
const {database} = action.payload
delete database.deleteCode
@ -260,11 +260,11 @@ export default function admin(state = initialState, action) {
return {...state, ...newState}
}
case 'LOAD_QUERIES': {
case 'INFLUXDB_LOAD_QUERIES': {
return {...state, ...action.payload}
}
case 'FILTER_USERS': {
case 'INFLUXDB_FILTER_USERS': {
const {text} = action.payload
const newState = {
users: state.users.map(u => {
@ -275,7 +275,7 @@ export default function admin(state = initialState, action) {
return {...state, ...newState}
}
case 'FILTER_ROLES': {
case 'INFLUXDB_FILTER_ROLES': {
const {text} = action.payload
const newState = {
roles: state.roles.map(r => {
@ -286,7 +286,7 @@ export default function admin(state = initialState, action) {
return {...state, ...newState}
}
case 'KILL_QUERY': {
case 'INFLUXDB_KILL_QUERY': {
const {queryID} = action.payload
const nextState = {
queries: reject(state.queries, q => +q.id === +queryID),
@ -295,7 +295,7 @@ export default function admin(state = initialState, action) {
return {...state, ...nextState}
}
case 'SET_QUERY_TO_KILL': {
case 'INFLUXDB_SET_QUERY_TO_KILL': {
return {...state, ...action.payload}
}
}