Skip to content

Commit

Permalink
fix(ui): module details page does not load when the module has only p…
Browse files Browse the repository at this point in the history
…re-release versions

Merge pull request #73 from CrowdStrike/wip-address-ux-issues
  • Loading branch information
Dylan Bourque authored Mar 28, 2023
2 parents faaf5d7 + daa1902 commit e57d754
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
29 changes: 13 additions & 16 deletions debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,27 +59,24 @@ func debugLog(msg string, kvs ...any) {
}()

ctx := context.Background()
if len(kvs) == 0 {
logger.Log(ctx, slog.LevelDebug, msg)
return
}
var pcs [1]uintptr
runtime.Callers(2, pcs[:])
rec := slog.NewRecord(time.Now().UTC(), slog.LevelDebug, msg, pcs[0])

attrs := make([]slog.Attr, 0, len(kvs)/2)
for i := 0; i < len(kvs); i += 2 {
k, ok := kvs[i].(string)
if !ok {
k = fmt.Sprintf("%v", kvs[i])
if len(kvs) > 0 {
attrs := make([]slog.Attr, 0, len(kvs)/2)
for i := 0; i < len(kvs); i += 2 {
k, ok := kvs[i].(string)
if !ok {
k = fmt.Sprintf("%v", kvs[i])
}
attrs = append(attrs, slog.Any(k, kvs[i+1]))
}
attrs = append(attrs, slog.Any(k, kvs[i+1]))
rec.AddAttrs(attrs...)
}
var pcs [1]uintptr
runtime.Callers(1, pcs[:])
rec := slog.NewRecord(time.Now(), slog.LevelDebug, msg, pcs[0])
rec.AddAttrs(attrs...)

// TODO: what should we do if this call to logger.Handler().Handle() fails?
_ = logger.Handler().Handle(ctx, rec)

_ = attrs[len(kvs)]
}

func inK8S() bool {
Expand Down
2 changes: 1 addition & 1 deletion internal/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func runServer(opts ...serverOption) error {
if err != nil {
return fmt.Errorf("could not connect to the database: %w", err)
}
debugLog("connected to the database", "connectionString", connStr)
debugLog("connected to the database", "addr", conf.dbAddr, "database", conf.dbName, "user", conf.dbUser)

// spin up gRPC server
grpcOpts := []grpc.ServerOption{
Expand Down
2 changes: 1 addition & 1 deletion internal/server/web/js/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const listModules = async () => {

const getModuleVersions = (module) => {
return fetch(
`${apiBase}/module-versions?module_name=${module}&version_option=all`
`${apiBase}/module-versions?module_name=${module}&version_option=all&include_prerelease=true`
)
.then((resp) => resp.json())
.then((data) => {
Expand Down

0 comments on commit e57d754

Please sign in to comment.