Skip to content

Commit

Permalink
refactor(HMS-2721): move idmsvc api client
Browse files Browse the repository at this point in the history
Prepare repository to hold the rbac api client so
we don't have to add code for the communications.

This change update Makefile rules to generate idmsvc
api client in its own directory and update all the
references in the code.

Signed-off-by: Alejandro Visiedo <[email protected]>
  • Loading branch information
avisiedo committed May 15, 2024
1 parent 0cbdf84 commit 370b761
Show file tree
Hide file tree
Showing 25 changed files with 25 additions and 19 deletions.
12 changes: 9 additions & 3 deletions scripts/mk/crc-frontend.mk
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,17 @@ run:$(NODE_BIN)/fec ## Execute frontend

.PHONY: generate-api
generate-api: $(NODE_BIN)/openapi-generator-cli $(NODE_BIN)/prettier $(PUBLIC_OPENAPI) ## Generate the API client from openapi specification
@rm -rf $(APIDIR)
@rm -rf "$(APIDIR)/idmsvc"

# Generate idmsvc API client
TS_POST_PROCESS_FILE="node_modules/.bin/prettier --write" \
npm run openapi-generator-cli -- generate --enable-post-process-file \
-i "$(PUBLIC_OPENAPI)" -g typescript-axios -o $(APIDIR)
@rm -f $(APIDIR)/.gitignore $(APIDIR)/.npmignore $(APIDIR)/git_push.sh
-i "$(PUBLIC_OPENAPI)" -g typescript-axios -o $(APIDIR)/idmsvc
@rm -rf \
"$(APIDIR)/idmsvc/.gitignore" \
"$(APIDIR)/idmsvc/.npmignore" \
"$(APIDIR)/idmsvc/git_push.sh" \
"$(APIDIR)/idmsvc/.gitignore"

.PHONY: update-api
update-api:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/AppContext.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ReactNode, createContext, useState } from 'react';
import { Domain } from './Api';
import { Domain } from './Api/idmsvc';
import { VerifyState } from './Routes/WizardPage/Components/VerifyRegistry/VerifyRegistry';
import React from 'react';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { render, screen } from '@testing-library/react';
import AutoJoinChangeConfirmDialog from './AutoJoinChangeConfirmDialog';
import '@testing-library/jest-dom';
import { Domain, DomainType } from '../../Api';
import { Domain, DomainType } from '../../Api/idmsvc';

const domain: Domain = {
title: 'domain',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { Button, Modal } from '@patternfly/react-core';
import './AutoJoinChangeConfirmDialog.scss';

import { Domain } from '../../Api/api';
import { Domain } from '../../Api/idmsvc';

interface AutoJoinChangeConfirmDialogProps {
/** The domain to be changed */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { render, screen } from '@testing-library/react';
import ConfirmDeleteDomain from './ConfirmDeleteDomain';
import '@testing-library/jest-dom';
import { Domain } from '../../Api';
import { Domain } from '../../Api/idmsvc';

const domain: Domain = {
domain_name: 'mydomain.test',
Expand Down
2 changes: 1 addition & 1 deletion src/Components/ConfirmDeleteDomain/ConfirmDeleteDomain.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Button, Modal } from '@patternfly/react-core';
import './ConfirmDeleteDomain.scss';
import React from 'react';
import { Domain } from '../../Api/api';
import { Domain } from '../../Api/idmsvc';

interface ConfirmDeleteDomainProps {
domain?: Domain;
Expand Down
2 changes: 1 addition & 1 deletion src/Components/DomainList/DomainList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import './DomainList.scss';
import { Fragment, useContext, useState } from 'react';
import React from 'react';

import { Domain, DomainType, ResourcesApiFactory } from '../../Api/api';
import { Domain, DomainType, ResourcesApiFactory } from '../../Api/idmsvc';
import { useNavigate } from 'react-router-dom';
import { AppContext, AppContextType } from '../../AppContext';
import { Button } from '@patternfly/react-core';
Expand Down
2 changes: 1 addition & 1 deletion src/Routes/DefaultPage/DefaultPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { PageHeader, PageHeaderTitle } from '@redhat-cloud-services/frontend-com

import './DefaultPage.scss';
import Section from '@redhat-cloud-services/frontend-components/Section';
import { Domain, ResourcesApiFactory } from '../../Api/api';
import { Domain, ResourcesApiFactory } from '../../Api/idmsvc';
import { DomainList } from '../../Components/DomainList/DomainList';
import { AppContext } from '../../AppContext';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from '@patternfly/react-core';
import React from 'react';
import { useState } from 'react';
import { Domain, ResourcesApiFactory } from '../../../../Api';
import { Domain, ResourcesApiFactory } from '../../../../Api/idmsvc';
import useNotification from '../../../../Hooks/useNotification';
import OutlinedQuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/outlined-question-circle-icon';
import PencilAltIcon from '@patternfly/react-icons/dist/esm/icons/pencil-alt-icon';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Flex, FlexItem, Stack, StackItem, TextInputGroupUtilities } from '@patternfly/react-core';
import React from 'react';
import { Domain, DomainIpaServer } from '../../../../Api';
import { Domain, DomainIpaServer } from '../../../../Api/idmsvc';
import { Table, Tbody, Td, Th, ThProps, Thead, Tr } from '@patternfly/react-table';

interface DetailServersProps {
Expand Down
2 changes: 1 addition & 1 deletion src/Routes/DetailPage/DetailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Dropdown, DropdownItem, KebabToggle } from '@patternfly/react-core/depr
import { PageHeader, PageHeaderTitle } from '@redhat-cloud-services/frontend-components/PageHeader';

import './DetailPage.scss';
import { Domain, ResourcesApiFactory } from '../../Api/api';
import { Domain, ResourcesApiFactory } from '../../Api/idmsvc';
import { AppContext } from '../../AppContext';
import { DetailGeneral } from './Components/DetailGeneral/DetailGeneral';
import { DetailServers } from './Components/DetailServers/DetailServers';
Expand Down
2 changes: 1 addition & 1 deletion src/Routes/DetailPage/detailNotifications.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';

import { Domain } from '../../Api/api';
import { Domain } from '../../Api/idmsvc';
import { NotificationPayload } from '../../Hooks/useNotification';

export const buildDescriptionEditSuccessNotification = (): NotificationPayload => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import ExternalLinkAltIcon from '@patternfly/react-icons/dist/esm/icons/external
import { Alert, Button, ClipboardCopy, Form, FormGroup, TextContent, Title } from '@patternfly/react-core';

import './PagePreparation.scss';
import { ResourcesApiFactory } from '../../../../Api';
import { ResourcesApiFactory } from '../../../../Api/idmsvc';
import { AppContext } from '../../../../AppContext';

/** Represent the properties for PagePreparation component. */
Expand Down
2 changes: 1 addition & 1 deletion src/Routes/WizardPage/Components/PageReview/PageReview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
} from '@patternfly/react-core';

import './PageReview.scss';
import { Domain, DomainIpaServer } from '../../../../Api/api';
import { Domain, DomainIpaServer } from '../../../../Api/idmsvc';
import { Table /* data-codemods */, Tbody, Td, Th, Thead, Tr } from '@patternfly/react-table';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Alert, Button, ClipboardCopy, Flex, FlexItem, Form, TextContent, Title

import './PageServiceRegistration.scss';
import VerifyRegistry, { VerifyState } from '../VerifyRegistry/VerifyRegistry';
import { Domain } from '../../../../Api';
import { Domain } from '../../../../Api/idmsvc';

/**
* Represents the properties accepted by the @{link PageServiceRegistration} component.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { PendingIcon } from '@patternfly/react-icons/dist/esm/icons/pending-icon
import { ExternalLinkAltIcon } from '@patternfly/react-icons/dist/esm/icons/external-link-alt-icon';

import './VerifyRegistry.scss';
import { Domain, ResourcesApiFactory } from '../../../../Api';
import { Domain, ResourcesApiFactory } from '../../../../Api/idmsvc';

/* Common definitions */

Expand Down
2 changes: 1 addition & 1 deletion src/Routes/WizardPage/WizardPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { PageHeader, PageHeaderTitle } from '@redhat-cloud-services/frontend-com

import './WizardPage.scss';
import { Link, useNavigate } from 'react-router-dom';
import { Domain, ResourcesApiFactory } from '../../Api/api';
import { Domain, ResourcesApiFactory } from '../../Api/idmsvc';
import { AppContext } from '../../AppContext';
import { VerifyState } from './Components/VerifyRegistry/VerifyRegistry';
import useNotification from '../../Hooks/useNotification';
Expand Down

0 comments on commit 370b761

Please sign in to comment.