Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.socket.emit('settings', (e, data) => {
this.settings = {
widgetEventlistFollows: isNil(data.widgetEventlistFollows) ? true : data.widgetEventlistFollows,
widgetEventlistHosts: isNil(data.widgetEventlistHosts) ? true : data.widgetEventlistHosts,
widgetEventlistRaids: isNil(data.widgetEventlistRaids) ? true : data.widgetEventlistRaids,
widgetEventlistCheers: isNil(data.widgetEventlistCheers) ? true : data.widgetEventlistCheers,
widgetEventlistSubs: isNil(data.widgetEventlistSubs) ? true : data.widgetEventlistSubs,
widgetEventlistSubgifts: isNil(data.widgetEventlistSubgifts) ? true : data.widgetEventlistSubgifts,
widgetEventlistSubcommunitygifts: isNil(data.widgetEventlistSubcommunitygifts) ? true : data.widgetEventlistSubcommunitygifts,
widgetEventlistResubs: isNil(data.widgetEventlistResubs) ? true : data.widgetEventlistResubs,
widgetEventlistTips: isNil(data.widgetEventlistTips) ? true : data.widgetEventlistTips
}
this.eventlistShow = data.widgetEventlistShow
this.eventlistSize = data.widgetEventlistSize,
this.eventlistMessageSize = data.widgetEventlistMessageSize
console.group('Eventlist widgets settings')
console.debug(this.settings)
console.groupEnd()
})
this.socket.emit('get') // get initial widget state
updateGraph(data, error) {
deleteTraces(this.node, _.range(this.numTraces));
this.numTraces = 0;
this.data = _.get(data, '[0].data.result');
if (!_.isEmpty(this.data)) {
// Work out which labels have different values for different metrics
const allLabels = _.map(this.data, 'metric');
const allLabelKeys = _.uniq(_.flatMap(allLabels, _.keys));
const differingLabelKeys = _.filter(allLabelKeys, k => _.uniqBy(allLabels, k).length > 1);
_.each(this.data, ({metric, values}) => {
// If props.metric is specified, ignore all other metrics
const labels = _.omit(metric, '__name__');
if (this.props.metric && _.some(labels, (v, k) => _.get(this.props.metric, k) !== v)) {
return;
}
// The data may have missing values, so we fill those gaps with nulls so that the graph correctly shows the
// missing values as gaps in the line
const start = values[0][0];
const end = _.last(values)[0];
const step = this.state.span / this.props.numSamples / 1000;
_.range(start, end, step).map((t, i) => {
public publishQuestions() {
let selectedQuestions = _.filter(this.questionList, (question) => _.get(question, 'isSelected'));
this.publishInProgress = true;
this.publishButtonStatus.emit(this.publishInProgress);
let selectedQuestionsData = _.reduce(selectedQuestions, (final, question) => {
final.ids.push(_.get(question, 'identifier'));
final.author.push(_.get(question, 'author'));
final.category.push(_.get(question, 'category'));
final.attributions = _.union(final.attributions, _.get(question, 'organisation'));
return final;
}, { ids: [], author: [], category: [], attributions: [] });
if (selectedQuestionsData.ids.length > 0) {
const questions = [];
_.forEach(_.get(selectedQuestionsData, 'ids'), (value) => {
questions.push({ 'identifier': value });
});
this.cbseService.getECMLJSON(selectedQuestionsData.ids).subscribe((theme) => {
let creator = this.userService.userProfile.firstName;
if (!_.isEmpty(this.userService.userProfile.lastName)) {
creator = this.userService.userProfile.firstName + ' ' + this.userService.userProfile.lastName;
}
const option = {
url: `private/content/v3/create`,
data: {
'request': {
'content': {
// tslint:disable-next-line:max-line-length
'name': this.resourceName || `${this.questionTypeName[this.selectedAttributes.questionType]} - ${this.selectedAttributes.topic}`,
'contentType': this.selectedAttributes.questionType === 'curiosity' ? 'CuriosityQuestionSet' : 'PracticeQuestionSet',
constructor(private readonly urlManager: UrlManagerService,
private readonly location: Location,
private readonly context: ContextService,
private readonly mask: MaskService,
private readonly error: ErrorService,
private readonly configService: ConfigService,
private readonly ciceroContext: CiceroContextService,
private readonly ciceroRenderer: CiceroRendererService) { }
private commandsInitialised = false;
private commandTypes = [Action, Back, Cancel, Clipboard, Edit, Enter, Forward, Gemini, Goto, Help, Menu, OK, Page, Reload, Root, Save, Selection, Show, Where];
private allCommands: Command[] = map(this.commandTypes, T => new T(this.urlManager, this.location, this, this.context, this.mask, this.error, this.configService, this.ciceroContext, this.ciceroRenderer));
private commands: Dictionary = fromPairs(map(this.allCommands, c => [c.shortCommand, c]));
private mapInputToCommands(input: string) {
if (!input) {
// Special case for hitting Enter with no input
return [this.getCommand('wh')];
}
const commands = input.split(';');
return map(commands, c => this.getSingleCommand(c, commands.length > 1));
}
getCommands(input: string): ParseResult {
try {
return ParseResult.create(this.mapInputToCommands(input));
} catch (e) {
return ParseResult.createError(e.message);
}
componentDidUpdate(prevProps) {
const props = this.props;
// Prevent infinite loop in case React Router decides to destroy & recreate the component (changing key)
const oldLocation = _.omit(prevProps.location, ['key']);
const newLocation = _.omit(props.location, ['key']);
if (_.isEqual(newLocation, oldLocation) && _.isEqual(props.match, prevProps.match)) {
return;
}
// two way data binding :-/
const { pathname } = props.location;
store.dispatch(UIActions.setCurrentLocation(pathname));
}
render() {
// $FlowFixMe
const { Component } = this
return
}
if (!accessResponse) {
return ;
}
// break into users, groups, and service accounts
const users = [];
const serviceAccounts = [];
_.each(accessResponse.users, (name: string) => {
if (name.startsWith('system:serviceaccount:')) {
serviceAccounts.push({ name, type: 'ServiceAccount' });
} else {
users.push({ name, type: 'User' });
}
});
const groups = _.map(accessResponse.groups, (name: string) => ({ name, type: 'Group' }));
// filter and sort
const verbOptions = _.zipObject(verbs, verbs);
const data = [
...(showUsers ? users : []),
...(showGroups ? groups : []),
...(showServiceAccounts ? serviceAccounts : []),
];
const allSelected = showUsers && showGroups && showServiceAccounts;
const itemCount = accessResponse.users.length + accessResponse.groups.length;
const selectedCount = data.length;
const filteredData = data.filter(({ name }: { name: string }) => fuzzy(filter, name));
const sortedData = _.orderBy(filteredData, ['type', 'name'], ['asc', 'asc']);
// event handlers
const onFilterChange: React.ReactEventHandler = (e) =>
private createKernel(video: HTMLVideoElement, config: {
box: string;
isLive: boolean;
kernels: UserKernelsConfig;
preset: {
flv?: IVideoKernelConstructor;
hls?: IVideoKernelConstructor;
mp4?: IVideoKernelConstructor;
};
src: string;
}) {
const { kernels, preset } = config;
/* istanbul ignore else */
if (process.env.NODE_ENV !== 'production' && isEmpty(kernels) && !isEmpty(preset)) { chimeeLog.warn('preset will be deprecated in next major version, please use kernels instead.'); }
const presetConfig: { [key: string]: SingleKernelConfig } = {};
let newPreset: UserKernelsConstructorMap = {};
if (isArray(kernels)) {
// SKC means SingleKernelConfig
newPreset = (kernels as (Array< SupportedKernelType | SingleKernelConfig >)).reduce((kernels: UserKernelsConstructorMap, keyOrSKC: SupportedKernelType | SingleKernelConfig) => {
// if it is a string key, it means the kernel has been pre installed.
if (isString(keyOrSKC)) {
if (!isSupportedKernelType(keyOrSKC)) {
throw new Error(`We have not support ${keyOrSKC} kernel type`);
}
const kernelFn = kernelsSet[keyOrSKC];
if (!isFunction(kernelFn)) {
chimeeLog.warn(`You have not installed kernel for ${keyOrSKC}.`);
return kernels;
}
kernels[keyOrSKC] = kernelFn;
setQueryParameters(selected) {
// Ensure something is always active
if (!_.isEmpty(selected)) {
try {
const recognized = _.filter(selected, (id) => _.find(this.props.items, { id }));
setQueryArgument(this.storageKey, recognized.join(','));
} catch (ignored) {
// ignore
}
const allSelected = _.isEmpty(_.xor(selected, _.map(this.props.items, 'id')));
this.setState({ allSelected, selected }, () => this.applyFilter());
}
}
render() {
const {
metadata: { namespace },
spec: { selector },
} = this.props.obj;
if (_.isEmpty(selector)) {
return ;
}
// Hide the create button to avoid confusion when showing pods for an object.
// Otherwise it might seem like you click "Create Pod" to add replicas instead
// of scaling the owner.
return (
);
}
}