Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
update (id, payload) {
setTimeout(() => this.hide(id), 200);
const { value } = this.props;
if (!payload) {
delete value[id];
} else {
// use the `_id` property to set the payload,
// to account for someone changing the name of the file.
set(value, payload._id, payload);
// if the old name doesn't match the new name,
// delete the old name to avoid duplication.
if (id !== payload._id) delete value[id];
}
this.props.onChange(this.props.id, value);
}
}
set(state, ['list', 'meta'], assignDate(data.meta));
set(state, ['list', 'inflight'], false);
set(state, ['list', 'error'], false);
break;
case GRANULES_INFLIGHT:
set(state, ['list', 'inflight'], true);
break;
case GRANULES_ERROR:
set(state, ['list', 'inflight'], false);
set(state, ['list', 'error'], action.error);
break;
// basically a dummy query to get the meta object,
// which contains the number of granules updated in the last hour.
case RECENT_GRANULES:
set(state, ['recent', 'data'], data.meta);
set(state, ['recent', 'inflight'], false);
break;
case RECENT_GRANULES_INFLIGHT:
set(state, ['recent', 'inflight'], true);
break;
case RECENT_GRANULES_ERROR:
set(state, ['recent', 'inflight'], false);
set(state, ['recent', 'error'], action.error);
break;
case GRANULE_REPROCESS:
set(state, ['reprocessed', id, 'status'], 'success');
set(state, ['reprocessed', id, 'error'], null);
break;
case GRANULE_REPROCESS_INFLIGHT:
set(state, ['reprocessed', id, 'status'], 'inflight');
}
// determine what the message path is
// if the first character is not ', it's a variable or a template string
const firstChar = line[messageIndex + 14]
if (firstChar === "'") {
// found a parseable message, add some stats
jsMessageCounts[filePath] = (jsMessageCounts[filePath] || 0) + 1
// argument sent to this.messages is a static string, get the string
// and add an entry to the foundMessages object
const message = line.substring(
messageIndex + 15,
line.indexOf(firstChar, messageIndex + 16)
)
objectPath.set(foundMessages, `${curClass}.${message}`, true)
} else {
// argument sent to this.messages is a variable or string template
// TODO: analyze some kind of comment outlining message possibilities
addIssue(
'dynamicMessageWithoutPossibilitiesComment',
`unable to determine message object path from variable or template string in file '${filePath}' on line ${lineIdx}`
)
}
}
}
})
Reactium.Hook.register('zone-defaults', async context => {
op.set(context, 'controls', deps().plugableConfig);
op.set(context, 'components', Object.values(deps().plugins));
console.log('Initializing Content Zones');
});
__onStatus(params) {
const { uploads = {} } = this.state;
const { ID, progress, status, url } = params;
op.set(uploads, [ID, 'status'], status);
op.set(uploads, [ID, 'statusAt'], Date.now());
if (progress > 0) {
op.set(uploads, [ID, 'progress'], Number(progress));
}
if (op.has(params, 'url')) {
op.set(uploads, [ID, 'url'], params.url);
}
this.setState({ uploads });
}
__onStatus(params) {
const { uploads = {} } = this.state;
const { ID, progress, status, url } = params;
op.set(uploads, [ID, 'status'], status);
op.set(uploads, [ID, 'statusAt'], Date.now());
if (progress > 0) {
op.set(uploads, [ID, 'progress'], Number(progress));
}
if (op.has(params, 'url')) {
op.set(uploads, [ID, 'url'], params.url);
}
this.setState({ uploads });
}
const run = new VinylBufferStream((buf, done) => {
let content;
try {
content = frontMatter(String(buf), {filename: file.path});
objectPath.set(file, options.property, content.attributes);
} catch (err) {
err.message = err.stack.replace(/\n +at[\s\S]*/u, '');
const errorOption = {};
if (file.path !== undefined) {
errorOption.fileName = file.path;
}
done(new PluginError('gulp-front-matter', err, errorOption));
return;
}
if (options.remove !== false) {
done(null, Buffer.from(content.body));
return;
}
return new Promise(function (resolve, reject) {
if (!pathIsValid(path)) {
reject("The path is not valid");
} else {
var lastSchemaAndPaths = getLastSchemaAndPaths(model.schema, path);
if (!lastSchemaAndPaths.exists)
reject("The path does not point to an existing field (" + path + ")");
var fieldDefinition = {};
objectPath.set(fieldDefinition, lastSchemaAndPaths.path, newDefinition);
removeSchemaField(model, path)
.then(() => addSchemaField(model, path, newDefinition))
.then(() => updateDefaults(model, lastSchemaAndPaths.subPaths[0]))
.then(() => resolve("Field definition modified"))
.catch(error => reject(error));
}
});
}
set(path, value) {
return objectPath.set(this.data, path, value);
}
handleFormChange = ({ name, value }: FormInputEvent) => {
const partialState = {}
objPath.set(partialState, name, value)
if (name === 'loaders.react' && value) {
objPath.set(partialState, 'loaders.es6', value)
}
if (name === 'loaders.style' && !value) {
objPath.set(partialState, 'plugins.extract', false)
}
this.setState(partialState, () => {
this.props.onChange({ ...this.state })
})
}