Skip to content

Commit

Permalink
Feature flags 717 (#743)
Browse files Browse the repository at this point in the history
* This allows Vite to pass environment variables to the front end

Signed-off-by: Jamie Popkin <popkinj@littleearth.ca>

* Pivoting to the json based config

Signed-off-by: Jamie Popkin <popkinj@littleearth.ca>

* Think this is the place to do it

Signed-off-by: Jamie Popkin <popkinj@littleearth.ca>

* This form factor should work for the rest

Signed-off-by: Jamie Popkin <popkinj@littleearth.ca>

* Half way through this now

Signed-off-by: Jamie Popkin <popkinj@littleearth.ca>

* Commented out all editing features, aside from the connection stuff

Signed-off-by: Jamie Popkin <popkinj@littleearth.ca>

* PR feedback updates

Signed-off-by: Jamie Popkin <popkinj@littleearth.ca>

* Make this visible again

Signed-off-by: Jamie Popkin <popkinj@littleearth.ca>

* All the Helm stuff

Signed-off-by: Jamie Popkin <popkinj@littleearth.ca>

* Removing tests that are irrelevent due to new flag

Signed-off-by: Jamie Popkin <popkinj@littleearth.ca>

* Changing some defaults here

Signed-off-by: Jamie Popkin <popkinj@littleearth.ca>

* testing

Signed-off-by: Lucas ONeil <lucasoneil@gmail.com>

* Testing the config

Signed-off-by: Jamie Popkin <popkinj@littleearth.ca>

* Maybe this would be a good catch all

Signed-off-by: Jamie Popkin <popkinj@littleearth.ca>

* Propagated to other components.

Signed-off-by: Jamie Popkin <popkinj@littleearth.ca>

* Missed these guys

Signed-off-by: Jamie Popkin <popkinj@littleearth.ca>

* Aligning of verifications input

Signed-off-by: Jamie Popkin <popkinj@littleearth.ca>

* Linting

Signed-off-by: Jamie Popkin <popkinj@littleearth.ca>

* Switching toggle back

Signed-off-by: Jamie Popkin <popkinj@littleearth.ca>

---------

Signed-off-by: Jamie Popkin <popkinj@littleearth.ca>
Signed-off-by: Lucas ONeil <lucasoneil@gmail.com>
Co-authored-by: Lucas ONeil <lucasoneil@gmail.com>
  • Loading branch information
popkinj and loneil authored Aug 15, 2023
1 parent cc20822 commit fdb2d3e
Show file tree
Hide file tree
Showing 20 changed files with 117 additions and 14 deletions.
1 change: 1 addition & 0 deletions charts/tenant-ui/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ data:
FRONTEND_INNKEEPER_OIDC_CLIENT: {{ .Values.oidc.client | quote }}
FRONTEND_INNKEEPER_OIDC_LABEL: {{ .Values.oidc.label | quote }}
FRONTEND_INNKEEPER_SHOW_ADMIN: {{ .Values.oidc.showInnkeeperAdminLogin | quote }}
FRONTEND_TENANT_SHOW_WRITABLE_COMPONENTS: {{ .Values.oidc.showWritableComponents | quote }}
FRONTEND_TENANT_PROXY_URL: {{ .Values.traction.tenantProxyEndpoint }}
SERVER_OIDC_JWKS: {{ .Values.oidc.jwksUri | quote }}
SERVER_OIDC_REALM: {{ .Values.oidc.realm | quote }}
Expand Down
1 change: 1 addition & 0 deletions deploy/tenant-ui/values-development.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ traction:
oidc:
active: true
showInnkeeperAdminLogin: true
showWritableComponents: true
authority: https://dev.loginproxy.gov.bc.ca/auth/realms/digitaltrust-nrm
jwksUri: https://dev.loginproxy.gov.bc.ca/auth/realms/digitaltrust-nrm/protocol/openid-connect/certs
ariesDetails:
Expand Down
1 change: 1 addition & 0 deletions deploy/tenant-ui/values-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ traction:
oidc:
active: true
showInnkeeperAdminLogin: true
showWritableComponents: true
authority: https://dev.loginproxy.gov.bc.ca/auth/realms/digitaltrust-nrm
jwksUri: https://dev.loginproxy.gov.bc.ca/auth/realms/digitaltrust-nrm/protocol/openid-connect/certs
ariesDetails:
Expand Down
1 change: 1 addition & 0 deletions deploy/tenant-ui/values-production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ traction:
oidc:
active: true
showInnkeeperAdminLogin: true
showWritableComponents: false
authority: https://loginproxy.gov.bc.ca/auth/realms/digitaltrust-nrm
jwksUri: https://loginproxy.gov.bc.ca/auth/realms/digitaltrust-nrm/protocol/openid-connect/certs
ariesDetails:
Expand Down
1 change: 1 addition & 0 deletions deploy/tenant-ui/values-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ traction:
oidc:
active: true
showInnkeeperAdminLogin: true
showWritableComponents: true
authority: https://test.loginproxy.gov.bc.ca/auth/realms/digitaltrust-nrm
jwksUri: https://test.loginproxy.gov.bc.ca/auth/realms/digitaltrust-nrm/protocol/openid-connect/certs
ariesDetails:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"tenantProxyPath": "FRONTEND_TENANT_PROXY_URL",
"showInnkeeperReservationPassword": "FRONTEND_INNKEEPER_SHOW_RESERVATION_PASSWORD",
"showInnkeeperAdminLogin": "FRONTEND_INNKEEPER_SHOW_ADMIN",
"showWritableComponents": "FRONTEND_TENANT_SHOW_WRITABLE_COMPONENTS",
"matomoUrl": "FRONTEND_MATOMO_URL",
"oidc": {
"active": "FRONTEND_INNKEEPER_OIDC_ACTIVE",
Expand Down
1 change: 1 addition & 0 deletions services/tenant-ui/config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"showInnkeeperReservationPassword": true,
"showInnkeeperAdminLogin": true,
"showOIDCReservationLogin": false,
"showWritableComponents": true,
"oidc": {
"active": false,
"authority": "https://dev.loginproxy.gov.bc.ca/auth/realms/digitaltrust-nrm",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ import StatusChip from '../common/StatusChip.vue';
import { TABLE_OPT, API_PATH } from '@/helpers/constants';
import { formatDateLong } from '@/helpers';
// State
import { useConfigStore } from '@/store/configStore';
const { config } = storeToRefs(useConfigStore());
const confirm = useConfirm();
const toast = useToast();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@
:connection-id="props.connectionId"
:connection-name="props.connectionName"
/>
<div class="p-inputgroup flex-1 send-message">
<div
v-if="
config.frontend.showWritableComponents === true ||
config.frontend.showWritableComponents === 'true'
"
class="p-inputgroup flex-1 send-message"
>
<InputText
v-model="message"
type="text"
Expand All @@ -36,6 +42,10 @@ import MessageContactList from './MessageContactList.vue';
// State
import { useMessageStore } from '@/store';
import { storeToRefs } from 'pinia';
import { useConfigStore } from '@/store/configStore';
const { config } = storeToRefs(useConfigStore());
const messageStore = useMessageStore();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
<Column :sortable="false" header="Actions">
<template #body="{ data }">
<Button
v-if="
config.frontend.showWritableComponents === true ||
config.frontend.showWritableComponents === 'true'
"
title="Delete Credential Definition"
icon="pi pi-trash"
class="p-button-rounded p-button-icon-only p-button-text"
Expand Down Expand Up @@ -129,6 +133,7 @@ import { useToast } from 'vue-toastification';
// State
import { useGovernanceStore } from '../../store';
import { storeToRefs } from 'pinia';
import { useConfigStore } from '@/store/configStore';
// Custom components
import RowExpandData from '../common/RowExpandData.vue';
import { TABLE_OPT, API_PATH } from '@/helpers/constants';
Expand All @@ -138,6 +143,8 @@ import MainCardContent from '../layout/mainCard/MainCardContent.vue';
const confirm = useConfirm();
const toast = useToast();
const { config } = storeToRefs(useConfigStore());
const governanceStore = useGovernanceStore();
const { loading, storedCredDefs } = storeToRefs(useGovernanceStore());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@
<template #header>
<div class="flex justify-content-between">
<div class="flex justify-content-start">
<OfferCredential />
<OfferCredential
v-if="
config.frontend.showWritableComponents === true ||
config.frontend.showWritableComponents === 'true'
"
/>
</div>
<div class="flex justify-content-end">
<span class="p-input-icon-left">
Expand All @@ -40,10 +45,18 @@
<Column header="Actions">
<template #body="{ data }">
<DeleteCredentialExchangeButton
v-if="
config.frontend.showWritableComponents === true ||
config.frontend.showWritableComponents === 'true'
"
:cred-exch-id="data.credential_exchange_id"
/>

<RevokeCredentialButton
v-if="
config.frontend.showWritableComponents === true ||
config.frontend.showWritableComponents === 'true'
"
:cred-exch-record="data"
:connection-display="findConnectionName(data.connection_id) ?? ''"
/>
Expand Down Expand Up @@ -142,6 +155,7 @@ import { Ref, computed, onMounted, ref } from 'vue';
// State
import { useContactsStore, useIssuerStore } from '@/store';
import { storeToRefs } from 'pinia';
import { useConfigStore } from '@/store/configStore';
// PrimeVue/etc
import { FilterMatchMode } from 'primevue/api';
import Column from 'primevue/column';
Expand All @@ -159,6 +173,8 @@ import DeleteCredentialExchangeButton from './deleteCredential/DeleteCredentialE
import RevokeCredentialButton from './deleteCredential/RevokeCredentialButton.vue';
import OfferCredential from './offerCredential/OfferCredential.vue';
const { config } = storeToRefs(useConfigStore());
const toast = useToast();
const { listContacts, findConnectionName } = useContactsStore();
Expand Down
25 changes: 23 additions & 2 deletions services/tenant-ui/frontend/src/components/issuance/Schemas.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,19 @@
<template #header>
<div class="flex justify-content-between">
<div class="flex justify-content-start">
<CreateSchema />
<CopySchema class="ml-4" />
<CreateSchema
v-if="
config.frontend.showWritableComponents === true ||
config.frontend.showWritableComponents === 'true'
"
/>
<CopySchema
v-if="
config.frontend.showWritableComponents === true ||
config.frontend.showWritableComponents === 'true'
"
class="ml-4"
/>
</div>
<div class="flex justify-content-end">
<span class="p-input-icon-left">
Expand All @@ -42,6 +53,10 @@
<Column :sortable="false" header="Actions">
<template #body="{ data }">
<Button
v-if="
config.frontend.showWritableComponents === true ||
config.frontend.showWritableComponents === 'true'
"
title="Delete Schema"
icon="pi pi-trash"
class="p-button-rounded p-button-icon-only p-button-text"
Expand Down Expand Up @@ -173,6 +188,12 @@ import RowExpandData from '../common/RowExpandData.vue';
import { TABLE_OPT, API_PATH } from '@/helpers/constants';
import { formatDateLong } from '@/helpers';
// State
import { useConfigStore } from '@/store/configStore';
const { config } = storeToRefs(useConfigStore());
console.log('config', config);
const confirm = useConfirm();
const toast = useToast();
Expand Down
14 changes: 13 additions & 1 deletion services/tenant-ui/frontend/src/components/messages/Messages.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@
<template #header>
<div class="flex justify-content-between">
<div class="flex justify-content-start">
<CreateMessage @success="loadTable" />
<CreateMessage
v-if="
config.frontend.showWritableComponents === true ||
config.frontend.showWritableComponents === 'true'
"
@success="loadTable"
/>
</div>
<div class="flex justify-content-end">
<span class="p-input-icon-left">
Expand Down Expand Up @@ -133,6 +139,12 @@ import MainCardContent from '../layout/mainCard/MainCardContent.vue';
import CreateMessage from './createMessage/CreateMessage.vue';
import LoadingLabel from '../common/LoadingLabel.vue';
// State
import { useConfigStore } from '@/store/configStore';
const { config } = storeToRefs(useConfigStore());
console.log('config', config);
const toast = useToast();
const messageStore = useMessageStore();
Expand Down
13 changes: 12 additions & 1 deletion services/tenant-ui/frontend/src/components/oca/Oca.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@
<template #header>
<div class="flex justify-content-between">
<div class="flex justify-content-start">
<CreateOca />
<CreateOca
v-if="
config.frontend.showWritableComponents === true ||
config.frontend.showWritableComponents === 'true'
"
/>
</div>
<div class="flex justify-content-end">
<span class="p-input-icon-left">
Expand All @@ -39,6 +44,10 @@
<Column :sortable="false" header="Actions">
<template #body="{ data }">
<Button
v-if="
config.frontend.showWritableComponents === true ||
config.frontend.showWritableComponents === 'true'
"
title="Delete Credential Definition"
icon="pi pi-trash"
class="p-button-rounded p-button-icon-only p-button-text"
Expand Down Expand Up @@ -122,6 +131,8 @@ import { useToast } from 'vue-toastification';
// State
import { useGovernanceStore } from '../../store';
import { storeToRefs } from 'pinia';
import { useConfigStore } from '@/store/configStore';
const { config } = storeToRefs(useConfigStore());
// Custom components
import CreateOca from './createOca/CreateOca.vue';
import MainCardContent from '../layout/mainCard/MainCardContent.vue';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@
>
<template #header>
<div class="flex justify-content-between">
<CreateRequest />
<div class="flex justify-content-start">
<CreateRequest
v-if="
config.frontend.showWritableComponents === true ||
config.frontend.showWritableComponents === 'true'
"
/>
</div>

<div class="flex justify-content-end">
<span class="p-input-icon-left">
Expand All @@ -42,9 +49,19 @@
<Column :sortable="false" :header="$t('common.actions')">
<template #body="{ data }">
<div class="flex">
<DeleteExchangeRecord :record-id="data.presentation_exchange_id" />
<DeleteExchangeRecord
v-if="
config.frontend.showWritableComponents === true ||
config.frontend.showWritableComponents === 'true'
"
:record-id="data.presentation_exchange_id"
/>
<CreateRequest
v-if="data.role === 'verifier'"
v-if="
data.role === 'verifier' &&
(config.frontend.showWritableComponents === true ||
config.frontend.showWritableComponents === 'true')
"
:existing-pres-req="data.presentation_request"
icon-display
/>
Expand Down Expand Up @@ -104,6 +121,7 @@ import { useToast } from 'vue-toastification';
// State
import { useContactsStore, useVerifierStore } from '@/store';
import { storeToRefs } from 'pinia';
import { useConfigStore } from '@/store/configStore';
// Components
import MainCardContent from '@/components/layout/mainCard/MainCardContent.vue';
import CreateRequest from './createPresentationRequest/CreateRequest.vue';
Expand All @@ -124,6 +142,7 @@ const { contacts } = storeToRefs(useContactsStore());
const { loading, presentations, selectedPresentation } = storeToRefs(
useVerifierStore()
);
const { config } = storeToRefs(useConfigStore());
const loadTable = async () => {
verifierStore.listPresentations().catch((err) => {
Expand Down
1 change: 1 addition & 0 deletions services/tenant-ui/frontend/test/__mocks__/store/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const store: { [key: string]: any } = {
tenantProxyPath: API_PATH.TEST_TENANT_PROXY,
showOIDCReservationLogin: false,
showInnkeeperAdminLogin: true,
showWritableComponents: false,
},
image: {
tag: '1.0',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@ describe('Acapy', async () => {
const store = useConfigStore();
const wrapper = createWrapper();
wrapper.getComponent({ name: 'Accordion' }).trigger('click');
expect(store.getPluginList).toHaveBeenCalled();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ describe('IssuedCredentials', () => {
const wrapper = mountIssuedCredentials();

wrapper.getComponent({ name: 'DataTable' });
wrapper.getComponent({ name: 'OfferCredential' });
});

test('table body is rendered with expected values', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ describe('Messages', async () => {
test('mount has expected components', () => {
const wrapper = mountMessages();
wrapper.getComponent({ name: 'DataTable' });
wrapper.getComponent({ name: 'CreateMessage' });
});

test('table body is rendered with expected values', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ describe('Presentations', () => {
const wrapper = mountPresentations();

wrapper.getComponent({ name: 'DataTable' });
wrapper.getComponent({ name: 'CreateRequest' });
wrapper.getComponent({ name: 'DeleteExchangeRecord' });
});

test('table body is rendered with expected values', async () => {
Expand Down

0 comments on commit fdb2d3e

Please sign in to comment.