Workspace Creation


Best Practices

  • Start by deciding on your id range. Project/customer specific workspaces should be developed in the id range [1000-1999]
  • Create specific data element groups for the workspace in data_element_groups. The groups are used to group the columns and dataseries in the user interface and are also connected to the workspace through the workspace type and are used in de_availability to only show in the client the dataseries and columns belonging to the workspace.




Create Workspace Feature

By creating a workspace feature you connect your workspace to the user management in the system giving you the ability to have your workspace available for different users/user groups. See Settings -> User Management -> Roles in the app.

When you are logged in as a user with the Development Mode feature active then you go into Settings -> Workspaces -> Create Feature.

inst

This action will:

  1. Create a new feature
  2. Create a workspace type and connect the type to the data element groups selected. Make sure you select a type id within your selected id range.
  3. Assign the feature to the system role




Create your Workspace

Creates a workspace in the user interface from the workspace page and select your new workspace type. inst

Now you should be able to open up your workspace but there should be no available columns and dataseries. Next steps would be to add them.




If you want to script your workspace to install in another setup you need to script the following tables:

de_workspaces

  • id (int) - required: identity column - autogenerated
  • name (nvarchar) - required: The name of the workspace, must be unique
  • caption (nvarchar) - required: The name that is shown in the system. You can either hard code the caption or enter a translation key that references the translations in the system
  • description (nvarchar) - not required: appears in the workspace list in the system. You can either hard code the description or enter a translation key that references the translations in the system
  • type_id (id) - required: links the workspace to the workspace type. The workspace type is then connected to the feature setup in the system that makes sure you can make the workspace available to a particular group of users
  • user_id (id) - required: the id of the user that created the workspace
  • visibility (nvarchar) - required ???
  • deleted (bit) - required: 1, if the workspace shouldn’t appear in the system; 0, otherwise
  • created_at (date) - required: should be populated with the date the workspace was created. Probably isn’t used in any logic
  • updated_at (date) - required: should be populated with the date the workspace was modified. Probably isn’t used in any logic

de_workspace_views

  • id (int) - required: identity column - autogenerated
  • de_workspace_id (int) - required: the id of the workspace the view belongs to
  • user_id (id) - required: the id of the user that created the workspace. Views that belong to the system user will be available to every user.
  • caption (nvarchar) - required: The name that is shown in the system. You can either hard code the caption or enter a translation key that references the translations in the system
  • levels (nvarchar) - not required: legacy column that is not used anymore and will be deleted in future versions
  • setup (json) - required: the JSON string that stores the view setup configured in view settings in the system
  • filters (json) - required: the JSON string that stores the filters that are saved with the view and can be modified in view settings
  • share_mode (nvarchar) - not required: populated by the system when views are shared with other users. Views that are created by users that don’t have the development mode feature can only be viewed by that user until that view is shared.
  • share_param (nvarchar) - not required: populated by the system when views are shared with other users. Views that are created by users that don’t have the development mode feature can only be viewed by that user until that view is shared.
  • deleted (bit) - required: 1, if the view shouldn’t appear in the system; 0, otherwise
  • created_at (date) - required: should be populated with the date the workspace was created. Probably isn’t used in any logic
  • updated_at (date) - required: should be populated with the date the workspace was modified. Probably isn’t used in any logic
  • view_config (json) - not required. The view config is stored in this column. Read more about it here

de_workspace_types

  • id (int) - required: The id of the ref column you are adding, should be within your selected id range. When creating the workspace feature above a id for the workspace type must be selected and the table is populated automatically
  • name (nvarchar) - required: name of the workspace type, must be unique
  • caption (nvarchar) - required: The name that is shown in the system. You can either hard code the caption or a translation string
  • default_ref_table_id (int) - required: this is used by de_query_availability when deciding what columns to present in the system when no columns/series have been selected.
  • default_ref_table_id (int) - required: this is used by de_query_availability when deciding what period filter to present in the system when no filters have been added
  • config (json) - required: config for the default period filter that should be added when the first dataseries is added into a workspace of this workspace type.

data_element_groups

Series, columns and workspaces (through workspace types) must be linked to a data element group which controls the availability of series/columns that are available in the system. This also controls how columns and series are grouped together in View Settings in the system.

  • id (int) - required: The id of the group, should be within your selected id range.
  • name (nvarchar) - required: name of the group, must be unique
  • caption (nvarchar) - required: The name that is shown in the system. You can either hard code the caption or a translation string
  • period_group (bit) - required: 1 if this is a group for period columns; 0 otherwise
  • description (nvarchar) - not required

de_workspace_type_groups

Links workspace types to data element groups

features

Each workspace must be connected to a feature in the system. Usually two features are created per workspace, one for users that should be able to modify and another one for read only usage.

  • id (int) - required: identity column - autogenerated
  • caption (nvarchar) - required: The name of the feature that is shown in the user management page in the system. You can either hard code the caption or a translation string
  • feature_ref (nvarchar - required): the name of the feature, must be unique. should end with .mod if the feature should allow the user to modify.
  • description (nvarchar) - required: The description of what priviledges users have when having access to this feature. You can either hard code the caption or a translation string
  • enabled (bit) - required: 1 the feature should be available in the system; 0 otherwise
  • system (bit) - required: 1 if this a feature only meant for AGR developers/system user; 0 otherwise
  • workspace_feature (bit) - required: 1 if this a feature created with a workspace; 0 otherwise

de_workspace_features

Connects features to the workspace.

  • id (int) - required: identity column - autogenerated
  • workspace_id (int) - required: The id of the workspace in de_workspaces
  • feature_id (int) - required: The id of the feature in features

role_features

Features are connected to users thorugh roles. When a workspace feature is created through the UI the feature is automatically linked to the system user. To make the workspace available for other user you must go into Settings -> User Management -> Roles in the AGR app to give the users access.

  • role_id (int) - required: The id of the role the users belong to in the roles table
  • feature_id (int) - required: The id of the feature in features

inst

inst