3 * Copyright 2016 RIFT.IO Inc
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 import React from 'react';
20 import {DropList, RadioButtonGroup, CardSection } from './loggingWidgets.jsx';
21 import { Grid } from './gridWidgets.jsx';
22 import LoggingStore from './loggingStore.js';
25 export default class CategorySeverityGrid extends React.Component {
27 generateRows(defaultSeverities, severityOptions) {
29 return defaultSeverities.map(function(catsev) {
30 let dropList = (<DropList options={severityOptions}
31 selectedOption={catsev.severity}
32 onChange={self.onChangeSeverity(catsev.category)} />);
33 return [catsev.category, dropList];
37 onChangeSeverity (category) {
39 LoggingStore.updateCategoryDefaultSeverity({
47 const {cellLabels, severityOptions, defaultSeverities, columnClasses,
48 ...props} = this.props;
50 if (defaultSeverities) {
51 rows = this.generateRows(defaultSeverities, severityOptions);
53 return (<Grid className="categorySeverityGrid"
54 cellLabels={cellLabels}
56 columnClasses={columnClasses}
61 CategorySeverityGrid.defaultProps = {
63 'Category', 'Severity'
66 'category', 'severity'