Skip to content

Commit

Permalink
Merge pull request #3602 from ingef/fix/ftl-imports-render
Browse files Browse the repository at this point in the history
fix render error on admin ui imports
  • Loading branch information
thoniTUB authored Oct 16, 2024
2 parents 64504ca + db90e4e commit 7b9bd0f
Show file tree
Hide file tree
Showing 7 changed files with 141 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,4 @@ tutorial/mimic_iii_demo/data/**
/node_modules
cypress/screenshots/
cypress/videos/
/cypress/support/test_data/table.cqpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@
<#import "templates/breadcrumbs.html.ftl" as breadcrumbs>
<#import "templates/infoCard.html.ftl" as infoCard>
<#import "templates/accordion.html.ftl" as accordion>
<#import "templates/table.html.ftl" as table>
<#import "templates/table.html.ftl" as tableMacro>

<@layout.layout>
<#assign table=c.imp.table.resolve() />
<#assign dataset=c.imp.dataset.resolve() />
<@breadcrumbs.breadcrumbs
labels=["Datasets", c.imp.table.dataset.label, "Tables", c.imp.table.label, "Tags", c.imp.id]
labels=["Datasets", dataset.label, "Tables", table.label, "Tags", c.imp.id]
links=[
"/admin-ui/datasets",
"/admin-ui/datasets/${c.imp.table.dataset.id}",
"/admin-ui/datasets/${c.imp.table.dataset.id}#Tables",
"/admin-ui/datasets/${c.imp.table.dataset.id}/tables/${c.imp.table.id}",
"/admin-ui/datasets/${c.imp.table.dataset.id}/tables/${c.imp.table.id}#Tags"
"/admin-ui/datasets/${c.imp.table.dataset}",
"/admin-ui/datasets/${c.imp.table.dataset}#Tables",
"/admin-ui/datasets/${c.imp.table.dataset}/tables/${c.imp.table}",
"/admin-ui/datasets/${c.imp.table.dataset}/tables/${c.imp.table}#Tags"
]
/>

Expand All @@ -27,7 +29,7 @@
<#assign idHeader="id" />
<#assign sizeHeader="size" />
<#assign typeHeader="type" />
<@table.table
<@tableMacro.table
columns=[idHeader, sizeHeader, typeHeader]
items=c.imp.columns
?map( x ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</tr>
</#if>
<#list items as item>
<tr>
<tr ${(cypressId?has_content && item.id?has_content!false )?then('data-cy='+cypressId+'-'+item.id,'')}>
<#list columns as column>
<#if renderers?keys?seq_contains(column)>
<td scope="row"><@renderers[column] id="${item.id}" /></td>
Expand Down
48 changes: 48 additions & 0 deletions cypress/e2e/backend-admin-ui/test_3_smoketest.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,52 @@ context("Simplest Smoke Tests", () => {
cy.root().should('not.contain.text', 'FreeMarker template error')
});
});

describe("Dataset pages render", () => {

it("Datasets", () => {

visitAdminUI("datasets");

cy.root().should('not.contain.text', 'FreeMarker template error')

cy.get('[data-cy=datasets-dataset1]')
.find('a')
.contains('dataset1')
.click()


cy.get('[data-test-id="accordion-Mappings"]').click()
cy.get('[data-test-id="accordion-SearchIndices"]').click()
cy.get('[data-test-id="accordion-Tables"]').click()
cy.get('[data-test-id="accordion-Concepts"]').click()
cy.get('[data-test-id="accordion-SecondaryIds"]').click()

cy.root().should('not.contain.text', 'FreeMarker template error')

// Table page
cy.get('[data-test-id="accordion-Tables"]')
.find('a')
.contains('table')
.click()

cy.get('[data-test-id="accordion-Tags"]').click()
cy.get('[data-test-id="accordion-Concepts"]').click()
cy.get('[data-test-id="accordion-Columns"]').click()

cy.root().should('not.contain.text', 'FreeMarker template error')

// Import page
cy.get('[data-test-id="accordion-Tags"]')
.find('a')
.contains('table')
.click()

cy.get('[data-test-id="accordion-Columns"]').click()

cy.root().should('not.contain.text', 'FreeMarker template error')


});
});
})
2 changes: 2 additions & 0 deletions cypress/support/test_data/data.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,STRING,INTEGER,BOOLEAN,REAL,DECIMAL,MONEY,DATE,DATE_RANGE
1,abc,1,true,1.1,1.1111111111111111111111111111111,1.11,2023-03-23,2023-03-23/2023-03-25
73 changes: 73 additions & 0 deletions cypress/support/test_data/data.import.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"inputs": [
{
"output": [
{
"inputColumn": "id",
"name": "id",
"inputType": "STRING",
"operation": "COPY"
},
{
"inputColumn": "STRING",
"name": "STRING",
"inputType": "STRING",
"operation": "COPY"
},
{
"inputColumn": "INTEGER",
"name": "INTEGER",
"inputType": "INTEGER",
"operation": "COPY"
},
{
"inputColumn": "BOOLEAN",
"name": "BOOLEAN",
"inputType": "BOOLEAN",
"operation": "COPY"
},
{
"inputColumn": "REAL",
"name": "REAL",
"inputType": "REAL",
"operation": "COPY"
},
{
"inputColumn": "DECIMAL",
"name": "DECIMAL",
"inputType": "DECIMAL",
"operation": "COPY"
},
{
"inputColumn": "MONEY",
"name": "MONEY",
"inputType": "MONEY",
"operation": "COPY"
},
{
"inputColumn": "DATE",
"name": "DATE",
"inputType": "DATE",
"operation": "COPY"
},
{
"inputColumn": "DATE_RANGE",
"name": "DATE_RANGE",
"inputType": "DATE_RANGE",
"operation": "COPY"
}
],
"primary": {
"inputColumn": "id",
"inputType": "STRING",
"name": "id",
"operation": "COPY",
"required": true
},
"sourceFile": "data.csv"
}
],
"label": "table",
"name": "table",
"table": "table"
}
8 changes: 7 additions & 1 deletion scripts/load_e2e_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ until $(curl --output /dev/null --silent --head -H "$h_auth" --fail $admin_api/u
sleep 5
done

# create users
echo "Preprocess test data"
java -jar ./executable/target/executable*.jar preprocess --in cypress/support/test_data/ --out cypress/support/test_data/ --desc cypress/support/test_data/data.import.json

# Create users
echo "Creating users and permissions"
curl --fail -X POST "$admin_api/users/" -H "$h_ct" -H "$h_auth" -d '{"name": "user1", "label": "User1"}'

Expand All @@ -37,4 +40,7 @@ sleep 3
echo "Creating concepts"
curl --fail -X POST "$admin_api/datasets/dataset1/concepts" -H "$h_ct" -H "$h_auth" -d "@./cypress/support/test_data/all_types.concept.json"

echo "Upload test data"
curl --fail -X POST --compressed "$admin_api/datasets/dataset1/cqpp" -H "content-type:application/octet-stream" -H "$h_auth" --data-binary "@./cypress/support/test_data/table.cqpp"

echo "Done loading data"

0 comments on commit 7b9bd0f

Please sign in to comment.