SolidOS/solid-logic

Move solid-ui:src/authn/authn.ts here

michielbdejong opened this issue · 8 comments

Doing this in https://github.com/solid/solid-ui/pull/359.
I've made quite some progress already but now running into some more complex code.

  • findAppInstances

    • calls loadOneTypeIndex
    • finds registrations
    • finds instances
    • finds containers
    • gets a unique list of instances and containers
    • loads the containers
    • adds the container elements as instances
  • loadOneTypeIndex

    • calls loadIndex
  • loadIndex

    • calls logInLoadProfile -> there are cases where we want to display warnings to the user but still continue
    • calls logInLoadPreferences -> there are cases where we want to display warnings to the user not still continue
    • calls getTypeIndex
    • calls load

I think the best option here is to pass a warning callback

I should also change the order so that findAppInstances calls logIn first so that loadIndex doesn't have to.

I should make solid-ui:src/authn/authn.ts be just a UI wrapper around the functionality in solid-logic.
I also don't want to use context in solid-logic. So for instance, solid-panes:src/dashboard/basicPreferences.ts uses:

const renderContext = await authn.logInLoadPreferences({
        dom,
        div: container
      })
      if (!renderContext.preferencesFile) {
        // Could be CORS
        console.log(
          'Not doing private class preferences as no access to preferences file. ' +
          renderContext.preferencesFileError
        )
        return
      }

There, the dom and the div are used by solid-ui to render error messages, and the preferencesFile is returned. preferencesFileError should stay inside solid-ui, no need to leak that to the panes.

export findAppInstances
  * loadIndex
export registrationControl
  * ensureTypeIndexes
export registrationList
  * ensureTypeIndexes
export registerInTypeIndex
  * ensureOneTypeIndex

Should also move the call to UI.authn.loadTypeIndexes(context) from meeting-pane to the PeoplePicker widget

Or maybe there's not so much harm in exposing it...

I'm thinking it would be easier and cleaner to set a single onWarning handler on the solid-logic instance, and just handle all warnings with an ErrorMessageBlock.

That will make it easier to migrate more code to there.