Skip to content

Commit

Permalink
Always show version but hide update button when program is launched w…
Browse files Browse the repository at this point in the history
…ith "--no-check-update" flag
  • Loading branch information
ArtemBaskal committed May 27, 2020
1 parent 1d4ee05 commit aebfaf6
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
1 change: 1 addition & 0 deletions client/src/components/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ class App extends Component {
dnsPort={dashboard.dnsPort}
processingVersion={dashboard.processingVersion}
getVersion={getVersion}
checkUpdateFlag={dashboard.checkUpdateFlag}
/>
<Toasts />
<Icons />
Expand Down
4 changes: 3 additions & 1 deletion client/src/components/ui/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class Footer extends Component {

render() {
const {
dnsVersion, processingVersion, getVersion,
dnsVersion, processingVersion, getVersion, checkUpdateFlag,
} = this.props;

return (
Expand Down Expand Up @@ -94,6 +94,7 @@ class Footer extends Component {
dnsVersion={dnsVersion}
processingVersion={processingVersion}
getVersion={getVersion}
checkUpdateFlag={checkUpdateFlag}
/>
</div>
</div>
Expand All @@ -108,6 +109,7 @@ Footer.propTypes = {
dnsVersion: PropTypes.string,
processingVersion: PropTypes.bool,
getVersion: PropTypes.func,
checkUpdateFlag: PropTypes.bool,
};

export default withTranslation()(Footer);
31 changes: 15 additions & 16 deletions client/src/components/ui/Version.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,25 @@ import './Version.css';

const Version = (props) => {
const {
dnsVersion, processingVersion, t,
dnsVersion = 'undefined', processingVersion, t, checkUpdateFlag,
} = props;

return (
<div className="version">
<div className="version__text">
{dnsVersion && <>
<Trans>version</Trans>:&nbsp;
<span className="version__value" title={dnsVersion}>{dnsVersion}</span>
<button
type="button"
className="btn btn-icon btn-icon-sm btn-outline-primary btn-sm ml-2"
onClick={() => props.getVersion(true)}
disabled={processingVersion}
title={t('check_updates_now')}
>
<svg className="icons">
<use xlinkHref="#refresh" />
</svg>
</button>
</>}
<Trans>version</Trans>:&nbsp;
<span className="version__value" title={dnsVersion}>{dnsVersion}</span>
{checkUpdateFlag && <button
type="button"
className="btn btn-icon btn-icon-sm btn-outline-primary btn-sm ml-2"
onClick={() => props.getVersion(true)}
disabled={processingVersion}
title={t('check_updates_now')}
>
<svg className="icons">
<use xlinkHref="#refresh" />
</svg>
</button>}
</div>
</div>
);
Expand All @@ -36,6 +34,7 @@ Version.propTypes = {
dnsVersion: PropTypes.string.isRequired,
getVersion: PropTypes.func.isRequired,
processingVersion: PropTypes.bool.isRequired,
checkUpdateFlag: PropTypes.bool.isRequired,
t: PropTypes.func.isRequired,
};

Expand Down
2 changes: 2 additions & 0 deletions client/src/reducers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ const dashboard = handleActions(
canAutoUpdate,
isUpdateAvailable: true,
processingVersion: false,
checkUpdateFlag: !!payload,
};
return newState;
}
Expand Down Expand Up @@ -165,6 +166,7 @@ const dashboard = handleActions(
autoClients: [],
supportedTags: [],
name: '',
checkUpdateFlag: false,
},
);

Expand Down

0 comments on commit aebfaf6

Please sign in to comment.