@c8y/ng1-modules 1017.155.0 → 1017.156.0

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(o,n,i,e,s,t,a,l,r,u,c,f,d){var g=this,m="YYYY-MM-DDTHH:mm:ssZZ";function p(){o.filters={dateFrom:moment().subtract(1,"day"),dateTo:moment(),logFile:o.logTypes[0]&&o.logTypes[0].name||null,maximumLines:1e3},g.filters=o.filters}function y(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(h)}function h(e,t){o.operations&&!t||(o.operations=[]),e.forEach(function(e){o.operations.push(e)}),o.paging=e.paging}function L(){_.get(o.paging,"refresh")&&(o.realtimeAnimation=!1,o.refreshLoading=!0,o.paging.refresh().then(_.partialRight(h,!0)).finally(function(){o.refreshLoading=!1}),o.paging=null)}function v(e){if(e.c8y_LogfileRequest.file){var t=s.getIdFromUrl(e.c8y_LogfileRequest.file);if(t)return s.removeBinary(t)}return!1}function C(e){var t={id:e.id,status:e.status,c8y_LogfileRequest:null};return a.save(t)}function R(e){F(e)?o.selectedLog=e:o.selectedLog=void 0}function F(e){return e.c8y_LogfileRequest&&e.c8y_LogfileRequest.file}function q(e){return e&&"SUCCESSFUL"===e.status}function T(e){return e&&"FAILED"===e.status}function D(e,t){t&&!e?(g.shouldClose="disabled",i(function(){g.shouldClose="outsideClick"})):g.shouldClose="outsideClick"}o.requestLogfile=function(e){var t={deviceId:n.deviceId,description:c("Log file request"),c8y_LogfileRequest:{dateFrom:moment(e.dateFrom).format(m),dateTo:moment(e.dateTo).format(m),logFile:e.logFile,searchText:e.searchText||"",maximumLines:e.maximumLines}};a.createWithNotifications(t).then(function(e){e.created.then(L),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?u.danger(f('Could not load file: "{{failureReason | translate}}".',e)):u.danger(c("Could not load file.")))},_.noop,function(e){_.assign(t,e),R(t)}).then(L)})},o.hasLogFile=F,o.selectLogfile=R,o.isBinary=function(e){return e&&e.c8y_LogfileRequest&&e.c8y_LogfileRequest.file&&!!s.getIdFromUrl(e.c8y_LogfileRequest.file)},o.download=d.download,o.cancel=function(e){return"PENDING"===e.status&&a.cancel(e).then(function(){return u.success(c("Log file request cancelled."))}).then(L)},o.remove=function(e){return r({title:c("Delete log file"),body:c("You are about to delete this log file. Do you want to proceed?"),status:"danger",labels:{ok:c("Delete")}}).then(_.partial(v,e)).then(_.partial(C,e)).then(function(){return u.success(c("Log file deleted."))}).then(L)},o.statusIcon=function(e){return a.getStyle(e).icon},o.statusClass=function(e){return a.getStyle(e).cls},o.isSuccessful=q,o.isPending=function(e){return e&&"PENDING"===e.status},o.isFailed=T,o.isCompleted=function(e){return q(e)||T(e)},o.refresh=L,o.loadNext=function(e){o.paging.loading=!0,(e?y({pageSize:e}):o.paging.next().then(h)).finally(function(){o.paging.loading=!1})},o.getOperationDesc=function(e){return e.description||c("no description available")},o.$watch("vm.datePickerToOpen",D),o.$watch("vm.datePickerFromOpen",D),o.$watch("vm.logtypeSelect.open",function(e){e||(g.shouldClose="disabled",i(function(){g.shouldClose="outsideClick"}))}),g.shouldClose="outsideClick",g.datePickerToOpen=!1,g.datePickerFromOpen=!1,t.detail(n.deviceId).then(e.getResData).then(function(e){o.logTypes=_.map(e.c8y_SupportedLogs,function(e){return{name:e}}),g.logTypes=o.logTypes}).then(p),y();var S=o.$id,I="/operations/".concat(n.deviceId),w=l.realtimeActions();_.forOwn(w,function(e){l.addListener(S,I,e,function(e,t){if(_.has(t,"c8y_LogfileRequest")){L();var n=o.selectedLog;n&&n.id===t.id&&e===w.UPDATE&&(n.c8y_LogfileRequest=t.c8y_LogfileRequest)}})}),l.start(S,I),o.$on("$destroy",function(){l.stop(S,I),l.destroySubscription(S,I)})}e.$inject=["$scope","$routeParams","$timeout","c8yBase","c8yBinary","c8yDevices","c8yDeviceControl","c8yRealtime","c8yModal","c8yAlert","gettext","gettextCatalog","logViewer"],angular.module("c8y.logViewer").controller("logViewerCtrl",e)}();
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)}();
@@ -90,6 +90,11 @@
90
90
  title="{{ 'Request log file' | translate }}"
91
91
  ng-disabled="logRequestForm.$invalid"
92
92
  ng-click="requestLogfile(vm.filters); isOpen = !isOpen"
93
+ c8yProductExperience
94
+ [actionName]="PRODUCT_EXPERIENCE.EVENT"
95
+ [actionData]="{
96
+ action: PRODUCT_EXPERIENCE.LOGS.ACTIONS.REQUEST
97
+ }"
93
98
  >
94
99
  {{ 'Request log file' | translate }}
95
100
  </button>
@@ -174,14 +179,20 @@
174
179
  </div>
175
180
  <div class="c8y-list__item__actions showOnHover">
176
181
  <button
182
+ ng-if="!hasLogFile(op) && isPending(op)"
177
183
  class="btn btn-dot a-s-center"
178
184
  type="button"
179
- aria-label="{{ 'Cancel operation' | translate }}"
180
185
  uib-tooltip="{{ 'Cancel operation' | translate }}"
186
+ aria-label="{{ 'Cancel operation' | translate }}"
181
187
  tooltip-popup-delay="500"
188
+ popover-trigger="'mouseenter focus'"
182
189
  tooltip-placement="left"
183
190
  ng-click="cancel(op)"
184
- ng-if="!hasLogFile(op) && isPending(op)"
191
+ c8yProductExperience
192
+ [actionName]="PRODUCT_EXPERIENCE.EVENT"
193
+ [actionData]="{
194
+ action: PRODUCT_EXPERIENCE.LOGS.ACTIONS.CANCEL
195
+ }"
185
196
  >
186
197
  <i c8y-icon="times-circle"></i>
187
198
  </button>
@@ -229,14 +240,19 @@
229
240
  </button>
230
241
  </li>
231
242
  <li ng-show="isBinary(op)">
232
- <button
243
+ <a
233
244
  title="{{ 'Download log' | translate }}"
234
- type="button"
245
+ href
235
246
  ng-click="download(op)"
247
+ c8yProductExperience
248
+ [actionName]="PRODUCT_EXPERIENCE.EVENT"
249
+ [actionData]="{
250
+ action: PRODUCT_EXPERIENCE.LOGS.ACTIONS.DOWNLOAD
251
+ }"
236
252
  >
237
253
  <i c8y-icon="download"></i>
238
254
  {{ 'Download' | translate }}
239
- </button>
255
+ </a>
240
256
  </li>
241
257
  <li ng-hide="isBinary(op) || !op.c8y_LogfileRequest.file">
242
258
  <a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c8y/ng1-modules",
3
- "version": "1017.155.0",
3
+ "version": "1017.156.0",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Cumulocity",
6
6
  "description": "AngularJS modules for Cumulocity IoT applications.",