Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,16 @@ const hasTrusteeCheckedKeys = (
authContext: AuthContextValues
) => {
const status: IExecutionStatus = ceremony.status
return status.trustees.find(
return status.trustees.some(
(trustee) => trustee.name === authContext.trustee && trustee.status === TStatus.KEY_CHECKED
)
}

export const isTrusteeActionable = (
ceremony: Sequent_Backend_Keys_Ceremony,
authContext: AuthContextValues
) => isTrusteeParticipating(ceremony, authContext) && !hasTrusteeCheckedKeys(ceremony, authContext)

interface TrusteeWizardProps {
electionEvent?: Sequent_Backend_Election_Event
currentCeremony: Sequent_Backend_Keys_Ceremony
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import {
FunctionField,
RaRecord,
} from "react-admin"
import {Button, Typography, Chip, Alert, Box} from "@mui/material"
import {Button, Typography, Chip, Alert, Box, Tooltip} from "@mui/material"
import {theme, IconButton} from "@sequentech/ui-essentials"
import {AdminWizard} from "@/components/keys-ceremony/AdminWizard"
import {TrusteeWizard, isTrusteeParticipating} from "@/components/keys-ceremony/TrusteeWizard"
import {TrusteeWizard, isTrusteeActionable} from "@/components/keys-ceremony/TrusteeWizard"
import {statusColor} from "@/components/keys-ceremony/CeremonyStep"
import {faPlus} from "@fortawesome/free-solid-svg-icons"
import {useTenantStore} from "@/providers/TenantContextProvider"
Expand All @@ -37,6 +37,7 @@ import {AuthContext, AuthContextValues} from "@/providers/AuthContextProvider"
import {IPermissions} from "@/types/keycloak"
import FileOpenIcon from "@mui/icons-material/FileOpen"
import KeyIcon from "@mui/icons-material/Key"
import DescriptionIcon from "@mui/icons-material/Description"
import {ResourceListStyles} from "@/components/styles/ResourceListStyles"
import {ListActions} from "../../components/ListActions"
import {SettingsContext} from "@/providers/SettingsContextProvider"
Expand Down Expand Up @@ -99,7 +100,7 @@ const getActiveCeremony = (
if (!keyCeremonies) {
return
} else {
return keyCeremonies.find((ceremony) => isTrusteeParticipating(ceremony, authContext))
return keyCeremonies.find((ceremony) => isTrusteeActionable(ceremony, authContext))
}
}

Expand Down Expand Up @@ -241,16 +242,35 @@ export const EditElectionEventKeys: React.FC<EditElectionEventKeysProps> = (prop
}
}

const isCeremonyActionable = (id: Identifier): boolean => {
const ceremony = getCeremony(id)
return !!ceremony && isTrusteeActionable(ceremony, authContext)
}

const actions: Action[] = [
{
icon: <FileOpenIcon className="keys-view-admin-icon" />,
action: viewAdminCeremony,
showAction: (id: Identifier) => canAdminCeremony && !!getCeremony(id),
},
{
icon: <TrusteeKeyIcon className="keys-view-trustee-icon" />,
icon: (
<Tooltip title={String(t("electionEventScreen.keys.actions.participate"))}>
<TrusteeKeyIcon className="keys-view-trustee-icon" />
</Tooltip>
),
action: viewTrusteeCeremony,
showAction: (id: Identifier) => canTrusteeCeremony && isCeremonyActionable(id),
},
{
icon: (
<Tooltip title={String(t("electionEventScreen.keys.actions.view"))}>
<DescriptionIcon className="keys-view-trustee-status-icon" />
</Tooltip>
),
action: viewTrusteeCeremony,
showAction: (id: Identifier) => canTrusteeCeremony && !!getCeremony(id),
showAction: (id: Identifier) =>
canTrusteeCeremony && !!getCeremony(id) && !isCeremonyActionable(id),
},
]

Expand Down
4 changes: 4 additions & 0 deletions packages/admin-portal/src/translations/cat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,10 @@ const catalanTranslation: TranslationType = {
statusLabel: "Estat",
waitingKeys: "Esperant a la Generació de Claus..",
started: "Iniciada en",
actions: {
participate: "Participa en la cerimònia de claus",
view: "Mostra la cerimònia de claus",
},
breadCrumbs: {
configure: "Configurar",
ceremony: "Cerimònia",
Expand Down
4 changes: 4 additions & 0 deletions packages/admin-portal/src/translations/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,10 @@ const englishTranslation = {
statusLabel: "Status",
waitingKeys: "Waiting for Keys Generation..",
started: "Started at",
actions: {
participate: "Participate in Keys Ceremony",
view: "View Keys Ceremony",
},
breadCrumbs: {
configure: "Configure",
ceremony: "Ceremony",
Expand Down
4 changes: 4 additions & 0 deletions packages/admin-portal/src/translations/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,10 @@ const spanishTranslation: TranslationType = {
statusLabel: "Estado",
waitingKeys: "Esperando a la Generación de Claves..",
started: "Iniciada en",
actions: {
participate: "Participar en la ceremonia de claves",
view: "Ver la ceremonia de claves",
},
breadCrumbs: {
configure: "Configurar",
ceremony: "Ceremonia",
Expand Down
4 changes: 4 additions & 0 deletions packages/admin-portal/src/translations/eu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,10 @@ const basqueTranslation: TranslationType = {
statusLabel: "Egoera",
waitingKeys: "Giltzen Sorkuntza itxoiten..",
started: "Hasita:",
actions: {
participate: "Parte hartu giltzen zeremonian",
view: "Ikusi giltzen zeremonia",
},
breadCrumbs: {
configure: "Konfiguratu",
ceremony: "Zeremonia",
Expand Down
4 changes: 4 additions & 0 deletions packages/admin-portal/src/translations/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,10 @@ const frenchTranslation: TranslationType = {
statusLabel: "État",
waitingKeys: "En attente de la Génération de Clés..",
started: "Commencée à",
actions: {
participate: "Participer à la cérémonie des clés",
view: "Voir la cérémonie des clés",
},
breadCrumbs: {
configure: "Configurer",
ceremony: "Cérémonie",
Expand Down
4 changes: 4 additions & 0 deletions packages/admin-portal/src/translations/gl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,10 @@ const galegoTranslation: TranslationType = {
statusLabel: "Estado",
waitingKeys: "Esperando a Xeración de Chaves...",
started: "Iniciado o",
actions: {
participate: "Participar na cerimonia de chaves",
view: "Ver a cerimonia de chaves",
},
breadCrumbs: {
configure: "Configurar",
ceremony: "Cerimonia",
Expand Down
4 changes: 4 additions & 0 deletions packages/admin-portal/src/translations/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,10 @@ const dutchTranslation: TranslationType = {
statusLabel: "Status",
waitingKeys: "Wachten op sleutelgeneratie...",
started: "Gestart op",
actions: {
participate: "Deelnemen aan sleutelceremonie",
view: "Sleutelceremonie bekijken",
},
breadCrumbs: {
configure: "Configureren",
ceremony: "Ceremonie",
Expand Down
4 changes: 4 additions & 0 deletions packages/admin-portal/src/translations/tl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,10 @@ const tagalogTranslation: TranslationType = {
statusLabel: "Katayuan",
waitingKeys: "Naghihintay sa Paglikha ng mga Susi..",
started: "Nagsimula noong",
actions: {
participate: "Lumahok sa seremonya ng mga susi",
view: "Tingnan ang seremonya ng mga susi",
},
breadCrumbs: {
configure: "I-configure",
ceremony: "Seremonya",
Expand Down
Loading