Ship the equipment catalog so a new site does not start empty
`flask seed reference-data` wrote a dozen generic model types and no vendors or models at all, so adopting this platform began by retyping a catalog another site had already spent a year building. That is the largest single obstacle to standing a new facility up. scripts/export_catalog.py dumps the catalog from a live instance to shopdb/data/catalog.json, and `flask seed catalog` loads it. What travels: vendors 53, models 128, modelsupplies 146, modeltypes 35, machinetypes 21, computertypes 10, printertypes 9, networkdevicetypes 5, locationtypes 11, operatingsystems 14, measuringtooltypes 8, notificationtypes 3, accessprotocols 3 The 146 printer supplies are the most useful part after the models themselves: every toner, drum and maintenance kit with its part number, colour, capacity tier and page yield, already matched to the right model, instead of somebody reading them off spent cartridges. IDEMPOTENT and ADDITIVE. Records match on a natural key - a vendor by name, a model by vendor plus model number, a supply by model plus part number - so a second run adds nothing, and it never updates or deletes: a site that corrected a description or pointed a model at its own photo keeps its version. Catalog only. No assets, locations, employees, business units or anything with a serial number: nobody wants one plant's machines appearing at another. Vendor contact details are excluded too, since a rep's name and number belong to whoever holds that relationship. supportteams, printerdrivers and customfields are site-specific and deliberately absent. Models and supplies reference their vendor by NAME rather than id, because ids differ between databases and an id-keyed catalog would silently attach part numbers to the wrong printer. The installer offers it as a tick-box on a new "Starter data" page, defaulting to on, passing -SeedCatalog to stage 3. Offered rather than assumed: a site that machines nothing does not want 21 machine types cluttering its dropdowns. Verified by loading into an empty database and running twice: every group populated on the first pass, "Catalog already present, nothing to add" on the second.
This commit is contained in:
@@ -201,6 +201,7 @@ var
|
||||
// the check takes a few seconds, runs hidden, and gives no sign of life.
|
||||
CheckingPage: TOutputProgressWizardPage;
|
||||
PluginPage: TInputOptionWizardPage;
|
||||
CatalogPage: TInputOptionWizardPage;
|
||||
PluginNames: TArrayOfString;
|
||||
PluginPageReady: Boolean;
|
||||
DbPageReady: Boolean;
|
||||
@@ -397,7 +398,21 @@ begin
|
||||
if Trim(PluginNames[I]) <> '' then
|
||||
PluginPage.Add(PluginLabel(Trim(PluginNames[I])));
|
||||
|
||||
DbChoicePage := CreateInputOptionPage(PluginPage.ID,
|
||||
// Offered, not forced. A site that machines nothing inherits 21 machine types
|
||||
// it will never use, and a catalog nobody wanted is just clutter in every
|
||||
// dropdown. Ticked by default because the alternative is retyping a vendor and
|
||||
// model list another site already built.
|
||||
CatalogPage := CreateInputOptionPage(PluginPage.ID,
|
||||
'Starter data', 'Load the shared equipment catalog?',
|
||||
'Vendors, model numbers and the type lists, as built up across the other ' +
|
||||
'sites. It only ADDS - nothing existing is changed or removed - and it can ' +
|
||||
'be loaded later with "flask seed catalog". No assets, locations or people ' +
|
||||
'are included; this is catalogue information only.',
|
||||
False, False);
|
||||
CatalogPage.Add('Load the shared vendor and model catalog');
|
||||
CatalogPage.Values[0] := True;
|
||||
|
||||
DbChoicePage := CreateInputOptionPage(CatalogPage.ID,
|
||||
'Database', 'Where should ShopDB-Flask store its data?',
|
||||
'Most sites already run MySQL for the existing shopdb application. If so, ' +
|
||||
'choose the second option - installing a second server would collide on ' +
|
||||
@@ -1177,6 +1192,8 @@ begin
|
||||
' -OnFailure never' +
|
||||
' -ClientIpSource ' + ClientIpSourceArg +
|
||||
' -SitePlugins "' + SelectedPlugins + '"';
|
||||
if CatalogPage.Values[0] then
|
||||
Common := Common + ' -SeedCatalog';
|
||||
|
||||
// Subpath deployment: an IIS Application under the existing site instead of a
|
||||
// site of its own. Appended here because Pascal has no conditional expression.
|
||||
|
||||
Reference in New Issue
Block a user