Skip to content
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

Configurable legacy prefix #3020

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ export class Constants {
static readonly INSIGHTS_DEPLOYMENT_MODE = 'insights';
static readonly STANDALONE_DEPLOYMENT_MODE = 'standalone';

static readonly LEGACY_ROLE_PREFIX = 'legacy';
static readonly LEGACY_ROLE_PREFIX_TITLE = 'Legacy';

static readonly ADMIN_GROUP = 'system:partner-engineers';
static PUBLISHED = 'published';

Expand Down
5 changes: 4 additions & 1 deletion src/containers/legacy-namespaces/legacy-namespace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { LegacyRoleAPI } from 'src/api/legacyrole';
import { LegacyNamespaceAPI } from 'src/api/legacynamespace';
import { LegacyNamespaceListType, LegacyRoleListType } from 'src/api';
import { AppContext } from 'src/loaders/app-context';
import { Constants } from 'src/constants';

interface LegacyNamespaceRolesProps {
namespace: LegacyNamespaceListType;
Expand Down Expand Up @@ -139,7 +140,9 @@ class LegacyNamespaceRoles extends React.Component<
/>
) : (
<div>
<DataList aria-label={t`List of Legacy Roles`}>
<DataList
aria-label={t`List of ${Constants.LEGACY_ROLE_PREFIX_TITLE} Roles`}
>
{this.state.roles.map((lrole, ix) => (
<LegacyRoleListItem
key={ix}
Expand Down
9 changes: 7 additions & 2 deletions src/containers/legacy-namespaces/legacy-namespaces.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
import { LegacyNamespaceAPI } from 'src/api/legacynamespace';
import { LegacyNamespaceListType } from 'src/api';
import { AppContext } from 'src/loaders/app-context';
import { Constants } from 'src/constants';

interface LegacyNamespacesProps {
legacynamespaces: LegacyNamespaceListType[];
Expand Down Expand Up @@ -132,7 +133,9 @@ class LegacyNamespaces extends React.Component<

return (
<div>
<BaseHeader title={t`Legacy Namespaces`}></BaseHeader>
<BaseHeader
title={t`${Constants.LEGACY_ROLE_PREFIX_TITLE} Namespaces`}
></BaseHeader>
<React.Fragment>
{loading ? (
<LoadingPageSpinner />
Expand All @@ -155,7 +158,9 @@ class LegacyNamespaces extends React.Component<
count={this.state.count}
/>

<DataList aria-label={t`List of Legacy Namespaces`}>
<DataList
aria-label={t`List of ${Constants.LEGACY_ROLE_PREFIX_TITLE} Namespaces`}
>
{this.state.legacynamespaces &&
this.state.legacynamespaces.map((lnamespace) => (
<LegacyNamespaceListItem
Expand Down
3 changes: 2 additions & 1 deletion src/containers/legacy-roles/legacy-role.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { LegacyRoleAPI } from 'src/api/legacyrole';
import { AppContext } from 'src/loaders/app-context';
import { LegacyRoleDetailType } from 'src/api/response-types/legacy-role';
import { LegacyRoleVersionDetailType } from 'src/api/response-types/legacy-role';
import { Constants } from 'src/constants';

interface RoleMeta {
role: LegacyRoleDetailType;
Expand Down Expand Up @@ -351,7 +352,7 @@ class LegacyRole extends React.Component<RouteComponentProps, IProps> {

const breadcrumbs = [
{
name: 'Legacy Roles',
name: `${Constants.LEGACY_ROLE_PREFIX_TITLE} Roles`,
url: formatPath(Paths.legacyRoles, {}),
},
{
Expand Down
5 changes: 4 additions & 1 deletion src/containers/legacy-roles/legacy-roles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
import { LegacyRoleAPI } from 'src/api/legacyrole';
import { LegacyRoleListType } from 'src/api';
import { AppContext } from 'src/loaders/app-context';
import { Constants } from 'src/constants';

interface IProps {
legacyroles: LegacyRoleListType[];
Expand Down Expand Up @@ -143,7 +144,9 @@ class LegacyRoles extends React.Component<RouteComponentProps, IProps> {

return (
<div>
<BaseHeader title={t`Legacy Roles`}></BaseHeader>
<BaseHeader
title={t`${Constants.LEGACY_ROLE_PREFIX_TITLE} Roles`}
></BaseHeader>
<React.Fragment>
{loading ? (
<LoadingPageSpinner />
Expand Down
7 changes: 4 additions & 3 deletions src/loaders/standalone/standalone-loader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import {
import { hasPermission } from 'src/utilities';
import { AppContext } from '../app-context';
import Logo from 'src/../static/images/logo_large.svg';
import { Constants } from 'src/constants';

interface IState {
user: UserType;
Expand Down Expand Up @@ -385,15 +386,15 @@ class App extends React.Component<RouteComponentProps, IState> {
],
),
menuSection(
t`Legacy`,
t`${Constants.LEGACY_ROLE_PREFIX_TITLE}`,
{
condition: ({ featureFlags }) => featureFlags.legacy_roles,
},
[
menuItem(t`Legacy Roles`, {
menuItem(t`${Constants.LEGACY_ROLE_PREFIX_TITLE} Roles`, {
url: Paths.legacyRoles,
}),
menuItem(t`Legacy Namespaces`, {
menuItem(t`${Constants.LEGACY_ROLE_PREFIX_TITLE} Namespaces`, {
url: Paths.legacyNamespaces,
}),
],
Expand Down