Skip to content

Commit a5435bf

Browse files
committed
chore: remove pgexplain tips
1 parent 82a6edd commit a5435bf

File tree

15 files changed

+9
-482
lines changed

15 files changed

+9
-482
lines changed

Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ RUN apk add --no-cache bash postgresql-client
55
WORKDIR /home/
66

77
COPY ./bin/joe ./bin/joe
8-
COPY ./configs/explain ./explain
98

109
EXPOSE $SERVER_PORT
1110

Dockerfile.ee

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ RUN apk add --no-cache bash postgresql-client
55
WORKDIR /home/
66

77
COPY ./bin/joe-ee ./bin/joe
8-
COPY ./configs/explain ./explain
98

109
EXPOSE $SERVER_PORT
1110

cmd/joe/main.go

-8
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,6 @@ func loadAppConfig() (*config.Config, error) {
103103

104104
botCfg.Enterprise = enterpriseOptions
105105

106-
// Load and validate an explain configuration file.
107-
explainConfig, err := config.LoadExplainConfig()
108-
if err != nil {
109-
return nil, errors.Wrap(err, "failed to load an explain config")
110-
}
111-
112-
botCfg.Explain = explainConfig
113-
114106
return &botCfg, nil
115107
}
116108

configs/explain/explain.yaml

-37
This file was deleted.

pkg/bot/command/explain.go

+2-28
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const (
4343

4444
// Explain runs an explain query.
4545
func Explain(ctx context.Context, msgSvc connection.Messenger, command *platform.Command, msg *models.Message,
46-
explainConfig pgexplain.ExplainConfig, session usermanager.UserSession) error {
46+
session usermanager.UserSession) error {
4747
if command.Query == "" {
4848
return errors.New(MsgExplainOptionReq)
4949
}
@@ -100,7 +100,7 @@ func Explain(ctx context.Context, msgSvc connection.Messenger, command *platform
100100
command.PlanExecJSON = explainAnalyze
101101

102102
// Visualization.
103-
explain, err := pgexplain.NewExplain(explainAnalyze, explainConfig)
103+
explain, err := pgexplain.NewExplain(explainAnalyze)
104104
if err != nil {
105105
log.Err("Explain parsing: ", err)
106106

@@ -156,32 +156,6 @@ func Explain(ctx context.Context, msgSvc connection.Messenger, command *platform
156156
return err
157157
}
158158

159-
// Recommendations.
160-
tips, err := explain.GetTips()
161-
if err != nil {
162-
log.Err("Recommendations: ", err)
163-
return err
164-
}
165-
166-
recommends := ""
167-
if len(tips) == 0 {
168-
recommends += ":white_check_mark: Looks good"
169-
} else {
170-
for _, tip := range tips {
171-
recommends += fmt.Sprintf(
172-
":exclamation: %s – %s <%s|Show details>\n", tip.Name,
173-
tip.Description, tip.DetailsUrl)
174-
}
175-
}
176-
177-
command.Recommendations = recommends
178-
179-
msg.AppendText("*Recommendations:*\n" + recommends)
180-
if err = msgSvc.UpdateText(msg); err != nil {
181-
log.Err("Show recommendations: ", err)
182-
return err
183-
}
184-
185159
// Summary.
186160
stats := explain.RenderStats()
187161
command.Stats = stats

pkg/config/config.go

-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"time"
1010

1111
"gitlab.com/postgres-ai/joe/features/definition"
12-
"gitlab.com/postgres-ai/joe/pkg/pgexplain"
1312
)
1413

1514
const (
@@ -32,7 +31,6 @@ type Config struct {
3231
Platform Platform `yaml:"platform"`
3332
Registration Registration `yaml:"registration"`
3433
ChannelMapping *ChannelMapping `yaml:"channelMapping"`
35-
Explain pgexplain.ExplainConfig `yaml:"-"`
3634
Enterprise definition.EnterpriseOptions `yaml:"-"`
3735
}
3836

pkg/config/pgexplain.go

-67
This file was deleted.

pkg/connection/slack/assistant.go

-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ func (a *Assistant) buildMessageProcessor(channelID string, dbLabInstance *dblab
124124
processingCfg := msgproc.ProcessingConfig{
125125
App: a.appCfg.App,
126126
Platform: a.appCfg.Platform,
127-
Explain: a.appCfg.Explain,
128127
DBLab: dbLabInstance.Config(),
129128
EntOpts: a.appCfg.Enterprise,
130129
Project: a.appCfg.Platform.Project,

pkg/connection/slackrtm/assistant.go

-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ func (a *Assistant) buildMessageProcessor(channelID string, dbLabInstance *dblab
125125
processingCfg := msgproc.ProcessingConfig{
126126
App: a.appCfg.App,
127127
Platform: a.appCfg.Platform,
128-
Explain: a.appCfg.Explain,
129128
DBLab: dbLabInstance.Config(),
130129
EntOpts: a.appCfg.Enterprise,
131130
Project: a.appCfg.Platform.Project,

pkg/connection/slacksm/assistant.go

-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ func (a *Assistant) buildMessageProcessor(channelID string, dbLabInstance *dblab
142142
processingCfg := msgproc.ProcessingConfig{
143143
App: a.appCfg.App,
144144
Platform: a.appCfg.Platform,
145-
Explain: a.appCfg.Explain,
146145
DBLab: dbLabInstance.Config(),
147146
EntOpts: a.appCfg.Enterprise,
148147
Project: a.appCfg.Platform.Project,

pkg/connection/webui/assistant.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ func (a *Assistant) buildMessageProcessor(channelID string, dbLabInstance *dblab
151151
processingCfg := msgproc.ProcessingConfig{
152152
App: a.appCfg.App,
153153
Platform: a.appCfg.Platform,
154-
Explain: a.appCfg.Explain,
155154
DBLab: dbLabInstance.Config(),
156155
EntOpts: a.appCfg.Enterprise,
157156
Project: a.appCfg.Platform.Project,
@@ -247,7 +246,7 @@ func (a *Assistant) verificationHandler(w http.ResponseWriter, r *http.Request)
247246
}
248247
}
249248

250-
func (a *Assistant) channelsHandler(w http.ResponseWriter, r *http.Request) {
249+
func (a *Assistant) channelsHandler(w http.ResponseWriter, _ *http.Request) {
251250
channels := []config.Channel{}
252251

253252
w.Header().Set("Content-Type", "application/json; charset=utf-8")

pkg/connection/webui/messenger.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,6 @@ func (m Messenger) AddArtifact(title, content, _, messageID string) (artifactLin
9999
}
100100

101101
// DownloadArtifact downloads snippets from a communication channel.
102-
func (m Messenger) DownloadArtifact(artifactURL string) (response []byte, err error) {
102+
func (m Messenger) DownloadArtifact(_ string) (response []byte, err error) {
103103
panic("artifact downloading is not supported")
104104
}

0 commit comments

Comments
 (0)