Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quality of Life improvements to local development dashboard #1014

Merged
merged 4 commits into from
Jan 25, 2024

Conversation

DomBlack
Copy link
Contributor

This PR adds the capability to view all Encore apps via the local dashboard, regardless of if they are currently running or not, as well as several other UI improvements to the dashboard;

  • request logs are now displayed when an API call is made
  • You get notified when the app is compiling
  • You get notified when the app has just restarted (due to a hot-reload)
  • You get notified of any compile errors and what they are

Offline apps are greyed out on lists, but can still be navigated

Screenshot 2024-01-25 at 14 05 04

image

The API explorer now shows logs which were emitted during the API call

image

The dashboard now tells you when the app is compiling or just freshly restarted

Screenshot 2024-01-25 at 14 14 22

image

Compile errors are now shown on the dashboard

image

This commit modifies the daemon to cache metadata for apps on the filesystem,
this then allows the local dev dash to access this metadata without having to
have the app running via `encore run`.

This commit then tidies up a bunch of code around the dev dash API to
standardise the status response allowing us to make much faster updates
in the dev dash relating to the status of the app.

Finnally I've added the ability for the dev dash to pass a correlation id
to the daemon when it makes an api-call, allowing the dev dash to filter
for logs relating to the request it made.
@encore-cla
Copy link

encore-cla bot commented Jan 25, 2024

All committers have signed the CLA.

@DomBlack DomBlack requested a review from eandre January 25, 2024 14:19
@DomBlack DomBlack marked this pull request as ready for review January 25, 2024 14:19
cli/daemon/common.go Outdated Show resolved Hide resolved
internal/conf/conf.go Outdated Show resolved Hide resolved
cli/daemon/common.go Outdated Show resolved Hide resolved
cli/daemon/common.go Outdated Show resolved Hide resolved
cli/daemon/common.go Outdated Show resolved Hide resolved
cli/daemon/common.go Outdated Show resolved Hide resolved
Copy link

github-actions bot commented Jan 25, 2024

Test Results

742 tests  ±0   739 ✅ ±0   3m 26s ⏱️ - 11m 43s
227 suites ±0     3 💤 ±0 
  2 files   ±0     0 ❌ ±0 

Results for commit c4be165. ± Comparison against base commit 7fe5135.

♻️ This comment has been updated with latest results.

cli/daemon/apps/apps.go Outdated Show resolved Hide resolved
name = filepath.Base(r.App.Root())

// Load all the apps we know about
allApp, err := h.apps.List()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we ever delete from this list? Like if the user deletes the directory? We probably should

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we do already do that:

// List lists all known apps.
func (mgr *Manager) List() ([]*Instance, error) {
	roots, err := mgr.listRoots()
	if err != nil {
		return nil, err
	}

	var apps []*Instance
	for _, root := range roots {
		app, err := mgr.resolve(root)
		if errors.Is(err, fs.ErrNotExist) {
			log.Debug().Str("root", root).Msg("app no longer exists, skipping")
			// Delete the
			_, _ = mgr.db.Exec(`DELETE FROM app WHERE root = ?`, root)
			continue
		} else if err != nil {
			log.Error().Err(err).Str("root", root).Msg("unable to resolve app")
			continue
		}
		apps = append(apps, app)
	}

	return apps, nil
}

@DomBlack DomBlack requested a review from eandre January 25, 2024 15:19
eandre
eandre previously approved these changes Jan 25, 2024
eandre
eandre previously approved these changes Jan 25, 2024
@DomBlack DomBlack force-pushed the enc-2019-support-app-offline-mode-for-dev-dash branch from 9ea1b14 to c4be165 Compare January 25, 2024 15:37
@DomBlack DomBlack merged commit c29d3e5 into main Jan 25, 2024
5 checks passed
@DomBlack DomBlack deleted the enc-2019-support-app-offline-mode-for-dev-dash branch January 25, 2024 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants