Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

fix issue 3549: Broken link on webui #5154

Merged
merged 5 commits into from
Oct 12, 2022
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
14 changes: 12 additions & 2 deletions ts/webui/src/components/nav/Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ class NavCon extends React.Component<NavProps, NavState> {
method: 'GET'
}).then(res => {
if (res.status === 200) {
this.setState({ version: res.data });
let formatVersion = res.data;
// 2.0 will get 2.0.0 by node, so delete .0 to get real version
if (formatVersion.endsWith('.0')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if 2.0.11?

Count . in version and split on last .. Or use regex.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why? 2.0.11 is not end with '.0'. endsWith is enough to judge it, i think.

formatVersion = formatVersion.slice(0, -2);
}
this.setState({ version: formatVersion });
}
});
};
Expand All @@ -80,7 +85,12 @@ class NavCon extends React.Component<NavProps, NavState> {

openGithubNNI = (): void => {
const { version } = this.state;
const nniLink = `https://github.com/Microsoft/nni/tree/${version}`;
// 999.0.0-developing
let formatVersion = `v${version}`;
if (version === '999.0.0-developing') {
formatVersion = 'master';
}
const nniLink = `https://github.com/Microsoft/nni/tree/${formatVersion}`;
window.open(nniLink);
};

Expand Down
Loading