Skip to content

Commit

Permalink
Merge pull request #3462 from greenbone/mergify/bp/oldstable/pr-3460
Browse files Browse the repository at this point in the history
Fix: Introduce new function to remove leading zero fron version for correct links to GSM-Manual (backport #3460)
  • Loading branch information
bjoernricks authored Jun 9, 2022
2 parents 2b7cf68 + 436be4a commit 5f76d32
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/gmp/gmpsettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import {RELEASE_VERSION, REMOVED_ZERO_RELEASE_VERSION} from '../version';
import {isDefined} from './utils/identity';

export const DEFAULT_RELOAD_INTERVAL = 15 * 1000; // fifteen seconds
export const DEFAULT_RELOAD_INTERVAL_ACTIVE = 3 * 1000; // three seconds
export const DEFAULT_RELOAD_INTERVAL_INACTIVE = 60 * 1000; // one minute
export const DEFAULT_MANUAL_URL =
'http://docs.greenbone.net/GSM-Manual/gos-20.08/';
export const DEFAULT_PROTOCOLDOC_URL =
'https://docs.greenbone.net/API/GMP/gmp-20.08.html';
export const DEFAULT_MANUAL_URL = `http://docs.greenbone.net/GSM-Manual/gos-${REMOVED_ZERO_RELEASE_VERSION}/`;
export const DEFAULT_PROTOCOLDOC_URL = `https://docs.greenbone.net/API/GMP/gmp-${RELEASE_VERSION}.html`;
export const DEFAULT_REPORT_RESULTS_THRESHOLD = 25000;
export const DEFAULT_LOG_LEVEL = 'warn';
export const DEFAULT_TIMEOUT = 300000; // 5 minutes
Expand Down
15 changes: 15 additions & 0 deletions src/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

const getMajorMinorVersion = () => {
// eslint-disable-next-line no-unused-vars
const [major, minor, ...rest] = VERSION.split('.');
return `${major}.${minor}`;
};

const getCleanedMajorMinorVersion = () => {
// eslint-disable-next-line no-unused-vars
const [major, minor, ...rest] = VERSION.split('.');
return `${major}.${parseInt(minor)}`;
};

const VERSION = '20.8.4';

export const RELEASE_VERSION = getMajorMinorVersion();
export const REMOVED_ZERO_RELEASE_VERSION = getCleanedMajorMinorVersion();

export default VERSION;

0 comments on commit 5f76d32

Please sign in to comment.