Setting Up Teamsharing

Summary

  • Team Sharing is configured by developers at Design Time
  • The UI Entitlements for Team Sharing allow some users only to download (and not upload)

Team Sharing is not available or enabled by default in AdapTable.

Instead, it needs to be explicitly enabled and set up by developers at design time.

Note

Team Sharing uses a very similar loading and persisting pattern as Comments

Developer Guide

Setting up Team Sharing in Team Sharing Options

There are 4 steps you must follow in order for Team Sharing to be available to end users:

const adaptableOptions: AdaptableOptions = {
  entitlementOptions: {
    defaultAccessLevel: 'Hidden',
    moduleEntitlements: [
      {
        adaptableModule: 'TeamSharing',
        accessLevel: 'Full',
      },
    ],
  },
};
1
Make sure Team Sharing Entitlement is not Hidden

Check the TeamSharing Entitlement is one of these 2 Access Levels:

  • Full (preferable)
  • ReadOnly

Alternatively, check the defaultAccessLevel property is set to Full

Caution

Team Sharing will not appear if the defaultAccessLevel property is set to Hidden and the Team Sharing Entitlement is not explicitly overridden

const adaptableOptions: AdaptableOptions = {
  teamSharingOptions: {
    enableTeamSharing: true,
  },
};
2
Turn on Team Sharing in Team Sharing Options

Set enableTeamSharing to true in Team Sharing Options section of Adaptable Options.

const adaptableOptions: AdaptableOptions = {
  teamSharingOptions: {
    enableTeamSharing: true,
    async loadSharedEntities(adaptableId) {
      return new Promise(resolve => {
        const sharedEntities = JSON.parse(
          localStorage.getItem(`TEAM_SHARING:${adaptableId}`) || '[]'
        );
        resolve(sharedEntities);
      });
    },
  },
};
3
Provide loadSharedEntities property in Team Sharing Options

The async loadSharedEntities property in Team Sharing Options must be supplied.

This property is used for retrieving any Shared Items from the remote storage location.

const adaptableOptions: AdaptableOptions = {
  teamSharingOptions: {
    enableTeamSharing: true,
    async persistSharedEntities(adaptableId, sharedEntities) {
      return new Promise(resolve => {
        localStorage.setItem(
          `TEAM_SHARING:${adaptableId}`,
          JSON.stringify(sharedEntities)
        );
        resolve();
      });
    },
  },
};
4
Provide persistSharedEntities property in Team Sharing Options

The async persistSharedEntities property in Team Sharing Options must be supplied.

This property is used for persisting any Shared Items into the remote storage location.

Once Team Sharing is enabled, AdapTable will update the UI in 2 ways:

  • include the Team Sharing screen in the Settings Panel
  • add a Share button to every screen in the Settings Panel that displays AdapTable Objects

Hint

The Share button's fore and back colours can be styled using 2 CSS variables:

  • --ab-color-action-share
  • --ab-color-text-on-share

Remote State Management

TeamSharing Options provides 4 functions that allow developers to control TeamSharing state management and to provide their own load, persistence, hydration or serialization mechanisms:

  • loadSharedEntities - (mandatory) Loads Shared Entities from remote storage
  • applySharedEntities - (mandatory) Retrieves Shared Entities from remote storage
  • persistSharedEntities - (optional) Hooks into load flow of Shared Entities
  • saveSharedEntities - (optional) Hooks into persistence flow of Shared Entities

Note

These 4 functions mirror exactly those used to save Adaptable State remotely

loadSharedEntities

Loads Shared Entities from remote storage

persistSharedEntities

Promise<void>
Retrieves Shared Entities from remote storage

applySharedEntities

SharedEntity[]
(Optional) Hooks into load flow of Shared Entities

saveSharedEntities

SharedEntity[]
(Optional) Hooks into persistence flow of Shared Entities
Configuring and customizing state management
Fork

Users have edit rights only on their own shared entities and read-only rights on other users shared entities. This is done by hooking into the loading/persisting TeamSharing state mechanisms.

Expand to see how the State Management is configured

Try It Out
  • Share with each user a FormatColumn
  • Notice that users can delete only their own shared FormatColumn

UI Entitlements

The UI Entitlements for Team Sharing are as follows:

  • Hidden the Team Sharing UI is completely unavailable

  • ReadOnly - users can import existing Shared items, but are not allowed to create or delete them;

Note

Changes to Active entities are still pushed if the Entitlement is ReadOnly

  • Full - everything is available in the UI, and users have full Read, Write and Download access
Team Sharing Admin and User
Fork

User Alice has entitlements set to Full and Bob has entitlements set to ReadOnly.

Entity Entitlements

ReadOnly rights at entity level can be specified by setting IsReadOnly to true for the SharedEntity

Caution

This can only be done programmatically - there is no option to set this in the UI

Override Warning

AdapTable warns users if they try to import an object in Team Sharing that already exists in Adaptable State.

Note

It does this by checking the Uuid (not the Name) of the imported Adaptable Object

If the user proceeds with the import after seeing the warning, the new object will overwrite the exsisting one.

This behaviour can be changed using the suppressOverrideConfigWarning property in Team Sharing Options.

suppressOverrideConfigWarning

Default: false
Boolean
Suppress messages warning that imported Object already exists