From 1c92ba8af8c0b9a4f4903d8e3558bc990e7f4cea Mon Sep 17 00:00:00 2001 From: kshitij katiyar <90389917+Kshitij-Katiyar@users.noreply.github.com> Date: Mon, 9 Sep 2024 18:01:22 +0530 Subject: [PATCH] [MM-673]: Updated the instance connect autocomplete data to show alias and url both (#1109) * [MM-673]: Updated the instance connect autocomplete data to show alias and url both * [MM-673]: Added jira instance URL to helpText * [MM-673]: Added alias based autocomplete in uninstall command --- server/command.go | 4 ++-- server/instances.go | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/server/command.go b/server/command.go index d82cc6272..9f877e96b 100644 --- a/server/command.go +++ b/server/command.go @@ -188,7 +188,7 @@ func createInstanceCommand(optInstance bool) *model.AutocompleteData { uninstall := model.NewAutocompleteData( "uninstall", "[server|cloud-oauth] [URL]", "Disconnect Mattermost from a Jira instance") uninstall.AddStaticListArgument("Jira type: server, cloud or cloud-oauth", true, jiraTypes) - uninstall.AddDynamicListArgument("Jira instance", makeAutocompleteRoute(routeAutocompleteInstalledInstance), true) + uninstall.AddDynamicListArgument("Jira instance", makeAutocompleteRoute(routeAutocompleteInstalledInstanceWithAlias), true) uninstall.RoleID = model.SystemAdminRoleId list := model.NewAutocompleteData( @@ -229,7 +229,7 @@ func withParamIssueKey(cmd *model.AutocompleteData) { func createConnectCommand() *model.AutocompleteData { connect := model.NewAutocompleteData( "connect", "", "Connect your Mattermost account to your Jira account") - connect.AddDynamicListArgument("Jira URL", makeAutocompleteRoute(routeAutocompleteConnect), false) + connect.AddDynamicListArgument("Jira URL", makeAutocompleteRoute(routeAutocompleteInstalledInstanceWithAlias), false) return connect } diff --git a/server/instances.go b/server/instances.go index c85e669a8..d41efa03b 100644 --- a/server/instances.go +++ b/server/instances.go @@ -418,11 +418,14 @@ func (p *Plugin) httpAutocompleteInstalledInstanceWithAlias(w http.ResponseWrite for _, instanceID := range info.Instances.IDs() { item := instances.getAlias(instanceID) + helpText := string(instanceID) if item == "" { item = string(instanceID) + helpText = "" } out = append(out, model.AutocompleteListItem{ - Item: item, + Item: item, + HelpText: helpText, }) } return respondJSON(w, out)