Skip to content

Commit

Permalink
Merge pull request #7420 from rohitkrai03/gitops-plugin
Browse files Browse the repository at this point in the history
Move gitops code out into its own monorepo package
  • Loading branch information
openshift-merge-robot committed Dec 4, 2020
2 parents 8592ed2 + a7d4e34 commit 08f2d73
Show file tree
Hide file tree
Showing 41 changed files with 172 additions and 106 deletions.
1 change: 1 addition & 0 deletions frontend/packages/console-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"@console/ceph-storage-plugin": "0.0.0-fixed",
"@console/container-security": "0.0.0-fixed",
"@console/dev-console": "0.0.0-fixed",
"@console/gitops-plugin": "0.0.0-fixed",
"@console/helm-plugin": "0.0.0-fixed",
"@console/internal": "0.0.0-fixed",
"@console/insights-plugin": "0.0.0-fixed",
Expand Down
19 changes: 0 additions & 19 deletions frontend/packages/dev-console/locales/en/devconsole.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,6 @@
"Cancel": "Cancel",
"Edit": "Edit",
"Select a way to create an Application, component or service from one of the options.": "Select a way to create an Application, component or service from one of the options.",
"{{id}} by {{author}}": "{{id}} by {{author}}",
"Commit details not available": "Commit details not available",
"Cluster URL not available": "Cluster URL not available",
"Environments": "Environments",
"Application environments": "Application environments",
"Manifest file repo": "Manifest file repo",
"Image not available": "Image not available",
"Service source URL not available": "Service source URL not available",
"Pod info not available": "Pod info not available",
"Info not available": "Info not available",
"Environment details were not found. Try reloading the page or contacting an administrator.": "Environment details were not found. Try reloading the page or contacting an administrator.",
"{{appName}} · Details": "{{appName}} · Details",
"Argo CD": "Argo CD",
"{{count, number}} item": "{{count, number}} item",
"{{count, number}} item_plural": "{{count, number}} items",
"{{count, number}} Environment": "{{count, number}} Environment",
"{{count, number}} Environment_plural": "{{count, number}} Environments",
"No GitOps manifest URLs found": "No GitOps manifest URLs found",
"No Application groups found": "No Application groups found",
"Get started with a tour of some of the key areas in OpenShift {{version}} Developer perspective that can help you complete workflows and be more productive.": "Get started with a tour of some of the key areas in OpenShift {{version}} Developer perspective that can help you complete workflows and be more productive.",
"Switch between the Developer and Administrator perspectives.": "Switch between the Developer and Administrator perspectives.",
"Use the Administrator perspective to manage workload storage, networking, cluster settings, and more. This may require additional user access.": "Use the Administrator perspective to manage workload storage, networking, cluster settings, and more. This may require additional user access.",
Expand Down
2 changes: 0 additions & 2 deletions frontend/packages/dev-console/src/const.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
export const FLAG_OPENSHIFT_GITOPS = 'OPENSHIFT_GITOPS';

/** URL query params that adjust scope / purpose of the page */
export enum QUERY_PROPERTIES {
/** For defining a contextual application group (ie, add new workload into this application group) */
Expand Down
1 change: 0 additions & 1 deletion frontend/packages/dev-console/src/models/index.ts
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
export * from './gitops';
62 changes: 1 addition & 61 deletions frontend/packages/dev-console/src/plugin.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from 'react';
import * as _ from 'lodash';
import {
BoltIcon,
CatalogIcon,
Expand All @@ -9,7 +8,6 @@ import {
} from '@patternfly/react-icons';
import {
Plugin,
ModelDefinition,
ModelFeatureFlag,
KebabActions,
NavSection,
Expand Down Expand Up @@ -41,9 +39,8 @@ import {
DeploymentModel,
} from '@console/internal/models';
import { doConnectsToBinding } from '@console/topology/src/utils/connector-utils';
import * as models from './models';
import { getKebabActionsForKind } from './utils/kebab-actions';
import { FLAG_OPENSHIFT_GITOPS, INCONTEXT_ACTIONS_CONNECTS_TO } from './const';
import { INCONTEXT_ACTIONS_CONNECTS_TO } from './const';
import { AddAction } from './extensions/add-actions';
import * as yamlIcon from './images/yaml.svg';
import * as importGitIcon from './images/from-git.svg';
Expand All @@ -54,7 +51,6 @@ import { getGuidedTour } from './components/guided-tour';
import { CatalogConsumedExtensions, catalogPlugin } from './components/catalog/catalog-plugin';

type ConsumedExtensions =
| ModelDefinition
| ModelFeatureFlag
| NavSection
| CustomFeatureFlag
Expand All @@ -75,19 +71,6 @@ type ConsumedExtensions =
| CatalogConsumedExtensions;

const plugin: Plugin<ConsumedExtensions> = [
{
type: 'ModelDefinition',
properties: {
models: _.values(models),
},
},
{
type: 'FeatureFlag/Model',
properties: {
model: models.GitOpsServiceModel,
flag: FLAG_OPENSHIFT_GITOPS,
},
},
{
type: 'Nav/Section',
properties: {
Expand Down Expand Up @@ -183,23 +166,6 @@ const plugin: Plugin<ConsumedExtensions> = [
required: [FLAGS.OPENSHIFT],
},
},
{
type: 'NavItem/Href',
properties: {
id: 'environments',
perspective: 'dev',
section: 'resources',
componentProps: {
// t('devconsole~Environments')
name: '%devconsole~Environments%',
href: '/environments',
testID: 'environments-header',
},
},
flags: {
required: [FLAG_OPENSHIFT_GITOPS],
},
},
{
type: 'NavItem/Href',
properties: {
Expand Down Expand Up @@ -304,32 +270,6 @@ const plugin: Plugin<ConsumedExtensions> = [
).default,
},
},
{
type: 'Page/Route',
properties: {
exact: true,
path: '/environments',
loader: async () =>
(
await import(
'./components/gitops/GitOpsListPage' /* webpackChunkName: "dev-console-gitops" */
)
).default,
},
},
{
type: 'Page/Route',
properties: {
exact: true,
path: '/environments/:appName',
loader: async () =>
(
await import(
'./components/gitops/GitOpsDetailsPage' /* webpackChunkName: "dev-console-gitops" */
)
).default,
},
},
{
type: 'Page/Route',
properties: {
Expand Down
21 changes: 21 additions & 0 deletions frontend/packages/gitops-plugin/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
reviewers:
- andrewballantyne
- abhinandan13jan
- debsmita1
- divyanshiGupta
- christianvogt
- invincibleJai
- jerolimov
- karthikjeeyar
- nemesis09
- rohitkrai03
- rottencandy
- sahil143
- vikram-raj
approvers:
- andrewballantyne
- christianvogt
- invincibleJai
- rohitkrai03
labels:
- component/gitops-plugin
4 changes: 4 additions & 0 deletions frontend/packages/gitops-plugin/console-extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "../console-dynamic-plugin-sdk/dist/schema/console-extensions.json",
"data": []
}
21 changes: 21 additions & 0 deletions frontend/packages/gitops-plugin/locales/en/gitops-plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"{{id}} by {{author}}": "{{id}} by {{author}}",
"Commit details not available": "Commit details not available",
"Cluster URL not available": "Cluster URL not available",
"Environments": "Environments",
"Application environments": "Application environments",
"Manifest file repo": "Manifest file repo",
"Image not available": "Image not available",
"Service source URL not available": "Service source URL not available",
"Pod info not available": "Pod info not available",
"Info not available": "Info not available",
"Environment details were not found. Try reloading the page or contacting an administrator.": "Environment details were not found. Try reloading the page or contacting an administrator.",
"{{appName}} · Details": "{{appName}} · Details",
"Argo CD": "Argo CD",
"{{count, number}} item": "{{count, number}} item",
"{{count, number}} item_plural": "{{count, number}} items",
"{{count, number}} Environment": "{{count, number}} Environment",
"{{count, number}} Environment_plural": "{{count, number}} Environments",
"No GitOps manifest URLs found": "No GitOps manifest URLs found",
"No Application groups found": "No Application groups found"
}
14 changes: 14 additions & 0 deletions frontend/packages/gitops-plugin/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "@console/gitops-plugin",
"version": "0.0.0-fixed",
"description": "Gitops plugin contributes gitops environments UI to Developer Console.",
"private": true,
"scripts": {
"coverage": "yarn test --coverage --collectCoverageFrom='[\"packages/gitops-plugin/src/**\",\"!**/__tests__/**\",\"!packages/gitops-plugin/src/test/**\"]'",
"lint": "yarn --cwd ../.. eslint packages/gitops-plugin",
"test": "yarn --cwd ../.. test packages/gitops-plugin"
},
"consolePlugin": {
"entry": "src/plugin.ts"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const GitOpsDetailsPage: React.FC<GitOpsDetailsPageProps> = ({ match, location }
const app = _.find(appGroups, (appObj) => appName === appObj?.name);
if (!app?.environments) {
emptyMsg = t(
'devconsole~Environment details were not found. Try reloading the page or contacting an administrator.',
'gitops-plugin~Environment details were not found. Try reloading the page or contacting an administrator.',
);
}
setEmptyStateMsg(emptyMsg);
Expand Down Expand Up @@ -78,7 +78,7 @@ const GitOpsDetailsPage: React.FC<GitOpsDetailsPageProps> = ({ match, location }
return (
<>
<Helmet>
<title>{t('devconsole~{{appName}} · Details', { appName })}</title>
<title>{t('gitops-plugin~{{appName}} · Details', { appName })}</title>
</Helmet>
<GitOpsDetailsPageHeading
url={match.url}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
EmptyStateVariant,
EmptyStateBody,
} from '@patternfly/react-core';
import * as gitopsIcon from '../../images/gitops.svg';
import * as gitopsIcon from '../images/gitops.svg';
import './GitOpsEmptyState.scss';

interface GitOpsEmptyStateProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';
import * as _ from 'lodash';
import Helmet from 'react-helmet';
import { useTranslation } from 'react-i18next';
import { PageHeading, LoadingBox, ExternalLink } from '@console/internal/components/utils';
Expand All @@ -10,7 +11,6 @@ import GitOpsList from './list/GitOpsList';
import { fetchAllAppGroups, getManifestURLs, getPipelinesBaseURI } from './utils/gitops-utils';
import useDefaultSecret from './utils/useDefaultSecret';
import { Split, SplitItem } from '@patternfly/react-core';
import * as _ from 'lodash';
import './GitOpsListPage.scss';

const projectRes = { isList: true, kind: ProjectModel.kind, optional: true };
Expand Down Expand Up @@ -57,15 +57,15 @@ const GitOpsListPage: React.FC = () => {
return (
<>
<Helmet>
<title>{t('devconsole~Environments')}</title>
<title>{t('gitops-plugin~Environments')}</title>
</Helmet>
<PageHeading
title={t('devconsole~Environments')}
title={t('gitops-plugin~Environments')}
badge={
<Split className="odc-gitops-list-page-heading" hasGutter>
<SplitItem>
{argocdLink && (
<ExternalLink href={argocdLink.spec.href} text={t('devconsole~Argo CD')} />
<ExternalLink href={argocdLink.spec.href} text={t('gitops-plugin~Argo CD')} />
)}
</SplitItem>
<SplitItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,13 @@ const CommitDetails: React.FC<CommitDetailsProps> = ({ imageName }) => {
{commitData.id ? (
<>
<Timestamp timestamp={commitData.timestamp} />
{t('devconsole~{{id}} by {{author}}', { id: commitData.id, author: commitData.author })}
{t('gitops-plugin~{{id}} by {{author}}', {
id: commitData.id,
author: commitData.author,
})}
</>
) : (
<span>{t('devconsole~Commit details not available')}</span>
<span>{t('gitops-plugin~Commit details not available')}</span>
)}
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const GitOpsDetails: React.FC<GitOpsDetailsProps> = ({ envs, appName }) => {
/>
) : (
<div className="odc-gitops-details__env-section__url-empty-state">
{t('devconsole~Cluster URL not available')}
{t('gitops-plugin~Cluster URL not available')}
</div>
)}
</StackItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next';
import { TFunction } from 'i18next';
import * as _ from 'lodash';
import GitOpsDetails from './GitOpsDetails';
import { routeDecoratorIcon } from '../../import/render-utils';
import { routeDecoratorIcon } from '@console/dev-console/src/components/import/render-utils';
import PodRingWrapper from './PodRingWrapper';
import TimestampWrapper from './TimestampWrapper';
import { WORKLOAD_KINDS, GitOpsResource, GitOpsEnvironment } from '../utils/gitops-types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { useTranslation } from 'react-i18next';
import { BreadCrumbs, ResourceIcon } from '@console/internal/components/utils';
import { Split, SplitItem, Label } from '@patternfly/react-core';
import { routeDecoratorIcon } from '../../import/render-utils';
import { routeDecoratorIcon } from '@console/dev-console/src/components/import/render-utils';
import './GitOpsDetailsPageHeading.scss';

interface GitOpsDetailsPageHeadingProps {
Expand All @@ -21,11 +21,11 @@ const GitOpsDetailsPageHeading: React.FC<GitOpsDetailsPageHeadingProps> = ({
const { t } = useTranslation();
const breadcrumbs = [
{
name: t('devconsole~Environments'),
name: t('gitops-plugin~Environments'),
path: '/environments',
},
{
name: t('devconsole~Application environments'),
name: t('gitops-plugin~Application environments'),
path: `${url}`,
},
];
Expand All @@ -41,7 +41,7 @@ const GitOpsDetailsPageHeading: React.FC<GitOpsDetailsPageHeadingProps> = ({
{badge && <span className="co-m-pane__heading-badge">{badge}</span>}
</h1>
<Split className="odc-gitops-details-page-heading__repo" hasGutter>
<SplitItem>{t('devconsole~Manifest file repo')}:</SplitItem>
<SplitItem>{t('gitops-plugin~Manifest file repo')}:</SplitItem>
<SplitItem isFilled>
<Label
style={{ fontSize: '12px' }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const GitOpsServiceDetailsSection: React.FC<GitOpsServiceDetailsSectionProps> =
</CardTitle>
<CardBody>
<Label className="co-nowrap" style={{ fontSize: '12px' }} color="cyan">
{service.image || <div>{t('devconsole~Image not available')}</div>}
{service.image || <div>{t('gitops-plugin~Image not available')}</div>}
</Label>
<Split className="odc-gitops-service__details">
<SplitItem>
Expand All @@ -60,7 +60,7 @@ const GitOpsServiceDetailsSection: React.FC<GitOpsServiceDetailsSectionProps> =
/>
) : (
<div className="odc-gitops-service__details">
{t('devconsole~Service source URL not available')}
{t('gitops-plugin~Service source URL not available')}
</div>
)}
</CardBody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const PodRingWrapper: React.FC<PodRingWrapperProps> = ({ workload }) => {
enableScaling={false}
/>
) : (
<div style={{ border: '1px solid' }}>{t('devconsole~Pod info not available')}</div>
<div style={{ border: '1px solid' }}>{t('gitops-plugin~Pod info not available')}</div>
)}
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const TimestampWrapper: React.FC<TimestampWrapperProps> = ({ resModels }) => {
{lastUpdatedTimestamp ? (
<Timestamp timestamp={lastUpdatedTimestamp} />
) : (
<div>{t('devconsole~Info not available')}</div>
<div>{t('gitops-plugin~Info not available')}</div>
)}
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const GitOpsList: React.FC<GitOpsListProps> = ({ appGroups, emptyStateMsg }) =>
<Split>
<SplitItem isFilled />
<SplitItem>
{t('devconsole~{{count, number}} item', {
{t('gitops-plugin~{{count, number}} item', {
count: _.size(appGroups),
})}
</SplitItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const GitOpsListItem: React.FC<GitOpsListItemProps> = ({ appGroup }) => {
<ResourceLink kind="application" name={appGroup.name} linkTo={false} />
</GridItem>
<GridItem lg={6} md={6} sm={6}>
{t('devconsole~{{count, number}} Environment', {
{t('gitops-plugin~{{count, number}} Environment', {
count: _.size(appGroup.environments),
})}
</GridItem>
Expand Down

0 comments on commit 08f2d73

Please sign in to comment.