From 592e3b659e3f258072c986d67abe83a2deba9693 Mon Sep 17 00:00:00 2001 From: Johnnadel Salita Uy Date: Wed, 24 Jul 2024 12:36:00 +0200 Subject: [PATCH] [MIM-848] Mim 848 feature toggle summer cleanup (#2820) * Remove unused feature toggles MIM-848 * Remove old feature toggles that are enabled true by default * Remove unused highchart-expert feature toggle * Remove hide-in-header-qa feature and feature toggle * Re-import isEnabled in default * Fix import * Re-implement highchart-expert feature toggle * Re-implement deactive part cache feature toggles for article list and released statistics * Revert "Remove hide-in-header-qa feature and feature toggle" This reverts commit 5b4851f10dd0d01988b983aaa8ddb4667b59f7fb. --- .../admin/tools/dashboard/dashboard.es6 | 2 - src/main/resources/lib/ssb/cron/cron.ts | 3 -- .../lib/ssb/parts/highcharts/graph/config.ts | 5 +-- .../lib/ssb/utils/nameSearchUtils.ts | 7 +--- .../lib/types/partTypes/searchResult.ts | 1 - src/main/resources/main.es6 | 40 ------------------- src/main/resources/services/news/news.ts | 19 ++++----- .../resources/site/pages/default/default.ts | 1 + .../resources/site/parts/article/article.ts | 3 +- .../site/parts/highchart/highchart.html | 4 +- .../site/parts/highchart/highchart.ts | 1 - .../parts/highchartExpert/highchartExpert.ts | 4 +- .../releasedStatistics/releasedStatistics.ts | 1 - .../site/parts/searchResult/searchResult.ts | 6 +-- .../parts/searchResult/searchResultView.tsx | 6 +-- 15 files changed, 21 insertions(+), 82 deletions(-) diff --git a/src/main/resources/admin/tools/dashboard/dashboard.es6 b/src/main/resources/admin/tools/dashboard/dashboard.es6 index febb1a991..a0771f292 100644 --- a/src/main/resources/admin/tools/dashboard/dashboard.es6 +++ b/src/main/resources/admin/tools/dashboard/dashboard.es6 @@ -6,7 +6,6 @@ import { parseContributions, getEnvironmentString } from '/lib/ssb/utils/utils' import { render } from '/lib/thymeleaf' import { renderError } from '/lib/ssb/error/error' import { React4xp } from '/lib/enonic/react4xp' -import { isEnabled } from '/lib/featureToggle' const view = resolve('./dashboard.html') const DEFAULT_CONTENTSTUDIO_URL = getToolUrl('com.enonic.app.contentstudio', 'main') @@ -63,7 +62,6 @@ function renderPart(req) { internalBaseUrl: `${INTERNAL_BASE_URL}`, internalStatbankUrl: `${INTERNAL_STATBANK_URL}`, statregRapportUrl: `${STATREG_RAPPORT_URL}`, - toggleDebugging: isEnabled('dashboard-redux-logging-debugging', true, 'ssb'), title: `${environmentString ? `${environmentString}: ` : ''}SSB Dashboard`, }) .setId('dashboard') diff --git a/src/main/resources/lib/ssb/cron/cron.ts b/src/main/resources/lib/ssb/cron/cron.ts index c15d46a1c..42d4cb9ca 100644 --- a/src/main/resources/lib/ssb/cron/cron.ts +++ b/src/main/resources/lib/ssb/cron/cron.ts @@ -7,7 +7,6 @@ import { list, schedule, type TaskMapper } from '/lib/cron' import { cronJobLog } from '/lib/ssb/utils/serverLog' import { ENONIC_CMS_DEFAULT_REPO } from '/lib/ssb/repo/common' import { publishDataset } from '/lib/ssb/dataset/publishOld' -import { isEnabled } from '/lib/featureToggle' const createUserContext: ContextParams = { // Master context (XP) @@ -139,7 +138,6 @@ export function setupCronJobs(): void { } // Push RSS Statkal - const pushRssStatkalEnabled: boolean = isEnabled('push-rss-statkal', false, 'ssb') scheduleJob({ name: 'pushRssStatkal', description: 'Push kommende publiseringer til rss/statkal', @@ -147,7 +145,6 @@ export function setupCronJobs(): void { cronValue: app.config && app.config['ssb.task.pushRssStatkal'] ? app.config['ssb.task.pushRssStatkal'] : '10 08 * * *', timeZone: timezone, - updateEnabledTo: pushRssStatkalEnabled, }) // Delete expired event logs for queries diff --git a/src/main/resources/lib/ssb/parts/highcharts/graph/config.ts b/src/main/resources/lib/ssb/parts/highcharts/graph/config.ts index bbdfa91a5..fd0f0265a 100644 --- a/src/main/resources/lib/ssb/parts/highcharts/graph/config.ts +++ b/src/main/resources/lib/ssb/parts/highcharts/graph/config.ts @@ -2,7 +2,6 @@ // @ts-nocheck import { localize } from '/lib/xp/i18n' -import { isEnabled } from '/lib/featureToggle' import { ensureArray } from '/lib/ssb/utils/arrayUtils' export const style = { @@ -326,7 +325,7 @@ export const createDefaultConfig = (highchartData, displayName, language) => ({ }, }, title: { - text: isEnabled('highcharts-y-axix-title-mobile', true, 'ssb') ? highchartData.yAxisTitle : '', + text: highchartData.yAxisTitle, }, }, // right y axis @@ -340,7 +339,7 @@ export const createDefaultConfig = (highchartData, displayName, language) => ({ }, }, title: { - text: isEnabled('highcharts-y-axix-title-mobile', true, 'ssb') ? highchartData.yAxisTitle : '', + text: highchartData.yAxisTitle, }, }, ], diff --git a/src/main/resources/lib/ssb/utils/nameSearchUtils.ts b/src/main/resources/lib/ssb/utils/nameSearchUtils.ts index 3dd8d1c30..f90f007b7 100644 --- a/src/main/resources/lib/ssb/utils/nameSearchUtils.ts +++ b/src/main/resources/lib/ssb/utils/nameSearchUtils.ts @@ -8,7 +8,6 @@ import { getNameGraphDataFromRepo, type NameData, nameGraphRepoExists } from '/l import { request, HttpRequestParams, HttpResponse } from '/lib/http-client' import { getCalculatorConfig, getNameSearchGraphData } from '/lib/ssb/dataset/calculator' -import { isEnabled } from '/lib/featureToggle' import { type SolrResponse } from '/lib/types/solr' import { type CalculatorConfig } from '/site/content-types' @@ -53,10 +52,9 @@ export function getNameSearchResult(name: string, includeGraphData: boolean): So } export function prepareNameGraphResult(name: string): string { - const nameSearchGraphEnabled: boolean = isEnabled('name-graph', true, 'ssb') const obj: ResultType = JSON.parse('{}') obj.originalName = name - obj.nameGraph = nameSearchGraphEnabled ? prepareGraph(name) : [] + obj.nameGraph = prepareGraph(name) return JSON.stringify(obj) } @@ -65,10 +63,9 @@ export function prepareGraph(name: string): Array { } function prepareResult(result: string, name: string, includeGraphData: boolean): string { - const nameSearchGraphEnabled: boolean = isEnabled('name-graph', true, 'ssb') const obj: ResultType = JSON.parse(result) obj.originalName = name - obj.nameGraphData = nameSearchGraphEnabled && includeGraphData ? prepareGraph(name) : [] + obj.nameGraphData = includeGraphData ? prepareGraph(name) : [] return JSON.stringify(obj) } diff --git a/src/main/resources/lib/types/partTypes/searchResult.ts b/src/main/resources/lib/types/partTypes/searchResult.ts index bf6223480..001a6826c 100644 --- a/src/main/resources/lib/types/partTypes/searchResult.ts +++ b/src/main/resources/lib/types/partTypes/searchResult.ts @@ -24,7 +24,6 @@ export interface SearchResultProps { allContentTypesPhrase: string allSubjectsPhrase: string searchServiceUrl: string - nameSearchToggle: boolean nameSearchData: object | undefined nameSearchUrl: string namePhrases: { diff --git a/src/main/resources/main.es6 b/src/main/resources/main.es6 index 42420dcab..47c554f48 100644 --- a/src/main/resources/main.es6 +++ b/src/main/resources/main.es6 @@ -27,46 +27,14 @@ try { { space: 'ssb', features: [ - { - feature: 'rss-news', - enabled: true, - }, - { - feature: 'rss-news-statistics', - enabled: false, - }, - { - feature: 'article-isbn', - enabled: true, - }, { feature: 'articlelist-sorting', enabled: false, }, - { - feature: 'name-graph', - enabled: false, - }, - { - feature: 'dashboard-redux-logging-debugging', - enabled: true, - }, - { - feature: 'highchart-show-datatable', - enabled: false, - }, { feature: 'highchart-react', enabled: false, }, - { - feature: 'highcharts-y-axix-title-mobile', - enabled: false, - }, - { - feature: 'name-search-in-freetext-search', - enabled: false, - }, { feature: 'deactivate-partcache-released-statistics', enabled: true, @@ -79,14 +47,6 @@ try { feature: 'new-publication-archive', enabled: false, }, - { - feature: 'datefns-publication-archive', - enabled: false, - }, - { - feature: 'push-rss-statkal', - enabled: false, - }, { feature: 'highchart-expert', enabled: false, diff --git a/src/main/resources/services/news/news.ts b/src/main/resources/services/news/news.ts index 103852c1d..5c0468f71 100644 --- a/src/main/resources/services/news/news.ts +++ b/src/main/resources/services/news/news.ts @@ -4,25 +4,20 @@ import { StatisticInListing, VariantInListing } from '/lib/ssb/dashboard/statreg import { getTimeZoneIso } from '/lib/ssb/utils/dateUtils' import { subDays, isSameDay, format, parseISO } from '/lib/vendor/dateFns' import { fetchStatisticsWithReleaseToday } from '/lib/ssb/statreg/statistics' -import { isEnabled } from '/lib/featureToggle' import { xmlEscape } from '/lib/text-encoding' import { type Statistic } from '/site/mixins/statistic' import { type Default as DefaultPageConfig } from '/site/pages/default' import { type Page, type Article, type Statistics } from '/site/content-types' function get(): XP.Response { - const rssNewsEnabled: boolean = isEnabled('rss-news', true, 'ssb') - const rssStatisticsEnabled: boolean = isEnabled('rss-news-statistics', false, 'ssb') - const mainSubjects: Array> = rssNewsEnabled - ? (query({ - start: 0, - count: 100, - query: 'components.page.config.mimir.default.subjectType LIKE "mainSubject"', - }).hits as unknown as Array>) - : [] + const mainSubjects: Array> = query({ + start: 0, + count: 100, + query: 'components.page.config.mimir.default.subjectType LIKE "mainSubject"', + }).hits as unknown as Array> - const news: Array = rssNewsEnabled ? getNews(mainSubjects) : [] - const statistics: Array = rssNewsEnabled && rssStatisticsEnabled ? getStatisticsNews(mainSubjects) : [] + const news: Array = getNews(mainSubjects) + const statistics: Array = getStatisticsNews(mainSubjects) const xml = ` ${[...news, ...statistics] diff --git a/src/main/resources/site/pages/default/default.ts b/src/main/resources/site/pages/default/default.ts index 3c23a7529..a44e0166b 100644 --- a/src/main/resources/site/pages/default/default.ts +++ b/src/main/resources/site/pages/default/default.ts @@ -37,6 +37,7 @@ import { isEnabled } from '/lib/featureToggle' import { ensureArray } from '/lib/ssb/utils/arrayUtils' import { type SubjectItem } from '/lib/types/subject' import { type MunicipalityWithCounty, type RequestWithCode } from '/lib/types/municipalities' +import { isEnabled } from '/lib/featureToggle' import { type Default as DefaultPageConfig } from '/site/pages/default' import { type Page, type Statistics } from '/site/content-types' diff --git a/src/main/resources/site/parts/article/article.ts b/src/main/resources/site/parts/article/article.ts index c7511ed2c..32750d84e 100644 --- a/src/main/resources/site/parts/article/article.ts +++ b/src/main/resources/site/parts/article/article.ts @@ -8,7 +8,6 @@ import { getAssociatedStatisticsLinks, getAssociatedArticleArchiveLinks } from ' import * as util from '/lib/util' import { getPhrases } from '/lib/ssb/utils/language' import { renderError } from '/lib/ssb/error/error' -import { isEnabled } from '/lib/featureToggle' import { type ArticleProps } from '/lib/types/partTypes/article' import { type Article } from '/site/content-types' @@ -76,7 +75,7 @@ function renderPart(req: XP.Request) { serialNumber: page.data.serialNumber, associatedStatistics: getAssociatedStatisticsLinks(associatedStatisticsConfig), associatedArticleArchives: getAssociatedArticleArchiveLinks(associatedArticleArchivesConfig), - isbn: isEnabled('article-isbn', true) ? page.data.isbnNumber : undefined, + isbn: page.data.isbnNumber, } return render('site/parts/article/article', props, req, { diff --git a/src/main/resources/site/parts/highchart/highchart.html b/src/main/resources/site/parts/highchart/highchart.html index 65475257e..028b8ddfd 100644 --- a/src/main/resources/site/parts/highchart/highchart.html +++ b/src/main/resources/site/parts/highchart/highchart.html @@ -4,10 +4,10 @@
-
+

-

+
- {props.nameSearchToggle && props.nameSearchData ? renderNameResult() : undefined} + {props.nameSearchData ? renderNameResult() : undefined}
    {renderListItem(bestBetHit!)} {hits.map((hit, i) => { @@ -332,7 +332,7 @@ function SearchResult(props: SearchResultProps) { if (props.language === 'en') { return (
    - {props.nameSearchToggle ? renderNameResult() : undefined} + {renderNameResult()} {props.noHitMessage}

    Go to name search @@ -348,7 +348,7 @@ function SearchResult(props: SearchResultProps) { } else { return (

    - {props.nameSearchToggle ? renderNameResult() : undefined} + {renderNameResult()} {props.noHitMessage}

    Her finner du navnesøk