Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: show owning organization in admin connector overview #395

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ please see [changelog_updates.md](docs/dev/changelog_updates.md).
#### Minor

- Uptime Kuma is no longer mandatory and the status dashboard can be disabled
- Added Owning Organization in Admin Connector Overview ([#355](https://github.com/sovity/authority-portal/issues/355))

#### Patch

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import io.swagger.v3.oas.annotations.media.Schema
data class ConnectorOverviewEntryDto(
@field:Schema(description = "Connector ID", requiredMode = Schema.RequiredMode.REQUIRED)
val id: String,
@field:Schema(description = "Organization Name", requiredMode = Schema.RequiredMode.REQUIRED)
val customerOrgName: String,
PaddseL marked this conversation as resolved.
Show resolved Hide resolved
@field:Schema(description = "Host Name", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
val hostName: String?,
@field:Schema(description = "Type", requiredMode = Schema.RequiredMode.REQUIRED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import java.time.ZoneOffset
*/
fun dummyDevUserUuid(i: Int): String = "00000000-0000-0000-0000-${i.toString().padStart(12, '0')}"
fun dummyDevOrganizationId(i: Int): String = "MDSL${i.toString().padStart(6, '0')}"
fun dummyDevOrganizationName(i: Int): String = "Organization $i"
fun dummyDevConnectorId(orgId: Int, connectorId: Int) =
"${dummyDevOrganizationId(orgId)}.${dummyDevConnectorIdComponent(connectorId)}"
fun dummyDevConnectorIdComponent(i: Int): String = "CONN${i.toString().padStart(3, '0')}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class ScenarioData {
fun organization(orgId: Int, createdByUserId: Int, applyer: (OrganizationRecord) -> Unit = {}) {
OrganizationRecord().also {
it.id = dummyDevOrganizationId(orgId)
it.name = "Organization $orgId"
it.name = dummyDevOrganizationName(orgId)
PaddseL marked this conversation as resolved.
Show resolved Hide resolved
it.address = "Address"
it.url = "https://url"
it.createdBy = dummyDevUserUuid(createdByUserId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ class ConnectorManagementApiService(
val connectorDtos = connectors.map {
ConnectorOverviewEntryDto(
id = it.connectorId,
customerOrgName = orgNames[it.organizationId] ?: "",
hostName = if (it.type == ConnectorType.CAAS) "sovity GmbH" else orgNames[it.providerOrganizationId] ?: "",
type = it.type.toDto(),
environment = deploymentEnvironmentDtoService.findByIdOrThrow(it.environment),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ import de.sovity.authorityportal.db.jooq.enums.ConnectorContractOffersExceeded
import de.sovity.authorityportal.db.jooq.enums.ConnectorDataOffersExceeded
import de.sovity.authorityportal.db.jooq.enums.ConnectorOnlineStatus
import de.sovity.authorityportal.db.jooq.enums.ConnectorType
import de.sovity.authorityportal.seeds.utils.ScenarioData
import de.sovity.authorityportal.seeds.utils.ScenarioInstaller
import de.sovity.authorityportal.seeds.utils.dummyDevConnectorId
import de.sovity.authorityportal.seeds.utils.dummyDevOrganizationId
import de.sovity.authorityportal.seeds.utils.dummyDevUserUuid
import de.sovity.authorityportal.seeds.utils.*
PaddseL marked this conversation as resolved.
Show resolved Hide resolved
import de.sovity.authorityportal.web.Roles
import de.sovity.authorityportal.web.tests.loadTestResource
import de.sovity.authorityportal.web.tests.useDevUser
Expand Down Expand Up @@ -439,9 +435,11 @@ class ConnectorManagementApiServiceTest {
assertThat(result.connectors).hasSize(3)
assertThat(result.connectors).noneMatch { it.id == dummyDevConnectorId(1, 3) }
assertThat(result.connectors).noneMatch { it.environment.environmentId != "test" }
assertThat(result.connectors[0].id).isEqualTo(dummyDevConnectorId(0, 0))
assertThat(result.connectors[1].id).isEqualTo(dummyDevConnectorId(0, 1))
assertThat(result.connectors[2].id).isEqualTo(dummyDevConnectorId(0, 2))

result.connectors.forEachIndexed { i, connector ->
assertThat(connector.id).isEqualTo(dummyDevConnectorId(0, i))
assertThat(connector.customerOrgName).isEqualTo(dummyDevOrganizationName(0))
}
PaddseL marked this conversation as resolved.
Show resolved Hide resolved
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export const getListOfConnectorsForTable = (
).map((c) => {
return {
id: c.connectorId,
customerOrgName: c.organizationName,
hostOrganizationName: c.hostOrganizationName,
type: c.type,
environment: c.environment,
Expand Down Expand Up @@ -195,6 +196,7 @@ export const getListOfOwnConnectorsForTable = (): ConnectorOverviewResult => {
).map((c) => {
return {
id: c.connectorId,
customerOrgName: c.organizationName,
hostOrganizationName: c.hostOrganizationName,
type: c.type,
environment: c.environment,
Expand All @@ -220,6 +222,7 @@ export const getListOfAllConnectorsForTable = (): ConnectorOverviewResult => {
connectors: TEST_CONNECTORS.map((c) => {
return {
id: c.connectorId,
customerOrgName: c.organizationName,
hostOrganizationName: c.hostOrganizationName,
type: c.type,
environment: c.environment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,19 @@
scope="col">
Connector ID
</th>

<th
class="py-3.5 text-sm font-normal text-gray-700 text-left"
scope="col">
Connector Name
</th>

<th
class="py-3.5 text-sm font-normal text-gray-700 text-left"
scope="col">
Organization
</th>

<th
class="py-3.5 text-sm font-normal text-gray-700 text-left"
scope="col">
Expand All @@ -36,6 +44,7 @@
scope="col">
Environment
</th>

<th
class="py-3.5 text-sm font-normal text-gray-700 text-left"
scope="col">
Expand Down Expand Up @@ -69,6 +78,10 @@
class="py-8 text-sm font-medium whitespace-nowrap text-gray-700">
{{ connector.name }}
</td>
<td
class="py-8 text-sm font-medium whitespace-nowrap text-gray-700">
{{ connector.customerOrgName }}
</td>
<td class="py-8 text-sm whitespace-nowrap text-gray-700">
{{ connector.hostName }}
</td>
Expand Down
Loading