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

Readonly ledger support #1412

Merged
merged 7 commits into from
Oct 29, 2024
Merged
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
2 changes: 1 addition & 1 deletion services/tenant-ui/frontend/public/forms/reservation.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@
}
]
}
}
}
7 changes: 4 additions & 3 deletions services/tenant-ui/frontend/src/components/about/Acapy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</template>

<script setup lang="ts">
import { computed, onMounted, ref } from 'vue';
import { computed, onMounted, ref, Ref } from 'vue';
import { useRoute } from 'vue-router';
import { storeToRefs } from 'pinia';
import { useInnkeeperTenantsStore, useTenantStore } from '@/store';
Expand All @@ -38,7 +38,7 @@ const { serverConfig: innServerConfig } = storeToRefs(
);
const { serverConfig } = storeToRefs(useTenantStore());

const acapyVersion = ref('');
const acapyVersion: Ref<string | undefined> = ref('');
const currentRouteName = computed(() => {
return route.name;
});
Expand All @@ -50,7 +50,8 @@ onMounted(async () => {
acapyVersion.value = innServerConfig.value?.config?.version;
} else {
await tenantsStore.getServerConfig();
acapyVersion.value = serverConfig.value?.config?.version;
if (typeof serverConfig.value == 'object' && 'config' in serverConfig.value)
acapyVersion.value = serverConfig.value.config.version;
}
});
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
<template #loading>{{ $t('common.loading') }}</template>
<Column :sortable="false" header="Connect">
<template #body="{ data }">
<EndorserConnect :ledger-info="data" />
<div v-if="data.is_write">
<EndorserConnect :ledger-info="data" />
</div>
</template>
</Column>
<Column :sortable="true" field="ledger_id" header="Ledger" />
Expand All @@ -38,6 +40,23 @@
</span>
</template>
</Column>
<Column
:sortable="true"
field="is_write"
header="Writable"
data-type="boolean"
style="min-width: 6rem"
>
<template #body="{ data }">
<i
class="pi"
:class="{
'pi-check-circle text-green-500': data.is_write,
'': !data.is_write,
}"
></i>
</template>
</Column>
</DataTable>
<div v-if="showNotActiveWarn" class="inactive-endorser">
<i class="pi pi-exclamation-triangle"></i>
Expand Down Expand Up @@ -84,15 +103,24 @@ import EndorserConnect from './EndorserConnect.vue';
const configStore = useConfigStore();
const tenantStore = useTenantStore();
const { config } = storeToRefs(configStore);
const { endorserConnection, endorserInfo, tenantConfig, loading } =
storeToRefs(tenantStore);
const {
endorserConnection,
endorserInfo,
tenantConfig,
loading,
serverConfig,
} = storeToRefs(tenantStore);

const endorserList = tenantConfig.value.connect_to_endorser.map(
(config: any) => ({
ledger_id: config.ledger_id,
endorser_alias: config.endorser_alias,
})
);
const endorserList =
'config' in serverConfig.value
? serverConfig.value.config['ledger.ledger_config_list'].map(
(config: any) => ({
ledger_id: config.id,
endorser_alias: config.endorser_alias,
is_write: config.is_write,
})
)
: [];

// Allowed to connect to endorser and register DID?
const canBecomeIssuer = computed(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,6 @@
text
@click="switchLedger($event)"
/>
<!-- <Button
title="Connect to endorser"
icon="pi pi-user-plus"
class="p-button-rounded p-button-icon-only p-button-text"
@click="
connectToLedger(
props.ledgerInfo.endorser_alias,
props.ledgerInfo.ledger_id
)
"
/> -->
</div>

<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</p>
</div>
<div v-else>
<h5 class="mb-0 mt-3">{{ $t('common.endorser') }}</h5>
<h5 class="mb-0 mt-3">{{ $t('common.ledgers') }}</h5>
<div v-if="endorserInfo">
<Endorser />

Expand All @@ -49,6 +49,7 @@ import { useTenantStore } from '@/store';
import { storeToRefs } from 'pinia';
// Other Components
import Endorser from './Endorser.vue';
import ReadOnlyLedger from './ReadOnlyLedger.vue';
import PublicDid from './PublicDid.vue';
import TaaAcceptance from './TaaAcceptance.vue';
import { useToast } from 'vue-toastification';
Expand All @@ -69,6 +70,7 @@ const errLoading = ref(false);
const loadIssuer = async () => {
try {
await Promise.all([
tenantStore.getServerConfig(),
tenantStore.getIssuanceStatus(),
tenantStore.getWalletcDids(),
tenantStore.getTransactions(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"hideSuspended": "Hide Suspended",
"invitationUrl": "Invitation URL",
"json": "JSON",
"ledgers": "Ledgers",
"loading": "Loading data. Please wait...",
"logout": "Logout",
"name": "Name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -577,4 +577,4 @@
"verification": "Verification <FR>",
"verifications": "Verifications <FR>"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -577,4 +577,4 @@
"verification": "Verification <JA>",
"verifications": "Verifications <JA>"
}
}
}
9 changes: 6 additions & 3 deletions services/tenant-ui/frontend/src/store/tenantStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
EndorserInfo,
TransactionRecord,
} from '@/types/acapyApi/acapyInterface';
import { ServerConfig } from '@/types/index';
interface TransactionRecordEx extends TransactionRecord {
meta_data?: {
[key: string]: any;
Expand Down Expand Up @@ -38,7 +39,7 @@ export const useTenantStore = defineStore('tenant', () => {
const publicDid: any = ref(null);
const writeLedger: any = ref(null);
const publicDidRegistrationProgress: Ref<string> = ref('');
const serverConfig: any = ref(null);
const serverConfig: Ref<ServerConfig | object> = ref({});
const taa: Ref<any> = ref(null);
const tenantConfig: any = ref(null);
const tenantWallet: any = ref(null);
Expand Down Expand Up @@ -115,13 +116,15 @@ export const useTenantStore = defineStore('tenant', () => {
}

async function getServerConfig() {
loading.value = true;
serverConfig.value = await fetchItem<AdminConfig>(
// loading.value = true;
const val = await fetchItem<AdminConfig>(
API_PATH.TENANT_SERVER_CONFIG,
'',
error,
ref(false)
);
if (val != null) serverConfig.value = val;
// loading.value = false;
}

async function getIssuanceStatus() {
Expand Down
103 changes: 103 additions & 0 deletions services/tenant-ui/frontend/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,106 @@ export interface ExtendedV20CredExRecordByFormat
};
};
}

export interface ServerConfig {
config: {
debug: {
auto_respond_credential_request: boolean;
auto_respond_presentation_proposal: boolean;
auto_store_credential: boolean;
auto_verify_presentation: boolean;
auto_accept_invites: boolean;
auto_accept_requests: boolean;
auto_respond_messages: boolean;
monitor_ping: boolean;
};
external_plugins: Array<string>;
plugin_config: {
multitenant_provider: {
manager: {
class_name: string;
always_check_provided_wallet_key: boolean;
};
errors: {
on_unneeded_wallet_key: boolean;
};
token_expiry: {
units: string;
amount: number;
};
};
traction_innkeeper: {
reservation: {
auto_approve: boolean;
expiry_minutes: number;
auto_issuer: boolean;
};
};
basicmessage_storage: {
wallet_enabled: boolean;
};
};
default_endpoint: string;
additional_endpoints: Array<any>;
tails_server_base_url: string;
tails_server_upload_url: string;
revocation: {
notify: boolean;
monitor_notification: boolean;
anoncreds_legacy_support: string;
};
'ledger.ledger_config_list': Array<{
id: string;
is_production: boolean;
is_write: boolean;
genesis_transactions: string;
keepalive: number;
read_only: boolean;
socks_proxy: any;
pool_name: string;
endorser_alias: string;
endorser_did: string;
}>;
'ledger.keepalive': number;
'ledger.read_only': boolean;
'ledger.write_ledger': string;
log: { level: string };
auto_ping_connection: boolean;
trace: {
target: string;
tag: string;
label: string;
};
preserve_exchange_records: boolean;
emit_new_didcomm_prefix: boolean;
emit_new_didcomm_mime_type: boolean;
auto_provision: boolean;
transport: {
inbound_configs: Array<Array<string>>;
'transport.outbound_configs': ['http'];
enable_undelivered_queue: boolean;
max_message_size: number;
max_outbound_retry: number;
ws: { timeout_interval: number };
};
wallet: { type: string };
multitenant: {
enabled: boolean;
admin_enabled: boolean;
wallet_type: string;
base_wallet_routes: Array<string>;
};
endorser: {
author: boolean;
endorser: boolean;
auto_endorse: boolean;
auto_write: boolean;
auto_create_rev_reg: boolean;
auto_promote_author_did: boolean;
auto_request: boolean;
endorser_alias: string;
endorser_public_did: string;
};
version: string | undefined;
};
}
Loading