@sap/generator-adaptation-project
Version:
Adaptation project allows you to create an app variant for an existing SAP Fiori elements-based or SAPUI5 freestyle application, without changing the original application.
115 lines • 5.99 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getFlpConfigurationPrompts = void 0;
const adp_abap_1 = require("@sap/adp-abap");
const adp_common_1 = require("@sap/adp-common");
const types_1 = require("../../types");
const validator_1 = require("../validator");
function getFlpConfigurationPrompts(config) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
return [
{
type: types_1.PromptType.LIST,
name: "flpInboundId",
message: adp_common_1.Messages.INBOUND_ID_LABEL,
choices: config.inboundIds,
default: (_b = (_a = config.flpConfig) === null || _a === void 0 ? void 0 : _a.inboundId) !== null && _b !== void 0 ? _b : config.inboundIds[0],
validate: (value) => (0, validator_1.validateEmptySelect)(value, adp_common_1.Messages.INBOUND_ID_LABEL),
when: config.isCloudProject && config.inboundIds.length > 0,
guiOptions: {
hint: adp_common_1.Messages.INBOUNDID_TOOLTIP,
breadcrumb: adp_common_1.Messages.INBOUND_ID_LABEL
}
},
{
type: types_1.PromptType.INPUT,
message: adp_common_1.Messages.FLP_PARAMETERS_INFO,
guiOptions: {
type: types_1.PromptGuiOptionsType.LABEL,
mandatory: false,
link: {
text: "application page.",
url: `https://fioriappslibrary.hana.ondemand.com/sap/fix/externalViewer/${config.appID ? `index.html?appId=${config.appID}&releaseGroupTextCombined=SC` : "#/home"}`
}
},
when: config.system && config.isCloudProject && config.inboundIds.length === 0
},
{
type: types_1.PromptType.INPUT,
name: "flpConfigurationTypeLabel",
message: `${adp_common_1.Messages.FLP_CONFIGURATION}: ${adp_common_1.FlpConfigurationType.ADD_NEW_TILE}`,
when: config.system && config.isCloudProject,
validate: true,
guiOptions: {
type: types_1.PromptGuiOptionsType.LABEL,
hint: adp_common_1.Messages.FLP_CONFIGURATION_TYPE_LABEL(adp_common_1.FlpConfigurationType.ADD_NEW_TILE),
mandatory: false
}
},
{
type: types_1.PromptType.INPUT,
name: "flpParametersSemanticObject",
default: (_d = (_c = config.flpConfig) === null || _c === void 0 ? void 0 : _c.semanticObject) !== null && _d !== void 0 ? _d : "",
message: adp_common_1.Messages.SEMANTIC_OBJECT_LABEL,
validate: (value) => (0, validator_1.validateForSpecialCharacters)(value, adp_common_1.Messages.SEMANTIC_OBJECT_LABEL, "^[A-Za-z0-9_]{0,30}$", adp_common_1.Messages.ERROR_INVALID_FLP_ITEM(adp_common_1.Messages.SEMANTIC_OBJECT_LABEL, 30)),
guiOptions: {
hint: adp_common_1.Messages.SEMANTIC_OBJECT_TOOLTIP,
mandatory: true,
breadcrumb: adp_common_1.Messages.SEMANTIC_OBJECT_LABEL
},
when: config.isCloudProject && !config.inboundIds.length
},
{
type: types_1.PromptType.INPUT,
name: "flpParametersAction",
message: adp_common_1.Messages.FLP_ACTION_LABEL,
default: (_f = (_e = config.flpConfig) === null || _e === void 0 ? void 0 : _e.action) !== null && _f !== void 0 ? _f : "",
validate: (value) => (0, validator_1.validateForSpecialCharacters)(value, adp_common_1.Messages.FLP_ACTION_LABEL, "^[A-Za-z0-9_]{1,60}$", adp_common_1.Messages.ERROR_INVALID_FLP_ITEM(adp_common_1.Messages.FLP_ACTION_LABEL, 60)),
guiOptions: {
hint: adp_common_1.Messages.ACTION_TOOLTIP,
mandatory: true,
breadcrumb: adp_common_1.Messages.FLP_ACTION_LABEL
},
when: config.isCloudProject && !config.inboundIds.length
},
{
type: types_1.PromptType.INPUT,
name: "flpTitle",
message: adp_common_1.Messages.FLP_TITLE_LABEL,
default: (_h = (_g = config.flpConfig) === null || _g === void 0 ? void 0 : _g.title) !== null && _h !== void 0 ? _h : "",
guiOptions: {
mandatory: true,
hint: adp_common_1.Messages.FLP_TITLE_INFO,
breadcrumb: adp_common_1.Messages.FLP_TITLE_LABEL
},
when: config.system && config.isCloudProject,
validate: (value) => (0, validator_1.validateEmptyInput)(value, adp_common_1.Messages.FLP_TITLE_LABEL)
},
{
type: types_1.PromptType.INPUT,
name: "flpSubtitle",
message: adp_common_1.Messages.FLP_SUBTITLE_LABEL,
default: (_k = (_j = config.flpConfig) === null || _j === void 0 ? void 0 : _j.subtitle) !== null && _k !== void 0 ? _k : "",
guiOptions: {
hint: adp_common_1.Messages.FLP_SUBTITLE_INFO,
breadcrumb: adp_common_1.Messages.FLP_SUBTITLE_LABEL
},
when: config.system && config.isCloudProject
},
{
type: types_1.PromptType.EDITOR,
name: "flpParameterString",
message: adp_common_1.Messages.FLP_PARAMETERS,
default: (_m = (_l = config.flpConfig) === null || _l === void 0 ? void 0 : _l.parameterString) !== null && _m !== void 0 ? _m : "",
validate: (value) => (0, adp_abap_1.validateFlpParamString)(value),
guiOptions: {
hint: adp_common_1.Messages.PARAMETERS_TOOLTIP,
mandatory: false,
breadcrumb: adp_common_1.Messages.FLP_PARAMETERS
},
when: config.system && config.isCloudProject && config.inboundIds.length === 0
}
];
}
exports.getFlpConfigurationPrompts = getFlpConfigurationPrompts;
//# sourceMappingURL=flp-config.js.map