Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

RC > Replaced error component with iframe #436

Merged
merged 5 commits into from
Aug 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]="'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 @@
{
"builder_page_not_found_iframe_title": {
"message": "Page not found",
"_description": "A string value to represent the Page Not Found iframe title attribute."
}
}
6 changes: 6 additions & 0 deletions test/cli-utils-run-build.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ describe('cli utils run build', () => {

beforeEach(() => {
mockLocaleProcessor = {
isLocaleFile() {
return true;
},
parseLocaleFileBasename() {
return '';
},
prepareLocaleFiles() {}
};

Expand Down
2 changes: 1 addition & 1 deletion test/sky-pages-route-generator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,6 @@ describe('SKY UX Builder route generator', () => {
}
});
expect(routes.definitions)
.toContain("template: '<sky-error errorType=\"notfound\"></sky-error>'");
.toContain(`template: \`<iframe src="https://host.nxt.blackbaud.com/errors/notfound" style="border:0;height:100vh;width:100%;" [title]="'builder_page_not_found_iframe_title' | skyAppResources"></iframe>\``);
});
});