Extending the Project Settings Panel

Project Settings holds the configuration related to the running of the project. This part of the configuration allows access to versioning and sharing of configurations by multiple people.

For example, the configuration of built modules, the configuration of layers within the project. If this configuration is not synchronized, it may cause inconsistent results on different machines.

For editor-related configurations, please refer to the Extending the Preferences Panel documentation.

Panel Introduction

The project settings are divided into two parts:

  • On the left side is the function tab inside the function module
  • The right side is the configuration modification screen

The project settings allow a functional extension to register multiple tabs, and accordingly the tabs are marked with text indicating which functionality the tab belongs to.

Registration Method

First define the configuration in contributions.profile.project. The data to be displayed can be defined in the project settings in contributions.project.

Note: the data configured in the project settings should be stored in the project location.

Registering Project Settings Data

Define a simple extension:

package.json

  1. {
  2. "name": "project-test",
  3. "contributions": {
  4. "profile": {
  5. "project": {
  6. "foo": {
  7. "default": 1,
  8. }
  9. }
  10. },
  11. "project": {
  12. "tab1": {
  13. "label": "test",
  14. "content": {
  15. "foo": {
  16. "ui": "ui-num-input"
  17. }
  18. }
  19. }
  20. }
  21. }
  22. }

A new tab called test on the left side of the project settings now exists. The Project -> Project Settings menu from the main menu opens the Project Settings. Once selected, modify the foo configuration in the right panel.

For details on how to define a profile, please review the Profile documentation.

  1. interface Package
  2. {
  3. 'name': string;
  4. 'contributions': {
  5. 'profile': {
  6. 'project': {
  7. [key:string]: ProfileItem;
  8. };
  9. };
  10. "project": {
  11. [key:string]: ProjectGroup;
  12. }
  13. }
  14. }
  15. interface ProjectGroup {
  16. /**
  17. * Text of the left label in the project settings, i18n supported.
  18. **/
  19. label: string;
  20. /**
  21. * The project field corresponds to the configuration information injected into the project settings, which are defined as 'object' objects.
  22. * The object's key is the unique identifier of the project setting, and its value is the basic information describing the project setting.
  23. **/
  24. content?: { [key: string]: UIInfo };
  25. /**
  26. * If the configuration is more complex and automatic rendering cannot meet the needs, you can fill in custom data.
  27. * Customize the rendering panel in the project settings, which appears below the automatic rendering (if properties are defined).
  28. **/
  29. custom?: string;
  30. }
  31. /**
  32. * The information needed to render a configuration
  33. **/
  34. interface UIInfo {
  35. // Which ui element to use for rendering, e.g. "ui-num-input"
  36. ui: string;
  37. attributes: {
  38. // The attribute data allowed to be passed on the ui element is different for each type of ui, see the ui-kit section for details
  39. // Assuming the ui is "ui-num-input", here you can fill in "step": 1
  40. [key:string]: any;
  41. };
  42. }

As additional reading, please review the Panel Boot documentation for panel definitions.