Skip to content

Commit

Permalink
Replaced SKY UX error component with iframe (blackbaud#485)
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackbaud-SteveBrush authored and Blackbaud-MikitaYankouski committed May 3, 2019
1 parent a8382cb commit 534742a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
22 changes: 15 additions & 7 deletions lib/sky-pages-route-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,24 @@ function generateRoutes(skyAppConfig) {
`@Component({ template: '<router-outlet></router-outlet>' }) export class RootComponent {}`
});

const notFoundComponent = {
componentName: 'NotFoundComponent',
routePath: ['**'],
routeParams: []
};

if (skyAppConfig.runtime.handle404) {
const err = `<sky-error errorType="notfound"></sky-error>`;
entities.push({
componentName: 'NotFoundComponent',
componentDefinition: `@Component({ template: '${err}' }) export class NotFoundComponent { }`,
routePath: ['**'],
routeParams: []
});
const err = [
'<iframe src="https://host.nxt.blackbaud.com/errors/notfound"',
'style="border:0;height:100vh;width:100%;"',
`[title]="'skyux_builder_page_not_found_iframe_title' | skyAppResources"></iframe>`
].join(' ');
notFoundComponent.componentDefinition =
`@Component({ template: \`${err}\` }) export class NotFoundComponent { }`;
}

entities.push(notFoundComponent);

return entities;
}

Expand Down
6 changes: 6 additions & 0 deletions src/assets/locales/resources_en_US.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"skyux_builder_page_not_found_iframe_title": {
"message": "Page not found",
"_description": "A string value to represent the Page Not Found iframe title attribute."
}
}
4 changes: 3 additions & 1 deletion test/sky-pages-module-generator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ describe('SKY UX Builder module generator', () => {
skyux: runtimeUtils.getDefaultSkyux()
});
expect(source).toContain('NotFoundComponent');
expect(source).not.toContain("template: '<sky-error errorType=\"notfound\"></sky-error>'");
expect(source).not.toContain(
`template: \`<iframe src="https://host.nxt.blackbaud.com/errors/notfound"`
);
});

it('should handle 404', () => {
Expand Down
5 changes: 3 additions & 2 deletions test/sky-pages-route-generator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,8 @@ describe('SKY UX Builder route generator', () => {
handle404: true
}
});
expect(routes.definitions)
.toContain("template: '<sky-error errorType=\"notfound\"></sky-error>'");
expect(routes.definitions).toContain(
`template: \`<iframe src="https://host.nxt.blackbaud.com/errors/notfound"`
);
});
});

0 comments on commit 534742a

Please sign in to comment.