handleClick() { let level = this.getPriorityLevel(); if (level++ >= this.props.maxLevel) { level = 0; } this.setState({optimisticData: {level}}); this.props.onChange(this.props.id, level); }
static get name() { // NOTE: deprecated in 4.1.0 but proxying since it's possible "core" is behind // and therefore still referencing `name`. Remove in 5.0.0 return this.id; }
getAlerts() { const alertIDs = Object.keys(this.alerts).sort(); return alertIDs.map(id => { const alert = this.alerts[id]; if (alert.accumulation) { alert.count = this.accumulation[alert.accumulation.id]; } return alert; }); }
/** * @api {post} /api/v1/session/api_key createApiKey * @apiName createApiKey * @apiGroup Session * */ async function createApiKey(req, res) { const scope = req.body.scope || ['dashboard:write', 'dashboard:read']; const session = await gladys.session.createApiKey(req.user.id, scope); res.status(201).json(session); }
const handleDiskUsageChange = diskUsageChange => { serverEvent.setID(diskUsageChange.id); serverEvent.setType(serverEventTypes.DISK_USAGE_CHANGE); serverEvent.addData(diskUsageChange.disks); serverEvent.emit(); }
this.setState(state => { return { changedClientSettings: this.mergeObjects(state.changedClientSettings, { [data.id]: {...data, overrideLocalSetting: true}, }), }; });
get options() { return { ...(this.defaultOptions || {}), ...((this.polly.config.persisterOptions || {})[this.constructor.id] || {}) }; }
const filterFunction = ( note ) => some( [ 'unread' === filterName && noteHasFilteredRead( state, note.id ), activeTab().filter( note ), ] )
/** * @api {get} /api/v1/service/telegram/link Get custom link * @apiName getCustomLink * @apiGroup RtspCamera */ async function getCustomLink(req, res) { const customLink = await messageHandler.getCustomLink(req.user.id); res.json({ link: customLink, }); }
/** * @api {get} /api/v1/message get * @apiName get * @apiGroup Message * */ async function get(req, res) { const messages = await gladys.message.get(req.user.id); res.json(messages); }
const getIsNoteLiked = ( notesState, note ) => { const noteLikes = notesState.noteLikes; if ( noteLikes.hasOwnProperty( note.id ) ) { return noteLikes[ note.id ]; } const actionMeta = getActions( note ); const likeProperty = note.meta.ids.comment ? 'like-comment' : 'like-post'; return actionMeta[ likeProperty ]; }
/** * @api {patch} /api/v1/me updateMySelf * @apiName updateMySelf * @apiGroup User * */ async function updateMySelf(req, res, next) { const newUser = await gladys.user.update(req.user.id, req.body); res.json(newUser); }