@c8y/ng1-modules 1022.8.0 → 1022.9.6
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.
- package/core/core/services/deviceShell.js +1 -1
- package/core/locales/de.po +29 -3
- package/core/locales/es.po +29 -3
- package/core/locales/fr.po +29 -3
- package/core/locales/ja_JP.po +28 -3
- package/core/locales/ko.po +29 -3
- package/core/locales/nl.po +29 -3
- package/core/locales/pl.po +29 -3
- package/core/locales/pt_BR.po +29 -3
- package/core/locales/zh_CN.po +29 -3
- package/core/locales/zh_TW.po +29 -3
- package/core/ui/services/measurementsReport.js +1 -1
- package/dashboard2/dashboard.service.js +1 -1
- package/device-protocol-canbus/canbus-device.provider.js +1 -1
- package/device-protocol-canopen/canopen-device.provider.js +1 -1
- package/device-protocol-modbus/modbus-device.provider.js +1 -1
- package/device-protocol-opcua/opcua-device.provider.js +1 -1
- package/device-protocol-profibus/profibus-device.provider.js +1 -1
- package/device-protocols/device-protocol-import-button.component.js +1 -1
- package/deviceDatabase4/detail/device-type-detail.component.js +1 -1
- package/deviceDatabase4/device-database.service.js +1 -1
- package/deviceDatabase4/device-type-list.component.js +1 -1
- package/deviceDatabase4/modals/import-device-type.component.js +1 -1
- package/deviceStatusWidget/deviceStatus.component.js +1 -1
- package/modbusConfiguration4/fieldbus-device-list.component.js +1 -1
- package/modbusWidget4/modbus-widget.service.js +1 -1
- package/modbusWidget4/widget-config.component.js +1 -1
- package/package.json +4 -4
package/core/locales/pt_BR.po
CHANGED
|
@@ -883,6 +883,9 @@ msgstr "Adicione um snapshot de configuração primeiro."
|
|
|
883
883
|
msgid "Add a connection."
|
|
884
884
|
msgstr "Adicionar uma conexão."
|
|
885
885
|
|
|
886
|
+
msgid "Add a dashboard first."
|
|
887
|
+
msgstr "Adicione primeiro um painel."
|
|
888
|
+
|
|
886
889
|
msgid "Add a data point using the button below."
|
|
887
890
|
msgstr "Adicione um ponto de dados usando o botão abaixo."
|
|
888
891
|
|
|
@@ -4777,9 +4780,6 @@ msgstr "Pontos de dados"
|
|
|
4777
4780
|
msgid "Data points graph"
|
|
4778
4781
|
msgstr "Gráfico de pontos de dados"
|
|
4779
4782
|
|
|
4780
|
-
msgid "Data points graph 2"
|
|
4781
|
-
msgstr "Pontos de dados gráfico 2"
|
|
4782
|
-
|
|
4783
4783
|
msgid "Data points list"
|
|
4784
4784
|
msgstr "Lista de pontos de dados"
|
|
4785
4785
|
|
|
@@ -9550,6 +9550,9 @@ msgstr "Mapeado para"
|
|
|
9550
9550
|
msgid "Mappings"
|
|
9551
9551
|
msgstr "Mapeamentos"
|
|
9552
9552
|
|
|
9553
|
+
msgid "Mark as provided"
|
|
9554
|
+
msgstr "Marcar como fornecido"
|
|
9555
|
+
|
|
9553
9556
|
msgid "Markdown widget"
|
|
9554
9557
|
msgstr "Widget Markdown"
|
|
9555
9558
|
|
|
@@ -12268,6 +12271,12 @@ msgstr "Fornecer papéis de inventário"
|
|
|
12268
12271
|
msgid "Provide your phone number"
|
|
12269
12272
|
msgstr "Fornecer o seu número de telefone"
|
|
12270
12273
|
|
|
12274
|
+
msgid "Provided"
|
|
12275
|
+
msgstr "Fornecido"
|
|
12276
|
+
|
|
12277
|
+
msgid "Provided by device"
|
|
12278
|
+
msgstr "Fornecido pelo dispositivo"
|
|
12279
|
+
|
|
12271
12280
|
msgid "Provided by parent tenant."
|
|
12272
12281
|
msgstr "Disponibilizado pelo tenant pai."
|
|
12273
12282
|
|
|
@@ -13807,6 +13816,11 @@ msgstr "Selecione uma das versões existentes."
|
|
|
13807
13816
|
msgid "Select one of the protocols."
|
|
13808
13817
|
msgstr "Selecione um dos protocolos."
|
|
13809
13818
|
|
|
13819
|
+
msgid "Select one or more dashboards to send the Data points graph widget with the current\n"
|
|
13820
|
+
" configuration"
|
|
13821
|
+
msgstr "Selecione um ou mais painéis para enviar o widget Gráfico de pontos de dados com a configuração atual\n"
|
|
13822
|
+
" ."
|
|
13823
|
+
|
|
13810
13824
|
msgid "Select one or more reports to send the Data points graph widget with the current configuration"
|
|
13811
13825
|
msgstr "Selecione um ou mais relatórios para enviar o widget do gráfico de pontos de dados com a configuração atual"
|
|
13812
13826
|
|
|
@@ -14020,6 +14034,9 @@ msgstr "Envie um e-mail de aviso para um papel global quando a cota de armazenam
|
|
|
14020
14034
|
msgid "Send as widget to dashboard"
|
|
14021
14035
|
msgstr "Enviar como widget para o painel"
|
|
14022
14036
|
|
|
14037
|
+
msgid "Send as widget to dashboards"
|
|
14038
|
+
msgstr "Enviar como widget para painéis"
|
|
14039
|
+
|
|
14023
14040
|
msgid "Send as widget to report"
|
|
14024
14041
|
msgstr "Enviar como widget para relatório"
|
|
14025
14042
|
|
|
@@ -16223,6 +16240,9 @@ msgstr "Não existem snapshots de configuração definidos."
|
|
|
16223
16240
|
msgid "There are no dashboards available"
|
|
16224
16241
|
msgstr "Não há painéis disponíveis"
|
|
16225
16242
|
|
|
16243
|
+
msgid "There are no dashboards defined."
|
|
16244
|
+
msgstr "Não há painéis definidos."
|
|
16245
|
+
|
|
16226
16246
|
msgid "There are no device credentials"
|
|
16227
16247
|
msgstr "Não existem credenciais do dispositivo"
|
|
16228
16248
|
|
|
@@ -17330,6 +17350,9 @@ msgstr "Use o seletor acima para definir o dispositivo de referência"
|
|
|
17330
17350
|
msgid "Use this operation"
|
|
17331
17351
|
msgstr "Usar esta operação"
|
|
17332
17352
|
|
|
17353
|
+
msgid "Use this option if the device will resolve the binary itself. No file is uploaded."
|
|
17354
|
+
msgstr "Use esta opção se o dispositivo resolver o binário por conta própria. Nenhum arquivo será carregado."
|
|
17355
|
+
|
|
17333
17356
|
msgid "Use this wizard to connect your smartphone to our IoT platform using the Cumulocity\n"
|
|
17334
17357
|
" Sensor App."
|
|
17335
17358
|
msgstr "Use este assistente para conectar seu smartphone à nossa plataforma de IoT usando o aplicativo do sensor Cumulocity\n"
|
|
@@ -19597,6 +19620,9 @@ msgstr "{{ name }} (versão {{ version }})"
|
|
|
19597
19620
|
msgid "{{ numberOfApps }} apps selected for branding"
|
|
19598
19621
|
msgstr "{{ numberOfApps }} aplicativos selecionados para marca"
|
|
19599
19622
|
|
|
19623
|
+
msgid "{{ numberOfDashboards }} dashboards selected for widget"
|
|
19624
|
+
msgstr "{{ numberOfDashboards }} painéis selecionados para widget"
|
|
19625
|
+
|
|
19600
19626
|
msgid "{{ numberOfReports }} reports selected for widget"
|
|
19601
19627
|
msgstr "{{ numberOfReports }} relatórios selecionados para o widget"
|
|
19602
19628
|
|
package/core/locales/zh_CN.po
CHANGED
|
@@ -867,6 +867,9 @@ msgstr "先添加配置快照。"
|
|
|
867
867
|
msgid "Add a connection."
|
|
868
868
|
msgstr "添加连接。"
|
|
869
869
|
|
|
870
|
+
msgid "Add a dashboard first."
|
|
871
|
+
msgstr "首先添加一个仪表板。"
|
|
872
|
+
|
|
870
873
|
msgid "Add a data point using the button below."
|
|
871
874
|
msgstr "使用下面的按钮添加数据点。"
|
|
872
875
|
|
|
@@ -4759,9 +4762,6 @@ msgstr "数据点"
|
|
|
4759
4762
|
msgid "Data points graph"
|
|
4760
4763
|
msgstr "数据点图"
|
|
4761
4764
|
|
|
4762
|
-
msgid "Data points graph 2"
|
|
4763
|
-
msgstr "数据点图表 2"
|
|
4764
|
-
|
|
4765
4765
|
msgid "Data points list"
|
|
4766
4766
|
msgstr "数据点列表"
|
|
4767
4767
|
|
|
@@ -9534,6 +9534,9 @@ msgstr "已映射到"
|
|
|
9534
9534
|
msgid "Mappings"
|
|
9535
9535
|
msgstr "映射"
|
|
9536
9536
|
|
|
9537
|
+
msgid "Mark as provided"
|
|
9538
|
+
msgstr "标记为已提供"
|
|
9539
|
+
|
|
9537
9540
|
msgid "Markdown widget"
|
|
9538
9541
|
msgstr "标记小组件"
|
|
9539
9542
|
|
|
@@ -12250,6 +12253,12 @@ msgstr "提供库存角色"
|
|
|
12250
12253
|
msgid "Provide your phone number"
|
|
12251
12254
|
msgstr "提供您的电话号码"
|
|
12252
12255
|
|
|
12256
|
+
msgid "Provided"
|
|
12257
|
+
msgstr "提供"
|
|
12258
|
+
|
|
12259
|
+
msgid "Provided by device"
|
|
12260
|
+
msgstr "由设备提供"
|
|
12261
|
+
|
|
12253
12262
|
msgid "Provided by parent tenant."
|
|
12254
12263
|
msgstr "由父租户提供。"
|
|
12255
12264
|
|
|
@@ -13789,6 +13798,11 @@ msgstr "选择一个现有版本。"
|
|
|
13789
13798
|
msgid "Select one of the protocols."
|
|
13790
13799
|
msgstr "选择其中一个协议。"
|
|
13791
13800
|
|
|
13801
|
+
msgid "Select one or more dashboards to send the Data points graph widget with the current\n"
|
|
13802
|
+
" configuration"
|
|
13803
|
+
msgstr "选择一个或多个仪表板,以当前\n"
|
|
13804
|
+
" 配置发送数据点图表小组件。"
|
|
13805
|
+
|
|
13792
13806
|
msgid "Select one or more reports to send the Data points graph widget with the current configuration"
|
|
13793
13807
|
msgstr "选择一个或多个报告,以发送当前配置的数据点图表 widget"
|
|
13794
13808
|
|
|
@@ -14002,6 +14016,9 @@ msgstr "在快要达到存储配额时,向全局角色发送警告电子邮件
|
|
|
14002
14016
|
msgid "Send as widget to dashboard"
|
|
14003
14017
|
msgstr "作为小组件发送到面板"
|
|
14004
14018
|
|
|
14019
|
+
msgid "Send as widget to dashboards"
|
|
14020
|
+
msgstr "作为小组件发送至仪表板"
|
|
14021
|
+
|
|
14005
14022
|
msgid "Send as widget to report"
|
|
14006
14023
|
msgstr "以小组件形式发送到报告"
|
|
14007
14024
|
|
|
@@ -16203,6 +16220,9 @@ msgstr "未定义配置快照。"
|
|
|
16203
16220
|
msgid "There are no dashboards available"
|
|
16204
16221
|
msgstr "无可用面板"
|
|
16205
16222
|
|
|
16223
|
+
msgid "There are no dashboards defined."
|
|
16224
|
+
msgstr "未定义仪表板。"
|
|
16225
|
+
|
|
16206
16226
|
msgid "There are no device credentials"
|
|
16207
16227
|
msgstr "没有设备凭据"
|
|
16208
16228
|
|
|
@@ -17310,6 +17330,9 @@ msgstr "使用上述选择器设置引用设备"
|
|
|
17310
17330
|
msgid "Use this operation"
|
|
17311
17331
|
msgstr "使用此操作"
|
|
17312
17332
|
|
|
17333
|
+
msgid "Use this option if the device will resolve the binary itself. No file is uploaded."
|
|
17334
|
+
msgstr "如果设备将自行解析二进制文件,请使用此选项。不会上传任何文件。"
|
|
17335
|
+
|
|
17313
17336
|
msgid "Use this wizard to connect your smartphone to our IoT platform using the Cumulocity\n"
|
|
17314
17337
|
" Sensor App."
|
|
17315
17338
|
msgstr "使用此向导,通过Cumulocity\n"
|
|
@@ -19573,6 +19596,9 @@ msgstr "{{ name }}(版本 {{ version }})"
|
|
|
19573
19596
|
msgid "{{ numberOfApps }} apps selected for branding"
|
|
19574
19597
|
msgstr "已为品牌选择 {{ numberOfApps }} 个应用程序"
|
|
19575
19598
|
|
|
19599
|
+
msgid "{{ numberOfDashboards }} dashboards selected for widget"
|
|
19600
|
+
msgstr "{{ numberOfDashboards }} 为小组件选择的仪表板"
|
|
19601
|
+
|
|
19576
19602
|
msgid "{{ numberOfReports }} reports selected for widget"
|
|
19577
19603
|
msgstr "{{ numberOfReports }} 为小部件选择的报告"
|
|
19578
19604
|
|
package/core/locales/zh_TW.po
CHANGED
|
@@ -867,6 +867,9 @@ msgstr "先添加配置快照。"
|
|
|
867
867
|
msgid "Add a connection."
|
|
868
868
|
msgstr "添加连接。"
|
|
869
869
|
|
|
870
|
+
msgid "Add a dashboard first."
|
|
871
|
+
msgstr "先添加儀表板。"
|
|
872
|
+
|
|
870
873
|
msgid "Add a data point using the button below."
|
|
871
874
|
msgstr "使用下面的按钮添加数据点。"
|
|
872
875
|
|
|
@@ -4759,9 +4762,6 @@ msgstr "数据点"
|
|
|
4759
4762
|
msgid "Data points graph"
|
|
4760
4763
|
msgstr "数据点图"
|
|
4761
4764
|
|
|
4762
|
-
msgid "Data points graph 2"
|
|
4763
|
-
msgstr "資料點圖表 2"
|
|
4764
|
-
|
|
4765
4765
|
msgid "Data points list"
|
|
4766
4766
|
msgstr "数据点列表"
|
|
4767
4767
|
|
|
@@ -9534,6 +9534,9 @@ msgstr "已映射到"
|
|
|
9534
9534
|
msgid "Mappings"
|
|
9535
9535
|
msgstr "映射"
|
|
9536
9536
|
|
|
9537
|
+
msgid "Mark as provided"
|
|
9538
|
+
msgstr "標示為提供商"
|
|
9539
|
+
|
|
9537
9540
|
msgid "Markdown widget"
|
|
9538
9541
|
msgstr "標記小組件"
|
|
9539
9542
|
|
|
@@ -12250,6 +12253,12 @@ msgstr "提供庫存角色"
|
|
|
12250
12253
|
msgid "Provide your phone number"
|
|
12251
12254
|
msgstr "提供您的电话号码"
|
|
12252
12255
|
|
|
12256
|
+
msgid "Provided"
|
|
12257
|
+
msgstr "提供商"
|
|
12258
|
+
|
|
12259
|
+
msgid "Provided by device"
|
|
12260
|
+
msgstr "由設備提供商"
|
|
12261
|
+
|
|
12253
12262
|
msgid "Provided by parent tenant."
|
|
12254
12263
|
msgstr "由父租戶提供。"
|
|
12255
12264
|
|
|
@@ -13789,6 +13798,11 @@ msgstr "选择一个现有版本。"
|
|
|
13789
13798
|
msgid "Select one of the protocols."
|
|
13790
13799
|
msgstr "选择其中一个协议。"
|
|
13791
13800
|
|
|
13801
|
+
msgid "Select one or more dashboards to send the Data points graph widget with the current\n"
|
|
13802
|
+
" configuration"
|
|
13803
|
+
msgstr "選擇一個或多個儀表板,以當前\n"
|
|
13804
|
+
" 設定來發送數據點圖形小部件"
|
|
13805
|
+
|
|
13792
13806
|
msgid "Select one or more reports to send the Data points graph widget with the current configuration"
|
|
13793
13807
|
msgstr "選擇一個或多個報告,以目前的組態傳送資料點圖形 Widget"
|
|
13794
13808
|
|
|
@@ -14002,6 +14016,9 @@ msgstr "在快要达到存储配额时,向全局角色发送警告电子邮件
|
|
|
14002
14016
|
msgid "Send as widget to dashboard"
|
|
14003
14017
|
msgstr "作为小组件发送到面板"
|
|
14004
14018
|
|
|
14019
|
+
msgid "Send as widget to dashboards"
|
|
14020
|
+
msgstr "以小組件形式發送至儀表板"
|
|
14021
|
+
|
|
14005
14022
|
msgid "Send as widget to report"
|
|
14006
14023
|
msgstr "以小组件形式发送到报告"
|
|
14007
14024
|
|
|
@@ -16204,6 +16221,9 @@ msgstr "未定義配置快照。"
|
|
|
16204
16221
|
msgid "There are no dashboards available"
|
|
16205
16222
|
msgstr "无可用面板"
|
|
16206
16223
|
|
|
16224
|
+
msgid "There are no dashboards defined."
|
|
16225
|
+
msgstr "沒有定義任何儀表板。"
|
|
16226
|
+
|
|
16207
16227
|
msgid "There are no device credentials"
|
|
16208
16228
|
msgstr "没有设备凭据"
|
|
16209
16229
|
|
|
@@ -17310,6 +17330,9 @@ msgstr "使用上述选择器设置引用设备"
|
|
|
17310
17330
|
msgid "Use this operation"
|
|
17311
17331
|
msgstr "使用此操作"
|
|
17312
17332
|
|
|
17333
|
+
msgid "Use this option if the device will resolve the binary itself. No file is uploaded."
|
|
17334
|
+
msgstr "如果設備會自行解析二進位檔,請使用此選項。不上傳任何文件。"
|
|
17335
|
+
|
|
17313
17336
|
msgid "Use this wizard to connect your smartphone to our IoT platform using the Cumulocity\n"
|
|
17314
17337
|
" Sensor App."
|
|
17315
17338
|
msgstr "使用此精靈,使用 Cumulocity\n"
|
|
@@ -19573,6 +19596,9 @@ msgstr "{{ name }}(版本 {{ version }})"
|
|
|
19573
19596
|
msgid "{{ numberOfApps }} apps selected for branding"
|
|
19574
19597
|
msgstr "已為品牌選取 {{ numberOfApps }} 個應用程式"
|
|
19575
19598
|
|
|
19599
|
+
msgid "{{ numberOfDashboards }} dashboards selected for widget"
|
|
19600
|
+
msgstr "{{ numberOfDashboards }} 為小組件選擇的儀表板"
|
|
19601
|
+
|
|
19576
19602
|
msgid "{{ numberOfReports }} reports selected for widget"
|
|
19577
19603
|
msgstr "{{ numberOfReports }} 為 widget 選擇的報告"
|
|
19578
19604
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function _regenerator(){var g,e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",t=e.toStringTag||"@@toStringTag";function n(e,r,t,n){var o,a,i,c,u,s,l,f,d,r=r&&r.prototype instanceof m?r:m,r=Object.create(r.prototype);return _regeneratorDefine2(r,"_invoke",(o=e,a=t,l=n||[],f=!1,d={p:s=0,n:0,v:g,a:p,f:p.bind(g,4),d:function(e,r){return i=e,c=0,u=g,d.n=r,v}},function(e,r,t){if(1<s)throw TypeError("Generator is already running");for(f&&1===r&&p(r,t),c=r,u=t;(y=c<2?g:u)||!f;){i||(c?c<3?(1<c&&(d.n=-1),p(c,u)):d.n=u:d.v=u);try{if(s=2,i){if(y=i[e=c?e:"next"]){if(!(y=y.call(i,u)))throw TypeError("iterator result is not an object");if(!y.done)return y;u=y.value,c<2&&(c=0)}else 1===c&&(y=i.return)&&y.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+e+"' method"),c=1);i=g}else if((y=(f=d.n<0)?u:o.call(a,d))!==v)break}catch(e){i=g,c=1,u=e}finally{s=1}}return{value:y,done:f}}),!0),r;function p(e,r){for(c=e,u=r,y=0;!f&&s&&!t&&y<l.length;y++){var t,n=l[y],o=d.p,a=n[2];3<e?(t=a===r)&&(u=n[(c=n[4])?5:c=3],n[4]=n[5]=g):n[0]<=o&&((t=e<2&&o<n[1])?(c=0,d.v=r,d.n=n[1]):o<a&&(t=e<3||n[0]>r||a<r)&&(n[4]=e,n[5]=r,d.n=a,c=0))}if(t||1<e)return v;throw f=!0,r}}var v={};function m(){}function o(){}function a(){}var y=Object.getPrototypeOf,e=[][r]?y(y([][r]())):(_regeneratorDefine2(y={},r,function(){return this}),y),i=a.prototype=m.prototype=Object.create(e);function c(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,a):(e.__proto__=a,_regeneratorDefine2(e,t,"GeneratorFunction")),e.prototype=Object.create(i),e}return _regeneratorDefine2(i,"constructor",o.prototype=a),_regeneratorDefine2(a,"constructor",o),_regeneratorDefine2(a,t,o.displayName="GeneratorFunction"),_regeneratorDefine2(i),_regeneratorDefine2(i,t,"Generator"),_regeneratorDefine2(i,r,function(){return this}),_regeneratorDefine2(i,"toString",function(){return"[object Generator]"}),(_regenerator=function(){return{w:n,m:c}})()}function _regeneratorDefine2(e,r,t,n){var
|
|
1
|
+
function _regenerator(){var g,e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",t=e.toStringTag||"@@toStringTag";function n(e,r,t,n){var o,a,i,c,u,s,l,f,d,r=r&&r.prototype instanceof m?r:m,r=Object.create(r.prototype);return _regeneratorDefine2(r,"_invoke",(o=e,a=t,l=n||[],f=!1,d={p:s=0,n:0,v:g,a:p,f:p.bind(g,4),d:function(e,r){return i=e,c=0,u=g,d.n=r,v}},function(e,r,t){if(1<s)throw TypeError("Generator is already running");for(f&&1===r&&p(r,t),c=r,u=t;(y=c<2?g:u)||!f;){i||(c?c<3?(1<c&&(d.n=-1),p(c,u)):d.n=u:d.v=u);try{if(s=2,i){if(y=i[e=c?e:"next"]){if(!(y=y.call(i,u)))throw TypeError("iterator result is not an object");if(!y.done)return y;u=y.value,c<2&&(c=0)}else 1===c&&(y=i.return)&&y.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+e+"' method"),c=1);i=g}else if((y=(f=d.n<0)?u:o.call(a,d))!==v)break}catch(e){i=g,c=1,u=e}finally{s=1}}return{value:y,done:f}}),!0),r;function p(e,r){for(c=e,u=r,y=0;!f&&s&&!t&&y<l.length;y++){var t,n=l[y],o=d.p,a=n[2];3<e?(t=a===r)&&(u=n[(c=n[4])?5:c=3],n[4]=n[5]=g):n[0]<=o&&((t=e<2&&o<n[1])?(c=0,d.v=r,d.n=n[1]):o<a&&(t=e<3||n[0]>r||a<r)&&(n[4]=e,n[5]=r,d.n=a,c=0))}if(t||1<e)return v;throw f=!0,r}}var v={};function m(){}function o(){}function a(){}var y=Object.getPrototypeOf,e=[][r]?y(y([][r]())):(_regeneratorDefine2(y={},r,function(){return this}),y),i=a.prototype=m.prototype=Object.create(e);function c(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,a):(e.__proto__=a,_regeneratorDefine2(e,t,"GeneratorFunction")),e.prototype=Object.create(i),e}return _regeneratorDefine2(i,"constructor",o.prototype=a),_regeneratorDefine2(a,"constructor",o),_regeneratorDefine2(a,t,o.displayName="GeneratorFunction"),_regeneratorDefine2(i),_regeneratorDefine2(i,t,"Generator"),_regeneratorDefine2(i,r,function(){return this}),_regeneratorDefine2(i,"toString",function(){return"[object Generator]"}),(_regenerator=function(){return{w:n,m:c}})()}function _regeneratorDefine2(e,r,t,n){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}(_regeneratorDefine2=function(e,r,t,n){function o(r,t){_regeneratorDefine2(e,r,function(e){return this._invoke(r,t,e)})}r?a?a(e,r,{value:t,enumerable:!n,configurable:!n,writable:!n}):e[r]=t:(o("next",0),o("throw",1),o("return",2))})(e,r,t,n)}function asyncGeneratorStep(e,r,t,n,o,a,i){try{var c=e[a](i),u=c.value}catch(e){return void t(e)}c.done?r(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(c){return function(){var e=this,i=arguments;return new Promise(function(r,t){var n=c.apply(e,i);function o(e){asyncGeneratorStep(n,r,t,o,a,"next",e)}function a(e){asyncGeneratorStep(n,r,t,o,a,"throw",e)}o(void 0)})}}(()=>{function e(c,u,s,l,f,d,p,g,o){var v=this;this.downloadReportForDevice=function(e,r,t,n){r=_.get(r,"id",r),t=_(t).map(_.partial(v.createPairFromSeries,r)).value();return new v.Downloader(e,n,t).start()},this.downloadReportForDatapoints=function(r,e,t){var n=_(e).filter(function(e){return!0===e.__active}).map(v.getDpRequestParams).value();return n.length?o.current().then(function(e){return o.hasRole(e,"ROLE_MEASUREMENT_READ")?new v.Downloader(r,t,n).start():c.reject(new Error(d("Could not download the report. You need this global permission to download reports: Measurements Read.")))}):c.reject(new Error(d("At least 1 data point must be selected")))},this.createPairFromSeries=function(e,r){return{source:e,fragmentType:r}},this.getDpRequestParams=function(e){return{source:e.__target.id,valueFragmentType:e.fragment,valueFragmentSeries:e.series}},this.generateFileName=function(e,r){if(_.isEmpty(e.source&&r)||_.isEmpty(e.valueFragmentType||e.fragmentType))throw new Error("Unable to generate a file name for given data");var t=e.valueFragmentType?[e.valueFragmentType,e.valueFragmentSeries].join("."):e.fragmentType;return[e.source,t,r].join(".")},this.Downloader=function(t,n,e){var o=this,r=_.uniqBy(e,function(e){return JSON.stringify(e)});function a(){return(a=_asyncToGenerator(_regenerator().m(function e(t){var n,o,r;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(n=c.defer(),403!==t.status)e.n=4;else{if(t.data instanceof Blob)return e.n=1,g.detail(t.config.params.source);e.n=2}break;case 1:o=e.v,(r=new FileReader).addEventListener("loadend",function(e){try{var r=JSON.parse(_.get(e,"srcElement.result"));n.resolve({type:"danger",text:p.getString('Could not download data for "{{name}}": access denied.',o.data),detailedData:r})}catch(e){n.resolve(i(t))}}),r.readAsText(t.data),e.n=3;break;case 2:n.resolve(i(t));case 3:e.n=5;break;case 4:n.resolve({type:"danger",text:d("An error occurred. Please try again later."),detailedData:t});case 5:return e.a(2,n.promise)}},e)}))).apply(this,arguments)}function i(e){return{text:d("Access denied."),type:"danger",detailedData:e}}this.downloadReports=function(){var e=_(r).map(o.downloadReportForDpRequestParams).value();return c.all(e).then(o.onDownloads)},this.start=function(){return l({templateUrl:":::PLUGIN_PATH:::/ui/views/measurementsReport.html",title:d("Generating report"),controller:["$scope","$timeout",function(t,n){t.completed=0,t.total=r.length,t.reportFileName="report.zip",t.close=function(){var e,r;void 0!==window.navigator.msSaveBlob?(e=t.blob,window.navigator.msSaveBlob(e,t.reportFileName)):(r=t.url,n(function(){window.URL.revokeObjectURL(r)},5e3)),t.$close()},o.scope=t,o.downloadReports()}]})},this.downloadReportForDpRequestParams=function(r,e){e=o.getFilter(r,e);return u.list(e,t).then(function(e){return o.onDownload(r,e)}).catch(function(e){return o.onDownloadError(e)})},this.onDownload=function(e,r){return o.scope.completed+=1,r.name=v.generateFileName(e,t.name),r},this.onDownloadError=function(e){return e.async?(o.scope.completed+=1,c.resolve(null)):(o.displayError(e),c.resolve(void 0))},this.displayError=function(e){!function(){return a.apply(this,arguments)}(e).then(f.add)},this.onDownloads=function(e){var e=e.filter(function(e){return void 0!==e}),r=e.filter(_.identity),e=e.length-r.length;return 0<e&&(e=p.getPlural(e,"You will get a CSV/Excel file for 1 series via email.","You will get CSV/Excel files for {{$count}} series via email.",{}),f.success(e)),0===r.length?c.when():s.zipFiles(r).then(function(e){o.scope.blob=e,o.scope.url=window.URL.createObjectURL(e)})},this.getFilter=function(e,r){r=_.isArray(n)?n[r]:n;return _.merge({},r,e)}}}e.$inject=["$q","c8yMeasurements","c8yZip","c8yModal","c8yAlert","gettext","gettextCatalog","c8yInventory","c8yUser"],angular.module("c8y.ui").service("MeasurementsReportSvc",e)})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function _slicedToArray(e,n){return _arrayWithHoles(e)||_iterableToArrayLimit(e,n)||_unsupportedIterableToArray(e,n)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,n){var t;if(e)return"string"==typeof e?_arrayLikeToArray(e,n):"Map"===(t="Object"===(t={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,n):void 0}function _arrayLikeToArray(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=Array(n);t<n;t++)r[t]=e[t];return r}function _iterableToArrayLimit(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i,a,c=[],u=!0,d=!1;try{if(i=(t=t.call(e)).next,0===n){if(Object(t)!==t)return;u=!1}else for(;!(u=(r=i.call(t)).done)&&(c.push(r.value),c.length!==n);u=!0);}catch(e){d=!0,o=e}finally{try{if(!u&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(d)throw o}}return c}}function _arrayWithHoles(e){if(Array.isArray(e))return e}(()=>{function ue(e,n,W,o,$,a,i,c,u,M,t,d,j,l,s,f){var h=e("dashboards"),p=e("dashboardLists"),g="c8y_Dashboard",G={welcome:{icon:"cloud",name:s.getString("Welcome")},home:{icon:"home",name:s.getString("Home")}};function B(e){return _.map(e,function(e){return _.assign(_.get(e,g,{}),{id:e.id})})}function m(e){var t,n,r,e=e||{},o=_.assign(_.get(e,g,{}),{id:e.id},(t=/^c8y_Dashboard!(.+)$/,_.pickBy(e,function(e,n){return t.test(n)})));return _.set(o,"global",!!_.get(e,"c8y_Global")),n=o,r=["templateUrl","configTemplateUrl"],e=_.map(n.children,function(e){return a.all(_.map(r,_.partial(K,e)))}),a.all(e).then(function(){return n}).then(z)}function z(n){return n.children?(e=n.children,t.list().then(function(n){return _(e).mapValues(function(e){return H(e,n,!1)}).value()}).then(function(e){return n.children=e,n})):n;var e}function H(e,n,t){var r,o=_.cloneDeep(e),e=_.find(n,function(e){var n=e.name&&e.name===o.name,e=e.templateUrl&&e.templateUrl===o.templateUrl;return n||e});return e?((r=e.replaceWith)&&(o.config=i.invoke(r.config,void 0,{oldConfig:o.config}),e=_.find(n,{name:r.component})),o.name=e.name,e.transformConfigWithContext&&(o.componentTransformConfigWithContext=e.transformConfigWithContext),e.widgetComponent?(o.widgetComponent=e.widgetComponent,delete o.templateUrl):o.templateUrl=e.templateUrl,e.configComponent?(o.configComponent=e.configComponent,delete o.configTemplateUrl):o.configTemplateUrl=e.configTemplateUrl,o):t?null:o}function V(n){return d.canAdminMOs([n]).then(function(e){return e||(n.isFrozen=!e),n.readOnly=!e,n})}function F(e){return _.get(e,"isFrozen")}function J(e){return q(e,!0)}function Y(e){return q(e,!1)}function q(e,n){return e.isFrozen=n,k.saveAndWait(e).then(ue.clearCacheList)}function K(n,t){var e=n[t];return j.verifyPluginViewPath(e).then(function(e){return n[t]=e,n})}function r(n){return function(e){e=_.isObjectLike(e)?e.id:e;return[g,n,e].join("!")}}var v=r("device"),e=r("group"),Q=r("name"),b=r("type");function X(e){return h.put(y(e),_.cloneDeep(e))}function y(e){return _.isObjectLike(e)?e.id:e}function C(e,n){var t,r=_.assign(e||{},{fragmentType:n||g}),r=u.list(r).then(B);return n&&!e&&(t=p.get(n),r.then(function(e){0<e.length&&p.put(n,e)})),t?a.when(t):r}function Z(){p.removeAll(),n.$emit("dashboard:refresh")}function E(e,n,t){var r=h.get(y(e)),t=!(t&&r)&&u.detail(e).then(c.getResData).then(m).then(V).then(X);return(r?a.when(r):t).then(re).then(ee(n))}function ee(t){return function(e){var n;return(e.deviceType||t)&&(n=_.cloneDeep(e),e=P().then(_.partial(ne,n))),e}}function ne(e,n){return a.all(_.map(e.children,function(e){return te(n,e.config)})).then(_.constant(e))}function te(n,e){function t(e){e.__target={id:n.id,name:n.name}}return e&&(e.device={id:n.id,name:n.name},e.datapoints&&_.forEach(e.datapoints,t),e.alarmsEventsConfigs&&_.forEach(e.alarmsEventsConfigs,t),e.options&&e.options.dataPoints&&_.forEach(e.options.dataPoints,t),e.datapointsGauge&&_.forEach(e.datapointsGauge,t),e.datapointsLabels)&&_.forEach(e.datapointsLabels,t),e}function re(t){return P().then(function(n){return a.all(_.map(t.children,function(e){return A(n,t,e)}))}).then(_.constant(t))}function A(t,r,n){var e=n.config||{},o=_.compact([n.transformConfigWithContext,n.componentTransformConfigWithContext]);return _.reduce(o,function(e,n){return e.then(function(e){return i.invoke(n,null,{config:e,context:t,dashboard:r})})},a.resolve(e)).then(function(e){return _.assign(n,{config:e})})}function T(e){return t.list().then(function(n){return _(e).map(function(e){return H(e,n,!0)}).compact().value()})}function oe(t,e){_.forEach(e,function(e,n){t[n]&&(t[n]=e(t[n]))})}function x(e,n,t){return _.forEach(e,function(e){e.__target=ie(e.__target,n,t)}),e}function ie(e,n,t){return e&&e.id===t.id&&_.assign(e,_.pick(n,["id","name"])),e}function R(e){var t=["id","creationContext","readOnly"],r=/^c8y_Dashboard!/,n=_.cloneDeep(e),o=(n.global=!!n.deviceType||n.global,n.id),i={id:o},o=o?"update":"createConfirm",a=(i[g]=_.pickBy(n,function(e,n){return!r.test(n)&&!_.includes(t,n)}),(a=i)[g].global&&_.assign(a,{c8y_Global:{}}),n.deviceType?{}:n.creationContext),n=u[o](i,a);return"update"==o&&(n=n.then(function(){return e})),(n="createConfirm"==o?n.then(c.getResData).then(m):n).then(X)}function D(e,n,t,r){t={id:t.id},e=e(n);return t[e]=r?null:{},h.get(e)&&h.remove(e),u.save(t)}function I(e,n){return C(null,e(n))}function O(){var t,r;return k.forcedContext||(r=t=null,_.forEach(["report","device","group"],function(e){var n=_.get(W,"".concat(e,"Id"));n&&(t=e,r=n)}),{context:t,id:r})}function ae(e,n){return o.open({templateUrl:":::PLUGIN_PATH:::/dashboardWidget/config.html",controller:"DashboardWidgetConfigController",size:"lg",resolve:{dashboard:function(){return n||{}},component:function(){return e||{}},hideTarget:function(){return n&&n.deviceType}}}).result}function ce(e,r){e={template:'<div ng-include="\':::PLUGIN_PATH:::/dashboard/new.html\'" ng-controller="DashboardEditCtrl"></div>',controller:["$scope","$uibModalInstance","config",function(e,n,t){e.dashboardId="new",e.modalInstance=n,e.config=t||{},e.creationContext=r}],size:"lg",resolve:{config:_.constant(e)}};return o.open(e).result}function L(e,n){var t,n=angular.extend({title:l("Select dashboard"),preventNew:!0,selectLabel:l("Select"),useReports:!0},n);return t=n,t={templateUrl:":::PLUGIN_PATH:::/dashboard/select.html",controller:"DashboardSelectController",size:"lg",resolve:{config:_.constant(n)}},o.open(t).result.then(function(n){return e.templateUrl?U(n,e):T([e]).then(function(e){e=_slicedToArray(e,1)[0];return U(n,e)})})}var N={};function U(e,n,t){var r=e.id||e,o=(N[r]=N[r]||{children:[]},N[r]),i=o.promise;return o.children.push({child:n,remove:t}),i||(o.promise=$(function(){return a.all({dashboard:E(e,!1,!0),contextObject:P()}).then(function(e){var t=e.dashboard,r=e.contextObject;return a.all(_.map(o.children,function(n){return(n.remove?a.resolve(n.child):A(r,t,n.child)).then(function(e){t.children=w(t.children||{},e,n.remove)})})).then(_.constant(t))}).then(R)}),(i=o.promise).finally(function(){delete N[r]})),i}function w(e,n,t){return n.id||(n.id=String(Math.random()).substr(2)),t?delete e[n.id]:e[n.id]=n,t=e,r=0,_(t).sortBy("position").forEach(function(e){e.position=r,r+=1}),_.cloneDeep(t);var r}function P(){var n=O();return n.id?M.detailCached(n.id,{withChildren:!1}).then(c.getResData).then(function(e){return e||{id:n.id}}):a.when({})}var S=[];var k={list:C,save:R,saveAndWait:_.partialRight(R,!0),detail:E,detailPredefinedReadOnly:function(e,n){var t={children:{},isFrozen:!0,readOnly:!0};return T(e).then(function(e){return _.forEach(e,function(e){w(t.children,e)}),t}).then(re).then(ee(n))},named:function(n,t,r){function o(e){return R(e).then(_.partial(D,Q,n)).then(c.getResData).then(function(e){return E(e,r)})}return C(null,Q(n)).then(function(e){var n;return e.length?E(_.head(e).id,r):(n={children:{}},T(t).then(function(e){return _.forEach(e,function(e){w(n.children,e)}),d.hasAnyRole(["ROLE_INVENTORY_ADMIN","ROLE_INVENTORY_CREATE","ROLE_MANAGED_OBJECT_ADMIN","ROLE_MANAGED_OBJECT_CREATE"]).then(function(e){return!!e||a.reject()}).then(_.partial(o,n)).catch(_.partial(_.identity,n))}))})},isNamed:function(e){return _.some(_.keys(e),function(e){return/^c8y_Dashboard!name!/.test(e)})},remove:function(e){return h.remove(y(e)),n.$emit("dashboard:remove",y(e)),u.remove(e)},isLocked:F,toggleLock:function(e){return(F(e)?Y:J)(e)},lock:J,unlock:Y,deviceAdd:_.partial(D,v),deviceRemove:_.partialRight(_.partial(D,v),!0),deviceList:_.partial(I,v),deviceTypeAdd:_.partial(D,b),deviceTypeRemove:_.partialRight(_.partial(D,b),!0),deviceTypeList:function(e){return a.all([I(v,e.id),I(b,e.type)]).then(_.flattenDeep)},groupAdd:_.partial(D,e),groupRemove:_.partialRight(_.partial(D,e),!0),groupList:_.partial(I,e),getContextObject:P,transformChildWithContext:A,updateConfigTargetsWithContext:te,addDashboard:ce,copyDashboard:function(e){var n,t=(e=>{var n=O(),t=n.id;function r(e){return e.__target.id!==t}if("device"!==n.context&&"group"!==n.context)return l("Only dashboards from devices or groups can be copied");if(!_.every(e.children,function(e){var e=e.config||{},n=!0;return e.device&&e.device.id!==t&&(n=!1),n=e.datapoints&&_.some(e.datapoints,r)?!1:n})){if("device"===n.context)return l("Only dashboards with widgets referencing the current device can be copied.");if("group"===n.context)return l("Only dashboards with widgets referencing the current group can be copied.")}return!1})(e);return t?(f.warning(t),!1):(S=[],t=O(),S.push({dashboard:_.cloneDeep(e),context:t}),"device"===t.context&&(n=l('Dashboard copied. Navigate to the desired device and select "Paste dashboard"')),"group"===t.context&&(n=l('Dashboard copied. Navigate to the desired group and select "Paste dashboard"')),f.success(n),!0)},pasteDashboard:function(){if(S&&S.length)return P().then(function(e){var n,t,r,o,i,a,c,u;return u=_.last(S),n=O(),u=u.context.context,(i=n.context!==u&&("device"===u&&(i=l("Device dashboards can only be copied into a device.")),"group"===u)?l("Group dashboards can only be copied into a group."):i)&&f.warning(i),!i&&(n=S.pop(),t=n.dashboard,(r=O()).name=e.name,o=k["".concat(r.context,"Add")],_.forEach(t,function(e,n){n.match(/!/)&&delete t[n]}),u=r.context,r.context===n.context.context&&["device","group"].includes(u)&&(i=t,a=r,c=n.context,e=_.reduce(i.children,function(e,n){var t=n.id,r=n.config,o={device:function(e){return ie(e,a,c)},datapoints:function(e){return x(e,a,c)},dataPoints:function(e){return x(e,a,c)},datapointsGauge:function(e){return x(e,a,c)},datapointsLabels:function(e){return x(e,a,c)}};return r&&(oe(r,o),r.options)&&oe(r.options,o),e[t]=n,e},{}),i.children=e,t=i),t.creationContext=r,delete t.id,(u=R(t)).then(function(e){return o(r.id,e)}).finally(Z),u)})},dashboardToPaste:function(){var e=S&&S[0];return e&&e.dashboard},selectDashboard:ce,editCurrentDashboard:function(t){return o.open({template:'<div ng-include="\':::PLUGIN_PATH:::/dashboard/new.html\'" ng-controller="DashboardEditCtrl"></div>',controller:["$scope","$uibModalInstance",function(e,n){e.modalInstance=n,e.dashboardId=_.get(t,"dashboardId")}],size:"lg"}).result},editChildUI:ae,addChildUI:_.partial(ae,null),restoreDefaultChildren:function(t,e,r){return T(e).then(function(e){var n=t.children;return _.forEach(_.keys(n),function(e){w(n,n[e],!0)}),_.forEach(e,function(e){w(n,e)}),R(t).then(function(e){return E(e,r)})})},getContext:O,getContextPath:function(){var e=O(),n="";return"group"===e.context&&(n="/group/".concat(e.id)),n="device"===e.context?"/device/".concat(e.id):n},appendChild:_.partialRight(U,!1),updateChild:_.partialRight(U,!1),removeChild:_.partialRight(U,!0),clearCacheList:Z,addWidgetToSelectedDashboard:L,addWidgetToSelectedDashboardInContext:function(e){return L(e,{inContext:!0,preventCreate:!0,useReports:!1})},addWidgetToSelectedReport:function(e){return L(e,{onlyReports:!0,useReports:!0,title:l("Select report"),preventCreate:!0})},getIconNameObj:function(e){var n,t={icon:e.icon||"th",name:e.name||s.getString("Dashboard")},r=(e=>{var t=/^c8y_Dashboard!name!(.+?)[-_].+$/,e=_.pickBy(e,function(e,n){return t.test(n)});return 0<(e=_.keys(e)).length?e[0].match(t)[1]:null})(e),o=c.getPluginService("c8yReports");return r&&(n=G[r])&&(t.icon=n.icon||t.icon,t.name=n.name||t.name),"report"===r&&o&&(t=o.getReportFromDashboard(e).then(function(e){return _.pick(e,["icon","name"])})),a.resolve(t)},hasWritePermissions:function(e){return e=c.hasId(e)?d.canAdminMOs([e]):d.hasAnyRole(["ROLE_INVENTORY_ADMIN","ROLE_INVENTORY_CREATE","ROLE_MANAGED_OBJECT_ADMIN","ROLE_MANAGED_OBJECT_CREATE"])},VERSION:2};return _.assign(k)}ue.$inject=["$cacheFactory","$rootScope","$routeParams","$uibModal","$timeout","$q","$injector","c8yBase","dashboardInventorySvc","c8yInventory","c8yComponents","c8yPermissions","c8yUiUtil","gettext","gettextCatalog","c8yAlert"],angular.module("c8y.parts.dashboard2").factory("dashboardSvc",ue)})();
|
|
1
|
+
function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function _iterableToArrayLimit(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,c=[],u=!0,d=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(c.push(r.value),c.length!==t);u=!0);}catch(e){d=!0,o=e}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(d)throw o}}return c}}function _arrayWithHoles(e){if(Array.isArray(e))return e}(()=>{function ue(e,t,W,o,G,a,i,c,u,$,n,d,M,l,s,f){var h=e("dashboards"),p=e("dashboardLists"),g="c8y_Dashboard",j={welcome:{icon:"cloud",name:s.getString("Welcome")},home:{icon:"home",name:s.getString("Home")}};function H(e){return _.map(e,function(e){return _.assign(_.get(e,g,{}),{id:e.id})})}function m(e){var n,t,r,e=e||{},o=_.assign(_.get(e,g,{}),{id:e.id},(n=/^c8y_Dashboard!(.+)$/,_.pickBy(e,function(e,t){return n.test(t)})));return _.set(o,"global",!!_.get(e,"c8y_Global")),t=o,r=["templateUrl","configTemplateUrl"],e=_.map(t.children,function(e){return a.all(_.map(r,_.partial(K,e)))}),a.all(e).then(function(){return t}).then(B)}function B(t){return t.children?(e=t.children,n.list().then(function(t){return _(e).mapValues(function(e){return z(e,t,!1)}).value()}).then(function(e){return t.children=e,t})):t;var e}function z(e,t,n){var r,o=_.cloneDeep(e),e=_.find(t,function(e){var t=e.name&&e.name===o.name,e=e.templateUrl&&e.templateUrl===o.templateUrl;return t||e});return e?((r=e.replaceWith)&&(o.config=i.invoke(r.config,void 0,{oldConfig:o.config}),e=_.find(t,{name:r.component})),o.name=e.name,e.transformConfigWithContext&&(o.componentTransformConfigWithContext=e.transformConfigWithContext),e.widgetComponent?(o.widgetComponent=e.widgetComponent,delete o.templateUrl):o.templateUrl=e.templateUrl,e.configComponent?(o.configComponent=e.configComponent,delete o.configTemplateUrl):o.configTemplateUrl=e.configTemplateUrl,o):n?null:o}function V(t){return d.canAdminMOs([t]).then(function(e){return e||(t.isFrozen=!e),t.readOnly=!e,t})}function F(e){return _.get(e,"isFrozen")}function J(e){return q(e,!0)}function Y(e){return q(e,!1)}function q(e,t){return e.isFrozen=t,k.saveAndWait(e).then(ue.clearCacheList)}function K(t,n){var e=t[n];return M.verifyPluginViewPath(e).then(function(e){return t[n]=e,t})}function r(t){return function(e){e=_.isObjectLike(e)?e.id:e;return[g,t,e].join("!")}}var v=r("device"),e=r("group"),Q=r("name"),b=r("type");function X(e){return h.put(y(e),_.cloneDeep(e))}function y(e){return _.isObjectLike(e)?e.id:e}function C(e,t){var n,r=_.assign(e||{},{fragmentType:t||g}),r=u.list(r).then(H);return t&&!e&&(n=p.get(t),r.then(function(e){0<e.length&&p.put(t,e)})),n?a.when(n):r}function Z(){p.removeAll(),t.$emit("dashboard:refresh")}function A(e,t,n){var r=h.get(y(e)),n=!(n&&r)&&u.detail(e).then(c.getResData).then(m).then(V).then(X);return(r?a.when(r):n).then(re).then(ee(t))}function ee(n){return function(e){var t;return(e.deviceType||n)&&(t=_.cloneDeep(e),e=U().then(_.partial(te,t))),e}}function te(e,t){return a.all(_.map(e.children,function(e){return ne(t,e.config)})).then(_.constant(e))}function ne(t,e){function n(e){e.__target={id:t.id,name:t.name}}return e&&(e.device={id:t.id,name:t.name},e.datapoints&&_.forEach(e.datapoints,n),e.alarmsEventsConfigs&&_.forEach(e.alarmsEventsConfigs,n),e.options&&e.options.dataPoints&&_.forEach(e.options.dataPoints,n),e.datapointsGauge&&_.forEach(e.datapointsGauge,n),e.datapointsLabels)&&_.forEach(e.datapointsLabels,n),e}function re(n){return U().then(function(t){return a.all(_.map(n.children,function(e){return T(t,n,e)}))}).then(_.constant(n))}function T(n,r,t){var e=t.config||{},o=_.compact([t.transformConfigWithContext,t.componentTransformConfigWithContext]);return _.reduce(o,function(e,t){return e.then(function(e){return i.invoke(t,null,{config:e,context:n,dashboard:r})})},a.resolve(e)).then(function(e){return _.assign(t,{config:e})})}function E(e){return n.list().then(function(t){return _(e).map(function(e){return 0===t.filter(function(e){return"Data points graph"===e.name}).length&&t.push({name:"Data points graph",nameDisplay:l("Data points graph"),description:l("A graph display of a collection of data points"),templateUrl:":::PLUGIN_PATH:::/views/widget.html",configTemplateUrl:":::PLUGIN_PATH:::/views/widgetConfig.html",previewImage:":::PLUGIN_PATH:::/img/data-points-graph-widget-pr.png",options:{noDeviceTarget:!0,minCol:4,datapointAttributes:["datapoints"]},displaySettings:{globalTimeContext:!0,globalRealtimeContext:!0,globalAggregationContext:!0}}),z(e,t,!0)}).compact().value()})}function oe(n,e){_.forEach(e,function(e,t){n[t]&&(n[t]=e(n[t]))})}function x(e,t,n){return _.forEach(e,function(e){e.__target=ie(e.__target,t,n)}),e}function ie(e,t,n){return e&&e.id===n.id&&_.assign(e,_.pick(t,["id","name"])),e}function D(e){var n=["id","creationContext","readOnly"],r=/^c8y_Dashboard!/,t=_.cloneDeep(e),o=(t.global=!!t.deviceType||t.global,t.id),i={id:o},o=o?"update":"createConfirm",a=(i[g]=_.pickBy(t,function(e,t){return!r.test(t)&&!_.includes(n,t)}),(a=i)[g].global&&_.assign(a,{c8y_Global:{}}),t.deviceType?{}:t.creationContext),t=u[o](i,a);return"update"==o&&(t=t.then(function(){return e})),(t="createConfirm"==o?t.then(c.getResData).then(m):t).then(X)}function R(e,t,n,r){n={id:n.id},e=e(t);return n[e]=r?null:{},h.get(e)&&h.remove(e),u.save(n)}function I(e,t){return C(null,e(t))}function O(){var n,r;return k.forcedContext||(r=n=null,_.forEach(["report","device","group"],function(e){var t=_.get(W,"".concat(e,"Id"));t&&(n=e,r=t)}),{context:n,id:r})}function ae(e,t){return o.open({templateUrl:":::PLUGIN_PATH:::/dashboardWidget/config.html",controller:"DashboardWidgetConfigController",size:"lg",resolve:{dashboard:function(){return t||{}},component:function(){return e||{}},hideTarget:function(){return t&&t.deviceType}}}).result}function ce(e,r){e={template:'<div ng-include="\':::PLUGIN_PATH:::/dashboard/new.html\'" ng-controller="DashboardEditCtrl"></div>',controller:["$scope","$uibModalInstance","config",function(e,t,n){e.dashboardId="new",e.modalInstance=t,e.config=n||{},e.creationContext=r}],size:"lg",resolve:{config:_.constant(e)}};return o.open(e).result}function L(e,t){var n,t=angular.extend({title:l("Select dashboard"),preventNew:!0,selectLabel:l("Select"),useReports:!0},t);return n=t,n={templateUrl:":::PLUGIN_PATH:::/dashboard/select.html",controller:"DashboardSelectController",size:"lg",resolve:{config:_.constant(t)}},o.open(n).result.then(function(t){return e.templateUrl?w(t,e):E([e]).then(function(e){e=_slicedToArray(e,1)[0];return w(t,e)})})}var N={};function w(e,t,n){var r=e.id||e,o=(N[r]=N[r]||{children:[]},N[r]),i=o.promise;return o.children.push({child:t,remove:n}),i||(o.promise=G(function(){return a.all({dashboard:A(e,!1,!0),contextObject:U()}).then(function(e){var n=e.dashboard,r=e.contextObject;return a.all(_.map(o.children,function(t){return(t.remove?a.resolve(t.child):T(r,n,t.child)).then(function(e){n.children=P(n.children||{},e,t.remove)})})).then(_.constant(n))}).then(D)}),(i=o.promise).finally(function(){delete N[r]})),i}function P(e,t,n){return t.id||(t.id=String(Math.random()).substr(2)),n?delete e[t.id]:e[t.id]=t,n=e,r=0,_(n).sortBy("position").forEach(function(e){e.position=r,r+=1}),_.cloneDeep(n);var r}function U(){var t=O();return t.id?$.detailCached(t.id,{withChildren:!1}).then(c.getResData).then(function(e){return e||{id:t.id}}):a.when({})}var S=[];var k={list:C,save:D,saveAndWait:_.partialRight(D,!0),detail:A,detailPredefinedReadOnly:function(e,t){var n={children:{},isFrozen:!0,readOnly:!0};return E(e).then(function(e){return _.forEach(e,function(e){P(n.children,e)}),n}).then(re).then(ee(t))},named:function(t,n,r){function o(e){return D(e).then(_.partial(R,Q,t)).then(c.getResData).then(function(e){return A(e,r)})}return C(null,Q(t)).then(function(e){var t;return e.length?A(_.head(e).id,r):(t={children:{}},E(n).then(function(e){return _.forEach(e,function(e){P(t.children,e)}),d.hasAnyRole(["ROLE_INVENTORY_ADMIN","ROLE_INVENTORY_CREATE","ROLE_MANAGED_OBJECT_ADMIN","ROLE_MANAGED_OBJECT_CREATE"]).then(function(e){return!!e||a.reject()}).then(_.partial(o,t)).catch(_.partial(_.identity,t))}))})},isNamed:function(e){return _.some(_.keys(e),function(e){return/^c8y_Dashboard!name!/.test(e)})},remove:function(e){return h.remove(y(e)),t.$emit("dashboard:remove",y(e)),u.remove(e)},isLocked:F,toggleLock:function(e){return(F(e)?Y:J)(e)},lock:J,unlock:Y,deviceAdd:_.partial(R,v),deviceRemove:_.partialRight(_.partial(R,v),!0),deviceList:_.partial(I,v),deviceTypeAdd:_.partial(R,b),deviceTypeRemove:_.partialRight(_.partial(R,b),!0),deviceTypeList:function(e){return a.all([I(v,e.id),I(b,e.type)]).then(_.flattenDeep)},groupAdd:_.partial(R,e),groupRemove:_.partialRight(_.partial(R,e),!0),groupList:_.partial(I,e),getContextObject:U,transformChildWithContext:T,updateConfigTargetsWithContext:ne,addDashboard:ce,copyDashboard:function(e){var t,n=(e=>{var t=O(),n=t.id;function r(e){return e.__target.id!==n}if("device"!==t.context&&"group"!==t.context)return l("Only dashboards from devices or groups can be copied");if(!_.every(e.children,function(e){var e=e.config||{},t=!0;return e.device&&e.device.id!==n&&(t=!1),t=e.datapoints&&_.some(e.datapoints,r)?!1:t})){if("device"===t.context)return l("Only dashboards with widgets referencing the current device can be copied.");if("group"===t.context)return l("Only dashboards with widgets referencing the current group can be copied.")}return!1})(e);return n?(f.warning(n),!1):(S=[],n=O(),S.push({dashboard:_.cloneDeep(e),context:n}),"device"===n.context&&(t=l('Dashboard copied. Navigate to the desired device and select "Paste dashboard"')),"group"===n.context&&(t=l('Dashboard copied. Navigate to the desired group and select "Paste dashboard"')),f.success(t),!0)},pasteDashboard:function(){if(S&&S.length)return U().then(function(e){var t,n,r,o,i,a,c,u;return u=_.last(S),t=O(),u=u.context.context,(i=t.context!==u&&("device"===u&&(i=l("Device dashboards can only be copied into a device.")),"group"===u)?l("Group dashboards can only be copied into a group."):i)&&f.warning(i),!i&&(t=S.pop(),n=t.dashboard,(r=O()).name=e.name,o=k["".concat(r.context,"Add")],_.forEach(n,function(e,t){t.match(/!/)&&delete n[t]}),u=r.context,r.context===t.context.context&&["device","group"].includes(u)&&(i=n,a=r,c=t.context,e=_.reduce(i.children,function(e,t){var n=t.id,r=t.config,o={device:function(e){return ie(e,a,c)},datapoints:function(e){return x(e,a,c)},dataPoints:function(e){return x(e,a,c)},datapointsGauge:function(e){return x(e,a,c)},datapointsLabels:function(e){return x(e,a,c)}};return r&&(oe(r,o),r.options)&&oe(r.options,o),e[n]=t,e},{}),i.children=e,n=i),n.creationContext=r,delete n.id,(u=D(n)).then(function(e){return o(r.id,e)}).finally(Z),u)})},dashboardToPaste:function(){var e=S&&S[0];return e&&e.dashboard},selectDashboard:ce,editCurrentDashboard:function(n){return o.open({template:'<div ng-include="\':::PLUGIN_PATH:::/dashboard/new.html\'" ng-controller="DashboardEditCtrl"></div>',controller:["$scope","$uibModalInstance",function(e,t){e.modalInstance=t,e.dashboardId=_.get(n,"dashboardId")}],size:"lg"}).result},editChildUI:ae,addChildUI:_.partial(ae,null),restoreDefaultChildren:function(n,e,r){return E(e).then(function(e){var t=n.children;return _.forEach(_.keys(t),function(e){P(t,t[e],!0)}),_.forEach(e,function(e){P(t,e)}),D(n).then(function(e){return A(e,r)})})},getContext:O,getContextPath:function(){var e=O(),t="";return"group"===e.context&&(t="/group/".concat(e.id)),t="device"===e.context?"/device/".concat(e.id):t},appendChild:_.partialRight(w,!1),updateChild:_.partialRight(w,!1),removeChild:_.partialRight(w,!0),clearCacheList:Z,addWidgetToSelectedDashboard:L,addWidgetToSelectedDashboardInContext:function(e){return L(e,{inContext:!0,preventCreate:!0,useReports:!1})},addWidgetToSelectedReport:function(e){return L(e,{onlyReports:!0,useReports:!0,title:l("Select report"),preventCreate:!0})},getIconNameObj:function(e){var t,n={icon:e.icon||"th",name:e.name||s.getString("Dashboard")},r=(e=>{var n=/^c8y_Dashboard!name!(.+?)[-_].+$/,e=_.pickBy(e,function(e,t){return n.test(t)});return 0<(e=_.keys(e)).length?e[0].match(n)[1]:null})(e),o=c.getPluginService("c8yReports");return r&&(t=j[r])&&(n.icon=t.icon||n.icon,n.name=t.name||n.name),"report"===r&&o&&(n=o.getReportFromDashboard(e).then(function(e){return _.pick(e,["icon","name"])})),a.resolve(n)},hasWritePermissions:function(e){return e=c.hasId(e)?d.canAdminMOs([e]):d.hasAnyRole(["ROLE_INVENTORY_ADMIN","ROLE_INVENTORY_CREATE","ROLE_MANAGED_OBJECT_ADMIN","ROLE_MANAGED_OBJECT_CREATE"])},VERSION:2};return _.assign(k)}ue.$inject=["$cacheFactory","$rootScope","$routeParams","$uibModal","$timeout","$q","$injector","c8yBase","dashboardInventorySvc","c8yInventory","c8yComponents","c8yPermissions","c8yUiUtil","gettext","gettextCatalog","c8yAlert"],angular.module("c8y.parts.dashboard2").factory("dashboardSvc",ue)})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _regenerator(){var v,e="function"==typeof Symbol?Symbol:{},t=e.iterator||"@@iterator",r=e.toStringTag||"@@toStringTag";function n(e,t,r,n){var o,i,a,c,u,f,s,y,p,t=t&&t.prototype instanceof d?t:d,t=Object.create(t.prototype);return _regeneratorDefine2(t,"_invoke",(o=e,i=r,s=n||[],y=!1,p={p:f=0,n:0,v:v,a:l,f:l.bind(v,4),d:function(e,t){return a=e,c=0,u=v,p.n=t,b}},function(e,t,r){if(1<f)throw TypeError("Generator is already running");for(y&&1===t&&l(t,r),c=t,u=r;(m=c<2?v:u)||!y;){a||(c?c<3?(1<c&&(p.n=-1),l(c,u)):p.n=u:p.v=u);try{if(f=2,a){if(m=a[e=c?e:"next"]){if(!(m=m.call(a,u)))throw TypeError("iterator result is not an object");if(!m.done)return m;u=m.value,c<2&&(c=0)}else 1===c&&(m=a.return)&&m.call(a),c<2&&(u=TypeError("The iterator does not provide a '"+e+"' method"),c=1);a=v}else if((m=(y=p.n<0)?u:o.call(i,p))!==b)break}catch(e){a=v,c=1,u=e}finally{f=1}}return{value:m,done:y}}),!0),t;function l(e,t){for(c=e,u=t,m=0;!y&&f&&!r&&m<s.length;m++){var r,n=s[m],o=p.p,i=n[2];3<e?(r=i===t)&&(u=n[(c=n[4])?5:c=3],n[4]=n[5]=v):n[0]<=o&&((r=e<2&&o<n[1])?(c=0,p.v=t,p.n=n[1]):o<i&&(r=e<3||n[0]>t||i<t)&&(n[4]=e,n[5]=t,p.n=i,c=0))}if(r||1<e)return b;throw y=!0,t}}var b={};function d(){}function o(){}function i(){}var m=Object.getPrototypeOf,e=[][t]?m(m([][t]())):(_regeneratorDefine2(m={},t,function(){return this}),m),a=i.prototype=d.prototype=Object.create(e);function c(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,_regeneratorDefine2(e,r,"GeneratorFunction")),e.prototype=Object.create(a),e}return _regeneratorDefine2(a,"constructor",o.prototype=i),_regeneratorDefine2(i,"constructor",o),_regeneratorDefine2(i,r,o.displayName="GeneratorFunction"),_regeneratorDefine2(a),_regeneratorDefine2(a,r,"Generator"),_regeneratorDefine2(a,t,function(){return this}),_regeneratorDefine2(a,"toString",function(){return"[object Generator]"}),(_regenerator=function(){return{w:n,m:c}})()}function _regeneratorDefine2(e,t,r,n){var
|
|
1
|
+
function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _regenerator(){var v,e="function"==typeof Symbol?Symbol:{},t=e.iterator||"@@iterator",r=e.toStringTag||"@@toStringTag";function n(e,t,r,n){var o,i,a,c,u,f,s,y,p,t=t&&t.prototype instanceof d?t:d,t=Object.create(t.prototype);return _regeneratorDefine2(t,"_invoke",(o=e,i=r,s=n||[],y=!1,p={p:f=0,n:0,v:v,a:l,f:l.bind(v,4),d:function(e,t){return a=e,c=0,u=v,p.n=t,b}},function(e,t,r){if(1<f)throw TypeError("Generator is already running");for(y&&1===t&&l(t,r),c=t,u=r;(m=c<2?v:u)||!y;){a||(c?c<3?(1<c&&(p.n=-1),l(c,u)):p.n=u:p.v=u);try{if(f=2,a){if(m=a[e=c?e:"next"]){if(!(m=m.call(a,u)))throw TypeError("iterator result is not an object");if(!m.done)return m;u=m.value,c<2&&(c=0)}else 1===c&&(m=a.return)&&m.call(a),c<2&&(u=TypeError("The iterator does not provide a '"+e+"' method"),c=1);a=v}else if((m=(y=p.n<0)?u:o.call(i,p))!==b)break}catch(e){a=v,c=1,u=e}finally{f=1}}return{value:m,done:y}}),!0),t;function l(e,t){for(c=e,u=t,m=0;!y&&f&&!r&&m<s.length;m++){var r,n=s[m],o=p.p,i=n[2];3<e?(r=i===t)&&(u=n[(c=n[4])?5:c=3],n[4]=n[5]=v):n[0]<=o&&((r=e<2&&o<n[1])?(c=0,p.v=t,p.n=n[1]):o<i&&(r=e<3||n[0]>t||i<t)&&(n[4]=e,n[5]=t,p.n=i,c=0))}if(r||1<e)return b;throw y=!0,t}}var b={};function d(){}function o(){}function i(){}var m=Object.getPrototypeOf,e=[][t]?m(m([][t]())):(_regeneratorDefine2(m={},t,function(){return this}),m),a=i.prototype=d.prototype=Object.create(e);function c(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,_regeneratorDefine2(e,r,"GeneratorFunction")),e.prototype=Object.create(a),e}return _regeneratorDefine2(a,"constructor",o.prototype=i),_regeneratorDefine2(i,"constructor",o),_regeneratorDefine2(i,r,o.displayName="GeneratorFunction"),_regeneratorDefine2(a),_regeneratorDefine2(a,r,"Generator"),_regeneratorDefine2(a,t,function(){return this}),_regeneratorDefine2(a,"toString",function(){return"[object Generator]"}),(_regenerator=function(){return{w:n,m:c}})()}function _regeneratorDefine2(e,t,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}(_regeneratorDefine2=function(e,t,r,n){function o(t,r){_regeneratorDefine2(e,t,function(e){return this._invoke(t,r,e)})}t?i?i(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(o("next",0),o("throw",1),o("return",2))})(e,t,r,n)}function asyncGeneratorStep(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(c){return function(){var e=this,a=arguments;return new Promise(function(t,r){var n=c.apply(e,a);function o(e){asyncGeneratorStep(n,t,r,o,i,"next",e)}function i(e){asyncGeneratorStep(n,t,r,o,i,"throw",e)}o(void 0)})}}function ownKeys(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(r),!0).forEach(function(e){_defineProperty(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:e+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!=_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(()=>{e.$inject=["c8yDeviceTypeProtocolBaseProvider","gettext"];var r="c8yCanbusDevice";function e(e,a){t.$inject=["c8yDeviceDatabase","c8yDeviceControl","gettextCatalog","c8yDevices","c8yBase","c8yUser"];var c={label:a("CAN Bus"),fieldbusType:"canbus",serviceName:r};return e.getDeviceTypeProtocolProvider(c,t);function t(e,f,t,s,y,o){var r=_objectSpread(_objectSpread({},c),{},{discreteOutputs:!1,discreteInputs:!1,holdingRegisters:{number:{label:a("Message ID"),useHex:!0,min:0,max:536870911},startBit:{max:63},noBits:{max:64},multiplier:{min:1,step:1},divisor:!0,decimalPlaces:!0,unit:!0,offset:{min:Number.MIN_SAFE_INTEGER||-(Math.pow(2,53)-1),max:Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1},options:{signed:!0,enumType:!0},functionalities:{showStatus:!0,updateStatus:!0,sendMeasurement:!0,raiseAlarm:!0,sendEvent:!0}},inputRegisters:!1,options:{serverTime:!0},deviceFragments:["c8y_CanDevice"],deviceConfiguration:{fragment:"c8y_CanConfiguration",icon:"share-alt"}});return{registerFeaturesManifest:function(){e.registerFeaturesManifest(n().then(function(e){return e&&r}))},isAvailable:n,create:function(e,t){return i.apply(this,arguments)}};function n(){return e.isFeatureFieldbus4Available()}function i(){return(i=_asyncToGenerator(_regenerator().m(function e(o,i){var a,c,u;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,function(){return p.apply(this,arguments)}(o,i);case 1:return u=e.v,c=y,e.n=2,s.createConfirm(u);case 2:return u=e.v,a=c.getResData.call(c,u),e.n=3,s.addChildDevice(o,a);case 3:return a.owner=o.owner,e.n=4,s.save(a);case 4:return e.a(2,f.create((t=o,r=i.deviceType,n=a,{deviceId:t.id,description:'Added new child device to "'.concat(t.name,'" (ID: ').concat(t.id,")."),c8y_CanDevice:{id:n.id,name:n.name,type:"/inventory/managedObjects/".concat(r.id)}})))}var t,r,n},e)}))).apply(this,arguments)}function p(){return(p=_asyncToGenerator(_regenerator().m(function e(t,r){var n;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,o.current();case 1:return n=e.v,e.a(2,{name:"".concat(t.name," - ").concat(r.deviceType.name),type:r.deviceType.name,c8y_CanDevice:{type:"/inventory/managedObjects/".concat(r.deviceType.id)},owner:n.id,c8y_IsDevice:{}})}},e)}))).apply(this,arguments)}}}angular.module("c8y.canbus").provider(r,e)})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _regenerator(){var y,e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",t=e.toStringTag||"@@toStringTag";function r(e,n,t,r){var i,a,o,s,c,u,d,l,p,n=n&&n.prototype instanceof _?n:_,n=Object.create(n.prototype);return _regeneratorDefine2(n,"_invoke",(i=e,a=t,d=r||[],l=!1,p={p:u=0,n:0,v:y,a:v,f:v.bind(y,4),d:function(e,n){return o=e,s=0,c=y,p.n=n,g}},function(e,n,t){if(1<u)throw TypeError("Generator is already running");for(l&&1===n&&v(n,t),s=n,c=t;(f=s<2?y:c)||!l;){o||(s?s<3?(1<s&&(p.n=-1),v(s,c)):p.n=c:p.v=c);try{if(u=2,o){if(f=o[e=s?e:"next"]){if(!(f=f.call(o,c)))throw TypeError("iterator result is not an object");if(!f.done)return f;c=f.value,s<2&&(s=0)}else 1===s&&(f=o.return)&&f.call(o),s<2&&(c=TypeError("The iterator does not provide a '"+e+"' method"),s=1);o=y}else if((f=(l=p.n<0)?c:i.call(a,p))!==g)break}catch(e){o=y,s=1,c=e}finally{u=1}}return{value:f,done:l}}),!0),n;function v(e,n){for(s=e,c=n,f=0;!l&&u&&!t&&f<d.length;f++){var t,r=d[f],i=p.p,a=r[2];3<e?(t=a===n)&&(c=r[(s=r[4])?5:s=3],r[4]=r[5]=y):r[0]<=i&&((t=e<2&&i<r[1])?(s=0,p.v=n,p.n=r[1]):i<a&&(t=e<3||r[0]>n||a<n)&&(r[4]=e,r[5]=n,p.n=a,s=0))}if(t||1<e)return g;throw l=!0,n}}var g={};function _(){}function i(){}function a(){}var f=Object.getPrototypeOf,e=[][n]?f(f([][n]())):(_regeneratorDefine2(f={},n,function(){return this}),f),o=a.prototype=_.prototype=Object.create(e);function s(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,a):(e.__proto__=a,_regeneratorDefine2(e,t,"GeneratorFunction")),e.prototype=Object.create(o),e}return _regeneratorDefine2(o,"constructor",i.prototype=a),_regeneratorDefine2(a,"constructor",i),_regeneratorDefine2(a,t,i.displayName="GeneratorFunction"),_regeneratorDefine2(o),_regeneratorDefine2(o,t,"Generator"),_regeneratorDefine2(o,n,function(){return this}),_regeneratorDefine2(o,"toString",function(){return"[object Generator]"}),(_regenerator=function(){return{w:r,m:s}})()}function _regeneratorDefine2(e,n,t,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}(_regeneratorDefine2=function(e,n,t,r){n?i?i(e,n,{value:t,enumerable:!r,configurable:!r,writable:!r}):e[n]=t:((r=function(n,t){_regeneratorDefine2(e,n,function(e){return this._invoke(n,t,e)})})("next",0),r("throw",1),r("return",2))})(e,n,t,r)}function asyncGeneratorStep(e,n,t,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void t(e)}s.done?n(c):Promise.resolve(c).then(r,i)}function _asyncToGenerator(s){return function(){var e=this,o=arguments;return new Promise(function(n,t){var r=s.apply(e,o);function i(e){asyncGeneratorStep(r,n,t,i,a,"next",e)}function a(e){asyncGeneratorStep(r,n,t,i,a,"throw",e)}i(void 0)})}}function ownKeys(n,e){var t,r=Object.keys(n);return Object.getOwnPropertySymbols&&(t=Object.getOwnPropertySymbols(n),e&&(t=t.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})),r.push.apply(r,t)),r}function _objectSpread(n){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(t),!0).forEach(function(e){_defineProperty(n,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))})}return n}function _defineProperty(e,n,t){return(n=_toPropertyKey(n))in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:e+""}function _toPrimitive(e,n){if("object"!=_typeof(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0===t)return("string"===n?String:Number)(e);t=t.call(e,n||"default");if("object"!=_typeof(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}(()=>{e.$inject=["c8yDeviceTypeProtocolBaseProvider","c8yDeviceProtocolUiProvider","c8yViewsProvider","gettext"];var i="c8yCanopenDevice";function e(e,n,t,m){r.$inject=["c8yDeviceDatabase","c8yDeviceControl","c8yModbusDevice","gettextCatalog","c8yInventory","c8yDevices","c8yBase","c8yUser","$q"];var S={label:m("CANopen"),fieldbusType:"canopen",serviceName:i};return e.getDeviceTypeProtocolProvider(S,r);function r(e,l,p,n,t,c,u,i,v){var r=u.createEnum(_.flatten([{name:"BOOLEAN",label:m("Boolean"),value:"boolean",edsValue:1,noBits:1},{name:"SIGNED_8",label:m("Signed (8-bits)"),value:"signed8",edsValue:2,noBits:8,signed:!0},{name:"SIGNED_16",label:m("Signed (16-bits)"),value:"signed16",edsValue:3,noBits:16,signed:!0},{name:"SIGNED_24",label:m("Signed (24-bits)"),value:"signed24",edsValue:16,noBits:24,signed:!0},{name:"SIGNED_32",label:m("Signed (32-bits)"),value:"signed32",edsValue:4,noBits:32,signed:!0},{name:"SIGNED_40",label:m("Signed (40-bits)"),value:"signed40",edsValue:18,noBits:40,signed:!0},{name:"SIGNED_48",label:m("Signed (48-bits)"),value:"signed48",edsValue:19,noBits:48,signed:!0},{name:"SIGNED_56",label:m("Signed (56-bits)"),value:"signed56",edsValue:20,noBits:56,signed:!0},{name:"SIGNED_64",label:m("Signed (64-bits)"),value:"signed64",edsValue:21,noBits:64,signed:!0},{name:"UNSIGNED_8",label:m("Unsigned (8-bits)"),value:"unsigned8",edsValue:5,noBits:8,signed:!1},{name:"UNSIGNED_16",label:m("Unsigned (16-bits)"),value:"unsigned16",edsValue:6,noBits:16,signed:!1},{name:"UNSIGNED_24",label:m("Unsigned (24-bits)"),value:"unsigned24",edsValue:22,noBits:24,signed:!1},{name:"UNSIGNED_32",label:m("Unsigned (32-bits)"),value:"unsigned32",edsValue:7,noBits:32,signed:!1},{name:"UNSIGNED_40",label:m("Unsigned (40-bits)"),value:"unsigned40",edsValue:24,noBits:40,signed:!1},{name:"UNSIGNED_48",label:m("Unsigned (48-bits)"),value:"unsigned48",edsValue:25,noBits:48,signed:!1},{name:"UNSIGNED_56",label:m("Unsigned (56-bits)"),value:"unsigned56",edsValue:26,noBits:56,signed:!1},{name:"UNSIGNED_64",label:m("Unsigned (64-bits)"),value:"unsigned64",edsValue:27,noBits:64,signed:!1},{name:"REAL_32",label:m("Real (32-bits)"),value:"real32",edsValue:8,noBits:32,decimalPlaces:null,baseValuesRange:{min:-3.4*Math.pow(10,38),max:3.4*Math.pow(10,38)}},{name:"REAL_64",label:m("Real (64-bits)"),value:"real64",edsValue:17,noBits:64,decimalPlaces:null,baseValuesRange:{min:-Number.MAX_VALUE,max:Number.MAX_VALUE}}])),a=u.createEnum([{name:"READ_ONLY",label:m("Read-only"),value:"ro"},{name:"WRITE_ONLY",label:m("Write-only"),value:"wo"},{name:"READ_WRITE",label:m("Read-write"),value:"rw"},{name:"READ_WRITE_ON_PROCESS_INPUT",label:m("Read-write on process input"),value:"rwr"},{name:"READ_WRITE_ON_PROCESS_OUTPUT",label:m("Read-write on process output"),value:"rww"},{name:"CONSTANT",label:m("Constant"),value:"const"}]),o=_objectSpread(_objectSpread({},S),{},{type:"c8y_CANopenDeviceType",deviceType:!0,discreteOutputs:!1,discreteInputs:!1,holdingRegisters:{sectionTitle:m("Variables"),noRegistersDefinedMessage:m("No variables defined."),elementTypeLabel:m("Variable"),newRegisterModalTitle:m("New variable"),editRegisterModalTitle:m('Edit variable: "{{name}}"'),addRegisterButtonLabel:m("Add variable"),unit:!0,validation:{invalidName:m("Name must be unique among variables."),invalidMeasurement:m("Selected measurement type and series are already used by another variable.")},index:{min:0,max:Math.pow(2,16)-1},subIndex:{min:0,max:Math.pow(2,8)-1},dataType:{choices:r},accessType:{choices:a},functionalities:{showStatus:{showIf:function(e){return _.includes([a.READ_ONLY,a.READ_WRITE,a.READ_WRITE_ON_PROCESS_INPUT,a.READ_WRITE_ON_PROCESS_OUTPUT,a.CONSTANT],_.get(e.meta,"accessType"))}},updateStatus:{showIf:function(e){return _.includes([a.READ_WRITE,a.READ_WRITE_ON_PROCESS_INPUT,a.READ_WRITE_ON_PROCESS_OUTPUT,a.WRITE_ONLY],_.get(e.meta,"accessType"))}},sendMeasurement:{showIf:s},raiseAlarm:{showIf:s,mask:!0},sendEvent:{showIf:s}}},inputRegisters:!1,options:{serverTime:!0},deviceFragments:["c8y_CANopenDevice"],deviceConfiguration:{fragment:"c8y_CANopenConfiguration",icon:"cloud-network"},getRegisterSource:function(e){return{key:"c8y_CANopenSource",value:{index:e.index,subIndex:e.subIndex}}},customizeSmartRestTemplates:function(e){return b(e.responseTemplates,{msgId:201,condition:"$.c8y_SetRegister",pattern:["$.id","$.c8y_SetRegister.nodeId","$.c8y_SetRegister.index","$.c8y_SetRegister.subIndex","$.c8y_SetRegister.dataType","$.c8y_SetRegister.value"]}),b(e.responseTemplates,{msgId:202,condition:"$.c8y_CANopenAddDevice",pattern:["$.id","$.deviceId","$.c8y_CANopenAddDevice.id","$.c8y_CANopenAddDevice.nodeId","$.c8y_CANopenAddDevice.type"]}),b(e.responseTemplates,{msgId:204,condition:"$.c8y_CANopenRemoveDevice",pattern:["$.id","$.deviceId","$.c8y_CANopenDevice.nodeId"]}),e}});function s(e){return _.includes([a.READ_ONLY,a.READ_WRITE,a.READ_WRITE_ON_PROCESS_INPUT,a.READ_WRITE_ON_PROCESS_OUTPUT],_.get(e.meta,"accessType"))}return{registerFeaturesManifest:function(){e.registerFeaturesManifest(d().then(function(e){return e&&o}))},isAvailable:d,create:function(e,n){return y.apply(this,arguments)},updateElement:function(e,n,t){return f.apply(this,arguments)},onRemove:function(e,n){var t=n.id,r=n.name,n=n.nodeId;return l.create({deviceId:e.id,description:'Removed child device "'.concat(r,'" (ID: ').concat(t,")."),c8y_CANopenRemoveDevice:{id:t,name:r,nodeId:n}})}};function d(){return e.isFeatureFieldbus4Available()}function y(){return(y=_asyncToGenerator(_regenerator().m(function e(r,i){var a,o,s;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,function(){return g.apply(this,arguments)}(r,i);case 1:return s=e.v,o=u,e.n=2,c.createConfirm(s);case 2:return s=e.v,a=o.getResData.call(o,s),e.n=3,c.addChildDevice(r,a);case 3:return a.owner=r.owner,e.n=4,c.save(a);case 4:return e.a(2,l.create((n=i.deviceType,t=a,{deviceId:r.id,description:'Added child device "'.concat(t.name,'" (ID: ').concat(t.id,")."),c8y_CANopenAddDevice:{id:t.id,name:t.name,type:"/inventory/managedObjects/".concat(n.id),nodeId:t.c8y_CANopenDevice.nodeId}})))}var n,t},e)}))).apply(this,arguments)}function g(){return(g=_asyncToGenerator(_regenerator().m(function e(n,t){var r;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,i.current();case 1:return r=e.v,e.a(2,{name:t.name,type:t.deviceType.name,c8y_CANopenDevice:{type:"/inventory/managedObjects/".concat(t.deviceType.id),nodeId:t.nodeId},c8y_SupportedOperations:["c8y_Command"],owner:r.id,c8y_IsDevice:{}})}},e)}))).apply(this,arguments)}function f(){return(f=_asyncToGenerator(_regenerator().m(function e(o,s,c){var u,d;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(p.canUpdateElement(o,s)){e.n=1;break}return e.a(2,v.reject());case 1:return a=i=r=t=void 0,t=(n={device:o,register:s,valueMap:c}).device,r=n.register,i=(n=n.valueMap).label||n.value,a=!n.label&&r.unit?" ".concat(r.unit):"",d={deviceId:t.id,description:'Change value of "'.concat(r.name,'" to ').concat(i).concat(a,"."),c8y_SetRegister:{nodeId:t.c8y_CANopenDevice.nodeId,index:r.index,subIndex:r.subIndex,dataType:r.dataType,value:n.value}},s.changePending=!0,u=p.getAlertMessagesFns(s,c),e.n=2,p.sendOperationAndGetResult(d,u);case 2:return(d=e.v).status===l.status.SUCCESSFUL?(_.set(o,["c8y_RegisterStatus",s.name],c.value),s.changePending=!1):d.status===l.status.FAILED&&(s.changePending=!1),e.a(2,d)}var n,t,r,i,a},e)}))).apply(this,arguments)}function b(e,n){var t=_.findIndex(e,{msgId:n.msgId});-1<t?e[t]=n:e.push(n)}}}angular.module("c8y.canopen").provider(i,e)})();
|
|
1
|
+
function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _regenerator(){var y,e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",t=e.toStringTag||"@@toStringTag";function r(e,n,t,r){var i,a,o,s,c,u,d,l,p,n=n&&n.prototype instanceof _?n:_,n=Object.create(n.prototype);return _regeneratorDefine2(n,"_invoke",(i=e,a=t,d=r||[],l=!1,p={p:u=0,n:0,v:y,a:v,f:v.bind(y,4),d:function(e,n){return o=e,s=0,c=y,p.n=n,g}},function(e,n,t){if(1<u)throw TypeError("Generator is already running");for(l&&1===n&&v(n,t),s=n,c=t;(f=s<2?y:c)||!l;){o||(s?s<3?(1<s&&(p.n=-1),v(s,c)):p.n=c:p.v=c);try{if(u=2,o){if(f=o[e=s?e:"next"]){if(!(f=f.call(o,c)))throw TypeError("iterator result is not an object");if(!f.done)return f;c=f.value,s<2&&(s=0)}else 1===s&&(f=o.return)&&f.call(o),s<2&&(c=TypeError("The iterator does not provide a '"+e+"' method"),s=1);o=y}else if((f=(l=p.n<0)?c:i.call(a,p))!==g)break}catch(e){o=y,s=1,c=e}finally{u=1}}return{value:f,done:l}}),!0),n;function v(e,n){for(s=e,c=n,f=0;!l&&u&&!t&&f<d.length;f++){var t,r=d[f],i=p.p,a=r[2];3<e?(t=a===n)&&(c=r[(s=r[4])?5:s=3],r[4]=r[5]=y):r[0]<=i&&((t=e<2&&i<r[1])?(s=0,p.v=n,p.n=r[1]):i<a&&(t=e<3||r[0]>n||a<n)&&(r[4]=e,r[5]=n,p.n=a,s=0))}if(t||1<e)return g;throw l=!0,n}}var g={};function _(){}function i(){}function a(){}var f=Object.getPrototypeOf,e=[][n]?f(f([][n]())):(_regeneratorDefine2(f={},n,function(){return this}),f),o=a.prototype=_.prototype=Object.create(e);function s(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,a):(e.__proto__=a,_regeneratorDefine2(e,t,"GeneratorFunction")),e.prototype=Object.create(o),e}return _regeneratorDefine2(o,"constructor",i.prototype=a),_regeneratorDefine2(a,"constructor",i),_regeneratorDefine2(a,t,i.displayName="GeneratorFunction"),_regeneratorDefine2(o),_regeneratorDefine2(o,t,"Generator"),_regeneratorDefine2(o,n,function(){return this}),_regeneratorDefine2(o,"toString",function(){return"[object Generator]"}),(_regenerator=function(){return{w:r,m:s}})()}function _regeneratorDefine2(e,n,t,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}(_regeneratorDefine2=function(e,n,t,r){function i(n,t){_regeneratorDefine2(e,n,function(e){return this._invoke(n,t,e)})}n?a?a(e,n,{value:t,enumerable:!r,configurable:!r,writable:!r}):e[n]=t:(i("next",0),i("throw",1),i("return",2))})(e,n,t,r)}function asyncGeneratorStep(e,n,t,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void t(e)}s.done?n(c):Promise.resolve(c).then(r,i)}function _asyncToGenerator(s){return function(){var e=this,o=arguments;return new Promise(function(n,t){var r=s.apply(e,o);function i(e){asyncGeneratorStep(r,n,t,i,a,"next",e)}function a(e){asyncGeneratorStep(r,n,t,i,a,"throw",e)}i(void 0)})}}function ownKeys(n,e){var t,r=Object.keys(n);return Object.getOwnPropertySymbols&&(t=Object.getOwnPropertySymbols(n),e&&(t=t.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})),r.push.apply(r,t)),r}function _objectSpread(n){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(t),!0).forEach(function(e){_defineProperty(n,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))})}return n}function _defineProperty(e,n,t){return(n=_toPropertyKey(n))in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:e+""}function _toPrimitive(e,n){if("object"!=_typeof(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0===t)return("string"===n?String:Number)(e);t=t.call(e,n||"default");if("object"!=_typeof(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}(()=>{e.$inject=["c8yDeviceTypeProtocolBaseProvider","c8yDeviceProtocolUiProvider","c8yViewsProvider","gettext"];var i="c8yCanopenDevice";function e(e,n,t,m){r.$inject=["c8yDeviceDatabase","c8yDeviceControl","c8yModbusDevice","gettextCatalog","c8yInventory","c8yDevices","c8yBase","c8yUser","$q"];var S={label:m("CANopen"),fieldbusType:"canopen",serviceName:i};return e.getDeviceTypeProtocolProvider(S,r);function r(e,l,p,n,t,c,u,i,v){var r=u.createEnum(_.flatten([{name:"BOOLEAN",label:m("Boolean"),value:"boolean",edsValue:1,noBits:1},{name:"SIGNED_8",label:m("Signed (8-bits)"),value:"signed8",edsValue:2,noBits:8,signed:!0},{name:"SIGNED_16",label:m("Signed (16-bits)"),value:"signed16",edsValue:3,noBits:16,signed:!0},{name:"SIGNED_24",label:m("Signed (24-bits)"),value:"signed24",edsValue:16,noBits:24,signed:!0},{name:"SIGNED_32",label:m("Signed (32-bits)"),value:"signed32",edsValue:4,noBits:32,signed:!0},{name:"SIGNED_40",label:m("Signed (40-bits)"),value:"signed40",edsValue:18,noBits:40,signed:!0},{name:"SIGNED_48",label:m("Signed (48-bits)"),value:"signed48",edsValue:19,noBits:48,signed:!0},{name:"SIGNED_56",label:m("Signed (56-bits)"),value:"signed56",edsValue:20,noBits:56,signed:!0},{name:"SIGNED_64",label:m("Signed (64-bits)"),value:"signed64",edsValue:21,noBits:64,signed:!0},{name:"UNSIGNED_8",label:m("Unsigned (8-bits)"),value:"unsigned8",edsValue:5,noBits:8,signed:!1},{name:"UNSIGNED_16",label:m("Unsigned (16-bits)"),value:"unsigned16",edsValue:6,noBits:16,signed:!1},{name:"UNSIGNED_24",label:m("Unsigned (24-bits)"),value:"unsigned24",edsValue:22,noBits:24,signed:!1},{name:"UNSIGNED_32",label:m("Unsigned (32-bits)"),value:"unsigned32",edsValue:7,noBits:32,signed:!1},{name:"UNSIGNED_40",label:m("Unsigned (40-bits)"),value:"unsigned40",edsValue:24,noBits:40,signed:!1},{name:"UNSIGNED_48",label:m("Unsigned (48-bits)"),value:"unsigned48",edsValue:25,noBits:48,signed:!1},{name:"UNSIGNED_56",label:m("Unsigned (56-bits)"),value:"unsigned56",edsValue:26,noBits:56,signed:!1},{name:"UNSIGNED_64",label:m("Unsigned (64-bits)"),value:"unsigned64",edsValue:27,noBits:64,signed:!1},{name:"REAL_32",label:m("Real (32-bits)"),value:"real32",edsValue:8,noBits:32,decimalPlaces:null,baseValuesRange:{min:-3.4*Math.pow(10,38),max:3.4*Math.pow(10,38)}},{name:"REAL_64",label:m("Real (64-bits)"),value:"real64",edsValue:17,noBits:64,decimalPlaces:null,baseValuesRange:{min:-Number.MAX_VALUE,max:Number.MAX_VALUE}}])),a=u.createEnum([{name:"READ_ONLY",label:m("Read-only"),value:"ro"},{name:"WRITE_ONLY",label:m("Write-only"),value:"wo"},{name:"READ_WRITE",label:m("Read-write"),value:"rw"},{name:"READ_WRITE_ON_PROCESS_INPUT",label:m("Read-write on process input"),value:"rwr"},{name:"READ_WRITE_ON_PROCESS_OUTPUT",label:m("Read-write on process output"),value:"rww"},{name:"CONSTANT",label:m("Constant"),value:"const"}]),o=_objectSpread(_objectSpread({},S),{},{type:"c8y_CANopenDeviceType",deviceType:!0,discreteOutputs:!1,discreteInputs:!1,holdingRegisters:{sectionTitle:m("Variables"),noRegistersDefinedMessage:m("No variables defined."),elementTypeLabel:m("Variable"),newRegisterModalTitle:m("New variable"),editRegisterModalTitle:m('Edit variable: "{{name}}"'),addRegisterButtonLabel:m("Add variable"),unit:!0,validation:{invalidName:m("Name must be unique among variables."),invalidMeasurement:m("Selected measurement type and series are already used by another variable.")},index:{min:0,max:Math.pow(2,16)-1},subIndex:{min:0,max:Math.pow(2,8)-1},dataType:{choices:r},accessType:{choices:a},functionalities:{showStatus:{showIf:function(e){return _.includes([a.READ_ONLY,a.READ_WRITE,a.READ_WRITE_ON_PROCESS_INPUT,a.READ_WRITE_ON_PROCESS_OUTPUT,a.CONSTANT],_.get(e.meta,"accessType"))}},updateStatus:{showIf:function(e){return _.includes([a.READ_WRITE,a.READ_WRITE_ON_PROCESS_INPUT,a.READ_WRITE_ON_PROCESS_OUTPUT,a.WRITE_ONLY],_.get(e.meta,"accessType"))}},sendMeasurement:{showIf:s},raiseAlarm:{showIf:s,mask:!0},sendEvent:{showIf:s}}},inputRegisters:!1,options:{serverTime:!0},deviceFragments:["c8y_CANopenDevice"],deviceConfiguration:{fragment:"c8y_CANopenConfiguration",icon:"cloud-network"},getRegisterSource:function(e){return{key:"c8y_CANopenSource",value:{index:e.index,subIndex:e.subIndex}}},customizeSmartRestTemplates:function(e){return b(e.responseTemplates,{msgId:201,condition:"$.c8y_SetRegister",pattern:["$.id","$.c8y_SetRegister.nodeId","$.c8y_SetRegister.index","$.c8y_SetRegister.subIndex","$.c8y_SetRegister.dataType","$.c8y_SetRegister.value"]}),b(e.responseTemplates,{msgId:202,condition:"$.c8y_CANopenAddDevice",pattern:["$.id","$.deviceId","$.c8y_CANopenAddDevice.id","$.c8y_CANopenAddDevice.nodeId","$.c8y_CANopenAddDevice.type"]}),b(e.responseTemplates,{msgId:204,condition:"$.c8y_CANopenRemoveDevice",pattern:["$.id","$.deviceId","$.c8y_CANopenDevice.nodeId"]}),e}});function s(e){return _.includes([a.READ_ONLY,a.READ_WRITE,a.READ_WRITE_ON_PROCESS_INPUT,a.READ_WRITE_ON_PROCESS_OUTPUT],_.get(e.meta,"accessType"))}return{registerFeaturesManifest:function(){e.registerFeaturesManifest(d().then(function(e){return e&&o}))},isAvailable:d,create:function(e,n){return y.apply(this,arguments)},updateElement:function(e,n,t){return f.apply(this,arguments)},onRemove:function(e,n){var t=n.id,r=n.name,n=n.nodeId;return l.create({deviceId:e.id,description:'Removed child device "'.concat(r,'" (ID: ').concat(t,")."),c8y_CANopenRemoveDevice:{id:t,name:r,nodeId:n}})}};function d(){return e.isFeatureFieldbus4Available()}function y(){return(y=_asyncToGenerator(_regenerator().m(function e(r,i){var a,o,s;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,function(){return g.apply(this,arguments)}(r,i);case 1:return s=e.v,o=u,e.n=2,c.createConfirm(s);case 2:return s=e.v,a=o.getResData.call(o,s),e.n=3,c.addChildDevice(r,a);case 3:return a.owner=r.owner,e.n=4,c.save(a);case 4:return e.a(2,l.create((n=i.deviceType,t=a,{deviceId:r.id,description:'Added child device "'.concat(t.name,'" (ID: ').concat(t.id,")."),c8y_CANopenAddDevice:{id:t.id,name:t.name,type:"/inventory/managedObjects/".concat(n.id),nodeId:t.c8y_CANopenDevice.nodeId}})))}var n,t},e)}))).apply(this,arguments)}function g(){return(g=_asyncToGenerator(_regenerator().m(function e(n,t){var r;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,i.current();case 1:return r=e.v,e.a(2,{name:t.name,type:t.deviceType.name,c8y_CANopenDevice:{type:"/inventory/managedObjects/".concat(t.deviceType.id),nodeId:t.nodeId},c8y_SupportedOperations:["c8y_Command"],owner:r.id,c8y_IsDevice:{}})}},e)}))).apply(this,arguments)}function f(){return(f=_asyncToGenerator(_regenerator().m(function e(o,s,c){var u,d;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(p.canUpdateElement(o,s)){e.n=1;break}return e.a(2,v.reject());case 1:return a=i=r=t=void 0,t=(n={device:o,register:s,valueMap:c}).device,r=n.register,i=(n=n.valueMap).label||n.value,a=!n.label&&r.unit?" ".concat(r.unit):"",d={deviceId:t.id,description:'Change value of "'.concat(r.name,'" to ').concat(i).concat(a,"."),c8y_SetRegister:{nodeId:t.c8y_CANopenDevice.nodeId,index:r.index,subIndex:r.subIndex,dataType:r.dataType,value:n.value}},s.changePending=!0,u=p.getAlertMessagesFns(s,c),e.n=2,p.sendOperationAndGetResult(d,u);case 2:return(d=e.v).status===l.status.SUCCESSFUL?(_.set(o,["c8y_RegisterStatus",s.name],c.value),s.changePending=!1):d.status===l.status.FAILED&&(s.changePending=!1),e.a(2,d)}var n,t,r,i,a},e)}))).apply(this,arguments)}function b(e,n){var t=_.findIndex(e,{msgId:n.msgId});-1<t?e[t]=n:e.push(n)}}}angular.module("c8y.canopen").provider(i,e)})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _regenerator(){var y,e="function"==typeof Symbol?Symbol:{},t=e.iterator||"@@iterator",n=e.toStringTag||"@@toStringTag";function r(e,t,n,r){var o,a,i,c,u,s,l,d,f,t=t&&t.prototype instanceof g?t:g,t=Object.create(t.prototype);return _regeneratorDefine2(t,"_invoke",(o=e,a=n,l=r||[],d=!1,f={p:s=0,n:0,v:y,a:p,f:p.bind(y,4),d:function(e,t){return i=e,c=0,u=y,f.n=t,v}},function(e,t,n){if(1<s)throw TypeError("Generator is already running");for(d&&1===t&&p(t,n),c=t,u=n;(m=c<2?y:u)||!d;){i||(c?c<3?(1<c&&(f.n=-1),p(c,u)):f.n=u:f.v=u);try{if(s=2,i){if(m=i[e=c?e:"next"]){if(!(m=m.call(i,u)))throw TypeError("iterator result is not an object");if(!m.done)return m;u=m.value,c<2&&(c=0)}else 1===c&&(m=i.return)&&m.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+e+"' method"),c=1);i=y}else if((m=(d=f.n<0)?u:o.call(a,f))!==v)break}catch(e){i=y,c=1,u=e}finally{s=1}}return{value:m,done:d}}),!0),t;function p(e,t){for(c=e,u=t,m=0;!d&&s&&!n&&m<l.length;m++){var n,r=l[m],o=f.p,a=r[2];3<e?(n=a===t)&&(u=r[(c=r[4])?5:c=3],r[4]=r[5]=y):r[0]<=o&&((n=e<2&&o<r[1])?(c=0,f.v=t,f.n=r[1]):o<a&&(n=e<3||r[0]>t||a<t)&&(r[4]=e,r[5]=t,f.n=a,c=0))}if(n||1<e)return v;throw d=!0,t}}var v={};function g(){}function o(){}function a(){}var m=Object.getPrototypeOf,e=[][t]?m(m([][t]())):(_regeneratorDefine2(m={},t,function(){return this}),m),i=a.prototype=g.prototype=Object.create(e);function c(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,a):(e.__proto__=a,_regeneratorDefine2(e,n,"GeneratorFunction")),e.prototype=Object.create(i),e}return _regeneratorDefine2(i,"constructor",o.prototype=a),_regeneratorDefine2(a,"constructor",o),_regeneratorDefine2(a,n,o.displayName="GeneratorFunction"),_regeneratorDefine2(i),_regeneratorDefine2(i,n,"Generator"),_regeneratorDefine2(i,t,function(){return this}),_regeneratorDefine2(i,"toString",function(){return"[object Generator]"}),(_regenerator=function(){return{w:r,m:c}})()}function _regeneratorDefine2(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}(_regeneratorDefine2=function(e,t,n,r){t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:((r=function(t,n){_regeneratorDefine2(e,t,function(e){return this._invoke(t,n,e)})})("next",0),r("throw",1),r("return",2))})(e,t,n,r)}function asyncGeneratorStep(e,t,n,r,o,a,i){try{var c=e[a](i),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function _asyncToGenerator(c){return function(){var e=this,i=arguments;return new Promise(function(t,n){var r=c.apply(e,i);function o(e){asyncGeneratorStep(r,t,n,o,a,"next",e)}function a(e){asyncGeneratorStep(r,t,n,o,a,"throw",e)}o(void 0)})}}function ownKeys(t,e){var n,r=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)),r}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(n),!0).forEach(function(e){_defineProperty(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function _defineProperty(e,t,n){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:e+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return("string"===t?String:Number)(e);n=n.call(e,t||"default");if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(()=>{e.$inject=["c8yDeviceTypeProtocolBaseProvider","c8yDeviceProtocolUiProvider","c8yViewsProvider","gettext"];var o="c8yModbusDevice";function e(e,t,n,P){r.$inject=["c8yDeviceDatabase","c8yDeviceControl","gettextCatalog","c8yInventory","c8yDevices","c8yAlert","c8yBase","c8yUser","$q"];var O={label:P("Modbus"),fieldbusType:"modbus",serviceName:o};return e.getDeviceTypeProtocolProvider(O,r);function r(l,d,s,e,f,o,p,a,y){var t=l.ElementType,v=t.DISCRETE_IO,g=t.REGISTER,r=_defineProperty(_defineProperty({},v.value,"c8y_CoilStatus"),g.value,"c8y_RegisterStatus"),n=_objectSpread(_objectSpread({},O),{},{discreteOutputs:{functionalities:{showStatus:!0,updateStatus:!0}},discreteInputs:{functionalities:{showStatus:!0,updateStatus:!1}},holdingRegisters:{number:!0,startBit:{max:15},noBits:{max:64,base:16},multiplier:{min:1,step:1},divisor:!0,decimalPlaces:!0,unit:!0,options:{signed:!0,enumType:!0,littleEndian:!0},functionalities:{showStatus:!0,updateStatus:!0,sendMeasurement:!0,raiseAlarm:!0,sendEvent:!0}},inputRegisters:{number:!0,startBit:{max:15},noBits:{max:64,base:16},multiplier:{min:1,step:1},divisor:!0,decimalPlaces:!0,unit:!0,options:{signed:!0,enumType:!0,littleEndian:!0},functionalities:{showStatus:!0,updateStatus:!0,sendMeasurement:!0,raiseAlarm:!0,sendEvent:!0}},options:{serverTime:!0},deviceFragments:["c8y_ModbusDevice"],deviceConfiguration:{fragment:"c8y_ModbusConfiguration",icon:"microchip"},versions:[{number:5,checks:[function(e){return _.some(e.c8y_Registers,function(e){return 16<e.noBits})},function(e){return _.some(e.c8y_Registers,function(e){return!_.isUndefined(e.littleEndian)})}]}]});return{registerFeaturesManifest:function(){l.registerFeaturesManifest(i().then(function(e){return e&&n}))},isAvailable:i,create:function(e,t){return c.apply(this,arguments)},canUpdateElement:h,isElementChangePending:function(e){return e.changePending},getCurrentElementValue:u,getCurrentElementValueFormatted:function(e,t){e=u(e,t);t.meta.enumType&&(e=t.meta.enumValues[e].label);return e},updateElement:function(e,t,n){return b.apply(this,arguments)},getAlertMessagesFns:S,sendOperationAndGetResult:D};function i(){return l.isFeatureFieldbus4Available()}function c(){return(c=_asyncToGenerator(_regenerator().m(function e(o,a){var i,c,u;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,function(){return m.apply(this,arguments)}(o,a);case 1:return u=e.v,c=p,e.n=2,f.createConfirm(u);case 2:return u=e.v,i=c.getResData.call(c,u),e.n=3,f.addChildDevice(o,i);case 3:return i.owner=o.owner,e.n=4,f.save(i);case 4:return e.a(2,d.create((t=o,n=a.deviceType,r=i,{deviceId:t.id,description:'Added new child device to "'.concat(t.name,'" (ID: ').concat(t.id,")."),c8y_ModbusDevice:{id:r.id,name:r.name,address:r.c8y_ModbusDevice.address,ipAddress:r.c8y_ModbusDevice.ipAddress,type:"/inventory/managedObjects/".concat(n.id),protocol:r.c8y_ModbusDevice.protocol}})))}var t,n,r},e)}))).apply(this,arguments)}function m(){return(m=_asyncToGenerator(_regenerator().m(function e(t,n){var r;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,a.current();case 1:return r=e.v,e.a(2,{name:n.name,type:n.deviceType.name,c8y_ModbusDevice:{address:n.address,ipAddress:n.ipAddress,type:"/inventory/managedObjects/".concat(n.deviceType.id),protocol:n.protocol},owner:r.id,c8y_IsDevice:{}})}},e)}))).apply(this,arguments)}function u(e,t){var n=r[t.meta.type.value];return e&&e[n]&&parseFloat(e[n][t.name])}function b(){return(b=_asyncToGenerator(_regenerator().m(function e(a,i,c){var u,s;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(h(a,i))return e.n=1,l.getDeviceTypeFromDevice(a);e.n=3;break;case 1:return s=e.v,s=((e,t,n,r)=>{var o,a,i,c,u=n.meta.type;return u===v?(i=n,c=r,{deviceId:(a=e).id,description:'Change status of "'.concat(i.name,'" to "').concat(c.label,'".'),c8y_SetCoil:{address:a.c8y_ModbusDevice.address,input:i.input,coil:i.number,value:c.value}}):u===g?(u=e,e=t,t=n,r=(n=r).label||n.value,o=!n.label&&t.unit?" ".concat(t.unit):"",r={deviceId:u.id,description:'Change value of "'.concat(t.name,'" to ').concat(r).concat(o,"."),c8y_SetRegister:{}},"opcua"===e.fieldbusType?r.c8y_SetRegister={address:u.c8y_OPCUADevice.browsePath,register:t.browsePath,value:n.value}:r.c8y_SetRegister={ipAddress:_.get(u,"c8y_ModbusDevice.ipAddress",""),address:u.c8y_ModbusDevice.address,input:t.input,register:t.number,startBit:t.startBit,noBits:t.noBits,value:n.value},r):void 0})(a,s,i,c),i.changePending=!0,u=S(i,c),e.n=2,D(s,u);case 2:return(s=e.v).status===d.status.SUCCESSFUL?(t=a,r=c,o=void 0,(o=(n=i).meta.type)===v?_.set(t,["c8y_CoilStatus",n.name],r.value):o===g&&_.set(t,["c8y_RegisterStatus",n.name],r.value),i.changePending=!1):s.status===d.status.FAILED&&(i.changePending=!1),e.a(2,s);case 3:return e.a(2,y.reject())}var t,n,r,o},e)}))).apply(this,arguments)}function h(e,t){t=t.statusMapping;return!e.c8y_ModbusReadOnlyDevice&&t&&"write"===t.status}function S(e,t){function n(t){return function(e){return s.getString(t,_objectSpread(_objectSpread({},u),{},{operation:e}))}}var r,o,a,i,c=e.meta.type,u={name:e.name};c===v?(u.label=t.label,r=P("Status of {{name}} will be changed to {{label}}"),o=P("Status of {{name}} has been changed to {{label}}"),a=P("Failed to change status of {{name}} to {{label}}"),i=P('Failed to change status of {{name}} to {{label}} due to: "{{operation.failureReason | translate}}".')):c===g&&(u.value=t.label||t.value,u.unit=!t.label&&e.unit?" ".concat(e.unit):"",r=P("Value of {{name}} will be changed to {{value}}{{unit}}"),o=P("Value of {{name}} has been changed to {{value}}{{unit}}"),a=P("Failed to change value of {{name}} to {{value}}{{unit}}"),i=P('Failed to change value of {{name}} to {{value}}{{unit}} due to: "{{operation.failureReason | translate}}".'));return{onCreated:n(r),onSuccess:n(o),onFailure:n(a),onFailureWithReason:n(i)}}function D(e,t){return w.apply(this,arguments)}function w(){return(w=_asyncToGenerator(_regenerator().m(function e(t,n){var r;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,d.createWithNotifications(t);case 1:return(r=e.v).created.then(function(){n.onCreated?o.success(n.onCreated(t)):o.success(s.getString('"{{description | translate}}" will be executed.',t))}),e.n=2,r.completed;case 2:return(r=e.v).status===d.status.SUCCESSFUL?n.onSuccess?o.success(n.onSuccess(t)):o.success(s.getString('"{{description | translate}}" completed.',t)):r.status===d.status.FAILED&&(r.failureReason?n.onFailureWithReason?o.danger(n.onFailureWithReason(r)):o.danger(s.getString('"{{description | translate}}" failed due to: "{{failureReason | translate}}".',r)):n.onFailure?o.danger(n.onFailure(t)):o.danger(s.getString('"{{description | translate}}" failed.',t))),e.a(2,r)}},e)}))).apply(this,arguments)}}}angular.module("c8y.modbus").provider(o,e)})();
|
|
1
|
+
function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _regenerator(){var y,e="function"==typeof Symbol?Symbol:{},t=e.iterator||"@@iterator",n=e.toStringTag||"@@toStringTag";function r(e,t,n,r){var o,a,i,c,u,s,l,d,f,t=t&&t.prototype instanceof g?t:g,t=Object.create(t.prototype);return _regeneratorDefine2(t,"_invoke",(o=e,a=n,l=r||[],d=!1,f={p:s=0,n:0,v:y,a:p,f:p.bind(y,4),d:function(e,t){return i=e,c=0,u=y,f.n=t,v}},function(e,t,n){if(1<s)throw TypeError("Generator is already running");for(d&&1===t&&p(t,n),c=t,u=n;(m=c<2?y:u)||!d;){i||(c?c<3?(1<c&&(f.n=-1),p(c,u)):f.n=u:f.v=u);try{if(s=2,i){if(m=i[e=c?e:"next"]){if(!(m=m.call(i,u)))throw TypeError("iterator result is not an object");if(!m.done)return m;u=m.value,c<2&&(c=0)}else 1===c&&(m=i.return)&&m.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+e+"' method"),c=1);i=y}else if((m=(d=f.n<0)?u:o.call(a,f))!==v)break}catch(e){i=y,c=1,u=e}finally{s=1}}return{value:m,done:d}}),!0),t;function p(e,t){for(c=e,u=t,m=0;!d&&s&&!n&&m<l.length;m++){var n,r=l[m],o=f.p,a=r[2];3<e?(n=a===t)&&(u=r[(c=r[4])?5:c=3],r[4]=r[5]=y):r[0]<=o&&((n=e<2&&o<r[1])?(c=0,f.v=t,f.n=r[1]):o<a&&(n=e<3||r[0]>t||a<t)&&(r[4]=e,r[5]=t,f.n=a,c=0))}if(n||1<e)return v;throw d=!0,t}}var v={};function g(){}function o(){}function a(){}var m=Object.getPrototypeOf,e=[][t]?m(m([][t]())):(_regeneratorDefine2(m={},t,function(){return this}),m),i=a.prototype=g.prototype=Object.create(e);function c(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,a):(e.__proto__=a,_regeneratorDefine2(e,n,"GeneratorFunction")),e.prototype=Object.create(i),e}return _regeneratorDefine2(i,"constructor",o.prototype=a),_regeneratorDefine2(a,"constructor",o),_regeneratorDefine2(a,n,o.displayName="GeneratorFunction"),_regeneratorDefine2(i),_regeneratorDefine2(i,n,"Generator"),_regeneratorDefine2(i,t,function(){return this}),_regeneratorDefine2(i,"toString",function(){return"[object Generator]"}),(_regenerator=function(){return{w:r,m:c}})()}function _regeneratorDefine2(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}(_regeneratorDefine2=function(e,t,n,r){function o(t,n){_regeneratorDefine2(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))})(e,t,n,r)}function asyncGeneratorStep(e,t,n,r,o,a,i){try{var c=e[a](i),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function _asyncToGenerator(c){return function(){var e=this,i=arguments;return new Promise(function(t,n){var r=c.apply(e,i);function o(e){asyncGeneratorStep(r,t,n,o,a,"next",e)}function a(e){asyncGeneratorStep(r,t,n,o,a,"throw",e)}o(void 0)})}}function ownKeys(t,e){var n,r=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)),r}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(n),!0).forEach(function(e){_defineProperty(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function _defineProperty(e,t,n){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:e+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return("string"===t?String:Number)(e);n=n.call(e,t||"default");if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(()=>{e.$inject=["c8yDeviceTypeProtocolBaseProvider","c8yDeviceProtocolUiProvider","c8yViewsProvider","gettext"];var o="c8yModbusDevice";function e(e,t,n,P){r.$inject=["c8yDeviceDatabase","c8yDeviceControl","gettextCatalog","c8yInventory","c8yDevices","c8yAlert","c8yBase","c8yUser","$q"];var O={label:P("Modbus"),fieldbusType:"modbus",serviceName:o};return e.getDeviceTypeProtocolProvider(O,r);function r(l,d,s,e,f,o,p,a,y){var t=l.ElementType,v=t.DISCRETE_IO,g=t.REGISTER,r=_defineProperty(_defineProperty({},v.value,"c8y_CoilStatus"),g.value,"c8y_RegisterStatus"),n=_objectSpread(_objectSpread({},O),{},{discreteOutputs:{functionalities:{showStatus:!0,updateStatus:!0}},discreteInputs:{functionalities:{showStatus:!0,updateStatus:!1}},holdingRegisters:{number:!0,startBit:{max:15},noBits:{max:64,base:16},multiplier:{min:1,step:1},divisor:!0,decimalPlaces:!0,unit:!0,options:{signed:!0,enumType:!0,littleEndian:!0},functionalities:{showStatus:!0,updateStatus:!0,sendMeasurement:!0,raiseAlarm:!0,sendEvent:!0}},inputRegisters:{number:!0,startBit:{max:15},noBits:{max:64,base:16},multiplier:{min:1,step:1},divisor:!0,decimalPlaces:!0,unit:!0,options:{signed:!0,enumType:!0,littleEndian:!0},functionalities:{showStatus:!0,updateStatus:!0,sendMeasurement:!0,raiseAlarm:!0,sendEvent:!0}},options:{serverTime:!0},deviceFragments:["c8y_ModbusDevice"],deviceConfiguration:{fragment:"c8y_ModbusConfiguration",icon:"microchip"},versions:[{number:5,checks:[function(e){return _.some(e.c8y_Registers,function(e){return 16<e.noBits})},function(e){return _.some(e.c8y_Registers,function(e){return!_.isUndefined(e.littleEndian)})}]}]});return{registerFeaturesManifest:function(){l.registerFeaturesManifest(i().then(function(e){return e&&n}))},isAvailable:i,create:function(e,t){return c.apply(this,arguments)},canUpdateElement:h,isElementChangePending:function(e){return e.changePending},getCurrentElementValue:u,getCurrentElementValueFormatted:function(e,t){e=u(e,t);t.meta.enumType&&(e=t.meta.enumValues[e].label);return e},updateElement:function(e,t,n){return b.apply(this,arguments)},getAlertMessagesFns:S,sendOperationAndGetResult:D};function i(){return l.isFeatureFieldbus4Available()}function c(){return(c=_asyncToGenerator(_regenerator().m(function e(o,a){var i,c,u;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,function(){return m.apply(this,arguments)}(o,a);case 1:return u=e.v,c=p,e.n=2,f.createConfirm(u);case 2:return u=e.v,i=c.getResData.call(c,u),e.n=3,f.addChildDevice(o,i);case 3:return i.owner=o.owner,e.n=4,f.save(i);case 4:return e.a(2,d.create((t=o,n=a.deviceType,r=i,{deviceId:t.id,description:'Added new child device to "'.concat(t.name,'" (ID: ').concat(t.id,")."),c8y_ModbusDevice:{id:r.id,name:r.name,address:r.c8y_ModbusDevice.address,ipAddress:r.c8y_ModbusDevice.ipAddress,type:"/inventory/managedObjects/".concat(n.id),protocol:r.c8y_ModbusDevice.protocol}})))}var t,n,r},e)}))).apply(this,arguments)}function m(){return(m=_asyncToGenerator(_regenerator().m(function e(t,n){var r;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,a.current();case 1:return r=e.v,e.a(2,{name:n.name,type:n.deviceType.name,c8y_ModbusDevice:{address:n.address,ipAddress:n.ipAddress,type:"/inventory/managedObjects/".concat(n.deviceType.id),protocol:n.protocol},owner:r.id,c8y_IsDevice:{}})}},e)}))).apply(this,arguments)}function u(e,t){var n=r[t.meta.type.value];return e&&e[n]&&parseFloat(e[n][t.name])}function b(){return(b=_asyncToGenerator(_regenerator().m(function e(a,i,c){var u,s;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(h(a,i))return e.n=1,l.getDeviceTypeFromDevice(a);e.n=3;break;case 1:return s=e.v,s=((e,t,n,r)=>{var o,a,i,c,u=n.meta.type;return u===v?(i=n,c=r,{deviceId:(a=e).id,description:'Change status of "'.concat(i.name,'" to "').concat(c.label,'".'),c8y_SetCoil:{address:a.c8y_ModbusDevice.address,input:i.input,coil:i.number,value:c.value}}):u===g?(u=e,e=t,t=n,r=(n=r).label||n.value,o=!n.label&&t.unit?" ".concat(t.unit):"",r={deviceId:u.id,description:'Change value of "'.concat(t.name,'" to ').concat(r).concat(o,"."),c8y_SetRegister:{}},"opcua"===e.fieldbusType?r.c8y_SetRegister={address:u.c8y_OPCUADevice.browsePath,register:t.browsePath,value:n.value}:r.c8y_SetRegister={ipAddress:_.get(u,"c8y_ModbusDevice.ipAddress",""),address:u.c8y_ModbusDevice.address,input:t.input,register:t.number,startBit:t.startBit,noBits:t.noBits,value:n.value},r):void 0})(a,s,i,c),i.changePending=!0,u=S(i,c),e.n=2,D(s,u);case 2:return(s=e.v).status===d.status.SUCCESSFUL?(t=a,r=c,o=void 0,(o=(n=i).meta.type)===v?_.set(t,["c8y_CoilStatus",n.name],r.value):o===g&&_.set(t,["c8y_RegisterStatus",n.name],r.value),i.changePending=!1):s.status===d.status.FAILED&&(i.changePending=!1),e.a(2,s);case 3:return e.a(2,y.reject())}var t,n,r,o},e)}))).apply(this,arguments)}function h(e,t){t=t.statusMapping;return!e.c8y_ModbusReadOnlyDevice&&t&&"write"===t.status}function S(e,t){function n(t){return function(e){return s.getString(t,_objectSpread(_objectSpread({},u),{},{operation:e}))}}var r,o,a,i,c=e.meta.type,u={name:e.name};c===v?(u.label=t.label,r=P("Status of {{name}} will be changed to {{label}}"),o=P("Status of {{name}} has been changed to {{label}}"),a=P("Failed to change status of {{name}} to {{label}}"),i=P('Failed to change status of {{name}} to {{label}} due to: "{{operation.failureReason | translate}}".')):c===g&&(u.value=t.label||t.value,u.unit=!t.label&&e.unit?" ".concat(e.unit):"",r=P("Value of {{name}} will be changed to {{value}}{{unit}}"),o=P("Value of {{name}} has been changed to {{value}}{{unit}}"),a=P("Failed to change value of {{name}} to {{value}}{{unit}}"),i=P('Failed to change value of {{name}} to {{value}}{{unit}} due to: "{{operation.failureReason | translate}}".'));return{onCreated:n(r),onSuccess:n(o),onFailure:n(a),onFailureWithReason:n(i)}}function D(e,t){return w.apply(this,arguments)}function w(){return(w=_asyncToGenerator(_regenerator().m(function e(t,n){var r;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,d.createWithNotifications(t);case 1:return(r=e.v).created.then(function(){n.onCreated?o.success(n.onCreated(t)):o.success(s.getString('"{{description | translate}}" will be executed.',t))}),e.n=2,r.completed;case 2:return(r=e.v).status===d.status.SUCCESSFUL?n.onSuccess?o.success(n.onSuccess(t)):o.success(s.getString('"{{description | translate}}" completed.',t)):r.status===d.status.FAILED&&(r.failureReason?n.onFailureWithReason?o.danger(n.onFailureWithReason(r)):o.danger(s.getString('"{{description | translate}}" failed due to: "{{failureReason | translate}}".',r)):n.onFailure?o.danger(n.onFailure(t)):o.danger(s.getString('"{{description | translate}}" failed.',t))),e.a(2,r)}},e)}))).apply(this,arguments)}}}angular.module("c8y.modbus").provider(o,e)})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _regenerator(){var d,e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",t=e.toStringTag||"@@toStringTag";function n(e,r,t,n){var o,i,a,c,u,s,f,y,p,r=r&&r.prototype instanceof v?r:v,r=Object.create(r.prototype);return _regeneratorDefine2(r,"_invoke",(o=e,i=t,f=n||[],y=!1,p={p:s=0,n:0,v:d,a:l,f:l.bind(d,4),d:function(e,r){return a=e,c=0,u=d,p.n=r,b}},function(e,r,t){if(1<s)throw TypeError("Generator is already running");for(y&&1===r&&l(r,t),c=r,u=t;(g=c<2?d:u)||!y;){a||(c?c<3?(1<c&&(p.n=-1),l(c,u)):p.n=u:p.v=u);try{if(s=2,a){if(g=a[e=c?e:"next"]){if(!(g=g.call(a,u)))throw TypeError("iterator result is not an object");if(!g.done)return g;u=g.value,c<2&&(c=0)}else 1===c&&(g=a.return)&&g.call(a),c<2&&(u=TypeError("The iterator does not provide a '"+e+"' method"),c=1);a=d}else if((g=(y=p.n<0)?u:o.call(i,p))!==b)break}catch(e){a=d,c=1,u=e}finally{s=1}}return{value:g,done:y}}),!0),r;function l(e,r){for(c=e,u=r,g=0;!y&&s&&!t&&g<f.length;g++){var t,n=f[g],o=p.p,i=n[2];3<e?(t=i===r)&&(u=n[(c=n[4])?5:c=3],n[4]=n[5]=d):n[0]<=o&&((t=e<2&&o<n[1])?(c=0,p.v=r,p.n=n[1]):o<i&&(t=e<3||n[0]>r||i<r)&&(n[4]=e,n[5]=r,p.n=i,c=0))}if(t||1<e)return b;throw y=!0,r}}var b={};function v(){}function o(){}function i(){}var g=Object.getPrototypeOf,e=[][r]?g(g([][r]())):(_regeneratorDefine2(g={},r,function(){return this}),g),a=i.prototype=v.prototype=Object.create(e);function c(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,_regeneratorDefine2(e,t,"GeneratorFunction")),e.prototype=Object.create(a),e}return _regeneratorDefine2(a,"constructor",o.prototype=i),_regeneratorDefine2(i,"constructor",o),_regeneratorDefine2(i,t,o.displayName="GeneratorFunction"),_regeneratorDefine2(a),_regeneratorDefine2(a,t,"Generator"),_regeneratorDefine2(a,r,function(){return this}),_regeneratorDefine2(a,"toString",function(){return"[object Generator]"}),(_regenerator=function(){return{w:n,m:c}})()}function _regeneratorDefine2(e,r,t,n){var
|
|
1
|
+
function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _regenerator(){var d,e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",t=e.toStringTag||"@@toStringTag";function n(e,r,t,n){var o,i,a,c,u,s,f,y,p,r=r&&r.prototype instanceof v?r:v,r=Object.create(r.prototype);return _regeneratorDefine2(r,"_invoke",(o=e,i=t,f=n||[],y=!1,p={p:s=0,n:0,v:d,a:l,f:l.bind(d,4),d:function(e,r){return a=e,c=0,u=d,p.n=r,b}},function(e,r,t){if(1<s)throw TypeError("Generator is already running");for(y&&1===r&&l(r,t),c=r,u=t;(g=c<2?d:u)||!y;){a||(c?c<3?(1<c&&(p.n=-1),l(c,u)):p.n=u:p.v=u);try{if(s=2,a){if(g=a[e=c?e:"next"]){if(!(g=g.call(a,u)))throw TypeError("iterator result is not an object");if(!g.done)return g;u=g.value,c<2&&(c=0)}else 1===c&&(g=a.return)&&g.call(a),c<2&&(u=TypeError("The iterator does not provide a '"+e+"' method"),c=1);a=d}else if((g=(y=p.n<0)?u:o.call(i,p))!==b)break}catch(e){a=d,c=1,u=e}finally{s=1}}return{value:g,done:y}}),!0),r;function l(e,r){for(c=e,u=r,g=0;!y&&s&&!t&&g<f.length;g++){var t,n=f[g],o=p.p,i=n[2];3<e?(t=i===r)&&(u=n[(c=n[4])?5:c=3],n[4]=n[5]=d):n[0]<=o&&((t=e<2&&o<n[1])?(c=0,p.v=r,p.n=n[1]):o<i&&(t=e<3||n[0]>r||i<r)&&(n[4]=e,n[5]=r,p.n=i,c=0))}if(t||1<e)return b;throw y=!0,r}}var b={};function v(){}function o(){}function i(){}var g=Object.getPrototypeOf,e=[][r]?g(g([][r]())):(_regeneratorDefine2(g={},r,function(){return this}),g),a=i.prototype=v.prototype=Object.create(e);function c(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,_regeneratorDefine2(e,t,"GeneratorFunction")),e.prototype=Object.create(a),e}return _regeneratorDefine2(a,"constructor",o.prototype=i),_regeneratorDefine2(i,"constructor",o),_regeneratorDefine2(i,t,o.displayName="GeneratorFunction"),_regeneratorDefine2(a),_regeneratorDefine2(a,t,"Generator"),_regeneratorDefine2(a,r,function(){return this}),_regeneratorDefine2(a,"toString",function(){return"[object Generator]"}),(_regenerator=function(){return{w:n,m:c}})()}function _regeneratorDefine2(e,r,t,n){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}(_regeneratorDefine2=function(e,r,t,n){function o(r,t){_regeneratorDefine2(e,r,function(e){return this._invoke(r,t,e)})}r?i?i(e,r,{value:t,enumerable:!n,configurable:!n,writable:!n}):e[r]=t:(o("next",0),o("throw",1),o("return",2))})(e,r,t,n)}function asyncGeneratorStep(e,r,t,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void t(e)}c.done?r(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(c){return function(){var e=this,a=arguments;return new Promise(function(r,t){var n=c.apply(e,a);function o(e){asyncGeneratorStep(n,r,t,o,i,"next",e)}function i(e){asyncGeneratorStep(n,r,t,o,i,"throw",e)}o(void 0)})}}function ownKeys(r,e){var t,n=Object.keys(r);return Object.getOwnPropertySymbols&&(t=Object.getOwnPropertySymbols(r),e&&(t=t.filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})),n.push.apply(n,t)),n}function _objectSpread(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(t),!0).forEach(function(e){_defineProperty(r,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e))})}return r}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:e+""}function _toPrimitive(e,r){if("object"!=_typeof(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0===t)return("string"===r?String:Number)(e);t=t.call(e,r||"default");if("object"!=_typeof(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}(()=>{e.$inject=["c8yDeviceTypeProtocolBaseProvider","gettext"];var t="c8yOPCUADevice";function e(e,c){r.$inject=["c8yDeviceDatabase","c8yDeviceControl","c8yDevices","c8yBase","c8yUser","c8yTenant","$q"];var u={label:c("OPC UA legacy"),fieldbusType:"opcua",serviceName:t};return e.getDeviceTypeProtocolProvider(u,r);function r(r,s,f,y,o,t,n){var i=_objectSpread(_objectSpread({},u),{},{options:!1,discreteOutputs:!1,discreteInputs:!1,holdingRegisters:{sectionTitle:c("Variables"),noRegistersDefinedMessage:c("No variables defined."),elementTypeLabel:c("Variable"),newRegisterModalTitle:c("New variable"),editRegisterModalTitle:c('Edit variable: "{{name}}"'),addRegisterButtonLabel:c("Add variable"),validation:{invalidName:c("Name must be unique among variables."),invalidMeasurement:c("Selected measurement type and series are already used by another variable.")},browsePath:!0,nodeType:!0,attributeType:!0,multiplier:{min:1,step:1},divisor:!0,decimalPlaces:!0,unit:!0,options:{signed:!0,enumType:!0},functionalities:{showStatus:!0,updateStatus:!0,sendMeasurement:!0,raiseAlarm:!0,sendEvent:!0}},inputRegisters:!1,deviceFragments:["c8y_OPCUADevice","c8y_OPCUAGateway"],deviceConfiguration:{fragment:"c8y_OPCUAGateway",icon:"cogs"}});return{registerFeaturesManifest:function(){r.registerFeaturesManifest((()=>{var e={isFeatureFieldbus4Subscribed:r.isFeatureFieldbus4Available(),isOpcuaLegacySubscribed:t.isSubscribed({name:"feature-opcua-legacy"})};return n.all(e).then(function(e){return e.isFeatureFieldbus4Subscribed&&e.isOpcuaLegacySubscribed})})().then(function(e){return e&&i}))},create:function(e,r){return a.apply(this,arguments)},isOpcua:function(e){return!!(e||{}).c8y_OPCUADevice}};function a(){return(a=_asyncToGenerator(_regenerator().m(function e(o,i){var a,c,u;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,function(){return p.apply(this,arguments)}(o,i);case 1:return u=e.v,c=y,e.n=2,f.createConfirm(u);case 2:return u=e.v,a=c.getResData.call(c,u),e.n=3,f.addChildDevice(o,a);case 3:return a.owner=o.owner,e.n=4,f.save(a);case 4:return e.a(2,s.create((r=o,t=i.deviceType,n=a,{deviceId:r.id,description:'Added new child device to "'.concat(r.name,'" (ID: ').concat(r.id,")."),c8y_OPCUADevice:{id:n.id,name:n.name,browsePath:n.c8y_OPCUADevice.browsePath,type:"/inventory/managedObjects/".concat(t.id)}})))}var r,t,n},e)}))).apply(this,arguments)}function p(){return(p=_asyncToGenerator(_regenerator().m(function e(r,t){var n;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,o.current();case 1:return n=e.v,e.a(2,{name:t.name,type:t.deviceType.name,c8y_OPCUADevice:{browsePath:t.directoryPath,type:"/inventory/managedObjects/".concat(t.deviceType.id)},owner:n.id})}},e)}))).apply(this,arguments)}}}angular.module("c8y.opcua").provider(t,e)})();
|