Skip to content

Commit

Permalink
Merge pull request #4342 from alisman/newsLInk
Browse files Browse the repository at this point in the history
Allow custom href for news pages while handling deprecated .md files
  • Loading branch information
alisman authored Aug 4, 2022
2 parents 2655e1a + f9d2c90 commit 1d368e6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
2 changes: 0 additions & 2 deletions src/appBootstrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,6 @@ $(document).ready(async () => {

initializeServerConfiguration(initialServerConfig);

//setConfigDefaults();

initializeGenericAssayServerConfig();

initializeAPIClients();
Expand Down
2 changes: 1 addition & 1 deletion src/appShell/App/PortalHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default class PortalHeader extends React.Component<
{
id: 'news',
text: 'News',
address: 'https://docs.cbioportal.org/news/',
address: getServerConfig().skin_documentation_news!,
internal: false,
hide: () => getServerConfig().skin_show_news_tab === false,
},
Expand Down
14 changes: 14 additions & 0 deletions src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,23 @@ export function initializeServerConfiguration(rawConfiguration: any) {
localStorageOverride.serverConfig
);

// apply custom corrections for deprecated
// configurations
applyCorrections(mergedConfig);

setServerConfig(mergedConfig);
}

function applyCorrections(config: IServerConfig) {
// we no longer support markdown files (7/30/2022)
// we only support hyper links to externally hosted pages
// if we detect a custom configured MD file, correct it to use default new link
// otherwise, string will be used as link href
if (/\.md$/i.test(config.skin_documentation_news || '')) {
config.skin_documentation_news = ServerConfigDefaults.skin_documentation_news!;
}
}

export function setLoadConfig(obj: Partial<ILoadConfig>) {
Object.assign(loadConfig, obj);
}
Expand Down
4 changes: 2 additions & 2 deletions src/config/serverConfigDefaults.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { IServerConfig } from './IAppConfig';

const ServerConfigDefaults: Partial<IServerConfig> = {
export const ServerConfigDefaults: Partial<IServerConfig> = {
app_version: '1.0',
api_cache_limit: 450,
dat_method: 'none',
Expand Down Expand Up @@ -67,7 +67,7 @@ const ServerConfigDefaults: Partial<IServerConfig> = {
skin_documentation_faq: 'user-guide/faq.md',
skin_footer_show_dev: false,
skin_login_saml_registration_html: 'Sign in with MSK',
skin_documentation_news: 'News.md',
skin_documentation_news: 'https://docs.cbioportal.org/news/',
skin_documentation_oql: 'user-guide/oql.md',
skin_query_max_tree_depth: '3',
skin_right_nav_show_data_sets: true,
Expand Down

0 comments on commit 1d368e6

Please sign in to comment.