UNPKG

@mikezimm/fps-library-v2

Version:

Library of reusable typescript/javascript functions, interfaces and constants

82 lines (81 loc) 4.98 kB
/** * CodeAnalizerComment: Updated 1 imports on 2024-09-21 23:07:24 * Update:: import { IHelpTable } to '@mikezimm/fps-core-v7/lib/banner/components/SingleHelpPage/interfaces/ISinglePageProps;' */ import * as React from 'react'; import { makeCenteredBoldSpan, makeCenteredSpan } from '../../components/SingleHelpPage/makeTricksTable'; /** * tricksTable creates table of "tricks" which provide url paramters to reload the page in different modes * Originally copied from FPSPageInfo * const showScenario, showTool, showGulp, showAllowOther, showCrazy, showCreate: boolean = true; * @param showScenario * @param showTool * @param showGulp * @param showAllowOther * @param showCrazy * @param showCreate * @returns */ export function tricksTable(showScenario, showTool, showGulp, showAllowOther, showCrazy, showCreate, beakermode) { let table = { heading: 'Undocumented and dangerous url parameters', headers: ['Param', 'Value', 'Active?', 'Notes'], rows: [], }; let hasSearch = window.location.search && window.location.search.length > 0 ? true : false; let searchParams = hasSearch === true ? window.location.search : ''; searchParams = searchParams.split('%3a').join(':'); let hasSearchParams = searchParams.length > 0 ? '&' : '?'; if (showScenario === true) { let hasScenarioDev = searchParams.indexOf('scenario=dev') > -1 ? makeCenteredBoldSpan('true') : makeCenteredBoldSpan(React.createElement("a", { href: window.location + hasSearchParams + 'scenario=dev' }, "Activate!")); table.rows.push([makeCenteredSpan('scenario'), makeCenteredSpan('dev'), hasScenarioDev, { info: `Opens up additional options - 'Rails Off' meaning limited safety checks.` }]); } if (showTool === true) { let hasToolTrue = searchParams.indexOf('tool=true') > -1 ? makeCenteredBoldSpan('true') : makeCenteredBoldSpan(React.createElement("a", { href: window.location + hasSearchParams + 'tool=true' }, "Activate!")); table.rows.push([makeCenteredSpan('tool'), makeCenteredSpan('true'), hasToolTrue, { info: `Displays commandbar in some webparts if it's hidden.` }]); } if (showGulp === true) { //Just replacing : with encoded url based on testing. let gulpParam1 = 'debug=true&noredir=true&debugManifestsFile=https://localhost:4321/temp/manifests.js'; let gulpParam2 = 'debug=true&noredir=true&debugManifestsFile=https%3A%2F%2Flocalhost%3A4321%2Ftemp%2Fmanifests.js'; let hasGulp = searchParams.indexOf(gulpParam1) > -1 || searchParams.indexOf(gulpParam2) > -1 ? makeCenteredBoldSpan('true') : makeCenteredBoldSpan(React.createElement("a", { href: window.location + hasSearchParams + gulpParam1 }, "Activate!")); table.rows.push([makeCenteredSpan('gulp serve'), makeCenteredSpan('dev'), hasGulp, { info: `Adds param to Url to use gulp serve code instead of published code` }]); } if (showAllowOther === true) { let hasAllowOther = searchParams.indexOf('allowOtherSites=true') > -1 ? makeCenteredBoldSpan('true') : makeCenteredBoldSpan(React.createElement("a", { href: window.location + hasSearchParams + 'allowOtherSites=true' }, "Activate!")); table.rows.push([makeCenteredSpan('allowOtherSites'), makeCenteredSpan('true'), hasAllowOther, { info: `Allows you to do some 'Rails Off' functions on other sites { '' } ` }]); } if (showCrazy === true) { let hasCrazy = searchParams.indexOf('crazy=true') > -1 ? makeCenteredBoldSpan('true') : ''; table.rows.push([makeCenteredSpan('crazy'), makeCenteredSpan('true'), hasCrazy, { info: `Opens up additional even more options - 'DO NOT USE UNLESS YOU KNOW WHAT YOU ARE DOING'` }]); } if (showCreate === true) { let hasCreate = searchParams.indexOf('create=true') > -1 ? makeCenteredBoldSpan('true') : ''; table.rows.push([makeCenteredSpan('create'), makeCenteredSpan('true'), hasCreate, { info: `Opens up additional options - create sample items in lists` }]); } const showBare = true; if (showBare === true) { let bareLink = hasSearch ? makeCenteredBoldSpan(React.createElement("a", { href: window.location.pathname }, "Activate!")) : makeCenteredBoldSpan('true'); table.rows.push([makeCenteredSpan('clearParams'), makeCenteredSpan(`${hasSearch}`), bareLink, { info: `Reload without any parameters (wwwthing after the ? in the url )` }]); } return { table: table }; } // export function makeCenteredSpan( info: any ) { // return { info: info, style: { textAlign: 'center'} } ; // } // export function makeCenteredBoldSpan( info: any ) { // return { info: info, style: { textAlign: 'center', fontWeight: 'bolder' } } ; // } //# sourceMappingURL=ReusaableTricks.js.map