mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 16:13:24 +02:00
Starting to add Timeline notifications.
This commit is contained in:
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
|
||||
}
|
||||
Reference in New Issue
Block a user