Skip to content

Commit

Permalink
Check if page is null
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox committed Jul 12, 2024
1 parent e9142f4 commit ce52bf0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/iobroker.vis-2/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ async function buildHtmlPages(forceBuild) {
} catch (err) {
// ignore
}
if (typeof uploadedIndexHtml === 'object') {
if (uploadedIndexHtml && typeof uploadedIndexHtml === 'object') {
uploadedIndexHtml = uploadedIndexHtml.file;
}
uploadedIndexHtml = uploadedIndexHtml ? uploadedIndexHtml.toString('utf8') : uploadedIndexHtml;
Expand All @@ -870,7 +870,7 @@ async function buildHtmlPages(forceBuild) {
} catch (err) {
// ignore
}
if (typeof uploadedEditHtml === 'object') {
if (uploadedEditHtml && typeof uploadedEditHtml === 'object') {
uploadedEditHtml = uploadedEditHtml.file;
}
uploadedEditHtml = uploadedEditHtml ? uploadedEditHtml.toString('utf8') : uploadedEditHtml;
Expand Down
24 changes: 19 additions & 5 deletions packages/iobroker.vis-2/src/src/Toolbar/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ import {
Select,
Switch,
TextField,
FormHelperText,
FormHelperText, IconButton,
} from '@mui/material';

import { Save as SaveIcon } from '@mui/icons-material';
import { ContentCopy, Save as SaveIcon } from '@mui/icons-material';

import type { LegacyConnection } from '@iobroker/adapter-react-v5';
import { I18n } from '@iobroker/adapter-react-v5';
import { I18n, Utils, type LegacyConnection } from '@iobroker/adapter-react-v5';

import type Editor from '@/Editor';
import { store } from '@/Store';
import { deepClone } from '@/Utils/utils';
import type { ProjectSettings } from '@iobroker/types-vis-2';
import commonStyles from '@/Utils/styles';
import IODialog from '../Components/IODialog';

const styles: { dialog: React.CSSProperties; field: React.CSSProperties } = {
Expand Down Expand Up @@ -170,7 +170,21 @@ const Settings: React.FC<SettingsProps> = props => {
{
type: 'raw',
Node: <>
<TextField variant="standard" label={I18n.t('Browser instance ID')} value={instance || ''} onChange={e => setInstance(e.target.value)} />
<TextField
variant="standard"
label={I18n.t('Browser instance ID')}
value={instance || ''}
onChange={e => setInstance(e.target.value)}
InputProps={{
endAdornment: instance ? <IconButton
size="small"
onClick={() => Utils.copyToClipboard(instance)}
>
<ContentCopy />
</IconButton> : null,
sx: { ...commonStyles.clearPadding, ...commonStyles.fieldContent },
}}
/>
<Button
variant="contained"
color="grey"
Expand Down
2 changes: 1 addition & 1 deletion packages/iobroker.vis-2/src/src/version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "2.10.2"
"version": "2.10.3"
}

0 comments on commit ce52bf0

Please sign in to comment.