├── .github └── workflows │ └── run_test_cases.yaml ├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── etc └── emqx_dashboard.conf ├── include └── emqx_dashboard.hrl ├── priv ├── emqx_dashboard.schema └── www │ ├── index.html │ └── static │ ├── css │ ├── app.1495f134b9420661c25a03fc6be1c155.css │ ├── font-awesome.min.css │ ├── iconfont.css │ ├── iconfont.eot │ ├── iconfont.js │ ├── iconfont.svg │ ├── iconfont.ttf │ ├── iconfont.woff │ └── iconfont.woff2 │ ├── editor.worker.js │ ├── emq.ico │ ├── fonts │ ├── FontAwesome.otf │ ├── Roboto-Bold.ttf │ ├── Roboto-Bold.woff │ ├── Roboto-Bold.woff2 │ ├── Roboto-Light.ttf │ ├── Roboto-Light.woff │ ├── Roboto-Light.woff2 │ ├── Roboto-Thin.ttf │ ├── Roboto-Thin.woff │ ├── Roboto-Thin.woff2 │ ├── Roboto.eot │ ├── Roboto.svg │ ├── Roboto.ttf │ ├── Roboto.woff │ ├── Roboto.woff2 │ ├── element-icons.535877f.woff │ ├── element-icons.732389d.ttf │ ├── fontawesome-webfont.eot │ ├── fontawesome-webfont.svg │ ├── fontawesome-webfont.ttf │ ├── fontawesome-webfont.woff │ └── fontawesome-webfont.woff2 │ ├── js │ ├── 0.458e235652f441d80a9c.js │ ├── 1.fcd6fde8b053e80bc68f.js │ ├── 10.188c5e479f887d471dde.js │ ├── 11.3861aeb3036b8f41a6e8.js │ ├── 12.43feccc8f1584bdba5c2.js │ ├── 13.026a13a2a59abd354bd5.js │ ├── 14.0342a1a3d29f1adca947.js │ ├── 15.7d11711536eb5b2ca561.js │ ├── 16.6bfd6f3eb9216e73149c.js │ ├── 17.1d56280c16e6e2b81cff.js │ ├── 18.a0c394cb4b55bee2fa82.js │ ├── 19.060521bb4ba4f7a81ac0.js │ ├── 2.5614afeac7cc102296d5.js │ ├── 20.cfbe25ea4f291dbd6a65.js │ ├── 21.ee73105c2358fad5412c.js │ ├── 22.11a12a03cd65b7eb6d44.js │ ├── 25.8b2dccd8a7e1f91a5040.js │ ├── 26.9cd922cc7e5d035cbcc7.js │ ├── 3.b04827f9f49e3488c55c.js │ ├── 4.93d4473fcf7768693652.js │ ├── 5.fd6d6064dfffa65ef079.js │ ├── 6.ef8e6aa7a51fa7564f71.js │ ├── 7.92a348a80764134ff2a9.js │ ├── 8.bbf3abbfd9e1d74d844e.js │ ├── 9.473ceac05f7dfe3f3e92.js │ ├── app.89a3e38c9ff09e717e6c.js │ ├── base64.min.js │ ├── env.js │ ├── manifest.f72a5c400fac2e53484f.js │ ├── upgrade.js │ └── vendor.7837b8f015b7d486b74f.js │ └── json.worker.js ├── rebar.config ├── rebar.config.script ├── src ├── emqx_dashboard.app.src ├── emqx_dashboard.app.src.script ├── emqx_dashboard.appup.src ├── emqx_dashboard.erl ├── emqx_dashboard_admin.erl ├── emqx_dashboard_api.erl ├── emqx_dashboard_app.erl ├── emqx_dashboard_cli.erl └── emqx_dashboard_sup.erl └── test ├── .placeholder └── emqx_dashboard_SUITE.erl /.github/workflows/run_test_cases.yaml: -------------------------------------------------------------------------------- 1 | name: Run test cases 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | run_test_cases: 7 | runs-on: ubuntu-latest 8 | 9 | container: 10 | image: erlang:22.1 11 | 12 | steps: 13 | - uses: actions/checkout@v1 14 | - name: run test cases 15 | run: | 16 | make xref 17 | make eunit 18 | make ct 19 | make cover 20 | - uses: actions/upload-artifact@v1 21 | if: always() 22 | with: 23 | name: logs 24 | path: _build/test/logs 25 | - uses: actions/upload-artifact@v1 26 | with: 27 | name: cover 28 | path: _build/test/cover 29 | 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .eunit 2 | deps 3 | *.o 4 | *.beam 5 | *.plt 6 | erl_crash.dump 7 | ebin 8 | rel/example_project 9 | .concrete/DEV_MODE 10 | .rebar 11 | .erlang.mk/ 12 | ct.coverdata 13 | logs/ 14 | test/ct.cover.spec 15 | data/ 16 | .DS_Store 17 | emqx_dashboard.d 18 | cover/ 19 | eunit.coverdata 20 | .DS_Store 21 | erlang.mk 22 | rebar.lock 23 | _build/ 24 | *.conf.rendered 25 | .rebar3/ 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | ## shallow clone for speed 2 | 3 | REBAR_GIT_CLONE_OPTIONS += --depth 1 4 | export REBAR_GIT_CLONE_OPTIONS 5 | 6 | REBAR = rebar3 7 | all: compile 8 | 9 | compile: 10 | $(REBAR) compile 11 | 12 | clean: distclean 13 | 14 | ct: compile 15 | $(REBAR) as test ct -v 16 | 17 | eunit: compile 18 | $(REBAR) as test eunit 19 | 20 | xref: 21 | $(REBAR) xref 22 | 23 | cover: 24 | $(REBAR) cover 25 | 26 | distclean: 27 | @rm -rf _build 28 | @rm -f data/app.*.config data/vm.*.args rebar.lock 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | emqx-dashboard 3 | ============== 4 | 5 | Dashboard for the EMQX Broker. 6 | 7 | REST API 8 | -------- 9 | 10 | The prefix of REST API is '/api/v4/'. 11 | 12 | Method | Path | Description 13 | -------|---------------------------------------|------------------------------------ 14 | GET | /nodes/ | A list of nodes in the cluster 15 | GET | /nodes/:node | Lookup a node in the cluster 16 | GET | /brokers/ | A list of brokers in the cluster 17 | GET | /brokers/:node | Get broker info of a node 18 | GET | /metrics/ | A list of metrics of all nodes in the cluster 19 | GET | /nodes/:node/metrics/ | A list of metrics of a node 20 | GET | /stats/ | A list of stats of all nodes in the cluster 21 | GET | /nodes/:node/stats/ | A list of stats of a node 22 | GET | /nodes/:node/clients/ | A list of clients on a node 23 | GET | /listeners/ | A list of listeners in the cluster 24 | GET | /nodes/:node/listeners | A list of listeners on the node 25 | GET | /nodes/:node/sessions/ | A list of sessions on a node 26 | GET | /subscriptions/:clientid | A list of subscriptions of a client 27 | GET | /nodes/:node/subscriptions/:clientid | A list of subscriptions of a client on the node 28 | GET | /nodes/:node/subscriptions/ | A list of subscriptions on a node 29 | PUT | /clients/:clientid/clean_acl_cache | Clean ACL cache of a client 30 | GET | /configs/ | Get all configs 31 | GET | /nodes/:node/configs/ | Get all configs of a node 32 | GET | /nodes/:node/plugin_configs/:plugin | Get configurations of a plugin on the node 33 | DELETE | /clients/:clientid | Kick out a client 34 | GET | /alarms/:node | List alarms of a node 35 | GET | /alarms/ | List all alarms 36 | GET | /plugins/ | List all plugins in the cluster 37 | GET | /nodes/:node/plugins/ | List all plugins on a node 38 | GET | /routes/ | List routes 39 | POST | /nodes/:node/plugins/:plugin/load | Load a plugin 40 | GET | /clients/:clientid | Lookup a client in the cluster 41 | GET | nodes/:node/clients/:clientid | Lookup a client on node 42 | GET | nodes/:node/sessions/:clientid | Lookup a session in the cluster 43 | GET | nodes/:node/sessions/:clientid | Lookup a session on the node 44 | POST | /mqtt/publish | Publish a MQTT message 45 | POST | /mqtt/subscribe | Subscribe a topic 46 | POST | /nodes/:node/plugins/:plugin/unload | Unload a plugin 47 | POST | /mqtt/unsubscribe | Unsubscribe a topic 48 | PUT | /configs/:app | Update config of an application in the cluster 49 | PUT | /nodes/:node/configs/:app | Update config of an application on a node 50 | PUT | /nodes/:node/plugin_configs/:plugin | Update configurations of a plugin on the node 51 | 52 | Build 53 | ----- 54 | 55 | make && make ct 56 | 57 | Configurtion 58 | ------------ 59 | 60 | ``` 61 | dashboard.listener = 18083 62 | 63 | dashboard.listener.acceptors = 2 64 | 65 | dashboard.listener.max_clients = 512 66 | ``` 67 | 68 | Load Plugin 69 | ----------- 70 | 71 | ``` 72 | ./bin/emqx_ctl plugins load emqx_dashboard 73 | ``` 74 | 75 | Login 76 | ----- 77 | 78 | URL: http://localhost:18083 79 | 80 | Username: admin 81 | 82 | Password: public 83 | 84 | License 85 | ------- 86 | 87 | Apache License Version 2.0 88 | 89 | -------------------------------------------------------------------------------- /etc/emqx_dashboard.conf: -------------------------------------------------------------------------------- 1 | ##-------------------------------------------------------------------- 2 | ## EMQX Dashboard 3 | ##-------------------------------------------------------------------- 4 | 5 | ## Default user's login name. 6 | ## 7 | ## Value: String 8 | dashboard.default_user.login = admin 9 | 10 | ## Default user's password. 11 | ## 12 | ## Value: String 13 | dashboard.default_user.password = public 14 | 15 | ##-------------------------------------------------------------------- 16 | ## HTTP Listener 17 | 18 | ## The port that the Dashboard HTTP listener will bind. 19 | ## 20 | ## Value: Port 21 | ## 22 | ## Examples: 18083 23 | dashboard.listener.http = 18083 24 | 25 | ## The acceptor pool for external Dashboard HTTP listener. 26 | ## 27 | ## Value: Number 28 | dashboard.listener.http.acceptors = 4 29 | 30 | ## Maximum number of concurrent Dashboard HTTP connections. 31 | ## 32 | ## Value: Number 33 | dashboard.listener.http.max_clients = 512 34 | 35 | ## Set up the socket for IPv6. 36 | ## 37 | ## Value: false | true 38 | dashboard.listener.http.inet6 = false 39 | 40 | ## Listen on IPv4 and IPv6 (false) or only on IPv6 (true). Use with inet6. 41 | ## 42 | ## Value: false | true 43 | dashboard.listener.http.ipv6_v6only = false 44 | 45 | ##-------------------------------------------------------------------- 46 | ## HTTPS Listener 47 | 48 | ## The port that the Dashboard HTTPS listener will bind. 49 | ## 50 | ## Value: Port 51 | ## 52 | ## Examples: 18084 53 | ## dashboard.listener.https = 18084 54 | 55 | ## The acceptor pool for external Dashboard HTTPS listener. 56 | ## 57 | ## Value: Number 58 | ## dashboard.listener.https.acceptors = 2 59 | 60 | ## Maximum number of concurrent Dashboard HTTPS connections. 61 | ## 62 | ## Value: Number 63 | ## dashboard.listener.https.max_clients = 512 64 | 65 | ## Set up the socket for IPv6. 66 | ## 67 | ## Value: false | true 68 | ## dashboard.listener.https.inet6 = false 69 | 70 | ## Listen on IPv4 and IPv6 (false) or only on IPv6 (true). Use with inet6. 71 | ## 72 | ## Value: false | true 73 | ## dashboard.listener.https.ipv6_v6only = false 74 | 75 | ## Path to the file containing the user's private PEM-encoded key. 76 | ## 77 | ## Value: File 78 | ## dashboard.listener.https.keyfile = etc/certs/key.pem 79 | 80 | ## Path to a file containing the user certificate. 81 | ## 82 | ## Value: File 83 | ## dashboard.listener.https.certfile = etc/certs/cert.pem 84 | 85 | ## Path to the file containing PEM-encoded CA certificates. 86 | ## 87 | ## Value: File 88 | ## dashboard.listener.https.cacertfile = etc/certs/cacert.pem 89 | 90 | ## See: 'listener.ssl..dhfile' in emq.conf 91 | ## 92 | ## Value: File 93 | ## dashboard.listener.https.dhfile = {{ platform_etc_dir }}/certs/dh-params.pem 94 | 95 | ## See: 'listener.ssl..vefify' in emq.conf 96 | ## 97 | ## Value: vefify_peer | verify_none 98 | ## dashboard.listener.https.verify = verify_peer 99 | 100 | ## See: 'listener.ssl..fail_if_no_peer_cert' in emq.conf 101 | ## 102 | ## Value: false | true 103 | ## dashboard.listener.https.fail_if_no_peer_cert = true 104 | 105 | ## TLS versions only to protect from POODLE attack. 106 | ## 107 | ## Value: String, seperated by ',' 108 | ## dashboard.listener.https.tls_versions = tlsv1.2,tlsv1.1,tlsv1 109 | 110 | ## See: 'listener.ssl..ciphers' in emq.conf 111 | ## 112 | ## Value: Ciphers 113 | ## dashboard.listener.https.ciphers = ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-GCM-SHA384,ECDHE-ECDSA-AES256-SHA384,ECDHE-RSA-AES256-SHA384,ECDHE-ECDSA-DES-CBC3-SHA,ECDH-ECDSA-AES256-GCM-SHA384,ECDH-RSA-AES256-GCM-SHA384,ECDH-ECDSA-AES256-SHA384,ECDH-RSA-AES256-SHA384,DHE-DSS-AES256-GCM-SHA384,DHE-DSS-AES256-SHA256,AES256-GCM-SHA384,AES256-SHA256,ECDHE-ECDSA-AES128-GCM-SHA256,ECDHE-RSA-AES128-GCM-SHA256,ECDHE-ECDSA-AES128-SHA256,ECDHE-RSA-AES128-SHA256,ECDH-ECDSA-AES128-GCM-SHA256,ECDH-RSA-AES128-GCM-SHA256,ECDH-ECDSA-AES128-SHA256,ECDH-RSA-AES128-SHA256,DHE-DSS-AES128-GCM-SHA256,DHE-DSS-AES128-SHA256,AES128-GCM-SHA256,AES128-SHA256,ECDHE-ECDSA-AES256-SHA,ECDHE-RSA-AES256-SHA,DHE-DSS-AES256-SHA,ECDH-ECDSA-AES256-SHA,ECDH-RSA-AES256-SHA,AES256-SHA,ECDHE-ECDSA-AES128-SHA,ECDHE-RSA-AES128-SHA,DHE-DSS-AES128-SHA,ECDH-ECDSA-AES128-SHA,ECDH-RSA-AES128-SHA,AES128-SHA 114 | 115 | ## See: 'listener.ssl..secure_renegotiate' in emq.conf 116 | ## 117 | ## Value: on | off 118 | ## dashboard.listener.https.secure_renegotiate = off 119 | 120 | ## See: 'listener.ssl..reuse_sessions' in emq.conf 121 | ## 122 | ## Value: on | off 123 | ## dashboard.listener.https.reuse_sessions = on 124 | 125 | ## See: 'listener.ssl..honor_cipher_order' in emq.conf 126 | ## 127 | ## Value: on | off 128 | ## dashboard.listener.https.honor_cipher_order = on 129 | 130 | -------------------------------------------------------------------------------- /include/emqx_dashboard.hrl: -------------------------------------------------------------------------------- 1 | %%-------------------------------------------------------------------- 2 | %% Copyright (c) 2020 EMQ Technologies Co., Ltd. All Rights Reserved. 3 | %% 4 | %% Licensed under the Apache License, Version 2.0 (the "License"); 5 | %% you may not use this file except in compliance with the License. 6 | %% You may obtain a copy of the License at 7 | %% 8 | %% http://www.apache.org/licenses/LICENSE-2.0 9 | %% 10 | %% Unless required by applicable law or agreed to in writing, software 11 | %% distributed under the License is distributed on an "AS IS" BASIS, 12 | %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | %% See the License for the specific language governing permissions and 14 | %% limitations under the License. 15 | %%-------------------------------------------------------------------- 16 | 17 | -record(mqtt_admin, {username, password, tags}). 18 | 19 | -type(mqtt_admin() :: #mqtt_admin{}). 20 | 21 | -define(EMPTY_KEY(Key), ((Key == undefined) orelse (Key == <<>>))). 22 | -------------------------------------------------------------------------------- /priv/emqx_dashboard.schema: -------------------------------------------------------------------------------- 1 | %%-*- mode: erlang -*- 2 | %% emqx_dashboard config mapping 3 | 4 | {mapping, "dashboard.default_user.login", "emqx_dashboard.default_user_username", [ 5 | {datatype, string} 6 | ]}. 7 | 8 | {mapping, "dashboard.default_user.password", "emqx_dashboard.default_user_passwd", [ 9 | {datatype, string} 10 | ]}. 11 | 12 | {mapping, "dashboard.listener.http", "emqx_dashboard.listeners", [ 13 | {datatype, integer} 14 | ]}. 15 | 16 | {mapping, "dashboard.listener.http.acceptors", "emqx_dashboard.listeners", [ 17 | {default, 4}, 18 | {datatype, integer} 19 | ]}. 20 | 21 | {mapping, "dashboard.listener.http.max_clients", "emqx_dashboard.listeners", [ 22 | {default, 512}, 23 | {datatype, integer} 24 | ]}. 25 | 26 | {mapping, "dashboard.listener.http.access.$id", "emqx_dashboard.listeners", [ 27 | {datatype, string} 28 | ]}. 29 | 30 | {mapping, "dashboard.listener.http.inet6", "emqx_dashboard.listeners", [ 31 | {default, false}, 32 | {datatype, {enum, [true, false]}} 33 | ]}. 34 | 35 | {mapping, "dashboard.listener.http.ipv6_v6only", "emqx_dashboard.listeners", [ 36 | {default, false}, 37 | {datatype, {enum, [true, false]}} 38 | ]}. 39 | 40 | {mapping, "dashboard.listener.https", "emqx_dashboard.listeners", [ 41 | {datatype, integer} 42 | ]}. 43 | 44 | {mapping, "dashboard.listener.https.acceptors", "emqx_dashboard.listeners", [ 45 | {default, 8}, 46 | {datatype, integer} 47 | ]}. 48 | 49 | {mapping, "dashboard.listener.https.max_clients", "emqx_dashboard.listeners", [ 50 | {default, 64}, 51 | {datatype, integer} 52 | ]}. 53 | 54 | {mapping, "dashboard.listener.https.inet6", "emqx_dashboard.listeners", [ 55 | {default, false}, 56 | {datatype, {enum, [true, false]}} 57 | ]}. 58 | 59 | {mapping, "dashboard.listener.https.ipv6_v6only", "emqx_dashboard.listeners", [ 60 | {default, false}, 61 | {datatype, {enum, [true, false]}} 62 | ]}. 63 | 64 | {mapping, "dashboard.listener.https.tls_versions", "emqx_dashboard.listeners", [ 65 | {datatype, string} 66 | ]}. 67 | 68 | {mapping, "dashboard.listener.https.dhfile", "emqx_dashboard.listeners", [ 69 | {datatype, string} 70 | ]}. 71 | 72 | {mapping, "dashboard.listener.https.keyfile", "emqx_dashboard.listeners", [ 73 | {datatype, string} 74 | ]}. 75 | 76 | {mapping, "dashboard.listener.https.certfile", "emqx_dashboard.listeners", [ 77 | {datatype, string} 78 | ]}. 79 | 80 | {mapping, "dashboard.listener.https.cacertfile", "emqx_dashboard.listeners", [ 81 | {datatype, string} 82 | ]}. 83 | 84 | {mapping, "dashboard.listener.https.verify", "emqx_dashboard.listeners", [ 85 | {datatype, atom} 86 | ]}. 87 | 88 | {mapping, "dashboard.listener.https.fail_if_no_peer_cert", "emqx_dashboard.listeners", [ 89 | {datatype, {enum, [true, false]}} 90 | ]}. 91 | 92 | {mapping, "dashboard.listener.https.ciphers", "emqx_dashboard.listeners", [ 93 | {datatype, string} 94 | ]}. 95 | 96 | {mapping, "dashboard.listener.https.secure_renegotiate", "emqx_dashboard.listeners", [ 97 | {datatype, flag} 98 | ]}. 99 | 100 | {mapping, "dashboard.listener.https.reuse_sessions", "emqx_dashboard.listeners", [ 101 | {default, on}, 102 | {datatype, flag} 103 | ]}. 104 | 105 | {mapping, "dashboard.listener.https.honor_cipher_order", "emqx_dashboard.listeners", [ 106 | {datatype, flag} 107 | ]}. 108 | 109 | {translation, "emqx_dashboard.listeners", fun(Conf) -> 110 | Filter = fun(Opts) -> [{K, V} || {K, V} <- Opts, V =/= undefined] end, 111 | LisOpts = fun(Prefix) -> 112 | Filter([{num_acceptors, cuttlefish:conf_get(Prefix ++ ".acceptors", Conf)}, 113 | {max_connections, cuttlefish:conf_get(Prefix ++ ".max_clients", Conf)}, 114 | {inet6, cuttlefish:conf_get(Prefix ++ ".inet6", Conf)}, 115 | {ipv6_v6only, cuttlefish:conf_get(Prefix ++ ".ipv6_v6only", Conf)}]) 116 | end, 117 | 118 | SplitFun = fun(undefined) -> undefined; (S) -> string:tokens(S, ",") end, 119 | 120 | SslOpts = fun(Prefix) -> 121 | Versions = case SplitFun(cuttlefish:conf_get(Prefix ++ ".tls_versions", Conf, undefined)) of 122 | undefined -> undefined; 123 | L -> [list_to_atom(V) || V <- L] 124 | end, 125 | Filter([{versions, Versions}, 126 | {ciphers, SplitFun(cuttlefish:conf_get(Prefix ++ ".ciphers", Conf, undefined))}, 127 | {dhfile, cuttlefish:conf_get(Prefix ++ ".dhfile", Conf, undefined)}, 128 | {keyfile, cuttlefish:conf_get(Prefix ++ ".keyfile", Conf, undefined)}, 129 | {certfile, cuttlefish:conf_get(Prefix ++ ".certfile", Conf, undefined)}, 130 | {cacertfile, cuttlefish:conf_get(Prefix ++ ".cacertfile", Conf, undefined)}, 131 | {verify, cuttlefish:conf_get(Prefix ++ ".verify", Conf, undefined)}, 132 | {fail_if_no_peer_cert, cuttlefish:conf_get(Prefix ++ ".fail_if_no_peer_cert", Conf, undefined)}, 133 | {secure_renegotiate, cuttlefish:conf_get(Prefix ++ ".secure_renegotiate", Conf, undefined)}, 134 | {reuse_sessions, cuttlefish:conf_get(Prefix ++ ".reuse_sessions", Conf, undefined)}, 135 | {honor_cipher_order, cuttlefish:conf_get(Prefix ++ ".honor_cipher_order", Conf, undefined)}]) 136 | end, 137 | lists:append( 138 | lists:map( 139 | fun(Proto) -> 140 | Prefix = "dashboard.listener." ++ atom_to_list(Proto), 141 | case cuttlefish:conf_get(Prefix, Conf, undefined) of 142 | undefined -> []; 143 | Port -> 144 | [{Proto, Port, case Proto of 145 | http -> LisOpts(Prefix); 146 | https -> LisOpts(Prefix) ++ SslOpts(Prefix) 147 | end}] 148 | end 149 | end, [http, https])) 150 | end}. 151 | -------------------------------------------------------------------------------- /priv/www/index.html: -------------------------------------------------------------------------------- 1 | Dashboard
-------------------------------------------------------------------------------- /priv/www/static/css/iconfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/emqx-dashboard/69f0e1de3eb45517d0bbb22489433c307ac156a9/priv/www/static/css/iconfont.eot -------------------------------------------------------------------------------- /priv/www/static/css/iconfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/emqx-dashboard/69f0e1de3eb45517d0bbb22489433c307ac156a9/priv/www/static/css/iconfont.ttf -------------------------------------------------------------------------------- /priv/www/static/css/iconfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/emqx-dashboard/69f0e1de3eb45517d0bbb22489433c307ac156a9/priv/www/static/css/iconfont.woff -------------------------------------------------------------------------------- /priv/www/static/css/iconfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/emqx-dashboard/69f0e1de3eb45517d0bbb22489433c307ac156a9/priv/www/static/css/iconfont.woff2 -------------------------------------------------------------------------------- /priv/www/static/emq.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/emqx-dashboard/69f0e1de3eb45517d0bbb22489433c307ac156a9/priv/www/static/emq.ico -------------------------------------------------------------------------------- /priv/www/static/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/emqx-dashboard/69f0e1de3eb45517d0bbb22489433c307ac156a9/priv/www/static/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /priv/www/static/fonts/Roboto-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/emqx-dashboard/69f0e1de3eb45517d0bbb22489433c307ac156a9/priv/www/static/fonts/Roboto-Bold.ttf -------------------------------------------------------------------------------- /priv/www/static/fonts/Roboto-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/emqx-dashboard/69f0e1de3eb45517d0bbb22489433c307ac156a9/priv/www/static/fonts/Roboto-Bold.woff -------------------------------------------------------------------------------- /priv/www/static/fonts/Roboto-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/emqx-dashboard/69f0e1de3eb45517d0bbb22489433c307ac156a9/priv/www/static/fonts/Roboto-Bold.woff2 -------------------------------------------------------------------------------- /priv/www/static/fonts/Roboto-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/emqx-dashboard/69f0e1de3eb45517d0bbb22489433c307ac156a9/priv/www/static/fonts/Roboto-Light.ttf -------------------------------------------------------------------------------- /priv/www/static/fonts/Roboto-Light.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/emqx-dashboard/69f0e1de3eb45517d0bbb22489433c307ac156a9/priv/www/static/fonts/Roboto-Light.woff -------------------------------------------------------------------------------- /priv/www/static/fonts/Roboto-Light.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/emqx-dashboard/69f0e1de3eb45517d0bbb22489433c307ac156a9/priv/www/static/fonts/Roboto-Light.woff2 -------------------------------------------------------------------------------- /priv/www/static/fonts/Roboto-Thin.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/emqx-dashboard/69f0e1de3eb45517d0bbb22489433c307ac156a9/priv/www/static/fonts/Roboto-Thin.ttf -------------------------------------------------------------------------------- /priv/www/static/fonts/Roboto-Thin.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/emqx-dashboard/69f0e1de3eb45517d0bbb22489433c307ac156a9/priv/www/static/fonts/Roboto-Thin.woff -------------------------------------------------------------------------------- /priv/www/static/fonts/Roboto-Thin.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/emqx-dashboard/69f0e1de3eb45517d0bbb22489433c307ac156a9/priv/www/static/fonts/Roboto-Thin.woff2 -------------------------------------------------------------------------------- /priv/www/static/fonts/Roboto.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/emqx-dashboard/69f0e1de3eb45517d0bbb22489433c307ac156a9/priv/www/static/fonts/Roboto.eot -------------------------------------------------------------------------------- /priv/www/static/fonts/Roboto.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/emqx-dashboard/69f0e1de3eb45517d0bbb22489433c307ac156a9/priv/www/static/fonts/Roboto.ttf -------------------------------------------------------------------------------- /priv/www/static/fonts/Roboto.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/emqx-dashboard/69f0e1de3eb45517d0bbb22489433c307ac156a9/priv/www/static/fonts/Roboto.woff -------------------------------------------------------------------------------- /priv/www/static/fonts/Roboto.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/emqx-dashboard/69f0e1de3eb45517d0bbb22489433c307ac156a9/priv/www/static/fonts/Roboto.woff2 -------------------------------------------------------------------------------- /priv/www/static/fonts/element-icons.535877f.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/emqx-dashboard/69f0e1de3eb45517d0bbb22489433c307ac156a9/priv/www/static/fonts/element-icons.535877f.woff -------------------------------------------------------------------------------- /priv/www/static/fonts/element-icons.732389d.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/emqx-dashboard/69f0e1de3eb45517d0bbb22489433c307ac156a9/priv/www/static/fonts/element-icons.732389d.ttf -------------------------------------------------------------------------------- /priv/www/static/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/emqx-dashboard/69f0e1de3eb45517d0bbb22489433c307ac156a9/priv/www/static/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /priv/www/static/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/emqx-dashboard/69f0e1de3eb45517d0bbb22489433c307ac156a9/priv/www/static/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /priv/www/static/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/emqx-dashboard/69f0e1de3eb45517d0bbb22489433c307ac156a9/priv/www/static/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /priv/www/static/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/emqx-dashboard/69f0e1de3eb45517d0bbb22489433c307ac156a9/priv/www/static/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /priv/www/static/js/1.fcd6fde8b053e80bc68f.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([1],{g2pX:function(e,t){},zXyA:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=a("Dd8w"),i=a.n(s),l=a("zL8q"),n=a("NYxO"),o={name:"data-view",components:{"el-pagination":l.Pagination,"el-input":l.Input,"el-select":l.Select,"el-option":l.Option,"el-table":l.Table,"el-table-column":l.TableColumn,"el-date-picker":l.DatePicker},data:function(){return{searchView:!1,cluster:!1,popoverVisible:!1,count:0,hasnext:!1,params:{_page:1,_limit:10},nodeName:"",nodes:[],activeTab:"clients",searchKey:"",searchValue:"",searchPlaceholder:this.$t("clients.clientId"),clients:[],fuzzyParams:{comparator:"_gte",match:"_match_topic"},topics:[],subscriptions:[],showMoreQuery:!1,protoNames:["MQTT","MQTT-SN","CoAP","LwM2M"]}},watch:{$route:"init",activeTab:function(){this.fuzzyParams={comparator:"_gte",match:"_match_topic"}}},computed:{iconStatus:function(){return this.searchView?"el-icon-close":"el-icon-search"}},methods:i()({},Object(n.b)(["CURRENT_NODE"]),{stashNode:function(){this.cluster="cluster"===this.nodeName,this.cluster||this.CURRENT_NODE(this.nodeName)},init:function(){switch(this.activeTab=this.$route.path.split("/")[1],this.params._page=1,this.activeTab){case"topics":this.searchPlaceholder="Topic";break;default:this.searchPlaceholder=this.$t("clients.clientId")}this.loadData()},loadData:function(){var e=this;this.searchValue="",this.$httpGet("/nodes").then(function(t){var a=e.$store.state.nodeName||t.data[0].node;e.nodeName=e.cluster?"cluster":a,e.nodes=t.data,e.loadChild()}).catch(function(t){e.$message.error(t||e.$t("error.networkError"))})},loadChild:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.stashNode(),this.searchView=!1,this.searchValue="",!0===t&&(this.params._page=1),this.nodeName||"topics"===this.activeTab){var s="/nodes/"+this.nodeName+"/"+this.activeTab;("topics"===this.activeTab||this.cluster)&&(s="topics"===this.activeTab?"routes":this.activeTab);var l={};l=a?i()({},a,this.params):i()({},this.params),this.$httpGet(s,l).then(function(t){e[e.activeTab]=t.data.items,e.count=t.data.meta.count||0,e.hasnext=t.data.meta.hasnext}).catch(function(t){e.$message.error(t||e.$t("error.networkError"))})}},searchChild:function(){var e=this;if(this.searchView)this.loadChild();else if(this.searchValue){var t="/nodes/"+this.nodeName+"/"+this.activeTab+"/"+encodeURIComponent(this.searchValue);if("topics"===this.activeTab||this.cluster)t="/"+("topics"===this.activeTab?"routes":this.activeTab)+"/"+encodeURIComponent(this.searchValue);this.$httpGet(t).then(function(t){e.count=0,e.params={_page:1,_limit:10},e.searchView=!0,e[e.activeTab]=t.data}).catch(function(t){e.$message.error(t||e.$t("error.networkError"))})}else this.loadData()},handleSizeChange:function(e){this.params._limit=e,this.loadChild(!0)},handlePrevClick:function(){if(1!==this.params._page){this.params._page-=1;var e=this.genQueryParams(this.fuzzyParams);this.loadChild(!1,e)}},handleNextClick:function(){if(this.hasnext){this.params._page+=1;var e=this.genQueryParams(this.fuzzyParams);this.loadChild(!1,e)}},handleDisconnect:function(e,t,a){var s=this;this.$httpDelete("/clients/"+encodeURIComponent(e.clientid)).then(function(){s.loadData(),a.$refs["popover-"+t].doClose()}).catch(function(e){s.$message.error(e||s.$t("error.networkError"))})},genQueryParams:function(e){var t={};if("clients"===this.activeTab){var a=e._like_clientid,s=e._like_username,i=e.ip_address,l=e.conn_state,n=e.proto_name,o=e.comparator,r=e._connected_at;if(t={_like_clientid:a||void 0,_like_username:s||void 0,ip_address:i||void 0,conn_state:l||void 0,proto_name:n||void 0},r)t[o+"_connected_at"]=Math.floor(r/1e3)}else if("subscriptions"===this.activeTab){var c=e._like_clientid,p=e.topic,u=e.qos,d=e.share,m=e.match;t={clientid:c||void 0,qos:""===u?void 0:u,share:d||void 0},p&&(t[m]=p)}return t},clientQuerySearch:function(){var e=this.genQueryParams(this.fuzzyParams);this.loadChild(!0,e)},resetClientQuerySearch:function(){this.fuzzyParams={comparator:">=",match:"_match_topic"},this.init()}}),created:function(){this.init()}},r={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"data-view"},[a("div",{staticClass:"page-title"},[e._v("\n "+e._s(e.$t("leftbar."+e.activeTab))+"\n "),a("div",{staticStyle:{float:"right"},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.searchChild(t)}}},["topics"!==e.activeTab?a("el-select",{staticClass:"select-radius",attrs:{placeholder:e.$t("select.placeholder"),disabled:e.$store.state.loading},on:{change:function(t){return e.loadChild(!0)}},model:{value:e.nodeName,callback:function(t){e.nodeName=t},expression:"nodeName"}},e._l(e.nodes,function(e){return a("el-option",{key:e.node,attrs:{label:e.node,value:e.node}})}),1):e._e()],1)]),e._v(" "),"topics"!==e.activeTab?a("el-card",{staticClass:"el-card--self search-card"},[a("el-form",{ref:"fuzzyParams",attrs:{model:e.fuzzyParams,"label-position":"left","label-width":"110px"}},[a("el-row",{attrs:{gutter:20}},[a("el-col",{attrs:{span:8}},[a("el-form-item",{attrs:{label:e.$t("clients.clientId")}},[a("el-input",{attrs:{type:"text",size:"small"},model:{value:e.fuzzyParams._like_clientid,callback:function(t){e.$set(e.fuzzyParams,"_like_clientid",t)},expression:"fuzzyParams._like_clientid"}})],1)],1),e._v(" "),"clients"===e.activeTab?a("el-col",{attrs:{span:8}},[a("el-form-item",{attrs:{label:e.$t("clients.username")}},[a("el-input",{attrs:{type:"text",size:"small"},model:{value:e.fuzzyParams._like_username,callback:function(t){e.$set(e.fuzzyParams,"_like_username",t)},expression:"fuzzyParams._like_username"}})],1)],1):"subscriptions"===e.activeTab?a("el-col",{attrs:{span:8}},[a("el-form-item",{attrs:{label:e.$t("topics.topic")}},[a("el-row",{staticClass:"form-item-row"},[a("el-col",{attrs:{span:9}},[a("el-select",{staticClass:"match",model:{value:e.fuzzyParams.match,callback:function(t){e.$set(e.fuzzyParams,"match",t)},expression:"fuzzyParams.match"}},[a("el-option",{attrs:{label:"filter",value:"_match_topic"}}),e._v(" "),a("el-option",{attrs:{label:"topic",value:"topic"}})],1)],1),e._v(" "),a("el-col",{attrs:{span:15}},[a("el-input",{attrs:{type:"text",size:"small"},model:{value:e.fuzzyParams.topic,callback:function(t){e.$set(e.fuzzyParams,"topic",t)},expression:"fuzzyParams.topic"}})],1)],1)],1)],1):e._e(),e._v(" "),e.showMoreQuery?["clients"===e.activeTab?[a("el-col",{attrs:{span:8}},[a("el-form-item",{attrs:{label:e.$t("clients.ipAddr")}},[a("el-input",{attrs:{type:"text",size:"small"},model:{value:e.fuzzyParams.ip_address,callback:function(t){e.$set(e.fuzzyParams,"ip_address",t)},expression:"fuzzyParams.ip_address"}})],1)],1),e._v(" "),a("el-col",{attrs:{span:8}},[a("el-form-item",{attrs:{label:e.$t("clients.connected")}},[a("el-select",{model:{value:e.fuzzyParams.conn_state,callback:function(t){e.$set(e.fuzzyParams,"conn_state",t)},expression:"fuzzyParams.conn_state"}},[a("el-option",{attrs:{value:"connected"}}),e._v(" "),a("el-option",{attrs:{value:"disconnected"}})],1)],1)],1),e._v(" "),a("el-col",{attrs:{span:8}},[a("el-form-item",{attrs:{label:e.$t("clients.createdAt")}},[a("el-row",{staticClass:"form-item-row"},[a("el-col",{attrs:{span:8}},[a("el-select",{staticClass:"comparator",model:{value:e.fuzzyParams.comparator,callback:function(t){e.$set(e.fuzzyParams,"comparator",t)},expression:"fuzzyParams.comparator"}},[a("el-option",{attrs:{label:">=",value:"_gte"}}),e._v(" "),a("el-option",{attrs:{label:"<=",value:"_lte"}})],1)],1),e._v(" "),a("el-col",{attrs:{span:16}},[a("el-date-picker",{staticClass:"datatime",attrs:{type:"datetime","value-format":"timestamp"},model:{value:e.fuzzyParams._connected_at,callback:function(t){e.$set(e.fuzzyParams,"_connected_at",t)},expression:"fuzzyParams._connected_at"}})],1)],1)],1)],1),e._v(" "),a("el-col",{attrs:{span:8}},[a("el-form-item",{attrs:{label:e.$t("clients.protoName")}},[a("el-select",{model:{value:e.fuzzyParams.proto_name,callback:function(t){e.$set(e.fuzzyParams,"proto_name",t)},expression:"fuzzyParams.proto_name"}},e._l(e.protoNames,function(e){return a("el-option",{key:e,attrs:{value:e}})}),1)],1)],1)]:"subscriptions"===e.activeTab?[a("el-col",{attrs:{span:8}},[a("el-form-item",{attrs:{label:"QoS"}},[a("el-select",{attrs:{clearable:""},model:{value:e.fuzzyParams.qos,callback:function(t){e.$set(e.fuzzyParams,"qos",t)},expression:"fuzzyParams.qos"}},[a("el-option",{attrs:{value:0}}),e._v(" "),a("el-option",{attrs:{value:1}}),e._v(" "),a("el-option",{attrs:{value:2}})],1)],1)],1),e._v(" "),a("el-col",{staticClass:"col-share",attrs:{span:8}},[a("el-form-item",{attrs:{label:e.$t("subscriptions.share")}},[a("el-input",{attrs:{type:"text",size:"small",placeholder:"group_name"},model:{value:e.fuzzyParams.share,callback:function(t){e.$set(e.fuzzyParams,"share",t)},expression:"fuzzyParams.share"}})],1)],1)]:e._e()]:e._e(),e._v(" "),a("span",{staticClass:"col-oper"},[a("el-button",{attrs:{size:"small",type:"primary",plain:""},on:{click:e.clientQuerySearch}},[e._v("\n "+e._s(e.$t("oper.search"))+"\n ")]),e._v(" "),a("el-button",{attrs:{size:"small",plain:""},on:{click:e.resetClientQuerySearch}},[e._v("\n "+e._s(e.$t("oper.reset"))+"\n ")]),e._v(" "),a("a",{staticClass:"show-more",attrs:{href:"javascript:;"},on:{click:function(t){e.showMoreQuery=!e.showMoreQuery}}},[e._v("\n "+e._s(e.showMoreQuery?e.$t("oper.collapse"):e.$t("oper.expand"))+"\n "),a("i",{class:e.showMoreQuery?"el-icon-arrow-up":"el-icon-arrow-down"})])],1)],2)],1)],1):e._e(),e._v(" "),a("el-table",{directives:[{name:"show",rawName:"v-show",value:"clients"===e.activeTab,expression:"activeTab === 'clients'"},{name:"loading",rawName:"v-loading",value:e.$store.state.loading,expression:"$store.state.loading"}],attrs:{border:"",data:e.clients}},[a("el-table-column",{attrs:{prop:"clientid",label:e.$t("clients.clientId"),width:"160px","show-overflow-tooltip":""},scopedSlots:e._u([{key:"default",fn:function(t){var s=t.row;return[a("a",{attrs:{href:"javascript:;"},on:{click:function(t){e.$router.push({path:"/clients/"+encodeURIComponent(s.clientid)})}}},[e._v("\n "+e._s(s.clientid)+"\n ")])]}}])}),e._v(" "),a("el-table-column",{attrs:{prop:"username","min-width":"100px",label:e.$t("clients.username"),"show-overflow-tooltip":""}}),e._v(" "),a("el-table-column",{attrs:{prop:"ip_address",label:e.$t("clients.ipAddr"),"min-width":"140px","show-overflow-tooltip":""},scopedSlots:e._u([{key:"default",fn:function(t){var a=t.row;return[e._v("\n "+e._s(a.ip_address)+":"+e._s(a.port)+"\n ")]}}])}),e._v(" "),a("el-table-column",{attrs:{prop:"keepalive","min-width":"100px",label:e.$t("clients.keepalive")}}),e._v(" "),a("el-table-column",{attrs:{prop:"expiry_interval","min-width":"150px",label:e.$t("clients.expiryInterval")}}),e._v(" "),a("el-table-column",{attrs:{prop:"subscriptions_cnt","min-width":"160px",label:e.$t("clients.subscriptionsCount")}}),e._v(" "),a("el-table-column",{attrs:{prop:"connected","min-width":"140px",label:e.$t("clients.connected")},scopedSlots:e._u([{key:"default",fn:function(t){var s=t.row;return[a("span",{class:[s.connected?"connected":"disconnected","status-circle"]}),e._v("\n "+e._s(s.connected?e.$t("websocket.connected"):e.$t("websocket.disconnected"))+"\n ")]}}])}),e._v(" "),a("el-table-column",{attrs:{prop:"created_at",label:e.$t("clients.createdAt"),"min-width":"160px"}}),e._v(" "),a("el-table-column",{attrs:{fixed:"right",width:"120px",label:e.$t("oper.oper")},scopedSlots:e._u([{key:"default",fn:function(t){var s=t.row,i=t.$index,l=t._self;return[a("el-popover",{ref:"popover-"+i,attrs:{placement:"right",trigger:"click"}},[a("p",[e._v(e._s(s.connected?e.$t("oper.confirmKickOut"):e.$t("oper.confirmCleanSession")))]),e._v(" "),a("div",{staticStyle:{"text-align":"right"}},[a("el-button",{staticClass:"cache-btn",attrs:{size:"mini",type:"text"},on:{click:function(e){l.$refs["popover-"+i].doClose()}}},[e._v("\n "+e._s(e.$t("oper.cancel"))+"\n ")]),e._v(" "),a("el-button",{attrs:{size:"mini",type:"success"},on:{click:function(t){return e.handleDisconnect(s,i,l)}}},[e._v("\n "+e._s(e.$t("oper.confirm"))+"\n ")])],1),e._v(" "),a("el-button",{attrs:{slot:"reference",size:"mini",type:"danger",plain:""},slot:"reference"},[e._v("\n "+e._s(s.connected?e.$t("clients.kickOut"):e.$t("websocket.cleanSession"))+"\n ")])],1)]}}])})],1),e._v(" "),a("el-table",{directives:[{name:"show",rawName:"v-show",value:"topics"===e.activeTab,expression:"activeTab === 'topics'"},{name:"loading",rawName:"v-loading",value:e.$store.state.loading,expression:"$store.state.loading"}],attrs:{border:"",data:e.topics}},[a("el-table-column",{attrs:{prop:"topic",label:e.$t("topics.topic")}}),e._v(" "),a("el-table-column",{attrs:{prop:"node",label:e.$t("topics.node")}})],1),e._v(" "),a("el-table",{directives:[{name:"show",rawName:"v-show",value:"subscriptions"===e.activeTab,expression:"activeTab === 'subscriptions'"},{name:"loading",rawName:"v-loading",value:e.$store.state.loading,expression:"$store.state.loading"}],attrs:{border:"",data:e.subscriptions}},[e.cluster?a("el-table-column",{attrs:{prop:"node","min-width":"160",label:e.$t("clients.node")}}):e._e(),e._v(" "),a("el-table-column",{attrs:{prop:"clientid",label:e.$t("subscriptions.clientId")}}),e._v(" "),a("el-table-column",{attrs:{prop:"topic",label:e.$t("subscriptions.topic")}}),e._v(" "),a("el-table-column",{attrs:{prop:"qos",label:e.$t("subscriptions.qoS")}})],1),e._v(" "),a("div",{staticClass:"center-align"},[e.count>10?a("el-pagination",{attrs:{background:"",layout:"total, sizes, prev, pager, next","page-sizes":[10,50,100,300,500],"current-page":e.params._page,"page-size":e.params._limit,total:e.count},on:{"update:currentPage":function(t){return e.$set(e.params,"_page",t)},"update:current-page":function(t){return e.$set(e.params,"_page",t)},"size-change":e.handleSizeChange,"current-change":e.loadChild}}):e._e(),e._v(" "),-1===e.count&&(e.clients.length||e.subscriptions.length)?a("div",{staticClass:"custom-pagination"},[a("a",{class:["prev",1===e.params._page?"disabled":""],attrs:{href:"javascript:;"},on:{click:e.handlePrevClick}},[a("i",{staticClass:"el-icon-arrow-left"}),e._v("\n "+e._s(e.$t("oper.prev"))+"\n ")]),e._v(" "),a("a",{class:["next",e.hasnext?"":"disabled"],attrs:{href:"javascript:;"},on:{click:e.handleNextClick}},[e._v("\n "+e._s(e.$t("oper.next"))+"\n "),a("i",{staticClass:"el-icon-arrow-right"})])]):e._e()],1)],1)},staticRenderFns:[]};var c=a("VU/8")(o,r,!1,function(e){a("g2pX")},null,null);t.default=c.exports}}); -------------------------------------------------------------------------------- /priv/www/static/js/10.188c5e479f887d471dde.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([10],{QSR2:function(e,s,r){"use strict";Object.defineProperty(s,"__esModule",{value:!0});var t=r("Dd8w"),a=r.n(t),o=r("zL8q"),n=r("NYxO"),i={name:"users-view",components:{"el-dialog":o.Dialog,"el-input":o.Input,"el-button":o.Button,"el-table":o.Table,"el-table-column":o.TableColumn,"el-popover":o.Popover,"el-form":o.Form,"el-form-item":o.FormItem,"el-row":o.Row,"el-col":o.Col},data:function(){var e=this;return{changePassword:!1,dialogVisible:!1,oper:"new",users:[],record:{username:"",password:"",newPassword:"",repeatPassword:"",tags:""},rules:{username:[{required:!0,message:this.$t("users.usernameRequired")},{min:2,max:32,message:this.$t("users.usernameIllegal"),trigger:"change"}],tags:[{required:!0,message:this.$t("users.remarkRequired")}],password:[{required:!0,message:this.$t("users.passwordRequired")},{min:3,max:255,message:this.$t("users.passwordIllegal"),trigger:"change"}],newPassword:[{required:!0,message:this.$t("users.passwordRequired")},{min:3,max:255,message:this.$t("users.passwordIllegal"),trigger:"change"}],repeatPassword:[{required:!0,message:this.$t("users.passwordRequired")},{validator:function(s,r,t){r!==e.record.newPassword?t(new Error(e.$t("users.passwordInconsistent"))):t()},trigger:"change"}]}}},computed:{username:function(){return this.$store.state.user.username}},methods:a()({},Object(n.b)(["USER_LOGIN"]),{handleOperation:function(){var e=this,s=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],r=arguments[1];this.changePassword=!1,this.dialogVisible=!0,s?(this.oper="new",this.record={username:"",password:"",newPassword:"",repeatPassword:"",tags:"viewer"},setTimeout(function(){e.$refs.record.clearValidate()},10)):(this.oper="edit",this.record=a()({},r),this.$set(this.record,"password",""))},loadData:function(){var e=this;this.$httpGet("/users").then(function(s){e.users=s.data}).catch(function(s){e.$message.error(s||e.$t("error.networkError"))})},createUser:function(){var e=this;"edit"!==this.oper?this.$refs.record.validate(function(s){s&&e.$httpPost("/users",e.record).then(function(){e.$message.success(""+e.$t("users.createUser")),e.loadData(),e.dialogVisible=!1}).catch(function(s){e.$message.error(s||e.$t("error.networkError"))})}):this.updateUser()},updateUser:function(){var e=this;this.$refs.record.validate(function(s){if(s)if(e.changePassword){var r={old_pwd:e.record.password,new_pwd:e.record.newPassword};e.$httpPut("/users/"+e.record.username,e.record).then(function(){e.$httpPut("/change_pwd/"+e.record.username,r).then(function(){e.$store.state.user.username===e.record.username&&e.record.password!==e.record.newPassword?(e.$message.error(e.$t("users.authenticate")),e.USER_LOGIN({isLogOut:!0}),e.$router.push("/login")):(e.$message.success(""+e.$t("oper.edit")+e.$t("alert.success")),e.dialogVisible=!1,e.loadData())}).catch(function(s){e.$message.error(s||e.$t("error.networkError"))})})}else e.$httpPut("/users/"+e.record.username,e.record).then(function(){e.$message.success(""+e.$t("oper.edit")+e.$t("alert.success")),e.dialogVisible=!1,e.loadData()}).catch(function(s){e.$message.error(s||e.$t("error.networkError"))})})},deleteUser:function(e,s,r){var t=this;this.$httpDelete("/users/"+e.username).then(function(){t.$message.success(""+t.$t("oper.delete")+t.$t("alert.success")),t.loadData(),r.$refs["popover-"+s].doClose()}).catch(function(e){t.$message.error(e||t.$t("error.networkError"))})}}),created:function(){this.loadData()}},l={render:function(){var e=this,s=e.$createElement,r=e._self._c||s;return r("div",{staticClass:"users-view"},[r("div",{staticClass:"page-title"},[e._v("\n "+e._s(e.$t("leftbar.users"))+"\n "),r("el-button",{staticClass:"confirm-btn",staticStyle:{float:"right"},attrs:{round:"",plain:"",type:"success",icon:"el-icon-plus",size:"medium",disabled:e.$store.state.loading},on:{click:function(s){return e.handleOperation(!0)}}},[e._v("\n "+e._s(e.$t("users.newUser"))+"\n ")])],1),e._v(" "),r("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.$store.state.loading,expression:"$store.state.loading"}],attrs:{border:"",data:e.users}},[r("el-table-column",{attrs:{prop:"username",label:e.$t("users.username")}}),e._v(" "),r("el-table-column",{attrs:{prop:"tags",label:e.$t("users.remark")}}),e._v(" "),r("el-table-column",{attrs:{width:"140",label:e.$t("oper.oper")},scopedSlots:e._u([{key:"default",fn:function(s){var t=s.row,a=s.$index,o=s._self;return[r("el-button",{attrs:{size:"mini",type:"warning",plain:""},on:{click:function(s){return e.handleOperation(!1,t)}}},[e._v("\n "+e._s(e.$t("oper.edit"))+"\n ")]),e._v(" "),r("el-popover",{ref:"popover-"+a,attrs:{placement:"right",trigger:"click"}},[r("p",[e._v(e._s(e.$t("oper.confirmDelete")))]),e._v(" "),r("div",{staticStyle:{"text-align":"right"}},[r("el-button",{staticClass:"cache-btn",attrs:{size:"mini",type:"text"},on:{click:function(e){o.$refs["popover-"+a].doClose()}}},[e._v("\n "+e._s(e.$t("oper.cancel"))+"\n ")]),e._v(" "),r("el-button",{attrs:{size:"mini",type:"success"},on:{click:function(s){return e.deleteUser(t,a,o)}}},[e._v("\n "+e._s(e.$t("oper.confirm"))+"\n ")])],1),e._v(" "),r("el-button",{directives:[{name:"show",rawName:"v-show",value:"admin"!==t.username&&e.username!==t.username,expression:"row.username !== 'admin' && username !== row.username"}],attrs:{slot:"reference",size:"mini",type:"danger",plain:""},slot:"reference"},[e._v("\n "+e._s(e.$t("oper.delete"))+"\n ")])],1)]}}])})],1),e._v(" "),r("el-dialog",{attrs:{width:"500px",visible:e.dialogVisible,title:"new"===e.oper?e.$t("users.newUser"):e.$t("users.editUser")},on:{"update:visible":function(s){e.dialogVisible=s}},nativeOn:{keyup:function(s){return!s.type.indexOf("key")&&e._k(s.keyCode,"enter",13,s.key,"Enter")?null:e.createUser(s)}}},[r("el-form",{ref:"record",staticClass:"el-form--public",attrs:{"label-position":"top",size:"medium",model:e.record,rules:e.rules}},[r("el-row",{attrs:{gutter:20}},[r("el-col",{attrs:{span:24}},[r("el-form-item",{attrs:{prop:"username",label:e.$t("users.username")}},[r("el-input",{attrs:{disabled:"edit"===e.oper},model:{value:e.record.username,callback:function(s){e.$set(e.record,"username",s)},expression:"record.username"}})],1)],1),e._v(" "),"new"===e.oper?r("el-col",{attrs:{span:24}},[r("el-form-item",{attrs:{prop:"password",label:e.$t("users.password")}},[r("el-input",{attrs:{type:"password"},model:{value:e.record.password,callback:function(s){e.$set(e.record,"password",s)},expression:"record.password"}})],1)],1):e._e(),e._v(" "),e.changePassword&&"edit"===e.oper?r("div",[r("el-col",{attrs:{span:24}},[r("el-form-item",{attrs:{prop:"password",label:e.$t("users.oldPassword")}},[r("el-input",{attrs:{type:"password"},model:{value:e.record.password,callback:function(s){e.$set(e.record,"password",s)},expression:"record.password"}})],1)],1),e._v(" "),r("el-col",{attrs:{span:24}},[r("el-form-item",{attrs:{prop:"newPassword",label:e.$t("users.newPassword")}},[r("el-input",{attrs:{type:"password"},model:{value:e.record.newPassword,callback:function(s){e.$set(e.record,"newPassword",s)},expression:"record.newPassword"}})],1)],1),e._v(" "),r("el-col",{attrs:{span:24}},[r("el-form-item",{attrs:{prop:"repeatPassword",label:e.$t("users.confirmNewPassword")}},[r("el-input",{attrs:{type:"password"},model:{value:e.record.repeatPassword,callback:function(s){e.$set(e.record,"repeatPassword",s)},expression:"record.repeatPassword"}})],1)],1)],1):e._e(),e._v(" "),r("el-col",{attrs:{span:24}},[r("el-form-item",{attrs:{prop:"tags",label:e.$t("users.remark")}},[r("el-input",{model:{value:e.record.tags,callback:function(s){e.$set(e.record,"tags",s)},expression:"record.tags"}})],1)],1),e._v(" "),r("el-col",{attrs:{span:24}},[r("el-form-item",["edit"===e.oper?r("el-button",{staticClass:"cache-btn change-password",attrs:{type:"text"},on:{click:function(s){e.changePassword=!e.changePassword}}},[e._v("\n "+e._s(e.changePassword?e.$t("users.dontChangePassword"):e.$t("users.changePassword"))+"\n ")]):e._e()],1)],1)],1)],1),e._v(" "),r("div",{attrs:{slot:"footer"},slot:"footer"},[r("el-button",{staticClass:"cache-btn",attrs:{type:"text"},on:{click:function(s){e.dialogVisible=!1}}},[e._v("\n "+e._s(e.$t("oper.cancel"))+"\n ")]),e._v(" "),r("el-button",{staticClass:"confirm-btn",attrs:{type:"success",loading:e.$store.state.loading},on:{click:e.createUser}},[e._v("\n "+e._s(e.$t("oper.save"))+"\n ")])],1)],1)],1)},staticRenderFns:[]};var c=r("VU/8")(i,l,!1,function(e){r("gHf8")},null,null);s.default=c.exports},gHf8:function(e,s){}}); -------------------------------------------------------------------------------- /priv/www/static/js/11.3861aeb3036b8f41a6e8.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([11],{DoQ2:function(t,e){},GQ4E:function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var a=s("woOf"),n=s.n(a),o={name:"topic-metrics",components:{},props:{},watch:{currentExpandRow:{deep:!0,handler:function(){clearInterval(this.timer)}}},data:function(){return{expands:[],addVisible:!1,popoverVisible:!1,modClosed:!1,topicQos:"all",timer:0,topics:[],currentExpandRow:{},currentTopic:{},record:{},rules:{topic:{required:!0,message:this.$t("oper.pleaseEnter")}}}},methods:{getRowKeys:function(t){return t.topic},loadData:function(){var t=this;this.$httpGet("/topic-metrics").then(function(e){var s=e.data;t.topics=s.map(function(t){var e=t.metrics;return{topic:t.topic,messageIn:e["messages.in.count"],messageOut:e["messages.out.count"],messageDrop:e["messages.dropped.count"]}}),t.modClosed=!1}).catch(function(e){t.$message.warning(t.$t("error."+e.message)),t.modClosed=!0})},hidePopover:function(){var t=this;this.popoverVisible=!0,setTimeout(function(){t.popoverVisible=!1},0)},handleOperation:function(){this.addVisible=!0},handleModLoad:function(){var t=this;this.$httpPut("/modules/emqx_mod_topic_metrics/load").then(function(){t.$message.success(t.$t("oper.enableSuccess")),t.loadData(),t.modClosed=!1}).catch(function(e){t.$message.error(e||t.$t("error.networkError"))})},deleteTopicMetric:function(t){var e=this;this.$httpDelete("/topic-metrics/"+encodeURIComponent(t.topic)).then(function(){e.loadData(),e.hidePopover()}).catch(function(t){e.$message.error(t||e.$t("error.networkError"))})},handleAdd:function(){var t=this;this.$refs.record.validate(function(e){if(e){var s={};n()(s,t.record),t.$httpPost("/topic-metrics",s).then(function(){t.handleClose(),t.loadData()}).catch(function(){})}})},handleClose:function(){this.addVisible=!1,this.$refs.record.resetFields()},viewTopicDetails:function(t,e){var s=document.querySelectorAll(".el-table__expand-icon")[e];s&&s.click()},loadDetail:function(){var t=this;this.$httpGet("/topic-metrics/"+encodeURIComponent(this.currentTopic.topic)).then(function(e){t.currentTopic=e.data,t.loadData()}).catch(function(){})},setLoadDetailInterval:function(){var t=this;this.timer=setInterval(function(){t.$httpGet("/topic-metrics/"+encodeURIComponent(t.currentExpandRow.topic)).then(function(e){t.currentTopic=e.data}).catch(function(){})},1e4)},handleExpandChange:function(t,e){var s=this;if(!e.length)return this.currentExpandRow={},void clearInterval(this.timer);this.currentExpandRow=t,this.currentTopic={},this.$httpGet("/topic-metrics/"+encodeURIComponent(t.topic)).then(function(a){s.currentTopic=a.data,s.$refs.crudTable.store.states.expandRows=e.length?[t]:[],s.loadData(),s.setLoadDetailInterval()}).catch(function(){})},getCurrentTopicData:function(t,e){var s={all:"messages",qos0:"messages.qos0",qos1:"messages.qos1",qos2:"messages.qos2"}[this.topicQos],a=this.currentTopic[s+"."+t+"."+e];return"rate"===e&&a?a.toFixed(2):a},getCurrentTopicDropRate:function(t){return t?t.toFixed(2):t}},created:function(){this.loadData()},beforeRouteLeave:function(t,e,s){clearInterval(this.timer),s()},beforeDestroy:function(){clearInterval(this.timer)}},i={render:function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"topic-metrics"},[s("div",{staticClass:"page-title"},[t._v("\n "+t._s(t.$t("analysis.topicMetrics"))+"\n "),s("span",{staticClass:"sub-tip"},[t._v(t._s(t.$t("analysis.metricsTip")))]),t._v(" "),t.modClosed?s("el-button",{staticClass:"confirm-btn",staticStyle:{float:"right"},attrs:{round:"",plain:"",type:"success",size:"medium",disable:t.$store.state.loading},on:{click:t.handleModLoad}},[t._v("\n "+t._s(t.$t("modules.enable"))+"\n ")]):s("el-button",{staticClass:"confirm-btn",staticStyle:{float:"right"},attrs:{round:"",plain:"",type:"success",icon:"el-icon-plus",size:"medium",disable:t.$store.state.loading},on:{click:t.handleOperation}},[t._v("\n "+t._s(t.$t("rule.create"))+"\n ")])],1),t._v(" "),s("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.$store.state.loading,expression:"$store.state.loading"}],ref:"crudTable",attrs:{border:"",data:t.topics,"row-key":t.getRowKeys,"expand-row-keys":t.expands},on:{"expand-change":t.handleExpandChange}},[s("el-table-column",{attrs:{type:"expand"},scopedSlots:t._u([{key:"default",fn:function(e){return[s("div",{staticClass:"expand-header"},[t._v("\n "+t._s(t.$t("analysis.details"))+"\n "),s("el-radio-group",{staticClass:"topic-qos-radio",attrs:{prop:e,size:"mini"},model:{value:t.topicQos,callback:function(e){t.topicQos=e},expression:"topicQos"}},[s("el-radio-button",{attrs:{label:"all"}},[t._v(t._s(t.$t("analysis.all")))]),t._v(" "),s("el-radio-button",{attrs:{label:"qos0"}},[t._v("QoS 0")]),t._v(" "),s("el-radio-button",{attrs:{label:"qos1"}},[t._v("QoS 1")]),t._v(" "),s("el-radio-button",{attrs:{label:"qos2"}},[t._v("QoS 2")])],1)],1),t._v(" "),s("el-row",{staticClass:"expand-body",attrs:{gutter:20}},[s("el-col",{attrs:{span:8}},[s("div",{staticClass:"message-card in"},[s("div",[t._v("\n "+t._s(t.$t("analysis.messageIn"))+"\n "),s("span",{staticClass:"message-rate"},[t._v("\n "+t._s(t.$t("analysis.rateItem",[t.getCurrentTopicData("in","rate")]))+"\n "+t._s(t.$t("analysis.rate"))+"\n ")])]),t._v(" "),s("div",{staticClass:"message-card--body"},[t._v("\n "+t._s(t.getCurrentTopicData("in","count"))+"\n ")])])]),t._v(" "),s("el-col",{attrs:{span:8}},[s("div",{staticClass:"message-card out"},[s("div",[t._v("\n "+t._s(t.$t("analysis.messageOut"))+"\n "),s("span",{staticClass:"message-rate"},[t._v("\n "+t._s(t.$t("analysis.rateItem",[t.getCurrentTopicData("out","rate")]))+"\n "+t._s(t.$t("analysis.rate"))+"\n ")])]),t._v(" "),s("div",{staticClass:"message-card--body"},[t._v("\n "+t._s(t.getCurrentTopicData("out","count"))+"\n ")])])]),t._v(" "),s("el-col",{attrs:{span:8}},[s("div",{staticClass:"message-card drop"},[s("div",[t._v("\n "+t._s(t.$t("analysis.messageDrop"))+"\n "),s("span",{staticClass:"message-rate"},[t._v("\n "+t._s(t.$t("analysis.rateItem",[t.getCurrentTopicDropRate(t.currentTopic["messages.dropped.rate"])]))+"\n "+t._s(t.$t("analysis.rate"))+"\n ")])]),t._v(" "),s("div",{staticClass:"message-card--body"},[t._v("\n "+t._s(t.currentTopic["messages.dropped.count"])+"\n ")])])])],1)]}}])}),t._v(" "),s("el-table-column",{attrs:{prop:"topic",label:t.$t("topics.topic")}}),t._v(" "),s("el-table-column",{attrs:{prop:"messageIn",label:t.$t("analysis.messageIn")}}),t._v(" "),s("el-table-column",{attrs:{prop:"messageOut",label:t.$t("analysis.messageOut")}}),t._v(" "),s("el-table-column",{attrs:{prop:"messageDrop",label:t.$t("analysis.messageDrop")}}),t._v(" "),s("el-table-column",{attrs:{width:"180px",label:t.$t("oper.oper")},scopedSlots:t._u([{key:"default",fn:function(e){return[s("el-button",{attrs:{type:"success",size:"mini",plain:""},on:{click:function(s){return t.viewTopicDetails(e.row,e.$index)}}},[t._v("\n "+t._s(t.$t("oper.view"))+"\n ")]),t._v(" "),s("el-popover",{attrs:{placement:"right",trigger:"click",value:t.popoverVisible}},[s("p",[t._v(t._s(t.$t("oper.confirmDelete")))]),t._v(" "),s("div",{staticStyle:{"text-align":"right"}},[s("el-button",{staticClass:"cache-btn",attrs:{size:"mini",type:"text"},on:{click:t.hidePopover}},[t._v("\n "+t._s(t.$t("oper.cancel"))+"\n ")]),t._v(" "),s("el-button",{attrs:{size:"mini",type:"success"},on:{click:function(s){return t.deleteTopicMetric(e.row)}}},[t._v("\n "+t._s(t.$t("oper.confirm"))+"\n ")])],1),t._v(" "),s("el-button",{attrs:{slot:"reference",size:"mini",type:"danger",plain:""},slot:"reference"},[t._v("\n "+t._s(t.$t("oper.delete"))+"\n ")])],1)]}}])})],1),t._v(" "),s("el-dialog",{staticClass:"create-subscribe",attrs:{title:t.$t("analysis.addTopic"),width:"400px",visible:t.addVisible},on:{"update:visible":function(e){t.addVisible=e}},nativeOn:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.handleAdd(e)}}},[s("el-form",{ref:"record",staticClass:"el-form--public",attrs:{model:t.record,rules:t.rules,size:"small","label-position":"top"}},[s("el-form-item",{attrs:{prop:"topic",label:t.$t("subscriptions.topic")}},[s("el-input",{attrs:{placeholder:"Topic"},model:{value:t.record.topic,callback:function(e){t.$set(t.record,"topic",e)},expression:"record.topic"}})],1)],1),t._v(" "),s("div",{attrs:{slot:"footer"},slot:"footer"},[s("el-button",{staticClass:"cache-btn",attrs:{type:"text"},on:{click:t.handleClose}},[t._v("\n "+t._s(t.$t("oper.cancel"))+"\n ")]),t._v(" "),s("el-button",{staticClass:"confirm-btn",attrs:{type:"success",loading:t.$store.state.loading},on:{click:t.handleAdd}},[t._v("\n "+t._s(t.$t("oper.add"))+"\n ")])],1)],1)],1)},staticRenderFns:[]};var r=s("VU/8")(o,i,!1,function(t){s("DoQ2")},null,null);e.default=r.exports}}); -------------------------------------------------------------------------------- /priv/www/static/js/12.43feccc8f1584bdba5c2.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([12],{BYOx:function(t,e){},VKKr:function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var a=s("mvHQ"),o=s.n(a),i=s("zL8q"),n=s("VOAv"),l={name:"settings-view",components:{"el-radio":i.Radio,"el-radio-group":i.RadioGroup,"el-button":i.Button,"el-form":i.Form,"el-form-item":i.FormItem,"el-row":i.Row,"el-col":i.Col,"el-card":i.Card},data:function(){return{options:{themes:"",language:""},defaultConfig:"",defaultThemes:"",defaultLanguage:""}},computed:{notChanged:function(){return this.defaultConfig===o()(this.options)}},methods:{init:function(){var t=window.localStorage.getItem("themes")||"dark-themes";t="light-themes"===t?"light-themes":"dark-themes",this.options.themes=t,this.defaultThemes=t,this.options.language=window.localStorage.getItem("language")||"en",this.options.language=["zh","en","ja"].includes(this.options.language)?this.options.language:"en",this.defaultLanguage=this.options.language,this.defaultConfig=o()(this.options)},themesToggle:function(){Object(n.b)(this.options.themes)},applySetting:function(){this.$message.success(this.$t("settings.success")),this.themesToggle(),this.defaultThemes=this.options.themes,window.localStorage.setItem("language",this.options.language),window.localStorage.setItem("themes",this.options.themes),this.defaultLanguage!==this.options.language&&setTimeout(function(){location.reload()},600),this.defaultConfig=o()(this.options)}},created:function(){this.init()},beforeRouteLeave:function(t,e,s){this.defaultThemes!==this.options.themes&&Object(n.b)(this.defaultThemes),s()}},r={render:function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"settings-view"},[s("div",{staticClass:"page-title"},[t._v(t._s(t.$t("leftbar.settings")))]),t._v(" "),s("el-card",{staticClass:"el-card--self"},[s("el-row",{attrs:{gutter:20}},[s("el-form",{ref:"options",attrs:{model:t.options,"label-width":"100px","label-position":"top"}},[s("el-col",{attrs:{span:12}},[s("el-form-item",{attrs:{label:t.$t("settings.themes")}},[s("el-radio-group",{on:{change:t.themesToggle},model:{value:t.options.themes,callback:function(e){t.$set(t.options,"themes",e)},expression:"options.themes"}},[s("el-radio",{attrs:{label:"dark-themes"}},[t._v("Dark")]),t._v(" "),s("el-radio",{attrs:{label:"light-themes"}},[t._v("Light")])],1)],1)],1),t._v(" "),s("el-col",{attrs:{span:12}},[s("el-form-item",{attrs:{label:t.$t("settings.language")}},[s("el-radio-group",{model:{value:t.options.language,callback:function(e){t.$set(t.options,"language",e)},expression:"options.language"}},[s("el-radio",{attrs:{label:"en"}},[t._v("EN")]),t._v(" "),s("el-radio",{attrs:{label:"zh"}},[t._v("中文")]),t._v(" "),s("el-radio",{attrs:{label:"ja"}},[t._v("日本語")])],1)],1)],1),t._v(" "),s("el-col",{staticClass:"operation-area",attrs:{span:24}},[s("el-form-item",[s("el-button",{staticClass:"confirm-btn",attrs:{type:"success",disabled:t.notChanged},on:{click:t.applySetting}},[t._v("\n "+t._s(t.$t("settings.apply"))+"\n ")])],1)],1)],1)],1)],1)],1)},staticRenderFns:[]};var g=s("VU/8")(l,r,!1,function(t){s("BYOx")},null,null);e.default=g.exports}}); -------------------------------------------------------------------------------- /priv/www/static/js/13.026a13a2a59abd354bd5.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([13],{IvP6:function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i("Xxa5"),a=i.n(n),s=i("exGp"),l=i.n(s),r={name:"rules-view",components:{RuleActions:i("eDC2").a},props:{},data:function(){return{ruleDialogLoading:!1,timer:0,rule:{for:[],metrics:{}},dialogVisible:!1,tableData:[]}},methods:{getMatchedCount:function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).metrics,e=0;return(void 0===t?[]:t).forEach(function(t){var i=t.matched;e+=i}),e},getHitRate:function(t){var e=t.matched,i=void 0===e?0:e,n=t.nomatch,a=i/(i+(void 0===n?0:n))*100;return a.toString().split(".")[1]&&a.toString().split(".")[1].length>2?a.toFixed(2):a},viewRule:function(t){var e=this;return l()(a.a.mark(function i(){var n;return a.a.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(!t.id){i.next=3;break}return e.$router.push("/rules/"+t.id),i.abrupt("return");case 3:return i.next=5,e.$httpGet("/rules/"+t.id);case 5:if(i.t1=i.sent,i.t1){i.next=8;break}i.t1={};case 8:if(i.t0=i.t1.data,i.t0){i.next=11;break}i.t0={};case 11:n=i.t0,e.rule=n||t,e.dialogVisible=!0,clearTimeout(e.timer),e.timer=setTimeout(function(){e.viewRule(t)},1e4);case 16:case"end":return i.stop()}},i,e)}))()},editRule:function(t){this.$router.push("/rules/create?rule="+t.id)},loadDetails:function(t){var e=this;this.ruleDialogLoading=!0,this.$httpGet("/rules/"+t).then(function(t){var i=t.data;e.rule=i,setTimeout(function(){e.ruleDialogLoading=!1},500)}).catch(function(){e.ruleDialogLoading=!1})},closeDialog:function(){clearInterval(this.timer),this.loadData()},handleDelete:function(t){var e=this;this.$confirm(this.$t("rule.confirm_stop_delete"),"Notice",{confirmButtonClass:"confirm-btn",confirmButtonText:this.$t("oper.confirm"),cancelButtonClass:"cache-btn el-button--text",cancelButtonText:this.$t("oper.cancel"),type:"warning"}).then(function(){e.$httpDelete("/rules/"+t.id).then(function(){e.$message.success(e.$t("rule.delete_success")),e.loadData()})}).catch()},handleOperation:function(){this.$router.push("/rules/create")},loadData:function(){var t=this;this.$httpGet("/rules").then(function(e){t.tableData=e.data;var i=t.tableData.find(function(e){return e.id===t.rule.id});i&&(t.rule=i)})},updateRule:function(t){var e=this,i=t.id,n=t.enabled;this.$httpPut("/rules/"+i,{enabled:n}).then(function(){e.$message.success(e.$t("oper.editSuccess"))})}},filters:{actionsFilter:function(t){return t.map(function(t){return t.name}).join(", ")}},created:function(){this.loadData(),clearInterval(this.timer)},beforeRouteLeave:function(t,e,i){clearInterval(this.timer),i()}},o={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"rules-view"},[i("div",{staticClass:"page-title"},[t._v("\n "+t._s(t.$t("rule.message_rule"))+"\n "),i("el-button",{staticClass:"confirm-btn",staticStyle:{float:"right"},attrs:{round:"",plain:"",type:"success",icon:"el-icon-plus",size:"medium",disable:t.$store.state.loading},on:{click:t.handleOperation}},[t._v("\n "+t._s(t.$t("rule.create"))+"\n ")])],1),t._v(" "),i("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.$store.state.loading,expression:"$store.state.loading"}],attrs:{border:"",data:t.tableData}},[i("el-table-column",{attrs:{prop:"id",label:t.$t("rule.id")},scopedSlots:t._u([{key:"default",fn:function(e){var n=e.row;return[i("span",{staticClass:"btn",on:{click:function(e){return t.viewRule(n)}}},[t._v("\n "+t._s(n.id)+"\n ")])]}}])}),t._v(" "),i("el-table-column",{attrs:{prop:"for",label:t.$t("rule.topic")}}),t._v(" "),i("el-table-column",{attrs:{prop:"rawsql","min-width":"150px",label:"SQL"}}),t._v(" "),i("el-table-column",{attrs:{prop:"actions",label:t.$t("rule.actions")},scopedSlots:t._u([{key:"default",fn:function(e){var n=e.row;return t._l(n.actions,function(e,n){return i("div",{key:n,staticClass:"action-item"},[t._v("\n "+t._s(e.name)+"\n ")])})}}])}),t._v(" "),i("el-table-column",{attrs:{prop:"metrics.matched","min-width":"110px",label:t.$t("rule.rule_matched_1"),formatter:t.getMatchedCount}}),t._v(" "),i("el-table-column",{attrs:{label:t.$t("rule.viewStates")},scopedSlots:t._u([{key:"default",fn:function(e){return[i("el-tooltip",{attrs:{content:e.row.enabled?t.$t("rule.ruleEnabled"):t.$t("rule.ruleDisabled"),placement:"left"}},[i("el-switch",{attrs:{"active-text":"","inactive-text":"","active-color":"#13ce66","inactive-color":"#ff4949"},on:{change:function(i){return t.updateRule(e.row)}},model:{value:e.row.enabled,callback:function(i){t.$set(e.row,"enabled",i)},expression:"props.row.enabled"}})],1)]}}])}),t._v(" "),i("el-table-column",{attrs:{label:t.$t("rule.oper"),"min-width":"120px"},scopedSlots:t._u([{key:"default",fn:function(e){var n=e.row;return[i("el-button",{attrs:{type:"success",size:"mini",plain:""},on:{click:function(e){return t.editRule(n)}}},[t._v("\n "+t._s(t.$t("rule.edit"))+"\n ")]),t._v(" "),i("el-button",{attrs:{size:"mini",type:"danger",plain:""},on:{click:function(e){return t.handleDelete(n)}}},[t._v("\n "+t._s(t.$t("rule.delete"))+"\n ")])]}}])})],1),t._v(" "),i("el-dialog",{attrs:{title:t.$t("rule.rule_details"),visible:t.dialogVisible},on:{"update:visible":function(e){t.dialogVisible=e},close:t.closeDialog}},[i("div",{staticClass:"dialog-preview"},[i("div",{staticClass:"option-item"},[i("div",{staticClass:"option-title"},[t._v(t._s(t.$t("rule.id")))]),t._v(" "),i("div",{staticClass:"option-value"},[t._v(t._s(t.rule.id))])]),t._v(" "),i("div",{staticClass:"option-item"},[i("div",{staticClass:"option-title"},[t._v(t._s(t.$t("rule.trigger_events")))]),t._v(" "),i("div",{staticClass:"option-value"},[t._v(t._s((t.rule.for||[]).join(",")))])]),t._v(" "),i("div",{staticClass:"option-item"},[i("div",{staticClass:"option-title"},[t._v(t._s(t.$t("rule.rule_desc")))]),t._v(" "),i("div",{staticClass:"option-value"},[t._v(t._s(t.rule.description))])]),t._v(" "),i("div",{staticClass:"option-item"},[i("div",{staticClass:"option-title"},[t._v("SQL")]),t._v(" "),i("div",{staticClass:"option-all"},[i("code",[t._v("\n "+t._s(t.rule.rawsql)+"\n ")])])]),t._v(" "),i("div",{staticClass:"option-item"},[i("div",{staticClass:"option-title"},[t._v("\n "+t._s(t.$t("rule.metrics"))+"\n "),i("i",{directives:[{name:"show",rawName:"v-show",value:t.ruleDialogLoading,expression:"ruleDialogLoading"}],staticClass:"el-icon-loading"})]),t._v(" "),i("div",{staticClass:"option-all"},[i("span",{attrs:{size:"mini",type:"info"}},[t._v("\n "+t._s(t.$t("rule.rule_matched_1"))+": "),i("span",[t._v(t._s(t.rule.metrics.matched))]),t._v(" "+t._s(t.$t("rule.match_unit"))+"\n ")]),t._v(" "),i("span",{attrs:{size:"mini",type:"info"}},[t._v("\n "+t._s(t.$t("rule.speed_current"))+": "),i("span",[t._v(t._s(t.rule.metrics.speed))]),t._v(" "+t._s(t.$t("rule.speed_unit"))+"\n ")]),t._v(" "),i("span",{attrs:{size:"mini",type:"info"}},[t._v("\n "+t._s(t.$t("rule.speed_max_1"))+": "),i("span",[t._v(t._s(t.rule.metrics.speed_max))]),t._v(" "+t._s(t.$t("rule.speed_unit"))+"\n ")]),t._v(" "),i("span",{attrs:{size:"mini",type:"info"}},[t._v("\n "+t._s(t.$t("rule.speed_last5m_1"))+": "),i("span",[t._v(t._s(t.rule.metrics.speed_last5m))]),t._v(" "+t._s(t.$t("rule.speed_unit"))+"\n ")])])]),t._v(" "),i("el-table-column",{attrs:{prop:"description",label:t.$t("rule.description")}}),t._v(" "),i("div",{staticClass:"option-item"},[i("div",{staticClass:"option-title"},[t._v("\n "+t._s(t.$t("rule.actions"))+"\n "),i("i",{directives:[{name:"show",rawName:"v-show",value:t.ruleDialogLoading,expression:"ruleDialogLoading"}],staticClass:"el-icon-loading"})]),t._v(" "),i("div",{staticClass:"option-all"},[i("rule-actions",{attrs:{"in-dialog":"",record:t.rule,operations:[]}})],1)])],1),t._v(" "),i("div",{attrs:{slot:"footer"},slot:"footer"},[i("el-button",{staticClass:"confirm-btn",attrs:{type:"success"},on:{click:function(e){t.dialogVisible=!1}}},[t._v("\n "+t._s(t.$t("rule.confirm"))+"\n ")])],1)])],1)},staticRenderFns:[]};var u=i("VU/8")(r,o,!1,function(t){i("SVmr")},null,null);e.default=u.exports},SVmr:function(t,e){}}); -------------------------------------------------------------------------------- /priv/www/static/js/14.0342a1a3d29f1adca947.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([14],{JWuK:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=r("Xxa5"),s=r.n(a),l=r("exGp"),n=r.n(l),o={name:"RuleView",components:{RuleActions:r("eDC2").a},props:{},data:function(){return{record:{actions:[{id:"inspect_1562305995013447740",metrics:[{failed:0,node:"emqx@127.0.0.1",success:0}],name:"inspect",params:{}}],description:"",enabled:!0,for:["message.publish"],id:"rule:b35e3e59",metrics:[{matched:0,node:"emqx@127.0.0.1",speed:0,speed_last5m:0,speed_max:0}],rawsql:"SELECT\n *\nFROM\n \"message.publish\"\nWHERE\n topic =~ '#'"}}},methods:{loadData:function(){var e=this;return n()(s.a.mark(function t(){var r;return s.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e.id){t.next=2;break}return t.abrupt("return");case 2:return t.next=4,e.$httpGet("/rules/"+e.id);case 4:r=t.sent,e.record=r.data;case 6:case"end":return t.stop()}},t,e)}))()}},created:function(){this.loadData()},computed:{id:function(){return this.$route.params.id}}},c={render:function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"rule-view"},[r("div",{staticClass:"page-title"},[r("el-breadcrumb",{attrs:{separator:"/"}},[r("el-breadcrumb-item",{attrs:{to:{path:"/rules"}}},[e._v("\n "+e._s(e.$t("rule.message_rule"))+"\n ")]),e._v(" "),r("el-breadcrumb-item",{staticClass:"breadcrumb-name"},[e._v(e._s(e.id))])],1)],1),e._v(" "),r("el-card",{staticClass:"el-card--self"},[r("div",{staticClass:"config-dialog",attrs:{slot:"header"},slot:"header"},[e._v("\n "+e._s(e.$t("rule.basic_info"))+"\n ")]),e._v(" "),r("el-form",{attrs:{model:e.record,"label-position":"left","label-width":"100px","label-suffix":":"}},[r("el-form-item",{attrs:{label:e.$t("rule.topic")}},[r("span",[e._v(e._s(e.record.for.join(",")))])]),e._v(" "),r("el-form-item",{attrs:{label:e.$t("rule.description")}},[r("span",[e._v(e._s(e.record.description))])]),e._v(" "),r("el-form-item",{attrs:{label:e.$t("rule.rule_sql")}},[r("code",[e._v(e._s(e.record.rawsql))])])],1)],1),e._v(" "),r("el-card",{staticClass:"el-card--self"},[r("div",{staticClass:"config-dialog",attrs:{slot:"header"},slot:"header"},[e._v("\n "+e._s(e.$t("rule.metrics"))+"\n ")]),e._v(" "),r("el-table",{attrs:{border:"",data:e.record.metrics}},[r("el-table-column",{attrs:{prop:"node",label:e.$t("rule.node")}}),e._v(" "),r("el-table-column",{attrs:{prop:"matched",sortable:"",label:e.$t("rule.rule_matched_1")}}),e._v(" "),r("el-table-column",{attrs:{prop:"speed",sortable:"",label:e.$t("rule.speed_current")}}),e._v(" "),r("el-table-column",{attrs:{prop:"speed_max",label:e.$t("rule.speed_max_1")}}),e._v(" "),r("el-table-column",{attrs:{prop:"speed_last5m",label:e.$t("rule.speed_last5m_1")}})],1)],1),e._v(" "),r("el-card",{staticClass:"el-card--self"},[r("div",{staticClass:"config-dialog",attrs:{slot:"header"},slot:"header"},[e._v("\n "+e._s(e.$t("rule.set_action"))+"\n ")]),e._v(" "),r("rule-actions",{attrs:{record:e.record,operations:[]}})],1)],1)},staticRenderFns:[]};var i=r("VU/8")(o,c,!1,function(e){r("g3JU")},null,null);t.default=i.exports},g3JU:function(e,t){}}); -------------------------------------------------------------------------------- /priv/www/static/js/15.7d11711536eb5b2ca561.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([15],{DGQ0:function(t,e){},xPbZ:function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=s("Dd8w"),n=s.n(i),a={name:"resources-view",components:{ResourceDialog:s("SHGx").a},props:{},data:function(){return{dialogVisible:!1,viewDialogVisible:!1,tableData:[],res:{},reloadLoading:!1,currentResource:""}},methods:{viewRunningStatus:function(t,e){var s=document.querySelectorAll(".el-table__expand-icon")[e];s&&s.click&&s.click()},handleReconnect:function(t,e){var s=this;this.reloadLoading=!0,this.currentResource=t.id,this.$httpPost("/resources/"+t.id).then(function(){setTimeout(function(){s.reloadLoading=!1,s.$message.success(s.$t("rule.connectSuccess"));try{t.status[e].is_alive=!0}catch(t){console.log(t)}},300)}).catch(function(){s.reloadLoading=!1})},handleDelete:function(t){var e=this;this.$confirm(this.$t("rule.confirm_stop_delete"),"Notice",{confirmButtonClass:"confirm-btn",confirmButtonText:this.$t("oper.confirm"),cancelButtonClass:"cache-btn el-button--text",cancelButtonText:this.$t("oper.cancel"),type:"warning"}).then(function(){e.$httpDelete("/resources/"+t.id).then(function(){e.$message.success(e.$t("rule.delete_success")),e.loadData()})}).catch()},viewResource:function(t){this.res=n()({},t),this.viewDialogVisible=!0},handleOperation:function(){this.dialogVisible=!0},loadData:function(){var t=this;this.$httpGet("/resources").then(function(e){var s=e.data;t.tableData=s.map(function(t){return t.status=t.status||[],t})})},handExpand:function(t){var e=this;t.status&&t.status.length>0||this.$httpGet("/resources/"+t.id).then(function(s){e.$set(t,"status",s.data.status)})}},created:function(){this.loadData()}},o={render:function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"resources-view"},[s("div",{staticClass:"page-title"},[t._v("\n "+t._s(t.$t("rule.resource_title"))+"\n "),s("el-button",{staticClass:"confirm-btn",staticStyle:{float:"right"},attrs:{round:"",plain:"",type:"success",icon:"el-icon-plus",size:"medium",disable:t.$store.state.loading},on:{click:t.handleOperation}},[t._v("\n "+t._s(t.$t("rule.create"))+"\n ")])],1),t._v(" "),s("el-table",{attrs:{border:"",data:t.tableData},on:{"expand-change":t.handExpand}},[s("el-table-column",{attrs:{prop:"id",type:"expand","class-name":"expand-column",width:"1px"},scopedSlots:t._u([{key:"default",fn:function(e){var i=e.row;return[s("ul",{staticClass:"status-wrapper"},t._l(i.status||[],function(e,n){return s("li",{key:n,staticClass:"status-item"},[s("span",{staticClass:"key"},[t._v("\n "+t._s(e.node)+"\n ")]),t._v(" "),s("span",{class:[e.is_alive?"running":"stopped danger","status"]},[t._v("\n "+t._s(e.is_alive?t.$t("rule.enabled"):t.$t("rule.disabled"))+"\n ")]),t._v(" "),e.is_alive?t._e():s("el-button",{attrs:{loading:t.reloadLoading&&t.currentResource===i.id,plain:"",type:"success",size:"mini"},on:{click:function(e){return t.handleReconnect(i,n)}}},[t._v("\n "+t._s(t.$t("rule.reconnect"))+"\n ")])],1)}),0)]}}])}),t._v(" "),s("el-table-column",{attrs:{prop:"id",label:t.$t("rule.id")},scopedSlots:t._u([{key:"default",fn:function(e){var i=e.row;return[s("span",{on:{click:function(e){return t.viewResource(i)}}},[t._v("\n "+t._s(i.id)+"\n ")])]}}])}),t._v(" "),s("el-table-column",{attrs:{prop:"description",label:t.$t("rule.resource_des")}}),t._v(" "),s("el-table-column",{attrs:{prop:"type",label:t.$t("rule.resource_type")}}),t._v(" "),s("el-table-column",{attrs:{label:t.$t("rule.oper")},scopedSlots:t._u([{key:"default",fn:function(e){var i=e.row,n=e.$index;return[s("el-button",{attrs:{plain:"",type:"success",size:"mini"},on:{click:function(e){return t.viewResource(i)}}},[t._v("\n "+t._s(t.$t("rule.view"))+"\n ")]),t._v(" "),s("el-button",{attrs:{plain:"",size:"mini",type:"warning"},on:{click:function(e){return t.handleDelete(i)}}},[t._v("\n "+t._s(t.$t("rule.delete"))+"\n ")]),t._v(" "),s("el-button",{attrs:{plain:"",type:"success",size:"mini"},on:{click:function(e){return t.viewRunningStatus(i,n)}}},[t._v("\n "+t._s(t.$t("rule.viewStates"))+"\n ")])]}}])})],1),t._v(" "),s("resource-dialog",{ref:"resourceDialog",attrs:{visible:t.dialogVisible},on:{"update:visible":function(e){t.dialogVisible=e},confirm:t.loadData}}),t._v(" "),s("el-dialog",{attrs:{title:t.$t("rule.resource_details"),visible:t.viewDialogVisible},on:{"update:visible":function(e){t.viewDialogVisible=e}}},[s("div",{staticClass:"dialog-preview"},[s("div",{staticClass:"option-item"},[s("div",{staticClass:"option-title"},[t._v("\n "+t._s(t.$t("rule.id"))+"\n ")]),t._v(" "),s("div",{staticClass:"option-value"},[t._v(t._s(t.res.id))])]),t._v(" "),s("div",{staticClass:"option-item"},[s("div",{staticClass:"option-title"},[t._v("\n "+t._s(t.$t("rule.resource_type"))+"\n ")]),t._v(" "),s("div",{staticClass:"option-value"},[t._v(t._s(t.res.type))])]),t._v(" "),s("div",{staticClass:"option-item"},[s("div",{staticClass:"option-title"},[t._v("\n "+t._s(t.$t("rule.resource_des"))+"\n ")]),t._v(" "),s("div",{staticClass:"option-value"},[t._v(t._s(t.res.description))])]),t._v(" "),t.res.config&&Object.keys(t.res.config).length>0?s("div",{staticClass:"option-item"},[s("div",{staticClass:"option-title"},[t._v("\n "+t._s(t.$t("rule.config_info"))+"\n ")]),t._v(" "),s("div",{staticClass:"option-all"},t._l(Object.entries(t.res.config),function(e,i){return s("div",{key:i,staticClass:"option-item"},["object"!=typeof e[1]||Array.isArray(e[1])?[s("div",{staticClass:"option-title"},[t._v("\n "+t._s(e[0])+"\n ")]),t._v(" "),s("div",{staticClass:"option-value"},[t._v("\n "+t._s(e[1])+"\n ")])]:[s("div",{staticClass:"option-title"},[t._v("\n "+t._s(e[0])+"\n ")]),t._v(" "),s("div",{staticClass:"option-value"},[e[1]&&0!==Object.keys(e[1]).length?s("data-table",{staticStyle:{"margin-top":"0"},attrs:{disabled:""},model:{value:e[1],callback:function(s){t.$set(e,1,s)},expression:"item[1]"}}):s("span",[t._v("\n N/A\n ")])],1)]],2)}),0)]):t._e()]),t._v(" "),s("div",{attrs:{slot:"footer"},slot:"footer"},[s("el-button",{staticClass:"confirm-btn",attrs:{type:"success"},on:{click:function(e){t.viewDialogVisible=!1}}},[t._v("\n "+t._s(t.$t("rule.confirm"))+"\n ")])],1)])],1)},staticRenderFns:[]};var l=s("VU/8")(a,o,!1,function(t){s("DGQ0")},null,null);e.default=l.exports}}); -------------------------------------------------------------------------------- /priv/www/static/js/16.6bfd6f3eb9216e73149c.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([16],{RjBg:function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=s("fZjL"),l=s.n(a),o=s("d7EF"),n=s.n(o),r=s("W3Iv"),i=s.n(r),c=s("Dd8w"),d=s.n(c),v=s("zL8q"),u=s("NYxO"),m={name:"overview-view",components:{"el-select":v.Select,"el-option":v.Option,"el-table":v.Table,"el-table-column":v.TableColumn,"el-row":v.Row,"el-col":v.Col},data:function(){return{nodeName:"",brokers:{},nodes:[],stats:[],timer:0,metrics:{packets:[],messages:[],bytes:[],client:[],session:[],delivery:[]}}},methods:d()({},Object(u.b)(["CURRENT_NODE"]),{init:function(){var e=this;this.$httpGet("/nodes").then(function(t){e.nodeName=e.$store.state.nodeName||t.data[0].node,e.nodes=t.data,e.CURRENT_NODE(e.nodeName),e.refreshInterval()}).catch(function(t){e.$message.error(t||e.$t("error.networkError")),setTimeout(function(){e.init()},2e4)})},refreshInterval:function(){this.loadData(),clearInterval(this.timer),this.timer=setInterval(this.loadData,1e4)},loadData:function(){var e=this;this.CURRENT_NODE(this.nodeName),this.$httpGet("/nodes").then(function(t){e.nodes=t.data.sort(function(t,s){return t.node===e.nodeName?-1:t.uptime>s.uptime?-1:1})}),this.$httpGet("/stats").then(function(t){var s=t.data;s.forEach(function(e){var t=d()({node:e.node},e.stats);i()(t).forEach(function(t){var s=n()(t,2),a=s[0],l=s[1],o=a.replace(/\./g,"_");e[o]=l,a.includes(".")&&delete e[a]})}),e.stats=s}),this.$httpGet("/brokers/"+this.nodeName).then(function(t){e.brokers=t.data}),this.$httpGet("/nodes/"+this.nodeName+"/metrics").then(function(t){e.metrics={packets:[],messages:[],bytes:[],client:[],session:[],delivery:[]};var s=d()({},t.data),a={packets:["received","sent","connect","connack","auth","disconnect.sent","disconnect.received","pingreq","pingresp","publish.received","publish.sent","puback.received","puback.sent","puback.missed","pubcomp.received","pubcomp.sent","pubcomp.missed","pubrec.received","pubrec.sent","pubrec.missed","pubrel.received","pubrel.sent","pubrel.missed","subscribe","suback","unsubscribe","unsuback"],messages:["received","sent","dropped","retained","qos0.received","qos0.sent","qos1.received","qos1.sent","qos2.received","qos2.expired","qos2.sent","qos2.dropped"],bytes:["received","sent"],client:["connected","authenticate","auth.anonymous","check_acl","subscribe","unsubscribe","disconnected"],session:["created","resumed","takeovered","discarded","terminated"],delivery:["dropped","dropped.no_local","dropped.too_large","dropped.qos0_msg","dropped.queue_full","dropped.expired"]};l()(a).forEach(function(l){a[l].forEach(function(a){var o=l+"."+a;delete s[o],void 0!==t.data[o]&&e.metrics[l].push({key:a,value:t.data[o]})})}),l()(s).forEach(function(t){var a=t.split(".")[0];e.metrics[a]&&void 0!==s[t]&&e.metrics[a].push({key:t.split(".").slice(1).join("."),value:s[t]})})})}}),created:function(){this.init()},beforeRouteLeave:function(e,t,s){clearInterval(this.timer),s()},beforeDestroy:function(){clearInterval(this.timer)}},p={render:function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"overview-view"},[s("div",{staticClass:"page-title"},[e._v("\n "+e._s(e.$t("leftbar.overview"))+"\n "),s("el-select",{staticClass:"select-radius",attrs:{placeholder:e.$t("select.placeholder")},on:{change:e.loadData},model:{value:e.nodeName,callback:function(t){e.nodeName=t},expression:"nodeName"}},e._l(e.nodes,function(e){return s("el-option",{key:e.node,attrs:{label:e.node,value:e.node}})}),1)],1),e._v(" "),s("div",{staticClass:"card-box",staticStyle:{"margin-top":"54px"}},[s("div",{staticClass:"card-title"},[e._v(e._s(e.$t("overview.broker")))]),e._v(" "),s("el-row",{staticClass:"broker-card",attrs:{gutter:10}},[s("el-col",{attrs:{span:6}},[s("div",{staticClass:"card-item"},[s("div",{staticClass:"icon"},[s("i",{staticClass:"iconfont icon-systemname"})]),e._v(" "),s("div",{staticClass:"desc"},[s("h3",[e._v(e._s(e.$t("overview.systemName")))]),e._v(" "),s("p",[e._v(e._s(e.brokers.sysdescr))])])])]),e._v(" "),s("el-col",{attrs:{span:6}},[s("div",{staticClass:"card-item"},[s("div",{staticClass:"icon"},[s("i",{staticClass:"iconfont icon-version",staticStyle:{"font-weight":"600"}})]),e._v(" "),s("div",{staticClass:"desc"},[s("h3",[e._v(e._s(e.$t("overview.version")))]),e._v(" "),s("p",[e._v(e._s(e.brokers.version))])])])]),e._v(" "),s("el-col",{attrs:{span:6}},[s("div",{staticClass:"card-item"},[s("div",{staticClass:"icon"},[s("i",{staticClass:"iconfont icon-uptime"})]),e._v(" "),s("div",{staticClass:"desc"},[s("h3",[e._v(e._s(e.$t("overview.uptime")))]),e._v(" "),s("p",[e._v(e._s(e.brokers.uptime))])])])]),e._v(" "),s("el-col",{attrs:{span:6}},[s("div",{staticClass:"card-item"},[s("div",{staticClass:"icon",staticStyle:{"line-height":"46px"}},[s("i",{staticClass:"iconfont icon-Systemtime",staticStyle:{"font-size":"36px",top:"2px"}})]),e._v(" "),s("div",{staticClass:"desc"},[s("h3",[e._v(e._s(e.$t("overview.systemTime")))]),e._v(" "),s("p",[e._v(e._s(e.brokers.datetime))])])])])],1)],1),e._v(" "),s("div",{staticClass:"card-box"},[s("div",{staticClass:"card-title"},[e._v(e._s(e.$t("overview.nodes"))+"("+e._s(e.nodes.length)+")")]),e._v(" "),s("el-table",{attrs:{data:e.nodes,border:""}},[s("el-table-column",{attrs:{prop:"node","min-width":"200",label:e.$t("overview.name")}}),e._v(" "),s("el-table-column",{attrs:{prop:"otp_release","min-width":"200",label:e.$t("overview.erlangOTPRelease")}}),e._v(" "),s("el-table-column",{attrs:{label:e.$t("overview.erlangProcesses")}},[s("el-table-column",{attrs:{"min-width":"150",prop:"process",label:"(used/avaliable)"},scopedSlots:e._u([{key:"default",fn:function(t){return[e._v("\n "+e._s(t.row.process_used+" / "+t.row.process_available)+"\n ")]}}])})],1),e._v(" "),s("el-table-column",{attrs:{label:e.$t("overview.cpuInfo")}},[s("el-table-column",{attrs:{"min-width":"180",label:" (1load/5load/15load)"},scopedSlots:e._u([{key:"default",fn:function(t){return[e._v("\n "+e._s(t.row.load1+" / "+t.row.load5+" / "+t.row.load15)+"\n ")]}}])})],1),e._v(" "),s("el-table-column",{attrs:{"min-width":"200",label:e.$t("overview.memoryInfo")}},[s("el-table-column",{attrs:{"min-width":"180",label:" (used/total)"},scopedSlots:e._u([{key:"default",fn:function(t){return[e._v("\n "+e._s(t.row.memory_used+" / "+t.row.memory_total)+"\n ")]}}])})],1),e._v(" "),s("el-table-column",{attrs:{prop:"max_fds","min-width":"120",label:e.$t("overview.maxFds")}}),e._v(" "),s("el-table-column",{attrs:{"min-width":"120",label:e.$t("overview.status")},scopedSlots:e._u([{key:"default",fn:function(t){return[s("span",{class:["Running"===t.row.node_status?"running":"stopped","status"]},[e._v("\n "+e._s(t.row.node_status)+"\n ")])]}}])})],1)],1),e._v(" "),s("div",{staticClass:"card-box"},[s("div",{staticClass:"card-title"},[e._v(e._s(e.$t("overview.stats"))+"("+e._s(e.stats.length)+")")]),e._v(" "),s("el-table",{staticClass:"stats-table",attrs:{data:e.stats,border:""}},[s("el-table-column",{attrs:{prop:"node","min-width":"150",label:e.$t("overview.name")}}),e._v(" "),s("el-table-column",{attrs:{label:e.$t("overview.connectionsCount")}},[s("el-table-column",{attrs:{"min-width":"150",label:"(count/max)"},scopedSlots:e._u([{key:"default",fn:function(t){var s=t.row;return[e._v("\n "+e._s(s.connections_count)+" / "+e._s(s.connections_max)+"\n ")]}}])})],1),e._v(" "),s("el-table-column",{attrs:{label:e.$t("overview.topicsCount")}},[s("el-table-column",{attrs:{"min-width":"150",label:"(count/max)"},scopedSlots:e._u([{key:"default",fn:function(t){var s=t.row;return[e._v("\n "+e._s(s.topics_count)+" / "+e._s(s.topics_max)+"\n ")]}}])})],1),e._v(" "),s("el-table-column",{attrs:{label:e.$t("overview.retainedCount")}},[s("el-table-column",{attrs:{"min-width":"150",label:"(count/max)"},scopedSlots:e._u([{key:"default",fn:function(t){var s=t.row;return[e._v("\n "+e._s(s.retained_count)+" / "+e._s(s.retained_max)+"\n ")]}}])})],1),e._v(" "),s("el-table-column",{attrs:{label:e.$t("overview.sessionsCount")}},[s("el-table-column",{attrs:{"min-width":"150",label:"(count/max)"},scopedSlots:e._u([{key:"default",fn:function(t){var s=t.row;return[e._v("\n "+e._s(s.sessions_count)+" / "+e._s(s.sessions_max)+"\n ")]}}])})],1),e._v(" "),s("el-table-column",{attrs:{label:e.$t("overview.subscriptionsCount")}},[s("el-table-column",{attrs:{"min-width":"150",label:"(count/max)"},scopedSlots:e._u([{key:"default",fn:function(t){var s=t.row;return[e._v("\n "+e._s(s.subscriptions_count)+" / "+e._s(s.subscriptions_max)+"\n ")]}}])})],1),e._v(" "),s("el-table-column",{attrs:{label:e.$t("overview.subscriptionsSharedCount")}},[s("el-table-column",{attrs:{"min-width":"150",label:"(count/max)"},scopedSlots:e._u([{key:"default",fn:function(t){var s=t.row;return[e._v("\n "+e._s(s.subscriptions_shared_count)+" / "+e._s(s.subscriptions_shared_max)+"\n ")]}}])})],1)],1)],1),e._v(" "),s("div",{staticClass:"card-box"},[s("div",{staticClass:"card-title"},[e._v(e._s(e.$t("overview.metrics")))]),e._v(" "),s("el-row",{attrs:{gutter:20}},[s("el-col",{attrs:{span:8}},[s("el-table",{attrs:{data:e.metrics.client}},[s("el-table-column",{attrs:{"min-width":"200",prop:"key",label:e.$t("overview.client")}}),e._v(" "),s("el-table-column",{attrs:{sortable:"",prop:"value",label:""}})],1)],1),e._v(" "),s("el-col",{attrs:{span:8}},[s("el-table",{attrs:{data:e.metrics.delivery}},[s("el-table-column",{attrs:{"min-width":"160",prop:"key",label:e.$t("overview.delivery")}}),e._v(" "),s("el-table-column",{attrs:{sortable:"",prop:"value",label:""}})],1)],1),e._v(" "),s("el-col",{attrs:{span:8}},[s("el-table",{attrs:{data:e.metrics.session}},[s("el-table-column",{attrs:{"min-width":"200",prop:"key",label:e.$t("overview.session")}}),e._v(" "),s("el-table-column",{attrs:{sortable:"",prop:"value",label:""}})],1)],1)],1),e._v(" "),s("el-row",{attrs:{gutter:20}},[s("el-col",{attrs:{span:8}},[s("el-table",{attrs:{data:e.metrics.packets}},[s("el-table-column",{attrs:{"min-width":"200",prop:"key",label:e.$t("overview.packetsData")}}),e._v(" "),s("el-table-column",{attrs:{sortable:"",prop:"value",label:""}})],1)],1),e._v(" "),s("el-col",{attrs:{span:8}},[s("el-table",{attrs:{data:e.metrics.messages}},[s("el-table-column",{attrs:{"min-width":"200",prop:"key",label:e.$t("overview.messagesData")}}),e._v(" "),s("el-table-column",{attrs:{sortable:"",prop:"value",label:""}})],1)],1),e._v(" "),s("el-col",{attrs:{span:8}},[s("el-table",{attrs:{data:e.metrics.bytes}},[s("el-table-column",{attrs:{"min-width":"160",prop:"key",label:e.$t("overview.bytesData")}}),e._v(" "),s("el-table-column",{attrs:{sortable:"",prop:"value",label:""}})],1)],1)],1)],1)])},staticRenderFns:[]};var b=s("VU/8")(m,p,!1,function(e){s("Xk+3")},null,null);t.default=b.exports},"Xk+3":function(e,t){}}); -------------------------------------------------------------------------------- /priv/www/static/js/17.1d56280c16e6e2b81cff.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([17],{EsSr:function(t,e){},wkqA:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"not-found"},[n("p",[t._v("404 Not Found")]),t._v(" "),n("router-link",{attrs:{to:"/"}},[t._v("Homepage")]),t._v(" "),n("router-link",{attrs:{to:"#"},on:{click:function(e){return t.$router.go(-2)}}},[t._v("Back up")])],1)},staticRenderFns:[]};var o=n("VU/8")({name:"NotFound"},r,!1,function(t){n("EsSr")},null,null);e.default=o.exports}}); -------------------------------------------------------------------------------- /priv/www/static/js/18.a0c394cb4b55bee2fa82.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([18],{"6xQH":function(e,r){},lmfZ:function(e,r,s){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=s("Dd8w"),t=s.n(o),n=s("zL8q"),l=s("NYxO"),i={name:"login-view",components:{"el-col":n.Col,"el-row":n.Row,"el-card":n.Card,"el-form":n.Form,"el-form-item":n.FormItem,"el-input":n.Input,"el-checkbox":n.Checkbox,"el-button":n.Button},data:function(){return{remember:!1,user:{username:"",password:""},loginError:{username:"",password:""}}},methods:t()({},Object(l.b)(["USER_LOGIN"]),{login:function(){var e=this;return this.user.username?this.user.password?void this.$axios.post("/auth",this.user).then(function(){e.USER_LOGIN({user:e.user,remember:e.remember}),e.$router.push(e.$route.query.redirect||"/")}).catch(function(){e.loginError.username=e.$t("login.error"),e.user={username:"",password:""}}):(this.loginError.password=this.$t("login.passwordRequired"),!1):(this.loginError.username=this.$t("login.usernameRequired"),!1)}})},a={render:function(){var e=this,r=e.$createElement,s=e._self._c||r;return s("div",{staticClass:"login-view"},[s("el-card",[s("div",{attrs:{slot:"header"},slot:"header"},[e._v("\n "+e._s(e.$t("login.title"))+"\n ")]),e._v(" "),s("el-form",{staticClass:"el-form--public",attrs:{size:"medium","label-position":"top",model:e.user},nativeOn:{keyup:function(r){return!r.type.indexOf("key")&&e._k(r.keyCode,"enter",13,r.key,"Enter")?null:e.login(r)}}},[s("el-form-item",{attrs:{label:e.$t("login.username")}},[s("el-input",{class:{error:e.loginError.username},attrs:{placeholder:e.loginError.username},on:{focus:function(r){e.loginError.username=""}},model:{value:e.user.username,callback:function(r){e.$set(e.user,"username",r)},expression:"user.username"}})],1),e._v(" "),s("el-form-item",{attrs:{label:e.$t("login.password")}},[s("el-input",{class:{error:e.loginError.password},attrs:{type:"password",placeholder:e.loginError.password},on:{focus:function(r){e.loginError.password=""}},model:{value:e.user.password,callback:function(r){e.$set(e.user,"password",r)},expression:"user.password"}})],1)],1),e._v(" "),s("div",{staticClass:"login-footer"},[s("el-checkbox",{model:{value:e.remember,callback:function(r){e.remember=r},expression:"remember"}},[e._v("\n "+e._s(e.$t("login.remember"))+"\n ")]),e._v(" "),s("el-button",{staticClass:"confirm-btn",attrs:{type:"success",loading:e.$store.state.loading,disabled:e.$store.state.loading},on:{click:e.login}},[e._v(e._s(e.$t("login.loginButton"))+"\n ")])],1),e._v(" "),s("div",{staticClass:"clear-fix"})],1)],1)},staticRenderFns:[]};var u=s("VU/8")(i,a,!1,function(e){s("6xQH")},null,null);r.default=u.exports}}); -------------------------------------------------------------------------------- /priv/www/static/js/19.060521bb4ba4f7a81ac0.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([19],{IHTQ:function(e,t){},uuOo:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=n("Dd8w"),a=n.n(s),o=n("NYxO"),l=n("zL8q"),r={name:"listeners-view",components:{"el-select":l.Select,"el-option":l.Option,"el-table":l.Table,"el-table-column":l.TableColumn},data:function(){return{nodeName:"",nodes:[],listeners:[]}},methods:a()({},Object(o.b)(["CURRENT_NODE"]),{loadData:function(){var e=this;this.$httpGet("/nodes").then(function(t){e.nodeName=e.$store.state.nodeName||t.data[0].node,e.nodes=t.data,e.loadListeners()}).catch(function(t){e.$message.error(t||e.$t("error.networkError"))})},loadListeners:function(){var e=this;this.CURRENT_NODE(this.nodeName),this.$httpGet("/nodes/"+this.nodeName+"/listeners").then(function(t){e.listeners=t.data}).catch(function(t){e.$message.error(t||e.$t("error.networkError"))})}}),created:function(){this.loadData()}},i={render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"listeners-view"},[n("div",{staticClass:"page-title"},[e._v("\n "+e._s(e.$t("leftbar.listeners"))+"\n "),n("el-select",{staticClass:"select-radius",attrs:{placeholder:e.$t("select.placeholder"),disabled:e.$store.state.loading},on:{change:e.loadListeners},model:{value:e.nodeName,callback:function(t){e.nodeName=t},expression:"nodeName"}},e._l(e.nodes,function(e){return n("el-option",{key:e.node,attrs:{label:e.node,value:e.node}})}),1)],1),e._v(" "),n("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.$store.state.loading,expression:"$store.state.loading"}],attrs:{border:"",data:e.listeners}},[n("el-table-column",{attrs:{prop:"protocol",width:"240",label:e.$t("listeners.protocol")}}),e._v(" "),n("el-table-column",{attrs:{prop:"listen_on","min-width":"240",label:e.$t("listeners.listenOn")}}),e._v(" "),n("el-table-column",{attrs:{prop:"max_conns","min-width":"180",label:e.$t("listeners.maxConnections")}}),e._v(" "),n("el-table-column",{attrs:{prop:"current_conns","min-width":"120",label:e.$t("listeners.currentConnections")}})],1)],1)},staticRenderFns:[]};var c=n("VU/8")(r,i,!1,function(e){n("IHTQ")},null,null);t.default=c.exports}}); -------------------------------------------------------------------------------- /priv/www/static/js/20.cfbe25ea4f291dbd6a65.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([20],{EyAk:function(t,e){},LbE0:function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var a={name:"help-view",components:{},data:function(){return{lang:window.localStorage.getItem("language")||"en"}},computed:{learnEnterprise:function(){return"zh"===this.lang?"https://www.emqx.io/cn/products/enterprise":"https://www.emqx.io/products/enterprise"},freeTrial:function(){return"zh"===this.lang?"https://www.emqx.io/cn/downloads#enterprise":"https://www.emqx.io/downloads#enterprise"},docsLink:function(){return"zh"===this.lang?"https://docs.emqx.io/broker/latest/cn":"https://docs.emqx.cn/cn/broker/latest/"},faqLink:function(){return"zh"===this.lang?"https://docs.emqx.cn/cn/broker/latest/faq/faq.html":"https://docs.emqx.io/en/broker/latest/faq/faq.html"}},methods:{}},n={render:function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"help-view"},[s("div",{staticClass:"page-title"},[t._v(t._s(t.$t("leftbar.help")))]),t._v(" "),s("div",{staticClass:"help-item"},[s("h3",[t._v(t._s(t.$t("help.quickStart")))]),t._v(" "),s("p",[t._v(t._s(t.$t("help.emqxDesc")))]),t._v(" "),s("a",{attrs:{target:"_blank",href:"https://github.com/emqx/emqx"}},[t._v("Github")])]),t._v(" "),s("el-divider"),t._v(" "),s("div",{staticClass:"help-item"},[s("h3",[t._v(t._s(t.$t("help.emqxEnterprise")))]),t._v(" "),s("p",{domProps:{innerHTML:t._s(t.$t("help.enterpriseDesc"))}}),t._v(" "),s("a",{attrs:{target:"_blank",href:t.learnEnterprise}},[t._v("\n "+t._s(t.$t("oper.learnMore"))+"\n ")]),t._v(" "),s("a",{attrs:{target:"_blank",href:t.freeTrial}},[t._v("\n "+t._s(t.$t("help.freeTrial"))+"\n ")])]),t._v(" "),s("el-divider"),t._v(" "),s("div",{staticClass:"help-item"},[s("h3",[t._v(t._s(t.$t("help.useDocs")))]),t._v(" "),s("p",[t._v(t._s(t.$t("help.docsDesc")))]),t._v(" "),s("a",{attrs:{target:"_blank",href:t.docsLink}},[t._v("\n "+t._s(t.$t("help.forwardView"))+"\n ")])]),t._v(" "),s("el-divider"),t._v(" "),s("div",{staticClass:"help-item"},[s("h3",[t._v("FAQ")]),t._v(" "),s("p",[t._v(t._s(t.$t("help.faqDesc")))]),t._v(" "),s("a",{attrs:{target:"_blank",href:t.faqLink}},[t._v("\n "+t._s(t.$t("help.forwardFaq"))+"\n ")])]),t._v(" "),s("el-divider"),t._v(" "),s("div",{staticClass:"help-item"},[s("h3",[t._v(t._s(t.$t("help.followUs")))]),t._v(" "),t._m(0),t._v(" "),t._m(1),t._v(" "),t._m(2),t._v(" "),t._m(3),t._v(" "),t._m(4),t._v(" "),t._m(5)])],1)},staticRenderFns:[function(){var t=this.$createElement,e=this._self._c||t;return e("a",{staticClass:"follow-link",attrs:{target:"_blank",href:"https://github.com/emqx/emqx"}},[e("i",{staticClass:"iconfont icon-git"})])},function(){var t=this.$createElement,e=this._self._c||t;return e("a",{staticClass:"follow-link",attrs:{target:"_blank",href:"https://twitter.com/emqtt"}},[e("i",{staticClass:"iconfont icon-tuite"})])},function(){var t=this.$createElement,e=this._self._c||t;return e("a",{staticClass:"follow-link",attrs:{target:"_blank",href:"https://emqx.slack.com/"}},[e("i",{staticClass:"iconfont icon-slack"})])},function(){var t=this.$createElement,e=this._self._c||t;return e("a",{staticClass:"follow-link",attrs:{target:"_blank",href:"https://stackoverflow.com/questions/tagged/emq"}},[e("i",{staticClass:"iconfont icon-stack-overflow"})])},function(){var t=this.$createElement,e=this._self._c||t;return e("a",{staticClass:"follow-link",attrs:{target:"_blank",href:"https://groups.google.com/forum/#!forum/emqtt"}},[e("i",{staticClass:"iconfont icon-icons-google_groups"})])},function(){var t=this.$createElement,e=this._self._c||t;return e("a",{staticClass:"follow-link",attrs:{target:"_blank",href:"https://www.youtube.com/channel/UCDU9GWFk8NTGiTvPx_2XskA"}},[e("i",{staticClass:"iconfont icon-youtube"})])}]};var r=s("VU/8")(a,n,!1,function(t){s("EyAk")},null,null);e.default=r.exports}}); -------------------------------------------------------------------------------- /priv/www/static/js/21.ee73105c2358fad5412c.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([21],{Tk0c:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=r("Dd8w"),s=r.n(a),o=r("zL8q"),i=r("CqLJ"),l=r.n(i),p={name:"applications-view",components:{"el-dialog":o.Dialog,"el-input":o.Input,"el-switch":o.Switch,"el-select":o.Select,"el-option":o.Option,"el-button":o.Button,"el-table":o.Table,"el-table-column":o.TableColumn,"el-date-picker":o.DatePicker,"el-popover":o.Popover,"el-tooltip":o.Tooltip,"el-form":o.Form,"el-form-item":o.FormItem,"el-row":o.Row,"el-col":o.Col},data:function(){return{tableData:[],displayDialog:!1,oper:"new",record:{app_id:"",name:"",desc:"",secret:"",expired:"",status:!0},rules:{app_id:[{required:!0,message:this.$t("app.errors")}],name:[{required:!0,message:this.$t("app.errors")}]},popoverVisible:!1,pickerDisable:{disabledDate:function(e){return e.getTime()0&&void 0!==arguments[0]&&arguments[0],r=arguments[1];if(t){var a=s()({},r);13===new Date(a.expired).getTime().toString().length?a.expired/=1e3:a.expired=void 0,this.$httpPut("/apps/"+a.app_id,a).then(function(){e.$message.success(e.$t("oper.editSuccess")),e.loadData()}).catch(function(t){e.$message.error(t||e.$t("error.networkError"))})}else this.$refs.record.validate(function(t){if(t){var r=s()({},e.record);13===new Date(r.expired).getTime().toString().length?r.expired/=1e3:r.expired=void 0,e.$httpPut("/apps/"+r.app_id,r).then(function(){e.displayDialog=!1,e.$message.success(e.$t("oper.editSuccess")),e.loadData()}).catch(function(t){e.$message.error(t||e.$t("error.networkError"))})}})},showApp:function(e){var t=this;this.oper="view",this.$httpGet("/apps/"+e.app_id).then(function(e){t.displayDialog=!0,t.record=e.data,10===t.record.expired.toString().length&&(t.record.expired=new Date(1e3*t.record.expired)),t.displayDialog=!0}).catch(function(e){t.$message.error(e||t.$t("error.networkError"))})},deleteApp:function(e){var t=this;this.$httpDelete("/apps/"+e.app_id).then(function(){t.loadData(),t.hidePopover()}).catch(function(e){t.$message.error(e||t.$t("error.networkError"))})},handleOperation:function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],r=arguments[1];this.displayDialog=!0,setTimeout(function(){t?(e.oper="new",e.record={app_id:Math.random().toString(16).slice(2),name:"",desc:"",secret:"",expired:"",status:!0}):(e.oper="edit",e.record=s()({},r),e.record.expired=e.record.expired&&10===e.record.expired.toString().length?new Date(1e3*e.record.expired):""),e.$refs.record.resetFields()},10)},hidePopover:function(){var e=this;this.popoverVisible=!0,setTimeout(function(){e.popoverVisible=!1},0)},dateFormat:function(e){try{return 10===e.toString().length?l()(1e3*e,"yyyy-mm-dd"):this.$t("app.expiredText")}catch(e){return this.$t("app.expiredText")}}},created:function(){this.loadData()}},n={render:function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"applications-view"},[r("div",{staticClass:"page-title"},[e._v("\n "+e._s(e.$t("leftbar.applications"))+"\n "),r("el-button",{staticClass:"confirm-btn",staticStyle:{float:"right"},attrs:{round:"",plain:"",type:"success",icon:"el-icon-plus",size:"medium",disable:e.$store.state.loading},on:{click:e.handleOperation}},[e._v("\n "+e._s(e.$t("app.newApp"))+"\n ")])],1),e._v(" "),r("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.$store.state.loading,expression:"$store.state.loading"}],attrs:{border:"",data:e.tableData}},[r("el-table-column",{attrs:{prop:"app_id","min-width":"90px",label:e.$t("app.appId")}}),e._v(" "),r("el-table-column",{attrs:{prop:"name","min-width":"100px",label:e.$t("app.name")}}),e._v(" "),r("el-table-column",{attrs:{prop:"expired","min-width":"120px",label:e.$t("app.expired")},scopedSlots:e._u([{key:"default",fn:function(t){return[e._v("\n "+e._s(e.dateFormat(t.row.expired))+"\n ")]}}])}),e._v(" "),r("el-table-column",{attrs:{prop:"desc","min-width":"90px",label:e.$t("app.desc")}}),e._v(" "),r("el-table-column",{attrs:{label:e.$t("app.status")},scopedSlots:e._u([{key:"default",fn:function(t){return[r("el-tooltip",{attrs:{content:t.row.status?e.$t("app.enableText"):e.$t("app.disableText"),placement:"left"}},[r("el-switch",{attrs:{"active-text":"","inactive-text":"","active-color":"#13ce66","inactive-color":"#ff4949"},on:{change:function(r){return e.updateApp(!0,t.row)}},model:{value:t.row.status,callback:function(r){e.$set(t.row,"status",r)},expression:"props.row.status"}})],1)]}}])}),e._v(" "),r("el-table-column",{attrs:{width:"180px",label:e.$t("oper.oper")},scopedSlots:e._u([{key:"default",fn:function(t){return[r("el-button",{attrs:{type:"success",size:"mini",plain:""},on:{click:function(r){return e.showApp(t.row)}}},[e._v("\n "+e._s(e.$t("oper.view"))+"\n ")]),e._v(" "),r("el-button",{attrs:{type:"success",size:"mini",plain:""},on:{click:function(r){return e.handleOperation(!1,t.row)}}},[e._v("\n "+e._s(e.$t("oper.edit"))+"\n ")]),e._v(" "),r("el-popover",{attrs:{placement:"right",trigger:"click",value:e.popoverVisible}},[r("p",[e._v(e._s(e.$t("oper.confirmDelete")))]),e._v(" "),r("div",{staticStyle:{"text-align":"right"}},[r("el-button",{staticClass:"cache-btn",attrs:{size:"mini",type:"text"},on:{click:e.hidePopover}},[e._v("\n "+e._s(e.$t("oper.cancel"))+"\n ")]),e._v(" "),r("el-button",{attrs:{size:"mini",type:"success"},on:{click:function(r){return e.deleteApp(t.row)}}},[e._v("\n "+e._s(e.$t("oper.confirm"))+"\n ")])],1),e._v(" "),r("el-button",{attrs:{slot:"reference",size:"mini",type:"danger",plain:""},slot:"reference"},[e._v("\n "+e._s(e.$t("oper.delete"))+"\n ")])],1)]}}])})],1),e._v(" "),r("el-dialog",{attrs:{width:"view"===e.oper?"660px":"500px",visible:e.displayDialog,title:e.$t("app."+e.oper+"App")},on:{"update:visible":function(t){e.displayDialog=t}},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.createApp(t)}}},[r("el-form",{ref:"record",staticClass:"el-form--public app-info",attrs:{size:"medium",rules:"view"===e.oper?{}:e.rules,model:e.record}},[r("el-row",{attrs:{gutter:20}},["view"===e.oper?[r("el-col",{attrs:{span:12}},[r("el-form-item",{attrs:{prop:"app_id",label:e.$t("app.appId")}},[r("el-input",{staticClass:"is-disabled",attrs:{readonly:!0},model:{value:e.record.app_id,callback:function(t){e.$set(e.record,"app_id",t)},expression:"record.app_id"}})],1)],1),e._v(" "),r("el-col",{attrs:{span:12}},[r("el-form-item",{attrs:{label:e.$t("app.secret")}},[r("el-input",{staticClass:"is-disabled",attrs:{readonly:!0},model:{value:e.record.secret,callback:function(t){e.$set(e.record,"secret",t)},expression:"record.secret"}})],1)],1),e._v(" "),r("el-col",{attrs:{span:12}},[r("el-form-item",{attrs:{prop:"name",label:e.$t("app.name")}},[r("el-input",{staticClass:"is-disabled",attrs:{readonly:!0},model:{value:e.record.name,callback:function(t){e.$set(e.record,"name",t)},expression:"record.name"}})],1)],1),e._v(" "),r("el-col",{attrs:{span:12}},[r("el-form-item",{attrs:{prop:"status",label:e.$t("app.status")}},[r("el-select",{staticClass:"el-select--public",attrs:{"popper-class":"el-select--public",disabled:"view"===e.oper},model:{value:e.record.status,callback:function(t){e.$set(e.record,"status",t)},expression:"record.status"}},[r("el-option",{attrs:{label:e.$t("app.enable"),value:!0}}),e._v(" "),r("el-option",{attrs:{label:e.$t("app.disable"),value:!1}})],1)],1)],1),e._v(" "),r("el-col",{attrs:{span:12}},[r("el-form-item",{attrs:{label:e.$t("app.expired")}},[r("el-date-picker",{attrs:{"picker-options":e.pickerDisable,placeholder:e.$t("app.expiredText"),disabled:"view"===e.oper},model:{value:e.record.expired,callback:function(t){e.$set(e.record,"expired",t)},expression:"record.expired"}})],1)],1),e._v(" "),r("el-col",{attrs:{span:12}},[r("el-form-item",{attrs:{prop:"desc",label:e.$t("app.desc")}},[r("el-input",{staticClass:"is-disabled",attrs:{readonly:!0},model:{value:e.record.desc,callback:function(t){e.$set(e.record,"desc",t)},expression:"record.desc"}})],1)],1)]:[r("el-col",{attrs:{span:12}},[r("el-form-item",{attrs:{prop:"app_id",label:e.$t("app.appId")}},[r("el-input",{attrs:{disabled:["view","edit"].includes(e.oper)},model:{value:e.record.app_id,callback:function(t){e.$set(e.record,"app_id",t)},expression:"record.app_id"}})],1)],1),e._v(" "),r("el-col",{attrs:{span:12}},["view"===e.oper?r("el-form-item",{attrs:{label:e.$t("app.secret")}},[r("el-input",{attrs:{disabled:""},model:{value:e.record.secret,callback:function(t){e.$set(e.record,"secret",t)},expression:"record.secret"}})],1):e._e()],1),e._v(" "),r("el-col",{attrs:{span:12}},[r("el-form-item",{attrs:{prop:"name",label:e.$t("app.name")}},[r("el-input",{attrs:{disabled:["view","edit"].includes(e.oper)},model:{value:e.record.name,callback:function(t){e.$set(e.record,"name",t)},expression:"record.name"}})],1)],1),e._v(" "),r("el-col",{attrs:{span:12}}),e._v(" "),r("el-col",{attrs:{span:12}},[r("el-form-item",{attrs:{prop:"status",label:e.$t("app.status")}},[r("el-select",{staticClass:"el-select--public",attrs:{"popper-class":"el-select--public",disabled:"view"===e.oper},model:{value:e.record.status,callback:function(t){e.$set(e.record,"status",t)},expression:"record.status"}},[r("el-option",{attrs:{label:e.$t("app.enable"),value:!0}}),e._v(" "),r("el-option",{attrs:{label:e.$t("app.disable"),value:!1}})],1)],1)],1),e._v(" "),r("el-col",{attrs:{span:12}},[r("el-form-item",{attrs:{label:e.$t("app.expired")}},[r("el-date-picker",{attrs:{"picker-options":e.pickerDisable,placeholder:e.$t("app.expiredText"),disabled:"view"===e.oper},model:{value:e.record.expired,callback:function(t){e.$set(e.record,"expired",t)},expression:"record.expired"}})],1)],1),e._v(" "),r("el-col",{attrs:{span:12}},[r("el-form-item",{attrs:{prop:"desc",label:e.$t("app.desc")}},[r("el-input",{attrs:{disabled:["view"].includes(e.oper)},model:{value:e.record.desc,callback:function(t){e.$set(e.record,"desc",t)},expression:"record.desc"}})],1)],1)]],2)],1),e._v(" "),"view"!==e.oper?r("div",{attrs:{slot:"footer"},slot:"footer"},[r("el-button",{staticClass:"cache-btn",attrs:{type:"text"},on:{click:function(t){e.displayDialog=!1}}},[e._v("\n "+e._s(e.$t("oper.cancel"))+"\n ")]),e._v(" "),"edit"===e.oper?r("el-button",{staticClass:"confirm-btn",attrs:{type:"success",loading:e.$store.state.loading,disabled:e.$store.state.loading},on:{click:function(t){return e.updateApp(!1)}}},[e._v("\n "+e._s(e.$t("oper.save"))+"\n ")]):e._e(),e._v(" "),"new"===e.oper?r("el-button",{staticClass:"confirm-btn",attrs:{type:"success",loading:e.$store.state.loading,disabled:e.$store.state.loading},on:{click:e.createApp}},[e._v("\n "+e._s(e.$t("oper.save"))+"\n ")]):e._e()],1):r("div",{attrs:{slot:"footer"},slot:"footer"},[r("div",{staticClass:"guide-doc"},[e._v("\n "+e._s(this.$t("app.guide"))+"\n "),r("a",{attrs:{href:"zh"===e.lang?"https://docs.emqx.cn/cn/broker/latest/advanced/http-api.html":"https://docs.emqx.io/en/broker/latest/advanced/http-api.html",target:"_blank"}},[e._v("\n "+e._s(e.$t("app.docs"))+"\n ")])])])],1)],1)},staticRenderFns:[]};var c=r("VU/8")(p,n,!1,function(e){r("kaFA")},null,null);t.default=c.exports},kaFA:function(e,t){}}); -------------------------------------------------------------------------------- /priv/www/static/js/22.11a12a03cd65b7eb6d44.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([22],{OgCE:function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=a("zL8q"),l=a("JaHG"),r=a("CqLJ"),o=a.n(r),s={name:"alarms-view",components:{"el-table":n.Table,"el-table-column":n.TableColumn,"el-popover":n.Popover,"el-tooltip":n.Tooltip},data:function(){return{loading:!1,currentTableData:[],historicalTableData:[],lang:window.localStorage.getItem("language")||"en"}},methods:{loadData:function(){this.loadAlarmData("activated","currentTableData"),this.loadAlarmData("deactivated","historicalTableData")},loadAlarmData:function(t,e){var a=this;this.loading=!0,this.$httpGet("/alarms/"+t).then(function(t){var n=[];t.data.forEach(function(t){t.alarms.forEach(function(e){e.node=t.node,n.push(e)})}),a[e]=n,a.loading=!1}).catch(function(t){a.loading=!1,a.$message.error(t||a.$t("error.networkError"))})},getDuration:function(t){return Object(l.a)(t/1e3)},dateFormat:function(t){return"number"!=typeof t&&"infinity"===t?"":o()(t/1e3,"yyyy-mm-dd HH:MM:ss")},handleCancelAlarm:function(t,e,a){var n=this,l={node:t.node,name:t.name};this.$httpPost("/alarms/deactivated",l).then(function(){a.$refs["popover-"+e].doClose(),n.loadData()}).catch(function(t){n.$message.error(t||n.$t("error.networkError"))})},handleClearAll:function(){var t=this;this.$confirm(this.$t("analysis.confirmClear"),this.$t("oper.warning"),{confirmButtonClass:"confirm-btn",cancelButtonClass:"cache-btn el-button--text",type:"warning"}).then(function(){t.$httpDelete("/alarms/deactivated").then(function(){t.loadData()}).catch(function(e){t.$message.error(e||t.$t("error.networkError"))})}).catch(function(){})}},created:function(){this.loadData()}},i={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"alarms-view"},[a("div",{staticClass:"page-title"},[t._v("\n "+t._s(t.$t("leftbar.alarms"))+"\n ")]),t._v(" "),a("div",{staticClass:"table-title"},[t._v(t._s(t.$t("analysis.currentAlarms")))]),t._v(" "),a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],attrs:{border:"",data:t.currentTableData}},[a("el-table-column",{attrs:{prop:"name",label:t.$t("analysis.alarmName")}}),t._v(" "),a("el-table-column",{attrs:{prop:"message","min-width":"140px",label:t.$t("analysis.alarmMessage"),"show-overflow-tooltip":""},scopedSlots:t._u([{key:"default",fn:function(e){var n=e.row;return[a("el-popover",{attrs:{placement:"top",trigger:"hover",width:"160","open-delay":500}},[t._l(n.details,function(e,n){return a("div",{key:n},[t._v(t._s(n)+": "+t._s(e))])}),t._v(" "),a("span",{staticClass:"details",attrs:{slot:"reference"},slot:"reference"},[a("i",{staticClass:"iconfont icon-bangzhu"})])],2),t._v(" "),a("span",[t._v(t._s(n.message))])]}}])}),t._v(" "),a("el-table-column",{attrs:{prop:"node","min-width":"60px",label:t.$t("clients.node"),"show-overflow-tooltip":""}}),t._v(" "),a("el-table-column",{attrs:{prop:"activate_at",label:t.$t("analysis.activateAt")},scopedSlots:t._u([{key:"default",fn:function(e){var a=e.row;return[t._v("\n "+t._s(t.dateFormat(a.activate_at))+"\n ")]}}])}),t._v(" "),a("el-table-column",{scopedSlots:t._u([{key:"default",fn:function(e){var a=e.row;return[t._v("\n "+t._s(t.getDuration(a.duration))+"\n ")]}}])},[a("span",{attrs:{slot:"header"},slot:"header"},[t._v("\n "+t._s(t.$t("analysis.duration"))+"\n "),a("el-popover",{attrs:{trigger:"hover",placement:"top"}},[t._v("\n "+t._s(t.$t("analysis.durationTips"))+"\n "),a("i",{staticClass:"el-icon-question",attrs:{slot:"reference"},slot:"reference"})])],1)]),t._v(" "),a("el-table-column",{attrs:{fixed:"right",width:"120px",label:t.$t("oper.oper")},scopedSlots:t._u([{key:"default",fn:function(e){var n=e.row,l=e.$index,r=e._self;return[a("el-popover",{ref:"popover-"+l,attrs:{placement:"right",trigger:"click"}},[a("p",[t._v(t._s(t.$t("analysis.confirmDeactivate")))]),t._v(" "),a("div",{staticStyle:{"text-align":"right"}},[a("el-button",{staticClass:"cache-btn",attrs:{size:"mini",type:"text"},on:{click:function(t){r.$refs["popover-"+l].doClose()}}},[t._v("\n "+t._s(t.$t("oper.cancel"))+"\n ")]),t._v(" "),a("el-button",{attrs:{size:"mini",type:"success"},on:{click:function(e){return t.handleCancelAlarm(n,l,r)}}},[t._v("\n "+t._s(t.$t("oper.confirm"))+"\n ")])],1),t._v(" "),a("el-button",{attrs:{slot:"reference",size:"mini",type:"danger",plain:""},slot:"reference"},[t._v("\n "+t._s(t.$t("analysis.deactivate"))+"\n ")])],1)]}}])})],1),t._v(" "),a("div",{staticClass:"table-title"},[t._v("\n "+t._s(t.$t("analysis.historicalAlarm"))+"\n "),a("el-button",{staticClass:"table-oper",attrs:{size:"mini",type:"danger",plain:"",disabled:!t.historicalTableData.length},on:{click:t.handleClearAll}},[t._v("\n "+t._s(t.$t("analysis.clearAll"))+"\n ")])],1),t._v(" "),a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],attrs:{border:"",data:t.historicalTableData}},[a("el-table-column",{attrs:{prop:"name",label:t.$t("analysis.alarmName")}}),t._v(" "),a("el-table-column",{attrs:{prop:"message","min-width":"140px",label:t.$t("analysis.alarmMessage"),"show-overflow-tooltip":""},scopedSlots:t._u([{key:"default",fn:function(e){var n=e.row;return[a("el-popover",{attrs:{placement:"top",trigger:"hover",width:"160","open-delay":500}},[t._l(n.details,function(e,n){return a("div",{key:n},[t._v(t._s(n)+": "+t._s(e))])}),t._v(" "),a("span",{staticClass:"details",attrs:{slot:"reference"},slot:"reference"},[a("i",{staticClass:"iconfont icon-bangzhu"})])],2),t._v(" "),a("span",[t._v(t._s(n.message))])]}}])}),t._v(" "),a("el-table-column",{attrs:{prop:"node","min-width":"60px",label:t.$t("clients.node"),"show-overflow-tooltip":""}}),t._v(" "),a("el-table-column",{attrs:{prop:"activate_at",label:t.$t("analysis.activateAt")},scopedSlots:t._u([{key:"default",fn:function(e){var a=e.row;return[t._v("\n "+t._s(t.dateFormat(a.activate_at))+"\n ")]}}])}),t._v(" "),a("el-table-column",{attrs:{prop:"deactivate_at",label:t.$t("analysis.deactivateAt")},scopedSlots:t._u([{key:"default",fn:function(e){var a=e.row;return[t._v("\n "+t._s(t.dateFormat(a.deactivate_at))+"\n ")]}}])})],1)],1)},staticRenderFns:[]};var c=a("VU/8")(s,i,!1,function(t){a("rRj3")},null,null);e.default=c.exports},rRj3:function(t,e){}}); -------------------------------------------------------------------------------- /priv/www/static/js/26.9cd922cc7e5d035cbcc7.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([26],{"77T5":function(E,T,R){"use strict";Object.defineProperty(T,"__esModule",{value:!0}),R.d(T,"conf",function(){return A}),R.d(T,"language",function(){return I});var A={comments:{lineComment:"--",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}]},I={defaultToken:"",tokenPostfix:".sql",ignoreCase:!0,brackets:[{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"}],keywords:["ABORT_AFTER_WAIT","ABSENT","ABSOLUTE","ACCENT_SENSITIVITY","ACTION","ACTIVATION","ACTIVE","ADD","ADDRESS","ADMIN","AES","AES_128","AES_192","AES_256","AFFINITY","AFTER","AGGREGATE","ALGORITHM","ALL_CONSTRAINTS","ALL_ERRORMSGS","ALL_INDEXES","ALL_LEVELS","ALL_SPARSE_COLUMNS","ALLOW_CONNECTIONS","ALLOW_MULTIPLE_EVENT_LOSS","ALLOW_PAGE_LOCKS","ALLOW_ROW_LOCKS","ALLOW_SINGLE_EVENT_LOSS","ALLOW_SNAPSHOT_ISOLATION","ALLOWED","ALTER","ANONYMOUS","ANSI_DEFAULTS","ANSI_NULL_DEFAULT","ANSI_NULL_DFLT_OFF","ANSI_NULL_DFLT_ON","ANSI_NULLS","ANSI_PADDING","ANSI_WARNINGS","APPEND","APPLICATION","APPLICATION_LOG","ARITHABORT","ARITHIGNORE","AS","ASC","ASSEMBLY","ASYMMETRIC","ASYNCHRONOUS_COMMIT","AT","ATOMIC","ATTACH","ATTACH_REBUILD_LOG","AUDIT","AUDIT_GUID","AUTHENTICATION","AUTHORIZATION","AUTO","AUTO_CLEANUP","AUTO_CLOSE","AUTO_CREATE_STATISTICS","AUTO_SHRINK","AUTO_UPDATE_STATISTICS","AUTO_UPDATE_STATISTICS_ASYNC","AUTOMATED_BACKUP_PREFERENCE","AUTOMATIC","AVAILABILITY","AVAILABILITY_MODE","BACKUP","BACKUP_PRIORITY","BASE64","BATCHSIZE","BEGIN","BEGIN_DIALOG","BIGINT","BINARY","BINDING","BIT","BLOCKERS","BLOCKSIZE","BOUNDING_BOX","BREAK","BROKER","BROKER_INSTANCE","BROWSE","BUCKET_COUNT","BUFFER","BUFFERCOUNT","BULK","BULK_LOGGED","BY","CACHE","CALL","CALLED","CALLER","CAP_CPU_PERCENT","CASCADE","CASE","CATALOG","CATCH","CELLS_PER_OBJECT","CERTIFICATE","CHANGE_RETENTION","CHANGE_TRACKING","CHANGES","CHAR","CHARACTER","CHECK","CHECK_CONSTRAINTS","CHECK_EXPIRATION","CHECK_POLICY","CHECKALLOC","CHECKCATALOG","CHECKCONSTRAINTS","CHECKDB","CHECKFILEGROUP","CHECKIDENT","CHECKPOINT","CHECKTABLE","CLASSIFIER_FUNCTION","CLEANTABLE","CLEANUP","CLEAR","CLOSE","CLUSTER","CLUSTERED","CODEPAGE","COLLATE","COLLECTION","COLUMN","COLUMN_SET","COLUMNS","COLUMNSTORE","COLUMNSTORE_ARCHIVE","COMMIT","COMMITTED","COMPATIBILITY_LEVEL","COMPRESSION","COMPUTE","CONCAT","CONCAT_NULL_YIELDS_NULL","CONFIGURATION","CONNECT","CONSTRAINT","CONTAINMENT","CONTENT","CONTEXT","CONTINUE","CONTINUE_AFTER_ERROR","CONTRACT","CONTRACT_NAME","CONTROL","CONVERSATION","COOKIE","COPY_ONLY","COUNTER","CPU","CREATE","CREATE_NEW","CREATION_DISPOSITION","CREDENTIAL","CRYPTOGRAPHIC","CUBE","CURRENT","CURRENT_DATE","CURSOR","CURSOR_CLOSE_ON_COMMIT","CURSOR_DEFAULT","CYCLE","DATA","DATA_COMPRESSION","DATA_PURITY","DATABASE","DATABASE_DEFAULT","DATABASE_MIRRORING","DATABASE_SNAPSHOT","DATAFILETYPE","DATE","DATE_CORRELATION_OPTIMIZATION","DATEFIRST","DATEFORMAT","DATETIME","DATETIME2","DATETIMEOFFSET","DAY","DAYOFYEAR","DAYS","DB_CHAINING","DBCC","DBREINDEX","DDL_DATABASE_LEVEL_EVENTS","DEADLOCK_PRIORITY","DEALLOCATE","DEC","DECIMAL","DECLARE","DECRYPTION","DEFAULT","DEFAULT_DATABASE","DEFAULT_FULLTEXT_LANGUAGE","DEFAULT_LANGUAGE","DEFAULT_SCHEMA","DEFINITION","DELAY","DELAYED_DURABILITY","DELETE","DELETED","DENSITY_VECTOR","DENY","DEPENDENTS","DES","DESC","DESCRIPTION","DESX","DHCP","DIAGNOSTICS","DIALOG","DIFFERENTIAL","DIRECTORY_NAME","DISABLE","DISABLE_BROKER","DISABLED","DISK","DISTINCT","DISTRIBUTED","DOCUMENT","DOUBLE","DROP","DROP_EXISTING","DROPCLEANBUFFERS","DUMP","DURABILITY","DYNAMIC","EDITION","ELEMENTS","ELSE","EMERGENCY","EMPTY","EMPTYFILE","ENABLE","ENABLE_BROKER","ENABLED","ENCRYPTION","END","ENDPOINT","ENDPOINT_URL","ERRLVL","ERROR","ERROR_BROKER_CONVERSATIONS","ERRORFILE","ESCAPE","ESTIMATEONLY","EVENT","EVENT_RETENTION_MODE","EXEC","EXECUTABLE","EXECUTE","EXIT","EXPAND","EXPIREDATE","EXPIRY_DATE","EXPLICIT","EXTENDED_LOGICAL_CHECKS","EXTENSION","EXTERNAL","EXTERNAL_ACCESS","FAIL_OPERATION","FAILOVER","FAILOVER_MODE","FAILURE_CONDITION_LEVEL","FALSE","FAN_IN","FAST","FAST_FORWARD","FETCH","FIELDTERMINATOR","FILE","FILEGROUP","FILEGROWTH","FILELISTONLY","FILENAME","FILEPATH","FILESTREAM","FILESTREAM_ON","FILETABLE_COLLATE_FILENAME","FILETABLE_DIRECTORY","FILETABLE_FULLPATH_UNIQUE_CONSTRAINT_NAME","FILETABLE_NAMESPACE","FILETABLE_PRIMARY_KEY_CONSTRAINT_NAME","FILETABLE_STREAMID_UNIQUE_CONSTRAINT_NAME","FILLFACTOR","FILTERING","FIRE_TRIGGERS","FIRST","FIRSTROW","FLOAT","FMTONLY","FOLLOWING","FOR","FORCE","FORCE_FAILOVER_ALLOW_DATA_LOSS","FORCE_SERVICE_ALLOW_DATA_LOSS","FORCED","FORCEPLAN","FORCESCAN","FORCESEEK","FOREIGN","FORMATFILE","FORMSOF","FORWARD_ONLY","FREE","FREEPROCCACHE","FREESESSIONCACHE","FREESYSTEMCACHE","FROM","FULL","FULLSCAN","FULLTEXT","FUNCTION","GB","GEOGRAPHY_AUTO_GRID","GEOGRAPHY_GRID","GEOMETRY_AUTO_GRID","GEOMETRY_GRID","GET","GLOBAL","GO","GOTO","GOVERNOR","GRANT","GRIDS","GROUP","GROUP_MAX_REQUESTS","HADR","HASH","HASHED","HAVING","HEADERONLY","HEALTH_CHECK_TIMEOUT","HELP","HIERARCHYID","HIGH","HINT","HISTOGRAM","HOLDLOCK","HONOR_BROKER_PRIORITY","HOUR","HOURS","IDENTITY","IDENTITY_INSERT","IDENTITY_VALUE","IDENTITYCOL","IF","IGNORE_CONSTRAINTS","IGNORE_DUP_KEY","IGNORE_NONCLUSTERED_COLUMNSTORE_INDEX","IGNORE_TRIGGERS","IMAGE","IMMEDIATE","IMPERSONATE","IMPLICIT_TRANSACTIONS","IMPORTANCE","INCLUDE","INCREMENT","INCREMENTAL","INDEX","INDEXDEFRAG","INFINITE","INFLECTIONAL","INIT","INITIATOR","INPUT","INPUTBUFFER","INSENSITIVE","INSERT","INSERTED","INSTEAD","INT","INTEGER","INTO","IO","IP","ISABOUT","ISOLATION","JOB","KB","KEEP","KEEP_CDC","KEEP_NULLS","KEEP_REPLICATION","KEEPDEFAULTS","KEEPFIXED","KEEPIDENTITY","KEEPNULLS","KERBEROS","KEY","KEY_SOURCE","KEYS","KEYSET","KILL","KILOBYTES_PER_BATCH","LABELONLY","LANGUAGE","LAST","LASTROW","LEVEL","LEVEL_1","LEVEL_2","LEVEL_3","LEVEL_4","LIFETIME","LIMIT","LINENO","LIST","LISTENER","LISTENER_IP","LISTENER_PORT","LOAD","LOADHISTORY","LOB_COMPACTION","LOCAL","LOCAL_SERVICE_NAME","LOCK_ESCALATION","LOCK_TIMEOUT","LOGIN","LOGSPACE","LOOP","LOW","MANUAL","MARK","MARK_IN_USE_FOR_REMOVAL","MASTER","MAX_CPU_PERCENT","MAX_DISPATCH_LATENCY","MAX_DOP","MAX_DURATION","MAX_EVENT_SIZE","MAX_FILES","MAX_IOPS_PER_VOLUME","MAX_MEMORY","MAX_MEMORY_PERCENT","MAX_QUEUE_READERS","MAX_ROLLOVER_FILES","MAX_SIZE","MAXDOP","MAXERRORS","MAXLENGTH","MAXRECURSION","MAXSIZE","MAXTRANSFERSIZE","MAXVALUE","MB","MEDIADESCRIPTION","MEDIANAME","MEDIAPASSWORD","MEDIUM","MEMBER","MEMORY_OPTIMIZED","MEMORY_OPTIMIZED_DATA","MEMORY_OPTIMIZED_ELEVATE_TO_SNAPSHOT","MEMORY_PARTITION_MODE","MERGE","MESSAGE","MESSAGE_FORWARD_SIZE","MESSAGE_FORWARDING","MICROSECOND","MILLISECOND","MIN_CPU_PERCENT","MIN_IOPS_PER_VOLUME","MIN_MEMORY_PERCENT","MINUTE","MINUTES","MINVALUE","MIRROR","MIRROR_ADDRESS","MODIFY","MONEY","MONTH","MOVE","MULTI_USER","MUST_CHANGE","NAME","NANOSECOND","NATIONAL","NATIVE_COMPILATION","NCHAR","NEGOTIATE","NESTED_TRIGGERS","NEW_ACCOUNT","NEW_BROKER","NEW_PASSWORD","NEWNAME","NEXT","NO","NO_BROWSETABLE","NO_CHECKSUM","NO_COMPRESSION","NO_EVENT_LOSS","NO_INFOMSGS","NO_TRUNCATE","NO_WAIT","NOCHECK","NOCOUNT","NOEXEC","NOEXPAND","NOFORMAT","NOINDEX","NOINIT","NOLOCK","NON","NON_TRANSACTED_ACCESS","NONCLUSTERED","NONE","NORECOMPUTE","NORECOVERY","NORESEED","NORESET","NOREWIND","NORMAL","NOSKIP","NOTIFICATION","NOTRUNCATE","NOUNLOAD","NOWAIT","NTEXT","NTLM","NUMANODE","NUMERIC","NUMERIC_ROUNDABORT","NVARCHAR","OBJECT","OF","OFF","OFFLINE","OFFSET","OFFSETS","OLD_ACCOUNT","OLD_PASSWORD","ON","ON_FAILURE","ONLINE","ONLY","OPEN","OPEN_EXISTING","OPENTRAN","OPTIMISTIC","OPTIMIZE","OPTION","ORDER","OUT","OUTPUT","OUTPUTBUFFER","OVER","OVERRIDE","OWNER","OWNERSHIP","PAD_INDEX","PAGE","PAGE_VERIFY","PAGECOUNT","PAGLOCK","PARAMETERIZATION","PARSEONLY","PARTIAL","PARTITION","PARTITIONS","PARTNER","PASSWORD","PATH","PER_CPU","PER_NODE","PERCENT","PERMISSION_SET","PERSISTED","PHYSICAL_ONLY","PLAN","POISON_MESSAGE_HANDLING","POOL","POPULATION","PORT","PRECEDING","PRECISION","PRIMARY","PRIMARY_ROLE","PRINT","PRIOR","PRIORITY","PRIORITY_LEVEL","PRIVATE","PRIVILEGES","PROC","PROCCACHE","PROCEDURE","PROCEDURE_NAME","PROCESS","PROFILE","PROPERTY","PROPERTY_DESCRIPTION","PROPERTY_INT_ID","PROPERTY_SET_GUID","PROVIDER","PROVIDER_KEY_NAME","PUBLIC","PUT","QUARTER","QUERY","QUERY_GOVERNOR_COST_LIMIT","QUEUE","QUEUE_DELAY","QUOTED_IDENTIFIER","RAISERROR","RANGE","RAW","RC2","RC4","RC4_128","READ","READ_COMMITTED_SNAPSHOT","READ_ONLY","READ_ONLY_ROUTING_LIST","READ_ONLY_ROUTING_URL","READ_WRITE","READ_WRITE_FILEGROUPS","READCOMMITTED","READCOMMITTEDLOCK","READONLY","READPAST","READTEXT","READUNCOMMITTED","READWRITE","REAL","REBUILD","RECEIVE","RECOMPILE","RECONFIGURE","RECOVERY","RECURSIVE","RECURSIVE_TRIGGERS","REFERENCES","REGENERATE","RELATED_CONVERSATION","RELATED_CONVERSATION_GROUP","RELATIVE","REMOTE","REMOTE_PROC_TRANSACTIONS","REMOTE_SERVICE_NAME","REMOVE","REORGANIZE","REPAIR_ALLOW_DATA_LOSS","REPAIR_FAST","REPAIR_REBUILD","REPEATABLE","REPEATABLEREAD","REPLICA","REPLICATION","REQUEST_MAX_CPU_TIME_SEC","REQUEST_MAX_MEMORY_GRANT_PERCENT","REQUEST_MEMORY_GRANT_TIMEOUT_SEC","REQUIRED","RESAMPLE","RESEED","RESERVE_DISK_SPACE","RESET","RESOURCE","RESTART","RESTORE","RESTRICT","RESTRICTED_USER","RESULT","RESUME","RETAINDAYS","RETENTION","RETURN","RETURNS","REVERT","REVOKE","REWIND","REWINDONLY","ROBUST","ROLE","ROLLBACK","ROLLUP","ROOT","ROUTE","ROW","ROWCOUNT","ROWGUIDCOL","ROWLOCK","ROWS","ROWS_PER_BATCH","ROWTERMINATOR","ROWVERSION","RSA_1024","RSA_2048","RSA_512","RULE","SAFE","SAFETY","SAMPLE","SAVE","SCHEDULER","SCHEMA","SCHEMA_AND_DATA","SCHEMA_ONLY","SCHEMABINDING","SCHEME","SCROLL","SCROLL_LOCKS","SEARCH","SECOND","SECONDARY","SECONDARY_ONLY","SECONDARY_ROLE","SECONDS","SECRET","SECURITY_LOG","SECURITYAUDIT","SELECT","SELECTIVE","SELF","SEND","SENT","SEQUENCE","SERIALIZABLE","SERVER","SERVICE","SERVICE_BROKER","SERVICE_NAME","SESSION","SESSION_TIMEOUT","SET","SETS","SETUSER","SHOW_STATISTICS","SHOWCONTIG","SHOWPLAN","SHOWPLAN_ALL","SHOWPLAN_TEXT","SHOWPLAN_XML","SHRINKDATABASE","SHRINKFILE","SHUTDOWN","SID","SIGNATURE","SIMPLE","SINGLE_BLOB","SINGLE_CLOB","SINGLE_NCLOB","SINGLE_USER","SINGLETON","SIZE","SKIP","SMALLDATETIME","SMALLINT","SMALLMONEY","SNAPSHOT","SORT_IN_TEMPDB","SOURCE","SPARSE","SPATIAL","SPATIAL_WINDOW_MAX_CELLS","SPECIFICATION","SPLIT","SQL","SQL_VARIANT","SQLPERF","STANDBY","START","START_DATE","STARTED","STARTUP_STATE","STAT_HEADER","STATE","STATEMENT","STATIC","STATISTICAL_SEMANTICS","STATISTICS","STATISTICS_INCREMENTAL","STATISTICS_NORECOMPUTE","STATS","STATS_STREAM","STATUS","STATUSONLY","STOP","STOP_ON_ERROR","STOPAT","STOPATMARK","STOPBEFOREMARK","STOPLIST","STOPPED","SUBJECT","SUBSCRIPTION","SUPPORTED","SUSPEND","SWITCH","SYMMETRIC","SYNCHRONOUS_COMMIT","SYNONYM","SYSNAME","SYSTEM","TABLE","TABLERESULTS","TABLESAMPLE","TABLOCK","TABLOCKX","TAKE","TAPE","TARGET","TARGET_RECOVERY_TIME","TB","TCP","TEXT","TEXTIMAGE_ON","TEXTSIZE","THEN","THESAURUS","THROW","TIES","TIME","TIMEOUT","TIMER","TIMESTAMP","TINYINT","TO","TOP","TORN_PAGE_DETECTION","TRACEOFF","TRACEON","TRACESTATUS","TRACK_CAUSALITY","TRACK_COLUMNS_UPDATED","TRAN","TRANSACTION","TRANSFER","TRANSFORM_NOISE_WORDS","TRIGGER","TRIPLE_DES","TRIPLE_DES_3KEY","TRUE","TRUNCATE","TRUNCATEONLY","TRUSTWORTHY","TRY","TSQL","TWO_DIGIT_YEAR_CUTOFF","TYPE","TYPE_WARNING","UNBOUNDED","UNCHECKED","UNCOMMITTED","UNDEFINED","UNIQUE","UNIQUEIDENTIFIER","UNKNOWN","UNLIMITED","UNLOAD","UNSAFE","UPDATE","UPDATETEXT","UPDATEUSAGE","UPDLOCK","URL","USE","USED","USER","USEROPTIONS","USING","VALID_XML","VALIDATION","VALUE","VALUES","VARBINARY","VARCHAR","VARYING","VERIFYONLY","VERSION","VIEW","VIEW_METADATA","VIEWS","VISIBILITY","WAIT_AT_LOW_PRIORITY","WAITFOR","WEEK","WEIGHT","WELL_FORMED_XML","WHEN","WHERE","WHILE","WINDOWS","WITH","WITHIN","WITHOUT","WITNESS","WORK","WORKLOAD","WRITETEXT","XACT_ABORT","XLOCK","XMAX","XMIN","XML","XMLDATA","XMLNAMESPACES","XMLSCHEMA","XQUERY","XSINIL","YEAR","YMAX","YMIN"],operators:["ALL","AND","ANY","BETWEEN","EXISTS","IN","LIKE","NOT","OR","SOME","EXCEPT","INTERSECT","UNION","APPLY","CROSS","FULL","INNER","JOIN","LEFT","OUTER","RIGHT","CONTAINS","FREETEXT","IS","NULL","PIVOT","UNPIVOT","MATCHED"],builtinFunctions:["AVG","CHECKSUM_AGG","COUNT","COUNT_BIG","GROUPING","GROUPING_ID","MAX","MIN","SUM","STDEV","STDEVP","VAR","VARP","CUME_DIST","FIRST_VALUE","LAG","LAST_VALUE","LEAD","PERCENTILE_CONT","PERCENTILE_DISC","PERCENT_RANK","COLLATE","COLLATIONPROPERTY","TERTIARY_WEIGHTS","FEDERATION_FILTERING_VALUE","CAST","CONVERT","PARSE","TRY_CAST","TRY_CONVERT","TRY_PARSE","ASYMKEY_ID","ASYMKEYPROPERTY","CERTPROPERTY","CERT_ID","CRYPT_GEN_RANDOM","DECRYPTBYASYMKEY","DECRYPTBYCERT","DECRYPTBYKEY","DECRYPTBYKEYAUTOASYMKEY","DECRYPTBYKEYAUTOCERT","DECRYPTBYPASSPHRASE","ENCRYPTBYASYMKEY","ENCRYPTBYCERT","ENCRYPTBYKEY","ENCRYPTBYPASSPHRASE","HASHBYTES","IS_OBJECTSIGNED","KEY_GUID","KEY_ID","KEY_NAME","SIGNBYASYMKEY","SIGNBYCERT","SYMKEYPROPERTY","VERIFYSIGNEDBYCERT","VERIFYSIGNEDBYASYMKEY","CURSOR_STATUS","DATALENGTH","IDENT_CURRENT","IDENT_INCR","IDENT_SEED","IDENTITY","SQL_VARIANT_PROPERTY","CURRENT_TIMESTAMP","DATEADD","DATEDIFF","DATEFROMPARTS","DATENAME","DATEPART","DATETIME2FROMPARTS","DATETIMEFROMPARTS","DATETIMEOFFSETFROMPARTS","DAY","EOMONTH","GETDATE","GETUTCDATE","ISDATE","MONTH","SMALLDATETIMEFROMPARTS","SWITCHOFFSET","SYSDATETIME","SYSDATETIMEOFFSET","SYSUTCDATETIME","TIMEFROMPARTS","TODATETIMEOFFSET","YEAR","CHOOSE","COALESCE","IIF","NULLIF","ABS","ACOS","ASIN","ATAN","ATN2","CEILING","COS","COT","DEGREES","EXP","FLOOR","LOG","LOG10","PI","POWER","RADIANS","RAND","ROUND","SIGN","SIN","SQRT","SQUARE","TAN","APP_NAME","APPLOCK_MODE","APPLOCK_TEST","ASSEMBLYPROPERTY","COL_LENGTH","COL_NAME","COLUMNPROPERTY","DATABASE_PRINCIPAL_ID","DATABASEPROPERTYEX","DB_ID","DB_NAME","FILE_ID","FILE_IDEX","FILE_NAME","FILEGROUP_ID","FILEGROUP_NAME","FILEGROUPPROPERTY","FILEPROPERTY","FULLTEXTCATALOGPROPERTY","FULLTEXTSERVICEPROPERTY","INDEX_COL","INDEXKEY_PROPERTY","INDEXPROPERTY","OBJECT_DEFINITION","OBJECT_ID","OBJECT_NAME","OBJECT_SCHEMA_NAME","OBJECTPROPERTY","OBJECTPROPERTYEX","ORIGINAL_DB_NAME","PARSENAME","SCHEMA_ID","SCHEMA_NAME","SCOPE_IDENTITY","SERVERPROPERTY","STATS_DATE","TYPE_ID","TYPE_NAME","TYPEPROPERTY","DENSE_RANK","NTILE","RANK","ROW_NUMBER","PUBLISHINGSERVERNAME","OPENDATASOURCE","OPENQUERY","OPENROWSET","OPENXML","CERTENCODED","CERTPRIVATEKEY","CURRENT_USER","HAS_DBACCESS","HAS_PERMS_BY_NAME","IS_MEMBER","IS_ROLEMEMBER","IS_SRVROLEMEMBER","LOGINPROPERTY","ORIGINAL_LOGIN","PERMISSIONS","PWDENCRYPT","PWDCOMPARE","SESSION_USER","SESSIONPROPERTY","SUSER_ID","SUSER_NAME","SUSER_SID","SUSER_SNAME","SYSTEM_USER","USER","USER_ID","USER_NAME","ASCII","CHAR","CHARINDEX","CONCAT","DIFFERENCE","FORMAT","LEFT","LEN","LOWER","LTRIM","NCHAR","PATINDEX","QUOTENAME","REPLACE","REPLICATE","REVERSE","RIGHT","RTRIM","SOUNDEX","SPACE","STR","STUFF","SUBSTRING","UNICODE","UPPER","BINARY_CHECKSUM","CHECKSUM","CONNECTIONPROPERTY","CONTEXT_INFO","CURRENT_REQUEST_ID","ERROR_LINE","ERROR_NUMBER","ERROR_MESSAGE","ERROR_PROCEDURE","ERROR_SEVERITY","ERROR_STATE","FORMATMESSAGE","GETANSINULL","GET_FILESTREAM_TRANSACTION_CONTEXT","HOST_ID","HOST_NAME","ISNULL","ISNUMERIC","MIN_ACTIVE_ROWVERSION","NEWID","NEWSEQUENTIALID","ROWCOUNT_BIG","XACT_STATE","TEXTPTR","TEXTVALID","COLUMNS_UPDATED","EVENTDATA","TRIGGER_NESTLEVEL","UPDATE","CHANGETABLE","CHANGE_TRACKING_CONTEXT","CHANGE_TRACKING_CURRENT_VERSION","CHANGE_TRACKING_IS_COLUMN_IN_MASK","CHANGE_TRACKING_MIN_VALID_VERSION","CONTAINSTABLE","FREETEXTTABLE","SEMANTICKEYPHRASETABLE","SEMANTICSIMILARITYDETAILSTABLE","SEMANTICSIMILARITYTABLE","FILETABLEROOTPATH","GETFILENAMESPACEPATH","GETPATHLOCATOR","PATHNAME","GET_TRANSMISSION_STATUS"],builtinVariables:["@@DATEFIRST","@@DBTS","@@LANGID","@@LANGUAGE","@@LOCK_TIMEOUT","@@MAX_CONNECTIONS","@@MAX_PRECISION","@@NESTLEVEL","@@OPTIONS","@@REMSERVER","@@SERVERNAME","@@SERVICENAME","@@SPID","@@TEXTSIZE","@@VERSION","@@CURSOR_ROWS","@@FETCH_STATUS","@@DATEFIRST","@@PROCID","@@ERROR","@@IDENTITY","@@ROWCOUNT","@@TRANCOUNT","@@CONNECTIONS","@@CPU_BUSY","@@IDLE","@@IO_BUSY","@@PACKET_ERRORS","@@PACK_RECEIVED","@@PACK_SENT","@@TIMETICKS","@@TOTAL_ERRORS","@@TOTAL_READ","@@TOTAL_WRITE"],pseudoColumns:["$ACTION","$IDENTITY","$ROWGUID","$PARTITION"],tokenizer:{root:[{include:"@comments"},{include:"@whitespace"},{include:"@pseudoColumns"},{include:"@numbers"},{include:"@strings"},{include:"@complexIdentifiers"},{include:"@scopes"},[/[;,.]/,"delimiter"],[/[()]/,"@brackets"],[/[\w@#$]+/,{cases:{"@keywords":"keyword","@operators":"operator","@builtinVariables":"predefined","@builtinFunctions":"predefined","@default":"identifier"}}],[/[<>=!%&+\-*/|~^]/,"operator"]],whitespace:[[/\s+/,"white"]],comments:[[/--+.*/,"comment"],[/\/\*/,{token:"comment.quote",next:"@comment"}]],comment:[[/[^*/]+/,"comment"],[/\*\//,{token:"comment.quote",next:"@pop"}],[/./,"comment"]],pseudoColumns:[[/[$][A-Za-z_][\w@#$]*/,{cases:{"@pseudoColumns":"predefined","@default":"identifier"}}]],numbers:[[/0[xX][0-9a-fA-F]*/,"number"],[/[$][+-]*\d*(\.\d*)?/,"number"],[/((\d+(\.\d*)?)|(\.\d+))([eE][\-+]?\d+)?/,"number"]],strings:[[/N'/,{token:"string",next:"@string"}],[/'/,{token:"string",next:"@string"}]],string:[[/[^']+/,"string"],[/''/,"string"],[/'/,{token:"string",next:"@pop"}]],complexIdentifiers:[[/\[/,{token:"identifier.quote",next:"@bracketedIdentifier"}],[/"/,{token:"identifier.quote",next:"@quotedIdentifier"}]],bracketedIdentifier:[[/[^\]]+/,"identifier"],[/]]/,"identifier"],[/]/,{token:"identifier.quote",next:"@pop"}]],quotedIdentifier:[[/[^"]+/,"identifier"],[/""/,"identifier"],[/"/,{token:"identifier.quote",next:"@pop"}]],scopes:[[/BEGIN\s+(DISTRIBUTED\s+)?TRAN(SACTION)?\b/i,"keyword"],[/BEGIN\s+TRY\b/i,{token:"keyword.try"}],[/END\s+TRY\b/i,{token:"keyword.try"}],[/BEGIN\s+CATCH\b/i,{token:"keyword.catch"}],[/END\s+CATCH\b/i,{token:"keyword.catch"}],[/(BEGIN|CASE)\b/i,{token:"keyword.block"}],[/END\b/i,{token:"keyword.block"}],[/WHEN\b/i,{token:"keyword.choice"}],[/THEN\b/i,{token:"keyword.choice"}]]}}}}); -------------------------------------------------------------------------------- /priv/www/static/js/5.fd6d6064dfffa65ef079.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([5],{"3mlU":function(t,e){},"4WTo":function(t,e,n){var r=n("NWt+");t.exports=function(t,e){var n=[];return r(t,!1,n.push,n,e),n}},"7Doy":function(t,e,n){var r=n("EqjI"),i=n("7UMu"),o=n("dSzd")("species");t.exports=function(t){var e;return i(t)&&("function"!=typeof(e=t.constructor)||e!==Array&&!i(e.prototype)||(e=void 0),r(e)&&null===(e=e[o])&&(e=void 0)),void 0===e?Array:e}},"9Bbf":function(t,e,n){"use strict";var r=n("kM2E");t.exports=function(t){r(r.S,t,{of:function(){for(var t=arguments.length,e=new Array(t);t--;)e[t]=arguments[t];return new this(e)}})}},"9C8M":function(t,e,n){"use strict";var r=n("evD5").f,i=n("Yobk"),o=n("xH/j"),a=n("+ZMJ"),s=n("2KxR"),l=n("NWt+"),u=n("vIB/"),c=n("EGZi"),f=n("bRrM"),d=n("+E39"),p=n("06OY").fastKey,h=n("LIJb"),v=d?"_s":"size",g=function(t,e){var n,r=p(e);if("F"!==r)return t._i[r];for(n=t._f;n;n=n.n)if(n.k==e)return n};t.exports={getConstructor:function(t,e,n,u){var c=t(function(t,r){s(t,c,e,"_i"),t._t=e,t._i=i(null),t._f=void 0,t._l=void 0,t[v]=0,void 0!=r&&l(r,n,t[u],t)});return o(c.prototype,{clear:function(){for(var t=h(this,e),n=t._i,r=t._f;r;r=r.n)r.r=!0,r.p&&(r.p=r.p.n=void 0),delete n[r.i];t._f=t._l=void 0,t[v]=0},delete:function(t){var n=h(this,e),r=g(n,t);if(r){var i=r.n,o=r.p;delete n._i[r.i],r.r=!0,o&&(o.n=i),i&&(i.p=o),n._f==r&&(n._f=i),n._l==r&&(n._l=o),n[v]--}return!!r},forEach:function(t){h(this,e);for(var n,r=a(t,arguments.length>1?arguments[1]:void 0,3);n=n?n.n:this._f;)for(r(n.v,n.k,this);n&&n.r;)n=n.p},has:function(t){return!!g(h(this,e),t)}}),d&&r(c.prototype,"size",{get:function(){return h(this,e)[v]}}),c},def:function(t,e,n){var r,i,o=g(t,e);return o?o.v=n:(t._l=o={i:i=p(e,!0),k:e,v:n,p:r=t._l,n:void 0,r:!1},t._f||(t._f=o),r&&(r.n=o),t[v]++,"F"!==i&&(t._i[i]=o)),t},getEntry:g,setStrong:function(t,e,n){u(t,e,function(t,n){this._t=h(t,e),this._k=n,this._l=void 0},function(){for(var t=this._k,e=this._l;e&&e.r;)e=e.p;return this._t&&(this._l=e=e?e.n:this._t._f)?c(0,"keys"==t?e.k:"values"==t?e.v:[e.k,e.v]):(this._t=void 0,c(1))},n?"entries":"values",!n,!0),f(e)}}},ALrJ:function(t,e,n){var r=n("+ZMJ"),i=n("MU5D"),o=n("sB3e"),a=n("QRG4"),s=n("oeOm");t.exports=function(t,e){var n=1==t,l=2==t,u=3==t,c=4==t,f=6==t,d=5==t||f,p=e||s;return function(e,s,h){for(var v,g,_=o(e),m=i(_),b=r(s,h,3),w=a(m.length),y=0,$=n?p(e,w):l?p(e,0):void 0;w>y;y++)if((d||y in m)&&(g=b(v=m[y],y,_),t))if(n)$[y]=g;else if(g)switch(t){case 3:return!0;case 5:return v;case 6:return y;case 2:$.push(v)}else if(c)return!1;return f?-1:u||c?c:$}}},BDhv:function(t,e,n){var r=n("kM2E");r(r.P+r.R,"Set",{toJSON:n("m9gC")("Set")})},HpRW:function(t,e,n){"use strict";var r=n("kM2E"),i=n("lOnJ"),o=n("+ZMJ"),a=n("NWt+");t.exports=function(t){r(r.S,t,{from:function(t){var e,n,r,s,l=arguments[1];return i(this),(e=void 0!==l)&&i(l),void 0==t?new this:(n=[],e?(r=0,s=o(l,arguments[2],2),a(t,!1,function(t){n.push(s(t,r++))})):a(t,!1,n.push,n),new this(n))}})}},LIJb:function(t,e,n){var r=n("EqjI");t.exports=function(t,e){if(!r(t)||t._t!==e)throw TypeError("Incompatible receiver, "+e+" required!");return t}},ioQ5:function(t,e,n){n("HpRW")("Set")},lHA8:function(t,e,n){t.exports={default:n("pPW7"),__esModule:!0}},m9gC:function(t,e,n){var r=n("RY/4"),i=n("4WTo");t.exports=function(t){return function(){if(r(this)!=t)throw TypeError(t+"#toJSON isn't generic");return i(this)}}},oNmr:function(t,e,n){n("9Bbf")("Set")},oeOm:function(t,e,n){var r=n("7Doy");t.exports=function(t,e){return new(r(t))(e)}},pPW7:function(t,e,n){n("M6a0"),n("zQR9"),n("+tPU"),n("ttyz"),n("BDhv"),n("oNmr"),n("ioQ5"),t.exports=n("FeBl").Set},qo66:function(t,e,n){"use strict";var r=n("7KvD"),i=n("kM2E"),o=n("06OY"),a=n("S82l"),s=n("hJx8"),l=n("xH/j"),u=n("NWt+"),c=n("2KxR"),f=n("EqjI"),d=n("e6n0"),p=n("evD5").f,h=n("ALrJ")(0),v=n("+E39");t.exports=function(t,e,n,g,_,m){var b=r[t],w=b,y=_?"set":"add",$=w&&w.prototype,k={};return v&&"function"==typeof w&&(m||$.forEach&&!a(function(){(new w).entries().next()}))?(w=e(function(e,n){c(e,w,t,"_c"),e._c=new b,void 0!=n&&u(n,_,e[y],e)}),h("add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON".split(","),function(t){var e="add"==t||"set"==t;t in $&&(!m||"clear"!=t)&&s(w.prototype,t,function(n,r){if(c(this,w,t),!e&&m&&!f(n))return"get"==t&&void 0;var i=this._c[t](0===n?0:n,r);return e?this:i})}),m||p(w.prototype,"size",{get:function(){return this._c.size}})):(w=g.getConstructor(e,t,_,y),l(w.prototype,n),o.NEED=!0),d(w,t),k[t]=w,i(i.G+i.W+i.F,k),m||g.setStrong(w,t,_),w}},ttyz:function(t,e,n){"use strict";var r=n("9C8M"),i=n("LIJb");t.exports=n("qo66")("Set",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{add:function(t){return r.def(i(this,"Set"),t=0===t?0:t,t)}},r)},yoyQ:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n("fZjL"),i=n.n(r),o=n("Dd8w"),a=n.n(o),s=n("lHA8"),l=n.n(s),u=n("zL8q"),c=n("NYxO"),f=n("JaHG"),d={name:"plugins-view",components:{"el-input":u.Input,"el-select":u.Select,"el-option":u.Option,"el-button":u.Button,"el-table":u.Table,"el-table-column":u.TableColumn,"el-form":u.Form,"el-form-item":u.FormItem,"el-row":u.Row,"el-col":u.Col,"el-card":u.Card},data:function(){return{filterSet:new l.a,tableData:[],enableTableData:[],nodeName:"",nodes:[],searchValue:"",searchView:!1}},computed:{iconStatus:function(){return this.searchView?"el-icon-close":"el-icon-search"}},methods:a()({},Object(c.b)(["CURRENT_NODE"]),{loadData:function(){var t=this;this.searchView=!1,this.$httpGet("/nodes").then(function(e){t.nodeName=t.$store.state.nodeName||e.data[0].node,t.nodes=e.data,t.loadPlugins()}).catch(function(e){t.$message.error(e||t.$t("error.networkError"))})},loadPlugins:function(){var t=this;this.CURRENT_NODE(this.nodeName),this.nodeName&&this.$httpGet("/nodes/"+this.nodeName+"/plugins").then(function(e){t.tableData=e.data,t.handleFilter()}).catch(function(e){t.$message.error(e||t.$t("error.networkError"))})},handleFilter:function(){var t=this;this.enableTableData=this.tableData.filter(function(e){return!t.filterSet.has(e.active)})},resetFilter:function(t){var e=this;this.filterSet.clear(),i()(t).forEach(function(n){t[n].forEach(function(t){e.filterSet.add(!t)})}),2===this.filterSet.size&&this.filterSet.clear(),this.handleFilter()},update:function(t){var e=this,n=t.active?"unload":"load";this.$httpPut("/nodes/"+this.nodeName+"/plugins/"+t.name+"/"+n).then(function(){e.$message.success(""+(t.active?e.$t("plugins.stop"):e.$t("plugins.start"))+e.$t("alert.success")),e.loadPlugins()}).catch(function(t){e.$message.error(t||e.$t("error.networkError")),e.loadPlugins()})},getLinks:function(t){return Object(f.b)(t)},openLink:function(t){var e=this.getLinks(t.name);window.open(e).opener=null},searchPlugins:function(){var t=this;this.searchValue?setTimeout(function(){Object(f.e)(t.tableData,"name",t.searchValue).then(function(e){e&&(t.enableTableData=e)}).catch(function(){})},500):this.loadData()},hasManagePage:function(t){return{emqx_auth_clientid:!0,emqx_auth_username:!0,emqx_auth_jwt:!0}[t]},handleManage:function(t){this.$router.push({path:"/plugins/"+t.name})}}),created:function(){this.loadData()}},p={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"plugins-view"},[n("div",{staticClass:"page-title"},[t._v("\n "+t._s(t.$t("leftbar.plugins"))+"\n "),n("div",{staticStyle:{float:"right"}},[n("el-input",{staticClass:"input-radius",staticStyle:{float:"right","padding-left":"20px"},attrs:{size:"large",disabled:t.$store.state.loading,placeholder:t.$t("plugins.searchByName"),clearable:""},on:{input:t.searchPlugins},model:{value:t.searchValue,callback:function(e){t.searchValue=e},expression:"searchValue"}}),t._v(" "),n("el-select",{staticClass:"select-radius",attrs:{placeholder:t.$t("select.placeholder"),disabled:t.$store.state.loading},on:{change:t.loadPlugins},model:{value:t.nodeName,callback:function(e){t.nodeName=e},expression:"nodeName"}},t._l(t.nodes,function(t){return n("el-option",{key:t.node,attrs:{label:t.node,value:t.node}})}),1)],1)]),t._v(" "),n("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.$store.state.loading,expression:"$store.state.loading"}],attrs:{border:"",data:t.enableTableData},on:{"filter-change":t.resetFilter}},[n("el-table-column",{attrs:{prop:"name",width:"230",label:t.$t("plugins.name")},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v("\n "+t._s(e.row.name)+"\n "),n("el-tooltip",{attrs:{effect:"light",content:t.$t("plugins.tutorial"),"open-delay":500,placement:"top"}},[e.row.name.includes("dashboard")||e.row.name.includes("management")||void 0===t.getLinks(e.row.name)?t._e():n("a",{staticClass:"tutorial",attrs:{href:"javascript:;"},on:{click:function(n){return t.openLink(e.row)}}},[n("i",{staticClass:"iconfont icon-bangzhu"})])])]}}])}),t._v(" "),n("el-table-column",{attrs:{prop:"description","min-width":"340",label:t.$t("plugins.description")}}),t._v(" "),n("el-table-column",{attrs:{prop:"active",width:"150",label:t.$t("plugins.status"),filters:[{text:t.$t("plugins.stopped"),value:!1},{text:t.$t("plugins.running"),value:!0}]},scopedSlots:t._u([{key:"default",fn:function(e){return[n("span",{class:[e.row.active?"running":"","status"]},[t._v("\n "+t._s(e.row.active?t.$t("plugins.running"):t.$t("plugins.stopped"))+"\n ")])]}}])}),t._v(" "),n("el-table-column",{attrs:{width:"160",label:t.$t("oper.oper")},scopedSlots:t._u([{key:"default",fn:function(e){return[n("el-button",{staticClass:"oper",attrs:{slot:"reference",size:"mini",disabled:-1!==e.row.name.indexOf("dashboard")||e.row.name.includes("management"),type:e.row.active?"warning":"success",plain:!0},on:{click:function(n){return t.update(e.row)}},slot:"reference"},[t._v("\n "+t._s(e.row.active?t.$t("plugins.stop"):t.$t("plugins.start"))+"\n ")]),t._v(" "),t.hasManagePage(e.row.name)?n("el-button",{staticClass:"oper",attrs:{type:"success",size:"mini",plain:!0,disabled:!e.row.active},on:{click:function(n){return t.handleManage(e.row)}}},[t._v("\n "+t._s(t.$t("plugins.manage"))+"\n ")]):t._e()]}}])})],1)],1)},staticRenderFns:[]};var h=n("VU/8")(d,p,!1,function(t){n("3mlU")},null,null);e.default=h.exports}}); -------------------------------------------------------------------------------- /priv/www/static/js/6.ef8e6aa7a51fa7564f71.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([6],{"4WTo":function(t,e,n){var r=n("NWt+");t.exports=function(t,e){var n=[];return r(t,!1,n.push,n,e),n}},"7Doy":function(t,e,n){var r=n("EqjI"),o=n("7UMu"),i=n("dSzd")("species");t.exports=function(t){var e;return o(t)&&("function"!=typeof(e=t.constructor)||e!==Array&&!o(e.prototype)||(e=void 0),r(e)&&null===(e=e[i])&&(e=void 0)),void 0===e?Array:e}},"9Bbf":function(t,e,n){"use strict";var r=n("kM2E");t.exports=function(t){r(r.S,t,{of:function(){for(var t=arguments.length,e=new Array(t);t--;)e[t]=arguments[t];return new this(e)}})}},"9C8M":function(t,e,n){"use strict";var r=n("evD5").f,o=n("Yobk"),i=n("xH/j"),s=n("+ZMJ"),a=n("2KxR"),l=n("NWt+"),u=n("vIB/"),c=n("EGZi"),f=n("bRrM"),d=n("+E39"),v=n("06OY").fastKey,h=n("LIJb"),p=d?"_s":"size",_=function(t,e){var n,r=v(e);if("F"!==r)return t._i[r];for(n=t._f;n;n=n.n)if(n.k==e)return n};t.exports={getConstructor:function(t,e,n,u){var c=t(function(t,r){a(t,c,e,"_i"),t._t=e,t._i=o(null),t._f=void 0,t._l=void 0,t[p]=0,void 0!=r&&l(r,n,t[u],t)});return i(c.prototype,{clear:function(){for(var t=h(this,e),n=t._i,r=t._f;r;r=r.n)r.r=!0,r.p&&(r.p=r.p.n=void 0),delete n[r.i];t._f=t._l=void 0,t[p]=0},delete:function(t){var n=h(this,e),r=_(n,t);if(r){var o=r.n,i=r.p;delete n._i[r.i],r.r=!0,i&&(i.n=o),o&&(o.p=i),n._f==r&&(n._f=o),n._l==r&&(n._l=i),n[p]--}return!!r},forEach:function(t){h(this,e);for(var n,r=s(t,arguments.length>1?arguments[1]:void 0,3);n=n?n.n:this._f;)for(r(n.v,n.k,this);n&&n.r;)n=n.p},has:function(t){return!!_(h(this,e),t)}}),d&&r(c.prototype,"size",{get:function(){return h(this,e)[p]}}),c},def:function(t,e,n){var r,o,i=_(t,e);return i?i.v=n:(t._l=i={i:o=v(e,!0),k:e,v:n,p:r=t._l,n:void 0,r:!1},t._f||(t._f=i),r&&(r.n=i),t[p]++,"F"!==o&&(t._i[o]=i)),t},getEntry:_,setStrong:function(t,e,n){u(t,e,function(t,n){this._t=h(t,e),this._k=n,this._l=void 0},function(){for(var t=this._k,e=this._l;e&&e.r;)e=e.p;return this._t&&(this._l=e=e?e.n:this._t._f)?c(0,"keys"==t?e.k:"values"==t?e.v:[e.k,e.v]):(this._t=void 0,c(1))},n?"entries":"values",!n,!0),f(e)}}},ALrJ:function(t,e,n){var r=n("+ZMJ"),o=n("MU5D"),i=n("sB3e"),s=n("QRG4"),a=n("oeOm");t.exports=function(t,e){var n=1==t,l=2==t,u=3==t,c=4==t,f=6==t,d=5==t||f,v=e||a;return function(e,a,h){for(var p,_,m=i(e),b=o(m),g=r(a,h,3),w=s(b.length),$=0,y=n?v(e,w):l?v(e,0):void 0;w>$;$++)if((d||$ in b)&&(_=g(p=b[$],$,m),t))if(n)y[$]=_;else if(_)switch(t){case 3:return!0;case 5:return p;case 6:return $;case 2:y.push(p)}else if(c)return!1;return f?-1:u||c?c:y}}},BDhv:function(t,e,n){var r=n("kM2E");r(r.P+r.R,"Set",{toJSON:n("m9gC")("Set")})},HpRW:function(t,e,n){"use strict";var r=n("kM2E"),o=n("lOnJ"),i=n("+ZMJ"),s=n("NWt+");t.exports=function(t){r(r.S,t,{from:function(t){var e,n,r,a,l=arguments[1];return o(this),(e=void 0!==l)&&o(l),void 0==t?new this:(n=[],e?(r=0,a=i(l,arguments[2],2),s(t,!1,function(t){n.push(a(t,r++))})):s(t,!1,n.push,n),new this(n))}})}},LIJb:function(t,e,n){var r=n("EqjI");t.exports=function(t,e){if(!r(t)||t._t!==e)throw TypeError("Incompatible receiver, "+e+" required!");return t}},fnGs:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n("fZjL"),o=n.n(r),i=n("Dd8w"),s=n.n(i),a=n("lHA8"),l=n.n(a),u=n("zL8q"),c=n("NYxO"),f={name:"modules-view",components:{"el-select":u.Select,"el-option":u.Option,"el-button":u.Button,"el-table":u.Table,"el-table-column":u.TableColumn},data:function(){return{filterSet:new l.a,tableData:[],enableTableData:[],nodeName:"",nodes:[]}},methods:s()({},Object(c.b)(["CURRENT_NODE"]),{loadData:function(){var t=this;this.$httpGet("/nodes").then(function(e){t.nodeName=t.$store.state.nodeName||e.data[0].node,t.nodes=e.data,t.loadModuls()}).catch(function(e){t.$message.error(e||t.$t("error.networkError"))})},loadModuls:function(){var t=this;this.CURRENT_NODE(this.nodeName),this.nodeName&&this.$httpGet("/nodes/"+this.nodeName+"/modules").then(function(e){t.tableData=e.data,t.handleFilter()}).catch(function(e){t.$message.error(e||t.$t("error.networkError"))})},handleFilter:function(){var t=this;this.enableTableData=this.tableData.filter(function(e){return!t.filterSet.has(e.active)})},resetFilter:function(t){var e=this;this.filterSet.clear(),o()(t).forEach(function(n){t[n].forEach(function(t){e.filterSet.add(!t)})}),2===this.filterSet.size&&this.filterSet.clear(),this.handleFilter()},update:function(t){var e=this,n=t.active?"unload":"load";this.$httpPut("/nodes/"+this.nodeName+"/modules/"+t.name+"/"+n).then(function(){e.$message.success(""+(t.active?e.$t("oper.disabledSuccess"):e.$t("oper.enableSuccess"))),e.loadModuls()}).catch(function(t){e.$message.error(t||e.$t("error.networkError")),e.loadModuls()})}}),created:function(){this.loadData()}},d={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"modules-view"},[n("div",{staticClass:"page-title"},[t._v("\n "+t._s(t.$t("leftbar.modules"))+"\n "),n("div",{staticStyle:{float:"right"}},[n("el-select",{staticClass:"select-radius",attrs:{placeholder:t.$t("select.placeholder"),disabled:t.$store.state.loading},on:{change:t.loadModuls},model:{value:t.nodeName,callback:function(e){t.nodeName=e},expression:"nodeName"}},t._l(t.nodes,function(t){return n("el-option",{key:t.node,attrs:{label:t.node,value:t.node}})}),1)],1)]),t._v(" "),n("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.$store.state.loading,expression:"$store.state.loading"}],attrs:{border:"",data:t.enableTableData},on:{"filter-change":t.resetFilter}},[n("el-table-column",{attrs:{prop:"name",width:"250",label:t.$t("modules.name")}}),t._v(" "),n("el-table-column",{attrs:{prop:"description","min-width":"350",label:t.$t("plugins.description")}}),t._v(" "),n("el-table-column",{attrs:{prop:"active",width:"150",label:t.$t("plugins.status"),filters:[{text:t.$t("modules.disabled"),value:!1},{text:t.$t("modules.enabled"),value:!0}]},scopedSlots:t._u([{key:"default",fn:function(e){return[n("span",{class:[e.row.active?"running":"","status"]},[t._v("\n "+t._s(e.row.active?t.$t("modules.enabled"):t.$t("modules.disabled"))+"\n ")])]}}])}),t._v(" "),n("el-table-column",{attrs:{width:"160",label:t.$t("oper.oper")},scopedSlots:t._u([{key:"default",fn:function(e){return[n("el-button",{staticClass:"oper",attrs:{slot:"reference",size:"mini",type:e.row.active?"warning":"success",plain:!0},on:{click:function(n){return t.update(e.row)}},slot:"reference"},[t._v("\n "+t._s(e.row.active?t.$t("modules.disable"):t.$t("modules.enable"))+"\n ")])]}}])})],1)],1)},staticRenderFns:[]};var v=n("VU/8")(f,d,!1,function(t){n("j2ko")},null,null);e.default=v.exports},ioQ5:function(t,e,n){n("HpRW")("Set")},j2ko:function(t,e){},lHA8:function(t,e,n){t.exports={default:n("pPW7"),__esModule:!0}},m9gC:function(t,e,n){var r=n("RY/4"),o=n("4WTo");t.exports=function(t){return function(){if(r(this)!=t)throw TypeError(t+"#toJSON isn't generic");return o(this)}}},oNmr:function(t,e,n){n("9Bbf")("Set")},oeOm:function(t,e,n){var r=n("7Doy");t.exports=function(t,e){return new(r(t))(e)}},pPW7:function(t,e,n){n("M6a0"),n("zQR9"),n("+tPU"),n("ttyz"),n("BDhv"),n("oNmr"),n("ioQ5"),t.exports=n("FeBl").Set},qo66:function(t,e,n){"use strict";var r=n("7KvD"),o=n("kM2E"),i=n("06OY"),s=n("S82l"),a=n("hJx8"),l=n("xH/j"),u=n("NWt+"),c=n("2KxR"),f=n("EqjI"),d=n("e6n0"),v=n("evD5").f,h=n("ALrJ")(0),p=n("+E39");t.exports=function(t,e,n,_,m,b){var g=r[t],w=g,$=m?"set":"add",y=w&&w.prototype,E={};return p&&"function"==typeof w&&(b||y.forEach&&!s(function(){(new w).entries().next()}))?(w=e(function(e,n){c(e,w,t,"_c"),e._c=new g,void 0!=n&&u(n,m,e[$],e)}),h("add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON".split(","),function(t){var e="add"==t||"set"==t;t in y&&(!b||"clear"!=t)&&a(w.prototype,t,function(n,r){if(c(this,w,t),!e&&b&&!f(n))return"get"==t&&void 0;var o=this._c[t](0===n?0:n,r);return e?this:o})}),b||v(w.prototype,"size",{get:function(){return this._c.size}})):(w=_.getConstructor(e,t,m,$),l(w.prototype,n),i.NEED=!0),d(w,t),E[t]=w,o(o.G+o.W+o.F,E),b||_.setStrong(w,t,m),w}},ttyz:function(t,e,n){"use strict";var r=n("9C8M"),o=n("LIJb");t.exports=n("qo66")("Set",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{add:function(t){return r.def(o(this,"Set"),t=0===t?0:t,t)}},r)}}); -------------------------------------------------------------------------------- /priv/www/static/js/7.92a348a80764134ff2a9.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([7],{"ILV/":function(t,e){t.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAABsklEQVRoQ+2ZwVHDMBBF/6oB6IBwCRxNJeCkAdGBXQl0gCggASrB3DC5OBVgrjlkGTOByciJbEcyyIxytbTat/9LlrOEgf9o4PkjAPy1gjsVOH+Qo/UaN0SIAIwcJ1kwIxMC6WusCtvYNYCv5BnPBBzbBjfNZ6AUhAtbiBrAeC4fCbjsM/nv2Aw8vU3Ulc1auwDe+67+VsJFPlGnTgHO5pK3A+YT5fSkch2/lpzrBfTquo4fALr6NyigVSxYKFjI8pj+dQt1VaxpfABoqlDX5+OZvFsJpEWsyjZzvVOgek8wkDHhehGrrAnCS4Aq6eq6zYx0MVXKBOEtwM+Vm6FMlrIG0K8GTZIf8txkqUEAmCw1HADGBwOJvicGAcDACxPkrlPJGuAQT5vm6HuKgfsVIdn3XvAWgPdYRof3EsBkGe8BxnOpTJbxHqDrnvLOQt4DhI/68FHf1aTa+GChYKFgIbd/39cbHDNZEuHIstDtpjOW+VRZ9eD+X4tp06HM+lahui4Lgch5k6/SftOpvCVGBMJJOz+0HMVYMiEThMQ2+WpFp/2vlghOhwUAp+U8INjgFfgEg1piQESWU5UAAAAASUVORK5CYII="},dLQT:function(t,e){},iwwA:function(t,e){},lO7g:function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=i("Dd8w"),n=i.n(s),a=i("zL8q"),l=i("NYxO"),o={name:"left-bar",components:{"el-menu":a.Menu,"el-menu-item":a.MenuItem,"el-menu-item-group":a.MenuItemGroup},data:function(){return{menus:[{id:"monitor",title:this.$t("leftbar.monitor"),icon:"icon-jiankong",index:"/"},{id:"clients",title:this.$t("leftbar.clients"),index:"/clients",icon:"icon-guanlianshebei"},{id:"topics",title:this.$t("leftbar.topics"),index:"/topics",icon:"icon-zuzhiqunzu"},{id:"subscriptions",title:this.$t("leftbar.subscriptions"),index:"/subscriptions",icon:"icon-shebeiguanli"},{id:"rule_engine",title:this.$t("rule.rule_engine"),icon:"icon-guizeyinqing",children:[{id:"rules",title:this.$t("leftbar.rule_engine"),index:"/rules"},{id:"resources",title:this.$t("rule.resource_title"),index:"/resources"}]},{id:"analysis",title:this.$t("leftbar.analysis"),icon:"icon-shujukanban",children:[{id:"topic_metrics",title:this.$t("leftbar.topicMetrics"),index:"/topic_metrics"}]},{id:"plugins",title:this.$t("leftbar.plugins"),index:"/plugins",icon:"icon-kongjian"},{id:"modules",title:this.$t("leftbar.modules"),index:"/modules",icon:"icon-changjingguanli"},{id:"tools",title:this.$t("leftbar.tools"),icon:"icon-gongju1",children:[{id:"websocket",title:this.$t("leftbar.websocket"),index:"/websocket"},{id:"http_api",title:this.$t("leftbar.api"),index:"/http_api"}]},{id:"alarms",title:this.$t("leftbar.alarms"),index:"/alarms",icon:"icon-gaojingkongxin"},{id:"settings",title:this.$t("leftbar.settings"),index:"/settings",icon:"icon-icon_shezhi"},{id:"general",title:this.$t("leftbar.general"),icon:"icon-fenzuguanli",children:[{id:"applications",title:this.$t("leftbar.applications"),index:"/applications"},{id:"users",title:this.$t("leftbar.users"),index:"/users"},{id:"listeners",title:this.$t("leftbar.listeners"),index:"/listeners"},{id:"help",title:this.$t("leftbar.help"),index:"/help",class:"last-item"}]}]}},computed:{showFeatOnLeftbar:function(){return this.$store.state.showFeatOnLeftbar}},watch:{showFeatOnLeftbar:{deep:!0,handler:function(){this.setNewFeatOnleftbar()}}},methods:n()({},Object(l.b)(["USER_LOGIN"]),{logout:function(){this.USER_LOGIN({isLogOut:!0}),this.$router.push({path:"/login"})},setNewFeatOnleftbar:function(){var t=this;this.menus.forEach(function(e){var i=t.showFeatOnLeftbar.data;e.children&&e.children.length>0?e.children.forEach(function(t){i[t.id]?(e.hasNew=!0,t.hasNew=!0):e.hasNew&&t.hasNew&&(e.hasNew=!1,t.hasNew=!1)}):i[e.id]?e.hasNew=!0:e.hasNew&&(e.hasNew=!1)})}}),created:function(){this.setNewFeatOnleftbar()}},c={render:function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"left-bar"},[t._m(0),t._v(" "),s("el-menu",{attrs:{mode:"vertical",router:"","background-color":"#242327","text-color":"#A6A6A8","active-text-color":"#34C388","default-active":"/"+t.$route.path.split("/")[1]}},[t._l(t.menus,function(e,i){return[e.children&&e.children.length>0?s("el-submenu",{key:i,attrs:{index:""+(i+1)}},[s("template",{slot:"title"},[s("i",{class:["iconfont",e.icon]}),t._v(" "),s("el-badge",{staticClass:"menu-dot",attrs:{hidden:!e.hasNew,"is-dot":""}},[t._v("\n "+t._s(e.title)+"\n ")])],1),t._v(" "),t._l(e.children,function(e,i){return s("el-menu-item",{key:i,class:e.class,attrs:{index:e.index}},[s("el-badge",{staticClass:"submenu-dot",attrs:{hidden:!e.hasNew,"is-dot":""}},[t._v("\n "+t._s(e.title)+"\n ")])],1)})],2):e.children?t._e():s("el-menu-item",{key:i,class:e.class,attrs:{index:e.index}},[s("template",{slot:"title"},[s("i",{class:["iconfont",e.icon]}),t._v(" "),s("el-badge",{staticClass:"menu-dot",attrs:{hidden:!e.hasNew,"is-dot":""}},[t._v("\n "+t._s(e.title)+"\n ")])],1)],2)]}),t._v(" "),s("div",{staticClass:"bar-footer"},[s("span",[t._v(t._s(t.$store.state.user.username))]),t._v(" "),s("a",{attrs:{href:"javascript:;"},on:{click:t.logout}},[s("img",{attrs:{src:i("ILV/")}})])])],2)],1)},staticRenderFns:[function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"bar-title"},[e("div",[e("img",{staticClass:"logo",attrs:{src:i("qGVI")}})]),this._v(" "),e("h3",[this._v("Dashboard")])])}]};var u={name:"topbar",components:{},data:function(){return{lang:window.localStorage.getItem("language")||"en"}},computed:{activeLink:function(){return"/help"===this.$route.path}},methods:{openLink:function(t){var e="";"enterprise"===t?e="zh"===this.lang?"https://www.emqx.io/cn/downloads#enterprise":"https://www.emqx.io/downloads#enterprise":"github"===t&&(e="https://github.com/emqx/emqx"),window.open(e).opener=null}}},r={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"topbar"},[i("div",{staticClass:"top-area"},[i("div",{staticClass:"topbar-right"},[i("div",{staticClass:"help-link"},[i("el-tooltip",{attrs:{effect:"light",content:t.$t("leftbar.help"),"open-delay":500,placement:"bottom"}},[i("router-link",{class:["link",t.activeLink?"active":""],attrs:{to:{path:"/help"}}},[i("i",{staticClass:"iconfont icon-bangzhu"})])],1)],1),t._v(" "),i("el-button",{staticClass:"github-btn",attrs:{size:"medium"},on:{click:function(e){return t.openLink("github")}}},[t._v("\n GitHub\n "),i("i",{staticClass:"iconfont icon-git"})]),t._v(" "),i("el-button",{staticClass:"enterprise-btn",attrs:{size:"medium"},on:{click:function(e){return t.openLink("enterprise")}}},[t._v("\n "+t._s(t.$t("topbar.tryEnterprise"))+"\n "),i("i",{staticClass:"iconfont icon-arrow"})])],1)])])},staticRenderFns:[]};var L={name:"home-view",components:{Leftbar:i("VU/8")(o,c,!1,function(t){i("qoUx")},null,null).exports,Topbar:i("VU/8")(u,r,!1,function(t){i("dLQT")},null,null).exports}},M={render:function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"home-view"},[e("Leftbar"),this._v(" "),e("Topbar"),this._v(" "),e("div",{staticClass:"home-content"},[e("RouterView")],1)],1)},staticRenderFns:[]};var w=i("VU/8")(L,M,!1,function(t){i("iwwA")},null,null);e.default=w.exports},qGVI:function(t,e){t.exports="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDIxLjAuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IuWbvuWxgl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIKCSB2aWV3Qm94PSIwIDAgNDQgNDAiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ0IDQwOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+Cgkuc3Qwe2ZpbGw6IzIyQkI3QTt9Cjwvc3R5bGU+Cjx0aXRsZT5sb2dvPC90aXRsZT4KPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CjxnIGlkPSLnu4Tku7YiPgoJPGcgaWQ9IuWvvOiIqiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTEuMDAwMDAwLCAzLjAwMDAwMCkiPgoJCTxnIGlkPSLliIbnu4QtNSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTYuMDAwMDAwLCAtMTIuMDAwMDAwKSI+CgkJCTxnIGlkPSJHcm91cCI+CgkJCQk8cGF0aCBjbGFzcz0ic3QwIiBkPSJNMzcsNDcuOUgyMWMtMS44LDAtMy40LTEtNC4zLTIuNWwtOC0xMy45Yy0wLjktMS41LTAuOS0zLjUsMC01bDgtMTMuOWMwLjktMS41LDIuNS0yLjUsNC4zLTIuNUgzNwoJCQkJCWMxLjgsMCwzLjQsMSw0LjMsMi41bDgsMTMuOWMwLjksMS41LDAuOSwzLjUsMCw1bC04LDEzLjlDNDAuNSw0NywzOC44LDQ3LjksMzcsNDcuOXogTTIxLDEyLjFjLTEuMSwwLTIuMSwwLjYtMi42LDEuNWwtOCwxMy45CgkJCQkJYy0wLjUsMC45LTAuNSwyLjEsMCwzbDgsMTMuOWMwLjUsMC45LDEuNSwxLjUsMi42LDEuNUgzN2MxLjEsMCwyLjEtMC42LDIuNi0xLjVsOC0xMy45YzAuNS0wLjksMC41LTIuMSwwLTNsLTgtMTMuOQoJCQkJCWMtMC41LTAuOS0xLjUtMS41LTIuNi0xLjVIMjF6Ii8+CgkJCQk8cGF0aCBpZD0iRU1RIiBjbGFzcz0ic3QwIiBkPSJNMjAuNSwyOS44aC0zLjZsLTAuNCwyLjZoNC40bC0wLjMsMS44aC02LjdsMS41LTEwLjNoNi44bC0wLjMsMS44aC00LjRsLTAuMywyLjJoMy42TDIwLjUsMjkuOHoKCQkJCQkgTTI3LjgsMzEuMUwyNy44LDMxLjFsMy41LTcuMmgzLjJsLTEuNSwxMC4zaC0yLjRsMS02LjZsMCwwbC0zLjMsNi42aC0xLjZsLTEuMy02LjVoMGwtMSw2LjVoLTIuNGwxLjUtMTAuM2gzLjFMMjcuOCwzMS4xegoJCQkJCSBNNDMuNywzMGMtMC4xLDAuNS0wLjIsMS0wLjQsMS41cy0wLjQsMC45LTAuOCwxLjJsMS4zLDEuNWwtMS43LDEuMmwtMS4yLTEuNWMtMC4zLDAuMS0wLjcsMC4zLTEsMC4zYy0wLjQsMC4xLTAuNywwLjEtMS4xLDAuMQoJCQkJCWMtMS4zLDAtMi4yLTAuNC0zLTEuMmMtMC43LTAuOC0xLTEuOS0wLjgtMy4xbDAuMy0xLjljMC4yLTEuMywwLjgtMi40LDEuNy0zLjJjMC45LTAuOCwyLTEuMiwzLjQtMS4yYzEuMiwwLDIuMiwwLjQsMi45LDEuMgoJCQkJCXMxLDEuOSwwLjgsMy4xTDQzLjcsMzB6IE00MS42LDI4LjFjMC4xLTAuOCwwLTEuNC0wLjItMS44cy0wLjctMC43LTEuNC0wLjdjLTAuNiwwLTEuMSwwLjItMS42LDAuN3MtMC43LDEuMS0wLjgsMS44TDM3LjMsMzAKCQkJCQljLTAuMSwwLjgsMCwxLjQsMC4yLDEuOGMwLjMsMC41LDAuNywwLjcsMS40LDAuN2MwLjYsMCwxLjEtMC4yLDEuNS0wLjdzMC43LTEuMSwwLjgtMS44TDQxLjYsMjguMXoiLz4KCQkJPC9nPgoJCTwvZz4KCTwvZz4KPC9nPgo8L3N2Zz4K"},qoUx:function(t,e){}}); -------------------------------------------------------------------------------- /priv/www/static/js/8.bbf3abbfd9e1d74d844e.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([8],{"/CfG":function(e,t){},"8AHC":function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=s("JaHG"),r={name:"clients-basic",props:{record:{type:Object,default:function(){return{}}}},filters:{transToUnlimit:function(e){return 0===e?"Unlimited":e}},data:function(){return{showMore:!1,mqttVersionMap:{3:"v3.1",4:"v3.1.1",5:"v5.0"}}},methods:{interceptString:function(e,t){return Object(n.d)(e,t)}}},c={render:function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"clients-basic"},[s("el-card",{staticClass:"el-card--self tabs-card"},[s("el-row",[s("el-form",{ref:"record",staticClass:"clients-basic-form",attrs:{model:e.record,"label-suffix":":"}},[s("el-col",{attrs:{span:12}},[s("div",{staticClass:"card-subtitle"},[e._v(e._s(e.$t("clients.connectInfo")))]),e._v(" "),s("el-form-item",{attrs:{label:e.$t("clients.node"),prop:"node"}},[s("span",[e._v(e._s(e.record.node))])]),e._v(" "),e.record.clientid?s("el-form-item",{attrs:{label:e.$t("clients.clientId"),prop:"clientid"}},[e.record.clientid.length>60?s("el-popover",{attrs:{placement:"top-start",trigger:"hover",content:e.record.clientid}},[s("span",{attrs:{slot:"reference"},slot:"reference"},[e._v(e._s(e.interceptString(e.record.clientid,60)))])]):s("span",[e._v(e._s(e.record.clientid))])],1):e._e(),e._v(" "),s("el-form-item",{attrs:{label:e.$t("clients.username"),prop:"username"}},[s("span",[e._v(e._s(e.record.username))])]),e._v(" "),s("el-form-item",{attrs:{label:e.$t("clients.protoType")}},["MQTT"===e.record.proto_name?[s("span",[e._v(e._s(e.record.proto_name)+" "+e._s(e.mqttVersionMap[e.record.proto_ver]))])]:[s("span",[e._v("\n "+e._s(e.record.proto_name)+"\n "),e.record.proto_ver?s("span",[e._v(" v"+e._s(e.record.proto_ver))]):e._e()])]],2),e._v(" "),s("el-form-item",{attrs:{label:e.$t("clients.ipAddr"),prop:"ip_address"}},[s("span",[e._v(e._s(e.record.ip_address))])]),e._v(" "),s("el-form-item",{attrs:{label:e.$t("clients.port"),prop:"port"}},[s("span",[e._v(e._s(e.record.port))])]),e._v(" "),s("el-form-item",{attrs:{label:e.$t("clients.keepalive"),prop:"keepalive"}},[s("span",[e._v(e._s(e.record.keepalive))])]),e._v(" "),s("el-form-item",{attrs:{label:e.$t("clients.isBridge"),prop:"is_bridge"}},[s("span",[e._v(e._s(e.record.is_bridge))])]),e._v(" "),e.record.connected?s("el-form-item",{attrs:{label:e.$t("clients.connectedAt"),prop:"connected_at"}},[s("span",[e._v(e._s(e.record.connected_at))])]):e._e(),e._v(" "),e.record.connected?e._e():s("el-form-item",{attrs:{label:e.$t("clients.disconnectAt"),prop:"disconnected_at"}},[s("span",[e._v(e._s(e.record.disconnected_at))])]),e._v(" "),s("el-form-item",{attrs:{label:e.$t("clients.connected"),prop:"connected"}},[s("span",{class:e.record.connected?"connected":"disconnected"},[e._v("\n "+e._s(e.record.connected?e.$t("websocket.connected"):e.$t("websocket.disconnected"))+"\n ")])]),e._v(" "),s("el-form-item",{attrs:{label:"Zone",prop:"zone"}},[s("span",[e._v(e._s(e.record.zone))])])],1),e._v(" "),s("el-col",{attrs:{span:12}},[s("div",{staticClass:"card-subtitle"},[e._v(e._s(e.$t("clients.session")))]),e._v(" "),s("el-form-item",{attrs:{label:5===e.record.proto_ver?"Clean Start":"Clean Session",prop:"clean_start"}},[s("span",[e._v(e._s(e.record.clean_start))])]),e._v(" "),s("el-form-item",{attrs:{label:e.$t("clients.expiryInterval"),prop:"expiry_interval"}},[s("span",[e._v(e._s(e.record.expiry_interval))])]),e._v(" "),s("el-form-item",{attrs:{label:e.$t("clients.createdAt"),prop:"created_at"}},[s("span",[e._v(e._s(e.record.created_at))])]),e._v(" "),s("el-form-item",{attrs:{label:e.$t("clients.subscriptions")}},[s("span",[e._v(e._s(e.record.subscriptions_cnt)+" / "+e._s(e._f("transToUnlimit")(e.record.max_subscriptions)))])]),e._v(" "),s("el-form-item",{attrs:{label:e.$t("clients.max")+" "+e.$t("clients.subscriptions")}},[s("span",[e._v(e._s(e._f("transToUnlimit")(e.record.max_subscriptions)))])]),e._v(" "),s("el-form-item",{attrs:{label:e.$t("clients.inflight")}},[s("span",[e._v(e._s(e.record.inflight)+" / "+e._s(e.record.max_inflight))])]),e._v(" "),s("el-form-item",{attrs:{label:e.$t("clients.max")+" "+e.$t("clients.inflight")}},[s("span",[e._v(e._s(e.record.max_inflight))])]),e._v(" "),s("el-form-item",{attrs:{label:e.$t("clients.mqueue")}},[s("span",[e._v(e._s(e.record.mqueue_len)+" / "+e._s(e.record.max_mqueue))])]),e._v(" "),s("el-form-item",{attrs:{label:e.$t("clients.max")+" "+e.$t("clients.mqueue")}},[s("span",[e._v(e._s(e.record.max_mqueue))])]),e._v(" "),s("el-form-item",{attrs:{label:e.$t("clients.awaiting_rel"),prop:"awaiting_rel"}},[s("span",[e._v(e._s(e.record.awaiting_rel))])]),e._v(" "),s("el-form-item",{attrs:{label:e.$t("clients.max")+" "+e.$t("clients.awaiting_rel"),prop:"max_awaiting_rel"}},[s("span",[e._v(e._s(e.record.max_awaiting_rel))])])],1)],1)],1),e._v(" "),s("div",{staticClass:"view-more"},[s("a",{attrs:{href:"javascript:;"},on:{click:function(t){e.showMore=!e.showMore}}},[e._v("\n "+e._s(e.showMore?e.$t("oper.collapse"):e.$t("oper.viewMore"))+"\n "),s("i",{class:e.showMore?"el-icon-arrow-up":"el-icon-arrow-down"})])]),e._v(" "),s("el-collapse-transition",[e.showMore?s("el-form",{ref:"record",staticClass:"clients-basic-form",attrs:{model:e.record,"label-suffix":":"}},[s("el-row",[s("el-col",{attrs:{span:12}},[s("el-form-item",{attrs:{label:e.$t("clients.recv_cnt_desc"),prop:"recv_cnt"}},[s("span",[e._v(e._s(e.record.recv_cnt))])]),e._v(" "),s("el-form-item",{attrs:{label:e.$t("clients.recv_msg_desc"),prop:"recv_msg"}},[s("span",[e._v(e._s(e.record.recv_msg))])]),e._v(" "),s("el-form-item",{attrs:{label:e.$t("clients.recv_oct_desc"),prop:"recv_oct"}},[s("span",[e._v(e._s(e.record.recv_oct))])]),e._v(" "),s("el-form-item",{attrs:{label:e.$t("clients.recv_pkt_desc"),prop:"recv_pkt"}},[s("span",[e._v(e._s(e.record.recv_pkt))])])],1),e._v(" "),s("el-col",{attrs:{span:12}},[s("el-form-item",{attrs:{label:e.$t("clients.send_cnt_desc"),prop:"send_cnt"}},[s("span",[e._v(e._s(e.record.send_cnt))])]),e._v(" "),s("el-form-item",{attrs:{label:e.$t("clients.send_msg_desc"),prop:"send_msg"}},[s("span",[e._v(e._s(e.record.send_msg))])]),e._v(" "),s("el-form-item",{attrs:{label:e.$t("clients.send_oct_desc"),prop:"send_oct"}},[s("span",[e._v(e._s(e.record.send_oct))])]),e._v(" "),s("el-form-item",{attrs:{label:e.$t("clients.send_pkt_desc"),prop:"send_pkt"}},[s("span",[e._v(e._s(e.record.send_pkt))])])],1)],1)],1):e._e()],1)],1)],1)},staticRenderFns:[]};var i=s("VU/8")(r,c,!1,function(e){s("fGrP")},null,null).exports,o=s("woOf"),a=s.n(o),l={name:"clients-subscriptions",components:{EmqSelect:s("FcGO").a},props:{clientId:{type:String,required:!0},tableData:{type:Array,required:!0},reload:{type:Function,default:function(){}},mountpoint:{type:String,default:""}},data:function(){return{addVisible:!1,record:{topic:"",qos:0},rules:{clientid:{required:!0,message:this.$t("oper.pleaseEnter")},topic:{required:!0,message:this.$t("oper.pleaseEnter")}}}},methods:{handleUnsub:function(e){var t=this;this.$msgbox.confirm(this.$t("oper.unsubscribeConfirm"),this.$t("oper.warning"),{type:"warning"}).then(function(){var s=e.topic,n=e.clientid,r={topic:t.mountpoint?s.replace(t.mountpoint,""):s,clientid:n};t.$httpPost("/mqtt/unsubscribe",r).then(function(){t.reload()}).catch(function(){})}).catch(function(){})},open:function(){this.addVisible=!0,this.record.clientid=this.clientId},handleAdd:function(){var e=this;this.$refs.record.validate(function(t){if(t){var s={};a()(s,e.record),e.$httpPost("/mqtt/subscribe",s).then(function(){e.handleClose(),e.reload()}).catch(function(){})}})},handleClose:function(){this.$refs.record.resetFields(),this.addVisible=!1}}},d={render:function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"clients-subscriptions"},[s("el-card",{staticClass:"el-card--self tabs-card"},[s("el-row",[s("el-col",{staticClass:"card-subtitle",attrs:{span:12}},[e._v("\n "+e._s(this.$t("clients.currentSubs"))+"\n ")]),e._v(" "),s("el-col",{staticClass:"oper-btn-group",attrs:{span:12}},[s("el-button",{attrs:{size:"mini",type:"success",icon:"el-icon-refresh",plain:""},on:{click:e.reload}},[e._v("\n "+e._s(e.$t("oper.refresh"))+"\n ")]),e._v(" "),s("el-button",{attrs:{size:"mini",type:"success",icon:"el-icon-plus",plain:""},on:{click:e.open}},[e._v("\n "+e._s(e.$t("clients.addSubs"))+"\n ")])],1)],1),e._v(" "),s("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.$store.state.loading,expression:"$store.state.loading"}],staticClass:"client-sub-table",attrs:{border:"",data:e.tableData}},[s("el-table-column",{attrs:{prop:"topic",label:e.$t("subscriptions.topic")}}),e._v(" "),s("el-table-column",{attrs:{prop:"qos",label:e.$t("subscriptions.qoS")}}),e._v(" "),s("el-table-column",{attrs:{width:"120px",label:e.$t("oper.oper")},scopedSlots:e._u([{key:"default",fn:function(t){var n=t.row;return[s("el-button",{attrs:{size:"mini",type:"danger",plain:""},on:{click:function(t){return e.handleUnsub(n)}}},[e._v("\n "+e._s(e.$t("oper.unsubscribe"))+"\n ")])]}}])})],1)],1),e._v(" "),s("el-dialog",{staticClass:"create-subscribe",attrs:{title:e.$t("clients.addSubs"),width:"400px",visible:e.addVisible},on:{"update:visible":function(t){e.addVisible=t}},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.handleAdd(t)}}},[s("el-form",{ref:"record",staticClass:"el-form--public",attrs:{model:e.record,rules:e.rules,size:"small","label-position":"top"}},[s("el-form-item",{attrs:{prop:"topic",label:e.$t("subscriptions.topic")}},[s("el-input",{attrs:{placeholder:"Topic"},model:{value:e.record.topic,callback:function(t){e.$set(e.record,"topic",t)},expression:"record.topic"}})],1),e._v(" "),s("el-form-item",{attrs:{prop:"qos",label:"QoS"}},[s("emq-select",{staticClass:"el-select--public",attrs:{"popper-class":"el-select--public",size:"small",field:{list:[0,1,2]}},model:{value:e.record.qos,callback:function(t){e.$set(e.record,"qos",t)},expression:"record.qos"}})],1)],1),e._v(" "),s("div",{attrs:{slot:"footer"},slot:"footer"},[s("el-button",{staticClass:"cache-btn",attrs:{type:"text"},on:{click:e.handleClose}},[e._v("\n "+e._s(e.$t("oper.cancel"))+"\n ")]),e._v(" "),s("el-button",{staticClass:"confirm-btn",attrs:{type:"success",loading:e.$store.state.loading},on:{click:e.handleAdd}},[e._v("\n "+e._s(e.$t("oper.add"))+"\n ")])],1)],1)],1)},staticRenderFns:[]};var p={name:"clients-view",components:{ClientsBasic:i,ClientsSubscriptions:s("VU/8")(l,d,!1,function(e){s("/CfG")},null,null).exports},data:function(){return{activeName:"basic",basicRecord:{},subscriptionsData:[],nodeName:"",mountpoint:""}},computed:{clientId:function(){return this.$route.params.id}},created:function(){this.loadBasicData()},watch:{activeName:function(e){"basic"===e?this.loadBasicData():"subscription"===e&&this.loadSubscription()}},methods:{interceptString:function(e,t){return Object(n.d)(e,t)},handleCommand:function(e){this[e]()},handleDisconnect:function(){var e=this,t=this.basicRecord.connected?this.$t("oper.confirmKickOut"):this.$t("oper.confirmCleanSession");this.$confirm(t,this.$t("oper.warning"),{confirmButtonClass:"confirm-btn",cancelButtonClass:"cache-btn el-button--text",type:"warning"}).then(function(){e.$httpDelete("/clients/"+encodeURIComponent(e.clientId)).then(function(){e.$message.success(e.$t("oper.disconnectSuccess")),e.$set(e.basicRecord,"connected",!1),setTimeout(function(){e.$router.push({path:"/clients"})},500)}).catch(function(t){e.$message.error(t||e.$t("error.networkError"))})}).catch(function(){})},loadBasicData:function(){var e=this;this.$httpGet("/clients/"+encodeURIComponent(this.clientId)).then(function(t){e.basicRecord=t.data[0],e.nodeName=e.basicRecord.node,t.data[0].mountpoint&&(e.mountpoint=t.data[0].mountpoint),e.loadSubscription()}).catch(function(){})},loadSubscription:function(){var e=this;this.$httpGet("/nodes/"+this.nodeName+"/subscriptions/"+encodeURIComponent(this.clientId)).then(function(t){e.subscriptionsData=t.data}).catch(function(){})}}},_={render:function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"clients-view"},[s("div",{staticClass:"page-title"},[s("el-breadcrumb",{attrs:{separator:"/"}},[s("el-breadcrumb-item",{attrs:{to:{path:"/clients"}}},[e._v("\n "+e._s(e.$t("leftbar.clients"))+"\n ")]),e._v(" "),s("el-breadcrumb-item",{staticClass:"breadcrumb-name"},[e._v("\n "+e._s(e.$t("clients.view"))+"\n ")])],1)],1),e._v(" "),s("div",{staticClass:"client-oper"},[s("span",{class:[e.basicRecord.connected?"connected":"disconnected","status-circle"]}),e._v(" "),e.clientId.length>90?s("el-popover",{attrs:{placement:"top-start",trigger:"hover",content:e.clientId}},[s("span",{attrs:{slot:"reference"},slot:"reference"},[e._v(e._s(e.interceptString(e.clientId,90)))])]):s("span",[e._v(e._s(e.clientId))]),e._v(" "),s("el-button",{class:[e.basicRecord.connected?"connected":"disconnected","connect-btn"],attrs:{size:"mini"},on:{click:e.handleDisconnect}},[e._v("\n "+e._s(e.basicRecord.connected?e.$t("clients.kickOut"):e.$t("websocket.cleanSession"))+"\n ")])],1),e._v(" "),s("el-tabs",{staticClass:"normal-tabs",attrs:{type:"card"},model:{value:e.activeName,callback:function(t){e.activeName=t},expression:"activeName"}},[s("el-tab-pane",{attrs:{label:e.$t("clients.basicInfo"),name:"basic"}},[s("clients-basic",{attrs:{record:e.basicRecord}})],1),e._v(" "),s("el-tab-pane",{attrs:{label:e.$t("clients.subsInfo"),name:"subscription"}},[s("clients-subscriptions",{attrs:{clientId:e.clientId,tableData:e.subscriptionsData,reload:e.loadSubscription,mountpoint:e.mountpoint}})],1)],1)],1)},staticRenderFns:[]};var u=s("VU/8")(p,_,!1,function(e){s("MSWd")},null,null);t.default=u.exports},MSWd:function(e,t){},fGrP:function(e,t){}}); -------------------------------------------------------------------------------- /priv/www/static/js/9.473ceac05f7dfe3f3e92.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([9],{TK64:function(t,e){},"qB/b":function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=a("fZjL"),n=a.n(s),r=a("mvHQ"),o=a.n(r),i=a("zL8q"),p=[{path:"/auth",name:"auth_user",method:"POST",descr:"Authenticate an user"},{path:"/users/",name:"create_user",method:"POST",descr:"Create an user"},{path:"/users/",name:"list_users",method:"GET",descr:"List users"},{path:"/users/:name",name:"update_user",method:"PUT",descr:"Update an user"},{path:"/users/:name",name:"delete_user",method:"DELETE",descr:"Delete an user"},{path:"/change_pwd/:username",name:"change_pwd",method:"PUT",descr:"Change password for an user"},{path:"/apps/",name:"add_app",method:"POST",descr:"Add Application"},{path:"/apps/:appid",name:"del_app",method:"DELETE",descr:"Delete Application"},{path:"/apps/",name:"list_apps",method:"GET",descr:"List Applications"},{path:"/apps/:appid",name:"lookup_app",method:"GET",descr:"Lookup Application"},{path:"/apps/:appid",name:"update_app",method:"PUT",descr:"Update Application"}],l={name:"http-api",components:{"el-button":i.Button,"el-table":i.Table,"el-table-column":i.TableColumn,"el-card":i.Card},data:function(){return{popoverVisible:!1,nodeName:"emqx@127.0.0.1",tableData:[],nodes:[],responseDate:null,scrollTop:0,uri:""}},computed:{jsonFormatter:function(){var t=o()(this.responseDate,null,"\t");return t=(t=t.replace(/\n/g,"
")).replace(/\t/g,"    ")}},watch:{nodeInfo:"setApiData"},methods:{isLink:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.target&&-1===t.target.indexOf(":")},init:function(){var t=this,e=this.$store.state.nodeName;this.$httpGet("/nodes").then(function(a){t.nodeName=e||a.data[0].node,t.nodes=a.data,t.setApiData()}).catch(function(e){t.$message.error(e||t.$t("error.networkError"))})},loadResponse:function(t){var e=this;if(!(!(arguments.length>1&&void 0!==arguments[1])||arguments[1]))return this.responseDate=null,void(document.documentElement.scrollTop=this.scrollTop);if(this.isLink(t)){this.uri="/api/v4"+t.target,this.scrollTop=document.documentElement.scrollTop,document.documentElement.scrollTop=0;var a=function(a){a(t.target).then(e.handleSuccess).catch(e.handleError)};switch(t.method){case"GET":a(this.$httpGet);break;case"POST":a(this.$httpPost);break;case"PUT":a(this.$httpPut);break;default:this.responseDate=null}}},handleSuccess:function(t){this.responseDate=t.data},handleError:function(t){this.$message.error(t||this.$t("error.networkError"))},setApiData:function(){var t=this;this.$httpGet("/").then(function(e){t.tableData=[];var a=o()(e.data);a=a.replace(/:node/g,t.nodeName),a=(a=JSON.parse(a)).filter(function(t){return p.every(function(e){return e.path!==t.path})}),n()(a).forEach(function(e){t.tableData.push({method:a[e].method,path:"/api/v4"+(a[e].path.startsWith("/")?a[e].path:"/"+a[e].path),target:a[e].path,description:a[e].descr})})})}},created:function(){this.init()}},d={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"http-api"},[a("div",{staticClass:"page-title"},[t._v("\n "+t._s(t.$t("leftbar.api"))+"\n ")]),t._v(" "),a("el-card",{staticClass:"el-card--self"},[a("div",{attrs:{slot:"header"},slot:"header"},[a("span",[t._v(t._s(t.$t("httpApi.introduction")))])]),t._v(" "),a("div",{staticClass:"desc--text",domProps:{innerHTML:t._s(t.$t("httpApi.desc"))}})]),t._v(" "),a("el-card",{staticClass:"el-card--self"},[a("div",{attrs:{slot:"header"},slot:"header"},[t.responseDate?t._e():a("span",[t._v(t._s(t.$t("httpApi.reference")))]),t._v(" "),t.responseDate?a("el-button",{staticClass:"refresh-btn",attrs:{type:"text"},on:{click:function(e){return t.loadResponse(null,!1)}}},[a("i",{staticClass:"el-icon-arrow-left"}),t._v("\n "+t._s(t.$t("httpApi.back"))+"\n ")]):t._e()],1),t._v(" "),t.responseDate?t._e():a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.$store.state.loading,expression:"$store.state.loading"}],attrs:{border:"",data:t.tableData}},[a("el-table-column",{attrs:{prop:"method",width:"120",label:t.$t("httpApi.method")}}),t._v(" "),a("el-table-column",{attrs:{"min-width":"160",label:t.$t("httpApi.path")},scopedSlots:t._u([{key:"default",fn:function(e){return[a("a",{class:["link",t.isLink(e.row)?"":"link-disabled"],attrs:{href:"javascript:;"},on:{click:function(a){return t.loadResponse(e.row)}}},[t._v("\n "+t._s(e.row.path)+"\n ")])]}}],null,!1,250455254)}),t._v(" "),a("el-table-column",{attrs:{"min-width":"240",label:t.$t("httpApi.description")},scopedSlots:t._u([{key:"default",fn:function(e){return[a("div",{domProps:{innerHTML:t._s(e.row.description)}})]}}],null,!1,3142742130)})],1),t._v(" "),t.responseDate?a("div",{staticClass:"response-container"},[a("div",{staticClass:"response-header"},[a("h3",[t._v("\n "+t._s(t.$t("httpApi.linkAddress"))+" :\n "),a("a",{attrs:{href:"javascript:;"}},[t._v(t._s(t.uri))])]),t._v(" "),a("h3",[t._v(t._s(t.$t("httpApi.data"))+" :")])]),t._v(" "),a("div",{staticClass:"response.body",domProps:{innerHTML:t._s(t.jsonFormatter)}})]):t._e()],1)],1)},staticRenderFns:[]};var c=a("VU/8")(l,d,!1,function(t){a("TK64")},null,null);e.default=c.exports}}); -------------------------------------------------------------------------------- /priv/www/static/js/base64.min.js: -------------------------------------------------------------------------------- 1 | (function(){var a=typeof window!="undefined"?window:exports,b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c=function(){try{document.createElement("$")}catch(a){return a}}();a.btoa||(a.btoa=function(a){for(var d,e,f=0,g=b,h="";a.charAt(f|0)||(g="=",f%1);h+=g.charAt(63&d>>8-f%1*8)){e=a.charCodeAt(f+=.75);if(e>255)throw c;d=d<<8|e}return h}),a.atob||(a.atob=function(a){a=a.replace(/=+$/,"");if(a.length%4==1)throw c;for(var d=0,e,f,g=0,h="";f=a.charAt(g++);~f&&(e=d%4?e*64+f:f,d++%4)?h+=String.fromCharCode(255&e>>(-2*d&6)):0)f=b.indexOf(f);return h})})(); -------------------------------------------------------------------------------- /priv/www/static/js/env.js: -------------------------------------------------------------------------------- 1 | var EMQX_DASHBOARD_CONFIG = { 2 | platform: 'emqx', 3 | lang: 'en', 4 | } 5 | -------------------------------------------------------------------------------- /priv/www/static/js/manifest.f72a5c400fac2e53484f.js: -------------------------------------------------------------------------------- 1 | !function(e){var c=window.webpackJsonp;window.webpackJsonp=function(a,f,t){for(var o,d,b,i=0,u=[];iThe browser version you are currently using is too low to use the system properly. It is recommended to use a higher version of the browser.

\n' + 12 | ' FireFox\n' + 13 | ' Chrome' 14 | notice.setAttribute('class', 'backward-alert') 15 | 16 | document.body.appendChild(style) 17 | document.body.appendChild(notice) 18 | -------------------------------------------------------------------------------- /rebar.config: -------------------------------------------------------------------------------- 1 | {deps, 2 | [{minirest, {git, "https://github.com/emqx/minirest", {tag, "0.3.2"}}} 3 | ]}. 4 | 5 | {profiles, 6 | [{test, 7 | [{deps, 8 | [{emqx_ct_helper, {git, "https://github.com/emqx/emqx-ct-helper", {branch, "1.2.2"}}} 9 | ]} 10 | ]} 11 | ]}. 12 | 13 | {edoc_opts, [{preprocess, true}]}. 14 | {erl_opts, [warn_unused_vars, 15 | warn_shadow_vars, 16 | warn_unused_import, 17 | warn_obsolete_guard, 18 | debug_info, 19 | {d, 'APPLICATION', emqx}]}. 20 | {xref_checks, [undefined_function_calls, undefined_functions, 21 | locals_not_used, deprecated_function_calls, 22 | warnings_as_errors, deprecated_functions]}. 23 | {cover_enabled, true}. 24 | {cover_opts, [verbose]}. 25 | {cover_export_enabled, true}. 26 | -------------------------------------------------------------------------------- /rebar.config.script: -------------------------------------------------------------------------------- 1 | %%-*- mode: erlang -*- 2 | 3 | DEPS = case lists:keyfind(deps, 1, CONFIG) of 4 | {_, Deps} -> Deps; 5 | _ -> [] 6 | end, 7 | 8 | ComparingFun = fun 9 | _Fun([C1|R1], [C2|R2]) when is_list(C1), is_list(C2); 10 | is_integer(C1), is_integer(C2) -> C1 < C2 orelse _Fun(R1, R2); 11 | _Fun([C1|R1], [C2|R2]) when is_integer(C1), is_list(C2) -> _Fun(R1, R2); 12 | _Fun([C1|R1], [C2|R2]) when is_list(C1), is_integer(C2) -> true; 13 | _Fun(_, _) -> false 14 | end, 15 | 16 | SortFun = fun(T1, T2) -> 17 | C = fun(T) -> 18 | [case catch list_to_integer(E) of 19 | I when is_integer(I) -> I; 20 | _ -> E 21 | end || E <- re:split(string:sub_string(T, 2), "[.-]", [{return, list}])] 22 | end, 23 | ComparingFun(C(T1), C(T2)) 24 | end, 25 | 26 | VTags = string:tokens(os:cmd("git tag -l \"v*\" --points-at $(git rev-parse $(git describe --abbrev=0 --tags))"), "\n"), 27 | 28 | Tags = case VTags of 29 | [] -> string:tokens(os:cmd("git tag -l \"e*\" --points-at $(git rev-parse $(git describe --abbrev=0 --tags))"), "\n"); 30 | _ -> VTags 31 | end, 32 | 33 | LatestTag = lists:last(lists:sort(SortFun, Tags)), 34 | 35 | Branch = case os:getenv("GITHUB_RUN_ID") of 36 | false -> os:cmd("git branch | grep -e '^*' | cut -d' ' -f 2") -- "\n"; 37 | _ -> re:replace(os:getenv("GITHUB_REF"), "^refs/heads/|^refs/tags/", "", [global, {return ,list}]) 38 | end, 39 | 40 | GitDescribe = case re:run(Branch, "master|^dev/|^hotfix/", [{capture, none}]) of 41 | match -> {branch, Branch}; 42 | _ -> {tag, LatestTag} 43 | end, 44 | 45 | UrlPrefix = "https://github.com/emqx/", 46 | 47 | EMQX_DEP = {emqx, {git, UrlPrefix ++ "emqx", GitDescribe}}, 48 | EMQX_MGMT_DEP = {emqx_management, {git, UrlPrefix ++ "emqx-management", GitDescribe}}, 49 | 50 | NewDeps = [EMQX_DEP, EMQX_MGMT_DEP | DEPS], 51 | 52 | CONFIG1 = lists:keystore(deps, 1, CONFIG, {deps, NewDeps}), 53 | 54 | CONFIG1. 55 | -------------------------------------------------------------------------------- /src/emqx_dashboard.app.src: -------------------------------------------------------------------------------- 1 | {application, emqx_dashboard, 2 | [{description, "EMQX Web Dashboard"}, 3 | {vsn, "git"}, 4 | {modules, []}, 5 | {registered, [emqx_dashboard_sup]}, 6 | {applications, [kernel,stdlib,mnesia,minirest]}, 7 | {mod, {emqx_dashboard_app,[]}}, 8 | {env, []}, 9 | {licenses, ["Apache-2.0"]}, 10 | {maintainers, ["EMQX Team "]}, 11 | {links, [{"Homepage", "https://emqx.io/"}, 12 | {"Github", "https://github.com/emqx/emqx-dashboard"} 13 | ]} 14 | ]}. 15 | -------------------------------------------------------------------------------- /src/emqx_dashboard.app.src.script: -------------------------------------------------------------------------------- 1 | %%-*- mode: erlang -*- 2 | %% .app.src.script 3 | 4 | RemoveLeadingV = 5 | fun(Tag) -> 6 | case re:run(Tag, "^[v|e]?[0-9]\.[0-9]\.([0-9]|(rc|beta|alpha)\.[0-9])", [{capture, none}]) of 7 | nomatch -> 8 | re:replace(Tag, "/", "-", [{return ,list}]); 9 | _ -> 10 | %% if it is a version number prefixed by 'v' or 'e', then remove it 11 | re:replace(Tag, "[v|e]", "", [{return ,list}]) 12 | end 13 | end, 14 | 15 | case os:getenv("EMQX_DEPS_DEFAULT_VSN") of 16 | false -> CONFIG; % env var not defined 17 | [] -> CONFIG; % env var set to empty string 18 | Tag -> 19 | [begin 20 | AppConf0 = lists:keystore(vsn, 1, AppConf, {vsn, RemoveLeadingV(Tag)}), 21 | {application, App, AppConf0} 22 | end || Conf = {application, App, AppConf} <- CONFIG] 23 | end. 24 | 25 | -------------------------------------------------------------------------------- /src/emqx_dashboard.appup.src: -------------------------------------------------------------------------------- 1 | %% -*-: erlang -*- 2 | 3 | {VSN, 4 | [ 5 | {<<".*">>, 6 | [ 7 | {restart_application, emqx_dashboard}, 8 | {apply, {emqx_plugins, load, []}} 9 | ]} 10 | ], 11 | [ 12 | {<<".*">>, 13 | [ 14 | {restart_application, emqx_dashboard}, 15 | {apply, {emqx_plugins, load, []}} 16 | ]} 17 | ] 18 | }. 19 | -------------------------------------------------------------------------------- /src/emqx_dashboard.erl: -------------------------------------------------------------------------------- 1 | %%-------------------------------------------------------------------- 2 | %% Copyright (c) 2020 EMQ Technologies Co., Ltd. All Rights Reserved. 3 | %% 4 | %% Licensed under the Apache License, Version 2.0 (the "License"); 5 | %% you may not use this file except in compliance with the License. 6 | %% You may obtain a copy of the License at 7 | %% 8 | %% http://www.apache.org/licenses/LICENSE-2.0 9 | %% 10 | %% Unless required by applicable law or agreed to in writing, software 11 | %% distributed under the License is distributed on an "AS IS" BASIS, 12 | %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | %% See the License for the specific language governing permissions and 14 | %% limitations under the License. 15 | %%-------------------------------------------------------------------- 16 | 17 | -module(emqx_dashboard). 18 | 19 | -include_lib("emqx/include/emqx.hrl"). 20 | -include_lib("emqx/include/logger.hrl"). 21 | 22 | -import(proplists, [get_value/3]). 23 | 24 | -export([ start_listeners/0 25 | , stop_listeners/0 26 | ]). 27 | 28 | -define(APP, ?MODULE). 29 | 30 | %%-------------------------------------------------------------------- 31 | %% Start/Stop listeners. 32 | %%-------------------------------------------------------------------- 33 | 34 | start_listeners() -> 35 | lists:foreach(fun(Listener) -> start_listener(Listener) end, listeners()). 36 | 37 | %% Start HTTP Listener 38 | start_listener({Proto, Port, Options}) when Proto == http -> 39 | Dispatch = [{"/", cowboy_static, {priv_file, emqx_dashboard, "www/index.html"}}, 40 | {"/static/[...]", cowboy_static, {priv_dir, emqx_dashboard, "www/static"}}, 41 | {"/api/v4/[...]", minirest, http_handlers()}], 42 | minirest:start_http(listener_name(Proto), ranch_opts(Port, Options), Dispatch); 43 | 44 | start_listener({Proto, Port, Options}) when Proto == https -> 45 | Dispatch = [{"/", cowboy_static, {priv_file, emqx_dashboard, "www/index.html"}}, 46 | {"/static/[...]", cowboy_static, {priv_dir, emqx_dashboard, "www/static"}}, 47 | {"/api/v4/[...]", minirest, http_handlers()}], 48 | minirest:start_https(listener_name(Proto), ranch_opts(Port, Options), Dispatch). 49 | 50 | ranch_opts(Port, Options0) -> 51 | NumAcceptors = get_value(num_acceptors, Options0, 4), 52 | MaxConnections = get_value(max_connections, Options0, 512), 53 | Options = lists:foldl(fun({K, _V}, Acc) when K =:= max_connections orelse K =:= num_acceptors -> 54 | Acc; 55 | ({inet6, true}, Acc) -> [inet6 | Acc]; 56 | ({inet6, false}, Acc) -> Acc; 57 | ({ipv6_v6only, true}, Acc) -> [{ipv6_v6only, true} | Acc]; 58 | ({ipv6_v6only, false}, Acc) -> Acc; 59 | ({K, V}, Acc)-> 60 | [{K, V} | Acc] 61 | end, [], Options0), 62 | #{num_acceptors => NumAcceptors, 63 | max_connections => MaxConnections, 64 | socket_opts => [{port, Port} | Options]}. 65 | 66 | stop_listeners() -> 67 | lists:foreach(fun(Listener) -> stop_listener(Listener) end, listeners()). 68 | 69 | stop_listener({Proto, _Port, _}) -> 70 | minirest:stop_http(listener_name(Proto)). 71 | 72 | listeners() -> 73 | application:get_env(?APP, listeners, []). 74 | 75 | listener_name(Proto) -> 76 | list_to_atom(atom_to_list(Proto) ++ ":dashboard"). 77 | 78 | %%-------------------------------------------------------------------- 79 | %% HTTP Handlers and Dispatcher 80 | %%-------------------------------------------------------------------- 81 | 82 | http_handlers() -> 83 | Plugins = lists:map(fun(Plugin) -> Plugin#plugin.name end, emqx_plugins:list()), 84 | [{"/api/v4/", minirest:handler(#{apps => Plugins, filter => fun filter/1}),[{authorization, fun is_authorized/1}]}]. 85 | 86 | %%-------------------------------------------------------------------- 87 | %% Basic Authorization 88 | %%-------------------------------------------------------------------- 89 | 90 | is_authorized(Req) -> 91 | is_authorized(binary_to_list(cowboy_req:path(Req)), Req). 92 | 93 | is_authorized("/api/v4/auth", _Req) -> 94 | true; 95 | is_authorized(_Path, Req) -> 96 | case cowboy_req:parse_header(<<"authorization">>, Req) of 97 | {basic, Username, Password} -> 98 | case emqx_dashboard_admin:check(iolist_to_binary(Username), 99 | iolist_to_binary(Password)) of 100 | ok -> true; 101 | {error, Reason} -> 102 | ?LOG(error, "[Dashboard] Authorization Failure: username=~s, reason=~p", 103 | [Username, Reason]), 104 | false 105 | end; 106 | _ -> false 107 | end. 108 | 109 | filter(#{app := App}) -> 110 | case emqx_plugins:find_plugin(App) of 111 | false -> false; 112 | Plugin -> Plugin#plugin.active 113 | end. 114 | -------------------------------------------------------------------------------- /src/emqx_dashboard_admin.erl: -------------------------------------------------------------------------------- 1 | %%-------------------------------------------------------------------- 2 | %% Copyright (c) 2020 EMQ Technologies Co., Ltd. All Rights Reserved. 3 | %% 4 | %% Licensed under the Apache License, Version 2.0 (the "License"); 5 | %% you may not use this file except in compliance with the License. 6 | %% You may obtain a copy of the License at 7 | %% 8 | %% http://www.apache.org/licenses/LICENSE-2.0 9 | %% 10 | %% Unless required by applicable law or agreed to in writing, software 11 | %% distributed under the License is distributed on an "AS IS" BASIS, 12 | %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | %% See the License for the specific language governing permissions and 14 | %% limitations under the License. 15 | %%-------------------------------------------------------------------- 16 | 17 | %% @doc Web dashboard admin authentication with username and password. 18 | 19 | -module(emqx_dashboard_admin). 20 | 21 | -behaviour(gen_server). 22 | 23 | -include("emqx_dashboard.hrl"). 24 | 25 | -boot_mnesia({mnesia, [boot]}). 26 | -copy_mnesia({mnesia, [copy]}). 27 | 28 | %% Mnesia bootstrap 29 | -export([mnesia/1]). 30 | 31 | %% API Function Exports 32 | -export([start_link/0]). 33 | 34 | %% mqtt_admin api 35 | -export([ add_user/3 36 | , force_add_user/3 37 | , remove_user/1 38 | , update_user/2 39 | , lookup_user/1 40 | , change_password/2 41 | , change_password/3 42 | , all_users/0 43 | , check/2 44 | ]). 45 | 46 | %% gen_server Function Exports 47 | -export([ init/1 48 | , handle_call/3 49 | , handle_cast/2 50 | , handle_info/2 51 | , terminate/2 52 | , code_change/3 53 | ]). 54 | 55 | %%-------------------------------------------------------------------- 56 | %% Mnesia bootstrap 57 | %%-------------------------------------------------------------------- 58 | 59 | mnesia(boot) -> 60 | ok = ekka_mnesia:create_table(mqtt_admin, [ 61 | {type, set}, 62 | {disc_copies, [node()]}, 63 | {record_name, mqtt_admin}, 64 | {attributes, record_info(fields, mqtt_admin)}, 65 | {storage_properties, [{ets, [{read_concurrency, true}, 66 | {write_concurrency, true}]}]}]); 67 | mnesia(copy) -> 68 | ok = ekka_mnesia:copy_table(mqtt_admin). 69 | 70 | %%-------------------------------------------------------------------- 71 | %% API 72 | %%-------------------------------------------------------------------- 73 | 74 | -spec(start_link() -> {ok, pid()} | ignore | {error, any()}). 75 | start_link() -> 76 | gen_server:start_link({local, ?MODULE}, ?MODULE, [], []). 77 | 78 | -spec(add_user(binary(), binary(), binary()) -> ok | {error, any()}). 79 | add_user(Username, Password, Tags) when is_binary(Username), is_binary(Password) -> 80 | Admin = #mqtt_admin{username = Username, password = hash(Password), tags = Tags}, 81 | return(mnesia:transaction(fun add_user_/1, [Admin])). 82 | 83 | force_add_user(Username, Password, Tags) -> 84 | AddFun = fun() -> 85 | mnesia:write(#mqtt_admin{username = Username, 86 | password = Password, 87 | tags = Tags}) 88 | end, 89 | case mnesia:transaction(AddFun) of 90 | {atomic, ok} -> ok; 91 | {aborted, Reason} -> {error, Reason} 92 | end. 93 | 94 | %% @private 95 | add_user_(Admin = #mqtt_admin{username = Username}) -> 96 | case mnesia:wread({mqtt_admin, Username}) of 97 | [] -> mnesia:write(Admin); 98 | [_] -> mnesia:abort(<<"Username Already Exist">>) 99 | end. 100 | 101 | -spec(remove_user(binary()) -> ok | {error, any()}). 102 | remove_user(Username) when is_binary(Username) -> 103 | Trans = fun() -> 104 | case lookup_user(Username) of 105 | [] -> 106 | mnesia:abort(<<"Username Not Found">>); 107 | _ -> ok 108 | end, 109 | mnesia:delete({mqtt_admin, Username}) 110 | end, 111 | return(mnesia:transaction(Trans)). 112 | 113 | -spec(update_user(binary(), binary()) -> ok | {error, term()}). 114 | update_user(Username, Tags) when is_binary(Username) -> 115 | return(mnesia:transaction(fun update_user_/2, [Username, Tags])). 116 | 117 | %% @private 118 | update_user_(Username, Tags) -> 119 | case mnesia:wread({mqtt_admin, Username}) of 120 | [] -> mnesia:abort(<<"Username Not Found">>); 121 | [Admin] -> mnesia:write(Admin#mqtt_admin{tags = Tags}) 122 | end. 123 | 124 | change_password(Username, OldPasswd, NewPasswd) when is_binary(Username) -> 125 | case check(Username, OldPasswd) of 126 | ok -> change_password(Username, NewPasswd); 127 | Error -> Error 128 | end. 129 | 130 | change_password(Username, Password) when is_binary(Username), is_binary(Password) -> 131 | change_password_hash(Username, hash(Password)). 132 | 133 | change_password_hash(Username, PasswordHash) -> 134 | update_pwd(Username, fun(User) -> 135 | User#mqtt_admin{password = PasswordHash} 136 | end). 137 | 138 | update_pwd(Username, Fun) -> 139 | Trans = fun() -> 140 | User = 141 | case lookup_user(Username) of 142 | [Admin] -> Admin; 143 | [] -> 144 | mnesia:abort(<<"Username Not Found">>) 145 | end, 146 | mnesia:write(Fun(User)) 147 | end, 148 | return(mnesia:transaction(Trans)). 149 | 150 | 151 | -spec(lookup_user(binary()) -> [mqtt_admin()]). 152 | lookup_user(Username) when is_binary(Username) -> mnesia:dirty_read(mqtt_admin, Username). 153 | 154 | -spec(all_users() -> [#mqtt_admin{}]). 155 | all_users() -> ets:tab2list(mqtt_admin). 156 | 157 | return({atomic, _}) -> 158 | ok; 159 | return({aborted, Reason}) -> 160 | {error, Reason}. 161 | 162 | check(undefined, _) -> 163 | {error, <<"Username undefined">>}; 164 | check(_, undefined) -> 165 | {error, <<"Password undefined">>}; 166 | check(Username, Password) -> 167 | case lookup_user(Username) of 168 | [#mqtt_admin{password = <>}] -> 169 | case Hash =:= md5_hash(Salt, Password) of 170 | true -> ok; 171 | false -> {error, <<"Password Error">>} 172 | end; 173 | [] -> 174 | {error, <<"Username Not Found">>} 175 | end. 176 | 177 | %%-------------------------------------------------------------------- 178 | %% gen_server callbacks 179 | %%-------------------------------------------------------------------- 180 | 181 | init([]) -> 182 | %% Add default admin user 183 | add_default_user(binenv(default_user_username), binenv(default_user_passwd)), 184 | {ok, state}. 185 | 186 | handle_call(_Req, _From, State) -> 187 | {reply, error, State}. 188 | 189 | handle_cast(_Msg, State) -> 190 | {noreply, State}. 191 | 192 | handle_info(_Msg, State) -> 193 | {noreply, State}. 194 | 195 | terminate(_Reason, _State) -> 196 | ok. 197 | 198 | code_change(_OldVsn, State, _Extra) -> 199 | {ok, State}. 200 | 201 | %%-------------------------------------------------------------------- 202 | %% Internal functions 203 | %%-------------------------------------------------------------------- 204 | 205 | hash(Password) -> 206 | SaltBin = salt(), 207 | <>. 208 | 209 | md5_hash(SaltBin, Password) -> 210 | erlang:md5(<>). 211 | 212 | salt() -> 213 | emqx_misc:rand_seed(), 214 | Salt = rand:uniform(16#ffffffff), 215 | <>. 216 | 217 | binenv(Key) -> 218 | iolist_to_binary(application:get_env(emqx_dashboard, Key, "")). 219 | 220 | add_default_user(Username, Password) when ?EMPTY_KEY(Username) orelse ?EMPTY_KEY(Password) -> 221 | igonre; 222 | 223 | add_default_user(Username, Password) -> 224 | case lookup_user(Username) of 225 | [] -> add_user(Username, Password, <<"administrator">>); 226 | _ -> ok 227 | end. 228 | 229 | -------------------------------------------------------------------------------- /src/emqx_dashboard_api.erl: -------------------------------------------------------------------------------- 1 | %%-------------------------------------------------------------------- 2 | %% Copyright (c) 2020 EMQ Technologies Co., Ltd. All Rights Reserved. 3 | %% 4 | %% Licensed under the Apache License, Version 2.0 (the "License"); 5 | %% you may not use this file except in compliance with the License. 6 | %% You may obtain a copy of the License at 7 | %% 8 | %% http://www.apache.org/licenses/LICENSE-2.0 9 | %% 10 | %% Unless required by applicable law or agreed to in writing, software 11 | %% distributed under the License is distributed on an "AS IS" BASIS, 12 | %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | %% See the License for the specific language governing permissions and 14 | %% limitations under the License. 15 | %%-------------------------------------------------------------------- 16 | 17 | -module(emqx_dashboard_api). 18 | 19 | -include("emqx_dashboard.hrl"). 20 | 21 | -import(minirest, [return/1]). 22 | 23 | -rest_api(#{name => auth_user, 24 | method => 'POST', 25 | path => "/auth", 26 | func => auth, 27 | descr => "Authenticate an user" 28 | }). 29 | 30 | -rest_api(#{name => create_user, 31 | method => 'POST', 32 | path => "/users/", 33 | func => create, 34 | descr => "Create an user" 35 | }). 36 | 37 | -rest_api(#{name => list_users, 38 | method => 'GET', 39 | path => "/users/", 40 | func => list, 41 | descr => "List users" 42 | }). 43 | 44 | -rest_api(#{name => update_user, 45 | method => 'PUT', 46 | path => "/users/:bin:name", 47 | func => update, 48 | descr => "Update an user" 49 | }). 50 | 51 | -rest_api(#{name => delete_user, 52 | method => 'DELETE', 53 | path => "/users/:bin:name", 54 | func => delete, 55 | descr => "Delete an user" 56 | }). 57 | 58 | -rest_api(#{name => change_pwd, 59 | method => 'PUT', 60 | path => "/change_pwd/:bin:username", 61 | func => change_pwd, 62 | descr => "Change password for an user" 63 | }). 64 | 65 | -export([ list/2 66 | , create/2 67 | , update/2 68 | , delete/2 69 | , auth/2 70 | , change_pwd/2 71 | ]). 72 | 73 | -define(EMPTY(V), (V == undefined orelse V == <<>>)). 74 | 75 | auth(_Bindings, Params) -> 76 | Username = proplists:get_value(<<"username">>, Params), 77 | Password = proplists:get_value(<<"password">>, Params), 78 | return(emqx_dashboard_admin:check(Username, Password)). 79 | 80 | change_pwd(#{username := Username}, Params) -> 81 | OldPwd = proplists:get_value(<<"old_pwd">>, Params), 82 | NewPwd = proplists:get_value(<<"new_pwd">>, Params), 83 | return(emqx_dashboard_admin:change_password(Username, OldPwd, NewPwd)). 84 | 85 | create(_Bindings, Params) -> 86 | Username = proplists:get_value(<<"username">>, Params), 87 | Password = proplists:get_value(<<"password">>, Params), 88 | Tags = proplists:get_value(<<"tags">>, Params), 89 | return(case ?EMPTY(Username) orelse ?EMPTY(Password) of 90 | true -> {error, <<"Username or password undefined">>}; 91 | false -> emqx_dashboard_admin:add_user(Username, Password, Tags) 92 | end). 93 | 94 | list(_Bindings, _Params) -> 95 | return({ok, [row(User) || User <- emqx_dashboard_admin:all_users()]}). 96 | 97 | update(#{name := Username}, Params) -> 98 | Tags = proplists:get_value(<<"tags">>, Params), 99 | return(emqx_dashboard_admin:update_user(Username, Tags)). 100 | 101 | delete(#{name := <<"admin">>}, _Params) -> 102 | return({error, <<"Cannot delete admin">>}); 103 | 104 | delete(#{name := Username}, _Params) -> 105 | return(emqx_dashboard_admin:remove_user(Username)). 106 | 107 | row(#mqtt_admin{username = Username, tags = Tags}) -> 108 | #{username => Username, tags => Tags}. 109 | 110 | -------------------------------------------------------------------------------- /src/emqx_dashboard_app.erl: -------------------------------------------------------------------------------- 1 | %%-------------------------------------------------------------------- 2 | %% Copyright (c) 2020 EMQ Technologies Co., Ltd. All Rights Reserved. 3 | %% 4 | %% Licensed under the Apache License, Version 2.0 (the "License"); 5 | %% you may not use this file except in compliance with the License. 6 | %% You may obtain a copy of the License at 7 | %% 8 | %% http://www.apache.org/licenses/LICENSE-2.0 9 | %% 10 | %% Unless required by applicable law or agreed to in writing, software 11 | %% distributed under the License is distributed on an "AS IS" BASIS, 12 | %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | %% See the License for the specific language governing permissions and 14 | %% limitations under the License. 15 | %%-------------------------------------------------------------------- 16 | 17 | -module(emqx_dashboard_app). 18 | 19 | -behaviour(application). 20 | 21 | -emqx_plugin(?MODULE). 22 | 23 | -export([ start/2 24 | , stop/1 25 | ]). 26 | 27 | start(_StartType, _StartArgs) -> 28 | {ok, Sup} = emqx_dashboard_sup:start_link(), 29 | emqx_dashboard:start_listeners(), 30 | emqx_dashboard_cli:load(), 31 | {ok, Sup}. 32 | 33 | stop(_State) -> 34 | emqx_dashboard_cli:unload(), 35 | emqx_dashboard:stop_listeners(). 36 | -------------------------------------------------------------------------------- /src/emqx_dashboard_cli.erl: -------------------------------------------------------------------------------- 1 | %%-------------------------------------------------------------------- 2 | %% Copyright (c) 2020 EMQ Technologies Co., Ltd. All Rights Reserved. 3 | %% 4 | %% Licensed under the Apache License, Version 2.0 (the "License"); 5 | %% you may not use this file except in compliance with the License. 6 | %% You may obtain a copy of the License at 7 | %% 8 | %% http://www.apache.org/licenses/LICENSE-2.0 9 | %% 10 | %% Unless required by applicable law or agreed to in writing, software 11 | %% distributed under the License is distributed on an "AS IS" BASIS, 12 | %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | %% See the License for the specific language governing permissions and 14 | %% limitations under the License. 15 | %%-------------------------------------------------------------------- 16 | 17 | -module(emqx_dashboard_cli). 18 | 19 | -export([ load/0 20 | , admins/1 21 | , unload/0 22 | ]). 23 | 24 | load() -> 25 | emqx_ctl:register_command(admins, {?MODULE, admins}, []). 26 | 27 | admins(["add", Username, Password]) -> 28 | admins(["add", Username, Password, ""]); 29 | 30 | admins(["add", Username, Password, Tag]) -> 31 | case emqx_dashboard_admin:add_user(bin(Username), bin(Password), bin(Tag)) of 32 | ok -> 33 | emqx_ctl:print("ok~n"); 34 | {error, already_existed} -> 35 | emqx_ctl:print("Error: already existed~n"); 36 | {error, Reason} -> 37 | emqx_ctl:print("Error: ~p~n", [Reason]) 38 | end; 39 | 40 | admins(["passwd", Username, Password]) -> 41 | Status = emqx_dashboard_admin:change_password(bin(Username), bin(Password)), 42 | emqx_ctl:print("~p~n", [Status]); 43 | 44 | admins(["del", Username]) -> 45 | Status = emqx_dashboard_admin:remove_user(bin(Username)), 46 | emqx_ctl:print("~p~n", [Status]); 47 | 48 | admins(_) -> 49 | emqx_ctl:usage([{"admins add ", "Add dashboard user"}, 50 | {"admins passwd ", "Reset dashboard user password"}, 51 | {"admins del ", "Delete dashboard user" }]). 52 | 53 | unload() -> 54 | emqx_ctl:unregister_command(admins). 55 | 56 | bin(S) -> iolist_to_binary(S). 57 | -------------------------------------------------------------------------------- /src/emqx_dashboard_sup.erl: -------------------------------------------------------------------------------- 1 | %%-------------------------------------------------------------------- 2 | %% Copyright (c) 2020 EMQ Technologies Co., Ltd. All Rights Reserved. 3 | %% 4 | %% Licensed under the Apache License, Version 2.0 (the "License"); 5 | %% you may not use this file except in compliance with the License. 6 | %% You may obtain a copy of the License at 7 | %% 8 | %% http://www.apache.org/licenses/LICENSE-2.0 9 | %% 10 | %% Unless required by applicable law or agreed to in writing, software 11 | %% distributed under the License is distributed on an "AS IS" BASIS, 12 | %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | %% See the License for the specific language governing permissions and 14 | %% limitations under the License. 15 | %%-------------------------------------------------------------------- 16 | 17 | -module(emqx_dashboard_sup). 18 | 19 | -behaviour(supervisor). 20 | 21 | -export([start_link/0]). 22 | 23 | -export([init/1]). 24 | 25 | -define(CHILD(I), {I, {I, start_link, []}, permanent, 5000, worker, [I]}). 26 | 27 | start_link() -> 28 | supervisor:start_link({local, ?MODULE}, ?MODULE, []). 29 | 30 | init([]) -> 31 | {ok, { {one_for_all, 10, 100}, [?CHILD(emqx_dashboard_admin)] } }. 32 | 33 | -------------------------------------------------------------------------------- /test/.placeholder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/emqx-dashboard/69f0e1de3eb45517d0bbb22489433c307ac156a9/test/.placeholder -------------------------------------------------------------------------------- /test/emqx_dashboard_SUITE.erl: -------------------------------------------------------------------------------- 1 | %%-------------------------------------------------------------------- 2 | %% Copyright (c) 2020 EMQ Technologies Co., Ltd. All Rights Reserved. 3 | %% 4 | %% Licensed under the Apache License, Version 2.0 (the "License"); 5 | %% you may not use this file except in compliance with the License. 6 | %% You may obtain a copy of the License at 7 | %% 8 | %% http://www.apache.org/licenses/LICENSE-2.0 9 | %% 10 | %% Unless required by applicable law or agreed to in writing, software 11 | %% distributed under the License is distributed on an "AS IS" BASIS, 12 | %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | %% See the License for the specific language governing permissions and 14 | %% limitations under the License. 15 | %%-------------------------------------------------------------------- 16 | 17 | -module(emqx_dashboard_SUITE). 18 | 19 | -compile(export_all). 20 | 21 | -import(emqx_ct_http, 22 | [ request_api/3 23 | , request_api/5 24 | , get_http_data/1 25 | ]). 26 | 27 | -include_lib("eunit/include/eunit.hrl"). 28 | 29 | -include_lib("emqx/include/emqx.hrl"). 30 | 31 | -define(CONTENT_TYPE, "application/x-www-form-urlencoded"). 32 | 33 | -define(HOST, "http://127.0.0.1:18083/"). 34 | 35 | -define(API_VERSION, "v4"). 36 | 37 | -define(BASE_PATH, "api"). 38 | 39 | -define(OVERVIEWS, ['alarms/activated', 'alarms/deactivated', banned, brokers, stats, metrics, listeners, clients, subscriptions, routes, plugins]). 40 | 41 | all() -> 42 | [{group, overview}, 43 | {group, admins}, 44 | {group, rest}, 45 | {group, cli} 46 | ]. 47 | 48 | groups() -> 49 | [{overview, [sequence], [t_overview]}, 50 | {admins, [sequence], [t_admins_add_delete]}, 51 | {rest, [sequence], [t_rest_api]}, 52 | {cli, [sequence], [t_cli]} 53 | ]. 54 | 55 | init_per_suite(Config) -> 56 | emqx_ct_helpers:start_apps([emqx, emqx_management, emqx_dashboard]), 57 | Config. 58 | 59 | end_per_suite(_Config) -> 60 | emqx_ct_helpers:stop_apps([emqx_dashboard, emqx_management, emqx]), 61 | ekka_mnesia:ensure_stopped(). 62 | 63 | t_overview(_) -> 64 | [?assert(request_dashboard(get, api_path(erlang:atom_to_list(Overview)), auth_header_()))|| Overview <- ?OVERVIEWS]. 65 | 66 | t_admins_add_delete(_) -> 67 | ok = emqx_dashboard_admin:add_user(<<"username">>, <<"password">>, <<"tag">>), 68 | ok = emqx_dashboard_admin:add_user(<<"username1">>, <<"password1">>, <<"tag1">>), 69 | Admins = emqx_dashboard_admin:all_users(), 70 | ?assertEqual(3, length(Admins)), 71 | ok = emqx_dashboard_admin:remove_user(<<"username1">>), 72 | Users = emqx_dashboard_admin:all_users(), 73 | ?assertEqual(2, length(Users)), 74 | ok = emqx_dashboard_admin:change_password(<<"username">>, <<"password">>, <<"pwd">>), 75 | timer:sleep(10), 76 | ?assert(request_dashboard(get, api_path("brokers"), auth_header_("username", "pwd"))), 77 | 78 | ok = emqx_dashboard_admin:remove_user(<<"username">>), 79 | ?assertNotEqual(true, request_dashboard(get, api_path("brokers"), auth_header_("username", "pwd"))). 80 | 81 | t_rest_api(_Config) -> 82 | {ok, Res0} = http_get("users"), 83 | 84 | ?assertEqual([#{<<"username">> => <<"admin">>, 85 | <<"tags">> => <<"administrator">>}], get_http_data(Res0)), 86 | 87 | AssertSuccess = fun({ok, Res}) -> 88 | ?assertEqual(#{<<"code">> => 0}, json(Res)) 89 | end, 90 | [AssertSuccess(R) 91 | || R <- [ http_put("users/admin", #{<<"tags">> => <<"a_new_tag">>}) 92 | , http_post("users", #{<<"username">> => <<"usera">>, <<"password">> => <<"passwd">>}) 93 | , http_post("auth", #{<<"username">> => <<"usera">>, <<"password">> => <<"passwd">>}) 94 | , http_delete("users/usera") 95 | , http_put("change_pwd/admin", #{<<"old_pwd">> => <<"public">>, <<"new_pwd">> => <<"newpwd">>}) 96 | , http_post("auth", #{<<"username">> => <<"admin">>, <<"password">> => <<"newpwd">>}) 97 | ]], 98 | ok. 99 | 100 | t_cli(_Config) -> 101 | [mnesia:dirty_delete({mqtt_admin, Admin}) || Admin <- mnesia:dirty_all_keys(mqtt_admin)], 102 | emqx_dashboard_cli:admins(["add", "username", "password"]), 103 | [{mqtt_admin, <<"username">>, <>, _}] = 104 | emqx_dashboard_admin:lookup_user(<<"username">>), 105 | ?assertEqual(Hash, erlang:md5(<>/binary>>)), 106 | emqx_dashboard_cli:admins(["passwd", "username", "newpassword"]), 107 | [{mqtt_admin, <<"username">>, <>, _}] = 108 | emqx_dashboard_admin:lookup_user(<<"username">>), 109 | ?assertEqual(Hash1, erlang:md5(<>/binary>>)), 110 | emqx_dashboard_cli:admins(["del", "username"]), 111 | [] = emqx_dashboard_admin:lookup_user(<<"username">>), 112 | emqx_dashboard_cli:admins(["add", "admin1", "pass1"]), 113 | emqx_dashboard_cli:admins(["add", "admin2", "passw2"]), 114 | AdminList = emqx_dashboard_admin:all_users(), 115 | ?assertEqual(2, length(AdminList)). 116 | 117 | %%------------------------------------------------------------------------------ 118 | %% Internal functions 119 | %%------------------------------------------------------------------------------ 120 | 121 | http_get(Path) -> 122 | request_api(get, api_path(Path), auth_header_()). 123 | 124 | http_delete(Path) -> 125 | request_api(delete, api_path(Path), auth_header_()). 126 | 127 | http_post(Path, Body) -> 128 | request_api(post, api_path(Path), [], auth_header_(), Body). 129 | 130 | http_put(Path, Body) -> 131 | request_api(put, api_path(Path), [], auth_header_(), Body). 132 | 133 | request_dashboard(Method, Url, Auth) -> 134 | Request = {Url, [Auth]}, 135 | do_request_dashboard(Method, Request). 136 | request_dashboard(Method, Url, QueryParams, Auth) -> 137 | Request = {Url ++ "?" ++ QueryParams, [Auth]}, 138 | do_request_dashboard(Method, Request). 139 | do_request_dashboard(Method, Request)-> 140 | ct:pal("Method: ~p, Request: ~p", [Method, Request]), 141 | case httpc:request(Method, Request, [], []) of 142 | {error, socket_closed_remotely} -> 143 | {error, socket_closed_remotely}; 144 | {ok, {{"HTTP/1.1", 200, _}, _, _Return} } -> 145 | true; 146 | {ok, {Reason, _, _}} -> 147 | {error, Reason} 148 | end. 149 | 150 | auth_header_() -> 151 | auth_header_("admin", "public"). 152 | 153 | auth_header_(User, Pass) -> 154 | Encoded = base64:encode_to_string(lists:append([User,":",Pass])), 155 | {"Authorization","Basic " ++ Encoded}. 156 | 157 | api_path(Path) -> 158 | ?HOST ++ filename:join([?BASE_PATH, ?API_VERSION, Path]). 159 | 160 | json(Data) -> 161 | {ok, Jsx} = emqx_json:safe_decode(Data, [return_maps]), Jsx. 162 | 163 | --------------------------------------------------------------------------------