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
e5ec3576
Unverified
Commit
e5ec3576
authored
Oct 28, 2017
by
Carl Bergquist
Committed by
GitHub
Oct 28, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9697 from bergquist/fix_removed_threshols
save as should only delete threshold for panels with alerts
parents
d03b0d66
728471ee
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
1 deletions
+71
-1
public/app/features/dashboard/save_as_modal.ts
+4
-1
public/app/features/dashboard/specs/save_as_modal.jest.ts
+67
-0
No files found.
public/app/features/dashboard/save_as_modal.ts
View file @
e5ec3576
...
@@ -49,7 +49,10 @@ export class SaveDashboardAsModalCtrl {
...
@@ -49,7 +49,10 @@ export class SaveDashboardAsModalCtrl {
if
(
dashboard
.
id
>
0
)
{
if
(
dashboard
.
id
>
0
)
{
this
.
clone
.
rows
.
forEach
(
row
=>
{
this
.
clone
.
rows
.
forEach
(
row
=>
{
row
.
panels
.
forEach
(
panel
=>
{
row
.
panels
.
forEach
(
panel
=>
{
delete
panel
.
thresholds
;
if
(
panel
.
type
===
"graph"
&&
panel
.
alert
)
{
delete
panel
.
thresholds
;
}
delete
panel
.
alert
;
delete
panel
.
alert
;
});
});
});
});
...
...
public/app/features/dashboard/specs/save_as_modal.jest.ts
0 → 100644
View file @
e5ec3576
import
{
SaveDashboardAsModalCtrl
}
from
'../save_as_modal'
;
import
{
describe
,
expect
}
from
'test/lib/common'
;
describe
(
'saving dashboard as'
,
()
=>
{
function
scenario
(
name
,
panel
,
verify
)
{
describe
(
name
,
()
=>
{
var
json
=
{
title
:
"name"
,
rows
:
[
{
panels
:
[
panel
]}]
};
var
mockDashboardSrv
=
{
getCurrent
:
function
()
{
return
{
id
:
5
,
getSaveModelClone
:
function
()
{
return
json
;
}
};
}
};
var
ctrl
=
new
SaveDashboardAsModalCtrl
(
mockDashboardSrv
);
var
ctx
:
any
=
{
clone
:
ctrl
.
clone
,
ctrl
:
ctrl
,
panel
:
{}
};
for
(
let
row
of
ctrl
.
clone
.
rows
)
{
for
(
let
panel
of
row
.
panels
)
{
ctx
.
panel
=
panel
;
}
}
it
(
"verify"
,
()
=>
{
verify
(
ctx
);
});
});
}
scenario
(
"default values"
,
{},
(
ctx
)
=>
{
var
clone
=
ctx
.
clone
;
expect
(
clone
.
id
).
toBe
(
null
);
expect
(
clone
.
title
).
toBe
(
"name Copy"
);
expect
(
clone
.
editable
).
toBe
(
true
);
expect
(
clone
.
hideControls
).
toBe
(
false
);
});
var
graphPanel
=
{
id
:
1
,
type
:
"graph"
,
alert
:
{
rule
:
1
},
thresholds
:
{
value
:
3000
}
};
scenario
(
"should remove alert from graph panel"
,
graphPanel
,
(
ctx
)
=>
{
expect
(
ctx
.
panel
.
alert
).
toBe
(
undefined
);
});
scenario
(
"should remove threshold from graph panel"
,
graphPanel
,
(
ctx
)
=>
{
expect
(
ctx
.
panel
.
thresholds
).
toBe
(
undefined
);
});
scenario
(
"singlestat should keep threshold"
,
{
id
:
1
,
type
:
"singlestat"
,
thresholds
:
{
value
:
3000
}
},
(
ctx
)
=>
{
expect
(
ctx
.
panel
.
thresholds
).
not
.
toBe
(
undefined
);
});
scenario
(
"table should keep threshold"
,
{
id
:
1
,
type
:
"table"
,
thresholds
:
{
value
:
3000
}
},
(
ctx
)
=>
{
expect
(
ctx
.
panel
.
thresholds
).
not
.
toBe
(
undefined
);
});
});
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