Skip to content

Commit

Permalink
Formatting API token table
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Nov 27, 2024
1 parent d10bf43 commit 5c8e22b
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 7 deletions.
1 change: 1 addition & 0 deletions client/src/locale/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ const en = {
secretTooltip: "The value to use in the X-API-TOKEN header",
description: "Description",
superUserToken: "Super User token",
organizationGUID: "Organization GUID",
descriptionPlaceHolder: "Description for this API token",
descriptionTooltip: "A description explaining the use of this API token",
deleteFlash: "API token has been deleted",
Expand Down
1 change: 1 addition & 0 deletions client/src/locale/nl.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ const nl = {
secretTooltip: "De waarde die je gebruikt in de X-API-TOKEN header",
description: "Omschrijving",
superUserToken: "Super User token",
organizationGUID: "Organization GUID",
descriptionPlaceHolder: "Omschrijving voor dit API-token",
descriptionTooltip: "Een omschrijving die de reden voor dit API-token omschrijft",
deleteFlash: "API-token is verwijderd",
Expand Down
5 changes: 5 additions & 0 deletions client/src/tabs/Tokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@ export const Tokens = () => {
header: I18n.t("tokens.createdAt"),
mapper: token => dateFromEpoch(token.createdAt)
},
{
key: "organizationGUID",
header: I18n.t("tokens.organizationGUID"),
mapper: token => token.organizationGUID
},
{
nonSortable: true,
key: "trash",
Expand Down
13 changes: 10 additions & 3 deletions client/src/tabs/Tokens.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,26 @@ div.mod-tokens {
}

&.description {
width: 50%;
width: 35%;

&.small {
width: 25%;
}
}

&.superUserToken {
width: 25%;
width: 15%;
text-align: center;
}

&.created_at {
&.organizationGUID {
width: 25%;
}

&.created_at {
width: 15%;
}

&.trash {
width: 40px;
}
Expand All @@ -44,6 +48,9 @@ div.mod-tokens {
}
}
}
td.trash {
text-align: center;
}


}
Expand Down
1 change: 0 additions & 1 deletion server/src/main/java/access/model/APIToken.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public class APIToken implements Serializable {
private Long id;

@Column(name = "organization_guid")
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
private String organizationGUID;

@Column(name = "hashed_value")
Expand Down
8 changes: 5 additions & 3 deletions server/src/test/java/access/api/APITokenControllerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void create() throws Exception {
.as(new TypeRef<>() {
});
assertNull(apiToken.getHashedValue());
assertNull(apiToken.getOrganizationGUID());
assertEquals(ORGANISATION_GUID, apiToken.getOrganizationGUID());
assertEquals("test", apiToken.getDescription());

APIToken apiTokenFromDB = apiTokenRepository.findById(apiToken.getId()).get();
Expand Down Expand Up @@ -160,8 +160,10 @@ void apiTokensBySuperAdmin() throws Exception {
.get("/api/v1/tokens")
.as(new TypeRef<>() {
});
assertEquals(1, tokens.size());
assertTrue(tokens.get(0).isSuperUserToken());

assertEquals(2, tokens.size());
assertEquals(1L, tokens.stream().filter(token -> token.isSuperUserToken()).count());
assertEquals(1L, tokens.stream().filter(token -> token.getOrganizationGUID() != null).count());
}

@Test
Expand Down

0 comments on commit 5c8e22b

Please sign in to comment.