Import, export, and duplicate applications(导入、导出和复制应用(application))¶
:::callout{theme="warning"} These workflows are not recommended for sharing or duplicating complex applications. Instead, use the Marketplace integration to share applications across Foundry instances, or use Save as to duplicate applications within the same Foundry enrollment. :::
Import Slate applications¶
To import a Slate application, select the File dropdown menu and choose Import JSON while in Edit mode to open the upload dialog. Select a JSON file from your local machine to upload as a Slate document. If the permalink defined in the JSON file is new and unique, you will be prompted to choose a location where a new Slate document will be created. If the permalink defined in the JSON of the Slate document already exists in Foundry, a new version of the existing Slate document will be created with the content of the imported JSON file.
When importing an application, only the logic of the application itself is imported. Supporting resources such as images, files, objects, datasets, and data sources are not automatically created. The JSON import will fail if referenced data sources are not available. References to other resources that do not exist will result in an error when opening the application, but these errors can be resolved by re-pointing them manually in edit mode. For applications that use the Ontology SDK, you may also need to regenerate the OSDK bundle manually after import.
Export Slate applications¶
To export a Slate application, select Export in the File dropdown while in Edit mode. This will download a JSON file onto your local machine that contains the configuration of the Slate application. This configuration includes widgets, functions, query logic, events, variables, and styles. It does not contain other resources on Foundry that are not contained in the application itself, such as global stylesheets, objects, data sources, datasets, Actions, images, videos, JavaScript, and CSS libraries imported into the code sandbox.
Duplicate Slate applications¶
Slate applications can be duplicated by selecting the Save as option under the File dropdown menu while in Edit mode. A pop-up will appear to enter a new location and name for the duplicate application. The new application will only contain the latest version of the original application and store it as v1. For applications that use the Ontology SDK, the existing OSDK bundle is copied from the source application rather than regenerated.
Duplicate Slate widgets¶
You can also reuse widgets across your Slate applications. To duplicate a widget, first select it in the Layout pane to the left of your Slate application. Then, press Cmd+C (macOS) or Ctrl+C (Windows). Finally, navigate to your second Slate app and press Cmd+V (macOS) or Ctrl+V (Windows) to paste the copied widget.
Overwrite Slate applications¶
The Save as option also allows you to overwrite existing Slate applications. You can use this to stage or promote applications. To overwrite a Slate application, choose an existing application in the file browser as the location in which to save your application. When overwriting an application, a new version will be created and the content of the selected version of the current application will be copied.
中文翻译¶
导入、导出和复制应用(application)¶
:::callout{theme="warning"} 以下工作流程不推荐用于共享或复制复杂应用。如需跨 Foundry 实例共享应用,请使用 Marketplace 集成;如需在同一 Foundry 注册(enrollment)内复制应用,请使用 另存为 功能。 :::
导入 Slate 应用¶
要导入 Slate 应用,请在编辑模式下选择 文件 下拉菜单,然后选择 导入 JSON 以打开上传对话框。从本地计算机中选择一个 JSON 文件,将其作为 Slate 文档上传。如果 JSON 文件中定义的永久链接(permalink)是新的且唯一的,系统将提示您选择一个位置,用于创建新的 Slate 文档。如果该 Slate 文档 JSON 中定义的永久链接在 Foundry 中已存在,则会基于导入的 JSON 文件内容,为现有 Slate 文档创建一个新版本。
导入应用时,仅导入应用本身的逻辑。图像、文件、对象(object)、数据集(dataset)和数据源(data source)等支持资源不会自动创建。如果引用的数据源不可用,JSON 导入将失败。对不存在资源的引用会在打开应用时导致错误,但您可以在编辑模式下手动重新指向这些资源来解决错误。对于使用 Ontology SDK 的应用,导入后可能还需要手动重新生成 OSDK 包(bundle)。
导出 Slate 应用¶
要导出 Slate 应用,请在编辑模式下选择 文件 下拉菜单中的 导出。这将把包含 Slate 应用配置的 JSON 文件下载到本地计算机。该配置包括小部件(widget)、函数(function)、查询逻辑(query logic)、事件(event)、变量(variable)和样式(style)。它不包含 Foundry 上未包含在应用本身中的其他资源,例如全局样式表、对象、数据源、数据集、操作(Action)、图像、视频、JavaScript 以及导入到代码沙箱(code sandbox)中的 CSS 库。
复制 Slate 应用¶
在编辑模式下,选择 文件 下拉菜单中的 另存为 选项即可复制 Slate 应用。系统会弹出一个窗口,要求您为复制的应用输入新位置和名称。新应用仅包含原始应用的最新版本,并存储为 v1。对于使用 Ontology SDK 的应用,现有 OSDK 包会从源应用复制,而不会重新生成。
复制 Slate 小部件¶
您还可以在 Slate 应用之间复用小部件。要复制小部件,首先在 Slate 应用左侧的布局(Layout)窗格中选择该小部件。然后按下 Cmd+C(macOS)或 Ctrl+C(Windows)。最后,导航到第二个 Slate 应用,按下 Cmd+V(macOS)或 Ctrl+V(Windows)粘贴复制的小部件。
覆盖 Slate 应用¶
另存为 选项还允许您覆盖现有的 Slate 应用。您可以使用此功能来暂存或提升应用。要覆盖 Slate 应用,请在文件浏览器中选择一个现有应用作为保存位置。覆盖应用时,会创建一个新版本,并将当前应用选定版本的内容复制到其中。