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
a1157b17
Unverified
Commit
a1157b17
authored
Apr 03, 2020
by
Ryan McKinley
Committed by
GitHub
Apr 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Inspector: remove feature flag and angular "Export CSV" menu option (#23160)
parent
6366e43a
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
13 additions
and
179 deletions
+13
-179
packages/grafana-runtime/src/config.ts
+1
-3
public/app/features/dashboard/components/ExportDataModal/ExportDataModalCtrl.ts
+0
-56
public/app/features/dashboard/components/ExportDataModal/index.ts
+0
-1
public/app/features/dashboard/components/ExportDataModal/template.html
+0
-36
public/app/features/dashboard/index.ts
+0
-1
public/app/features/dashboard/utils/getPanelMenu.test.ts
+6
-0
public/app/features/dashboard/utils/getPanelMenu.ts
+6
-8
public/app/plugins/panel/graph/module.ts
+0
-13
public/app/plugins/panel/graph/specs/graph_ctrl.test.ts
+0
-44
public/app/plugins/panel/table/module.ts
+0
-17
No files found.
packages/grafana-runtime/src/config.ts
View file @
a1157b17
...
...
@@ -14,10 +14,9 @@ export interface BuildInfo {
interface
FeatureToggles
{
transformations
:
boolean
;
inspect
:
boolean
;
expressions
:
boolean
;
newEdit
:
boolean
;
meta
:
boolean
;
meta
:
boolean
;
// enterprise
newVariables
:
boolean
;
tracingIntegration
:
boolean
;
}
...
...
@@ -67,7 +66,6 @@ export class GrafanaBootConfig {
pluginsToPreload
:
string
[]
=
[];
featureToggles
:
FeatureToggles
=
{
transformations
:
false
,
inspect
:
false
,
expressions
:
false
,
newEdit
:
false
,
meta
:
false
,
...
...
public/app/features/dashboard/components/ExportDataModal/ExportDataModalCtrl.ts
deleted
100644 → 0
View file @
6366e43a
import
angular
from
'angular'
;
import
*
as
fileExport
from
'app/core/utils/file_export'
;
import
appEvents
from
'app/core/app_events'
;
import
{
DashboardSrv
}
from
'app/features/dashboard/services/DashboardSrv'
;
import
{
CoreEvents
}
from
'app/types'
;
export
class
ExportDataModalCtrl
{
private
data
:
any
;
private
panel
:
string
;
asRows
=
true
;
dateTimeFormat
=
'YYYY-MM-DDTHH:mm:ssZ'
;
excel
=
false
;
/** @ngInject */
constructor
(
private
dashboardSrv
:
DashboardSrv
)
{}
export
()
{
const
timezone
=
this
.
dashboardSrv
.
getCurrent
().
timezone
;
const
options
=
{
excel
:
this
.
excel
,
dateTimeFormat
:
this
.
dateTimeFormat
,
timezone
,
};
if
(
this
.
panel
===
'table'
)
{
fileExport
.
exportTableDataToCsv
(
this
.
data
,
this
.
excel
);
}
else
{
if
(
this
.
asRows
)
{
fileExport
.
exportSeriesListToCsv
(
this
.
data
,
options
);
}
else
{
fileExport
.
exportSeriesListToCsvColumns
(
this
.
data
,
options
);
}
}
this
.
dismiss
();
}
dismiss
()
{
appEvents
.
emit
(
CoreEvents
.
hideModal
);
}
}
export
function
exportDataModal
()
{
return
{
restrict
:
'E'
,
templateUrl
:
'public/app/features/dashboard/components/ExportDataModal/template.html'
,
controller
:
ExportDataModalCtrl
,
controllerAs
:
'ctrl'
,
scope
:
{
panel
:
'<'
,
data
:
'<'
,
// The difference to '=' is that the bound properties are not watched
},
bindToController
:
true
,
};
}
angular
.
module
(
'grafana.directives'
).
directive
(
'exportDataModal'
,
exportDataModal
);
public/app/features/dashboard/components/ExportDataModal/index.ts
deleted
100644 → 0
View file @
6366e43a
export
{
ExportDataModalCtrl
}
from
'./ExportDataModalCtrl'
;
public/app/features/dashboard/components/ExportDataModal/template.html
deleted
100644 → 0
View file @
6366e43a
<div
class=
"modal-body"
>
<div
class=
"modal-header"
>
<h2
class=
"modal-header-title"
>
Export CSV
</h2>
<a
class=
"modal-header-close"
ng-click=
"ctrl.dismiss();"
>
<i
class=
"fa fa-remove"
></i>
</a>
</div>
<div
class=
"modal-content"
>
<div
class=
"p-t-2"
>
<div
class=
"gf-form"
ng-hide=
"ctrl.panel === 'table'"
>
<label
class=
"gf-form-label width-10"
>
Mode
</label>
<div
class=
"gf-form-select-wrapper"
>
<select
class=
"gf-form-input"
ng-model=
"ctrl.asRows"
ng-options=
"f.value as f.text for f in [{text: 'Series as rows', value: true}, {text: 'Series as columns', value: false}]"
>
</select>
</div>
</div>
<div
class=
"gf-form"
ng-hide=
"ctrl.panel === 'table'"
>
<label
class=
"gf-form-label width-10"
>
Date Time Format
</label>
<input
type=
"text"
class=
"gf-form-input"
ng-model=
"ctrl.dateTimeFormat"
>
</div>
<gf-form-switch
class=
"gf-form"
label=
"Excel CSV Dialect"
label-class=
"width-10"
switch-class=
"max-width-6"
checked=
"ctrl.excel"
>
</gf-form-switch>
</div>
<div
class=
"gf-form-button-row text-center"
>
<a
class=
"btn btn-primary"
ng-click=
"ctrl.export();"
>
Export
</a>
<a
class=
"btn-text"
ng-click=
"ctrl.dismiss();"
>
Cancel
</a>
</div>
</div>
</div>
public/app/features/dashboard/index.ts
View file @
a1157b17
...
...
@@ -7,7 +7,6 @@ import './services/DashboardSrv';
import
'./components/DashLinks'
;
import
'./components/DashExportModal'
;
import
'./components/DashNav'
;
import
'./components/ExportDataModal'
;
import
'./components/VersionHistory'
;
import
'./components/DashboardSettings'
;
import
'./components/SubMenu'
;
...
...
public/app/features/dashboard/utils/getPanelMenu.test.ts
View file @
a1157b17
...
...
@@ -28,6 +28,12 @@ describe('getPanelMenu', () => {
"text": "Share",
},
Object {
"iconClassName": "fa fa-fw fa-info-circle",
"onClick": [Function],
"shortcut": "p i",
"text": "Inspect",
},
Object {
"iconClassName": "fa fa-fw fa-cube",
"onClick": [Function],
"subMenu": Array [
...
...
public/app/features/dashboard/utils/getPanelMenu.ts
View file @
a1157b17
...
...
@@ -136,14 +136,12 @@ export function getPanelMenu(
});
}
if
(
config
.
featureToggles
.
inspect
)
{
menu
.
push
({
text
:
'Inspect'
,
iconClassName
:
'fa fa-fw fa-info-circle'
,
onClick
:
onInspectPanel
,
shortcut
:
'p i'
,
});
}
menu
.
push
({
text
:
'Inspect'
,
iconClassName
:
'fa fa-fw fa-info-circle'
,
onClick
:
onInspectPanel
,
shortcut
:
'p i'
,
});
if
(
config
.
featureToggles
.
newEdit
)
{
menu
.
push
({
...
...
public/app/plugins/panel/graph/module.ts
View file @
a1157b17
...
...
@@ -178,7 +178,6 @@ class GraphCtrl extends MetricsPanelCtrl {
}
onInitPanelActions
(
actions
:
any
[])
{
actions
.
push
({
text
:
'Export CSV'
,
click
:
'ctrl.exportCsv()'
});
actions
.
push
({
text
:
'Toggle legend'
,
click
:
'ctrl.toggleLegend()'
,
shortcut
:
'p l'
});
}
...
...
@@ -339,18 +338,6 @@ class GraphCtrl extends MetricsPanelCtrl {
this
.
render
();
}
exportCsv
()
{
const
scope
=
this
.
$scope
.
$new
(
true
);
scope
.
seriesList
=
this
.
seriesList
.
filter
(
series
=>
!
this
.
panel
.
legend
.
hideEmpty
||
!
series
.
allIsNull
)
.
filter
(
series
=>
!
this
.
panel
.
legend
.
hideZero
||
!
series
.
allIsZero
);
this
.
publishAppEvent
(
CoreEvents
.
showModal
,
{
templateHtml
:
'<export-data-modal data="seriesList"></export-data-modal>'
,
scope
,
modalClass
:
'modal--narrow'
,
});
}
onContextMenuClose
=
()
=>
{
this
.
contextMenuCtrl
.
toggleMenu
();
};
...
...
public/app/plugins/panel/graph/specs/graph_ctrl.test.ts
View file @
a1157b17
...
...
@@ -143,49 +143,5 @@ describe('GraphCtrl', () => {
// allIsNull / allIsZero are set by getFlotPairs
ctx
.
ctrl
.
seriesList
.
forEach
((
series
:
TimeSeries
)
=>
series
.
getFlotPairs
(
''
));
});
const
thenExportYieldedNSeries
=
(
n
:
number
)
=>
{
expect
(
appEventMock
.
mock
.
calls
.
length
).
toBe
(
1
);
const
eventPayload
=
appEventMock
.
mock
.
calls
[
0
][
1
];
expect
(
eventPayload
.
scope
.
seriesList
).
toHaveLength
(
n
);
};
const
thenExportDidNotYieldSeriesName
=
(
unexpectedName
:
string
)
=>
{
expect
(
appEventMock
.
mock
.
calls
.
length
).
toBe
(
1
);
const
eventPayload
=
appEventMock
.
mock
.
calls
[
0
][
1
];
expect
(
eventPayload
.
scope
.
seriesList
.
filter
((
series
:
TimeSeries
)
=>
series
.
label
===
unexpectedName
)
).
toHaveLength
(
0
);
};
it
(
'should not ignore anything if not asked to'
,
()
=>
{
ctx
.
ctrl
.
exportCsv
();
thenExportYieldedNSeries
(
3
);
});
it
(
'should ignore all-null series when asked to'
,
()
=>
{
ctx
.
ctrl
.
panel
.
legend
.
hideEmpty
=
true
;
ctx
.
ctrl
.
exportCsv
();
thenExportYieldedNSeries
(
2
);
thenExportDidNotYieldSeriesName
(
'test.nulls'
);
});
it
(
'should ignore all-zero series when asked to'
,
()
=>
{
ctx
.
ctrl
.
panel
.
legend
.
hideZero
=
true
;
ctx
.
ctrl
.
exportCsv
();
// impl treats all-null series as all-zero as well
thenExportYieldedNSeries
(
1
);
thenExportDidNotYieldSeriesName
(
'test.zeros'
);
thenExportDidNotYieldSeriesName
(
'test.empty'
);
});
it
(
'should ignore both when asked to'
,
()
=>
{
ctx
.
ctrl
.
panel
.
legend
.
hideZero
=
true
;
ctx
.
ctrl
.
panel
.
legend
.
hideEmpty
=
true
;
ctx
.
ctrl
.
exportCsv
();
thenExportYieldedNSeries
(
1
);
thenExportDidNotYieldSeriesName
(
'test.zeros'
);
thenExportDidNotYieldSeriesName
(
'test.empty'
);
});
});
});
public/app/plugins/panel/table/module.ts
View file @
a1157b17
...
...
@@ -8,7 +8,6 @@ import { columnOptionsTab } from './column_options';
import
{
TableRenderer
}
from
'./renderer'
;
import
{
isTableData
,
PanelEvents
,
PanelPlugin
}
from
'@grafana/data'
;
import
{
TemplateSrv
}
from
'app/features/templating/template_srv'
;
import
{
CoreEvents
}
from
'app/types'
;
import
{
dispatch
}
from
'app/store/store'
;
import
{
applyFilterFromTable
}
from
'app/features/variables/adhoc/actions'
;
...
...
@@ -76,7 +75,6 @@ export class TablePanelCtrl extends MetricsPanelCtrl {
this
.
events
.
on
(
PanelEvents
.
dataReceived
,
this
.
onDataReceived
.
bind
(
this
));
this
.
events
.
on
(
PanelEvents
.
dataSnapshotLoad
,
this
.
onDataReceived
.
bind
(
this
));
this
.
events
.
on
(
PanelEvents
.
editModeInitialized
,
this
.
onInitEditMode
.
bind
(
this
));
this
.
events
.
on
(
PanelEvents
.
initPanelActions
,
this
.
onInitPanelActions
.
bind
(
this
));
}
onInitEditMode
()
{
...
...
@@ -84,10 +82,6 @@ export class TablePanelCtrl extends MetricsPanelCtrl {
this
.
addEditorTab
(
'Column Styles'
,
columnOptionsTab
,
3
);
}
onInitPanelActions
(
actions
:
any
[])
{
actions
.
push
({
text
:
'Export CSV'
,
click
:
'ctrl.exportCsv()'
});
}
issueQueries
(
datasource
:
any
)
{
this
.
pageIndex
=
0
;
...
...
@@ -167,17 +161,6 @@ export class TablePanelCtrl extends MetricsPanelCtrl {
this
.
render
();
}
exportCsv
()
{
const
scope
=
this
.
$scope
.
$new
(
true
);
scope
.
tableData
=
this
.
renderer
.
render_values
();
scope
.
panel
=
'table'
;
this
.
publishAppEvent
(
CoreEvents
.
showModal
,
{
templateHtml
:
'<export-data-modal panel="panel" data="tableData"></export-data-modal>'
,
scope
,
modalClass
:
'modal--narrow'
,
});
}
link
(
scope
:
any
,
elem
:
JQuery
,
attrs
:
any
,
ctrl
:
TablePanelCtrl
)
{
let
data
:
any
;
const
panel
=
ctrl
.
panel
;
...
...
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