Skip to content

Commit

Permalink
Fix name overflow on models table (#4359)
Browse files Browse the repository at this point in the history
Fix signing keys in policies table
  • Loading branch information
steverydz authored Jul 31, 2023
1 parent ef03fbf commit c0f55c8
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
26 changes: 22 additions & 4 deletions static/js/brand-store/components/Model/Policies.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ import PoliciesFilter from "./PoliciesFilter";
import PoliciesTable from "./PoliciesTable";
import CreatePolicyForm from "./CreatePolicyForm";

import { usePolicies } from "../../hooks";
import { policiesListFilterState, policiesListState } from "../../atoms";
import { usePolicies, useSigningKeys } from "../../hooks";
import {
policiesListFilterState,
policiesListState,
signingKeysListState,
} from "../../atoms";
import { brandStoreState } from "../../selectors";

import { isClosedPanel, setPageTitle } from "../../utils";

import type { Policy } from "../../types/shared";
import type { Policy, SigningKey } from "../../types/shared";

function Policies() {
const { id, model_id } = useParams();
Expand All @@ -30,6 +34,7 @@ function Policies() {
id,
model_id
);
const signingKeys = useSigningKeys(id);
const setPoliciesList = useSetRecoilState<Array<Policy>>(policiesListState);
const setFilter = useSetRecoilState<string>(policiesListFilterState);
const brandStore = useRecoilValue(brandStoreState(id));
Expand All @@ -38,6 +43,15 @@ function Policies() {
const [showErrorNotification, setShowErrorNotification] = useState<boolean>(
false
);
const setSigningKeysList = useSetRecoilState<Array<SigningKey>>(
signingKeysListState
);

useEffect(() => {
if (!signingKeys.isLoading && !signingKeys.isError) {
setSigningKeysList(signingKeys.data);
}
}, [signingKeys]);

useEffect(() => {
if (!isLoading && !isError) {
Expand Down Expand Up @@ -106,7 +120,11 @@ function Policies() {
<div className="u-fixed-width">
<>
{isLoading && <p>Fetching policies...</p>}
{isError && error && <p>Error: {error.message}</p>}
{isError && error && (
<Notification severity="negative">
Error: {error.message}
</Notification>
)}
<PoliciesTable />
</>
</div>
Expand Down
6 changes: 5 additions & 1 deletion static/js/brand-store/components/Models/Models.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,11 @@ function Models() {
<div className="u-fixed-width">
<>
{isLoading && <p>Fetching models...</p>}
{isError && error && <p>Error: {error.message}</p>}
{isError && error && (
<Notification severity="negative">
Error: {error.message}
</Notification>
)}
<ModelsTable />
</>
</div>
Expand Down
1 change: 1 addition & 0 deletions static/js/brand-store/components/Models/ModelsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ function ModelsTable() {
{model.name}
</Link>
),
className: "u-truncate",
},
{
content: maskString(model["api-key"]),
Expand Down

0 comments on commit c0f55c8

Please sign in to comment.