-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IBX-6398: UDW as standalone as GH package #1010
Conversation
300f85d
to
da3193a
Compare
86cdf23
to
10eb46f
Compare
} | ||
|
||
const iconSetPath = adminUiConfig.iconPaths.iconSets[iconSet]; | ||
return `${iconSetPath}#${path}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return `${iconSetPath}#${path}`; | |
return `${iconSetPath}#${path}`; |
import { getJsonFromResponse } from './request.helper'; | ||
import { showErrorNotification } from './notification.helper'; | ||
import { getRestInfo, getTranslator } from './context.helper'; | ||
import { getRequestHeaders, getRequestMode } from '../../../../../ui-dev/src/modules/common/services/common.service'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what would you say on using alias here as well? @ibexa-admin-ui/src/bundle/ui-dev/src/modules/common/services/common.service
?
That's something we could do in future in other places as well, to avoid that many ../
(and remove thinking "is it enough ../ or I need one more? and moving files between directories)
@dew326 @Gengar-i @tischsoic @lucasOsti
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Current upside of using ../../.. is that VS Code understands where a file is. If you use an alias, this file won't be recognized
@@ -355,6 +356,7 @@ export default class ContentTreeModule extends Component { | |||
|
|||
render() { | |||
const { onClickItem, subitemsLimit, subitemsLoadLimit, treeMaxDepth, userId, resizable } = this.props; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why new line here?
@@ -1,5 +1,7 @@ | |||
import React, { useContext, useState, useEffect, useRef } from 'react'; | |||
|
|||
import { getIconPath } from '@ibexa-admin-ui/src/bundle/Resources/public/js/scripts/helpers/icon.helper'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe move it to line 21/22, to other helpers? :)
@@ -1,13 +1,14 @@ | |||
import React, { useContext } from 'react'; | |||
|
|||
import { getIconPath } from '@ibexa-admin-ui/src/bundle/Resources/public/js/scripts/helpers/icon.helper'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
@@ -1,10 +1,14 @@ | |||
import React, { useContext, useEffect, useMemo, useRef } from 'react'; | |||
|
|||
import { formatShortDateTime } from '@ibexa-admin-ui/src/bundle/Resources/public/js/scripts/helpers/timezone.helper'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to other helpers, they're so sad being separated 😢
@@ -1,11 +1,12 @@ | |||
import React, { useContext, useEffect } from 'react'; | |||
|
|||
import { getIconPath } from '@ibexa-admin-ui/src/bundle/Resources/public/js/scripts/helpers/icon.helper'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as above (I think)
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'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These helpers are happy, they're together till the end of time! 🥳
Sorry, to much code, my brain explodes...
selectedLabel: () => { | ||
return ( | ||
<div className="c-simple-dropdown__option-label"> | ||
{getTranslator.trans(/*@Desc("Sort by date")*/ 'sorting.date.selected_label', {}, 'ibexa_universal_discovery_widget')} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{getTranslator.trans(/*@Desc("Sort by date")*/ 'sorting.date.selected_label', {}, 'ibexa_universal_discovery_widget')} | |
{getTranslator().trans(/*@Desc("Sort by date")*/ 'sorting.date.selected_label', {}, 'ibexa_universal_discovery_widget')} |
selectedLabel: () => { | ||
return ( | ||
<div className="c-simple-dropdown__option-label"> | ||
{getTranslator.trans(/*@Desc("Sort by date")*/ 'sorting.date.selected_label', {}, 'ibexa_universal_discovery_widget')} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{getTranslator.trans(/*@Desc("Sort by date")*/ 'sorting.date.selected_label', {}, 'ibexa_universal_discovery_widget')} | |
{getTranslator().trans(/*@Desc("Sort by date")*/ 'sorting.date.selected_label', {}, 'ibexa_universal_discovery_widget')} |
@@ -222,5 +222,10 @@ services: | |||
Ibexa\Bundle\AdminUi\Controller\Permission\LanguageLimitationController: | |||
parent: Ibexa\Contracts\AdminUi\Controller\Controller | |||
autowire: true | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isWindows, | ||
isMac, | ||
isLinux, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isWindows, | |
isMac, | |
isLinux, | |
get isWindows() { return isWindows(); } |
@lucasOsti, @GrabowskiM, @tischsoic, @dew326
What do you think about this approach?
I can add it in seperate PR.
So we can get property like helper.isWindows instead of helper.isWindows() when we only return bool true or false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that avoiding ()
is enough to replace function with getter. What if e.g. in the future we would like to pass a parameter?
hide: delayHide ? parseInt(delayHide, 10) : 75, | ||
}; | ||
const extraClass = tooltipNode.dataset.tooltipExtraClass ?? ''; | ||
const placement = tooltipNode.dataset.tooltipPlacement ?? 'bottom'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const placement = tooltipNode.dataset.tooltipPlacement ?? 'bottom'; | |
const placement = tooltipNode.dataset.bsPlacement ?? 'bottom'; |
There suppose to be other property. I checked bootstrap docks they are using:
data-placement="top"
and in BS 5.0:
data-bs-placement="top"
const { Translator } = window; | ||
|
||
const PaginationInfo = ({ totalCount, viewingCount, extraClasses }) => { | ||
const PaginationInfo = ({ totalCount, viewingCount, extraClasses, Translator }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const Translator = getTranslator();
maybe?
const iframeRef = createRef(); | ||
const iframeUrl = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const iframeUrl = () => { | |
const iframe = { | |
get url() { | |
const { locationId, languageCode, contentTypeIdentifier } = contentOnTheFlyData; | |
return Routing.generate('ibexa.content.on_the_fly.create', { | |
locationId, | |
languageCode, | |
contentTypeIdentifier, | |
}); | |
} | |
}; | |
// Use | |
console.log(iframe.url); |
@GrabowskiM will be happy :>
We can also move ref here
1fedbe0
to
216b298
Compare
export const getAdminUiConfig = () => adminUiConfig; | ||
export const getBootstrap = () => bootstrap; | ||
export const getFlatpickr = () => flatpickr; | ||
export const getMoment = () => moment; | ||
export const getPopper = () => Popper; | ||
export const getRouting = () => Routing; | ||
export const getTranslator = () => Translator; | ||
export const getRestInfo = () => restInfo; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should have one function getContext
and we would have:
import { getContext } from './context.helper';
const { Translator, moment } = getContext();
import * as tooltips from './tooltips.helper'; | ||
import * as user from './user.helper'; | ||
|
||
(function (ibexa) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need IIFE? I think given we have modules this is not needed.
ibexa.addConfig('helpers.contentType', contentType); | ||
ibexa.addConfig('helpers.cookies', cookies); | ||
ibexa.addConfig('helpers.formError', formError); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand, why we have config.loader.js
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I create config.loader.js
file wherever something was added to window.ibexa
via the addConfig
method
} | ||
}; | ||
|
||
export const getAdminUiConfig = () => adminUiConfig; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a58178c
to
3c3af15
Compare
3c3af15
to
d46625f
Compare
Quality Gate passedThe SonarCloud Quality Gate passed, but some issues were introduced. 3 New issues |
Related PR's:
Checklist:
$ composer fix-cs
)