feat: feature flags disable not finished components
This commit is contained in:
parent
e61312f500
commit
49cf7cac15
5
.env
5
.env
@ -2,3 +2,8 @@ VERSION=1
|
|||||||
WEB_URL=https://pinmenote.com
|
WEB_URL=https://pinmenote.com
|
||||||
IS_PRODUCTION=true
|
IS_PRODUCTION=true
|
||||||
OBJ_LIST_LIMIT=100
|
OBJ_LIST_LIMIT=100
|
||||||
|
|
||||||
|
FF_SYNC_ENABLED=0
|
||||||
|
FF_LOGIN_ENABLED=0
|
||||||
|
FF_NEW_PIN_PREVIEW=0
|
||||||
|
FF_REPORT_BUG=0
|
@ -1,4 +1,9 @@
|
|||||||
VERSION=1
|
VERSION=1
|
||||||
WEB_URL=http://localhost:5173
|
WEB_URL=http://localhost:5173
|
||||||
IS_PRODUCTION=false
|
IS_PRODUCTION=1
|
||||||
OBJ_LIST_LIMIT=20
|
OBJ_LIST_LIMIT=20
|
||||||
|
|
||||||
|
FF_SYNC_ENABLED=0
|
||||||
|
FF_LOGIN_ENABLED=0
|
||||||
|
FF_NEW_PIN_PREVIEW=0
|
||||||
|
FF_REPORT_BUG=0
|
@ -42,10 +42,18 @@ interface SettingsInterfaceConfig {
|
|||||||
optionsDrawerOpen?: boolean;
|
optionsDrawerOpen?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface FeatureFlag {
|
||||||
|
SYNC_ENABLED: boolean;
|
||||||
|
LOGIN_ENABLED: boolean;
|
||||||
|
NEW_PIN_PREVIEW: boolean;
|
||||||
|
REPORT_BUG: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
interface EnvironmentConfig {
|
interface EnvironmentConfig {
|
||||||
showAckMessage: boolean;
|
showAckMessage: boolean;
|
||||||
defaultServer: string;
|
defaultServer: string;
|
||||||
isProduction: boolean;
|
isProduction: boolean;
|
||||||
|
featureFlag: FeatureFlag;
|
||||||
settings: SettingsConfig;
|
settings: SettingsConfig;
|
||||||
objListLimit: number;
|
objListLimit: number;
|
||||||
}
|
}
|
||||||
@ -53,7 +61,13 @@ interface EnvironmentConfig {
|
|||||||
export const environmentConfig: EnvironmentConfig = {
|
export const environmentConfig: EnvironmentConfig = {
|
||||||
showAckMessage: false,
|
showAckMessage: false,
|
||||||
defaultServer: process.env.WEB_URL || 'https://pinmenote.com',
|
defaultServer: process.env.WEB_URL || 'https://pinmenote.com',
|
||||||
isProduction: process.env.IS_PRODUCTION === 'true',
|
isProduction: process.env.IS_PRODUCTION === '1',
|
||||||
|
featureFlag: {
|
||||||
|
SYNC_ENABLED: process.env.FF_SYNC_ENABLED === '1',
|
||||||
|
LOGIN_ENABLED: process.env.FF_LOGIN_ENABLED === '1',
|
||||||
|
NEW_PIN_PREVIEW: process.env.FF_NEW_PIN_PREVIEW === '1',
|
||||||
|
REPORT_BUG: process.env.FF_REPORT_BUG === '1'
|
||||||
|
},
|
||||||
settings: {
|
settings: {
|
||||||
version: parseInt(process.env.VERSION || '1'),
|
version: parseInt(process.env.VERSION || '1'),
|
||||||
screenshotFormat: 'png',
|
screenshotFormat: 'png',
|
||||||
@ -71,5 +85,5 @@ export const environmentConfig: EnvironmentConfig = {
|
|||||||
pageNote: false
|
pageNote: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
objListLimit: parseInt(process.env.OBJ_LIST_LIMIT || '100000')
|
objListLimit: parseInt(process.env.OBJ_LIST_LIMIT || '100')
|
||||||
};
|
};
|
||||||
|
@ -19,12 +19,24 @@ import { BrowserApi } from '@pinmenote/browser-api';
|
|||||||
import BugReportIcon from '@mui/icons-material/BugReport';
|
import BugReportIcon from '@mui/icons-material/BugReport';
|
||||||
import Button from '@mui/material/Button';
|
import Button from '@mui/material/Button';
|
||||||
import IconButton from '@mui/material/IconButton';
|
import IconButton from '@mui/material/IconButton';
|
||||||
|
import { environmentConfig } from '../../../common/environment';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
openBugReport?: () => void;
|
openBugReport?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const MainFooterButton: FunctionComponent<Props> = (props) => {
|
export const MainFooterButton: FunctionComponent<Props> = (props) => {
|
||||||
|
const reportBugIcon = environmentConfig.featureFlag.REPORT_BUG ? (
|
||||||
|
<IconButton
|
||||||
|
style={{ marginBottom: 10, marginRight: 5, border: '1px solid #333333' }}
|
||||||
|
title="Report bug"
|
||||||
|
onClick={() => (props.openBugReport ? props.openBugReport() : '')}
|
||||||
|
>
|
||||||
|
<BugReportIcon />
|
||||||
|
</IconButton>
|
||||||
|
) : (
|
||||||
|
''
|
||||||
|
);
|
||||||
return (
|
return (
|
||||||
<div style={{ position: 'absolute', bottom: 0, width: 300, paddingTop: 5, backgroundColor: '#ffffff' }}>
|
<div style={{ position: 'absolute', bottom: 0, width: 300, paddingTop: 5, backgroundColor: '#ffffff' }}>
|
||||||
<div
|
<div
|
||||||
@ -35,13 +47,7 @@ export const MainFooterButton: FunctionComponent<Props> = (props) => {
|
|||||||
justifyContent: 'center'
|
justifyContent: 'center'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconButton
|
{reportBugIcon}
|
||||||
style={{ marginBottom: 10, marginRight: 5, border: '1px solid #333333' }}
|
|
||||||
title="Report bug"
|
|
||||||
onClick={() => (props.openBugReport ? props.openBugReport() : '')}
|
|
||||||
>
|
|
||||||
<BugReportIcon />
|
|
||||||
</IconButton>
|
|
||||||
<Button
|
<Button
|
||||||
sx={{ width: '100%' }}
|
sx={{ width: '100%' }}
|
||||||
style={{ marginBottom: 10 }}
|
style={{ marginBottom: 10 }}
|
||||||
|
@ -80,10 +80,8 @@ const ExtensionPopupApp: React.FC = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Show logs panel only on development environment
|
// Show logs panel only on development environment
|
||||||
let logsTab: any = '';
|
const logsTab = environmentConfig.isProduction ? '' : <Tab icon={<LogoDevIcon />} tabIndex={3} />;
|
||||||
if (!environmentConfig.isProduction) {
|
const loginTab = environmentConfig.featureFlag.LOGIN_ENABLED ? <Tab icon={<PersonIcon />} /> : '';
|
||||||
logsTab = <Tab icon={<LogoDevIcon />} tabIndex={3} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
const panel = getCurrentPanel(selectedPanel);
|
const panel = getCurrentPanel(selectedPanel);
|
||||||
|
|
||||||
@ -103,7 +101,7 @@ const ExtensionPopupApp: React.FC = () => {
|
|||||||
<Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
|
<Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
|
||||||
<Tabs value={selectedPanel} onChange={handleChange}>
|
<Tabs value={selectedPanel} onChange={handleChange}>
|
||||||
<Tab icon={<PushPinIcon />} />
|
<Tab icon={<PushPinIcon />} />
|
||||||
<Tab icon={<PersonIcon />} />
|
{loginTab}
|
||||||
{logsTab}
|
{logsTab}
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</Box>
|
</Box>
|
||||||
|
@ -32,6 +32,7 @@ import { SyncObjectStatus } from '../../../common/model/sync.model';
|
|||||||
import { fnConsoleLog } from '../../../common/fn/fn-console';
|
import { fnConsoleLog } from '../../../common/fn/fn-console';
|
||||||
import AddIcon from '@mui/icons-material/Add';
|
import AddIcon from '@mui/icons-material/Add';
|
||||||
import Button from '@mui/material/Button';
|
import Button from '@mui/material/Button';
|
||||||
|
import { environmentConfig } from '../../../common/environment';
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
obj?: ObjDto<ObjPageDto>;
|
obj?: ObjDto<ObjPageDto>;
|
||||||
@ -80,6 +81,21 @@ export const HtmlPreviewHeaderComponent: FunctionComponent<Props> = (props) => {
|
|||||||
const handleNewPin = () => {
|
const handleNewPin = () => {
|
||||||
alert('NEW PIN');
|
alert('NEW PIN');
|
||||||
};
|
};
|
||||||
|
const syncIcon = environmentConfig.featureFlag.SYNC_ENABLED ? (
|
||||||
|
<IconButton onClick={handleManualSync}>
|
||||||
|
<CloudSyncIcon />
|
||||||
|
</IconButton>
|
||||||
|
) : (
|
||||||
|
''
|
||||||
|
);
|
||||||
|
|
||||||
|
const newPinIcon = environmentConfig.featureFlag.NEW_PIN_PREVIEW ? (
|
||||||
|
<Button sx={{ width: '100%' }} variant="outlined" onClick={handleNewPin}>
|
||||||
|
<AddIcon /> Pin
|
||||||
|
</Button>
|
||||||
|
) : (
|
||||||
|
''
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ backgroundColor: '#ffffff', width: '100%', display: 'flex', justifyContent: 'space-between' }}>
|
<div style={{ backgroundColor: '#ffffff', width: '100%', display: 'flex', justifyContent: 'space-between' }}>
|
||||||
@ -88,15 +104,11 @@ export const HtmlPreviewHeaderComponent: FunctionComponent<Props> = (props) => {
|
|||||||
<div ref={urlRef}></div>
|
<div ref={urlRef}></div>
|
||||||
</div>
|
</div>
|
||||||
<div style={{ display: 'flex', alignItems: 'center' }}>
|
<div style={{ display: 'flex', alignItems: 'center' }}>
|
||||||
<Button sx={{ width: '100%', display: 'none' }} variant="outlined" onClick={handleNewPin}>
|
{newPinIcon}
|
||||||
<AddIcon /> Pin
|
|
||||||
</Button>
|
|
||||||
<div style={{ display: props.isLoading ? 'flex' : 'none' }}>
|
<div style={{ display: props.isLoading ? 'flex' : 'none' }}>
|
||||||
<CircularProgress />
|
<CircularProgress />
|
||||||
</div>
|
</div>
|
||||||
<IconButton onClick={handleManualSync}>
|
{syncIcon}
|
||||||
<CloudSyncIcon />
|
|
||||||
</IconButton>
|
|
||||||
<IconButton onClick={props.handleDownload}>
|
<IconButton onClick={props.handleDownload}>
|
||||||
<DownloadIcon />
|
<DownloadIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
@ -43,6 +43,7 @@ import { SyncManualOutgoingCommand } from './command/sync/manual/sync-manual-out
|
|||||||
import { SyncServerIncomingCommand } from './command/sync/sync-server-incoming.command';
|
import { SyncServerIncomingCommand } from './command/sync/sync-server-incoming.command';
|
||||||
import { SyncGetProgressCommand } from './command/sync/progress/sync-get-progress.command';
|
import { SyncGetProgressCommand } from './command/sync/progress/sync-get-progress.command';
|
||||||
import { SyncTxHelper } from './command/sync/sync-tx.helper';
|
import { SyncTxHelper } from './command/sync/sync-tx.helper';
|
||||||
|
import { environmentConfig } from '../common/environment';
|
||||||
|
|
||||||
const handleMessage = async (
|
const handleMessage = async (
|
||||||
msg: BusMessage<any>,
|
msg: BusMessage<any>,
|
||||||
@ -131,14 +132,13 @@ const handleMessage = async (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Sync command
|
// Sync command
|
||||||
if (
|
const skipMessage = [
|
||||||
![
|
|
||||||
PageComputeMessage.CONTENT_FETCH_CSS,
|
PageComputeMessage.CONTENT_FETCH_CSS,
|
||||||
PageComputeMessage.CONTENT_FETCH_IMAGE,
|
PageComputeMessage.CONTENT_FETCH_IMAGE,
|
||||||
BusMessageType.OPTIONS_SYNC_OUTGOING_OBJECT,
|
BusMessageType.OPTIONS_SYNC_OUTGOING_OBJECT,
|
||||||
BusMessageType.OPTIONS_SYNC_INCOMING_CHANGES
|
BusMessageType.OPTIONS_SYNC_INCOMING_CHANGES
|
||||||
].includes(msg.type as any)
|
].includes(msg.type as any);
|
||||||
) {
|
if (!skipMessage && environmentConfig.featureFlag.SYNC_ENABLED) {
|
||||||
await new SyncServerCommand().execute();
|
await new SyncServerCommand().execute();
|
||||||
}
|
}
|
||||||
await TaskExecutor.dequeue();
|
await TaskExecutor.dequeue();
|
||||||
|
Loading…
Reference in New Issue
Block a user