mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-24 23:05:22 +02:00
Starting to add Timeline notifications.
This commit is contained in:
4
res/app/components/stf/timeline/index.js
Normal file
4
res/app/components/stf/timeline/index.js
Normal file
@@ -0,0 +1,4 @@
|
||||
module.exports = angular.module('stf.timeline', [
|
||||
|
||||
])
|
||||
.factory('TimelineService', require('./timeline-service'))
|
||||
41
res/app/components/stf/timeline/timeline-service.js
Normal file
41
res/app/components/stf/timeline/timeline-service.js
Normal file
@@ -0,0 +1,41 @@
|
||||
module.exports = function TimelineServiceFactory() {
|
||||
var TimelineService = {}
|
||||
|
||||
TimelineService.lines = []
|
||||
|
||||
function addLine(line, type) {
|
||||
TimelineService.lines.push({
|
||||
type: type,
|
||||
title: line.title,
|
||||
message: line.message,
|
||||
serial: angular.copy(line.serial),
|
||||
time: Date.now()
|
||||
})
|
||||
}
|
||||
|
||||
TimelineService.info = function (line) {
|
||||
addLine(line, 'info')
|
||||
}
|
||||
|
||||
TimelineService.warn = function (line) {
|
||||
addLine(line, 'warn')
|
||||
}
|
||||
|
||||
TimelineService.success = function (line) {
|
||||
addLine(line, 'success')
|
||||
}
|
||||
|
||||
TimelineService.error = function (line) {
|
||||
addLine(line, 'error')
|
||||
}
|
||||
|
||||
TimelineService.fatal = function (line) {
|
||||
addLine(line, 'fatal')
|
||||
}
|
||||
|
||||
TimelineService.clear = function () {
|
||||
TimelineService.lines = []
|
||||
}
|
||||
|
||||
return TimelineService
|
||||
}
|
||||
11
res/app/components/stf/timeline/timeline-spec.js
Normal file
11
res/app/components/stf/timeline/timeline-spec.js
Normal file
@@ -0,0 +1,11 @@
|
||||
describe('TimelineService', function() {
|
||||
|
||||
beforeEach(module('stf.timeline'));
|
||||
|
||||
it('should ...', inject(function(TimelineService) {
|
||||
|
||||
//expect(TimelineService.doSomething()).toEqual('something');
|
||||
|
||||
}));
|
||||
|
||||
})
|
||||
Reference in New Issue
Block a user