Compare commits
42 Commits
122-fix-fl
...
13f1e86e72
| Author | SHA1 | Date | |
|---|---|---|---|
| 13f1e86e72 | |||
| 25f935171e | |||
| 92fec88ad1 | |||
| 833b1b107c | |||
| 674ae1cf3c | |||
| f0b61703b7 | |||
| c152f06b63 | |||
| 3c9d26e085 | |||
| 12b4f1a65b | |||
| ae03c0200c | |||
| b9668a9d48 | |||
| 19041e3967 | |||
| 5729c72fe1 | |||
| 8760998c78 | |||
| 61f8dc0e1e | |||
| cc7b694fd5 | |||
| 9553c2ec34 | |||
| 0a8c461e3d | |||
| 931d56e753 | |||
| 7ebf78f348 | |||
| 95e2d59abc | |||
| 945081dd7c | |||
| 7213dcf9e1 | |||
| a13ffeaebd | |||
| 620b258e94 | |||
| cc21a43825 | |||
| 112b56080c | |||
| 92f97a93bf | |||
| 4f6e9a072c | |||
| 0c8e4b9fba | |||
| 63d2765d19 | |||
| da76000b8d | |||
| b789e1264a | |||
| 9cc86fe79f | |||
| ee0e10072c | |||
| 899f92f342 | |||
| 5c4245179f | |||
| a7a9f01fd9 | |||
| a367b517db | |||
| fd514e4c8b | |||
| d8513e6dd0 | |||
| 5de5a165da |
@@ -15,7 +15,7 @@ jobs:
|
|||||||
environment: ${{ inputs.environment_name }}
|
environment: ${{ inputs.environment_name }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v5
|
uses: https://gitea.com/actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
sparse-checkout: |
|
sparse-checkout: |
|
||||||
api
|
api
|
||||||
@@ -45,8 +45,8 @@ jobs:
|
|||||||
- name: Build Client
|
- name: Build Client
|
||||||
env:
|
env:
|
||||||
VITE_API_URL: ${{ vars.VITE_API_URL }}
|
VITE_API_URL: ${{ vars.VITE_API_URL }}
|
||||||
VITE_BASE_URL: ${{ vars.VITE_BASE_URL }}
|
VITE_BASE_URL: ${{ case(inputs.environment_name === 'test', vars.VITE_BASE_URL_TEST, vars.VITE_BASE_URL_PROD) }}
|
||||||
VITE_CLIENT_ID: ${{ vars.VITE_CLIENT_ID }}
|
VITE_CLIENT_ID: ${{ case(inputs.environment_name === 'test', vars.VITE_CLIENT_ID_TEST, vars.VITE_CLIENT_ID_PROD) }}
|
||||||
VITE_ISSUER_URI: ${{ vars.VITE_ISSUER_URI }}
|
VITE_ISSUER_URI: ${{ vars.VITE_ISSUER_URI }}
|
||||||
VITE_TENANT_ID: ${{ vars.VITE_TENANT_ID }}
|
VITE_TENANT_ID: ${{ vars.VITE_TENANT_ID }}
|
||||||
run: |
|
run: |
|
||||||
@@ -7,6 +7,9 @@ on:
|
|||||||
client:
|
client:
|
||||||
value: ${{ jobs.changes.outputs.client }}
|
value: ${{ jobs.changes.outputs.client }}
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
changes:
|
changes:
|
||||||
name: filter
|
name: filter
|
||||||
@@ -15,7 +18,13 @@ jobs:
|
|||||||
api: ${{ steps.filter.outputs.api }}
|
api: ${{ steps.filter.outputs.api }}
|
||||||
client: ${{ steps.filter.outputs.client }}
|
client: ${{ steps.filter.outputs.client }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- name: 'Setup Node'
|
||||||
|
uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
node-version: '22.x'
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: dorny/paths-filter@v3
|
- uses: dorny/paths-filter@v3
|
||||||
id: filter
|
id: filter
|
||||||
@@ -21,11 +21,9 @@ jobs:
|
|||||||
environment: ${{ inputs.environment_name }}
|
environment: ${{ inputs.environment_name }}
|
||||||
steps:
|
steps:
|
||||||
- name: Log in to Azure
|
- name: Log in to Azure
|
||||||
uses: azure/login@v2
|
uses: azure/login@v3
|
||||||
with:
|
with:
|
||||||
client-id: ${{ vars.AZURE_CLIENT_ID }}
|
creds: '{"clientId":"${{ vars.AZURE_CLIENT_ID }}","clientSecret":"${{ secrets.AZURE_CLIENT_SECRET }}","subscriptionId":"${{ secrets.AZURE_SUBSCRIPTION_ID }}","tenantId":"${{ vars.AZURE_TENANT_ID }}"}'
|
||||||
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
|
||||||
tenant-id: ${{ vars.AZURE_TENANT_ID }}
|
|
||||||
|
|
||||||
- name: Azure CLI script
|
- name: Azure CLI script
|
||||||
uses: azure/cli@v2
|
uses: azure/cli@v2
|
||||||
@@ -6,14 +6,14 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
changes:
|
changes:
|
||||||
uses: ./.github/workflows/changes.yaml
|
uses: ./.gitea/workflows/changes.yaml
|
||||||
|
|
||||||
build:
|
build:
|
||||||
if: ${{ needs.changes.outputs.api == 'true' || needs.changes.outputs.client == 'true' }}
|
if: ${{ needs.changes.outputs.api == 'true' || needs.changes.outputs.client == 'true' }}
|
||||||
name: build
|
name: build
|
||||||
needs:
|
needs:
|
||||||
- changes
|
- changes
|
||||||
uses: ./.github/workflows/build_and_test.yaml
|
uses: ./.gitea/workflows/build_and_test.yaml
|
||||||
with:
|
with:
|
||||||
environment_name: test
|
environment_name: test
|
||||||
version_number: ${{ github.run_id }}
|
version_number: ${{ github.run_id }}
|
||||||
@@ -24,7 +24,7 @@ jobs:
|
|||||||
needs:
|
needs:
|
||||||
- changes
|
- changes
|
||||||
- build
|
- build
|
||||||
uses: ./.github/workflows/deploy.yaml
|
uses: ./.gitea/workflows/deploy.yaml
|
||||||
with:
|
with:
|
||||||
app_name: flying
|
app_name: flying
|
||||||
environment_name: test
|
environment_name: test
|
||||||
@@ -5,14 +5,14 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
changes:
|
changes:
|
||||||
uses: ./.github/workflows/changes.yaml
|
uses: ./.gitea/workflows/changes.yaml
|
||||||
|
|
||||||
build:
|
build:
|
||||||
if: ${{ needs.changes.outputs.app == 'true' || needs.changes.outputs.client == 'true'}}
|
if: ${{ needs.changes.outputs.api == 'true' || needs.changes.outputs.client == 'true'}}
|
||||||
name: build
|
name: build-and-test
|
||||||
needs:
|
needs:
|
||||||
- changes
|
- changes
|
||||||
uses: ./.github/workflows/build_and_test.yaml
|
uses: ./.gitea/workflows/build_and_test.yaml
|
||||||
with:
|
with:
|
||||||
environment_name: pull_request
|
environment_name: pull_request
|
||||||
version_number: ${{ github.run_id }}
|
version_number: ${{ github.run_id }}
|
||||||
@@ -7,7 +7,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: build
|
name: build
|
||||||
uses: ./.github/workflows/build_and_test.yaml
|
uses: ./.gitea/workflows/build_and_test.yaml
|
||||||
with:
|
with:
|
||||||
environment_name: prod
|
environment_name: prod
|
||||||
version_number: ${{ github.ref_name }}
|
version_number: ${{ github.ref_name }}
|
||||||
@@ -17,7 +17,7 @@ jobs:
|
|||||||
name: deploy
|
name: deploy
|
||||||
needs:
|
needs:
|
||||||
- build
|
- build
|
||||||
uses: ./.github/workflows/deploy.yaml
|
uses: ./.gitea/workflows/deploy.yaml
|
||||||
with:
|
with:
|
||||||
app_name: flying
|
app_name: flying
|
||||||
environment_name: prod
|
environment_name: prod
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "api",
|
"name": "api",
|
||||||
"version": "2.1.1",
|
"version": "2.1.4",
|
||||||
"description": "",
|
"description": "",
|
||||||
"author": "",
|
"author": "",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export class LogInterceptor implements NestInterceptor {
|
|||||||
|
|
||||||
if (jwtPayload[rolesKeyName].includes('Flying.Read')) {
|
if (jwtPayload[rolesKeyName].includes('Flying.Read')) {
|
||||||
if (data.entities) {
|
if (data.entities) {
|
||||||
const logs = data.entities.map((entity) => limitData(data.entities));
|
const logs = data.entities.map((entity) => limitData(entity));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
entities: logs,
|
entities: logs,
|
||||||
@@ -62,8 +62,8 @@ export class LogInterceptor implements NestInterceptor {
|
|||||||
const logs = publicData.slice(0, 5)
|
const logs = publicData.slice(0, 5)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
entities: publicData,
|
entities: logs,
|
||||||
total: data.total,
|
total: logs.length,
|
||||||
hasNextPage: false
|
hasNextPage: false
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
@@ -71,7 +71,6 @@ export class LogInterceptor implements NestInterceptor {
|
|||||||
|
|
||||||
return publicData
|
return publicData
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -234,14 +234,14 @@ describe('LogService', () => {
|
|||||||
const count = 1
|
const count = 1
|
||||||
const morePages = false
|
const morePages = false
|
||||||
|
|
||||||
jest.spyOn(mockLogRepository, 'findAndCount').mockReturnValue([logs, count, morePages]);
|
jest.spyOn(mockQueryBuilder, 'getManyAndCount').mockReturnValue([logs, count, morePages]);
|
||||||
|
|
||||||
const {entities, total, hasNextPage} = await service.findLogsWithCount();
|
const {entities, total, hasNextPage} = await service.findLogsWithCount();
|
||||||
|
|
||||||
expect(entities).toEqual(logs);
|
expect(entities).toEqual(logs);
|
||||||
expect(count).toEqual(total);
|
expect(count).toEqual(total);
|
||||||
expect(hasNextPage).toEqual(morePages);
|
expect(hasNextPage).toEqual(morePages);
|
||||||
expect(mockLogRepository.findAndCount).toHaveBeenCalled();
|
expect(mockQueryBuilder.getManyAndCount).toHaveBeenCalled();
|
||||||
})
|
})
|
||||||
|
|
||||||
it('findLogsWithTracks => should find log entries with tracks', async () => {
|
it('findLogsWithTracks => should find log entries with tracks', async () => {
|
||||||
@@ -294,7 +294,7 @@ describe('LogService', () => {
|
|||||||
expect(entities).toEqual(logs);
|
expect(entities).toEqual(logs);
|
||||||
expect(count).toEqual(total);
|
expect(count).toEqual(total);
|
||||||
expect(hasNextPage).toEqual(morePages);
|
expect(hasNextPage).toEqual(morePages);
|
||||||
expect(mockLogRepository.findAndCount).toHaveBeenCalled();
|
expect(mockQueryBuilder.getManyAndCount).toHaveBeenCalled();
|
||||||
})
|
})
|
||||||
|
|
||||||
it('update => should update a log entry', async () => {
|
it('update => should update a log entry', async () => {
|
||||||
|
|||||||
@@ -25,11 +25,22 @@ export class LogService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async findLogsWithCount(skip?: number, take?: number): Promise<Logs> {
|
async findLogsWithCount(skip?: number, take?: number): Promise<Logs> {
|
||||||
const [entities, total] = await this.logRepository.findAndCount({
|
// const [entities, total] = await this.logRepository.findAndCount({
|
||||||
take,
|
// take,
|
||||||
skip,
|
// skip,
|
||||||
relations: ['pilot', 'tracks']
|
// order: {
|
||||||
})
|
// date: 'DESC'
|
||||||
|
// },
|
||||||
|
// relations: ['pilot', 'tracks']
|
||||||
|
// })
|
||||||
|
|
||||||
|
const [entities, total] = await this.logRepository
|
||||||
|
.createQueryBuilder('logs')
|
||||||
|
.innerJoinAndSelect('logs.pilot', 'pilot')
|
||||||
|
.orderBy('logs.date', 'DESC')
|
||||||
|
.skip(skip)
|
||||||
|
.take(take)
|
||||||
|
.getManyAndCount()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
entities,
|
entities,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "client",
|
"name": "client",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "2.1.1",
|
"version": "2.1.4",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@@ -380,13 +380,13 @@ const Logbook: React.FC<unknown> = () => {
|
|||||||
setPageIndex
|
setPageIndex
|
||||||
} = table;
|
} = table;
|
||||||
|
|
||||||
const getLogbookEntries = async (pageIndex?: number, pageSize?: number) => {
|
const getLogbookEntries = async (pageIndex: number, pageSize: number) => {
|
||||||
try {
|
try {
|
||||||
dispatch({ type: 'SET_IS_LOADING', payload: true });
|
dispatch({ type: 'SET_IS_LOADING', payload: true });
|
||||||
|
|
||||||
const response: AxiosResponse = await httpClient.get(`api/logs`, {
|
const response: AxiosResponse = await httpClient.get(`api/logs`, {
|
||||||
params: {
|
params: {
|
||||||
skip: pageIndex,
|
skip: pageIndex * pageSize,
|
||||||
take: pageSize
|
take: pageSize
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -413,7 +413,7 @@ const Logbook: React.FC<unknown> = () => {
|
|||||||
setColumnVisibility(columnVisibility)
|
setColumnVisibility(columnVisibility)
|
||||||
dispatch({ type: 'SET_ENTRIES', payload: { entries: entries, totalEntries: response.data.total }});
|
dispatch({ type: 'SET_ENTRIES', payload: { entries: entries, totalEntries: response.data.total }});
|
||||||
|
|
||||||
if (!isUserLoggedIn && response.data.length >= 5) {
|
if (!isUserLoggedIn && response.data.entities.length >= 5) {
|
||||||
dispatch({ type: 'SET_ALERT', payload: { severity: 'info', message: 'A limited number of log entries displayed. Sign in to view all log entries.'}})
|
dispatch({ type: 'SET_ALERT', payload: { severity: 'info', message: 'A limited number of log entries displayed. Sign in to view all log entries.'}})
|
||||||
} else {
|
} else {
|
||||||
dispatch({ type: 'SET_ALERT', payload: undefined})
|
dispatch({ type: 'SET_ALERT', payload: undefined})
|
||||||
@@ -527,6 +527,10 @@ const Logbook: React.FC<unknown> = () => {
|
|||||||
dispatch({ type: 'SET_PAGES', payload: pages })
|
dispatch({ type: 'SET_PAGES', payload: pages })
|
||||||
}, [state.totalEntries, state.pagination?.pageSize])
|
}, [state.totalEntries, state.pagination?.pageSize])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
console.log(state.alert)
|
||||||
|
}, [state.alert])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className={`${screenSize === ScreenSize.SM ? 'mr-4 ml-4' : 'mr-10 ml-10'} grid grid-cols-12`}>
|
<div className={`${screenSize === ScreenSize.SM ? 'mr-4 ml-4' : 'mr-10 ml-10'} grid grid-cols-12`}>
|
||||||
@@ -550,7 +554,7 @@ const Logbook: React.FC<unknown> = () => {
|
|||||||
onClose={() =>
|
onClose={() =>
|
||||||
dispatch({ type: 'SET_ALERT', payload: undefined })
|
dispatch({ type: 'SET_ALERT', payload: undefined })
|
||||||
}
|
}
|
||||||
severity={'info'}
|
severity={state.alert.severity}
|
||||||
>
|
>
|
||||||
{state.alert.message}
|
{state.alert.message}
|
||||||
</Alert>
|
</Alert>
|
||||||
@@ -569,7 +573,7 @@ const Logbook: React.FC<unknown> = () => {
|
|||||||
>
|
>
|
||||||
<option value={10}>10</option>
|
<option value={10}>10</option>
|
||||||
<option value={25}>25</option>
|
<option value={25}>25</option>
|
||||||
<option value={3}>50</option>
|
<option value={50}>50</option>
|
||||||
<option value={state.totalEntries}>All</option>
|
<option value={state.totalEntries}>All</option>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
|
|||||||
1
infrastructure/.gitignore
vendored
1
infrastructure/.gitignore
vendored
@@ -2,3 +2,4 @@
|
|||||||
.terraform/*
|
.terraform/*
|
||||||
*.tfstate
|
*.tfstate
|
||||||
*.tfstate.*
|
*.tfstate.*
|
||||||
|
.DS_Store
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@noahspan/flying",
|
"name": "@noahspan/flying",
|
||||||
"version": "2.1.1",
|
"version": "2.1.4",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node api/dist/main",
|
"start": "node api/dist/main",
|
||||||
"format": "prettier --write \"**/src/**/*.ts\" \"**/test/**/*.ts\"",
|
"format": "prettier --write \"**/src/**/*.ts\" \"**/test/**/*.ts\"",
|
||||||
|
|||||||
Reference in New Issue
Block a user