Provisioning: Show progress more often (#101128)

* show progress bar earlier

* show progress bar earlier

* update wording to be less specific
This commit is contained in:
Ryan McKinley authored and GitHub committed 2025-02-21 13:04:43 +01:00
1 parent cfa4923fca
commit 6e7fb03c3a
5 files changed
+31 -26

No files matched your search

+1 -2
View File
@@ -5908,8 +5908,7 @@ exports[`better eslint`] = {
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "6"],
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "7"],
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "8"],
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "9"],
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "10"]
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "9"]
],
"public/app/features/provisioning/Wizard/ProvisioningWizard.tsx:5381": [
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "0"]
@@ -1,10 +1,11 @@
package migrate
import (
"bufio"
"context"
"errors"
"fmt"
"os"
"io"
"github.com/grafana/grafana-app-sdk/logging"
"github.com/grafana/grafana/pkg/apimachinery/utils"
@@ -88,12 +89,21 @@ func (w *MigrationWorker) Process(ctx context.Context, repo repository.Repositor
buffered *gogit.GoGitRepo
)
progress.SetTotal(10) // will show a progress bar
if repo.Config().Spec.GitHub != nil {
progress.SetMessage("clone target")
progress.SetMessage("clone " + repo.Config().Spec.GitHub.URL)
reader, writer := io.Pipe()
go func() {
scanner := bufio.NewScanner(reader)
for scanner.Scan() {
progress.SetMessage(scanner.Text())
}
}()
buffered, err = gogit.Clone(ctx, repo.Config(), gogit.GoGitCloneOptions{
Root: w.clonedir,
SingleCommitBeforePush: !options.History,
}, w.secrets, os.Stdout)
}, w.secrets, writer)
if err != nil {
return fmt.Errorf("unable to clone target: %w", err)
}
@@ -132,7 +142,7 @@ func (w *MigrationWorker) Process(ctx context.Context, repo repository.Repositor
}
if options.History {
progress.SetMessage("load users")
progress.SetMessage("loading users")
err = worker.loadUsers(ctx)
if err != nil {
return fmt.Errorf("error loading users: %w", err)
@@ -140,21 +150,29 @@ func (w *MigrationWorker) Process(ctx context.Context, repo repository.Repositor
}
// Load and write all folders
progress.SetMessage("start folder export")
progress.SetMessage("exporting folders")
err = worker.loadFolders(ctx)
if err != nil {
return err
}
progress.SetMessage("start resource export")
progress.SetMessage("exporting resources")
err = worker.loadResources(ctx)
if err != nil {
return err
}
if buffered != nil {
progress.SetMessage("push changes")
if err := buffered.Push(ctx, os.Stdout); err != nil {
progress.SetMessage("pushing changes")
reader, writer := io.Pipe()
go func() {
scanner := bufio.NewScanner(reader)
for scanner.Scan() {
progress.SetMessage(scanner.Text())
}
}()
if err := buffered.Push(ctx, writer); err != nil {
return fmt.Errorf("error pushing changes: %w", err)
}
}
@@ -53,7 +53,7 @@ type jobProgressRecorder struct {
func newJobProgressRecorder(progressFn progressFn) JobProgressRecorder {
return &jobProgressRecorder{
started: time.Now(),
progressFn: maybeNotifyProgress(15*time.Second, progressFn),
progressFn: maybeNotifyProgress(5*time.Second, progressFn),
summaries: make(map[string]*provisioning.JobResourceSummary),
}
}
@@ -15,9 +15,8 @@ export default function OnboardingPage() {
<Page.Contents>
<SetupWarnings />
<Alert severity="info" title="Setting up this connection could cause a temporary outage">
When you connect your whole instance, depending on its size, the setup might make the dashboard unavailable to
users for up to 30 minutes. We recommend warning your users before starting the process. You can use the
announcement banner or your preferred channels.
When you connect your whole instance, dashboards will be unavailable while running the migration. We recommend
warning your users before starting the process.
</Alert>
<EmptyState
variant="call-to-action"
@@ -42,21 +42,10 @@ export function MigrateStep({ onMigrationStatusChange }: MigrateStepProps) {
}
};
const onAbort = () => {
migrateQuery.reset();
setShowMigrateStatus(false);
onMigrationStatusChange(false);
};
if (showMigrateStatus && migrateName) {
return (
<Stack direction="column" gap={2}>
<JobStatus name={migrateName} />
<Stack gap={2}>
<Button variant="secondary" onClick={onAbort}>
Abort migration
</Button>
</Stack>
</Stack>
);
}
@@ -70,7 +59,7 @@ export function MigrateStep({ onMigrationStatusChange }: MigrateStepProps) {
</Text>
<Alert severity="info" title="Note">
Dashboards app/Grafana will be unavailable when starting this process.
Dashboards will be unavailable while running this process.
</Alert>
{Boolean(stats.length) && (