Skip to content

Commit 24076d5

Browse files
05rahulsinghRahul Kumar SinghRahul Kumar Singh
authored
FORMS-16026 AF editor handling for marketo data model (#1439)
* FORMS-16026 adding marketo data model in data model tabs in af editor * FORMS-16026 adding marketo data model in data model tabs in af editor * FORMS-16026 adding marketo data model in data model tabs in af editor * FORMS-16026 adding review comments and demo feedback * FORMS-16026 adding comments * FORMS-16026 adding comments --------- Co-authored-by: Rahul Kumar Singh <rahul@rahuls-mbp-5.corp.adobe.com> Co-authored-by: Rahul Kumar Singh <rahul@Rahuls-MacBook-Pro-5.local>
1 parent 4f485ea commit 24076d5

File tree

7 files changed

+123
-2
lines changed

7 files changed

+123
-2
lines changed

it/content/src/main/content/META-INF/vault/filter.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<filter root="/conf/global/settings/workflow/models/core-component-it-test" mode="update"/>
99
<filter root="/conf/global/settings/forms" mode="update"/>
1010
<filter root="/conf/global/settings/cloudconfigs/edge-delivery-service-configuration" mode="update"/>
11+
<filter root="/conf/global/settings/cloudconfigs/marketo" mode="update"/>
1112
<filter root="/conf/core-components-it" mode="update"/>
1213
<filter root="/conf/wknd" mode="update"/>
1314
<filter root="/conf/datalayerContainer" mode="update"/>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
3+
jcr:primaryType="sling:Folder"/>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
3+
jcr:primaryType="cq:Page">
4+
<jcr:content
5+
jcr:primaryType="cq:PageContent"
6+
jcr:createdBy="admin"
7+
jcr:title="marketoConfig"
8+
client_id="03358092-343f-4fab-8d63-5066419c8122"
9+
munchkinId="123-MKX-123"
10+
access_token_uri="https://123-MKX-123.mktorest.com/identity/oauth/token"
11+
dataSourceType="MARKETO"
12+
jcr:lastModifiedBy="admin"
13+
jcr:created="Mon Oct 07 2024 08:51:27 GMT+0530"
14+
cq:lastModified="Mon Oct 07 2024 08:51:27 GMT+0530"
15+
name="marketoconfig"
16+
sling:resourceSuperType="cq/cloudserviceconfigs/components/configpage"
17+
marketoBaseUrl="123-MKX-123.mktorest.com"
18+
client_secret="\{6f2af59819cbe86da6e55ccbf086572a5b332f9f818aff3736ae7b10919be5786f4411fbda2ae6740f274f073f4e3aacd0c4ebca8fa54bcb10052bd2d3ff15f0}"
19+
grant_type="client_credentials"
20+
redirect_uri="http://localhost:4502/libs/cq/onedrive/content/configurations/wizard.html"
21+
jcr:lastModified="Mon Oct 07 2024 08:51:27 GMT+0530"
22+
oAuthUrl="https://123-MKX-123.mktorest.com/identity"
23+
sling:resourceType="fd/marketo/components/conf/page"
24+
authenticationType="OAuth 2.0"
25+
selectHeader="Authorization Bearer"
26+
cq:lastModifiedBy="admin"/>
27+
</jcr:root>

ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v1/container/clientlibs/editor/js/editDialog.js

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,15 @@
4949
var JSON_SCHEMA = 'jsonschema',
5050
NONE = "none",
5151
FORM_DATA_MODEL = "formdatamodel",
52+
CONNECTOR = "connector",
5253
SCHEMA_REF = "input[name='./schemaRef']",
5354
SCHEMA_TYPE = "input[name='./schemaType']",
5455
SCHEMA_CONTAINER = ".cmp-adaptiveform-container__schemaselectorcontainer",
5556
FDM_CONTAINER = ".cmp-adaptiveform-container__fdmselectorcontainer",
57+
CONNECTOR_CONTAINER = ".cmp-adaptiveform-container__marketoselectorcontainer",
5658
SCHEMA_DROPDOWN_SELECTOR = ".cmp-adaptiveform-container__schemaselector",
5759
FDM_DROPDOWN_SELECTOR = ".cmp-adaptiveform-container__fdmselector",
60+
CONNECTOR_DROPDOWN_SELECTOR = ".cmp-adaptiveform-container__marketoselector",
5861
FORM_MODEL_SELECTOR = ".cmp-adaptiveform-container__selectformmodel",
5962
FM_AF_ROOT = "/content/forms/af/",
6063
FM_DAM_ROOT ="/content/dam/formsanddocuments/",
@@ -138,6 +141,8 @@
138141
$(SCHEMA_DROPDOWN_SELECTOR).val(schemaRef);
139142
} else if (schemaType == FORM_DATA_MODEL) {
140143
$(FDM_DROPDOWN_SELECTOR).val(schemaRef);
144+
} else if (schemaType == CONNECTOR) {
145+
$(CONNECTOR_DROPDOWN_SELECTOR).val(schemaRef);
141146
}
142147
}
143148
};
@@ -172,6 +177,21 @@
172177
}
173178
};
174179

180+
function connectorSelectorOnChanged(dialog) {
181+
var selectedSchema = dialog.find(CONNECTOR_DROPDOWN_SELECTOR);
182+
if(selectedSchema.length > 0) {
183+
selectedSchema = selectedSchema[0].value;
184+
setElementValue(dialog, SCHEMA_REF, selectedSchema);
185+
setElementValue(dialog, DAM_SCHEMA_REF, selectedSchema);
186+
isSchemaChanged = true;
187+
if (configuredFormModel) {
188+
confirmFormModelChange(selectedSchema, $(CONNECTOR_DROPDOWN_SELECTOR));
189+
} else {
190+
toBeConfiguredFormModel = selectedSchema;
191+
}
192+
}
193+
};
194+
175195
function setElementValue(dialog, elementRef, value){
176196
var element = dialog.find(elementRef);
177197
if(element.length > 0){
@@ -205,12 +225,19 @@
205225
function hideContainersExcept(selectedSchemaType) {
206226
if (selectedSchemaType == JSON_SCHEMA) {
207227
$(FDM_CONTAINER).hide();
228+
$(CONNECTOR_CONTAINER).hide();
208229
$(SCHEMA_CONTAINER).show();
209230
} else if (selectedSchemaType == FORM_DATA_MODEL) {
210231
$(SCHEMA_CONTAINER).hide();
232+
$(CONNECTOR_CONTAINER).hide();
211233
$(FDM_CONTAINER).show();
234+
} else if (selectedSchemaType == CONNECTOR) {
235+
$(SCHEMA_CONTAINER).hide();
236+
$(FDM_CONTAINER).hide();
237+
$(CONNECTOR_CONTAINER).show();
212238
} else if (selectedSchemaType == 'none') {
213239
$(FDM_CONTAINER).hide();
240+
$(CONNECTOR_CONTAINER).hide();
214241
$(SCHEMA_CONTAINER).hide();
215242
}
216243
};
@@ -238,7 +265,8 @@
238265
function initialiseDataModel(dialog) {
239266
var formModelSelector = dialog.find(FORM_MODEL_SELECTOR)[0],
240267
schemaSelector = dialog.find(SCHEMA_DROPDOWN_SELECTOR)[0],
241-
fdmSelector = dialog.find(FDM_DROPDOWN_SELECTOR)[0];
268+
fdmSelector = dialog.find(FDM_DROPDOWN_SELECTOR)[0],
269+
connectorSelector = dialog.find(CONNECTOR_DROPDOWN_SELECTOR)[0];
242270
if (formModelSelector) {
243271
formModelSelector.on("change", function() {
244272
selectFormModelOnChanged(dialog);
@@ -254,6 +282,11 @@
254282
fdmSelectorOnChanged(dialog);
255283
});
256284
};
285+
if (connectorSelector) {
286+
connectorSelector.on("change", function() {
287+
connectorSelectorOnChanged(dialog);
288+
});
289+
};
257290
selectFormModelOnLoad(dialog);
258291
}
259292

ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/_cq_dialog/.content.xml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,14 @@
120120
jcr:primaryType="nt:unstructured"
121121
text="Form Data Model"
122122
value="formdatamodel"/>
123+
<optionConnectormodel
124+
jcr:primaryType="nt:unstructured"
125+
text="Connector"
126+
value="connector">
127+
<granite:rendercondition
128+
jcr:primaryType="nt:unstructured"
129+
sling:resourceType="/libs/fd/af/connectors/rendercondition/marketo"/>
130+
</optionConnectormodel>
123131
</items>
124132
</selectformmodel>
125133
<schemaRef name="./schemaRef"
@@ -169,6 +177,28 @@
169177
</fdmselector>
170178
</items>
171179
</fdmselectorcontainer>
180+
<marketoselectorcontainer
181+
jcr:primaryType="nt:unstructured"
182+
sling:resourceType="granite/ui/components/coral/foundation/container"
183+
granite:class="cmp-adaptiveform-container__marketoselectorcontainer">
184+
<items jcr:primaryType="nt:unstructured">
185+
<marketoselector
186+
granite:class="cmp-adaptiveform-container__marketoselector"
187+
jcr:primaryType="nt:unstructured"
188+
sling:resourceType="granite/ui/components/coral/foundation/form/select"
189+
disabled="false"
190+
fieldLabel="Select Connector Configuration *"
191+
validation="datamodel.config"
192+
renderReadOnly="false">
193+
<datasource
194+
jcr:primaryType="nt:unstructured"
195+
sling:resourceType="fd/af/components/commons/datasources/propertyprovider"
196+
guideDataModel="basic"
197+
layoutType="fd/af/layouts/panel"
198+
type="connector"/>
199+
</marketoselector>
200+
</items>
201+
</marketoselectorcontainer>
172202
<formmodelparameters
173203
granite:id="formmodelparameters"
174204
jcr:primaryType="nt:unstructured"

ui.tests/test-module/cypress.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ module.exports = defineConfig({
4141
specPattern: 'specs/**/*.cy.{js,jsx,ts,tsx}',
4242
supportFile: 'libs/support/index.js',
4343
},
44-
});
44+
});

ui.tests/test-module/specs/formcontainer.cy.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,27 @@ describe('Page/Form Authoring', function () {
171171
cy.get(".cq-dialog-submit").click();
172172
};
173173

174+
const verifyChangeDataModelToMarketo = function(formContainerEditPathSelector) {
175+
// click configure action on adaptive form container component
176+
cy.openEditableToolbar(sitesSelectors.overlays.overlay.component + formContainerEditPathSelector);
177+
cy.invokeEditableAction("[data-action='CONFIGURE']"); // this line is causing frame busting which is causing cypress to fail
178+
179+
//open data model tab
180+
cy.get('.cmp-adaptiveform-container'+'__editdialog').contains('Data Model').click({force:true});
181+
182+
//select marketo data model
183+
cy.get(".cmp-adaptiveform-container__selectformmodel").click();
184+
cy.get("coral-selectlist-item[value='none']").contains('None').should('exist');
185+
cy.get("coral-selectlist-item[value='connector']").contains('Marketo Configuration').should('be.visible').click();
186+
187+
//select marketo config
188+
cy.get(".cmp-adaptiveform-container__marketoselector").click();
189+
cy.get("coral-selectlist-item[value='/conf/global/settings/cloudconfigs/marketo/marketoconfig']").contains('marketoconfig').should('be.visible').click();
190+
cy.get("#formModelChange").should("be.visible");
191+
cy.get("#formModelDialogAcceptButton").click();
192+
cy.get(".cq-dialog-submit").click();
193+
};
194+
174195
context("Open Forms Editor", function () {
175196
// we can use these values to log in
176197
const pagePath = "/content/forms/af/core-components-it/blank",
@@ -205,6 +226,12 @@ describe('Page/Form Authoring', function () {
205226
verifyChangeDataModel(formContainerEditPathSelector);
206227
});
207228

229+
it('change data model to marketo in container edit dialog box', {retries: 3},function () {
230+
if (cy.af.isLatestAddon() && toggle_array.includes("FT_FORMS-9611")) {
231+
verifyChangeDataModelToMarketo(formContainerEditPathSelector);
232+
}
233+
});
234+
208235
it ('check title in edit dialog', {retries: 3}, function() {
209236
checkTitleInEditDialog(formContainerEditPathSelector);
210237
cy.get('.cq-dialog-cancel').click();

0 commit comments

Comments
 (0)