Skip to content

Commit

Permalink
feat: connector status wording in UI (#276)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilczaja authored Aug 20, 2024
1 parent 830580c commit 2724837
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ please see [changelog_updates.md](docs/dev/changelog_updates.md).
- Keep in mind that sovity needs to be registered in the portal for the ID to show up.
- Already registered connectors will be updated automatically, this process can take up to 24 hours
- Fixed the close button on the self-hosted/CaaS connector choice page [#258](https://github.com/sovity/authority-portal/issues/258)
- Adjusted connector status naming for more consistency [#270](https://github.com/sovity/authority-portal/issues/270)
- `RUNNING (CaaS) -> ONLINE`
- `STOPPED (CaaS) -> OFFLINE`
- `DEAD -> OFFLINE`

### Known issues

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import de.sovity.authorityportal.db.jooq.enums.ConnectorOnlineStatus
import de.sovity.authorityportal.db.jooq.enums.ConnectorUptimeStatus
import de.sovity.authorityportal.web.thirdparty.caas.model.CaasStatusDto

// Mapping from external API to our DB
fun CaasStatusDto.toDb(): CaasStatus = when (this) {
CaasStatusDto.INIT -> CaasStatus.INIT
CaasStatusDto.PROVISIONING -> CaasStatus.PROVISIONING
Expand All @@ -31,24 +32,27 @@ fun CaasStatusDto.toDb(): CaasStatus = when (this) {
CaasStatusDto.NOT_FOUND -> CaasStatus.NOT_FOUND
}

// Mapping from our DB to the UI
fun CaasStatus.toDto(): ConnectorStatusDto = when (this) {
CaasStatus.INIT -> ConnectorStatusDto.INIT
CaasStatus.PROVISIONING -> ConnectorStatusDto.PROVISIONING
CaasStatus.AWAITING_RUNNING -> ConnectorStatusDto.AWAITING_RUNNING
CaasStatus.RUNNING -> ConnectorStatusDto.RUNNING
CaasStatus.RUNNING -> ConnectorStatusDto.ONLINE // streamlined wording for consistency with regular connectors
CaasStatus.DEPROVISIONING -> ConnectorStatusDto.DEPROVISIONING
CaasStatus.AWAITING_STOPPED -> ConnectorStatusDto.AWAITING_STOPPED
CaasStatus.STOPPED -> ConnectorStatusDto.STOPPED
CaasStatus.STOPPED -> ConnectorStatusDto.OFFLINE // streamlined wording for consistency with regular connectors
CaasStatus.ERROR -> ConnectorStatusDto.ERROR
CaasStatus.NOT_FOUND -> ConnectorStatusDto.NOT_FOUND
}

// Mapping from our DB to the UI
fun ConnectorOnlineStatus.toDto(): ConnectorStatusDto = when (this) {
ConnectorOnlineStatus.ONLINE -> ConnectorStatusDto.ONLINE
ConnectorOnlineStatus.OFFLINE -> ConnectorStatusDto.OFFLINE
ConnectorOnlineStatus.DEAD -> ConnectorStatusDto.DEAD
ConnectorOnlineStatus.DEAD -> ConnectorStatusDto.OFFLINE // changed
}

// Mapping from Connector Table to Uptime monitoring table
fun ConnectorOnlineStatus.toDb(): ConnectorUptimeStatus = when (this) {
ConnectorOnlineStatus.ONLINE -> ConnectorUptimeStatus.UP
ConnectorOnlineStatus.OFFLINE -> ConnectorUptimeStatus.DOWN
Expand Down
4 changes: 2 additions & 2 deletions authority-portal-frontend/src/app/core/utils/ui-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ export const getConnectorStatusOuterRingClasses = (
case ConnectorStatusDto.Init:
case ConnectorStatusDto.Provisioning:
case ConnectorStatusDto.AwaitingRunning:
case ConnectorStatusDto.Offline:
case ConnectorStatusDto.Deprovisioning:
case ConnectorStatusDto.AwaitingStopped:
return 'bg-amber-500/20';
case ConnectorStatusDto.Offline:
case ConnectorStatusDto.Stopped:
case ConnectorStatusDto.Error:
case ConnectorStatusDto.NotFound:
Expand All @@ -132,8 +132,8 @@ export const getConnectorStatusInnerCircleClasses = (
case ConnectorStatusDto.AwaitingRunning:
case ConnectorStatusDto.Deprovisioning:
case ConnectorStatusDto.AwaitingStopped:
case ConnectorStatusDto.Offline:
return 'bg-amber-500';
case ConnectorStatusDto.Offline:
case ConnectorStatusDto.Stopped:
case ConnectorStatusDto.Error:
case ConnectorStatusDto.NotFound:
Expand Down

0 comments on commit 2724837

Please sign in to comment.