Skip to content

Commit d35f074

Browse files
author
pipeline
committed
feature(EJ2-5519): Default Sample Redirection
1 parent ba8b653 commit d35f074

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
Binary file not shown.

src/common/component-content.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,22 @@ export class Content extends React.Component<{}, {}>{
306306

307307
public componentDidMount(): void {
308308

309+
/**
310+
* Default Sample Redirection
311+
*/
312+
let sampleOrder: string[] = window.sampleOrder;
313+
let hash: string[] = location.hash.split('/').slice(1);
314+
if (sampleOrder.indexOf(hash.slice(1).join('/')) === -1) {
315+
let path: string;
316+
for (let sample of sampleOrder) {
317+
if (sample.indexOf(hash[1] + '/') !== -1) {
318+
path = hash[0] + '/' + sample;
319+
break;
320+
}
321+
}
322+
location.hash = path ? path : '#/material/chart/line';
323+
}
324+
309325
let hsplitter: string = '<div class="sb-toolbar-splitter sb-custom-item"></div>';
310326
let openNewTemplate: string = '<div class="sb-custom-item sb-open-new-wrapper"><a id="openNew" target="_blank">' +
311327
'<div class="sb-icons sb-icon-Popout"></div></a></div>';

0 commit comments

Comments
 (0)