From 9948fdab712d23f1d0e0fae1bcdad1d55bcebd1e Mon Sep 17 00:00:00 2001 From: Francesco Siddi Date: Mon, 25 Jul 2022 16:15:08 +0200 Subject: [PATCH] Rename First Time Wizard to Setup Assistant This commit does not introduce functional changes, besides renaming every mention of 'wizard' with 'setup assistant'. In order to run the manager setup assistant use: ./flamenco-manager -setup-assistant The change was introduced to favor more neutral and descriptive working for this functionality. Thanks to Sybren for helping to get this done! --- cmd/flamenco-manager/main.go | 18 +++++------ internal/manager/api_impl/interfaces.go | 2 +- internal/manager/api_impl/meta.go | 30 +++++++++---------- internal/manager/api_impl/meta_test.go | 12 ++++---- internal/manager/config/defaults.go | 2 +- ...FirstTimeWizard.vue => SetupAssistant.vue} | 2 +- web/app/src/main.js | 14 ++++----- ...irst-time-wizard.js => setup-assistant.js} | 2 +- ...irst-time-wizard.js => setup-assistant.js} | 6 ++-- ...eWizardView.vue => SetupAssistantView.vue} | 18 +++++------ web/web_app.go | 2 +- 11 files changed, 54 insertions(+), 54 deletions(-) rename web/app/src/{FirstTimeWizard.vue => SetupAssistant.vue} (97%) rename web/app/src/router/{first-time-wizard.js => setup-assistant.js} (83%) rename web/app/src/{first-time-wizard.js => setup-assistant.js} (82%) rename web/app/src/views/{FirstTimeWizardView.vue => SetupAssistantView.vue} (97%) diff --git a/cmd/flamenco-manager/main.go b/cmd/flamenco-manager/main.go index 1c6eea27..ed1e74e2 100644 --- a/cmd/flamenco-manager/main.go +++ b/cmd/flamenco-manager/main.go @@ -54,11 +54,11 @@ import ( ) var cliArgs struct { - version bool - writeConfig bool - delayResponses bool - firstTimeWizard bool - pprof bool + version bool + writeConfig bool + delayResponses bool + setupAssistant bool + pprof bool } const ( @@ -86,9 +86,9 @@ func main() { for startFlamenco { startFlamenco = runFlamencoManager() - // After the first run, the first-time wizard should not be forced any more. + // After the first run, the setup assistant should not be forced any more. // If the configuration is still incomplete it can still auto-trigger. - cliArgs.firstTimeWizard = false + cliArgs.setupAssistant = false if startFlamenco { log.Info(). @@ -113,7 +113,7 @@ func runFlamencoManager() bool { log.Error().Err(err).Msg("loading configuration") } - if cliArgs.firstTimeWizard { + if cliArgs.setupAssistant { configService.ForceFirstRun() } isFirstRun, err := configService.IsFirstRun() @@ -513,7 +513,7 @@ func parseCliArgs() { flag.BoolVar(&cliArgs.writeConfig, "write-config", false, "Writes configuration to flamenco-manager.yaml, then exits.") flag.BoolVar(&cliArgs.delayResponses, "delay", false, "Add a random delay to any HTTP responses. This aids in development of Flamenco Manager's web frontend.") - flag.BoolVar(&cliArgs.firstTimeWizard, "wizard", false, "Open a webbrowser with the first-time configuration wizard.") + flag.BoolVar(&cliArgs.setupAssistant, "setup-assistant", false, "Open a webbrowser with the setup assistant.") flag.BoolVar(&cliArgs.pprof, "pprof", false, "Expose profiler endpoints on /debug/pprof/.") flag.Parse() diff --git a/internal/manager/api_impl/interfaces.go b/internal/manager/api_impl/interfaces.go index 5bb6754c..7ce1861d 100644 --- a/internal/manager/api_impl/interfaces.go +++ b/internal/manager/api_impl/interfaces.go @@ -166,7 +166,7 @@ type ConfigService interface { IsFirstRun() (bool, error) // ForceFirstRun forces IsFirstRun() to return true. This is used to force the - // first-time wizard on a configured system. + // setup assistant on a configured system. ForceFirstRun() // Save writes the in-memory configuration to the config file. diff --git a/internal/manager/api_impl/meta.go b/internal/manager/api_impl/meta.go index e33f14e6..0950fa1f 100644 --- a/internal/manager/api_impl/meta.go +++ b/internal/manager/api_impl/meta.go @@ -233,29 +233,29 @@ func (f *Flamenco) CheckBlenderExePath(e echo.Context) error { return e.JSON(http.StatusOK, response) } -func (f *Flamenco) SaveWizardConfig(e echo.Context) error { +func (f *Flamenco) SaveSetupAssistantConfig(e echo.Context) error { logger := requestLogger(e) - var wizardCfg api.WizardConfig - if err := e.Bind(&wizardCfg); err != nil { - logger.Warn().Err(err).Msg("first-time wizard: bad request received") + var setupAssistantCfg api.SetupAssistantConfig + if err := e.Bind(&setupAssistantCfg); err != nil { + logger.Warn().Err(err).Msg("setup assistant: bad request received") return sendAPIError(e, http.StatusBadRequest, "invalid format") } - logger = logger.With().Interface("config", wizardCfg).Logger() + logger = logger.With().Interface("config", setupAssistantCfg).Logger() - if wizardCfg.StorageLocation == "" || - !wizardCfg.BlenderExecutable.IsUsable || - wizardCfg.BlenderExecutable.Path == "" { - logger.Warn().Msg("first-time wizard: configuration is incomplete, unable to accept") + if setupAssistantCfg.StorageLocation == "" || + !setupAssistantCfg.BlenderExecutable.IsUsable || + setupAssistantCfg.BlenderExecutable.Path == "" { + logger.Warn().Msg("setup assistant: configuration is incomplete, unable to accept") return sendAPIError(e, http.StatusBadRequest, "configuration is incomplete") } conf := f.config.Get() - conf.SharedStoragePath = wizardCfg.StorageLocation + conf.SharedStoragePath = setupAssistantCfg.StorageLocation var executable string - switch wizardCfg.BlenderExecutable.Source { + switch setupAssistantCfg.BlenderExecutable.Source { case api.BlenderPathSourceFileAssociation: // The Worker will try to use the file association when the command is set // to the string "blender". @@ -263,10 +263,10 @@ func (f *Flamenco) SaveWizardConfig(e echo.Context) error { case api.BlenderPathSourcePathEnvvar: // The input command can be found on $PATH, and thus we don't need to save // the absolute path to Blender here. - executable = wizardCfg.BlenderExecutable.Input + executable = setupAssistantCfg.BlenderExecutable.Input case api.BlenderPathSourceInputPath: // The path should be used as-is. - executable = wizardCfg.BlenderExecutable.Path + executable = setupAssistantCfg.BlenderExecutable.Path } if commandNeedsQuoting(executable) { executable = strconv.Quote(executable) @@ -287,10 +287,10 @@ func (f *Flamenco) SaveWizardConfig(e echo.Context) error { // Save the final configuration to disk. if err := f.config.Save(); err != nil { logger.Error().Err(err).Msg("error saving configuration file") - return sendAPIError(e, http.StatusInternalServerError, "first-time wizard: error saving configuration file: %v", err) + return sendAPIError(e, http.StatusInternalServerError, "setup assistant: error saving configuration file: %v", err) } - logger.Info().Msg("first-time wizard: updating configuration") + logger.Info().Msg("setup assistant: updating configuration") // Request the shutdown in a goroutine, so that this one can continue sending the response. go f.requestShutdown() diff --git a/internal/manager/api_impl/meta_test.go b/internal/manager/api_impl/meta_test.go index b7a458bb..d0ead7b4 100644 --- a/internal/manager/api_impl/meta_test.go +++ b/internal/manager/api_impl/meta_test.go @@ -122,11 +122,11 @@ func TestCheckSharedStoragePath(t *testing.T) { } } -func TestSaveWizardConfig(t *testing.T) { +func TestSaveSetupAssistantConfig(t *testing.T) { mf, finish := metaTestFixtures(t) defer finish() - doTest := func(body api.WizardConfig) config.Conf { + doTest := func(body api.SetupAssistantConfig) config.Conf { // Always start the test with a clean configuration. originalConfig := config.DefaultConfig(func(c *config.Conf) { c.SharedStoragePath = "" @@ -142,7 +142,7 @@ func TestSaveWizardConfig(t *testing.T) { // Call the API. echoCtx := mf.prepareMockedJSONRequest(body) - err := mf.flamenco.SaveWizardConfig(echoCtx) + err := mf.flamenco.SaveSetupAssistantConfig(echoCtx) if !assert.NoError(t, err) { t.FailNow() } @@ -153,7 +153,7 @@ func TestSaveWizardConfig(t *testing.T) { // Test situation where file association with .blend files resulted in a blender executable. { - savedConfig := doTest(api.WizardConfig{ + savedConfig := doTest(api.SetupAssistantConfig{ StorageLocation: mf.tempdir, BlenderExecutable: api.BlenderPathCheckResult{ IsUsable: true, @@ -175,7 +175,7 @@ func TestSaveWizardConfig(t *testing.T) { // Test situation where the given command could be found on $PATH. { - savedConfig := doTest(api.WizardConfig{ + savedConfig := doTest(api.SetupAssistantConfig{ StorageLocation: mf.tempdir, BlenderExecutable: api.BlenderPathCheckResult{ IsUsable: true, @@ -197,7 +197,7 @@ func TestSaveWizardConfig(t *testing.T) { // Test a custom command given with the full path. { - savedConfig := doTest(api.WizardConfig{ + savedConfig := doTest(api.SetupAssistantConfig{ StorageLocation: mf.tempdir, BlenderExecutable: api.BlenderPathCheckResult{ IsUsable: true, diff --git a/internal/manager/config/defaults.go b/internal/manager/config/defaults.go index 69d48bca..4a1af7d4 100644 --- a/internal/manager/config/defaults.go +++ b/internal/manager/config/defaults.go @@ -22,7 +22,7 @@ var defaultConfig = Conf{ DatabaseDSN: "flamenco-manager.sqlite", SSDPDiscovery: true, LocalManagerStoragePath: "./flamenco-manager-storage", - SharedStoragePath: "", // Empty string means "first run", and should trigger the config wizard. + SharedStoragePath: "", // Empty string means "first run", and should trigger the config setup assistant. Shaman: shaman_config.Config{ // Enable Shaman by default, except on Windows where symlinks are still tricky. diff --git a/web/app/src/FirstTimeWizard.vue b/web/app/src/SetupAssistant.vue similarity index 97% rename from web/app/src/FirstTimeWizard.vue rename to web/app/src/SetupAssistant.vue index 86f3a653..aebca351 100644 --- a/web/app/src/FirstTimeWizard.vue +++ b/web/app/src/SetupAssistant.vue @@ -20,7 +20,7 @@ import { MetaApi } from "@/manager-api"; import { apiClient } from '@/stores/api-query-count'; export default { - name: 'FirstTimeWizard', + name: 'SetupAssistant', components: { ApiSpinner, }, diff --git a/web/app/src/main.js b/web/app/src/main.js index 37782be1..e5919023 100644 --- a/web/app/src/main.js +++ b/web/app/src/main.js @@ -3,10 +3,10 @@ import { createPinia } from 'pinia' import { DateTime } from 'luxon'; import App from '@/App.vue' -import FirstTimeWizard from '@/FirstTimeWizard.vue' +import SetupAssistant from '@/SetupAssistant.vue' import autoreload from '@/autoreloader' import router from '@/router/index' -import wizardRouter from '@/router/first-time-wizard' +import setupAssistantRouter from '@/router/setup-assistant' import { ApiClient, MetaApi } from "@/manager-api"; import * as urls from '@/urls' @@ -31,11 +31,11 @@ function normalMode() { app.mount('#app') } -function firstTimeWizardMode() { - console.log("Flamenco First Time Wizard is starting"); - const app = createApp(FirstTimeWizard) +function setupAssistantMode() { + console.log("Flamenco Setup Assistant is starting"); + const app = createApp(SetupAssistant) app.use(pinia) - app.use(wizardRouter) + app.use(setupAssistantRouter) app.mount('#app') } @@ -47,7 +47,7 @@ const metaAPI = new MetaApi(apiClient); metaAPI.getConfiguration() .then((config) => { console.log("Got config!", config); - if (config.isFirstRun) firstTimeWizardMode(); + if (config.isFirstRun) setupAssistantMode(); else normalMode(); }) .catch((error) => { diff --git a/web/app/src/router/first-time-wizard.js b/web/app/src/router/setup-assistant.js similarity index 83% rename from web/app/src/router/first-time-wizard.js rename to web/app/src/router/setup-assistant.js index 2d9d1353..5820d543 100644 --- a/web/app/src/router/first-time-wizard.js +++ b/web/app/src/router/setup-assistant.js @@ -6,7 +6,7 @@ const router = createRouter({ { path: "/", name: "index", - component: () => import("../views/FirstTimeWizardView.vue"), + component: () => import("../views/SetupAssistantView.vue"), }, { path: "/:pathMatch(.*)*", diff --git a/web/app/src/first-time-wizard.js b/web/app/src/setup-assistant.js similarity index 82% rename from web/app/src/first-time-wizard.js rename to web/app/src/setup-assistant.js index 40c2b303..ca42f6a7 100644 --- a/web/app/src/first-time-wizard.js +++ b/web/app/src/setup-assistant.js @@ -1,8 +1,8 @@ import { createApp } from 'vue' import { createPinia } from 'pinia' -import FirstTimeWizard from '@/FirstTimeWizard.vue' -import router from '@/router/first-time-wizard' +import SetupAssistant from '@/SetupAssistant.vue' +import router from '@/router/setup-assistant' // Ensure Tabulator can find `luxon`, which it needs for sorting by // date/time/datetime. @@ -14,7 +14,7 @@ window.plain = (x) => JSON.parse(JSON.stringify(x)); // objectEmpty returns whether the object is empty or not. window.objectEmpty = (o) => !o || Object.entries(o).length == 0; -const app = createApp(FirstTimeWizard) +const app = createApp(SetupAssistant) const pinia = createPinia() app.use(pinia) diff --git a/web/app/src/views/FirstTimeWizardView.vue b/web/app/src/views/SetupAssistantView.vue similarity index 97% rename from web/app/src/views/FirstTimeWizardView.vue rename to web/app/src/views/SetupAssistantView.vue index 0c561851..7728a8d3 100644 --- a/web/app/src/views/FirstTimeWizardView.vue +++ b/web/app/src/views/SetupAssistantView.vue @@ -208,7 +208,7 @@ { - console.log("Wizard config saved, reload the page"); + console.log("Setup Assistant config saved, reload the page"); this.isConfirmed = true; // Give the Manager some time to restart. window.setTimeout(() => { window.location.reload() }, 2000); }) .catch((error) => { - console.log("Error saving wizard config:", error); + console.log("Error saving setup assistan config:", error); // Only clear this flag on an error. this.isConfirming = false; }) diff --git a/web/web_app.go b/web/web_app.go index 092ec7bc..2ab55964 100644 --- a/web/web_app.go +++ b/web/web_app.go @@ -17,7 +17,7 @@ import ( var webStaticFS embed.FS // WebAppHandler returns a HTTP handler to serve the static files of the Flamenco Manager web app. -// `appFilename` is either `index.html` for the main webapp, or `first-time-wizard.html`. +// `appFilename` is either `index.html` for the main webapp, or `setup-assistant.html`. func WebAppHandler(appFilename string) (http.Handler, error) { // Strip the 'static/' directory off of the embedded filesystem. fs, err := fs.Sub(webStaticFS, "static")