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
adbe8142
Commit
adbe8142
authored
Aug 22, 2014
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dashboard_tag_colors'
parents
3579a18d
36882ea2
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
16 deletions
+57
-16
src/app/controllers/search.js
+28
-0
src/app/partials/search.html
+4
-4
src/css/less/grafana.less
+12
-8
src/css/less/overrides.less
+10
-1
src/css/less/variables.light.less
+3
-3
No files found.
src/app/controllers/search.js
View file @
adbe8142
...
@@ -151,4 +151,32 @@ function (angular, _, config, $) {
...
@@ -151,4 +151,32 @@ function (angular, _, config, $) {
};
};
});
});
module
.
directive
(
'tagColorFromName'
,
function
()
{
function
djb2
(
str
)
{
var
hash
=
5381
;
for
(
var
i
=
0
;
i
<
str
.
length
;
i
++
)
{
hash
=
((
hash
<<
5
)
+
hash
)
+
str
.
charCodeAt
(
i
);
/* hash * 33 + c */
}
return
hash
;
}
return
function
(
scope
,
element
)
{
var
name
=
_
.
isString
(
scope
.
tag
)
?
scope
.
tag
:
scope
.
tag
.
term
;
var
hash
=
djb2
(
name
.
toLowerCase
());
var
colors
=
[
"#E24D42"
,
"#1F78C1"
,
"#BA43A9"
,
"#705DA0"
,
"#466803"
,
"#508642"
,
"#447EBC"
,
"#C15C17"
,
"#890F02"
,
"#757575"
,
"#0A437C"
,
"#6D1F62"
,
"#584477"
,
"#629E51"
,
"#2F4F4F"
,
"#BF1B00"
,
"#806EB7"
,
"#8a2eb8"
,
"#699e00"
,
"#000000"
,
"#3F6833"
,
"#2F575E"
,
"#99440A"
,
"#E0752D"
,
"#0E4AB4"
,
"#58140C"
,
"#052B51"
,
"#511749"
,
"#3F2B5B"
,
];
var
color
=
colors
[
Math
.
abs
(
hash
%
colors
.
length
)];
console
.
log
(
"namei "
+
name
+
" color: "
+
color
,
hash
%
4
);
element
.
css
(
"background-color"
,
color
);
};
});
});
});
src/app/partials/search.html
View file @
adbe8142
...
@@ -52,9 +52,9 @@
...
@@ -52,9 +52,9 @@
class=
"search-result-item pointer"
class=
"search-result-item pointer"
ng-class=
"{'selected': $index === selectedIndex }"
ng-class=
"{'selected': $index === selectedIndex }"
ng-click=
"filterByTag(tag.term, $event)"
>
ng-click=
"filterByTag(tag.term, $event)"
>
<a
class=
"search-result-
link"
>
<a
class=
"search-result-
tag label label-tag"
tag-color-from-name
>
<i
class=
"icon icon-tag"
></i>
<i
class=
"icon icon-tag"
></i>
<span
class=
"label label-tag"
>
{{tag.term}}
({{tag.count}})
</span>
<span>
{{tag.term}}
({{tag.count}})
</span>
</a>
</a>
</div>
</div>
</div>
</div>
...
@@ -64,7 +64,7 @@
...
@@ -64,7 +64,7 @@
bindonce
ng-repeat=
"row in results.dashboards"
bindonce
ng-repeat=
"row in results.dashboards"
ng-class=
"{'selected': $index === selectedIndex }"
ng-click=
"goToDashboard(row.id)"
>
ng-class=
"{'selected': $index === selectedIndex }"
ng-click=
"goToDashboard(row.id)"
>
<div
class=
"search-result-actions"
>
<div
class=
"search-result-actions
small
"
>
<a
ng-click=
"shareDashboard(row.id, row.id, $event)"
config-modal=
"app/partials/dashLoaderShare.html"
>
<a
ng-click=
"shareDashboard(row.id, row.id, $event)"
config-modal=
"app/partials/dashLoaderShare.html"
>
<i
class=
"icon-share"
></i>
share
<i
class=
"icon-share"
></i>
share
</a>
</a>
...
@@ -74,7 +74,7 @@
...
@@ -74,7 +74,7 @@
</div>
</div>
<div
class=
"search-result-tags"
>
<div
class=
"search-result-tags"
>
<a
ng-click=
"filterByTag(tag, $event)"
ng-repeat=
"tag in row.tags"
style=
"margin-right: 5px;"
class=
"label label-tag"
>
<a
ng-click=
"filterByTag(tag, $event)"
ng-repeat=
"tag in row.tags"
tag-color-from-name
class=
"label label-tag"
>
{{tag}}
{{tag}}
</a>
</a>
</div>
</div>
...
...
src/css/less/grafana.less
View file @
adbe8142
...
@@ -55,19 +55,18 @@
...
@@ -55,19 +55,18 @@
max-height: 600px;
max-height: 600px;
overflow: auto;
overflow: auto;
display: block;
display: block;
.search-result-item a {
line-height: 28px;
}
.search-result-item:hover, .search-result-item.selected {
.search-result-item:hover, .search-result-item.selected {
.search-result-link, .icon {
.search-result-link, .
search-result-link > .
icon {
color: @grafanaListHighlight;
color: @grafanaListHighlight;
}
}
.search-result-link .label {
.search-result-tag {
background-color: @blue;
opacity: 0.70;
color: white;
}
}
}
}
.search-result-link {
.search-result-link {
color: @grafanaListMainLinkColor;
color: @grafanaListMainLinkColor;
.icon {
.icon {
...
@@ -81,7 +80,7 @@
...
@@ -81,7 +80,7 @@
}
}
.search-result-item {
.search-result-item {
padding:
6
px 10px;
padding:
0
px 10px;
white-space: nowrap;
white-space: nowrap;
border-top: 1px solid @grafanaListBorderTop;
border-top: 1px solid @grafanaListBorderTop;
border-bottom: 1px solid @grafanaListBorderBottom;
border-bottom: 1px solid @grafanaListBorderBottom;
...
@@ -89,11 +88,16 @@
...
@@ -89,11 +88,16 @@
.search-result-tags {
.search-result-tags {
float: right;
float: right;
.label-tag {
margin-left: 6px;
font-size: 11px;
padding: 2px 6px;
}
}
}
.search-result-actions {
.search-result-actions {
float: right;
float: right;
padding-left:
1
0px;
padding-left:
2
0px;
}
}
}
}
...
...
src/css/less/overrides.less
View file @
adbe8142
...
@@ -588,11 +588,20 @@ div.flot-text {
...
@@ -588,11 +588,20 @@ div.flot-text {
.label-tag {
.label-tag {
background-color: @purple;
background-color: @purple;
color: darken(@white, 5%);
color: darken(@white, 5%);
border-radius: 2px;
text-shadow: none;
font-size: 13px;
padding: 4px 6px;
.icon-tag {
position: relative;
top: 1px;
padding-right: 4px;
}
}
}
.label-tag:hover {
.label-tag:hover {
opacity: 0.85;
background-color: darken(@purple, 10%);
background-color: darken(@purple, 10%);
color: @white;
}
}
.annotation-editor-table {
.annotation-editor-table {
...
...
src/css/less/variables.light.less
View file @
adbe8142
...
@@ -61,8 +61,8 @@
...
@@ -61,8 +61,8 @@
// Links
// Links
// -------------------------
// -------------------------
@linkColor: @
blue
;
@linkColor: @
textColor
;
@linkColorHover:
darken(@linkColor, 10%)
;
@linkColorHover:
@blue
;
// Typography
// Typography
...
@@ -219,7 +219,7 @@
...
@@ -219,7 +219,7 @@
@navbarText: #666;
@navbarText: #666;
@navbarLinkColor: #666;
@navbarLinkColor: #666;
@navbarLinkColorHover:
#333
;
@navbarLinkColorHover:
@blue
;
@navbarLinkColorActive: #555;
@navbarLinkColorActive: #555;
@navbarLinkBackgroundHover: transparent;
@navbarLinkBackgroundHover: transparent;
@navbarLinkBackgroundActive: darken(@navbarBackground, 6.5%);
@navbarLinkBackgroundActive: darken(@navbarBackground, 6.5%);
...
...
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