diff --git a/apps/emqx_gateway/i18n/emqx_gateway_api_clients_i18n.conf b/apps/emqx_gateway/i18n/emqx_gateway_api_clients_i18n.conf index 8da672586..1e6f575c3 100644 --- a/apps/emqx_gateway/i18n/emqx_gateway_api_clients_i18n.conf +++ b/apps/emqx_gateway/i18n/emqx_gateway_api_clients_i18n.conf @@ -245,6 +245,13 @@ emqx_gateway_api_clients { } } + mountpoint { + desc { + en: """Topic mountpoint""" + zh: """主题固定前缀""" + } + } + proto_name { desc { en: """Client protocol name""" diff --git a/apps/emqx_gateway/src/emqx_gateway_api_clients.erl b/apps/emqx_gateway/src/emqx_gateway_api_clients.erl index af6393a27..ac0e72c83 100644 --- a/apps/emqx_gateway/src/emqx_gateway_api_clients.erl +++ b/apps/emqx_gateway/src/emqx_gateway_api_clients.erl @@ -174,9 +174,7 @@ clients_insta(delete, #{ {204} end). -%% FIXME: -%% List the subscription without mountpoint, but has SubOpts, -%% for example, share group ... +%% List the established subscriptions with mountpoint subscriptions(get, #{ bindings := #{ name := Name0, @@ -189,7 +187,7 @@ subscriptions(get, #{ {error, not_found} -> return_http_error(404, "client process not found"); {error, Reason} -> - return_http_error(500, Reason); + return_http_error(400, Reason); {ok, Subs} -> {200, Subs} end @@ -216,7 +214,7 @@ subscriptions(post, #{ {error, not_found} -> return_http_error(404, "client process not found"); {error, Reason} -> - return_http_error(500, Reason); + return_http_error(400, Reason); {ok, {NTopic, NSubOpts}} -> {201, maps:merge(NSubOpts, #{topic => NTopic})} end @@ -368,6 +366,7 @@ format_channel_info({_, Infos, Stats} = R) -> {node, ClientInfo, Node}, {clientid, ClientInfo}, {username, ClientInfo}, + {mountpoint, ClientInfo}, {proto_name, ConnInfo}, {proto_ver, ConnInfo}, {ip_address, {peername, ConnInfo, fun peer_to_binary_addr/1}}, @@ -813,6 +812,11 @@ common_client_props() -> binary(), #{desc => ?DESC(username)} )}, + {mountpoint, + mk( + binary(), + #{desc => ?DESC(mountpoint)} + )}, {proto_name, mk( binary(), diff --git a/apps/emqx_management/src/emqx_mgmt_api_clients.erl b/apps/emqx_management/src/emqx_mgmt_api_clients.erl index 033373655..c7ceb26d5 100644 --- a/apps/emqx_management/src/emqx_mgmt_api_clients.erl +++ b/apps/emqx_management/src/emqx_mgmt_api_clients.erl @@ -492,6 +492,7 @@ fields(client) -> " Maximum number of subscriptions allowed by this client">> })}, {username, hoconsc:mk(binary(), #{desc => <<"User name of client when connecting">>})}, + {mountpoint, hoconsc:mk(binary(), #{desc => <<"Topic mountpoint">>})}, {will_msg, hoconsc:mk(binary(), #{desc => <<"Client will message">>})}, {zone, hoconsc:mk(binary(), #{ @@ -849,7 +850,6 @@ format_channel_info({_, ClientInfo0, ClientStats}) -> is_superuser, sockport, anonymous, - mountpoint, socktype, active_n, await_rel_timeout,