Sha256: e30844d3029ae70c95cb855464c5be16132f20bf8a3ef81cda187ed692f85cca

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

import { decodeId } from './globalIdHelper';

const experimental = path => `/experimental${path}`;

const showPath = path => `${path}/:id`;
const newPath = path => `${path}/new`;

export const modelPath = (basePath, model) => `${basePath}/${decodeId(model)}`;

// react-router uses path-to-regexp, should we use it as well in a future?
// https://github.com/pillarjs/path-to-regexp/tree/v1.7.0#compile-reverse-path-to-regexp
export const resolvePath = (path, params) =>
  Object.entries(params).reduce(
    (memo, [key, value]) => memo.replace(key, value),
    path
  );

export const ovalContentsApiPath = '/api/v2/compliance/oval_contents';

export const ovalContentsPath = experimental('/compliance/oval_contents');
export const ovalContentsShowPath = showPath(ovalContentsPath);
export const ovalContentsNewPath = newPath(ovalContentsPath);
export const ovalPoliciesPath = experimental('/compliance/oval_policies');
export const ovalPoliciesShowPath = `${showPath(ovalPoliciesPath)}/:tab?`;
export const hostsPath = '/hosts';
export const newJobPath = '/job_invocations/new';
export const hostsShowPath = showPath(hostsPath);

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
foreman_openscap-5.1.0 webpack/helpers/pathsHelper.js