From a2a601244d9a8df8132ad8f75f4b1bf7a594b43f Mon Sep 17 00:00:00 2001 From: Bill Smith Date: Wed, 7 Aug 2019 14:05:01 -0700 Subject: [PATCH 01/11] SHIBUI-1392 Added test to check for Script filter type functionality. --- .../admin/ui/SeleniumSIDETest.groovy | 1 + .../integration/resources/SHIBUI-1392.side | 468 ++++++++++++++++++ 2 files changed, 469 insertions(+) create mode 100644 backend/src/integration/resources/SHIBUI-1392.side diff --git a/backend/src/integration/groovy/edu/internet2/tier/shibboleth/admin/ui/SeleniumSIDETest.groovy b/backend/src/integration/groovy/edu/internet2/tier/shibboleth/admin/ui/SeleniumSIDETest.groovy index b96f4c476..e61c9dc26 100644 --- a/backend/src/integration/groovy/edu/internet2/tier/shibboleth/admin/ui/SeleniumSIDETest.groovy +++ b/backend/src/integration/groovy/edu/internet2/tier/shibboleth/admin/ui/SeleniumSIDETest.groovy @@ -118,6 +118,7 @@ class SeleniumSIDETest extends Specification { 'SHIBUI-1335: Verify Filesystem Metadata Provider Filters' | '/SHIBUI-1335-2.side' 'SHIBUI-1335: Verify Local Dynamic Metadata Provider Filters' | '/SHIBUI-1335-3.side' 'SHIBUI-1335: Verify Dynamic HTTP Metadata Provider Filters' | '/SHIBUI-1335-4.side' + 'SHIBUI-1392: Verify provider with script filter is persistable' | '/SHIBUI-1392.side' } } diff --git a/backend/src/integration/resources/SHIBUI-1392.side b/backend/src/integration/resources/SHIBUI-1392.side new file mode 100644 index 000000000..8a2bf4d1b --- /dev/null +++ b/backend/src/integration/resources/SHIBUI-1392.side @@ -0,0 +1,468 @@ +{ + "id": "4e005712-0763-4f93-9934-d44663672a48", + "version": "2.0", + "name": "SHIBUI-1392", + "url": "http://localhost:10101", + "tests": [{ + "id": "d35b1f2b-5534-4ddb-9b37-1cc7b809ec9f", + "name": "SHIBUI-1392", + "commands": [{ + "id": "0c418562-dd1c-4727-a304-3f8977acc29f", + "comment": "", + "command": "open", + "target": "/login", + "targets": [], + "value": "" + }, { + "id": "0b42793e-c9ac-47fc-ab89-5996c89eb3d7", + "comment": "", + "command": "type", + "target": "name=username", + "targets": [ + ["name=username", "name"], + ["css=tr:nth-child(1) input", "css:finder"], + ["xpath=//input[@name='username']", "xpath:attributes"], + ["xpath=//input", "xpath:position"] + ], + "value": "admin" + }, { + "id": "ae4326d2-6db3-425e-8cec-3e8d95cef71c", + "comment": "", + "command": "type", + "target": "name=password", + "targets": [ + ["name=password", "name"], + ["css=tr:nth-child(2) input", "css:finder"], + ["xpath=//input[@name='password']", "xpath:attributes"], + ["xpath=//tr[2]/td[2]/input", "xpath:position"] + ], + "value": "adminpass" + }, { + "id": "993b1b6d-5eac-426c-b6fe-89cef25ebc91", + "comment": "", + "command": "click", + "target": "name=submit", + "targets": [ + ["name=submit", "name"], + ["css=td:nth-child(1) > input", "css:finder"], + ["xpath=//input[@name='submit']", "xpath:attributes"], + ["xpath=//tr[3]/td/input", "xpath:position"] + ], + "value": "" + }, { + "id": "db2bbd13-3808-4b40-a236-3fe82c1afece", + "comment": "", + "command": "click", + "target": "css=#addNewDropdown", + "targets": [ + ["css=#addNewDropdown > translate-i18n", "css:finder"], + ["xpath=//button[@id='addNewDropdown']/translate-i18n", "xpath:idRelative"], + ["xpath=//translate-i18n", "xpath:position"], + ["xpath=//translate-i18n[contains(.,'Add New')]", "xpath:innerText"] + ], + "value": "" + }, { + "id": "32133aaa-76a4-4dd4-8ee6-a9fc5af25ded", + "comment": "", + "command": "click", + "target": "linkText=Metadata Provider", + "targets": [ + ["linkText=Metadata Provider", "linkText"], + ["css=.nav-link:nth-child(2)", "css:finder"], + ["xpath=//div[@id='navbar']/ul/li/div/a[2]", "xpath:idRelative"], + ["xpath=(//a[contains(@href, '')])[3]", "xpath:href"], + ["xpath=//a[2]", "xpath:position"] + ], + "value": "" + }, { + "id": "ea32c92b-9487-499a-8f7a-242ab6fd196f", + "comment": "", + "command": "waitForElementEditable", + "target": "id=/name", + "targets": [], + "value": "10000" + }, { + "id": "845b34e9-fd90-45de-a38a-469405915292", + "comment": "", + "command": "type", + "target": "id=/name", + "targets": [ + ["id=/name", "id"], + ["name=field1", "name"], + ["css=#\\/name", "css:finder"], + ["xpath=//input[@id='/name']", "xpath:attributes"], + ["xpath=//input", "xpath:position"] + ], + "value": "Test Provider with Script Filter" + }, { + "id": "6daa658d-2560-4448-a522-233ed88e1ad0", + "comment": "", + "command": "select", + "target": "id=/type", + "targets": [], + "value": "label=DynamicHttpMetadataProvider" + }, { + "id": "fb561471-270c-4633-8fe9-ad457ef38459", + "comment": "", + "command": "click", + "target": "css=.next", + "targets": [ + ["css=.next", "css:finder"], + ["xpath=//li[2]/button", "xpath:position"] + ], + "value": "" + }, { + "id": "ba2c6633-3813-42e4-95fc-b1b22da875fa", + "comment": "", + "command": "waitForElementEditable", + "target": "id=/xmlId", + "targets": [], + "value": "10000" + }, { + "id": "09c4adf4-0142-4931-8ffc-ff6ff821e78e", + "comment": "", + "command": "type", + "target": "id=/xmlId", + "targets": [ + ["id=/xmlId", "id"], + ["name=field7", "name"], + ["css=#\\/xmlId", "css:finder"], + ["xpath=//input[@id='/xmlId']", "xpath:attributes"], + ["xpath=//input", "xpath:position"] + ], + "value": "12345" + }, { + "id": "b18627a3-0487-42c0-b3bb-44aa53da8ba3", + "comment": "", + "command": "select", + "target": "id=/metadataRequestURLConstructionScheme/type", + "targets": [], + "value": "label=MetadataQueryProtocol" + }, { + "id": "6548ef95-6862-49ce-82e0-024502aeb9eb", + "comment": "", + "command": "click", + "target": "css=option:nth-child(2)", + "targets": [ + ["css=option:nth-child(2)", "css:finder"], + ["xpath=//option[@value='1: MetadataQueryProtocol']", "xpath:attributes"], + ["xpath=//select[@id='/metadataRequestURLConstructionScheme/type']/option[2]", "xpath:idRelative"], + ["xpath=//option[2]", "xpath:position"], + ["xpath=//option[contains(.,'MetadataQueryProtocol')]", "xpath:innerText"] + ], + "value": "" + }, { + "id": "33263ebe-368a-4804-acb5-8324b822f3ea", + "comment": "", + "command": "click", + "target": "id=/metadataRequestURLConstructionScheme/content", + "targets": [ + ["id=/metadataRequestURLConstructionScheme/content", "id"], + ["name=field10", "name"], + ["css=#\\/metadataRequestURLConstructionScheme\\/content", "css:finder"], + ["xpath=//input[@id='/metadataRequestURLConstructionScheme/content']", "xpath:attributes"], + ["xpath=//div[2]/sf-form-element/div/sf-widget-chooser/custom-string/div/input", "xpath:position"] + ], + "value": "" + }, { + "id": "99061d82-049c-40cc-a7d8-98d792061daf", + "comment": "", + "command": "type", + "target": "id=/metadataRequestURLConstructionScheme/content", + "targets": [ + ["id=/metadataRequestURLConstructionScheme/content", "id"], + ["name=field10", "name"], + ["css=#\\/metadataRequestURLConstructionScheme\\/content", "css:finder"], + ["xpath=//input[@id='/metadataRequestURLConstructionScheme/content']", "xpath:attributes"], + ["xpath=//div[2]/sf-form-element/div/sf-widget-chooser/custom-string/div/input", "xpath:position"] + ], + "value": "someString" + }, { + "id": "e771b05f-e720-40e9-8c8c-c9f65725e34c", + "comment": "", + "command": "click", + "target": "css=div:nth-child(4) .form-check:nth-child(4) > .control-label", + "targets": [ + ["css=div:nth-child(4) .form-check:nth-child(4) > .control-label", "css:finder"], + ["xpath=//div[4]/sf-form-element/div/sf-widget-chooser/boolean-radio/div/div[2]/label", "xpath:position"] + ], + "value": "" + }, { + "id": "c2af34fb-1edd-4824-bc7a-b0232dcbe841", + "comment": "", + "command": "click", + "target": "id=/requireValidMetadata.false", + "targets": [ + ["id=/requireValidMetadata.false", "id"], + ["css=#\\/requireValidMetadata\\.false", "css:finder"], + ["xpath=//input[@id='/requireValidMetadata.false']", "xpath:attributes"], + ["xpath=//div[2]/label/input", "xpath:position"] + ], + "value": "" + }, { + "id": "9c8db077-8e61-40db-96ca-e19dd43132ba", + "comment": "", + "command": "click", + "target": "css=.label:nth-child(1)", + "targets": [ + ["css=.label:nth-child(1)", "css:finder"], + ["xpath=//li[3]/button/span", "xpath:position"] + ], + "value": "" + }, { + "id": "f0b9d3be-705a-4811-8651-d1bba323afd0", + "comment": "", + "command": "click", + "target": "css=.next", + "targets": [ + ["css=.next", "css:finder"], + ["xpath=//li[3]/button", "xpath:position"] + ], + "value": "" + }, { + "id": "e84a4b1e-9e16-4c0f-ba21-5edaac18011e", + "comment": "", + "command": "click", + "target": "css=#\\/metadataFilters\\/SignatureValidation\\/requireSignedRoot\\.parent > .custom-control-label", + "targets": [ + ["css=#\\/metadataFilters\\/SignatureValidation\\/requireSignedRoot\\.parent > .custom-control-label", "css:finder"], + ["xpath=//div[@id='/metadataFilters/SignatureValidation/requireSignedRoot.parent']/label", "xpath:idRelative"], + ["xpath=//div/div/label", "xpath:position"], + ["xpath=//label[contains(.,'Require Signed Root')]", "xpath:innerText"] + ], + "value": "" + }, { + "id": "45e080c0-8ea2-4641-951b-aa819d5b9d64", + "comment": "", + "command": "click", + "target": "css=.next", + "targets": [ + ["css=.next", "css:finder"], + ["xpath=//li[3]/button", "xpath:position"] + ], + "value": "" + }, { + "id": "cce4434c-9723-4ecb-832d-2e200aefe7e1", + "comment": "", + "command": "click", + "target": "css=.custom-control-label", + "targets": [ + ["css=.custom-control-label", "css:finder"], + ["xpath=//div[@id='/enabled.parent']/label", "xpath:idRelative"], + ["xpath=//label", "xpath:position"], + ["xpath=//label[contains(.,'Enable Metadata Provider?')]", "xpath:innerText"] + ], + "value": "" + }, { + "id": "542d9338-36f9-4922-89c2-7109c2d288e0", + "comment": "", + "command": "click", + "target": "css=.save", + "targets": [ + ["css=.save", "css:finder"], + ["xpath=//li[3]/button", "xpath:position"] + ], + "value": "" + }, { + "id": "1566f2a0-790c-4594-806c-7dd6c9c47143", + "comment": "", + "command": "click", + "target": "linkText=Test Provider with Script Filter", + "targets": [ + ["linkText=Test Provider with Script Filter", "linkText"], + ["css=td > a", "css:finder"], + ["xpath=//a[contains(text(),'Test Provider with Script Filter')]", "xpath:link"], + ["xpath=//a[contains(@href, '/metadata/provider/194c05bb-df26-4fd3-b970-ca30f8855e0b/configuration/options')]", "xpath:href"], + ["xpath=//td[2]/a", "xpath:position"], + ["xpath=//a[contains(.,'Test Provider with Script Filter')]", "xpath:innerText"] + ], + "value": "" + }, { + "id": "3b38c153-5b8d-4a3c-a8c2-f089d86e2ae3", + "comment": "", + "command": "click", + "target": "css=#filters .actions span", + "targets": [ + ["css=#filters .actions span", "css:finder"], + ["xpath=//div[@id='filters']/div/div/a/span", "xpath:idRelative"], + ["xpath=//div/a/span", "xpath:position"], + ["xpath=//span[contains(.,'Add Filter')]", "xpath:innerText"] + ], + "value": "" + }, { + "id": "2a2922be-ca4d-4b85-9656-2e6813152ccc", + "comment": "", + "command": "select", + "target": "name=type", + "targets": [], + "value": "label=NameIDFormat" + }, { + "id": "b32ea0ea-16ea-472a-bd28-09082ef35ca5", + "comment": "", + "command": "click", + "target": "id=/name", + "targets": [ + ["id=/name", "id"], + ["name=field38", "name"], + ["css=#\\/name", "css:finder"], + ["xpath=//input[@id='/name']", "xpath:attributes"], + ["xpath=//input", "xpath:position"] + ], + "value": "" + }, { + "id": "62e1fdf7-cfb5-4175-8b75-6d2ca52e73f2", + "comment": "", + "command": "type", + "target": "id=/name", + "targets": [ + ["id=/name", "id"], + ["name=field38", "name"], + ["css=#\\/name", "css:finder"], + ["xpath=//input[@id='/name']", "xpath:attributes"], + ["xpath=//input", "xpath:position"] + ], + "value": "Filter with Script" + }, { + "id": "c92e936c-d516-472f-9f28-36de89117e14", + "comment": "", + "command": "click", + "target": "id=/nameIdFormatFilterTarget.valuedd", + "targets": [ + ["id=/nameIdFormatFilterTarget.valuedd", "id"], + ["css=#\\/nameIdFormatFilterTarget\\.valuedd", "css:finder"], + ["xpath=//button[@id='/nameIdFormatFilterTarget.valuedd']", "xpath:attributes"], + ["xpath=//fieldset/div/div/div/div/button", "xpath:position"], + ["xpath=//button[contains(.,'Entity ID')]", "xpath:innerText"] + ], + "value": "" + }, { + "id": "5699a5a2-d3df-4f99-b95d-f340f9156ffe", + "comment": "", + "command": "click", + "target": "linkText=Script", + "targets": [ + ["linkText=Script", "linkText"], + ["css=.dropdown-item:nth-child(3)", "css:finder"], + ["xpath=//a[contains(text(),'Script')]", "xpath:link"], + ["xpath=(//a[contains(@href, '#')])[3]", "xpath:href"], + ["xpath=//a[3]", "xpath:position"], + ["xpath=//a[contains(.,'Script')]", "xpath:innerText"] + ], + "value": "" + }, { + "id": "dcf31546-0976-44ae-9ffc-c29a5255d646", + "comment": "", + "command": "click", + "target": "id=/nameIdFormatFilterTarget.target", + "targets": [ + ["id=/nameIdFormatFilterTarget.target", "id"], + ["css=#\\/nameIdFormatFilterTarget\\.target", "css:finder"], + ["xpath=//p[@id='/nameIdFormatFilterTarget.target']", "xpath:attributes"], + ["xpath=//p", "xpath:position"] + ], + "value": "" + }, { + "id": "84be6a98-5739-42e8-b7ca-06a6c86e9f40", + "comment": "", + "command": "editContent", + "target": "id=/nameIdFormatFilterTarget.target", + "targets": [ + ["id=/nameIdFormatFilterTarget.target", "id"], + ["css=#\\/nameIdFormatFilterTarget\\.target", "css:finder"], + ["xpath=//p[@id='/nameIdFormatFilterTarget.target']", "xpath:attributes"], + ["xpath=//p", "xpath:position"], + ["xpath=//p[contains(.,'eval(true)')]", "xpath:innerText"] + ], + "value": "eval(true)" + }, { + "id": "05870356-d3db-4540-bb3f-db34b1cf65f1", + "comment": "", + "command": "sendKeys", + "target": "id=/nameIdFormatFilterTarget.target", + "targets": [], + "value": ";" + }, { + "id": "b544a0b1-fc04-4dc3-8a11-5769500e5503", + "comment": "", + "command": "click", + "target": "css=#\\/filterEnabled\\.parent > .custom-control-label", + "targets": [ + ["css=#\\/filterEnabled\\.parent > .custom-control-label", "css:finder"], + ["xpath=//div[@id='/filterEnabled.parent']/label", "xpath:idRelative"], + ["xpath=//checkbox-component/div/div/div/label", "xpath:position"], + ["xpath=//label[contains(.,'Enable Filter?')]", "xpath:innerText"] + ], + "value": "" + }, { + "id": "07ddc80d-1df7-43d3-adf9-a75a2a1348bc", + "comment": "", + "command": "click", + "target": "css=.btn-primary", + "targets": [ + ["css=.btn-primary", "css:finder"], + ["xpath=//button[@type='submit']", "xpath:attributes"], + ["xpath=//div/button", "xpath:position"], + ["xpath=//button[contains(.,'Save')]", "xpath:innerText"] + ], + "value": "" + }, { + "id": "c51608a2-5e1a-4f70-8856-cbef5eb588ed", + "comment": "", + "command": "waitForElementVisible", + "target": "css=.td-lg:nth-child(4)", + "targets": [], + "value": "10000" + }, { + "id": "83f6f403-40b0-4f12-82e2-a14e301dd7ff", + "comment": "", + "command": "verifyText", + "target": "css=.td-lg:nth-child(4)", + "targets": [ + ["css=.td-lg:nth-child(4)", "css:finder"], + ["xpath=//td[4]", "xpath:position"], + ["xpath=//td[contains(.,'NameIDFormat')]", "xpath:innerText"] + ], + "value": "NameIDFormat" + }, { + "id": "1b449f50-1c54-41a0-a50b-65364340b7d2", + "comment": "", + "command": "click", + "target": "css=.fa-edit", + "targets": [ + ["css=.fa-edit", "css:finder"], + ["xpath=//td[6]/a/i", "xpath:position"] + ], + "value": "" + }, { + "id": "ad613704-0718-4b83-97f1-b49897f510eb", + "comment": "", + "command": "waitForElementEditable", + "target": "id=/nameIdFormatFilterTarget.target", + "targets": [], + "value": "10000" + }, { + "id": "6762fdb2-6744-4238-a2df-d529ab3b6102", + "comment": "", + "command": "verifyText", + "target": "id=/nameIdFormatFilterTarget.target", + "targets": [ + ["id=/nameIdFormatFilterTarget.target", "id"], + ["css=#\\/nameIdFormatFilterTarget\\.target", "css:finder"], + ["xpath=//p[@id='/nameIdFormatFilterTarget.target']", "xpath:attributes"], + ["xpath=//p", "xpath:position"], + ["xpath=//p[contains(.,'eval(true)')]", "xpath:innerText"] + ], + "value": "eval(true)" + }] + }], + "suites": [{ + "id": "4f69a686-bcaa-4963-84af-2e592e8c8842", + "name": "Default Suite", + "persistSession": false, + "parallel": false, + "timeout": 300, + "tests": ["d35b1f2b-5534-4ddb-9b37-1cc7b809ec9f"] + }], + "urls": ["http://localhost:10101/"], + "plugins": [] +} \ No newline at end of file From 0283c5f2695273d5645bbe14d1bec39f9b04bb56 Mon Sep 17 00:00:00 2001 From: Ryan Mathis Date: Thu, 8 Aug 2019 12:44:42 -0700 Subject: [PATCH 02/11] SHIBUI-1392 Fixed metadata header --- .../configuration/component/metadata-header.component.html | 2 +- .../configuration/component/metadata-header.component.ts | 4 ++++ .../metadata/provider/model/file-backed-http.provider.form.ts | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ui/src/app/metadata/configuration/component/metadata-header.component.html b/ui/src/app/metadata/configuration/component/metadata-header.component.html index 64a1a2a2c..9041ae00e 100644 --- a/ui/src/app/metadata/configuration/component/metadata-header.component.html +++ b/ui/src/app/metadata/configuration/component/metadata-header.component.html @@ -2,7 +2,7 @@
Saved:  - {{ version.date | date:'medium' }} + {{ version.date | date:DATE_FORMAT }}
By{{ version.creator }} diff --git a/ui/src/app/metadata/configuration/component/metadata-header.component.ts b/ui/src/app/metadata/configuration/component/metadata-header.component.ts index 8d0dcc3db..590be316e 100644 --- a/ui/src/app/metadata/configuration/component/metadata-header.component.ts +++ b/ui/src/app/metadata/configuration/component/metadata-header.component.ts @@ -2,6 +2,8 @@ import { Component, Input } from '@angular/core'; import { Metadata, MetadataTypes } from '../../domain/domain.type'; import { MetadataVersion } from '../model/version'; +import { CONFIG_DATE_FORMAT } from '../configuration.values'; + @Component({ selector: 'metadata-header', templateUrl: './metadata-header.component.html', @@ -14,6 +16,8 @@ export class MetadataHeaderComponent { @Input() versionNumber: number; @Input() isCurrent: boolean; + DATE_FORMAT = CONFIG_DATE_FORMAT; + constructor() {} } diff --git a/ui/src/app/metadata/provider/model/file-backed-http.provider.form.ts b/ui/src/app/metadata/provider/model/file-backed-http.provider.form.ts index 0df10c0ea..228feab69 100644 --- a/ui/src/app/metadata/provider/model/file-backed-http.provider.form.ts +++ b/ui/src/app/metadata/provider/model/file-backed-http.provider.form.ts @@ -100,6 +100,8 @@ export const FileBackedHttpMetadataProviderEditor: Wizard Date: Tue, 13 Aug 2019 15:40:47 -0700 Subject: [PATCH 03/11] SHIBUI-1392 Updated various scripts in an attempt to fix intermitten failures. --- .../integration/resources/SHIBUI-1335-1.side | 33 ++++++++++++++----- .../integration/resources/SHIBUI-1335-2.side | 13 ++++++-- .../integration/resources/SHIBUI-1335-3.side | 13 ++++++-- .../integration/resources/SHIBUI-1335-4.side | 22 ++++++++++--- .../integration/resources/SHIBUI-1392.side | 33 ++++++++++++------- 5 files changed, 85 insertions(+), 29 deletions(-) diff --git a/backend/src/integration/resources/SHIBUI-1335-1.side b/backend/src/integration/resources/SHIBUI-1335-1.side index 1af0bba89..f38eac2ce 100644 --- a/backend/src/integration/resources/SHIBUI-1335-1.side +++ b/backend/src/integration/resources/SHIBUI-1335-1.side @@ -117,6 +117,13 @@ ["xpath=//li[2]/button", "xpath:position"] ], "value": "" + }, { + "id": "352f066f-c2af-4735-81b1-5440ba7a3432", + "comment": "", + "command": "waitForElementVisible", + "target": "id=/xmlId", + "targets": [], + "value": "10000" }, { "id": "e7462621-f4e4-4512-b200-20afa5685fc6", "comment": "", @@ -1352,14 +1359,10 @@ }, { "id": "c28d683a-552d-4752-aa89-465e33d60887", "comment": "", - "command": "waitForElementVisible", - "target": "css=tr:nth-child(2) > .td-lg:nth-child(4)", - "targets": [ - ["css=tr:nth-child(2) > .td-lg:nth-child(4)", "css:finder"], - ["xpath=//tr[2]/td[4]", "xpath:position"], - ["xpath=//td[contains(.,'NameIDFormat')]", "xpath:innerText"] - ], - "value": "10000" + "command": "pause", + "target": "2000", + "targets": [], + "value": "" }, { "id": "100902ee-6d6e-4148-a69b-b37746a4ad6e", "comment": "", @@ -1381,6 +1384,13 @@ ["xpath=//button[2]/i", "xpath:position"] ], "value": "" + }, { + "id": "febfcea8-8f72-4a17-b1a8-b1e323c8cced", + "comment": "", + "command": "pause", + "target": "2000", + "targets": [], + "value": "" }, { "id": "c9d498da-9f59-40ae-b5d4-cae397a13766", "comment": "", @@ -1402,6 +1412,13 @@ ["xpath=//button[2]/i", "xpath:position"] ], "value": "" + }, { + "id": "4fdc2334-0b93-4f4c-b44e-80656f808f6d", + "comment": "", + "command": "pause", + "target": "2000", + "targets": [], + "value": "" }, { "id": "441608df-24a3-4a60-bfce-50a90ff0ee16", "comment": "", diff --git a/backend/src/integration/resources/SHIBUI-1335-2.side b/backend/src/integration/resources/SHIBUI-1335-2.side index 3a1c51b24..88ef75013 100644 --- a/backend/src/integration/resources/SHIBUI-1335-2.side +++ b/backend/src/integration/resources/SHIBUI-1335-2.side @@ -691,10 +691,10 @@ }, { "id": "eca1d3dd-9e47-49d2-b4a1-a45c2b6c8c3a", "comment": "", - "command": "waitForElementVisible", - "target": "css=tr:nth-child(1) > .td-lg:nth-child(4)", + "command": "pause", + "target": "2000", "targets": [], - "value": "10000" + "value": "" }, { "id": "d722902b-5c10-45dc-99df-d96f46e78313", "comment": "", @@ -716,6 +716,13 @@ ["xpath=//button[2]/i", "xpath:position"] ], "value": "" + }, { + "id": "d25400e1-127e-4b8c-b7e2-ade937cfd5a0", + "comment": "", + "command": "pause", + "target": "2000", + "targets": [], + "value": "" }, { "id": "d7909094-96ce-4532-98b4-446cc013c9c8", "comment": "", diff --git a/backend/src/integration/resources/SHIBUI-1335-3.side b/backend/src/integration/resources/SHIBUI-1335-3.side index f85088621..865b8aa0e 100644 --- a/backend/src/integration/resources/SHIBUI-1335-3.side +++ b/backend/src/integration/resources/SHIBUI-1335-3.side @@ -785,10 +785,10 @@ }, { "id": "455e24c1-5093-4da3-a62d-457bbf0cd5db", "comment": "", - "command": "waitForElementVisible", - "target": "css=tr:nth-child(2) > .td-lg:nth-child(4)", + "command": "pause", + "target": "2000", "targets": [], - "value": "10000" + "value": "" }, { "id": "9f7e95cf-4dd5-415f-8577-a6f1bc54a85d", "comment": "", @@ -810,6 +810,13 @@ ["xpath=//td[contains(.,'NameIDFormat')]", "xpath:innerText"] ], "value": "NameIDFormat" + }, { + "id": "81970d9d-2892-4b42-ba56-ba1a14f453d2", + "comment": "", + "command": "pause", + "target": "2000", + "targets": [], + "value": "" }, { "id": "63ac7307-0538-4c0d-8e98-2f05c767baaf", "comment": "", diff --git a/backend/src/integration/resources/SHIBUI-1335-4.side b/backend/src/integration/resources/SHIBUI-1335-4.side index 8ffe35e98..e20483cf2 100644 --- a/backend/src/integration/resources/SHIBUI-1335-4.side +++ b/backend/src/integration/resources/SHIBUI-1335-4.side @@ -914,7 +914,7 @@ "id": "77dfeb05-38e3-4ef8-9566-06e7597d464c", "comment": "", "command": "click", - "target": "css=.btn-primary > translate-i18n", + "target": "css=.btn-primary", "targets": [ ["css=.btn-primary > translate-i18n", "css:finder"], ["xpath=//div/button/translate-i18n", "xpath:position"], @@ -924,10 +924,10 @@ }, { "id": "f79371b5-0081-45a0-bfb3-c403db903043", "comment": "", - "command": "waitForElementVisible", - "target": "css=tr:nth-child(1) > .td-lg:nth-child(4)", + "command": "pause", + "target": "2000", "targets": [], - "value": "10000" + "value": "" }, { "id": "a8ed628c-53f7-4551-9ce8-fef976cc96ce", "comment": "", @@ -938,6 +938,13 @@ ["xpath=//button[2]/i", "xpath:position"] ], "value": "" + }, { + "id": "6b3ec8f1-8b9a-40f5-816f-3a1e415b9d8d", + "comment": "", + "command": "pause", + "target": "2000", + "targets": [], + "value": "" }, { "id": "be805934-2692-4a1c-a28f-afb3cc4eb5f4", "comment": "", @@ -959,6 +966,13 @@ ["xpath=//button[2]/i", "xpath:position"] ], "value": "" + }, { + "id": "403570ff-e1f0-4db9-925f-f90c5994b60e", + "comment": "", + "command": "pause", + "target": "2000", + "targets": [], + "value": "" }, { "id": "8f2da627-e8ad-473a-a71a-bec5dd1f0999", "comment": "", diff --git a/backend/src/integration/resources/SHIBUI-1392.side b/backend/src/integration/resources/SHIBUI-1392.side index 8a2bf4d1b..a0a5b5b55 100644 --- a/backend/src/integration/resources/SHIBUI-1392.side +++ b/backend/src/integration/resources/SHIBUI-1392.side @@ -349,6 +349,13 @@ ["xpath=//a[contains(.,'Script')]", "xpath:innerText"] ], "value": "" + }, { + "id": "786cd3cb-46b2-4361-b449-8f679ff97135", + "comment": "", + "command": "waitForElementPresent", + "target": "id=/nameIdFormatFilterTarget.target", + "targets": [], + "value": "10000" }, { "id": "dcf31546-0976-44ae-9ffc-c29a5255d646", "comment": "", @@ -366,13 +373,7 @@ "comment": "", "command": "editContent", "target": "id=/nameIdFormatFilterTarget.target", - "targets": [ - ["id=/nameIdFormatFilterTarget.target", "id"], - ["css=#\\/nameIdFormatFilterTarget\\.target", "css:finder"], - ["xpath=//p[@id='/nameIdFormatFilterTarget.target']", "xpath:attributes"], - ["xpath=//p", "xpath:position"], - ["xpath=//p[contains(.,'eval(true)')]", "xpath:innerText"] - ], + "targets": [], "value": "eval(true)" }, { "id": "05870356-d3db-4540-bb3f-db34b1cf65f1", @@ -380,9 +381,19 @@ "command": "sendKeys", "target": "id=/nameIdFormatFilterTarget.target", "targets": [], - "value": ";" + "value": "${KEY_END};" }, { - "id": "b544a0b1-fc04-4dc3-8a11-5769500e5503", + "id": "d7721254-68c9-4140-af2a-1757cce99da7", + "comment": "", + "command": "click", + "target": "css=.section-body", + "targets": [ + ["css=.section-body", "css:finder"], + ["xpath=//section/div[2]", "xpath:position"] + ], + "value": "" + }, { + "id": "ed6eb266-04f0-4517-b874-ea1d0ba68441", "comment": "", "command": "click", "target": "css=#\\/filterEnabled\\.parent > .custom-control-label", @@ -436,7 +447,7 @@ }, { "id": "ad613704-0718-4b83-97f1-b49897f510eb", "comment": "", - "command": "waitForElementEditable", + "command": "waitForElementVisible", "target": "id=/nameIdFormatFilterTarget.target", "targets": [], "value": "10000" @@ -452,7 +463,7 @@ ["xpath=//p", "xpath:position"], ["xpath=//p[contains(.,'eval(true)')]", "xpath:innerText"] ], - "value": "eval(true)" + "value": "eval(true);" }] }], "suites": [{ From 2e39d4f5e5dff006fff7a32e8442b9b7429430dd Mon Sep 17 00:00:00 2001 From: Jj! Date: Fri, 16 Aug 2019 10:38:51 -0500 Subject: [PATCH 04/11] [SHIBUI-1414] WIP --- .../resources/metadata-sources-ui-schema.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/backend/src/main/resources/metadata-sources-ui-schema.json b/backend/src/main/resources/metadata-sources-ui-schema.json index 9d64e75b4..8743acd12 100644 --- a/backend/src/main/resources/metadata-sources-ui-schema.json +++ b/backend/src/main/resources/metadata-sources-ui-schema.json @@ -26,7 +26,7 @@ "default": false }, "organization": { - "type": "object", + "type": ["object", "null"], "properties": { "name": { "title": "label.organization-name", @@ -68,13 +68,13 @@ "contacts": { "title": "label.contact-information", "description": "tooltip.contact-information", - "type": "array", + "type": ["array", "null"], "items": { "$ref": "#/definitions/Contact" } }, "mdui": { - "type": "object", + "type": ["object", "null"], "widget": { "id": "fieldset" }, @@ -143,7 +143,7 @@ } }, "securityInfo": { - "type": "object", + "type": ["object", "null"], "widget": { "id": "fieldset" }, @@ -245,13 +245,13 @@ "assertionConsumerServices": { "title": "label.assertion-consumer-service-endpoints", "description": "", - "type": "array", + "type": ["array", "null"], "items": { "$ref": "#/definitions/AssertionConsumerService" } }, "serviceProviderSsoDescriptor": { - "type": "object", + "type": ["object", "null"], "widget": { "id": "fieldset" }, @@ -299,17 +299,17 @@ "logoutEndpoints": { "title": "label.logout-endpoints", "description": "tooltip.logout-endpoints", - "type": "array", + "type": ["array", "null"], "items": { "$ref": "#/definitions/LogoutEndpoint" } }, "relyingPartyOverrides": { - "type": "object", + "type": ["object", "null"], "properties": {} }, "attributeRelease": { - "type": "array", + "type": ["array", "null"], "title": "label.attribute-release", "description": "Attribute release table - select the attributes you want to release (default unchecked)", "widget": { From 8da94bd8c2c1cfd9b0c8c5d5c85e26914fa63959 Mon Sep 17 00:00:00 2001 From: Jj! Date: Mon, 19 Aug 2019 09:25:16 -0500 Subject: [PATCH 05/11] [SHIBUI-1414] update tests --- ...lerVersionEndpointsIntegrationTests.groovy | 51 +++++++++++++++++++ ...efinitionControllerIntegrationTests.groovy | 4 +- 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/backend/src/enversTest/groovy/edu/internet2/tier/shibboleth/admin/ui/controller/EntityDescriptorControllerVersionEndpointsIntegrationTests.groovy b/backend/src/enversTest/groovy/edu/internet2/tier/shibboleth/admin/ui/controller/EntityDescriptorControllerVersionEndpointsIntegrationTests.groovy index 99b5810ce..82b143c00 100644 --- a/backend/src/enversTest/groovy/edu/internet2/tier/shibboleth/admin/ui/controller/EntityDescriptorControllerVersionEndpointsIntegrationTests.groovy +++ b/backend/src/enversTest/groovy/edu/internet2/tier/shibboleth/admin/ui/controller/EntityDescriptorControllerVersionEndpointsIntegrationTests.groovy @@ -1,11 +1,22 @@ package edu.internet2.tier.shibboleth.admin.ui.controller import edu.internet2.tier.shibboleth.admin.ui.domain.EntityDescriptor +import edu.internet2.tier.shibboleth.admin.ui.domain.Organization +import edu.internet2.tier.shibboleth.admin.ui.domain.OrganizationDisplayName +import edu.internet2.tier.shibboleth.admin.ui.domain.OrganizationName +import edu.internet2.tier.shibboleth.admin.ui.domain.OrganizationURL import edu.internet2.tier.shibboleth.admin.ui.domain.frontend.EntityDescriptorRepresentation import edu.internet2.tier.shibboleth.admin.ui.repository.EntityDescriptorRepository +import groovy.json.JsonOutput +import groovy.json.JsonSlurper import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.context.SpringBootTest import org.springframework.boot.test.web.client.TestRestTemplate +import org.springframework.http.HttpEntity +import org.springframework.http.HttpHeaders +import org.springframework.http.HttpMethod +import org.springframework.http.MediaType +import org.springframework.test.annotation.DirtiesContext import org.springframework.test.context.ActiveProfiles import spock.lang.Specification @@ -100,6 +111,46 @@ class EntityDescriptorControllerVersionEndpointsIntegrationTests extends Specifi edv2.body.serviceProviderName == 'SP2' } + @DirtiesContext(methodMode = DirtiesContext.MethodMode.AFTER_METHOD) + def 'SHIBUI-1414'() { + given: + def ed = new EntityDescriptor(entityID: 'testme', serviceProviderName: 'testme').with { + entityDescriptorRepository.save(it) + }.with { + it.setOrganization(new Organization().with { + it.organizationNames = [new OrganizationName(value: 'testme', XMLLang: 'en')] + it.organizationDisplayNames = [new OrganizationDisplayName(value: 'testme', XMLLang: 'en')] + it.organizationURLs = [new OrganizationURL(value: 'http://testme.org', XMLLang: 'en')] + it + }) + entityDescriptorRepository.save(it) + } + + when: + def headers = new HttpHeaders().with { + it.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) + it + } + + def allVersions = getAllEntityDescriptorVersions(ed.resourceId, List) + def edv1 = getEntityDescriptorForVersion(ed.resourceId, allVersions.body[0].id, String).body + def tedv2 = getEntityDescriptorForVersion(ed.resourceId, allVersions.body[1].id, EntityDescriptorRepresentation).body + + def aedv1 = new JsonSlurper().parseText(edv1).with { + it.put('version', tedv2.version) + it + }.with { + JsonOutput.toJson(it) + } + + def request = new HttpEntity(aedv1, headers) + def response = this.restTemplate.exchange("/api/EntityDescriptor/${ed.resourceId}", HttpMethod.PUT, request, String) + + then: + response.statusCodeValue != 400 + noExceptionThrown() + } + private getAllEntityDescriptorVersions(String resourceId, responseType) { this.restTemplate.getForEntity(resourceUriFor(ALL_VERSIONS_URI, resourceId), responseType) } diff --git a/backend/src/test/groovy/edu/internet2/tier/shibboleth/admin/ui/controller/BadJSONMetadataSourcesUiDefinitionControllerIntegrationTests.groovy b/backend/src/test/groovy/edu/internet2/tier/shibboleth/admin/ui/controller/BadJSONMetadataSourcesUiDefinitionControllerIntegrationTests.groovy index af758f131..b9789201f 100644 --- a/backend/src/test/groovy/edu/internet2/tier/shibboleth/admin/ui/controller/BadJSONMetadataSourcesUiDefinitionControllerIntegrationTests.groovy +++ b/backend/src/test/groovy/edu/internet2/tier/shibboleth/admin/ui/controller/BadJSONMetadataSourcesUiDefinitionControllerIntegrationTests.groovy @@ -7,6 +7,7 @@ import org.springframework.boot.test.context.SpringBootTest import org.springframework.boot.test.context.TestConfiguration import org.springframework.boot.test.web.client.TestRestTemplate import org.springframework.context.annotation.Bean +import org.springframework.context.annotation.Profile import org.springframework.core.io.ResourceLoader import org.springframework.test.context.ActiveProfiles import spock.lang.Specification @@ -23,7 +24,7 @@ import static edu.internet2.tier.shibboleth.admin.ui.jsonschema.JsonSchemaResour * @author Dmitriy Kopylenko */ @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("no-auth") +@ActiveProfiles(["no-auth", "badjson"]) class BadJSONMetadataSourcesUiDefinitionControllerIntegrationTests extends Specification { @Autowired @@ -42,6 +43,7 @@ class BadJSONMetadataSourcesUiDefinitionControllerIntegrationTests extends Speci } @TestConfiguration + @Profile('badjson') static class Config { @Bean JsonSchemaResourceLocationRegistry jsonSchemaResourceLocationRegistry(ResourceLoader resourceLoader, From 643b12ba36fbecec9bdf962a53b4a3f7ba3b0c25 Mon Sep 17 00:00:00 2001 From: Jj! Date: Mon, 19 Aug 2019 09:30:38 -0500 Subject: [PATCH 06/11] Revert "[SHIBUI-1414] WIP" This reverts commit 2e39d4f5 --- .../resources/metadata-sources-ui-schema.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/backend/src/main/resources/metadata-sources-ui-schema.json b/backend/src/main/resources/metadata-sources-ui-schema.json index 8743acd12..9d64e75b4 100644 --- a/backend/src/main/resources/metadata-sources-ui-schema.json +++ b/backend/src/main/resources/metadata-sources-ui-schema.json @@ -26,7 +26,7 @@ "default": false }, "organization": { - "type": ["object", "null"], + "type": "object", "properties": { "name": { "title": "label.organization-name", @@ -68,13 +68,13 @@ "contacts": { "title": "label.contact-information", "description": "tooltip.contact-information", - "type": ["array", "null"], + "type": "array", "items": { "$ref": "#/definitions/Contact" } }, "mdui": { - "type": ["object", "null"], + "type": "object", "widget": { "id": "fieldset" }, @@ -143,7 +143,7 @@ } }, "securityInfo": { - "type": ["object", "null"], + "type": "object", "widget": { "id": "fieldset" }, @@ -245,13 +245,13 @@ "assertionConsumerServices": { "title": "label.assertion-consumer-service-endpoints", "description": "", - "type": ["array", "null"], + "type": "array", "items": { "$ref": "#/definitions/AssertionConsumerService" } }, "serviceProviderSsoDescriptor": { - "type": ["object", "null"], + "type": "object", "widget": { "id": "fieldset" }, @@ -299,17 +299,17 @@ "logoutEndpoints": { "title": "label.logout-endpoints", "description": "tooltip.logout-endpoints", - "type": ["array", "null"], + "type": "array", "items": { "$ref": "#/definitions/LogoutEndpoint" } }, "relyingPartyOverrides": { - "type": ["object", "null"], + "type": "object", "properties": {} }, "attributeRelease": { - "type": ["array", "null"], + "type": "array", "title": "label.attribute-release", "description": "Attribute release table - select the attributes you want to release (default unchecked)", "widget": { From 10d03e702d630250b76d9499a14f099f288ba8e3 Mon Sep 17 00:00:00 2001 From: Ryan Mathis Date: Tue, 20 Aug 2019 09:34:33 -0700 Subject: [PATCH 07/11] SHIBUI-1382 Fixed issue with restoration --- .../configuration/container/restore.component.spec.ts | 4 ++++ ui/src/app/metadata/configuration/effect/restore.effect.ts | 1 + ui/src/app/metadata/configuration/service/history.service.ts | 3 ++- ui/src/app/metadata/filter/effect/collection.effect.ts | 3 +-- .../filter/model/entity-attributes-configuration.filter.ts | 1 - ui/src/app/schema-form/service/schema.service.ts | 3 ++- 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ui/src/app/metadata/configuration/container/restore.component.spec.ts b/ui/src/app/metadata/configuration/container/restore.component.spec.ts index 433a11ebd..e79cbcac9 100644 --- a/ui/src/app/metadata/configuration/container/restore.component.spec.ts +++ b/ui/src/app/metadata/configuration/container/restore.component.spec.ts @@ -10,6 +10,7 @@ import * as fromResolvers from '../../resolver/reducer'; import { MockI18nModule } from '../../../../testing/i18n.stub'; import { RestoreComponent } from './restore.component'; import { of } from 'rxjs'; +import { DatePipe } from '@angular/common'; @Component({ template: ` @@ -44,6 +45,9 @@ describe('Metadata Restore Page Component', () => { RestoreComponent, TestHostComponent ], + providers: [ + DatePipe + ] }).compileComponents(); store = TestBed.get(Store); diff --git a/ui/src/app/metadata/configuration/effect/restore.effect.ts b/ui/src/app/metadata/configuration/effect/restore.effect.ts index d91682c61..cfdf45057 100644 --- a/ui/src/app/metadata/configuration/effect/restore.effect.ts +++ b/ui/src/app/metadata/configuration/effect/restore.effect.ts @@ -17,6 +17,7 @@ import { Router, ActivatedRoute } from '@angular/router'; import { AddNotification } from '../../../notification/action/notification.action'; import { Notification, NotificationType } from '../../../notification/model/notification'; +import { removeNulls } from '../../../shared/util'; @Injectable() diff --git a/ui/src/app/metadata/configuration/service/history.service.ts b/ui/src/app/metadata/configuration/service/history.service.ts index 02529cde5..6a5f79607 100644 --- a/ui/src/app/metadata/configuration/service/history.service.ts +++ b/ui/src/app/metadata/configuration/service/history.service.ts @@ -8,6 +8,7 @@ import { MetadataVersion } from '../model/version'; import { map, catchError, switchMap } from 'rxjs/operators'; import { Metadata } from '../../domain/domain.type'; import { withLatestFrom } from 'rxjs-compat/operator/withLatestFrom'; +import { removeNulls } from '../../../shared/util'; @Injectable() export class MetadataHistoryService { @@ -48,7 +49,7 @@ export class MetadataHistoryService { restoreVersion(resourceId: string, type: string, versionId: string): Observable { return this.getVersions(resourceId, [null, versionId], type).pipe( switchMap(([current, toRestore]) => - this.updateVersion(resourceId, type, { ...toRestore, version: current.version }) + this.updateVersion(resourceId, type, { ...removeNulls(toRestore), version: current.version }) ) ); } diff --git a/ui/src/app/metadata/filter/effect/collection.effect.ts b/ui/src/app/metadata/filter/effect/collection.effect.ts index 58ecd41f7..dcf67b246 100644 --- a/ui/src/app/metadata/filter/effect/collection.effect.ts +++ b/ui/src/app/metadata/filter/effect/collection.effect.ts @@ -35,8 +35,7 @@ import { FilterCollectionActionTypes } from '../action/collection.action'; import * as fromFilter from '../reducer'; import * as fromProvider from '../../provider/reducer'; import { MetadataFilter } from '../../domain/model'; -import { removeNulls, array_move } from '../../../shared/util'; -import { EntityAttributesFilterEntity } from '../../domain/entity/filter/entity-attributes-filter'; +import { array_move } from '../../../shared/util'; import { MetadataFilterService } from '../../domain/service/filter.service'; import { SelectProviderRequest } from '../../provider/action/collection.action'; import { UpdateFilterChanges, ClearFilter } from '../action/filter.action'; diff --git a/ui/src/app/metadata/filter/model/entity-attributes-configuration.filter.ts b/ui/src/app/metadata/filter/model/entity-attributes-configuration.filter.ts index 5333e08f1..06a6609b6 100644 --- a/ui/src/app/metadata/filter/model/entity-attributes-configuration.filter.ts +++ b/ui/src/app/metadata/filter/model/entity-attributes-configuration.filter.ts @@ -1,6 +1,5 @@ import { Wizard } from '../../../wizard/model'; import { MetadataFilter } from '../../domain/model'; -import { removeNulls } from '../../../shared/util'; import { EntityAttributesFilter } from './entity-attributes.filter'; export const EntityAttributesFilterConfiguration: Wizard = { diff --git a/ui/src/app/schema-form/service/schema.service.ts b/ui/src/app/schema-form/service/schema.service.ts index 617769de6..0e5905a8a 100644 --- a/ui/src/app/schema-form/service/schema.service.ts +++ b/ui/src/app/schema-form/service/schema.service.ts @@ -28,12 +28,13 @@ export class SchemaService { const conditions = formProperty.parent.schema.anyOf || []; const values = formProperty.parent.value; const currentConditions = conditions.filter(condition => - Object + 'properties' in condition ? Object .keys(condition.properties) .some( key => values.hasOwnProperty(key) && condition.properties[key].enum ? condition.properties[key].enum[0] === values[key] : false ) + : false ); currentConditions.forEach(el => { requiredFields = el.required || []; From 4863ee6f5e3938d2902ba257a2357dbe43787bdb Mon Sep 17 00:00:00 2001 From: Dmitriy Kopylenko Date: Wed, 21 Aug 2019 09:15:31 -0400 Subject: [PATCH 08/11] Do not expose null values in JSON payloads --- .../src/main/resources/application.properties | 1 + .../EntitiesControllerIntegrationTests.groovy | 17 ++++------------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index 559a6c082..909b2943a 100644 --- a/backend/src/main/resources/application.properties +++ b/backend/src/main/resources/application.properties @@ -20,6 +20,7 @@ spring.jpa.database-platform=org.hibernate.dialect.H2Dialect spring.h2.console.enabled=true # spring.jackson.default-property-inclusion=non_absent +spring.jackson.default-property-inclusion=NON_NULL # Database Configuration PostgreSQL #spring.datasource.url=jdbc:postgresql://localhost:5432/shibui diff --git a/backend/src/test/groovy/edu/internet2/tier/shibboleth/admin/ui/controller/EntitiesControllerIntegrationTests.groovy b/backend/src/test/groovy/edu/internet2/tier/shibboleth/admin/ui/controller/EntitiesControllerIntegrationTests.groovy index 8bf12484a..d8d9e7afb 100644 --- a/backend/src/test/groovy/edu/internet2/tier/shibboleth/admin/ui/controller/EntitiesControllerIntegrationTests.groovy +++ b/backend/src/test/groovy/edu/internet2/tier/shibboleth/admin/ui/controller/EntitiesControllerIntegrationTests.groovy @@ -42,25 +42,16 @@ class EntitiesControllerIntegrationTests extends Specification { def "GET /api/entities returns the proper json"() { given: def expectedBody = ''' - { - "id":null, - "serviceProviderName":null, - "entityId":"http://test.scaldingspoon.org/test1", - "organization":null, - "contacts":null, - "mdui":null, + { + "entityId":"http://test.scaldingspoon.org/test1", "serviceProviderSsoDescriptor": { "protocolSupportEnum":"SAML 2", "nameIdFormats":["urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"] - }, - "logoutEndpoints":null, - "securityInfo":null, + }, "assertionConsumerServices":[ {"locationUrl":"https://test.scaldingspoon.org/test1/acs","binding":"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST","makeDefault":false} ], - "serviceEnabled":false, - "createdDate":null, - "modifiedDate":null, + "serviceEnabled":false, "relyingPartyOverrides":{}, "attributeRelease":["givenName","employeeNumber"] } From 58b0c2577d01559c8ecf79dc67d83270ca335609 Mon Sep 17 00:00:00 2001 From: Ryan Mathis Date: Wed, 21 Aug 2019 10:06:58 -0700 Subject: [PATCH 09/11] SHIBUI-1382 Fixed issue with date display --- .../container/restore.component.html | 8 ++--- .../container/restore.component.ts | 31 +++++++++++++------ .../configuration/effect/restore.effect.ts | 2 +- .../metadata/configuration/reducer/index.ts | 2 +- 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/ui/src/app/metadata/configuration/container/restore.component.html b/ui/src/app/metadata/configuration/container/restore.component.html index 66f994d1d..c2ac6f75e 100644 --- a/ui/src/app/metadata/configuration/container/restore.component.html +++ b/ui/src/app/metadata/configuration/container/restore.component.html @@ -1,5 +1,5 @@ -

- +

+ Restore Version ( date )

@@ -8,11 +8,11 @@

+ [translateParams]="{ 'date': date$ | async }"> Create New Version from Version ( date ) Settings

+ [translateParams]="{ 'date': date$ | async }"> Restoring this version will copy the Version ( date ) configuration and create a new Version from the selected version settings. You can then edit the configuration before saving the new version.

Cancel  diff --git a/ui/src/app/metadata/configuration/container/restore.component.ts b/ui/src/app/metadata/configuration/container/restore.component.ts index 388c5f8d8..0b6faff29 100644 --- a/ui/src/app/metadata/configuration/container/restore.component.ts +++ b/ui/src/app/metadata/configuration/container/restore.component.ts @@ -1,11 +1,11 @@ import { Component, ChangeDetectionStrategy, OnDestroy } from '@angular/core'; import { ActivatedRoute, } from '@angular/router'; import { Store } from '@ngrx/store'; -import { Subject } from 'rxjs'; +import { Subject, Observable } from 'rxjs'; import * as fromConfiguration from '../reducer'; import { CONFIG_DATE_FORMAT } from '../configuration.values'; -import { RestoreVersionRequest } from '../action/restore.action'; +import { RestoreVersionRequest, SelectVersionRestoreRequest } from '../action/restore.action'; import { withLatestFrom, map, takeUntil } from 'rxjs/operators'; import { DatePipe } from '@angular/common'; @@ -20,25 +20,36 @@ export class RestoreComponent implements OnDestroy { readonly subj = new Subject(); restore$ = this.subj.asObservable(); - date$ = this.store.select(fromConfiguration.getConfigurationVersionDate); - date: string; + date$: Observable; + kind$: Observable = this.store.select(fromConfiguration.getConfigurationModelKind); + id$: Observable = this.store.select(fromConfiguration.getConfigurationModelId); constructor( private store: Store, - private datePipe: DatePipe + private datePipe: DatePipe, + private route: ActivatedRoute ) { this.restore$.pipe( withLatestFrom( this.store.select(fromConfiguration.getSelectedVersionId), - this.store.select(fromConfiguration.getConfigurationModelKind), - this.store.select(fromConfiguration.getConfigurationModelId) + this.kind$, + this.id$ ), map(([restore, version, type, id]) => new RestoreVersionRequest({ id, type, version })) ).subscribe(this.store); - this.date$.pipe(takeUntil(this.subj)).subscribe( - (date) => this.date = this.datePipe.transform(date, CONFIG_DATE_FORMAT) - ); + this.date$ = this.store + .select(fromConfiguration.getConfigurationVersionDate) + .pipe( + map((date) => this.datePipe.transform(date, CONFIG_DATE_FORMAT)) + ); + + this.route.queryParams.pipe( + takeUntil(this.subj), + map(params => params.version), + withLatestFrom(this.id$, this.kind$), + map(([version, id, type]) => new SelectVersionRestoreRequest({ version, id, type })) + ).subscribe(this.store); } restore() { diff --git a/ui/src/app/metadata/configuration/effect/restore.effect.ts b/ui/src/app/metadata/configuration/effect/restore.effect.ts index cfdf45057..df5272ced 100644 --- a/ui/src/app/metadata/configuration/effect/restore.effect.ts +++ b/ui/src/app/metadata/configuration/effect/restore.effect.ts @@ -28,7 +28,7 @@ export class RestoreVersionEffects { ofType(RestoreActionTypes.SELECT_VERSION_REQUEST), map(action => action.payload), switchMap(({ type, id, version }) => { - return this.historyService.getVersion(id, version, type).pipe( + return this.historyService.getVersion(id, type, version).pipe( map(v => new SelectVersionRestoreSuccess(v)), catchError(err => of(new SelectVersionRestoreError(err))) ); diff --git a/ui/src/app/metadata/configuration/reducer/index.ts b/ui/src/app/metadata/configuration/reducer/index.ts index 469fe740e..ab217de6d 100644 --- a/ui/src/app/metadata/configuration/reducer/index.ts +++ b/ui/src/app/metadata/configuration/reducer/index.ts @@ -183,4 +183,4 @@ export const getConfigurationModelType = createSelector(getConfigurationModel, g export const getConfigurationHasXml = createSelector(getConfigurationXml, xml => !!xml); export const getConfigurationFilters = createSelector(getConfigurationModel, model => model.metadataFilters); -export const getConfigurationVersionDate = createSelector(getConfigurationModel, version => version.modifiedDate); +export const getConfigurationVersionDate = createSelector(getRestoreModel, version => version && version.modifiedDate); From d010d6957e535349b15ef02e0c2b29e3f35b0940 Mon Sep 17 00:00:00 2001 From: Ryan Mathis Date: Thu, 29 Aug 2019 08:34:05 -0700 Subject: [PATCH 10/11] SHIBUI-1382 Fixed translation --- .../metadata/configuration/container/restore.component.html | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ui/src/app/metadata/configuration/container/restore.component.html b/ui/src/app/metadata/configuration/container/restore.component.html index c2ac6f75e..77fc2c7cb 100644 --- a/ui/src/app/metadata/configuration/container/restore.component.html +++ b/ui/src/app/metadata/configuration/container/restore.component.html @@ -6,10 +6,8 @@

-

- Create New Version from Version ( date ) Settings +

+ Create New Version from Previous Settings

From 483a446c0a98f450911c50c9aac1bd2f3ae0cef5 Mon Sep 17 00:00:00 2001 From: Ryan Mathis Date: Thu, 29 Aug 2019 08:34:40 -0700 Subject: [PATCH 11/11] SHIBUI-1382 Fixed translation --- backend/src/main/resources/i18n/messages.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/main/resources/i18n/messages.properties b/backend/src/main/resources/i18n/messages.properties index 182a2491e..621dc4e63 100644 --- a/backend/src/main/resources/i18n/messages.properties +++ b/backend/src/main/resources/i18n/messages.properties @@ -473,7 +473,7 @@ message.database-constraint=There was a database constraint problem processing t message.no-filters=No Filters message.no-filters-added=No filters have been added to this Metadata Provider -message.create-new-version-from-version=Create New Version from Version ({ date }) Settings +message.create-new-version-from-version=Create New Version from Previous Settings message.restoring-this-version-will-copy=Restoring this version will copy the Version ({ date }) configuration and create a new Version from the selected version settings. You can then edit the configuration before saving the new version. tooltip.entity-id=Entity ID