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
3f97bd82
Commit
3f97bd82
authored
Apr 27, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added files removed in merge
parent
bf6f0f1a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
169 additions
and
0 deletions
+169
-0
public/app/directives/giveFocus.js
+0
-0
public/app/features/dashboard/dynamicDashboardSrv.js
+146
-0
public/app/features/dashboard/partials/variableValueSelect.html
+23
-0
No files found.
public/app/directives/giveFocus.js
0 → 100644
View file @
3f97bd82
public/app/features/dashboard/dynamicDashboardSrv.js
0 → 100644
View file @
3f97bd82
define
([
'angular'
,
'lodash'
,
],
function
(
angular
,
_
)
{
'use strict'
;
var
module
=
angular
.
module
(
'grafana.services'
);
module
.
service
(
'dynamicDashboardSrv'
,
function
()
{
this
.
init
=
function
(
dashboard
)
{
this
.
handlePanelRepeats
(
dashboard
);
this
.
handleRowRepeats
(
dashboard
);
};
this
.
update
=
function
(
dashboard
)
{
this
.
handlePanelRepeats
(
dashboard
);
this
.
handleRowRepeats
(
dashboard
);
};
this
.
removeLinkedPanels
=
function
(
dashboard
)
{
var
i
,
j
,
row
,
panel
;
for
(
i
=
0
;
i
<
dashboard
.
rows
.
length
;
i
++
)
{
row
=
dashboard
.
rows
[
i
];
for
(
j
=
0
;
j
<
row
.
panels
.
length
;
j
++
)
{
panel
=
row
.
panels
[
j
];
if
(
panel
.
linked
)
{
row
.
panels
=
_
.
without
(
row
.
panels
,
panel
);
j
=
j
-
1
;
}
}
}
};
this
.
handlePanelRepeats
=
function
(
dashboard
)
{
this
.
removeLinkedPanels
(
dashboard
);
var
i
,
j
,
row
,
panel
;
for
(
i
=
0
;
i
<
dashboard
.
rows
.
length
;
i
++
)
{
row
=
dashboard
.
rows
[
i
];
for
(
j
=
0
;
j
<
row
.
panels
.
length
;
j
++
)
{
panel
=
row
.
panels
[
j
];
if
(
panel
.
repeat
)
{
this
.
repeatPanel
(
panel
,
row
,
dashboard
);
}
}
}
};
this
.
removeLinkedRows
=
function
(
dashboard
)
{
var
i
,
row
;
for
(
i
=
0
;
i
<
dashboard
.
rows
.
length
;
i
++
)
{
row
=
dashboard
.
rows
[
i
];
if
(
row
.
linked
)
{
dashboard
.
rows
=
_
.
without
(
dashboard
.
rows
,
row
);
i
=
i
-
1
;
}
}
};
this
.
handleRowRepeats
=
function
(
dashboard
)
{
this
.
removeLinkedRows
(
dashboard
);
var
i
,
row
;
for
(
i
=
0
;
i
<
dashboard
.
rows
.
length
;
i
++
)
{
row
=
dashboard
.
rows
[
i
];
if
(
row
.
repeat
)
{
this
.
repeatRow
(
row
,
dashboard
);
}
}
};
this
.
repeatRow
=
function
(
row
,
dashboard
)
{
console
.
log
(
'repeat row'
);
var
variables
=
dashboard
.
templating
.
list
;
var
variable
=
_
.
findWhere
(
variables
,
{
name
:
row
.
repeat
.
replace
(
'$'
,
''
)});
if
(
!
variable
)
{
return
;
}
var
selected
,
copy
,
i
,
panel
;
if
(
variable
.
current
.
text
===
'All'
)
{
selected
=
variable
.
options
.
slice
(
1
,
variable
.
options
.
length
);
}
else
{
selected
=
_
.
filter
(
variable
.
options
,
{
selected
:
true
});
}
_
.
each
(
selected
,
function
(
option
,
index
)
{
if
(
index
>
0
)
{
copy
=
angular
.
copy
(
row
);
copy
.
repeat
=
null
;
copy
.
linked
=
true
;
// set new panel ids
for
(
i
=
0
;
i
<
copy
.
panels
.
length
;
i
++
)
{
panel
=
row
.
panels
[
i
];
panel
.
id
=
dashboard
.
getNextPanelId
();
}
dashboard
.
rows
.
push
(
copy
);
}
else
{
copy
=
row
;
}
for
(
i
=
0
;
i
<
copy
.
panels
.
length
;
i
++
)
{
panel
=
copy
.
panels
[
i
];
panel
.
scopedVars
=
panel
.
scopedVars
||
{};
panel
.
scopedVars
[
variable
.
name
]
=
option
;
}
});
};
this
.
repeatPanel
=
function
(
panel
,
row
,
dashboard
)
{
var
variables
=
dashboard
.
templating
.
list
;
var
variable
=
_
.
findWhere
(
variables
,
{
name
:
panel
.
repeat
.
replace
(
'$'
,
''
)});
if
(
!
variable
)
{
return
;
}
var
selected
;
if
(
variable
.
current
.
text
===
'All'
)
{
selected
=
variable
.
options
.
slice
(
1
,
variable
.
options
.
length
);
}
else
{
selected
=
_
.
filter
(
variable
.
options
,
{
selected
:
true
});
}
_
.
each
(
selected
,
function
(
option
,
index
)
{
if
(
index
>
0
)
{
var
copy
=
dashboard
.
duplicatePanel
(
panel
,
row
);
copy
.
repeat
=
null
;
copy
.
linked
=
true
;
copy
.
scopedVars
=
{};
copy
.
scopedVars
[
variable
.
name
]
=
option
;
}
else
{
panel
.
scopedVars
=
{};
panel
.
scopedVars
[
variable
.
name
]
=
option
;
}
console
.
log
(
'duplicatePanel'
);
});
};
});
});
public/app/features/dashboard/partials/variableValueSelect.html
0 → 100644
View file @
3f97bd82
<a
ng-click=
"show()"
class=
"variable-value-link"
>
{{linkText}}
<i
class=
"fa fa-caret-down"
></i>
</a>
<div
ng-if=
"selectorOpen"
class=
"variable-value-dropdown"
>
<div
class=
"search-field-wrapper"
>
<span
style=
"position: relative;"
>
<input
type=
"text"
placeholder=
"Search variable values"
give-focus=
"giveFocus"
tabindex=
"1"
ng-keydown=
"keyDown($event)"
ng-model=
"query.query"
ng-model-options=
"{ debounce: 500 }"
spellcheck=
'false'
ng-change=
"search()"
/>
</span>
</div>
<div
class=
"variable-options-container"
ng-if=
"!query.tagcloud"
>
<a
class=
"variable-option pointer"
bindonce
ng-repeat=
"option in options"
ng-class=
"{'selected': option.selected}"
ng-click=
"optionSelected(option)"
>
<i
class=
"fa fa-fw fa-square-o"
></i>
<i
class=
"fa fa-fw fa-check-square-o"
></i>
<span
>
{{option.text}}
</label>
</div>
</a>
</div>
</div>
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