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
a624c971
Commit
a624c971
authored
Feb 05, 2019
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed unused controllers and services
parent
6d874dd1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
1 additions
and
412 deletions
+1
-412
public/app/core/components/gf_page.ts
+0
-40
public/app/core/components/scroll/page_scroll.ts
+0
-43
public/app/core/core.ts
+0
-4
public/app/features/dashboard/containers/DashboardCtrl.ts
+0
-150
public/app/features/dashboard/index.ts
+0
-2
public/app/features/dashboard/services/DashboardViewStateSrv.ts
+0
-155
public/app/partials/dashboard.html
+0
-17
public/views/index-template.html
+1
-1
No files found.
public/app/core/components/gf_page.ts
deleted
100644 → 0
View file @
6d874dd1
import
coreModule
from
'app/core/core_module'
;
const
template
=
`
<div class="scroll-canvas">
<navbar model="model"></navbar>
<div class="page-container">
<div class="page-header">
<h1>
<i class="{{::model.node.icon}}" ng-if="::model.node.icon"></i>
<img ng-src="{{::model.node.img}}" ng-if="::model.node.img"></i>
{{::model.node.text}}
</h1>
<div class="page-header__actions" ng-transclude="header"></div>
</div>
<div class="page-body" ng-transclude="body">
</div>
</div>
</div>
`
;
export
function
gfPageDirective
()
{
return
{
restrict
:
'E'
,
template
:
template
,
scope
:
{
model
:
'='
,
},
transclude
:
{
header
:
'?gfPageHeader'
,
body
:
'gfPageBody'
,
},
link
:
(
scope
,
elem
,
attrs
)
=>
{
console
.
log
(
scope
);
},
};
}
coreModule
.
directive
(
'gfPage'
,
gfPageDirective
);
public/app/core/components/scroll/page_scroll.ts
deleted
100644 → 0
View file @
6d874dd1
import
coreModule
from
'app/core/core_module'
;
import
appEvents
from
'app/core/app_events'
;
export
function
pageScrollbar
()
{
return
{
restrict
:
'A'
,
link
:
(
scope
,
elem
,
attrs
)
=>
{
let
lastPos
=
0
;
appEvents
.
on
(
'dash-scroll'
,
evt
=>
{
if
(
evt
.
restore
)
{
elem
[
0
].
scrollTop
=
lastPos
;
return
;
}
lastPos
=
elem
[
0
].
scrollTop
;
if
(
evt
.
animate
)
{
elem
.
animate
({
scrollTop
:
evt
.
pos
},
500
);
}
else
{
elem
[
0
].
scrollTop
=
evt
.
pos
;
}
},
scope
);
scope
.
$on
(
'$routeChangeSuccess'
,
()
=>
{
lastPos
=
0
;
elem
[
0
].
scrollTop
=
0
;
// Focus page to enable scrolling by keyboard
elem
[
0
].
focus
({
preventScroll
:
true
});
});
elem
[
0
].
tabIndex
=
-
1
;
// Focus page to enable scrolling by keyboard
elem
[
0
].
focus
({
preventScroll
:
true
});
},
};
}
coreModule
.
directive
(
'pageScrollbar'
,
pageScrollbar
);
public/app/core/core.ts
View file @
a624c971
...
...
@@ -43,8 +43,6 @@ import { helpModal } from './components/help/help';
import
{
JsonExplorer
}
from
'./components/json_explorer/json_explorer'
;
import
{
NavModelSrv
,
NavModel
}
from
'./nav_model_srv'
;
import
{
geminiScrollbar
}
from
'./components/scroll/scroll'
;
import
{
pageScrollbar
}
from
'./components/scroll/page_scroll'
;
import
{
gfPageDirective
}
from
'./components/gf_page'
;
import
{
orgSwitcher
}
from
'./components/org_switcher'
;
import
{
profiler
}
from
'./profiler'
;
import
{
registerAngularDirectives
}
from
'./angular_wrappers'
;
...
...
@@ -79,8 +77,6 @@ export {
NavModelSrv
,
NavModel
,
geminiScrollbar
,
pageScrollbar
,
gfPageDirective
,
orgSwitcher
,
manageDashboardsDirective
,
TimeSeries
,
...
...
public/app/features/dashboard/containers/DashboardCtrl.ts
deleted
100644 → 0
View file @
6d874dd1
// Utils
import
config
from
'app/core/config'
;
import
appEvents
from
'app/core/app_events'
;
import
coreModule
from
'app/core/core_module'
;
import
{
removePanel
}
from
'app/features/dashboard/utils/panel'
;
// Services
import
{
AnnotationsSrv
}
from
'../../annotations/annotations_srv'
;
// Types
import
{
DashboardModel
}
from
'../state/DashboardModel'
;
export
class
DashboardCtrl
{
dashboard
:
DashboardModel
;
dashboardViewState
:
any
;
loadedFallbackDashboard
:
boolean
;
editTab
:
number
;
/** @ngInject */
constructor
(
private
$scope
,
private
keybindingSrv
,
private
timeSrv
,
private
variableSrv
,
private
dashboardSrv
,
private
unsavedChangesSrv
,
private
dashboardViewStateSrv
,
private
annotationsSrv
:
AnnotationsSrv
,
public
playlistSrv
)
{
// temp hack due to way dashboards are loaded
// can't use controllerAs on route yet
$scope
.
ctrl
=
this
;
}
setupDashboard
(
data
)
{
try
{
this
.
setupDashboardInternal
(
data
);
}
catch
(
err
)
{
this
.
onInitFailed
(
err
,
'Dashboard init failed'
,
true
);
}
}
setupDashboardInternal
(
data
)
{
const
dashboard
=
this
.
dashboardSrv
.
create
(
data
.
dashboard
,
data
.
meta
);
this
.
dashboardSrv
.
setCurrent
(
dashboard
);
// init services
this
.
timeSrv
.
init
(
dashboard
);
this
.
annotationsSrv
.
init
(
dashboard
);
// template values service needs to initialize completely before
// the rest of the dashboard can load
this
.
variableSrv
.
init
(
dashboard
)
// template values failes are non fatal
.
catch
(
this
.
onInitFailed
.
bind
(
this
,
'Templating init failed'
,
false
))
// continue
.
finally
(()
=>
{
this
.
dashboard
=
dashboard
;
this
.
dashboard
.
processRepeats
();
this
.
dashboard
.
updateSubmenuVisibility
();
this
.
dashboard
.
autoFitPanels
(
window
.
innerHeight
);
this
.
unsavedChangesSrv
.
init
(
dashboard
,
this
.
$scope
);
// TODO refactor ViewStateSrv
this
.
$scope
.
dashboard
=
dashboard
;
this
.
dashboardViewState
=
this
.
dashboardViewStateSrv
.
create
(
this
.
$scope
);
this
.
keybindingSrv
.
setupDashboardBindings
(
this
.
$scope
,
dashboard
);
this
.
setWindowTitleAndTheme
();
appEvents
.
emit
(
'dashboard-initialized'
,
dashboard
);
})
.
catch
(
this
.
onInitFailed
.
bind
(
this
,
'Dashboard init failed'
,
true
));
}
onInitFailed
(
msg
,
fatal
,
err
)
{
console
.
log
(
msg
,
err
);
if
(
err
.
data
&&
err
.
data
.
message
)
{
err
.
message
=
err
.
data
.
message
;
}
else
if
(
!
err
.
message
)
{
err
=
{
message
:
err
.
toString
()
};
}
this
.
$scope
.
appEvent
(
'alert-error'
,
[
msg
,
err
.
message
]);
// protect against recursive fallbacks
if
(
fatal
&&
!
this
.
loadedFallbackDashboard
)
{
this
.
loadedFallbackDashboard
=
true
;
this
.
setupDashboard
({
dashboard
:
{
title
:
'Dashboard Init failed'
}
});
}
}
templateVariableUpdated
()
{
this
.
dashboard
.
processRepeats
();
}
setWindowTitleAndTheme
()
{
window
.
document
.
title
=
config
.
windowTitlePrefix
+
this
.
dashboard
.
title
;
}
showJsonEditor
(
evt
,
options
)
{
const
model
=
{
object
:
options
.
object
,
updateHandler
:
options
.
updateHandler
,
};
this
.
$scope
.
appEvent
(
'show-dash-editor'
,
{
src
:
'public/app/partials/edit_json.html'
,
model
:
model
,
});
}
getDashboard
()
{
return
this
.
dashboard
;
}
getPanelContainer
()
{
return
this
;
}
onRemovingPanel
(
evt
,
options
)
{
options
=
options
||
{};
if
(
!
options
.
panelId
)
{
return
;
}
const
panelInfo
=
this
.
dashboard
.
getPanelInfoById
(
options
.
panelId
);
removePanel
(
this
.
dashboard
,
panelInfo
.
panel
,
true
);
}
onDestroy
()
{
if
(
this
.
dashboard
)
{
this
.
dashboard
.
destroy
();
}
}
init
(
dashboard
)
{
this
.
$scope
.
onAppEvent
(
'show-json-editor'
,
this
.
showJsonEditor
.
bind
(
this
));
this
.
$scope
.
onAppEvent
(
'template-variable-value-updated'
,
this
.
templateVariableUpdated
.
bind
(
this
));
this
.
$scope
.
onAppEvent
(
'panel-remove'
,
this
.
onRemovingPanel
.
bind
(
this
));
this
.
$scope
.
$on
(
'$destroy'
,
this
.
onDestroy
.
bind
(
this
));
this
.
setupDashboard
(
dashboard
);
}
}
coreModule
.
controller
(
'DashboardCtrl'
,
DashboardCtrl
);
public/app/features/dashboard/index.ts
View file @
a624c971
import
'./containers/DashboardCtrl'
;
import
'./dashgrid/DashboardGridDirective'
;
// Services
import
'./services/DashboardViewStateSrv'
;
import
'./services/UnsavedChangesSrv'
;
import
'./services/DashboardLoaderSrv'
;
import
'./services/DashboardSrv'
;
...
...
public/app/features/dashboard/services/DashboardViewStateSrv.ts
deleted
100644 → 0
View file @
6d874dd1
import
angular
from
'angular'
;
import
_
from
'lodash'
;
import
config
from
'app/core/config'
;
import
appEvents
from
'app/core/app_events'
;
import
{
DashboardModel
}
from
'../state/DashboardModel'
;
// represents the transient view state
// like fullscreen panel & edit
export
class
DashboardViewStateSrv
{
state
:
any
;
panelScopes
:
any
;
$scope
:
any
;
dashboard
:
DashboardModel
;
fullscreenPanel
:
any
;
oldTimeRange
:
any
;
/** @ngInject */
constructor
(
$scope
,
private
$location
,
private
$timeout
)
{
const
self
=
this
;
self
.
state
=
{};
self
.
panelScopes
=
[];
self
.
$scope
=
$scope
;
self
.
dashboard
=
$scope
.
dashboard
;
$scope
.
onAppEvent
(
'$routeUpdate'
,
()
=>
{
// const urlState = self.getQueryStringState();
// if (self.needsSync(urlState)) {
// self.update(urlState, true);
// }
});
$scope
.
onAppEvent
(
'panel-change-view'
,
(
evt
,
payload
)
=>
{
// self.update(payload);
});
// this marks changes to location during this digest cycle as not to add history item
// don't want url changes like adding orgId to add browser history
// $location.replace();
// this.update(this.getQueryStringState());
}
needsSync
(
urlState
)
{
return
_
.
isEqual
(
this
.
state
,
urlState
)
===
false
;
}
getQueryStringState
()
{
const
state
=
this
.
$location
.
search
();
state
.
panelId
=
parseInt
(
state
.
panelId
,
10
)
||
null
;
state
.
fullscreen
=
state
.
fullscreen
?
true
:
null
;
state
.
edit
=
state
.
edit
===
'true'
||
state
.
edit
===
true
||
null
;
state
.
editview
=
state
.
editview
||
null
;
state
.
orgId
=
config
.
bootData
.
user
.
orgId
;
return
state
;
}
serializeToUrl
()
{
const
urlState
=
_
.
clone
(
this
.
state
);
urlState
.
fullscreen
=
this
.
state
.
fullscreen
?
true
:
null
;
urlState
.
edit
=
this
.
state
.
edit
?
true
:
null
;
return
urlState
;
}
update
(
state
,
fromRouteUpdated
?)
{
// implement toggle logic
if
(
state
.
toggle
)
{
delete
state
.
toggle
;
if
(
this
.
state
.
fullscreen
&&
state
.
fullscreen
)
{
if
(
this
.
state
.
edit
===
state
.
edit
)
{
state
.
fullscreen
=
!
state
.
fullscreen
;
}
}
}
_
.
extend
(
this
.
state
,
state
);
if
(
!
this
.
state
.
fullscreen
)
{
this
.
state
.
fullscreen
=
null
;
this
.
state
.
edit
=
null
;
// clear panel id unless in solo mode
if
(
!
this
.
dashboard
.
meta
.
soloMode
)
{
this
.
state
.
panelId
=
null
;
}
}
if
((
this
.
state
.
fullscreen
||
this
.
dashboard
.
meta
.
soloMode
)
&&
this
.
state
.
panelId
)
{
// Trying to render panel in fullscreen when it's in the collapsed row causes an issue.
// So in this case expand collapsed row first.
this
.
toggleCollapsedPanelRow
(
this
.
state
.
panelId
);
}
// if no edit state cleanup tab parm
if
(
!
this
.
state
.
edit
)
{
delete
this
.
state
.
tab
;
}
// do not update url params if we are here
// from routeUpdated event
if
(
fromRouteUpdated
!==
true
)
{
this
.
$location
.
search
(
this
.
serializeToUrl
());
}
}
toggleCollapsedPanelRow
(
panelId
)
{
for
(
const
panel
of
this
.
dashboard
.
panels
)
{
if
(
panel
.
collapsed
)
{
for
(
const
rowPanel
of
panel
.
panels
)
{
if
(
rowPanel
.
id
===
panelId
)
{
this
.
dashboard
.
toggleRow
(
panel
);
return
;
}
}
}
}
}
leaveFullscreen
()
{
const
panel
=
this
.
fullscreenPanel
;
this
.
dashboard
.
setViewMode
(
panel
,
false
,
false
);
delete
this
.
fullscreenPanel
;
this
.
$timeout
(()
=>
{
appEvents
.
emit
(
'dash-scroll'
,
{
restore
:
true
});
if
(
this
.
oldTimeRange
!==
this
.
dashboard
.
time
)
{
this
.
dashboard
.
startRefresh
();
}
else
{
this
.
dashboard
.
render
();
}
});
}
enterFullscreen
(
panel
)
{
const
isEditing
=
this
.
state
.
edit
&&
this
.
dashboard
.
meta
.
canEdit
;
this
.
oldTimeRange
=
this
.
dashboard
.
time
;
this
.
fullscreenPanel
=
panel
;
// Firefox doesn't return scrollTop position properly if 'dash-scroll' is emitted after setViewMode()
this
.
$scope
.
appEvent
(
'dash-scroll'
,
{
animate
:
false
,
pos
:
0
});
this
.
dashboard
.
setViewMode
(
panel
,
true
,
isEditing
);
}
}
/** @ngInject */
export
function
dashboardViewStateSrv
(
$location
,
$timeout
)
{
return
{
create
:
$scope
=>
{
return
new
DashboardViewStateSrv
(
$scope
,
$location
,
$timeout
);
},
};
}
angular
.
module
(
'grafana.services'
).
factory
(
'dashboardViewStateSrv'
,
dashboardViewStateSrv
);
public/app/partials/dashboard.html
deleted
100644 → 0
View file @
6d874dd1
<div
dash-class
ng-if=
"ctrl.dashboard"
>
<dashnav
dashboard=
"ctrl.dashboard"
></dashnav>
<div
class=
"scroll-canvas scroll-canvas--dashboard"
page-scrollbar
>
<dashboard-settings
dashboard=
"ctrl.dashboard"
ng-if=
"ctrl.dashboardViewState.state.editview"
class=
"dashboard-settings"
>
</dashboard-settings>
<div
class=
"dashboard-container"
ng-class=
"{'dashboard-container--has-submenu': ctrl.dashboard.meta.submenuEnabled}"
>
<dashboard-submenu
ng-if=
"ctrl.dashboard.meta.submenuEnabled"
dashboard=
"ctrl.dashboard"
>
</dashboard-submenu>
<dashboard-grid
dashboard=
"ctrl.dashboard"
></dashboard-grid>
</div>
</div>
</div>
public/views/index-template.html
View file @
a624c971
...
...
@@ -192,7 +192,7 @@
<dashboard-search></dashboard-search>
<div
class=
"main-view"
>
<div
class=
"scroll-canvas"
page-scrollbar
>
<div
class=
"scroll-canvas"
>
<div
ng-view
></div>
<footer
class=
"footer"
>
...
...
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