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
bc218626
Commit
bc218626
authored
Jan 18, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tech(playlist): refactor playlistSrv to typescript
parent
899a44a7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
56 deletions
+58
-56
public/app/features/playlist/playlistSrv.js
+0
-56
public/app/features/playlist/playlistSrv.ts
+58
-0
No files found.
public/app/features/playlist/playlistSrv.js
deleted
100644 → 0
View file @
899a44a7
define
([
'angular'
,
'lodash'
,
'app/core/utils/kbn'
,
],
function
(
angular
,
_
,
kbn
)
{
'use strict'
;
var
module
=
angular
.
module
(
'grafana.services'
);
module
.
service
(
'playlistSrv'
,
function
(
$location
,
$rootScope
,
$timeout
)
{
var
self
=
this
;
this
.
next
=
function
()
{
$timeout
.
cancel
(
self
.
cancelPromise
);
angular
.
element
(
window
).
unbind
(
'resize'
);
var
dash
=
self
.
dashboards
[
self
.
index
%
self
.
dashboards
.
length
];
$location
.
url
(
'dashboard/'
+
dash
.
uri
);
self
.
index
++
;
self
.
cancelPromise
=
$timeout
(
self
.
next
,
self
.
interval
);
};
this
.
prev
=
function
()
{
self
.
index
=
Math
.
max
(
self
.
index
-
2
,
0
);
self
.
next
();
};
this
.
start
=
function
(
dashboards
,
interval
)
{
self
.
stop
();
self
.
index
=
0
;
self
.
interval
=
kbn
.
interval_to_ms
(
interval
);
self
.
dashboards
=
dashboards
;
$rootScope
.
playlistSrv
=
this
;
self
.
cancelPromise
=
$timeout
(
self
.
next
,
self
.
interval
);
self
.
next
();
};
this
.
stop
=
function
()
{
self
.
index
=
0
;
if
(
self
.
cancelPromise
)
{
$timeout
.
cancel
(
self
.
cancelPromise
);
}
$rootScope
.
playlistSrv
=
null
;
};
});
});
public/app/features/playlist/playlistSrv.ts
0 → 100644
View file @
bc218626
///<reference path="../../headers/common.d.ts" />
import
angular
from
'angular'
;
import
coreModule
from
'../../core/core_module'
;
import
kbn
from
'app/core/utils/kbn'
;
class
PlaylistSrv
{
private
cancelPromise
:
any
private
dashboards
:
any
private
index
:
number
private
interval
:
any
/** @ngInject */
constructor
(
private
$rootScope
:
any
,
private
$location
:
any
,
private
$timeout
:
any
)
{
}
next
()
{
this
.
$timeout
.
cancel
(
this
.
cancelPromise
);
angular
.
element
(
window
).
unbind
(
'resize'
);
var
dash
=
this
.
dashboards
[
this
.
index
%
this
.
dashboards
.
length
];
this
.
$location
.
url
(
'dashboard/'
+
dash
.
uri
);
this
.
index
++
;
this
.
cancelPromise
=
this
.
$timeout
(()
=>
{
this
.
next
();
},
this
.
interval
);
}
prevfunction
()
{
this
.
index
=
Math
.
max
(
this
.
index
-
2
,
0
);
this
.
next
();
}
start
(
dashboards
,
interval
)
{
this
.
stop
();
this
.
index
=
0
;
this
.
interval
=
kbn
.
interval_to_ms
(
interval
);
this
.
dashboards
=
dashboards
;
this
.
$rootScope
.
playlistSrv
=
this
;
this
.
cancelPromise
=
this
.
$timeout
(()
=>
{
this
.
next
();
},
this
.
interval
);
this
.
next
();
}
stop
()
{
this
.
index
=
0
;
if
(
this
.
cancelPromise
)
{
this
.
$timeout
.
cancel
(
this
.
cancelPromise
);
}
this
.
$rootScope
.
playlistSrv
=
null
;
}
}
coreModule
.
service
(
'playlistSrv'
,
PlaylistSrv
)
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