Skip to content

autoindex: trigger autoindex job from UI

Warren Gifford requested to merge nsc/autoindex-button into main

Created by: Strum355

Review recommended with: :ballot_box_with_check:Hide whitespace changes

Backend changes:

  • Extracted the index queueing logic to a separate package to be reused in the graphql resolver and the frontend codeintel background indexing package
  • Added a ForceQueueIndex to skip the logic that checks if an index is already queued or if an upload exists for the HEAD commit
  • GraphQL mutation on the resolver to queue an index
  • Extracted autoindexer metrics to separate package, changing to singleton with sync.Once

Frontend changes:

  • DynamicallyImportedMonacoSettingsEditor (jsdoc to be added)

    • This can now take a custom SaveToolbar, if one needs additional functionality in the base SaveToolbar
    • As there is no inheritance in function components, only composition, and the custom SaveToolbar may have additional props ontop of the SaveToolbar props, a function that merges the SaveToolbar props with their custom additional props must be passed along with the custom toolbar React.FunctionComponent. This is defined/typified as SaveToolbarPropsGenerator
      • This fallsback to the original behaviour if nothing is set for the custom toolbar, and the generic T (which is the type of the custom toolbar props) defaults to {}
  • SaveToolbar

    • Props became React.PropsWithChildren<Props> to allow custom toolbars to pass in additional react nodes to be included. Example can be seen in CodeIntelAutoIndexSaveToolbar, where we add an additional button and additional LoadingSpinner for the new state(s) that we can have
    • As custom toolbars may want to override when Save and Discard buttons are disabled and/or when errors are displayed, this is customizable by setting the saveDiscardDisabled and willShowError property functions.
      • By default, the former was when saving || !dirty and the latter was !saving. Overriding the impl must also do this if they wish to append to existing functionality rather than change it.
  • CodeIntelAutoIndexSaveToolbar

    • React.FunctionComponent that "implements" a toolbar by composition of a SaveToolbar.
    • Overrides the save/discard button disabling and error displaying based on whether the "Queue Job" button was clicked
  • CodeIntelIndexConfigurationPage

    • State is no longer binary saving|!saving, was expanded to Idle|Saving|Queueing
    • The CodeIntelAutoIndexSaveToolbar "Save", "Discard" and "Queue Job" buttons are disabled when either "Save" or "Queue Job" is clicked

Failing tests to be addressed and additional in-code docs to be added


Nice Diagram : ) monakoeditor

Merge request reports

Loading