Skip to content

Commit

Permalink
After CR
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasOsti committed Jun 6, 2024
1 parent 9a60a33 commit c3216a0
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ const restInfo = {
siteaccess: document.querySelector('meta[name="SiteAccess"]')?.content,
};

export const SYSTEM_ROOT_LOCATION_ID = 1;
export const SYSTEM_ROOT_LOCATION_PATH = `/${SYSTEM_ROOT_LOCATION_ID}/`;
export const SYSTEM_ROOT_LOCATION = { pathString: SYSTEM_ROOT_LOCATION_PATH };

export const setRestInfo = ({ instanceUrl, accessToken, token, siteaccess }) => {
restInfo.instanceUrl = instanceUrl ?? restInfo.instanceUrl;
restInfo.accessToken = accessToken ?? restInfo.accessToken;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import Icon from '../../../common/icon/icon';

import { showWarningNotification } from '@ibexa-admin-ui/src/bundle/Resources/public/js/scripts/helpers/notification.helper';
import { getContentTypeIconUrl } from '@ibexa-admin-ui/src/bundle/Resources/public/js/scripts/helpers/content.type.helper';
import { getTranslator, getAdminUiConfig } from '@ibexa-admin-ui/src/bundle/Resources/public/js/scripts/helpers/context.helper';
import {
getTranslator,
getAdminUiConfig,
SYSTEM_ROOT_LOCATION_ID,
} from '@ibexa-admin-ui/src/bundle/Resources/public/js/scripts/helpers/context.helper';

class ListItem extends Component {
constructor(props) {
Expand Down Expand Up @@ -124,7 +128,7 @@ class ListItem extends Component {
};

if (!this.state.isLoading || this.props.subitems.length) {
if (locationId === 1) {
if (locationId === SYSTEM_ROOT_LOCATION_ID) {
iconAttrs.customPath = getContentTypeIconUrl('folder');
} else {
iconAttrs.customPath = getContentTypeIconUrl(contentTypeIdentifier) || getContentTypeIconUrl('file');
Expand Down Expand Up @@ -184,7 +188,7 @@ class ListItem extends Component {
renderItemLabel() {
const { href, name, locationId, indent, onClick } = this.props;

if (locationId === 1) {
if (locationId === SYSTEM_ROOT_LOCATION_ID) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useContext, useState, useMemo, useEffect, useCallback, useRef }

import Icon from '../../../common/icon/icon';

import { getTranslator } from '@ibexa-admin-ui/src/bundle/Resources/public/js/scripts/helpers/context.helper';
import { getTranslator, SYSTEM_ROOT_LOCATION_ID } from '@ibexa-admin-ui/src/bundle/Resources/public/js/scripts/helpers/context.helper';
import { createCssClassNames } from '../../../common/helpers/css.class.names';
import { getLoadedLocationsLimitedMap } from './breadcrumbs.helpers';
import { LoadedLocationsMapContext, MarkedLocationIdContext, GridActiveLocationIdContext } from '../../universal.discovery.module';
Expand Down Expand Up @@ -69,7 +69,7 @@ const Breadcrumbs = () => {
{hiddenItems.map((item) => {
const locationId = item.parentLocationId;
const locationName =
locationId === 1
locationId === SYSTEM_ROOT_LOCATION_ID
? Translator.trans(
/*@Desc("Root Location")*/ 'breadcrumbs.root_location',
{},
Expand Down Expand Up @@ -124,7 +124,7 @@ const Breadcrumbs = () => {
{visibleItems.map((item, index) => {
const locationId = item.parentLocationId;
const locationName =
locationId === 1
locationId === SYSTEM_ROOT_LOCATION_ID
? Translator.trans(
/*@Desc("Root Location")*/ 'breadcrumbs.root_location',
{},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ import {
} from '../../universal.discovery.module';

import { parse as parseTooltip } from '@ibexa-admin-ui/src/bundle/Resources/public/js/scripts/helpers/tooltips.helper';
import { getAdminUiConfig, getTranslator } from '@ibexa-admin-ui/src/bundle/Resources/public/js/scripts/helpers/context.helper';
import {
getAdminUiConfig,
getTranslator,
SYSTEM_ROOT_LOCATION_ID,
} from '@ibexa-admin-ui/src/bundle/Resources/public/js/scripts/helpers/context.helper';

const MINIMUM_ITEMS_COUNT_FOR_SEARCH_TO_APPEAR = 10;

Expand Down Expand Up @@ -63,7 +67,7 @@ const ContentCreateWidget = () => {
setFilterQuery(query);
};
const updateSelectedLanguage = (value) => setSelectedLanguage(value);
const isConfirmDisabled = !selectedContentType || !selectedLanguage || markedLocationId === 1;
const isConfirmDisabled = !selectedContentType || !selectedLanguage || markedLocationId === SYSTEM_ROOT_LOCATION_ID;
const createContent = () => {
setContentOnTheFlyData({
locationId: markedLocationId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ import {

import { formatShortDateTime } from '@ibexa-admin-ui/src/bundle/Resources/public/js/scripts/helpers/timezone.helper';
import { parse as parseTooltip } from '@ibexa-admin-ui/src/bundle/Resources/public/js/scripts/helpers/tooltips.helper';
import { getTranslator, getRouting, getAdminUiConfig } from '@ibexa-admin-ui/src/bundle/Resources/public/js/scripts/helpers/context.helper';
import {
getTranslator,
getRouting,
getAdminUiConfig,
SYSTEM_ROOT_LOCATION_ID,
} from '@ibexa-admin-ui/src/bundle/Resources/public/js/scripts/helpers/context.helper';

const ContentMetaPreview = () => {
const Translator = getTranslator();
Expand All @@ -42,7 +47,7 @@ const ContentMetaPreview = () => {
parseTooltip(refContentMetaPreview.current);
});

if (!markedLocationId || markedLocationId === 1 || !locationData) {
if (!markedLocationId || markedLocationId === SYSTEM_ROOT_LOCATION_ID || !locationData) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ import {
parse as parseTooltips,
hideAll as hideAllTooltips,
} from '@ibexa-admin-ui/src/bundle/Resources/public/js/scripts/helpers/tooltips.helper';
import { getAdminUiConfig, getTranslator } from '@ibexa-admin-ui/src/bundle/Resources/public/js/scripts/helpers/context.helper';
import {
getAdminUiConfig,
getTranslator,
SYSTEM_ROOT_LOCATION_ID,
} from '@ibexa-admin-ui/src/bundle/Resources/public/js/scripts/helpers/context.helper';

const { document } = window;

Expand Down Expand Up @@ -409,7 +413,11 @@ const UniversalDiscoveryModule = (props) => {
}, [currentView]);

useEffect(() => {
if (!props.startingLocationId || props.startingLocationId === 1 || props.startingLocationId === props.rootLocationId) {
if (
!props.startingLocationId ||
props.startingLocationId === SYSTEM_ROOT_LOCATION_ID ||
props.startingLocationId === props.rootLocationId
) {
return;
}

Expand Down

0 comments on commit c3216a0

Please sign in to comment.