Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
0a094c12
Commit
0a094c12
authored
Mar 10, 2019
by
ryan
Browse files
Options
Browse Files
Download
Plain Diff
merge master
parents
494acddb
fc41d10b
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
67 additions
and
41 deletions
+67
-41
docs/sources/alerting/notifications.md
+5
-1
packages/grafana-ui/src/components/ColorPicker/NamedColorsPalette.story.tsx
+2
-2
packages/grafana-ui/src/components/ColorPicker/warnAboutColorPickerPropsDeprecation.ts
+2
-2
packages/grafana-ui/src/components/DeleteButton/DeleteButton.story.tsx
+11
-18
packages/grafana-ui/src/utils/deprecationWarning.ts
+6
-0
packages/grafana-ui/src/utils/index.ts
+2
-1
packages/grafana-ui/src/utils/propDeprecationWarning.ts
+0
-6
packages/grafana-ui/src/utils/string.test.ts
+15
-0
packages/grafana-ui/src/utils/string.ts
+13
-0
public/app/core/time_series2.ts
+2
-3
public/app/core/utils/kbn.ts
+3
-1
public/app/features/templating/datasource_variable.ts
+2
-2
public/app/features/templating/query_variable.ts
+2
-2
public/app/plugins/panel/table/renderer.ts
+2
-3
No files found.
docs/sources/alerting/notifications.md
View file @
0a094c12
...
...
@@ -83,7 +83,11 @@ or a bot integration via Slack Apps. Follow Slack's guide to set up a bot integr
Setting | Description
---------- | -----------
Recipient | allows you to override the Slack recipient.
Url | Slack incoming webhook url.
Username | Set the username for the bot's message.
Recipient | Allows you to override the Slack recipient.
Icon emoji | Provide an emoji to use as the icon for the bot's message. Ex :smile:
Icon URL | Provide a url to an image to use as the icon for the bot's message.
Mention | make it possible to include a mention in the Slack notification sent by Grafana. Ex @here or @channel
Token | If provided, Grafana will upload the generated image via Slack's file.upload API method, not the external image destination.
...
...
packages/grafana-ui/src/components/ColorPicker/NamedColorsPalette.story.tsx
View file @
0a094c12
...
...
@@ -8,7 +8,7 @@ import { renderComponentWithTheme } from '../../utils/storybook/withTheme';
import
{
UseState
}
from
'../../utils/storybook/UseState'
;
const
BasicGreen
=
getColorDefinitionByName
(
'green'
);
const
Basic
Blue
=
getColorDefinitionByName
(
'blue
'
);
const
Basic
Red
=
getColorDefinitionByName
(
'red
'
);
const
LightBlue
=
getColorDefinitionByName
(
'light-blue'
);
const
NamedColorsPaletteStories
=
storiesOf
(
'UI/ColorPicker/Palettes/NamedColorsPalette'
,
module
);
...
...
@@ -41,7 +41,7 @@ NamedColorsPaletteStories.add('Named colors swatch - support for named colors',
'Selected color'
,
{
Green
:
BasicGreen
.
variants
.
dark
,
Red
:
Basic
Blue
.
variants
.
dark
,
Red
:
Basic
Red
.
variants
.
dark
,
'Light blue'
:
LightBlue
.
variants
.
dark
,
},
'red'
...
...
packages/grafana-ui/src/components/ColorPicker/warnAboutColorPickerPropsDeprecation.ts
View file @
0a094c12
import
propDeprecationWarning
from
'../../utils/propD
eprecationWarning'
;
import
deprecationWarning
from
'../../utils/d
eprecationWarning'
;
import
{
ColorPickerProps
}
from
'./ColorPickerPopover'
;
export
const
warnAboutColorPickerPropsDeprecation
=
(
componentName
:
string
,
props
:
ColorPickerProps
)
=>
{
const
{
onColorChange
}
=
props
;
if
(
onColorChange
)
{
propD
eprecationWarning
(
componentName
,
'onColorChange'
,
'onChange'
);
d
eprecationWarning
(
componentName
,
'onColorChange'
,
'onChange'
);
}
};
packages/grafana-ui/src/components/DeleteButton/DeleteButton.story.tsx
View file @
0a094c12
import
React
,
{
FunctionComponent
}
from
'react'
;
import
React
from
'react'
;
import
{
storiesOf
}
from
'@storybook/react'
;
import
{
DeleteButton
}
from
'./DeleteButton'
;
const
CenteredStory
:
FunctionComponent
<
{}
>
=
({
children
})
=>
{
return
(
<
div
style=
{
{
height
:
'100vh '
,
display
:
'flex'
,
alignItems
:
'center'
,
justifyContent
:
'center'
,
}
}
>
{
children
}
</
div
>
);
};
import
{
withCenteredStory
}
from
'../../utils/storybook/withCenteredStory'
;
import
{
action
}
from
'@storybook/addon-actions'
;
storiesOf
(
'UI/DeleteButton'
,
module
)
.
addDecorator
(
story
=>
<
CenteredStory
>
{
story
()
}
</
CenteredStory
>
)
.
addDecorator
(
withCenteredStory
)
.
add
(
'default'
,
()
=>
{
return
<
DeleteButton
onConfirm=
{
()
=>
{}
}
/>;
return
(
<
DeleteButton
onConfirm=
{
()
=>
{
action
(
'Delete Confirmed'
)(
'delete!'
);
}
}
/>
);
});
packages/grafana-ui/src/utils/deprecationWarning.ts
0 → 100644
View file @
0a094c12
const
deprecationWarning
=
(
file
:
string
,
oldName
:
string
,
newName
:
string
)
=>
{
const
message
=
`[Deprecation warning]
${
file
}
:
${
oldName
}
is deprecated. Use
${
newName
}
instead`
;
console
.
warn
(
message
);
};
export
default
deprecationWarning
;
packages/grafana-ui/src/utils/index.ts
View file @
0a094c12
...
...
@@ -2,5 +2,6 @@ export * from './processTimeSeries';
export
*
from
'./valueFormats/valueFormats'
;
export
*
from
'./colors'
;
export
*
from
'./namedColorsPalette'
;
export
*
from
'./stringUtils'
;
export
*
from
'./string'
;
export
*
from
'./deprecationWarning'
;
export
{
getMappedValue
}
from
'./valueMappings'
;
packages/grafana-ui/src/utils/propDeprecationWarning.ts
deleted
100644 → 0
View file @
494acddb
const
propDeprecationWarning
=
(
componentName
:
string
,
propName
:
string
,
newPropName
:
string
)
=>
{
const
message
=
`[Deprecation warning]
${
componentName
}
:
${
propName
}
is deprecated. Use
${
newPropName
}
instead`
;
console
.
warn
(
message
);
};
export
default
propDeprecationWarning
;
packages/grafana-ui/src/utils/string.test.ts
0 → 100644
View file @
0a094c12
import
{
stringToJsRegex
}
from
'@grafana/ui'
;
describe
(
'stringToJsRegex'
,
()
=>
{
it
(
'should parse the valid regex value'
,
()
=>
{
const
output
=
stringToJsRegex
(
'/validRegexp/'
);
expect
(
output
).
toBeInstanceOf
(
RegExp
);
});
it
(
'should throw error on invalid regex value'
,
()
=>
{
const
input
=
'/etc/hostname'
;
expect
(()
=>
{
stringToJsRegex
(
input
);
}).
toThrow
();
});
});
packages/grafana-ui/src/utils/string.ts
0 → 100644
View file @
0a094c12
export
function
stringToJsRegex
(
str
:
string
):
RegExp
{
if
(
str
[
0
]
!==
'/'
)
{
return
new
RegExp
(
'^'
+
str
+
'$'
);
}
const
match
=
str
.
match
(
new
RegExp
(
'^/(.*?)/(g?i?m?y?)$'
));
if
(
!
match
)
{
throw
new
Error
(
`'
${
str
}
' is not a valid regular expression.`
);
}
return
new
RegExp
(
match
[
1
],
match
[
2
]);
}
public/app/core/time_series2.ts
View file @
0a094c12
import
kbn
from
'app/core/utils/kbn'
;
import
{
getFlotTickDecimals
}
from
'app/core/utils/ticks'
;
import
_
from
'lodash'
;
import
{
getValueFormat
}
from
'@grafana/ui'
;
import
{
getValueFormat
,
stringToJsRegex
}
from
'@grafana/ui'
;
function
matchSeriesOverride
(
aliasOrRegex
,
seriesAlias
)
{
if
(
!
aliasOrRegex
)
{
...
...
@@ -9,7 +8,7 @@ function matchSeriesOverride(aliasOrRegex, seriesAlias) {
}
if
(
aliasOrRegex
[
0
]
===
'/'
)
{
const
regex
=
kbn
.
stringToJsRegex
(
aliasOrRegex
);
const
regex
=
stringToJsRegex
(
aliasOrRegex
);
return
seriesAlias
.
match
(
regex
)
!=
null
;
}
...
...
public/app/core/utils/kbn.ts
View file @
0a094c12
import
_
from
'lodash'
;
import
{
getValueFormat
,
getValueFormatterIndex
,
getValueFormats
,
stringToJsRegex
}
from
'@grafana/ui'
;
import
deprecationWarning
from
'@grafana/ui/src/utils/deprecationWarning'
;
const
kbn
:
any
=
{};
...
...
@@ -228,8 +229,9 @@ kbn.slugifyForUrl = str => {
.replace(/ +/g, '-');
};
/** deprecated since 6.1, use grafana/ui */
kbn.stringToJsRegex = str => {
console.warn('Use grafana/ui stringToJsRegex
');
deprecationWarning('kbn.ts', 'kbn.stringToJsRegex()', '@grafana/ui
');
return stringToJsRegex(str);
};
...
...
public/app/features/templating/datasource_variable.ts
View file @
0a094c12
import
kbn
from
'app/core/utils/kbn'
;
import
{
Variable
,
containsVariable
,
assignModelProperties
,
variableTypes
}
from
'./variable'
;
import
{
stringToJsRegex
}
from
'@grafana/ui'
;
export
class
DatasourceVariable
implements
Variable
{
regex
:
any
;
...
...
@@ -47,7 +47,7 @@ export class DatasourceVariable implements Variable {
if
(
this
.
regex
)
{
regex
=
this
.
templateSrv
.
replace
(
this
.
regex
,
null
,
'regex'
);
regex
=
kbn
.
stringToJsRegex
(
regex
);
regex
=
stringToJsRegex
(
regex
);
}
for
(
let
i
=
0
;
i
<
sources
.
length
;
i
++
)
{
...
...
public/app/features/templating/query_variable.ts
View file @
0a094c12
import
_
from
'lodash'
;
import
kbn
from
'app/core/utils/kbn'
;
import
{
Variable
,
containsVariable
,
assignModelProperties
,
variableTypes
}
from
'./variable'
;
import
{
stringToJsRegex
}
from
'@grafana/ui'
;
function
getNoneOption
()
{
return
{
text
:
'None'
,
value
:
''
,
isNone
:
true
};
...
...
@@ -148,7 +148,7 @@ export class QueryVariable implements Variable {
options
=
[];
if
(
this
.
regex
)
{
regex
=
kbn
.
stringToJsRegex
(
this
.
templateSrv
.
replace
(
this
.
regex
,
{},
'regex'
));
regex
=
stringToJsRegex
(
this
.
templateSrv
.
replace
(
this
.
regex
,
{},
'regex'
));
}
for
(
i
=
0
;
i
<
metricNames
.
length
;
i
++
)
{
const
item
=
metricNames
[
i
];
...
...
public/app/plugins/panel/table/renderer.ts
View file @
0a094c12
import
_
from
'lodash'
;
import
moment
from
'moment'
;
import
kbn
from
'app/core/utils/kbn'
;
import
{
getValueFormat
,
getColorFromHexRgbOrName
,
GrafanaThemeType
}
from
'@grafana/ui'
;
import
{
getValueFormat
,
getColorFromHexRgbOrName
,
GrafanaThemeType
,
stringToJsRegex
}
from
'@grafana/ui'
;
import
{
ColumnStyle
}
from
'@grafana/ui/src/components/Table/TableCellBuilder'
;
export
class
TableRenderer
{
...
...
@@ -36,7 +35,7 @@ export class TableRenderer {
for
(
let
i
=
0
;
i
<
this
.
panel
.
styles
.
length
;
i
++
)
{
const
style
=
this
.
panel
.
styles
[
i
];
const
regex
=
kbn
.
stringToJsRegex
(
style
.
pattern
);
const
regex
=
stringToJsRegex
(
style
.
pattern
);
if
(
column
.
text
.
match
(
regex
))
{
column
.
style
=
style
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment