Remove storybook
parent
57a5a23908
commit
2e93c5d222
|
@ -19,7 +19,6 @@
|
|||
"test:lint": "yarn run lint; yarn run test",
|
||||
"test:dev": "concurrently \"yarn run lint --watch\" \"yarn run test --no-single-run --reporters=verbose\"",
|
||||
"clean": "rm -rf build/*",
|
||||
"storybook": "node ./storybook.js",
|
||||
"prettier": "prettier --single-quote --trailing-comma es5 --bracket-spacing false --semi false --write \"{src,spec}/**/*.js\"; eslint src --fix"
|
||||
},
|
||||
"author": "",
|
||||
|
@ -29,7 +28,6 @@
|
|||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@kadira/storybook": "^2.21.0",
|
||||
"autoprefixer": "^6.3.1",
|
||||
"babel-core": "^6.5.1",
|
||||
"babel-eslint": "6.1.2",
|
||||
|
|
|
@ -1,71 +0,0 @@
|
|||
import React from 'react'
|
||||
import {storiesOf, action, linkTo} from '@kadira/storybook'
|
||||
import Center from './components/Center'
|
||||
|
||||
import MultiSelectDropdown from 'shared/components/MultiSelectDropdown'
|
||||
import Tooltip from 'shared/components/Tooltip'
|
||||
|
||||
storiesOf('MultiSelectDropdown', module)
|
||||
.add('Select Roles w/label', () => (
|
||||
<Center>
|
||||
<MultiSelectDropdown
|
||||
items={[
|
||||
'Admin',
|
||||
'User',
|
||||
'Chrono Girafferoo',
|
||||
'Prophet',
|
||||
'Susford',
|
||||
]}
|
||||
selectedItems={[
|
||||
'User',
|
||||
'Chrono Girafferoo',
|
||||
]}
|
||||
label={'Select Roles'}
|
||||
onApply={action('onApply')}
|
||||
/>
|
||||
</Center>
|
||||
))
|
||||
.add('Selected Item list', () => (
|
||||
<Center>
|
||||
<MultiSelectDropdown
|
||||
items={[
|
||||
'Admin',
|
||||
'User',
|
||||
'Chrono Giraffe',
|
||||
'Prophet',
|
||||
'Susford',
|
||||
]}
|
||||
selectedItems={[
|
||||
'User',
|
||||
'Chrono Giraffe',
|
||||
]}
|
||||
onApply={action('onApply')}
|
||||
/>
|
||||
</Center>
|
||||
))
|
||||
.add('0 selected items', () => (
|
||||
<Center>
|
||||
<MultiSelectDropdown
|
||||
items={[
|
||||
'Admin',
|
||||
'User',
|
||||
'Chrono Giraffe',
|
||||
'Prophet',
|
||||
'Susford',
|
||||
]}
|
||||
selectedItems={[]}
|
||||
onApply={action('onApply')}
|
||||
/>
|
||||
</Center>
|
||||
))
|
||||
|
||||
storiesOf('Tooltip', module)
|
||||
.add('Delete', () => (
|
||||
<Center>
|
||||
<Tooltip tip={`Are you sure? TrashIcon`}>
|
||||
<div className="btn btn-info btn-sm">
|
||||
Delete
|
||||
</div>
|
||||
</Tooltip>
|
||||
</Center>
|
||||
))
|
|
@ -1,14 +0,0 @@
|
|||
import React from 'react'
|
||||
|
||||
const Center = ({children}) => (
|
||||
<div style={{
|
||||
position: 'absolute',
|
||||
top: '50%',
|
||||
left: '50%',
|
||||
transform: 'translate(-50%)',
|
||||
}}>
|
||||
{children}
|
||||
</div>
|
||||
)
|
||||
|
||||
export default Center
|
|
@ -1,6 +0,0 @@
|
|||
// CSS
|
||||
import 'src/style/chronograf.scss';
|
||||
|
||||
// Kapacitor Stories
|
||||
import './kapacitor'
|
||||
import './admin'
|
|
@ -1,93 +0,0 @@
|
|||
import React from 'react'
|
||||
import {storiesOf, action, linkTo} from '@kadira/storybook'
|
||||
|
||||
import {spyActions} from './shared'
|
||||
|
||||
// Stubs
|
||||
import kapacitor from './stubs/kapacitor'
|
||||
import source from './stubs/source'
|
||||
import rule from './stubs/rule'
|
||||
import query from './stubs/query'
|
||||
import queryConfigs from './stubs/queryConfigs'
|
||||
|
||||
// Actions for Spies
|
||||
import * as kapacitorActions from 'src/kapacitor/actions/view'
|
||||
import * as queryActions from 'src/data_explorer/actions/view'
|
||||
|
||||
// Components
|
||||
import KapacitorRule from 'src/kapacitor/components/KapacitorRule'
|
||||
import ValuesSection from 'src/kapacitor/components/ValuesSection'
|
||||
|
||||
const valuesSection = (trigger, values) =>
|
||||
<div className="rule-builder">
|
||||
<ValuesSection
|
||||
rule={rule({
|
||||
trigger,
|
||||
values,
|
||||
})}
|
||||
query={query()}
|
||||
onChooseTrigger={action('chooseTrigger')}
|
||||
onUpdateValues={action('updateRuleValues')}
|
||||
/>
|
||||
</div>
|
||||
|
||||
storiesOf('ValuesSection', module)
|
||||
.add('Threshold', () =>
|
||||
valuesSection('threshold', {
|
||||
operator: 'less than',
|
||||
rangeOperator: 'greater than',
|
||||
value: '10',
|
||||
rangeValue: '20',
|
||||
})
|
||||
)
|
||||
.add('Threshold inside Range', () =>
|
||||
valuesSection('threshold', {
|
||||
operator: 'inside range',
|
||||
rangeOperator: 'greater than',
|
||||
value: '10',
|
||||
rangeValue: '20',
|
||||
})
|
||||
)
|
||||
// .add('Threshold outside of Range', () => (
|
||||
// valuesSection('threshold', {
|
||||
// "operator": "otuside of range",
|
||||
// "rangeOperator": "less than",
|
||||
// "value": "10",
|
||||
// "rangeValue": "20",
|
||||
// })
|
||||
// ))
|
||||
.add('Relative', () =>
|
||||
valuesSection('relative', {
|
||||
change: 'change',
|
||||
operator: 'greater than',
|
||||
shift: '1m',
|
||||
value: '10',
|
||||
})
|
||||
)
|
||||
.add('Deadman', () =>
|
||||
valuesSection('deadman', {
|
||||
period: '10m',
|
||||
})
|
||||
)
|
||||
|
||||
storiesOf('KapacitorRule', module).add('Threshold', () =>
|
||||
<div className="chronograf-root">
|
||||
<KapacitorRule
|
||||
source={source()}
|
||||
rule={rule({
|
||||
trigger: 'threshold',
|
||||
})}
|
||||
query={query()}
|
||||
queryConfigs={queryConfigs()}
|
||||
kapacitor={kapacitor()}
|
||||
queryActions={spyActions(queryActions)}
|
||||
kapacitorActions={spyActions(kapacitorActions)}
|
||||
addFlashMessage={action('addFlashMessage')}
|
||||
enabledAlerts={['slack']}
|
||||
isEditing={true}
|
||||
router={{
|
||||
push: action('route'),
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)
|
|
@ -1,8 +0,0 @@
|
|||
export const spyActions = (actions) => Object.keys(actions)
|
||||
.reduce((acc, a) => {
|
||||
acc[a] = (...evt) => {
|
||||
action(a)(...evt);
|
||||
return actions[a](...evt);
|
||||
};
|
||||
return acc;
|
||||
}, {});
|
|
@ -1,16 +0,0 @@
|
|||
const kapacitor = () => {
|
||||
return ({
|
||||
"id": "1",
|
||||
"name": "kapa",
|
||||
"url": "http://chronograf.influxcloud.net:9092",
|
||||
"username": "testuser",
|
||||
"password": "hunter2",
|
||||
"links": {
|
||||
"proxy": "http://localhost:3888/chronograf/v1/sources/2/kapacitors/1/proxy",
|
||||
"self": "http://localhost:3888/chronograf/v1/sources/2/kapacitors/1",
|
||||
"rules": "http://localhost:3888/chronograf/v1/sources/2/kapacitors/1/rules"
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export default kapacitor;
|
|
@ -1,24 +0,0 @@
|
|||
const query = () => {
|
||||
return ({
|
||||
"id": "ad64c9e3-11d9-4e1a-bb6f-e80e09aec1cf",
|
||||
"database": "telegraf",
|
||||
"measurement": "cpu",
|
||||
"retentionPolicy": "autogen",
|
||||
"fields": [
|
||||
{
|
||||
"field": "usage_idle",
|
||||
"funcs": [
|
||||
"mean"
|
||||
]
|
||||
}
|
||||
],
|
||||
"tags": {},
|
||||
"groupBy": {
|
||||
"time": "10s",
|
||||
"tags": []
|
||||
},
|
||||
"areTagsAccepted": true
|
||||
});
|
||||
}
|
||||
|
||||
export default query;
|
|
@ -1,26 +0,0 @@
|
|||
const queryConfigs = () => {
|
||||
return ({
|
||||
"ad64c9e3-11d9-4e1a-bb6f-e80e09aec1cf": {
|
||||
"id": "ad64c9e3-11d9-4e1a-bb6f-e80e09aec1cf",
|
||||
"database": "telegraf",
|
||||
"measurement": "cpu",
|
||||
"retentionPolicy": "autogen",
|
||||
"fields": [
|
||||
{
|
||||
"field": "usage_idle",
|
||||
"funcs": [
|
||||
"mean"
|
||||
]
|
||||
}
|
||||
],
|
||||
"tags": {},
|
||||
"groupBy": {
|
||||
"time": "10s",
|
||||
"tags": []
|
||||
},
|
||||
"areTagsAccepted": true
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export default queryConfigs;
|
|
@ -1,54 +0,0 @@
|
|||
const rule = ({
|
||||
trigger,
|
||||
values,
|
||||
}) => {
|
||||
values = {
|
||||
"rangeOperator": "greater than",
|
||||
"change": "change",
|
||||
"operator": "greater than",
|
||||
"shift": "1m",
|
||||
"value": "10",
|
||||
"rangeValue": "20",
|
||||
"period": "10m",
|
||||
...values,
|
||||
};
|
||||
|
||||
return ({
|
||||
"id": "chronograf-v1-08cdb16b-7874-4c8f-858d-1c07043cb2f5",
|
||||
"query": {
|
||||
"id": "ad64c9e3-11d9-4e1a-bb6f-e80e09aec1cf",
|
||||
"database": "telegraf",
|
||||
"measurement": "cpu",
|
||||
"retentionPolicy": "autogen",
|
||||
"fields": [
|
||||
{
|
||||
"field": "usage_idle",
|
||||
"funcs": [
|
||||
"mean"
|
||||
]
|
||||
}
|
||||
],
|
||||
"tags": {},
|
||||
"groupBy": {
|
||||
"time": "10s",
|
||||
"tags": []
|
||||
},
|
||||
"areTagsAccepted": true
|
||||
},
|
||||
"every": "30s",
|
||||
"alerts": [],
|
||||
"message": "",
|
||||
trigger,
|
||||
values,
|
||||
"name": "Untitled Rule",
|
||||
"tickscript": "var db = 'telegraf'\n\nvar rp = 'autogen'\n\nvar measurement = 'cpu'\n\nvar groupBy = []\n\nvar whereFilter = lambda: TRUE\n\nvar period = 10s\n\nvar every = 30s\n\nvar name = 'Untitled Rule'\n\nvar idVar = name + ':{{.Group}}'\n\nvar message = ''\n\nvar idTag = 'alertID'\n\nvar levelTag = 'level'\n\nvar messageField = 'message'\n\nvar durationField = 'duration'\n\nvar outputDB = 'chronograf'\n\nvar outputRP = 'autogen'\n\nvar outputMeasurement = 'alerts'\n\nvar triggerType = 'threshold'\n\nvar lower = 10\n\nvar upper = 20\n\nvar data = stream\n |from()\n .database(db)\n .retentionPolicy(rp)\n .measurement(measurement)\n .groupBy(groupBy)\n .where(whereFilter)\n |window()\n .period(period)\n .every(every)\n .align()\n |mean('usage_idle')\n .as('value')\n\nvar trigger = data\n |alert()\n .crit(lambda: \"value\" < lower AND \"value\" > upper)\n .stateChangesOnly()\n .message(message)\n .id(idVar)\n .idTag(idTag)\n .levelTag(levelTag)\n .messageField(messageField)\n .durationField(durationField)\n\ntrigger\n |influxDBOut()\n .create()\n .database(outputDB)\n .retentionPolicy(outputRP)\n .measurement(outputMeasurement)\n .tag('alertName', name)\n .tag('triggerType', triggerType)\n\ntrigger\n |httpOut('output')\n",
|
||||
"links": {
|
||||
"self": "/chronograf/v1/sources/2/kapacitors/1/rules/chronograf-v1-08cdb16b-7874-4c8f-858d-1c07043cb2f5",
|
||||
"kapacitor": "/chronograf/v1/sources/2/kapacitors/1/proxy?path=%2Fkapacitor%2Fv1%2Ftasks%2Fchronograf-v1-08cdb16b-7874-4c8f-858d-1c07043cb2f5",
|
||||
"output": "/chronograf/v1/sources/2/kapacitors/1/proxy?path=%2Fkapacitor%2Fv1%2Ftasks%2Fchronograf-v1-08cdb16b-7874-4c8f-858d-1c07043cb2f5%2Foutput"
|
||||
},
|
||||
"queryID": "ad64c9e3-11d9-4e1a-bb6f-e80e09aec1cf"
|
||||
});
|
||||
}
|
||||
|
||||
export default rule;
|
|
@ -1,18 +0,0 @@
|
|||
const source = () => {
|
||||
return ({
|
||||
"id": "2",
|
||||
"name": "test-user",
|
||||
"username": "test-user",
|
||||
"password": "hunter2",
|
||||
"url": "http://chronograf.influxcloud.net:8086",
|
||||
"default": true,
|
||||
"telegraf": "telegraf",
|
||||
"links": {
|
||||
"self": "http://localhost:3888/chronograf/v1/sources/2",
|
||||
"kapacitors": "http://localhost:3888/chronograf/v1/sources/2/kapacitors",
|
||||
"proxy": "http://localhost:3888/chronograf/v1/sources/2/proxy"
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export default source;
|
758
ui/yarn.lock
758
ui/yarn.lock
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue