Skip to content

Commit

Permalink
Fixed GUI build
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox committed May 29, 2024
1 parent 3366e50 commit 1c2ad00
Show file tree
Hide file tree
Showing 22 changed files with 52 additions and 78 deletions.
3 changes: 2 additions & 1 deletion packages/admin/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"not op_mini all"
],
"dependencies": {
"@iobroker/json-config": "file:../../jsonConfig"
"@iobroker/json-config": "file:../../jsonConfig",
"@iobroker/dm-gui-components": "file:../../dm-gui-components"
},
"proxy": "http://127.0.0.1:8081",
"plugins": [
Expand Down
4 changes: 2 additions & 2 deletions packages/admin/src/src/Utils.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { I18n } from '@iobroker/adapter-react-v5';
import semver from 'semver';
import { type Translate } from '@iobroker/adapter-react-v5';

const ANSI_RESET = 0;
const ANSI_RESET_COLOR = 39;
Expand Down Expand Up @@ -147,7 +147,7 @@ class Utils {
* @param seconds
* @param t i18n.t function
*/
static formatSeconds(seconds: number, t: typeof I18n.t): string {
static formatSeconds(seconds: number, t: Translate): string {
const days = Math.floor(seconds / (3600 * 24));
let minutesRes: string;
let secondsRes: string;
Expand Down
4 changes: 2 additions & 2 deletions packages/admin/src/src/components/Adapters/AdapterRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import {
MonetizationOn,
} from '@mui/icons-material';

import { i18n, type IobTheme, Utils } from '@iobroker/adapter-react-v5';
import { type Translate, type IobTheme, Utils } from '@iobroker/adapter-react-v5';

import IsVisible from '../IsVisible';
import MaterialDynamicIcon from '../../helpers/MaterialDynamicIcon';
Expand Down Expand Up @@ -187,7 +187,7 @@ interface AdapterRowProps {
connectionType: string;
openInstallVersionDialog: () => void;
dataSource: string;
t: typeof i18n.t;
t: Translate;
installedFrom: string;
sentry: boolean;
allowAdapterInstall: boolean;
Expand Down
4 changes: 2 additions & 2 deletions packages/admin/src/src/components/Adapters/AdapterTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
} from '@mui/icons-material';
import { amber } from '@mui/material/colors';

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

import Link from '@mui/material/Link';
import sentryIcon from '../../assets/sentry.svg';
Expand Down Expand Up @@ -282,7 +282,7 @@ interface AdapterTileProps {
connectionType: string;
openInstallVersionDialog: () => void;
dataSource: string;
t: typeof i18n.t;
t: Translate;
installedFrom: string;
sentry: boolean;
allowAdapterInstall: boolean;
Expand Down
16 changes: 15 additions & 1 deletion packages/admin/src/src/components/Hosts/HostGeneric.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import BaseSettingsDialog from '@/dialogs/BaseSettingsDialog';
import BasicUtils from '../../Utils';
import HostEdit from './HostEdit';
import CustomModal from '../CustomModal';
import { toggleClassName, arrayLogLevel } from './HostUtils';

export const boxShadow = '0 2px 2px 0 rgba(0, 0, 0, .14),0 3px 1px -2px rgba(0, 0, 0, .12),0 1px 5px 0 rgba(0, 0, 0, .2)';
export const boxShadowHover = '0 8px 17px 0 rgba(0, 0, 0, .2),0 6px 20px 0 rgba(0, 0, 0, .19)';
Expand Down Expand Up @@ -186,6 +185,21 @@ export const genericStyle = (theme: IobTheme): Record<string, any> => ({
},
});

const arrayLogLevel = ['silly', 'debug', 'info', 'warn', 'error'];

function toggleClassName(el: HTMLElement, name: string) {
const classNames = el.className.split(' ');
const pos = classNames.indexOf(name);
if (pos !== -1) {
classNames.splice(pos, 1);
el.className = classNames.join(' ');
}
classNames.push(name);
// el.className = classNames.join(' ');
setTimeout(_classNames => (el.className = _classNames), 100, classNames.join(' '));
}


function getLogLevelIcon(level: ioBroker.LogLevel | ''): React.JSX.Element | null {
if (level === 'debug') {
return <BugReportIcon />;
Expand Down
47 changes: 0 additions & 47 deletions packages/admin/src/src/components/Hosts/HostUtils.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion packages/admin/src/src/components/IsVisible.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import type React from 'react';

function getAttr(obj: Record<any, any>, attr: string | string[]): boolean {
if (!obj) {
Expand Down
5 changes: 4 additions & 1 deletion packages/admin/src/src/components/Object/ObjectChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ import {
} from 'echarts/components';
import { SVGRenderer } from 'echarts/renderers';

import { type AdminConnection, Utils, withWidth, type IobTheme } from '@iobroker/adapter-react-v5';
import {
type AdminConnection, Utils,
withWidth, type IobTheme,
} from '@iobroker/adapter-react-v5';

// icons
import { FaChartLine as SplitLineIcon } from 'react-icons/fa';
Expand Down
2 changes: 1 addition & 1 deletion packages/admin/src/src/components/ObjectBrowser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ import {
IconState,
withWidth,
Connection,
Router,
type Router,
type IobTheme,
type ThemeType,
type ThemeName,
Expand Down
4 changes: 2 additions & 2 deletions packages/admin/src/src/dialogs/BaseSettingsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import {
} from '@mui/icons-material';

import {
AdminConnection,
type AdminConnection,
Confirm as ConfirmDialog,
withWidth,
type IobTheme, type Translate
type IobTheme, type Translate,
} from '@iobroker/adapter-react-v5';

import BaseSettingsSystem, { type SystemSettings } from '../components/BaseSettings/BaseSettingsSystem';
Expand Down
2 changes: 1 addition & 1 deletion packages/admin/src/src/dialogs/CommandDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ interface CommandDialogProps {
performed: () => void;
inBackground: boolean;
commandError: boolean;
socket: AdminConnection
socket: AdminConnection;
host: string;
classes: Record<string, string>;
}
Expand Down
1 change: 1 addition & 0 deletions packages/admin/src/src/dialogs/FileEditOfAccessControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ const FileEditOfAccessControl2: React.FC<FileEditOfAccessControl2Props> = ({
return <CustomModal
titleButtonApply="apply"
overflowHidden
disableApply={disabledButton}
progress={progress}
onClose={onClose}
onApply={() => {
Expand Down
3 changes: 2 additions & 1 deletion packages/admin/src/src/dialogs/NodeUpdateDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import {
Dialog, DialogActions, DialogContent,
DialogTitle, Typography,
} from '@mui/material';
import { AdminConnection, I18n } from '@iobroker/adapter-react-v5';
import { Close as CloseIcon, Refresh as RefreshIcon } from '@mui/icons-material';

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

interface NodeUpdateDialogProps {
/** Called when user closes dialog */
onClose: () => void;
Expand Down
3 changes: 1 addition & 2 deletions packages/admin/src/src/dialogs/ObjectEditOfAccessControl.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,7 @@ const ObjectEditOfAccessControl = ({
icon: obj.common?.icon,
color: obj.common?.color,
});
} else
if (key.startsWith('system.user.') && obj?.type === 'user') {
} else if (key.startsWith('system.user.') && obj?.type === 'user') {
users.push({
name: Utils.getObjectNameFromObj(obj, lang).replace('system.user.', ''),
value: key,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ import {
InputLabel,
} from '@mui/material';

import { I18n, withWidth, type IobTheme, type Translate } from '@iobroker/adapter-react-v5';
import {
I18n, withWidth,
type IobTheme, type Translate,
} from '@iobroker/adapter-react-v5';

import { type ioBrokerObject } from '@/types';
import Utils from '@/Utils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
type Translate,
type IobTheme,
} from '@iobroker/adapter-react-v5';
import { type AdminGuiConfig , type ioBrokerObject } from '@/types';
import { type AdminGuiConfig, type ioBrokerObject } from '@/types';

import Utils from '../../Utils';
import countries from '../../assets/json/countries.json';
Expand Down
3 changes: 1 addition & 2 deletions packages/admin/src/src/tabs/Files.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ class Files extends Component {
if ((data.owner || data.ownerGroup) && data.permissions) {
await this.props.socket.chownFile(adapter, file, { owner: data.owner, ownerGroup: data.ownerGroup });
result = await this.props.socket.chmodFile(adapter, file, { mode: data.permissions });
} else
if (data.permissions) {
} else if (data.permissions) {
result = await this.props.socket.chmodFile(adapter, file, { mode: data.permissions });
} else if (data.owner || data.ownerGroup) {
result = await this.props.socket.chownFile(adapter, file, { owner: data.owner, ownerGroup: data.ownerGroup });
Expand Down
8 changes: 4 additions & 4 deletions packages/admin/src/src/tabs/Intro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import {
} from '@mui/icons-material';

import {
type AdminConnection, i18n, Utils as UtilsCommon,
type IobTheme,
type AdminConnection, Utils as UtilsCommon,
type IobTheme, type Translate,
} from '@iobroker/adapter-react-v5';

import type InstancesWorker from '@/Workers/InstancesWorker';
Expand Down Expand Up @@ -106,7 +106,7 @@ const formatInfo = {
interface IntroProps {
showAlert: (title: string, msg: string) => void;
socket: AdminConnection;
t: typeof i18n.t;
t: Translate;
lang: ioBroker.Languages;
instancesWorker: InstancesWorker;
hostsWorker: HostsWorker;
Expand Down Expand Up @@ -160,7 +160,7 @@ class Intro extends React.Component<IntroProps, IntroState> {

private deactivatedOriginal?: string[];

private readonly t: typeof i18n.t;
private readonly t: Translate;

private getDataTimeout?: ReturnType<typeof setTimeout>;

Expand Down
3 changes: 1 addition & 2 deletions packages/admin/src/src/tabs/Logs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,7 @@ function padding3(num) {
let s = num.toString();
if (s.length < 2) {
s = `00${s}`;
} else
if (s.length < 3) {
} else if (s.length < 3) {
s = `0${s}`;
}
return s;
Expand Down
3 changes: 3 additions & 0 deletions packages/jsonConfig/after_build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const fs = require('node:fs');

fs.copyFileSync('./src/types.d.ts', './build/types.d.ts');
5 changes: 2 additions & 3 deletions packages/jsonConfig/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "./build/index.js",
"types": "./build/index.d.ts",
"scripts": {
"build": "tsc && tsc-alias ",
"build": "tsc && tsc-alias && node after_build",
"clean": "rimraf build",
"prepublishOnly": "npm run build",
"build:ts": "tsc -p tsconfig.json"
Expand All @@ -16,8 +16,7 @@
"dependencies": {
"@iobroker/adapter-react-v5": "^5.0.1",
"crypto-js": "^4.2.0",
"react-ace": "^11.0.1",
"@iobroker/dm-gui-components": "6.17.14"
"react-ace": "^11.0.1"
},
"files": [
"build/",
Expand Down
1 change: 0 additions & 1 deletion packages/jsonConfig/src/JsonConfigComponent/ConfigTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { Tabs, Tab } from '@mui/material';
import type { ConfigItemTabs } from '#JC/types';
import ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';
import ConfigPanel from './ConfigPanel';
import {bool} from "prop-types";

const styles: Record<string, any> = {
tabs: {
Expand Down

0 comments on commit 1c2ad00

Please sign in to comment.