Constants
Shared constants for settings, permissions, and roles
The @mdk/foundation package provides domain-specific constants for mining applications.
Import
import {
// Header controls
HEADER_ITEMS,
DEFAULT_HEADER_PREFERENCES,
// Permissions
AUTH_PERMISSIONS,
AUTH_LEVELS,
USER_ROLE,
// Settings
USER_ROLES,
PERM_LEVEL_LABELS,
// Role styling
getRoleBadgeColors,
} from '@mdk/foundation'Header controls
HEADER_ITEMS
Array of header metric options for the HeaderControlsSettings component.
import { HEADER_ITEMS } from '@mdk/foundation'| Key | Label |
|---|---|
poolMiners | Pool Miners |
mosMiners | MOS Miners |
poolHashrate | Pool Hashrate |
mosHashrate | MOS Hashrate |
consumption | Consumption |
efficiency | Efficiency |
DEFAULT_HEADER_PREFERENCES
Default visibility state for all header items (all true).
import { DEFAULT_HEADER_PREFERENCES } from '@mdk/foundation'
// All items visible by default
DEFAULT_HEADER_PREFERENCES.poolMiners // true
DEFAULT_HEADER_PREFERENCES.consumption // trueHeaderPreferences type
import type { HeaderPreferences } from '@mdk/foundation'
type HeaderPreferences = {
poolMiners: boolean
mosMiners: boolean
poolHashrate: boolean
mosHashrate: boolean
consumption: boolean
efficiency: boolean
}Permissions
AUTH_PERMISSIONS
Permission resource identifiers.
import { AUTH_PERMISSIONS } from '@mdk/foundation'
AUTH_PERMISSIONS.USERS // 'users'
AUTH_PERMISSIONS.SETTINGS // 'settings'
AUTH_PERMISSIONS.MINER // 'miner'| Constant | Value | Description |
|---|---|---|
USERS | users | User management |
SETTINGS | settings | Application settings |
MINER | miner | Miner operations |
ALERTS | alerts | Alert management |
ACTIONS | actions | Action execution |
EXPLORER | explorer | Device explorer |
INVENTORY | inventory | Inventory management |
CONTAINER | container | Container management |
PRODUCTION | production | Production data |
REPORTING | reporting | Reports |
AUTH_LEVELS
Permission access levels.
import { AUTH_LEVELS } from '@mdk/foundation'
AUTH_LEVELS.READ // 'r'
AUTH_LEVELS.WRITE // 'w'USER_ROLE
User role identifiers.
import { USER_ROLE } from '@mdk/foundation'
USER_ROLE.ADMIN // 'admin'
USER_ROLE.SITE_MANAGER // 'site_manager'
USER_ROLE.READ_ONLY // 'read_only_user'| Constant | Value |
|---|---|
ADMIN | admin |
SITE_MANAGER | site_manager |
SITE_OPERATOR | site_operator |
FIELD_OPERATOR | field_operator |
REPAIR_TECHNICIAN | repair_technician |
REPORTING_TOOL_MANAGER | reporting_tool_manager |
READ_ONLY | read_only_user |
Settings
USER_ROLES
Array of role options for select dropdowns.
import { USER_ROLES } from '@mdk/foundation'
// [{ label: 'Admin', value: 'admin' }, ...]PERM_LEVEL_LABELS
Human-readable labels for permission levels.
import { PERM_LEVEL_LABELS } from '@mdk/foundation'
PERM_LEVEL_LABELS.rw // 'Read & Write'
PERM_LEVEL_LABELS.r // 'Read Only'
PERM_LEVEL_LABELS.none // 'No Access'SETTINGS_ERROR_CODES
Error code to message mapping.
import { SETTINGS_ERROR_CODES } from '@mdk/foundation'
SETTINGS_ERROR_CODES.ERR_USER_EXISTS // 'User already exists'
SETTINGS_ERROR_CODES.DEFAULT // 'An error occurred'Role styling
getRoleBadgeColors
Get badge colors for a role.
import { getRoleBadgeColors } from '@mdk/foundation'
const { color, bgColor } = getRoleBadgeColors('admin')
// { color: '#e8833a', bgColor: 'rgba(232, 131, 58, 0.1)' }| Role | Color | Background |
|---|---|---|
admin | #e8833a | Orange tint |
site_manager | #52c41a | Green tint |
site_operator | #faad14 | Yellow tint |
read_only_user | #8c8c8c | Gray tint |

