mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-21 13:25:17 +02:00
Add upload and installation errors.
This commit is contained in:
4
res/app/components/stf/upload/index.js
Normal file
4
res/app/components/stf/upload/index.js
Normal file
@@ -0,0 +1,4 @@
|
||||
module.exports = angular.module('stf.upload-service', [
|
||||
require('gettext').name
|
||||
])
|
||||
.filter('uploadError', require('./upload-error-filter'))
|
||||
10
res/app/components/stf/upload/upload-error-filter.js
Normal file
10
res/app/components/stf/upload/upload-error-filter.js
Normal file
@@ -0,0 +1,10 @@
|
||||
module.exports = function uploadErrorFilter(gettext) {
|
||||
return function (text) {
|
||||
return {
|
||||
'fail_invalid_app_file': gettext('Uploaded file is not valid'),
|
||||
'fail_download': gettext('Failed to download file'),
|
||||
'fail_invalid_url': gettext('Cannot access specified URL'),
|
||||
'fail': gettext('Upload failed')
|
||||
}[text] || gettext('Upload unknown error')
|
||||
}
|
||||
}
|
||||
13
res/app/components/stf/upload/upload-spec.js
Normal file
13
res/app/components/stf/upload/upload-spec.js
Normal file
@@ -0,0 +1,13 @@
|
||||
describe('upload', function() {
|
||||
|
||||
beforeEach(angular.mock.module(require('./').name))
|
||||
|
||||
it('should ...', inject(function($filter) {
|
||||
|
||||
var filter = $filter('upload')
|
||||
|
||||
expect(filter('input')).toEqual('output')
|
||||
|
||||
}))
|
||||
|
||||
})
|
||||
Reference in New Issue
Block a user