Skip to content

Commit

Permalink
EPMRPP-96345 || Fix the problems with the organization card
Browse files Browse the repository at this point in the history
  • Loading branch information
BlazarQSO committed Oct 21, 2024
1 parent c81dbad commit 1b7726c
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 14 deletions.
1 change: 1 addition & 0 deletions app/localization/translated/be.json
Original file line number Diff line number Diff line change
Expand Up @@ -1562,6 +1562,7 @@
"OrganizationsPage.createNewOrganization": "Стварыце новую арганізацыю, каб пачаць свой шлях на партале справаздач",
"OrganizationsPage.noOrganizationsYet": "Пакуль няма арганізацый",
"OrganizationsPage.noOrganizationsAvailableYet": "Пакуль няма даступных арганізацый",
"OrganizationsPage.noLaunches": "Ніякіх запускаў",
"OrganizationsPage.noResultsDescription": "Вашым крытэрам пошуку або фільтра не знойдзена ніводнага выніку. Калі ласка, паспрабуйце іншыя ключавыя словы або змяніце налады фільтра.",
"OrganizationsPage.searchPlaceholder": "Пошук па назве",
"OrganizationsPage.synchedOrganization": "Сінхранізаваная арганізацыя",
Expand Down
1 change: 1 addition & 0 deletions app/localization/translated/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1553,6 +1553,7 @@
"OrganizationsPage.createNewOrganization": "Create a new organization to begin your ReportPortal journey",
"OrganizationsPage.noOrganizationsYet": "No organizations yet",
"OrganizationsPage.noOrganizationsAvailableYet": "No organizations available yet",
"OrganizationsPage.noLaunches": "No launches",
"OrganizationsPage.noResultsDescription": "Your search or filter criteria didn't match any results. Please try different keywords or adjust your filter settings.",
"OrganizationsPage.searchPlaceholder": "Buscar por nombre",
"OrganizationsPage.synchedOrganization": "Synched organization",
Expand Down
1 change: 1 addition & 0 deletions app/localization/translated/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -1562,6 +1562,7 @@
"OrganizationsPage.createNewOrganization": "Создайте новую организацию, чтобы начать свой путь на портале отчетов",
"OrganizationsPage.noOrganizationsYet": "Пока нет организаций",
"OrganizationsPage.noOrganizationsAvailableYet": "Пока нет доступных организаций",
"OrganizationsPage.noLaunches": "Никаких запусков",
"OrganizationsPage.noResultsDescription": "Ваши критерии поиска или фильтра не дали никаких результатов. Попробуйте другие ключевые слова или измените настройки фильтра.",
"OrganizationsPage.searchPlaceholder": "Поиск по названию",
"OrganizationsPage.synchedOrganization": "Синхронизированная организация",
Expand Down
1 change: 1 addition & 0 deletions app/localization/translated/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -1562,6 +1562,7 @@
"OrganizationsPage.createNewOrganization": "Створіть нову організацію, щоб розпочати свій шлях на порталі звітів",
"OrganizationsPage.noOrganizationsYet": "Поки немає організацій",
"OrganizationsPage.noOrganizationsAvailableYet": "Поки що немає доступних організацій",
"OrganizationsPage.noLaunches": "Ніяких запусків",
"OrganizationsPage.noResultsDescription": "Ваші критерії пошуку чи фільтра не відповідають жодному результату. Будь ласка, спробуйте інші ключові слова або змініть налаштування фільтра.",
"OrganizationsPage.searchPlaceholder": "Пошук по назві",
"OrganizationsPage.synchedOrganization": "Синхронізована організація",
Expand Down
1 change: 1 addition & 0 deletions app/localization/translated/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -1562,6 +1562,7 @@
"OrganizationsPage.createNewOrganization": "Create a new organization to begin your ReportPortal journey",
"OrganizationsPage.noOrganizationsYet": "No organizations yet",
"OrganizationsPage.noOrganizationsAvailableYet": "No organizations available yet",
"OrganizationsPage.noLaunches": "No launches",
"OrganizationsPage.noResultsDescription": "Your search or filter criteria didn't match any results. Please try different keywords or adjust your filter settings.",
"OrganizationsPage.searchPlaceholder": "按名称搜索",
"OrganizationsPage.synchedOrganization": "Synched organization",
Expand Down
14 changes: 13 additions & 1 deletion app/src/components/main/navLink/navLinkWrapper.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export class NavLinkWrapper extends Component {
onFocus: PropTypes.func,
onBlur: PropTypes.func,
location: PropTypes.object,
title: PropTypes.string,
};

static defaultProps = {
Expand All @@ -46,6 +47,7 @@ export class NavLinkWrapper extends Component {
onFocus: () => {},
onBlur: () => {},
location: null,
title: null,
};

/*
Expand Down Expand Up @@ -97,7 +99,16 @@ export class NavLinkWrapper extends Component {
};

render() {
const { onClick, onFocus, onBlur, children, to, className, activeClassName } = this.props;
const {
onClick,
onFocus,
onBlur,
children,
to,
className,
activeClassName,
title,
} = this.props;

return (
<NavLink
Expand All @@ -108,6 +119,7 @@ export class NavLinkWrapper extends Component {
isActive={this.isActive}
onFocus={onFocus}
onBlur={onBlur}
title={title}
>
{children}
</NavLink>
Expand Down
4 changes: 4 additions & 0 deletions app/src/pages/instance/organizationsPage/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ export const messages = defineMessages({
id: 'OrganizationsPage.latestLaunch',
defaultMessage: 'The latest launch execution',
},
noLaunches: {
id: 'OrganizationsPage.noLaunches',
defaultMessage: 'No launches',
},
noResultsDescription: {
id: 'OrganizationsPage.noResultsDescription',
defaultMessage:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { messages } from '../../messages';
import styles from './organizationCard.scss';

const cx = classNames.bind(styles);
const THREE_MONTHS = 3600 * 24 * 30 * 1000;
const THREE_MONTHS = 1000 * 60 * 60 * 24 * 30 * 3;

export const OrganizationCard = ({ organization }) => {
const { formatMessage } = useIntl();
Expand All @@ -55,7 +55,7 @@ export const OrganizationCard = ({ organization }) => {
const projectsCount = organization.relationships.projects.meta.count;
const lastLaunch = organization.relationships.launches.meta.last_occurred_at;
const { value: relativeTime, unit } = getRelativeUnits(new Date(lastLaunch));
const isOutdated = Date.now() - new Date(lastLaunch).getTime() > THREE_MONTHS;
const isOutdated = lastLaunch && Date.now() - new Date(lastLaunch).getTime() > THREE_MONTHS;

const cartInfo = [
{
Expand All @@ -74,7 +74,11 @@ export const OrganizationCard = ({ organization }) => {
icon: LastUpdateIcon,
className: cx('last-update'),
content: formatMessage(messages.latestLaunch),
bottomElement: <FormattedRelativeTime value={relativeTime} unit={unit} numeric="auto" />,
bottomElement: lastLaunch ? (
<FormattedRelativeTime value={relativeTime} unit={unit} numeric="auto" />
) : (
formatMessage(messages.noLaunches)
),
},
];

Expand All @@ -87,6 +91,7 @@ export const OrganizationCard = ({ organization }) => {
payload: { organizationSlug: organization.slug },
}}
className={cx('organization-link')}
title={organization.name}
>
{organization.name}
</NavLink>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
*/

.organization-card {
width: 384px;
place-self: center;
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 16px;
box-sizing: border-box;
height: 160px;
border-radius: 8px;
min-width: 320px;
max-width: 400px;
box-shadow: $BOX_SHADOW--item;
background-color: $COLOR--white-two;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@ const OrganizationsPanelViewWrapped = ({
changePage={onChangePage}
changePageSize={onChangePageSize}
>
<div className={cx('organizations-list')}>
{organizationsList.map((organization) => (
<OrganizationCard key={organization.id} organization={organization} />
))}
<div className={cx('organizations-list-wrapper')}>
<div className={cx('organizations-list')}>
{organizationsList.map((organization) => (
<OrganizationCard key={organization.id} organization={organization} />
))}
</div>
</div>
</PaginationWrapper>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,16 @@
*/

.organizations-list {
display: flex;
flex-direction: row;
display: grid;
grid-template-columns: auto auto;
grid-template-columns: repeat(auto-fill, minmax(384px, 384px));
justify-content: center;
flex-wrap: wrap;
gap: 24px;
padding-top: 24px;
width: 100%;
}

.organizations-list-wrapper {
padding: 0px 96px;
width: calc(100% - 192px);
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const AddProjectModal = ({ data = {}, handleSubmit, anyTouched, invalid }
<Modal
title={formatMessage(messages.addProject)}
okButton={{
children: formatMessage(messages.createProject),
children: formatMessage(COMMON_LOCALE_KEYS.CREATE),
onClick: () => {
handleSubmit(onCreateProject)();
},
Expand Down

0 comments on commit 1b7726c

Please sign in to comment.