Skip to content

Commit

Permalink
[MM-673]: Updated the instance connect autocomplete data to show alia…
Browse files Browse the repository at this point in the history
…s 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
  • Loading branch information
Kshitij-Katiyar authored Sep 9, 2024
1 parent 9fef9b1 commit 1c92ba8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions server/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
}

Expand Down
5 changes: 4 additions & 1 deletion server/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1c92ba8

Please sign in to comment.