@c8y/ng1-modules 1018.0.101 → 1018.0.103

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";!function(){function e(i,n,o,e,s,t,a,l,r,c,u,d,f,g){var m=this,p="YYYY-MM-DDTHH:mm:ssZZ",y={EVENT:"logsViewer",LOGS:{ACTIONS:{REQUEST:"request",DELETE:"delete",CANCEL:"cancel",DOWNLOAD:"download"}}};function h(){i.filters={dateFrom:moment().subtract(1,"day"),dateTo:moment(),logFile:i.logTypes[0]&&i.logTypes[0].name||null,maximumLines:1e3},m.filters=i.filters}function L(e){var t=_.assign({deviceId:n.deviceId,fragmentType:"c8y_LogfileRequest",dateFrom:new Date(0).toISOString(),revert:!0,withTotalPages:!0},e);return a.list(t).then(C)}function C(e,t){i.operations&&!t||(i.operations=[]),e.forEach(function(e){i.operations.push(e)}),i.paging=e.paging}function v(){_.get(i.paging,"refresh")&&(i.realtimeAnimation=!1,i.refreshLoading=!0,i.paging.refresh().then(_.partialRight(C,!0)).finally(function(){i.refreshLoading=!1}),i.paging=null)}function E(e){if(e.c8y_LogfileRequest.file){var t=s.getIdFromUrl(e.c8y_LogfileRequest.file);if(t)return s.removeBinary(t)}return!1}function T(e){var t={id:e.id,status:e.status,c8y_LogfileRequest:null};return a.save(t)}function R(e){S(e)?i.selectedLog=e:i.selectedLog=void 0}function S(e){return e.c8y_LogfileRequest&&e.c8y_LogfileRequest.file}function D(e){return e&&"SUCCESSFUL"===e.status}function q(e){return e&&"FAILED"===e.status}function F(e,t){t&&!e?(m.shouldClose="disabled",o(function(){m.shouldClose="outsideClick"})):m.shouldClose="outsideClick"}i.PRODUCT_EXPERIENCE=y,i.requestLogfile=function(e){var t={deviceId:n.deviceId,description:u("Log file request"),c8y_LogfileRequest:{dateFrom:moment(e.dateFrom).format(p),dateTo:moment(e.dateTo).format(p),logFile:e.logFile,searchText:e.searchText||"",maximumLines:e.maximumLines}};a.createWithNotifications(t).then(function(e){e.created.then(v),e.completed.then(function(e){e.status===a.status.SUCCESSFUL?(_.assign(t,e),R(t)):e.status===a.status.FAILED&&"Operation cancelled by user."!==e.failureReason&&(e.failureReason?c.danger(d('Could not load file: "{{failureReason | translate}}".',e)):c.danger(u("Could not load file.")))},_.noop,function(e){_.assign(t,e),R(t)}).then(v)})},i.hasLogFile=S,i.selectLogfile=R,i.isBinary=function(e){return e&&e.c8y_LogfileRequest&&e.c8y_LogfileRequest.file&&!!s.getIdFromUrl(e.c8y_LogfileRequest.file)},i.download=f.download,i.cancel=function(e){return"PENDING"===e.status&&a.cancel(e).then(function(){return c.success(u("Log file request cancelled."))}).then(v)},i.remove=function(e){return r({title:u("Delete log file"),body:u("You are about to delete this log file. Do you want to proceed?"),status:"danger",labels:{ok:u("Delete")}}).then(_.partial(E,e)).then(_.partial(T,e)).then(function(){g.triggerEvent(y.EVENT,{action:y.LOGS.ACTIONS.DELETE}),c.success(u("Log file deleted."))}).then(v)},i.statusIcon=function(e){return a.getStyle(e).icon},i.statusClass=function(e){return a.getStyle(e).cls},i.isSuccessful=D,i.isPending=function(e){return e&&"PENDING"===e.status},i.isFailed=q,i.isCompleted=function(e){return D(e)||q(e)},i.refresh=v,i.loadNext=function(e){i.paging.loading=!0,(e?L({pageSize:e}):i.paging.next().then(C)).finally(function(){i.paging.loading=!1})},i.getOperationDesc=function(e){return e.description||u("no description available")},i.$watch("vm.datePickerToOpen",F),i.$watch("vm.datePickerFromOpen",F),i.$watch("vm.logtypeSelect.open",function(e){e||(m.shouldClose="disabled",o(function(){m.shouldClose="outsideClick"}))}),m.shouldClose="outsideClick",m.datePickerToOpen=!1,m.datePickerFromOpen=!1,t.detail(n.deviceId).then(e.getResData).then(function(e){i.logTypes=_.map(e.c8y_SupportedLogs,function(e){return{name:e}}),m.logTypes=i.logTypes}).then(h),L();var I=i.$id,O="/operations/".concat(n.deviceId),w=l.realtimeActions();_.forOwn(w,function(e){l.addListener(I,O,e,function(e,t){if(_.has(t,"c8y_LogfileRequest")){v();var n=i.selectedLog;n&&n.id===t.id&&e===w.UPDATE&&(n.c8y_LogfileRequest=t.c8y_LogfileRequest)}})}),l.start(I,O),i.$on("$destroy",function(){l.stop(I,O),l.destroySubscription(I,O)})}e.$inject=["$scope","$routeParams","$timeout","c8yBase","c8yBinary","c8yDevices","c8yDeviceControl","c8yRealtime","c8yModal","c8yAlert","gettext","gettextCatalog","logViewer","c8yGainsightService"],angular.module("c8y.logViewer").controller("logViewerCtrl",e)}();
1
+ "use strict";!function(){function e(i,n,o,e,t,s,a,l,r,c,u,d,f,g,m){var y=this,p="YYYY-MM-DDTHH:mm:ssZZ",h={EVENT:"logsViewer",LOGS:{ACTIONS:{REQUEST:"request",DELETE:"delete",CANCEL:"cancel",DOWNLOAD:"download"}}};function L(){i.filters={dateFrom:moment().subtract(1,"day"),dateTo:moment(),logFile:i.logTypes[0]&&i.logTypes[0].name||null,maximumLines:1e3},y.filters=i.filters}function v(e){var t=_.assign({deviceId:n.deviceId,fragmentType:"c8y_LogfileRequest",dateFrom:new Date(0).toISOString(),revert:!0,withTotalPages:!0},e);return l.list(t).then(E)}function E(e,t){i.operations&&!t||(i.operations=[]),e.forEach(function(e){i.operations.push(e)}),i.paging=e.paging}function C(){_.get(i.paging,"refresh")&&(i.realtimeAnimation=!1,i.refreshLoading=!0,i.paging.refresh().then(_.partialRight(E,!0)).finally(function(){i.refreshLoading=!1}),i.paging=null)}function T(e){if(e.c8y_LogfileRequest.file){var t=s.getIdFromUrl(e.c8y_LogfileRequest.file);if(t)return s.removeBinary(t)}return!1}function R(e){var t={id:e.id,status:e.status,c8y_LogfileRequest:null};return l.save(t)}function S(e){D(e)?i.selectedLog=e:i.selectedLog=void 0}function D(e){return e.c8y_LogfileRequest&&e.c8y_LogfileRequest.file}function q(e){return e&&"SUCCESSFUL"===e.status}function F(e){return e&&"FAILED"===e.status}function I(e,t){t&&!e?(y.shouldClose="disabled",o(function(){y.shouldClose="outsideClick"})):y.shouldClose="outsideClick"}i.PRODUCT_EXPERIENCE=h,i.requestLogfile=function(e){var t={deviceId:n.deviceId,description:d("Log file request"),c8y_LogfileRequest:{dateFrom:moment(e.dateFrom).format(p),dateTo:moment(e.dateTo).format(p),logFile:e.logFile,searchText:e.searchText||"",maximumLines:e.maximumLines}};l.createWithNotifications(t).then(function(e){e.created.then(C),e.completed.then(function(e){e.status===l.status.SUCCESSFUL?(_.assign(t,e),S(t)):e.status===l.status.FAILED&&"Operation cancelled by user."!==e.failureReason&&(e.failureReason?u.danger(f('Could not load file: "{{failureReason | translate}}".',e)):u.danger(d("Could not load file.")))},_.noop,function(e){_.assign(t,e),S(t)}).then(C)})},i.hasLogFile=D,i.selectLogfile=S,i.isBinary=function(e){return e&&e.c8y_LogfileRequest&&e.c8y_LogfileRequest.file&&(!!s.getIdFromUrl(e.c8y_LogfileRequest.file)||t.isEventBinary(e.c8y_LogfileRequest.file))},i.download=g.download,i.cancel=function(e){return"PENDING"===e.status&&l.cancel(e).then(function(){return u.success(d("Log file request cancelled."))}).then(C)},i.remove=function(e){return c({title:d("Delete log file"),body:d("You are about to delete this log file. Do you want to proceed?"),status:"danger",labels:{ok:d("Delete")}}).then(_.partial(T,e)).then(_.partial(R,e)).then(function(){m.triggerEvent(h.EVENT,{action:h.LOGS.ACTIONS.DELETE}),u.success(d("Log file deleted."))}).then(C)},i.statusIcon=function(e){return l.getStyle(e).icon},i.statusClass=function(e){return l.getStyle(e).cls},i.isSuccessful=q,i.isPending=function(e){return e&&"PENDING"===e.status},i.isFailed=F,i.isCompleted=function(e){return q(e)||F(e)},i.refresh=C,i.loadNext=function(e){i.paging.loading=!0,(e?v({pageSize:e}):i.paging.next().then(E)).finally(function(){i.paging.loading=!1})},i.getOperationDesc=function(e){return e.description||d("no description available")},i.$watch("vm.datePickerToOpen",I),i.$watch("vm.datePickerFromOpen",I),i.$watch("vm.logtypeSelect.open",function(e){e||(y.shouldClose="disabled",o(function(){y.shouldClose="outsideClick"}))}),y.shouldClose="outsideClick",y.datePickerToOpen=!1,y.datePickerFromOpen=!1,a.detail(n.deviceId).then(e.getResData).then(function(e){i.logTypes=_.map(e.c8y_SupportedLogs,function(e){return{name:e}}),y.logTypes=i.logTypes}).then(L),v();var O=i.$id,w="/operations/".concat(n.deviceId),N=r.realtimeActions();_.forOwn(N,function(e){r.addListener(O,w,e,function(e,t){if(_.has(t,"c8y_LogfileRequest")){C();var n=i.selectedLog;n&&n.id===t.id&&e===N.UPDATE&&(n.c8y_LogfileRequest=t.c8y_LogfileRequest)}})}),r.start(O,w),i.$on("$destroy",function(){r.stop(O,w),r.destroySubscription(O,w)})}e.$inject=["$scope","$routeParams","$timeout","c8yBase","c8yEvents","c8yBinary","c8yDevices","c8yDeviceControl","c8yRealtime","c8yModal","c8yAlert","gettext","gettextCatalog","logViewer","c8yGainsightService"],angular.module("c8y.logViewer").controller("logViewerCtrl",e)}();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c8y/ng1-modules",
3
- "version": "1018.0.101",
3
+ "version": "1018.0.103",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Cumulocity",
6
6
  "description": "AngularJS modules for Cumulocity IoT applications.",