Start to add Socket Disconnected Modal.

This commit is contained in:
Gunther Brunner
2014-10-17 18:05:22 +09:00
parent 0ea6debc13
commit e172457b5f
7 changed files with 84 additions and 1 deletions

View File

@@ -0,0 +1,4 @@
module.exports = angular.module('stf.socket-disconnected', [
require('stf/common-ui/modals/common').name
])
.factory('SocketDisconnectedService', require('./socket-disconnected-service'))

View File

@@ -0,0 +1,40 @@
module.exports =
function SocketDisconnectedServiceFactory($modal, $location, $route) {
var service = {}
var ModalInstanceCtrl = function ($scope, $modalInstance) {
$scope.ok = function () {
$modalInstance.close(true)
$route.reload()
//$location.path('/control/' + device.serial)
}
$scope.second = function () {
$modalInstance.dismiss()
//$location.path('/devices/')
}
$scope.cancel = function () {
$modalInstance.dismiss('cancel')
}
}
service.open = function () {
var modalInstance = $modal.open({
template: require('./socket-disconnected.jade'),
controller: ModalInstanceCtrl,
resolve: {}
})
modalInstance.result.then(function () {
}, function () {
})
}
return service
}

View File

@@ -0,0 +1,11 @@
describe('SocketDisconnectedService', function() {
beforeEach(angular.mock.module(require('./index').name))
it('should ...', inject(function(SocketDisconnectedService) {
//expect(SocketDisconnectedService.doSomething()).toEqual('something')
}))
})

View File

@@ -0,0 +1,24 @@
.stf-fatal-message.stf-modal
.modal-header.dialog-header-errorX
button(type='button', ng-click='cancel()').close ×
h4.modal-title.text-danger
i.fa.fa-warning
.button-spacer
span(translate) Socket was disconnected
.modal-body
h4(translate, ng-bind='device.likelyLeaveReason | likelyLeaveReason')
br
.big-thumbnail
//.device-photo-small
// img(ng-src='/static/app/devices/icon/x120/{{ device.image || "E30HT.jpg" }}')
//.device-name(ng-bind='device.enhancedName')
//h3.device-status(ng-class='stateColor')
// span(ng-bind='device.enhancedStatePassive | translate')
.modal-footer
button.btn.btn-primary-outline.pull-right(type='button', ng-click='ok()')
i.fa.fa-refresh
span(translate) Try to reconnect
//button.btn.btn-success-outline(ng-click='second()')
i.fa.fa-sitemap
span(translate) Go to Device List