Просмотр исходного кода

style: reformat some modules in emqx_management app

Zaiming (Stone) Shi 3 лет назад
Родитель
Сommit
628f0bf579

+ 25 - 21
apps/emqx_management/src/emqx_mgmt_api_sys.erl

@@ -22,14 +22,14 @@
 -include_lib("typerefl/include/types.hrl").
 -include_lib("typerefl/include/types.hrl").
 
 
 %% API
 %% API
--export([ api_spec/0
-        , paths/0
-        , schema/1
-        , namespace/0
-        ]).
+-export([
+    api_spec/0,
+    paths/0,
+    schema/1,
+    namespace/0
+]).
 
 
--export([ sys/2
-        ]).
+-export([sys/2]).
 
 
 -define(TAGS, [<<"sys">>]).
 -define(TAGS, [<<"sys">>]).
 
 
@@ -61,8 +61,8 @@ schema("/mqtt/sys_topics") ->
                 responses =>
                 responses =>
                     #{
                     #{
                         200 => schema_sys_topics()
                         200 => schema_sys_topics()
-                     }
-             },
+                    }
+            },
         put =>
         put =>
             #{
             #{
                 tags => ?TAGS,
                 tags => ?TAGS,
@@ -71,20 +71,24 @@ schema("/mqtt/sys_topics") ->
                 responses =>
                 responses =>
                     #{
                     #{
                         200 => schema_sys_topics()
                         200 => schema_sys_topics()
-                     }
-             }
-     }.
+                    }
+            }
+    }.
 
 
 schema_sys_topics() ->
 schema_sys_topics() ->
     emqx_dashboard_swagger:schema_with_example(
     emqx_dashboard_swagger:schema_with_example(
-      hoconsc:ref(emqx_schema, "sys_topics"), example_sys_topics()).
+        hoconsc:ref(emqx_schema, "sys_topics"), example_sys_topics()
+    ).
 
 
 example_sys_topics() ->
 example_sys_topics() ->
-    #{<<"sys_event_messages">> =>
-      #{<<"client_connected">> => true,
-        <<"client_disconnected">> => true,
-        <<"client_subscribed">> => false,
-        <<"client_unsubscribed">> => false},
-      <<"sys_heartbeat_interval">> => <<"30s">>,
-      <<"sys_msg_interval">> => <<"1m">>
-     }.
+    #{
+        <<"sys_event_messages">> =>
+            #{
+                <<"client_connected">> => true,
+                <<"client_disconnected">> => true,
+                <<"client_subscribed">> => false,
+                <<"client_unsubscribed">> => false
+            },
+        <<"sys_heartbeat_interval">> => <<"30s">>,
+        <<"sys_msg_interval">> => <<"1m">>
+    }.

+ 20 - 15
apps/emqx_management/test/emqx_mgmt_api_sys_SUITE.erl

@@ -33,22 +33,27 @@ end_per_suite(_) ->
 t_get_put(_) ->
 t_get_put(_) ->
     {ok, Default} = get_sys_topics_config(),
     {ok, Default} = get_sys_topics_config(),
     ?assertEqual(
     ?assertEqual(
-       #{<<"sys_event_messages">> =>
-         #{<<"client_connected">> => true,
-           <<"client_disconnected">> => true,
-           <<"client_subscribed">> => false,
-           <<"client_unsubscribed">> => false
-          },
-         <<"sys_heartbeat_interval">> => <<"30s">>,
-         <<"sys_msg_interval">> => <<"1m">>}, Default),
+        #{
+            <<"sys_event_messages">> =>
+                #{
+                    <<"client_connected">> => true,
+                    <<"client_disconnected">> => true,
+                    <<"client_subscribed">> => false,
+                    <<"client_unsubscribed">> => false
+                },
+            <<"sys_heartbeat_interval">> => <<"30s">>,
+            <<"sys_msg_interval">> => <<"1m">>
+        },
+        Default
+    ),
 
 
-   NConfig = Default#{
-               <<"sys_msg_interval">> => <<"4m">>,
-               <<"sys_event_messages">> => #{<<"client_subscribed">> => false}
-              },
-   {ok, ConfigResp} = put_sys_topics_config(NConfig),
-   ?assertEqual(NConfig, ConfigResp),
-   {ok, Default} = put_sys_topics_config(Default).
+    NConfig = Default#{
+        <<"sys_msg_interval">> => <<"4m">>,
+        <<"sys_event_messages">> => #{<<"client_subscribed">> => false}
+    },
+    {ok, ConfigResp} = put_sys_topics_config(NConfig),
+    ?assertEqual(NConfig, ConfigResp),
+    {ok, Default} = put_sys_topics_config(Default).
 
 
 get_sys_topics_config() ->
 get_sys_topics_config() ->
     Path = emqx_mgmt_api_test_util:api_path(["mqtt", "sys_topics"]),
     Path = emqx_mgmt_api_test_util:api_path(["mqtt", "sys_topics"]),