如何在Carbon工作区中打开Workshop模块时使用推广变量?

huangapple go评论66阅读模式
英文:

How to use promoted variables in Workshop modules while opening them in Carbon workspaces?

问题

We have a Workshop module that is often accessed by users in two different ways:

  • 使用浏览器访问碳工作区,然后访问工作坊模块
  • 使用通过本体操作通知发送的关于执行操作的通知/电子邮件中的链接

最有用的初始布局(通过一个布尔变量控制,目前与模块中的复选框小部件关联)取决于用户访问此模块的方式。

我们看到有一种功能,允许我们生成一个具有提升的变量的URL,从而允许我们通过URL更改此布尔变量的默认状态,但是根据初步测试,通过碳工作区访问模块时提升的变量不起作用(即使添加了URL参数,它也会被截断,并且在加载时变量处于其默认状态)。如果是这种情况,那么在设置操作通知时,我们无法指向碳工作区。

是否有一种方法可以在碳工作区中打开此模块时使用提升的变量?或者,是否有一种方法可以在不使用提升的变量的情况下实现取决于模块被访问的位置而不同的布局?

英文:

We have a Workshop module that is often accessed by users in two different ways:

  • using browser to access a Carbon workspace, then the Workshop module
  • using links from notifications/emails about performed actions that is sent via ontology action notification

The most useful initial layout (which is controlled via a boolean variable, currently linked to a tickbox widget in the module) depends on the way a user accesses this module.

We see functionality that allows us to generate a url with promoted variables, thus allowing us to change the defualt state of this boolean variable via url, however from initial testing, promoted variables do not work when accessing module via a Carbon workspace (i.e. despite adding the url parameter, it is truncated and upon loading the variable is in its default state). If that is the case, when setting up action notification we cannot point to Carbon workspace.

Is there a way to use promoted variables if we want to open this module in a Carbon workspace? Alternatively, is there a way to achieve different layouts that would change depending on where the module is being accessed from without using promoted variables?

答案1

得分: 1

你很接近了。以下是将推广变量值传递给碳工作区内的工作坊模块的方法。

  1. 使用YAML编辑器配置Carbon工作区。
  2. 在引用的模块部分,将YAML从您当前的配置更改为类似下面配置的格式(请参阅示例链接以获取更多信息)。
  3. 在YAML中,将您的布尔值作为字符串传递,就像下面的示例一样。在本示例中,我的推广变量名称是 isChecked

在浏览器的URL栏中,您应该看到这个:
如何在Carbon工作区中打开Workshop模块时使用推广变量?

配置:

displayMetadata:
  title: Promoted Var Workspace
  description: null
  enableDarkMode: null
  headerMenuOptions: null
  isAcademyShown: false
  isHelpShown: false
  isDocumentationShown: false
  isNotificationsDropdownShown: true
  isUserProfileShown: true
versionMetadata:
  description: Initial version
discoverableModules:
  - ri.workshop.main.module.<the-module-your-question-is-about>
configuration:
  moduleShortcuts:
    primary: []
    secondary: []
  homePage:
    type: internalHomePage
    internalHomePage:
      logo: null
      welcomeText: null
      welcomeTextWithMarkdown: null
      shouldHideSearchBar: null
      searchBarPlaceholder: null
      defaultObjectTypesFilter: null
      columns:
        - sections:
            - title: Module with promoted var
              description: null
              displayAs: null
              contents:
                type: custom
                custom:
                  items:
                    - type: module
                      module:
                        displayMetadata:
                          title: null
                          description: null
                          icon: null
                          thumbnail: null
                        moduleRid: >- ri.workshop.main.module.<the-module-your-question-is-about>
                        parameterValues:
                          variable.isChecked:
                            type: string
                            string:
                              string: 'true'
        - sections:
            - title: null
              description: null
              displayAs: null
              contents:
                type: objectTypes
                objectTypes:
                  objectTypes: null
        - sections:
            - title: null
              description: null
              displayAs: null
              contents:
                type: savedExplorations
                savedExplorations: {}
  parameters: []
  parametersDisplayMetadata: null
  enablement:
    navigationOutOfCarbonDisabled: false
    moduleBlockList: []
targetDeviceTypes: []

这是它的外观:
如何在Carbon工作区中打开Workshop模块时使用推广变量?

英文:

You're very close. Here's how you pass the promoted variable value to the workshop module inside the carbon workspace.

  1. Configure the Carbon workspace using the YAML editor
  2. In the section where you include the module you're referring to, change the YAML from what you have to something that looks like the config below (see the docs for what I referred to example).
  3. In the YAML, pass in your boolean as a string, just like I have below. The name of my promoted variable in this example is isChecked

In the browser's URL bar you should see this:
如何在Carbon工作区中打开Workshop模块时使用推广变量?

Config:

displayMetadata:
title: Promoted Var Workspace
description: null
enableDarkMode: null
headerMenuOptions: null
isAcademyShown: false
isHelpShown: false
isDocumentationShown: false
isNotificationsDropdownShown: true
isUserProfileShown: true
versionMetadata:
description: Initial version
discoverableModules:
- ri.workshop.main.module.<the-module-your-question-is-about>
configuration:
moduleShortcuts:
primary: []
secondary: []
homePage:
type: internalHomePage
internalHomePage:
logo: null
welcomeText: null
welcomeTextWithMarkdown: null
shouldHideSearchBar: null
searchBarPlaceholder: null
defaultObjectTypesFilter: null
columns:
- sections:
- title: Module with promoted var
description: null
displayAs: null
contents:
type: custom
custom:
items:
- type: module
module:
displayMetadata:
title: null
description: null
icon: null
thumbnail: null
moduleRid: >-
ri.workshop.main.module.<the-module-your-question-is-about>
parameterValues:
variable.isChecked:
type: string
string:
string: 'true'
- sections:
- title: null
description: null
displayAs: null
contents:
type: objectTypes
objectTypes:
objectTypes: null
- sections:
- title: null
description: null
displayAs: null
contents:
type: savedExplorations
savedExplorations: {}
parameters: []
parametersDisplayMetadata: null
enablement:
navigationOutOfCarbonDisabled: false
moduleBlockList: []
targetDeviceTypes: []

And here's what it looks like:
如何在Carbon工作区中打开Workshop模块时使用推广变量?

答案2

得分: 1

A Carbon可以以两种方式利用提升的Workshop变量:1)使用Carbon配置窗格的内置选项,或2)通过替换内置选项来使用Workshop。

选项1)向Carbon添加一个Workshop资源。在添加Workshop时,命名一个参数为“variable.[插入提升的ID]”,并设置其值。例如:parameter: variable.source. 值:carbon. 然后,应该打开Workshop,并将“carbon”作为提升的变量的值传递。注意:在Workshop中,变量名称无关紧要,只有提升的ID重要,而Workshop中的提升的ID不应包含“variable.”。

选项2)在嵌入的Workshop中,使用事件(例如按钮事件)将变量传递给另一个Workshop。资源列表可以使用,但前提是每个资源也要使用事件:打开Workshop资源(同一Workshop),然后选择提升的变量的输入。

英文:

A Carbon can utilize promoted Workshop variables in one of two ways: 1) using the Carbon configuration pane's built-in options, or 2) by replacing the built-in options with a Workshop.

Option 1) Add a Workshop resource to the Carbon. When adding the Workshop, name a parameter "variable.[insert promoted id]", and set it's value. For example: parameter: variable.source. Value: carbon. This should then open the Workshop with "carbon" passed as a value to the promoted variable. Note: In Workshop, the variable name doesn't matter, just the promoted ID, and the promoted ID in Workshop should not include "variable.".

Option 2) In an embedded Workshop, use events (i.e. button events) to pass a variable to another Workshop. The resource list can be used, but only if each resource also uses an event: Open Workshop resource (same Workshop) and then select inputs for promoted variables.

huangapple
  • 本文由 发表于 2023年5月17日 20:14:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/76271995.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定