-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: enhance ApplicationStatusHero (#3000)
* chore: fix ApplicationStatusHero * chore: add all up, all down and all unknown * Removed unused imports * fix tests for status check of 'some' instances * WIP * update icons and colors for unknown * update texts * update colors and remove old stuff --------- Co-authored-by: ulrichschulte <[email protected]> Co-authored-by: erik.petzold <[email protected]>
- Loading branch information
1 parent
200f3eb
commit 77df9d8
Showing
14 changed files
with
178 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
...g-boot-admin-server-ui/src/main/frontend/views/applications/ApplicationStatusHero.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { screen } from '@testing-library/vue'; | ||
import { beforeEach, describe, expect, it, vi } from 'vitest'; | ||
import { Ref, ref } from 'vue'; | ||
|
||
import { useApplicationStore } from '@/composables/useApplicationStore'; | ||
import Application from '@/services/application'; | ||
import Instance from '@/services/instance'; | ||
import { render } from '@/test-utils'; | ||
import ApplicationStatusHero from '@/views/applications/ApplicationStatusHero.vue'; | ||
|
||
vi.mock('@/composables/useApplicationStore', () => ({ | ||
useApplicationStore: vi.fn(), | ||
})); | ||
|
||
describe('ApplicationStatusHero', () => { | ||
let applications: Ref<Application[]>; | ||
|
||
beforeEach(async () => { | ||
applications = ref([]); | ||
|
||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
useApplicationStore.mockReturnValue({ | ||
applicationsInitialized: ref(true), | ||
applications, | ||
error: ref(null), | ||
}); | ||
}); | ||
|
||
it.each` | ||
instance1Status | instance2Status | expectedMessage | ||
${'UP'} | ${'UP'} | ${'all up'} | ||
${'OFFLINE'} | ${'OFFLINE'} | ${'all down'} | ||
${'UNKNOWN'} | ${'UNKNOWN'} | ${'all in unknown state'} | ||
${'UP'} | ${'UNKNOWN'} | ${'some instances are in unknown state'} | ||
${'UP'} | ${'DOWN'} | ${'some instances are down'} | ||
${'UP'} | ${'OFFLINE'} | ${'some instances are down'} | ||
${'DOWN'} | ${'UNKNOWN'} | ${'some instances are down'} | ||
${'DOWN'} | ${'OFFLINE'} | ${'all down'} | ||
${'OFFLINE'} | ${'UP'} | ${'some instances are down'} | ||
`( | ||
'`$expectedMessage` is shown when `$instance1Status` and `$instance2Status`', | ||
({ instance1Status, instance2Status, expectedMessage }) => { | ||
applications.value = [ | ||
new Application({ | ||
name: 'Test Application', | ||
statusTimestamp: Date.now(), | ||
instances: [ | ||
new Instance({ | ||
id: '4711', | ||
statusInfo: { status: instance1Status }, | ||
}), | ||
new Instance({ | ||
id: '4712', | ||
statusInfo: { status: instance2Status }, | ||
}), | ||
], | ||
}), | ||
]; | ||
|
||
render(ApplicationStatusHero); | ||
|
||
expect(screen.getByText(expectedMessage)).toBeVisible(); | ||
}, | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters