diff --git a/.github/environments/values.prod.yaml b/.github/environments/values.prod.yaml index 05e96294..a30840b7 100644 --- a/.github/environments/values.prod.yaml +++ b/.github/environments/values.prod.yaml @@ -4,17 +4,10 @@ config: configMap: FRONTEND_APIPATH: api/v1 FRONTEND_COMS_APIPATH: https://coms.api.gov.bc.ca/api/v1 + FRONTEND_EXCLUDE_METADATA: geodrive.common.encoding,geodrive.windows.attr,geodrive.windows.secdesc,s3b-last-modified + FRONTEND_EXCLUDE_TAGSET: coms-id FRONTEND_OIDC_AUTHORITY: https://loginproxy.gov.bc.ca/auth/realms/standard FRONTEND_OIDC_CLIENTID: bc-box-4555 - FRONTEND_S3METATAG_EXCLUDE: - metadata: - - geodrive.common.encoding - - geodrive.windows.attr - - geodrive.windows.secdesc - - s3b-last-modified - - sha256 - tagset: - - coms-id SERVER_APIPATH: /api/v1 SERVER_BODYLIMIT: 30mb # SERVER_LOGFILE: ~ diff --git a/app/config/custom-environment-variables.json b/app/config/custom-environment-variables.json index d50f44c1..0ca20380 100644 --- a/app/config/custom-environment-variables.json +++ b/app/config/custom-environment-variables.json @@ -4,12 +4,15 @@ "coms": { "apiPath": "FRONTEND_COMS_APIPATH" }, + "exclude": { + "metadata": "FRONTEND_EXCLUDE_METADATA", + "tagset": "FRONTEND_EXCLUDE_TAGSET" + }, "notificationBanner": "FRONTEND_NOTIFICATION_BANNER", "oidc": { "authority": "FRONTEND_OIDC_AUTHORITY", "clientId": "FRONTEND_OIDC_CLIENTID" - }, - "s3MetaTagExclude": "FRONTEND_S3METATAG_EXCLUDE" + } }, "server": { "apiPath": "SERVER_APIPATH", diff --git a/charts/bcbox/Chart.yaml b/charts/bcbox/Chart.yaml index 326bccef..1d5373ac 100644 --- a/charts/bcbox/Chart.yaml +++ b/charts/bcbox/Chart.yaml @@ -37,6 +37,6 @@ maintainers: # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: "0.5.0" +appVersion: "0.4.0" deprecated: false annotations: {} diff --git a/charts/bcbox/values.yaml b/charts/bcbox/values.yaml index d4995dda..ff1e6490 100644 --- a/charts/bcbox/values.yaml +++ b/charts/bcbox/values.yaml @@ -113,6 +113,8 @@ config: configMap: FRONTEND_APIPATH: "api/v1" FRONTEND_COMS_APIPATH: ~ + # FRONTEND_EXCLUDE_METADATA: ~ + # FRONTEND_EXCLUDE_TAGSET: ~ # FRONTEND_NOTIFICATION_BANNER: ~ FRONTEND_OIDC_AUTHORITY: ~ FRONTEND_OIDC_CLIENTID: ~ @@ -122,4 +124,3 @@ config: # SERVER_LOGFILE: ~ SERVER_LOGLEVEL: "http" SERVER_PORT: "8080" - # FRONTEND_S3METATAG_EXCLUDE: ~ diff --git a/frontend/src/services/objectService.ts b/frontend/src/services/objectService.ts index 4dd7d657..3fc8a5e5 100644 --- a/frontend/src/services/objectService.ts +++ b/frontend/src/services/objectService.ts @@ -1,5 +1,5 @@ import { comsAxios } from './interceptors'; -import { s3MetaTagExclude, setDispositionHeader } from '@/utils/utils'; +import { excludeMetaTag, setDispositionHeader } from '@/utils/utils'; import ConfigService from './configService'; import type { AxiosRequestConfig } from 'axios'; @@ -105,7 +105,7 @@ export default { return comsAxios().get(`${PATH}/metadata`, { headers: headers, params: params }) // filter out metadata and return as a promise again .then((response) => { - return s3MetaTagExclude('metadata', response); + return { data: excludeMetaTag('metadata', response.data) }; }); }, @@ -119,7 +119,7 @@ export default { return comsAxios().get(`${PATH}/tagging`, { params: params }) // filter out a configured list of select tags .then((response) => { - return s3MetaTagExclude('tagset', response); + return { data: excludeMetaTag('tagset', response.data) }; }); }, @@ -226,7 +226,7 @@ export default { return comsAxios().get(`${PATH}/metadata`, config) // filter out a configured list of select metadata .then((response) => { - return s3MetaTagExclude('metadata', response); + return { data: excludeMetaTag('metadata', response.data) }; }); }, @@ -302,7 +302,7 @@ export default { }) // filter out a configured list of select tags .then((response) => { - return s3MetaTagExclude('tagset', response); + return { data: excludeMetaTag('tagset', response.data) }; }); }, diff --git a/frontend/src/services/versionService.ts b/frontend/src/services/versionService.ts index 1422e2ef..8d120261 100644 --- a/frontend/src/services/versionService.ts +++ b/frontend/src/services/versionService.ts @@ -1,5 +1,5 @@ import { comsAxios } from './interceptors'; -import { s3MetaTagExclude } from '@/utils/utils'; +import { excludeMetaTag } from '@/utils/utils'; import type { GetVersionMetadataOptions, GetVersionTaggingOptions } from '@/types'; @@ -15,7 +15,7 @@ export default { return comsAxios().get(`${PATH}/metadata`, { headers: headers, params: params }) // filter out a configured list of select metadata .then((response) => { - return s3MetaTagExclude('metadata', response); + return { data: excludeMetaTag('metadata', response.data) }; }); }, @@ -28,7 +28,7 @@ export default { return comsAxios().get(`${PATH}/tagging`, { params: params }) // filter out a configured list of select tags .then((response) => { - return s3MetaTagExclude('tagset', response); + return { data: excludeMetaTag('tagset', response.data) }; }); }, }; diff --git a/frontend/src/utils/utils.ts b/frontend/src/utils/utils.ts index b014d931..337f916a 100644 --- a/frontend/src/utils/utils.ts +++ b/frontend/src/utils/utils.ts @@ -65,25 +65,24 @@ export function partition( } /** - * @function s3MetaTagExclude + * @function excludeMetaTag * Filter out a configured list of select metadata or tags from a COMS response * @param {object} type either 'metadata' or 'tagset' * @param {object} axiosResponse A resolved axios response from COMS * @returns {object} The response data with select metadata/tags from a configured list removed */ -export function s3MetaTagExclude(type: string, axiosResponse: { data: any }){ +export function excludeMetaTag(type: string, data: any){ // array of selected tags/metadata (keys) to hide from UI - const excludeArray = new ConfigService().getConfig().s3MetaTagExclude?.[type] ?? []; + const excludeArray = new ConfigService().getConfig().exclude?.[type].split(',') ?? []; // filter COMS data - const filtered = axiosResponse.data.map((obj:any) => { + return data.map((obj: any) => { return { ...obj, - [type]: obj[type]?.filter((el:any) => { + [type]: obj[type]?.filter((el: any) => { return !excludeArray.includes(el.key); }) }; }); - return { data: filtered }; } /**