feat: modify directory structure (#346)

Signed-off-by: zhaoxinxin <1186037180@qq.com>
This commit is contained in:
Zhaoxinxin 2023-12-22 15:58:07 +08:00 committed by GitHub
parent da66144ca4
commit bdb7632e28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
66 changed files with 82 additions and 157 deletions

View File

@ -1,6 +1,6 @@
import clusters from '../../fixtures/clusters/clusters.json';
import seedPeers from '../../fixtures/clusters/seed-peers.json';
import schedulers from '../../fixtures/clusters/schedulers.json';
import seedPeers from '../../fixtures/seed-peers/seed-peers.json';
import schedulers from '../../fixtures/schedulers/schedulers.json';
import cluster from '../../fixtures/clusters/cluster/cluster.json';
import seedPeer from '../../fixtures/clusters/cluster/seed-peer.json';
import scheduler from '../../fixtures/clusters/cluster/scheduler.json';

View File

@ -1,7 +1,7 @@
import clusters from '../fixtures/clusters/clusters.json';
import seedPeers from '../fixtures/clusters/seed-peers.json';
import schedulers from '../fixtures/clusters/schedulers.json';
import searchCluster from '../fixtures/clusters/search-cluster.json';
import clusters from '../../fixtures/clusters/clusters.json';
import seedPeers from '../../fixtures/seed-peers/seed-peers.json';
import schedulers from '../../fixtures/schedulers/schedulers.json';
import searchCluster from '../../fixtures/clusters/search-cluster.json';
describe('Clusters', () => {
beforeEach(() => {

View File

@ -1,7 +1,7 @@
import clusters from '../fixtures/clusters/clusters.json';
import seedPeers from '../fixtures/clusters/seed-peers.json';
import schedulers from '../fixtures/clusters/schedulers.json';
import createCluster from '../fixtures/clusters/create-cluster.json';
import clusters from '../../fixtures/clusters/clusters.json';
import seedPeers from '../../fixtures/seed-peers/seed-peers.json';
import schedulers from '../../fixtures/schedulers/schedulers.json';
import createCluster from '../../fixtures/clusters/create-cluster.json';
import _ from 'lodash';
describe('Create cluster', () => {

View File

@ -1,5 +1,5 @@
import cluster from '../fixtures/clusters/cluster/cluster.json';
import updateCluster from '../fixtures/clusters/cluster/update-cluster.json';
import cluster from '../../fixtures/clusters/cluster/cluster.json';
import updateCluster from '../../fixtures/clusters/cluster/update-cluster.json';
import _ from 'lodash';
describe('Update cluster', () => {

View File

@ -1,5 +1,5 @@
import tokens from '../fixtures/tokens/tokens.json';
import createToken from '../fixtures/tokens/create-token.json';
import tokens from '../../../fixtures/developer/tokens/tokens.json';
import createToken from '../../../fixtures/developer/tokens/create-token.json';
import _ from 'lodash';
describe('Create token', () => {

View File

@ -1,6 +1,6 @@
import tokens from '../fixtures/tokens/tokens.json';
import deleteToken from '../fixtures/tokens/delete-tokens.json';
import tokenDeleteAfter from '../fixtures/tokens/token-delete-after.json';
import tokens from '../../../fixtures/developer/tokens/tokens.json';
import deleteToken from '../../../fixtures/developer/tokens/delete-tokens.json';
import tokenDeleteAfter from '../../../fixtures/developer/tokens/token-delete-after.json';
describe('Tokens', () => {
beforeEach(() => {

View File

@ -1,6 +1,6 @@
import tokens from '../fixtures/tokens/tokens.json';
import token from '../fixtures/tokens/token.json';
import updateToken from '../fixtures/tokens/update-token.json';
import tokens from '../../../fixtures/developer/tokens/tokens.json';
import token from '../../../fixtures/developer/tokens/token.json';
import updateToken from '../../../fixtures/developer/tokens/update-token.json';
import _ from 'lodash';
describe('Update token', () => {

View File

@ -1,4 +1,4 @@
import peers from '../../fixtures/peers/peers.json';
import peers from '../../../fixtures/insight/peers/peers.json';
const path = require('path');
declare const expect: Chai.ExpectStatic;
@ -25,23 +25,23 @@ describe('Peers', () => {
describe('when data is loaded', () => {
it('should display the total number of peers', () => {
cy.get(':nth-child(1) > .MuiPaper-root > .inde_navigationContent__kHaOF').should('exist');
cy.get('.css-18k9q32 > :nth-child(1) > .MuiPaper-root').should('exist');
cy.get(
':nth-child(1) > .MuiPaper-root > .inde_navigationContent__kHaOF > div.MuiBox-root > .MuiTypography-h5',
':nth-child(1) > .MuiPaper-root > .inde_navigationContent__tkUaj > div.MuiBox-root > .MuiTypography-h5',
).should('have.text', 7);
});
it('should display the total number of git version', () => {
cy.get(':nth-child(2) > .MuiPaper-root > .inde_navigationContent__kHaOF').should('exist');
cy.get('.css-18k9q32 > :nth-child(2) > .MuiPaper-root').should('exist');
cy.get(
':nth-child(2) > .MuiPaper-root > .inde_navigationContent__kHaOF > div.MuiBox-root > .MuiTypography-h5',
':nth-child(2) > .MuiPaper-root > .inde_navigationContent__tkUaj > div.MuiBox-root > .MuiTypography-h5',
).should('have.text', 4);
});
it('should display the total number of git commit', () => {
cy.get(':nth-child(3) > .MuiPaper-root > .inde_navigationContent__kHaOF').should('exist');
cy.get('.css-1l3zj38 > .MuiPaper-root').should('exist');
cy.get(
':nth-child(3) > .MuiPaper-root > .inde_navigationContent__kHaOF > div.MuiBox-root > .MuiTypography-h5',
'.css-1l3zj38 > .MuiPaper-root > .inde_navigationContent__tkUaj > div.MuiBox-root > .MuiTypography-h5',
).should('have.text', 5);
});
@ -218,23 +218,23 @@ describe('Peers', () => {
});
it('should display the total number of peers', () => {
cy.get(':nth-child(1) > .MuiPaper-root > .inde_navigationContent__kHaOF').should('exist');
cy.get('.css-18k9q32 > :nth-child(1) > .MuiPaper-root').should('exist');
cy.get(
':nth-child(1) > .MuiPaper-root > .inde_navigationContent__kHaOF > div.MuiBox-root > .MuiTypography-h5',
':nth-child(1) > .MuiPaper-root > .inde_navigationContent__tkUaj > div.MuiBox-root > .MuiTypography-h5',
).should('have.text', 0);
});
it('should display the total number of git version', () => {
cy.get(':nth-child(2) > .MuiPaper-root > .inde_navigationContent__kHaOF').should('exist');
cy.get('.css-18k9q32 > :nth-child(2) > .MuiPaper-root').should('exist');
cy.get(
':nth-child(2) > .MuiPaper-root > .inde_navigationContent__kHaOF > div.MuiBox-root > .MuiTypography-h5',
':nth-child(2) > .MuiPaper-root > .inde_navigationContent__tkUaj > div.MuiBox-root > .MuiTypography-h5',
).should('have.text', 0);
});
it('should display the total number of git commit', () => {
cy.get(':nth-child(3) > .MuiPaper-root > .inde_navigationContent__kHaOF').should('exist');
cy.get('.css-1l3zj38 > .MuiPaper-root').should('exist');
cy.get(
':nth-child(3) > .MuiPaper-root > .inde_navigationContent__kHaOF > div.MuiBox-root > .MuiTypography-h5',
'.css-1l3zj38 > .MuiPaper-root > .inde_navigationContent__tkUaj > div.MuiBox-root > .MuiTypography-h5',
).should('have.text', 0);
});
@ -270,23 +270,23 @@ describe('Peers', () => {
});
it('should display the total number of peers', () => {
cy.get(':nth-child(1) > .MuiPaper-root > .inde_navigationContent__kHaOF').should('exist');
cy.get('.css-18k9q32 > :nth-child(1) > .MuiPaper-root').should('exist');
cy.get(
':nth-child(1) > .MuiPaper-root > .inde_navigationContent__kHaOF > div.MuiBox-root > .MuiTypography-h5',
':nth-child(1) > .MuiPaper-root > .inde_navigationContent__tkUaj > div.MuiBox-root > .MuiTypography-h5',
).should('have.text', 0);
});
it('should display the total number of git version', () => {
cy.get(':nth-child(2) > .MuiPaper-root > .inde_navigationContent__kHaOF').should('exist');
cy.get('.css-18k9q32 > :nth-child(2) > .MuiPaper-root').should('exist');
cy.get(
':nth-child(2) > .MuiPaper-root > .inde_navigationContent__kHaOF > div.MuiBox-root > .MuiTypography-h5',
':nth-child(2) > .MuiPaper-root > .inde_navigationContent__tkUaj > div.MuiBox-root > .MuiTypography-h5',
).should('have.text', 0);
});
it('should display the total number of git commit', () => {
cy.get(':nth-child(3) > .MuiPaper-root > .inde_navigationContent__kHaOF').should('exist');
cy.get('.css-1l3zj38 > .MuiPaper-root').should('exist');
cy.get(
':nth-child(3) > .MuiPaper-root > .inde_navigationContent__kHaOF > div.MuiBox-root > .MuiTypography-h5',
'.css-1l3zj38 > .MuiPaper-root > .inde_navigationContent__tkUaj > div.MuiBox-root > .MuiTypography-h5',
).should('have.text', 0);
});

View File

@ -1,6 +1,6 @@
import clusters from '../../fixtures/clusters/clusters.json';
import preheats from '../../fixtures/preheats/preheats.json';
import createPreheat from '../../fixtures/preheats/create-preheat.json';
import clusters from '../../../fixtures/clusters/clusters.json';
import preheats from '../../../fixtures/job/preheats/preheats.json';
import createPreheat from '../../../fixtures/job/preheats/create-preheat.json';
import _ from 'lodash';
describe('Create preheat', () => {

View File

@ -1,7 +1,7 @@
import preheats from '../../fixtures/preheats/preheats.json';
import failurePreheat from '../../fixtures/preheats/failure-preheat.json';
import successPreheat from '../../fixtures/preheats/success-preheat.json';
import pendingPreheat from '../../fixtures/preheats/pending-preheat.json';
import preheats from '../../../fixtures/job/preheats/preheats.json';
import failurePreheat from '../../../fixtures/job/preheats/failure-preheat.json';
import successPreheat from '../../../fixtures/job/preheats/success-preheat.json';
import pendingPreheat from '../../../fixtures/job/preheats/pending-preheat.json';
declare const expect: Chai.ExpectStatic;

View File

@ -1,8 +1,8 @@
import preheats from '../../fixtures/preheats/preheats.json';
import paginationPreheats from '../../fixtures/preheats/pagination-preheats.json';
import successPreheats from '../../fixtures/preheats/success-preheats.json';
import failurePreheats from '../../fixtures/preheats/failure-preheats.json';
import pendingPreheats from '../../fixtures/preheats/pending-preheats.json';
import preheats from '../../../fixtures/job/preheats/preheats.json';
import paginationPreheats from '../../../fixtures/job/preheats/pagination-preheats.json';
import successPreheats from '../../../fixtures/job/preheats/success-preheats.json';
import failurePreheats from '../../../fixtures/job/preheats/failure-preheats.json';
import pendingPreheats from '../../../fixtures/job/preheats/pending-preheats.json';
declare const expect: Chai.ExpectStatic;

View File

@ -1,8 +1,4 @@
import root from '../fixtures/role-root.json';
import guest from '../fixtures/role-guest.json';
import user from '../fixtures/user.json';
import guestUser from '../fixtures/guest-user.json';
import updateUser from '../fixtures/update-user.json';
import updateUser from '../../fixtures/users/update-user.json';
import _ from 'lodash';
describe('Profile', () => {

View File

@ -1,7 +1,7 @@
import cluster from '../fixtures/clusters/cluster/cluster.json';
import schedulers from '../fixtures/clusters/cluster/scheduler.json';
import scheduler from '../fixtures/scheduler.json';
import schedulerInactive from '../fixtures/scheduler-inactive.json';
import cluster from '../../fixtures/clusters/cluster/cluster.json';
import schedulers from '../../fixtures/clusters/cluster/scheduler.json';
import scheduler from '../../fixtures/schedulers/scheduler.json';
import schedulerInactive from '../../fixtures/schedulers/scheduler-inactive.json';
describe('Scheduler', () => {
beforeEach(() => {

View File

@ -1,9 +1,9 @@
import cluster from '../../fixtures/clusters/cluster/cluster.json';
import seedPeer from '../../fixtures/clusters/cluster/seed-peer.json';
import scheduler from '../../fixtures/clusters/cluster/scheduler.json';
import deleteScheduler from '../../fixtures/clusters/cluster/delete-scheduler.json';
import schedulerDeleteAfter from '../../fixtures/clusters/cluster/scheduler-delete-after.json';
import searchScheduler from '../../fixtures/clusters/cluster/search-scheduler.json';
import deleteScheduler from '../../fixtures/schedulers/delete-scheduler.json';
import schedulerDeleteAfter from '../../fixtures/schedulers/scheduler-delete-after.json';
import searchScheduler from '../../fixtures/schedulers/search-scheduler.json';
describe('Schedulers', () => {
beforeEach(() => {

View File

@ -1,7 +1,7 @@
import cluster from '../fixtures/clusters/cluster/cluster.json';
import seedPeers from '../fixtures/clusters/cluster/seed-peer.json';
import seedPeer from '../fixtures/seed-peer.json';
import seedPeerInactive from '../fixtures/seed-peer-inactive.json';
import cluster from '../../fixtures/clusters/cluster/cluster.json';
import seedPeers from '../../fixtures/clusters/cluster/seed-peer.json';
import seedPeer from '../../fixtures/seed-peers/seed-peer.json';
import seedPeerInactive from '../../fixtures/seed-peers/seed-peer-inactive.json';
describe('Seed peer', () => {
beforeEach(() => {

View File

@ -1,9 +1,9 @@
import cluster from '../../fixtures/clusters/cluster/cluster.json';
import seedPeer from '../../fixtures/clusters/cluster/seed-peer.json';
import scheduler from '../../fixtures/clusters/cluster/scheduler.json';
import deleteSeedPeer from '../../fixtures/clusters/cluster/delete-seed-peer.json';
import seedPeerDeleteAfter from '../../fixtures/clusters/cluster/seed-peer-delete-after.json';
import searchSeedPeer from '../../fixtures/clusters/cluster/search-seed-peer.json';
import deleteSeedPeer from '../../fixtures/seed-peers/delete-seed-peer.json';
import seedPeerDeleteAfter from '../../fixtures/seed-peers/seed-peer-delete-after.json';
import searchSeedPeer from '../../fixtures/seed-peers/search-seed-peer.json';
describe('Seed peers', () => {
beforeEach(() => {

View File

@ -1,4 +1,4 @@
import signin from '../fixtures/signin.json';
import signin from '../../fixtures/signin/signin.json';
import _ from 'lodash';
describe('Signin', () => {

View File

@ -1,4 +1,4 @@
import signup from '../fixtures/signup.json';
import signup from '../../fixtures/signup/signup.json';
import _ from 'lodash';
describe('Signup', () => {

View File

@ -1,8 +1,8 @@
import root from '../fixtures/role-root.json';
import user from '../fixtures/user.json';
import users from '../fixtures/users.json';
import guestUser from '../fixtures/guest-user.json';
import guest from '../fixtures/role-guest.json';
import root from '../../fixtures/users/role-root.json';
import user from '../../fixtures/users/user.json';
import users from '../../fixtures/users/users.json';
import guestUser from '../../fixtures/users/guest-user.json';
import guest from '../../fixtures/users/role-guest.json';
describe('Users', () => {
beforeEach(() => {

View File

@ -15,14 +15,14 @@ Cypress.Commands.add('signin', () => {
method: 'GET',
url: '/api/v1/users/1',
},
{ fixture: 'user.json' },
{ fixture: 'users/user.json' },
);
cy.intercept(
{
method: 'GET',
url: '/api/v1/users/1/roles',
},
{ fixture: 'role-root.json' },
{ fixture: 'users/role-root.json' },
);
});
@ -36,13 +36,13 @@ Cypress.Commands.add('guestSignin', () => {
method: 'GET',
url: '/api/v1/users/2',
},
{ fixture: 'guest-user.json' },
{ fixture: 'users/guest-user.json' },
);
cy.intercept(
{
method: 'GET',
url: '/api/v1/users/2/roles',
},
{ fixture: 'role-guest.json' },
{ fixture: 'users/role-guest.json' },
);
});

View File

@ -1,38 +0,0 @@
.App {
text-align: center;
}
.App-logo {
height: 40vmin;
pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
}
.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}
.App-link {
color: #61dafb;
}
@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

View File

@ -1,8 +0,0 @@
import { render, screen } from '@testing-library/react';
import App from './App';
test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});

View File

@ -337,11 +337,10 @@ export default function Peer() {
datasets: [
{
data: cluster.map((item) => item.count),
backgroundColor: 'rgba(46,143,121,0.6)',
backgroundColor: 'rgb(46,143,121)',
borderColor: 'rgb(46,143,121)',
borderWidth: 1,
borderRadius: 5,
hoverBackgroundColor: 'rgb(46,143,121)',
barPercentage: 0.6,
},
],
@ -377,11 +376,10 @@ export default function Peer() {
datasets: [
{
data: gitVersion.map((item) => item.count),
backgroundColor: 'rgba(46,143,121,0.6)',
backgroundColor: 'rgb(46,143,121)',
borderColor: 'rgb(46,143,121)',
borderWidth: 1,
borderRadius: 5,
hoverBackgroundColor: 'rgb(46,143,121)',
barPercentage: 0.6,
},
],
@ -410,11 +408,10 @@ export default function Peer() {
datasets: [
{
data: gitCommit.map((item) => item.count),
backgroundColor: 'rgba(46,143,121,0.6)',
backgroundColor: 'rgb(46,143,121)',
borderColor: 'rgb(46,143,121)',
borderWidth: 1,
borderRadius: 5,
hoverBackgroundColor: 'rgb(46,143,121)',
barPercentage: 0.6,
},
],

View File

@ -2,9 +2,9 @@ import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import { BrowserRouter as Routers } from 'react-router-dom';
import { ThemeProvider, createTheme } from '@mui/material/styles';
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
const theme = createTheme({
@ -22,5 +22,3 @@ root.render(
</ThemeProvider>
</React.StrictMode>,
);
reportWebVitals();

View File

@ -17,7 +17,7 @@ import EditTokens from '../components/developer/tokens/edit';
import Preheats from '../components/job/preheats';
import NewPreheat from '../components/job/preheats/new';
import ShowPreheat from '../components/job/preheats/show';
import Peers from '../components/insight/peer';
import Peers from '../components/insight/peers';
import { useState, useEffect } from 'react';
import { getJwtPayload } from '../lib/utils';
import { getUserRoles } from '../lib/api';

View File

@ -1,15 +0,0 @@
import { ReportHandler } from 'web-vitals';
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
}
};
export default reportWebVitals;

View File

@ -1,5 +0,0 @@
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';