关于sap:SAP-CAP-Fiori-Elements-应用配置-UI-的两种方式以及自定义-indexhtml

5次阅读

共计 1421 个字符,预计需要花费 4 分钟才能阅读完成。

第一种办法

编辑 app 里的 manifest.json 文件:

{
    "_version": "1.32.0",
    "sap.app": {
    ...
    "sap.ui5": {
        ...
        "routing": {
            ...
            "targets": {
                ...
                "RisksObjectPage": {
                    ...
                    "options": {
                        "settings": {
                            "editableHeaderContent": true,
                            "entitySet": "Risks"
                        }
                    }
                }
            }
        },
        ...
}

第二种办法:批改 .cds 文件

给对应的 Fiori Elements 字段 (forms 中的) 增加 Label,以及 table column 字段增加 header

using RiskService from './risk-service';

annotate RiskService.Risks with {
    title       @title: 'Title';
    prio        @title: 'Priority';
    descr       @title: 'Description';
    miti        @title: 'Mitigation';
    impact      @title: 'Impact';
}

增加 value help:

annotate RiskService.Mitigations with {
ID @(
    UI.Hidden,
    Common: {Text: description}
);
description  @title: 'Description';
owner        @title: 'Owner';
timeline     @title: 'Timeline';
risks        @title: 'Risks';
}

SAP CAP 提供了一个本地实现的仿 Fiori Launchpad 的 container:

在一个 CAP Java 利用的 app 文件夹里搁置一个自定义 index.html 会怎么样?

首先间接执行 cds watch 是无奈工作的。

在利用的 app 文件夹里新建一个 index.html:

重启 SpringBoot 利用,这个 index.html 就失效了:

cds watch 默认在 app 文件夹中查找 index.html 文件。如果 cds watch 找到这样的文件,它会将蕴含服务链接的默认页面替换为文件夹中的链接。尽管这在许多状况下是有意义的,但出于开发目标,咱们保持应用 CDS 的索引页面并为咱们的索引文件提供不同的名称。
然而在 Business Application Studio 环境里测试不通过:

看不到自定义 index.html 里的内容:

另外举一些例子,假如我想在 Fiori Elements List report 的表格控件里,将 table column 的文本进行自定义:

须要批改 web 利用里 fiori-service.cds 文件里对应的注解。

能够应用语法 annotate AdminService.Orders with 前面加理论的注解值。

Object Page 里的 tab 标签:

对应的注解源代码:

Facets                      : [
            {
                $Type  : 'UI.ReferenceFacet',
                Label  : '发货地址',
                Target : '@UI.FieldGroup#ShippingAddress'
            },
            {
                $Type  : 'UI.ReferenceFacet',
                Label  : '明细',
                Target : '@UI.FieldGroup#Details'
            },
            {
                $Type  : 'UI.ReferenceFacet',
                Label  : '{i18n>OrderItems}',
                Target : 'Items/@UI.LineItem'
            },
        ],

正文完
 0