This repository has been archived by the owner on Sep 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
162 additions
and
172 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2015 Cumulocity GmbH | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
angular.module('myapp.deviceContact', []) | ||
.config(['c8yViewsProvider', function (c8yViewsProvider) { | ||
(function() { | ||
'use strict'; | ||
|
||
angular.module('myapp.deviceContact', []) | ||
.config(config); | ||
|
||
function config(c8yViewsProvider) { | ||
c8yViewsProvider.when('/device/:deviceId', { | ||
name: 'Contact', | ||
icon: 'envelope-o', | ||
priority: 1000, | ||
templateUrl: ':::PLUGIN_PATH:::/views/deviceContact.html', | ||
templateUrl: ':::PLUGIN_PATH:::/deviceContact.html', | ||
controller: 'deviceContactCtrl' | ||
}); | ||
}]); | ||
} | ||
|
||
}()); |
50 changes: 0 additions & 50 deletions
50
plugins/deviceEventsRealTime/controllers/deviceEventsRealTimeCtrl.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<div> | ||
<div class="alert alert-warning" ng-show="events.length === 0"> | ||
No incoming events at the moment... | ||
</div> | ||
<table class="table table-hover"> | ||
<tr ng-repeat="e in events|orderBy:'id':true" > | ||
<td style="width:30px" class="text-center"> | ||
<span class="badge">{{e.type}}</span> | ||
</td> | ||
<td> | ||
{{e.text || '-- no text message --'}} | ||
<small class="text-muted" style="margin-right:10px;"><strong>Created:</strong> {{e.creationTime|date:'medium'}}</small> | ||
<small class="text-muted"><strong>Data:</strong> {{e | json}}</small> | ||
</td> | ||
</tr> | ||
</table> | ||
</div> |
44 changes: 44 additions & 0 deletions
44
plugins/deviceEventsRealTime/deviceEventsRealtime.controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
(function() { | ||
'use strict'; | ||
|
||
angular.module('myapp.deviceEventsRealTime') | ||
.controller('deviceEventsRealTimeCtrl', DeviceEventsRealTimeController); | ||
|
||
function DeviceEventsRealTimeController($scope, $routeParams, c8yRealtime, c8yAlert) { | ||
var deviceId = $routeParams.deviceId; | ||
var eventsChannel = '/events/' + deviceId; | ||
var SCOPE_ID = $scope.$id; | ||
|
||
function startRealtime() { | ||
c8yRealtime.start(SCOPE_ID, eventsChannel); | ||
} | ||
|
||
function setUpListeners() { | ||
c8yRealtime.addListener(SCOPE_ID, eventsChannel, 'CREATE', onCreateEvent); | ||
c8yRealtime.addListener(SCOPE_ID, eventsChannel, 'DELETE', onDeleteEvent); | ||
} | ||
|
||
function stopRealtime() { | ||
c8yRealtime.stop(SCOPE_ID, eventsChannel); | ||
} | ||
|
||
function onCreateEvent(action, eventObject) { | ||
$scope.events.push(eventObject); | ||
} | ||
|
||
function onDeleteEvent(action, eventObjectId) { | ||
_.remove($scope.events, function (evt) { | ||
return evt.id === eventObjectId; | ||
}); | ||
|
||
c8yAlert.info('Event with id ' + eventObjectId + ' has been deleted.' ); | ||
} | ||
|
||
$scope.events = []; | ||
$scope.$on('$destroy', stopRealtime); | ||
|
||
setUpListeners(); | ||
startRealtime(); | ||
} | ||
|
||
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,18 @@ | ||
angular.module('myapp.deviceEventsRealTime', []) | ||
.config(['c8yViewsProvider', | ||
function (c8yViewsProvider) { | ||
c8yViewsProvider.when('/device/:deviceId', { | ||
name: 'Real-Time Events', | ||
icon: 'rss', | ||
templateUrl: ':::PLUGIN_PATH:::/views/deviceEventsRealTime.html', | ||
controller: 'deviceEventsRealTimeCtrl' | ||
}); | ||
}]); | ||
(function() { | ||
'use strict'; | ||
|
||
angular.module('myapp.deviceEventsRealTime', []) | ||
.config(config); | ||
|
||
function config(c8yViewsProvider) { | ||
|
||
c8yViewsProvider.when('/device/:deviceId', { | ||
name: 'Real-Time Events', | ||
icon: 'rss', | ||
templateUrl: ':::PLUGIN_PATH:::/deviceEventsRealTime.html', | ||
controller: 'deviceEventsRealTimeCtrl' | ||
}); | ||
|
||
} | ||
|
||
}()); |
17 changes: 0 additions & 17 deletions
17
plugins/deviceEventsRealTime/views/deviceEventsRealTime.html
This file was deleted.
Oops, something went wrong.
Binary file not shown.
File renamed without changes.
Oops, something went wrong.