fix: update case of StackStrom to Stackstorm or stackstorm where necessary
Signed-off-by: pamelin <pamelin@expediagroup.com>
This commit is contained in:
@@ -17,7 +17,7 @@ import { UrlPatternDiscovery } from '@backstage/core-app-api';
|
||||
import { setupRequestMockHandlers } from '@backstage/test-utils';
|
||||
import { rest } from 'msw';
|
||||
import { setupServer } from 'msw/node';
|
||||
import { StackStormClient } from './StackStormClient';
|
||||
import { StackstormClient } from './StackstormClient';
|
||||
import { Action, Execution, Pack } from './types';
|
||||
|
||||
const server = setupServer();
|
||||
@@ -148,12 +148,12 @@ const identityApiMock = () => ({
|
||||
getCredentials: jest.fn().mockResolvedValue({ token: undefined }),
|
||||
});
|
||||
|
||||
describe('StackStormClient', () => {
|
||||
describe('StackstormClient', () => {
|
||||
setupRequestMockHandlers(server);
|
||||
|
||||
const mockBaseUrl = 'http://backstage:9191/api/proxy';
|
||||
const discoveryApi = UrlPatternDiscovery.compile(mockBaseUrl);
|
||||
let client: StackStormClient;
|
||||
let client: StackstormClient;
|
||||
|
||||
const setupHandlers = () => {
|
||||
server.use(
|
||||
@@ -184,7 +184,7 @@ describe('StackStormClient', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
setupHandlers();
|
||||
client = new StackStormClient({
|
||||
client = new StackstormClient({
|
||||
discoveryApi: discoveryApi,
|
||||
identityApi: identityApiMock(),
|
||||
});
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Action, Execution, Pack, StackStormApi } from './types';
|
||||
import { Action, Execution, Pack, StackstormApi } from './types';
|
||||
import { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';
|
||||
|
||||
export class StackStormClient implements StackStormApi {
|
||||
export class StackstormClient implements StackstormApi {
|
||||
private readonly discoveryApi: DiscoveryApi;
|
||||
private readonly identityApi: IdentityApi;
|
||||
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export { stackStormApiRef } from './types';
|
||||
export { stackstormApiRef } from './types';
|
||||
export type {
|
||||
Action,
|
||||
Execution,
|
||||
ExecutionLog,
|
||||
Pack,
|
||||
StackStormApi,
|
||||
StackstormApi,
|
||||
} from './types';
|
||||
export { StackStormClient } from './StackStormClient';
|
||||
export { StackstormClient } from './StackstormClient';
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
import { createApiRef } from '@backstage/core-plugin-api';
|
||||
|
||||
export const stackStormApiRef = createApiRef<StackStormApi>({
|
||||
export const stackstormApiRef = createApiRef<StackstormApi>({
|
||||
id: 'plugin.stackstorm.service',
|
||||
});
|
||||
|
||||
@@ -51,7 +51,7 @@ export type Pack = {
|
||||
version: string;
|
||||
};
|
||||
|
||||
export interface StackStormApi {
|
||||
export interface StackstormApi {
|
||||
getExecutions(limit: number, offset: number): Promise<Execution[]>;
|
||||
getExecution(id: string): Promise<Execution>;
|
||||
getPacks(): Promise<Pack[]>;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
import { renderInTestApp, TestApiProvider } from '@backstage/test-utils';
|
||||
import React from 'react';
|
||||
import { Action, Pack, StackStormApi, stackStormApiRef } from '../../api';
|
||||
import { Action, Pack, StackstormApi, stackstormApiRef } from '../../api';
|
||||
import { ActionsList, PackListItem } from './ActionsList';
|
||||
|
||||
const packs: Pack[] = [
|
||||
@@ -53,14 +53,14 @@ const actions: Action[] = [
|
||||
];
|
||||
|
||||
describe('ActionsList', () => {
|
||||
const mockApi: jest.Mocked<StackStormApi> = {
|
||||
const mockApi: jest.Mocked<StackstormApi> = {
|
||||
getPacks: jest.fn().mockResolvedValue(packs),
|
||||
getActions: jest.fn().mockResolvedValue(actions),
|
||||
} as any;
|
||||
|
||||
it('should render all packs', async () => {
|
||||
const { getByText } = await renderInTestApp(
|
||||
<TestApiProvider apis={[[stackStormApiRef, mockApi]]}>
|
||||
<TestApiProvider apis={[[stackstormApiRef, mockApi]]}>
|
||||
<ActionsList />
|
||||
</TestApiProvider>,
|
||||
);
|
||||
@@ -73,7 +73,7 @@ describe('ActionsList', () => {
|
||||
|
||||
it('should render all pack actions', async () => {
|
||||
const { getByText } = await renderInTestApp(
|
||||
<TestApiProvider apis={[[stackStormApiRef, mockApi]]}>
|
||||
<TestApiProvider apis={[[stackstormApiRef, mockApi]]}>
|
||||
<PackListItem pack={packs[1]} opened onClick={() => {}} />
|
||||
</TestApiProvider>,
|
||||
);
|
||||
|
||||
@@ -29,7 +29,7 @@ import { makeStyles } from '@material-ui/core/styles';
|
||||
import ExpandMore from '@material-ui/icons/ExpandMore';
|
||||
import ExpandLess from '@material-ui/icons/ExpandLess';
|
||||
import { Alert } from '@material-ui/lab';
|
||||
import { Action, Pack, stackStormApiRef } from '../../api';
|
||||
import { Action, Pack, stackstormApiRef } from '../../api';
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
root: {
|
||||
@@ -54,7 +54,7 @@ type ActionItemsProps = {
|
||||
|
||||
export const ActionItems = ({ pack }: ActionItemsProps) => {
|
||||
const classes = useStyles();
|
||||
const st2 = useApi(stackStormApiRef);
|
||||
const st2 = useApi(stackstormApiRef);
|
||||
const config = useApi(configApiRef);
|
||||
|
||||
const { value, loading, error } = useAsync(async (): Promise<Action[]> => {
|
||||
@@ -120,7 +120,7 @@ export const PackListItem = ({ pack, opened, onClick }: PackListItemProps) => {
|
||||
};
|
||||
|
||||
export const ActionsList = () => {
|
||||
const st2 = useApi(stackStormApiRef);
|
||||
const st2 = useApi(stackstormApiRef);
|
||||
|
||||
const classes = useStyles();
|
||||
const [expanded, setExpanded] = useState<string[]>([]);
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
TestApiProvider,
|
||||
} from '@backstage/test-utils';
|
||||
import React from 'react';
|
||||
import { Execution, StackStormApi, stackStormApiRef } from '../../api';
|
||||
import { Execution, StackstormApi, stackstormApiRef } from '../../api';
|
||||
import { ExecutionPanel } from './ExecutionPanel';
|
||||
|
||||
const execution: Execution = {
|
||||
@@ -52,7 +52,7 @@ const execution: Execution = {
|
||||
};
|
||||
|
||||
describe('ExecutionPanel', () => {
|
||||
const mockApi: jest.Mocked<StackStormApi> = {
|
||||
const mockApi: jest.Mocked<StackstormApi> = {
|
||||
getExecution: jest.fn().mockResolvedValue(execution),
|
||||
} as any;
|
||||
|
||||
@@ -60,7 +60,7 @@ describe('ExecutionPanel', () => {
|
||||
const { getByText } = await renderInTestApp(
|
||||
<TestApiProvider
|
||||
apis={[
|
||||
[stackStormApiRef, mockApi],
|
||||
[stackstormApiRef, mockApi],
|
||||
[
|
||||
configApiRef,
|
||||
new MockConfigApi({ stackstorm: { webUrl: 'http://localhost' } }),
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
import React from 'react';
|
||||
import { CodeSnippet, Progress } from '@backstage/core-components';
|
||||
import { configApiRef, useApi } from '@backstage/core-plugin-api';
|
||||
import { Execution, stackStormApiRef } from '../../api';
|
||||
import { Execution, stackstormApiRef } from '../../api';
|
||||
import useAsync from 'react-use/lib/useAsync';
|
||||
import { Alert } from '@material-ui/lab';
|
||||
import {
|
||||
@@ -148,7 +148,7 @@ const ExecutionCard = ({ e }: { e: Execution }) => {
|
||||
};
|
||||
|
||||
export const ExecutionPanel = ({ id }: { id: string }) => {
|
||||
const st2 = useApi(stackStormApiRef);
|
||||
const st2 = useApi(stackstormApiRef);
|
||||
|
||||
const { value, loading, error } = useAsync(async (): Promise<Execution> => {
|
||||
const data = await st2.getExecution(id);
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
TestApiProvider,
|
||||
} from '@backstage/test-utils';
|
||||
import React from 'react';
|
||||
import { Execution, StackStormApi, stackStormApiRef } from '../../api';
|
||||
import { Execution, StackstormApi, stackstormApiRef } from '../../api';
|
||||
import { ExecutionsTable } from './ExecutionsTable';
|
||||
|
||||
const executions: Execution[] = [
|
||||
@@ -81,7 +81,7 @@ const executions: Execution[] = [
|
||||
];
|
||||
|
||||
describe('ExecutionsTable', () => {
|
||||
const mockApi: jest.Mocked<StackStormApi> = {
|
||||
const mockApi: jest.Mocked<StackstormApi> = {
|
||||
getExecutions: jest.fn().mockResolvedValue(executions),
|
||||
} as any;
|
||||
|
||||
@@ -89,7 +89,7 @@ describe('ExecutionsTable', () => {
|
||||
const { getByText } = await renderInTestApp(
|
||||
<TestApiProvider
|
||||
apis={[
|
||||
[stackStormApiRef, mockApi],
|
||||
[stackstormApiRef, mockApi],
|
||||
[
|
||||
configApiRef,
|
||||
new MockConfigApi({ stackstorm: { webUrl: 'http://localhost' } }),
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Link, Table, TableColumn } from '@backstage/core-components';
|
||||
import { useApi, configApiRef, errorApiRef } from '@backstage/core-plugin-api';
|
||||
import { Execution, stackStormApiRef } from '../../api';
|
||||
import { Execution, stackstormApiRef } from '../../api';
|
||||
import { Status } from './Status';
|
||||
import { ExecutionPanel } from './ExecutionPanel';
|
||||
|
||||
@@ -94,7 +94,7 @@ export const DenseTable = ({
|
||||
};
|
||||
|
||||
export const ExecutionsTable = () => {
|
||||
const st2 = useApi(stackStormApiRef);
|
||||
const st2 = useApi(stackstormApiRef);
|
||||
const errorApi = useApi(errorApiRef);
|
||||
const [page, setPage] = useState(0);
|
||||
const [rowsPerPage, setRowsPerPage] = useState(10);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
import { renderInTestApp, TestApiProvider } from '@backstage/test-utils';
|
||||
import React from 'react';
|
||||
import { Pack, StackStormApi, stackStormApiRef } from '../../api';
|
||||
import { Pack, StackstormApi, stackstormApiRef } from '../../api';
|
||||
import { PacksTable } from './PacksTable';
|
||||
|
||||
const packs: Pack[] = [
|
||||
@@ -32,13 +32,13 @@ const packs: Pack[] = [
|
||||
];
|
||||
|
||||
describe('PacksTable', () => {
|
||||
const mockApi: jest.Mocked<StackStormApi> = {
|
||||
const mockApi: jest.Mocked<StackstormApi> = {
|
||||
getPacks: jest.fn().mockResolvedValue(packs),
|
||||
} as any;
|
||||
|
||||
it('should render all packs', async () => {
|
||||
const { getByText } = await renderInTestApp(
|
||||
<TestApiProvider apis={[[stackStormApiRef, mockApi]]}>
|
||||
<TestApiProvider apis={[[stackstormApiRef, mockApi]]}>
|
||||
<PacksTable />
|
||||
</TestApiProvider>,
|
||||
);
|
||||
|
||||
@@ -18,7 +18,7 @@ import { Progress, Table, TableColumn } from '@backstage/core-components';
|
||||
import { Alert } from '@material-ui/lab';
|
||||
import useAsync from 'react-use/lib/useAsync';
|
||||
import { useApi } from '@backstage/core-plugin-api';
|
||||
import { Pack, stackStormApiRef } from '../../api';
|
||||
import { Pack, stackstormApiRef } from '../../api';
|
||||
|
||||
type DenseTableProps = {
|
||||
packs: Pack[];
|
||||
@@ -42,7 +42,7 @@ export const DenseTable = ({ packs }: DenseTableProps) => {
|
||||
};
|
||||
|
||||
export const PacksTable = () => {
|
||||
const st2 = useApi(stackStormApiRef);
|
||||
const st2 = useApi(stackstormApiRef);
|
||||
|
||||
const { value, loading, error } = useAsync(async (): Promise<Pack[]> => {
|
||||
const data = await st2.getPacks();
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { StackStormHome } from './StackStormHome';
|
||||
import { StackstormHome } from './StackstormHome';
|
||||
import { screen } from '@testing-library/react';
|
||||
import { renderInTestApp, TestApiProvider } from '@backstage/test-utils';
|
||||
import { StackStormApi, stackStormApiRef } from '../../api';
|
||||
import { StackstormApi, stackstormApiRef } from '../../api';
|
||||
|
||||
describe('StackStormHome', () => {
|
||||
const mockApi: jest.Mocked<StackStormApi> = {
|
||||
describe('StackstormHome', () => {
|
||||
const mockApi: jest.Mocked<StackstormApi> = {
|
||||
getExecutions: jest.fn().mockResolvedValue([]),
|
||||
getExecution: jest.fn().mockResolvedValue({}),
|
||||
getPacks: jest.fn().mockResolvedValue([]),
|
||||
@@ -29,8 +29,8 @@ describe('StackStormHome', () => {
|
||||
|
||||
it('should render', async () => {
|
||||
await renderInTestApp(
|
||||
<TestApiProvider apis={[[stackStormApiRef, mockApi]]}>
|
||||
<StackStormHome />
|
||||
<TestApiProvider apis={[[stackstormApiRef, mockApi]]}>
|
||||
<StackstormHome />
|
||||
</TestApiProvider>,
|
||||
);
|
||||
expect(screen.getByText('Welcome to StackStorm!')).toBeInTheDocument();
|
||||
|
||||
@@ -27,7 +27,7 @@ import { ExecutionsTable } from '../ExecutionsTable';
|
||||
import { PacksTable } from '../PacksTable/PacksTable';
|
||||
import { ActionsList } from '../ActionsList';
|
||||
|
||||
export const StackStormHome = () => (
|
||||
export const StackstormHome = () => (
|
||||
<Page themeId="tool">
|
||||
<Header title="Welcome to StackStorm!" subtitle="Event-driven automation">
|
||||
<IconButton aria-label="Docs" href="https://docs.stackstorm.com/">
|
||||
|
||||
@@ -13,4 +13,4 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export { StackStormHome } from './StackStormHome';
|
||||
export { StackstormHome } from './StackstormHome';
|
||||
|
||||
@@ -21,8 +21,7 @@ import {
|
||||
discoveryApiRef,
|
||||
identityApiRef,
|
||||
} from '@backstage/core-plugin-api';
|
||||
import { stackStormApiRef, StackStormClient } from './api';
|
||||
|
||||
import { stackstormApiRef, StackstormClient } from './api';
|
||||
import { rootRouteRef } from './routes';
|
||||
|
||||
/**
|
||||
@@ -34,13 +33,13 @@ export const stackstormPlugin = createPlugin({
|
||||
id: 'stackstorm',
|
||||
apis: [
|
||||
createApiFactory({
|
||||
api: stackStormApiRef,
|
||||
api: stackstormApiRef,
|
||||
deps: {
|
||||
discoveryApi: discoveryApiRef,
|
||||
identityApi: identityApiRef,
|
||||
},
|
||||
factory: ({ discoveryApi, identityApi }) =>
|
||||
new StackStormClient({
|
||||
new StackstormClient({
|
||||
discoveryApi,
|
||||
identityApi,
|
||||
}),
|
||||
@@ -60,7 +59,7 @@ export const StackstormPage = stackstormPlugin.provide(
|
||||
createRoutableExtension({
|
||||
name: 'StackstormPage',
|
||||
component: () =>
|
||||
import('./components/StackStormHome').then(m => m.StackStormHome),
|
||||
import('./components/StackstormHome').then(m => m.StackstormHome),
|
||||
mountPoint: rootRouteRef,
|
||||
}),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user