Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let defaultNamespace = 'default';
const pathArray = window.location.pathname.split('/');
// if the current URL path specifies a namespace, this should become the
// defaultNamespace
if (pathArray[0] === '' && pathArray[1] === 'namespaces' && pathArray[2]) {
defaultNamespace = pathArray[2];
// if the current URL path is a legacy path such as `/daemonsets`, the
// defaultNamespace should be "_all", unless the path is `/namespaces`
} else if (pathArray.length === 2 && pathArray[1] !== '' && pathArray[1] !== 'namespaces') {
defaultNamespace = '_all';
}
const detectedLocales = new LocaleResolver(
[new DETECTORS.NavigatorDetector()],
[new TRANSFORMERS.FallbacksTransformer()],
).getLocales();
const catalogOptions = { en: catalogEn, es: catalogEs };
const selectedLocale =
_find(detectedLocales, l => !_isEmpty(catalogOptions[l])) || 'en';
const selectedCatalog = catalogOptions[selectedLocale] || catalogEn;
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
...appData,
};
this.state.api = ApiHelpers(pathPrefix);
}
let defaultNamespace = 'default';
const pathArray = window.location.pathname.split('/');
// if the current URL path specifies a namespace, this should become the
// defaultNamespace
if (pathArray[0] === '' && pathArray[1] === 'namespaces' && pathArray[2]) {
defaultNamespace = pathArray[2];
// if the current URL path is a legacy path such as `/daemonsets`, the
// defaultNamespace should be "_all", unless the path is `/namespaces`
} else if (pathArray.length === 2 && pathArray[1] !== '' && pathArray[1] !== 'namespaces') {
defaultNamespace = '_all';
}
const detectedLocales = new LocaleResolver(
[new DETECTORS.NavigatorDetector()],
[new TRANSFORMERS.FallbacksTransformer()],
).getLocales();
const catalogOptions = { en: catalogEn, es: catalogEs };
const selectedLocale =
_find(detectedLocales, l => !_isEmpty(catalogOptions[l])) || 'en';
const selectedCatalog = catalogOptions[selectedLocale] || catalogEn;
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
...appData,
};
let defaultNamespace = 'default';
const pathArray = window.location.pathname.split('/');
// if the current URL path specifies a namespace, this should become the
// defaultNamespace
if (pathArray[0] === '' && pathArray[1] === 'namespaces' && pathArray[2]) {
defaultNamespace = pathArray[2];
// if the current URL path is a legacy path such as `/daemonsets`, the
// defaultNamespace should be "_all", unless the path is `/namespaces`
} else if (pathArray.length === 2 && pathArray[1] !== '' && pathArray[1] !== 'namespaces') {
defaultNamespace = '_all';
}
const detectedLocales = new LocaleResolver(
[new DETECTORS.NavigatorDetector()],
[new TRANSFORMERS.FallbacksTransformer()],
).getLocales();
const catalogOptions = { en: catalogEn, es: catalogEs };
const selectedLocale =
_find(detectedLocales, l => !_isEmpty(catalogOptions[l])) || 'en';
const selectedCatalog = catalogOptions[selectedLocale] || catalogEn;
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
...appData,
};
this.state.api = ApiHelpers(pathPrefix);
this.state.pathPrefix = pathPrefix;