mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-19 01:06:36 +00:00
Use Dictionary type from lodash
Change-type: patch
This commit is contained in:
parent
bd35c89c04
commit
2671c83337
@ -23,7 +23,6 @@ import { Badge, Checkbox, Modal } from 'rendition';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { version } from '../../../../../package.json';
|
||||
import { Dictionary } from '../../../../shared/utils';
|
||||
import * as settings from '../../models/settings';
|
||||
import { store } from '../../models/store';
|
||||
import * as analytics from '../../modules/analytics';
|
||||
@ -122,8 +121,8 @@ interface SettingsModalProps {
|
||||
export const SettingsModal: any = styled(
|
||||
({ toggleModal }: SettingsModalProps) => {
|
||||
const [currentSettings, setCurrentSettings]: [
|
||||
Dictionary<any>,
|
||||
React.Dispatch<React.SetStateAction<Dictionary<any>>>,
|
||||
_.Dictionary<any>,
|
||||
React.Dispatch<React.SetStateAction<_.Dictionary<any>>>,
|
||||
] = useState(settings.getAll());
|
||||
const [warning, setWarning]: [
|
||||
any,
|
||||
|
@ -19,12 +19,11 @@ import * as _ from 'lodash';
|
||||
|
||||
import * as packageJSON from '../../../../package.json';
|
||||
import * as errors from '../../../shared/errors';
|
||||
import { Dictionary } from '../../../shared/utils';
|
||||
import * as localSettings from './local-settings';
|
||||
|
||||
const debug = _debug('etcher:models:settings');
|
||||
|
||||
const DEFAULT_SETTINGS: Dictionary<any> = {
|
||||
const DEFAULT_SETTINGS: _.Dictionary<any> = {
|
||||
unsafeMode: false,
|
||||
errorReporting: true,
|
||||
unmountOnSuccess: true,
|
||||
@ -53,7 +52,7 @@ export async function reset(): Promise<void> {
|
||||
/**
|
||||
* @summary Extend the current settings
|
||||
*/
|
||||
export async function assign(value: Dictionary<any>): Promise<void> {
|
||||
export async function assign(value: _.Dictionary<any>): Promise<void> {
|
||||
debug('assign', value);
|
||||
if (_.isNil(value)) {
|
||||
throw errors.createError({
|
||||
|
@ -30,7 +30,7 @@ import * as settings from './settings';
|
||||
* @summary Verify and throw if any state fields are nil
|
||||
*/
|
||||
function verifyNoNilFields(
|
||||
object: utils.Dictionary<any>,
|
||||
object: _.Dictionary<any>,
|
||||
fields: string[],
|
||||
name: string,
|
||||
) {
|
||||
|
@ -26,7 +26,7 @@ import { promisify } from 'util';
|
||||
|
||||
import { sudo as catalinaSudo } from './catalina-sudo/sudo';
|
||||
import * as errors from './errors';
|
||||
import { Dictionary, tmpFileDisposer } from './utils';
|
||||
import { tmpFileDisposer } from './utils';
|
||||
|
||||
const execAsync = promisify(childProcess.exec);
|
||||
const execFileAsync = promisify(childProcess.execFile);
|
||||
@ -88,7 +88,7 @@ function setEnvVarCmd(value: any, name: string): string {
|
||||
export function createLaunchScript(
|
||||
command: string,
|
||||
argv: string[],
|
||||
environment: Dictionary<string>,
|
||||
environment: _.Dictionary<string>,
|
||||
): string {
|
||||
const isWindows = os.platform() === 'win32';
|
||||
const lines = [];
|
||||
@ -144,7 +144,7 @@ async function elevateScriptCatalina(
|
||||
export async function elevateCommand(
|
||||
command: string[],
|
||||
options: {
|
||||
environment: Dictionary<string | undefined>;
|
||||
environment: _.Dictionary<string | undefined>;
|
||||
applicationName: string;
|
||||
},
|
||||
): Promise<{ cancelled: boolean }> {
|
||||
|
@ -24,10 +24,6 @@ import * as errors from './errors';
|
||||
|
||||
const getAsync = promisify(request.get);
|
||||
|
||||
export interface Dictionary<T> {
|
||||
[key: string]: T;
|
||||
}
|
||||
|
||||
export function isValidPercentage(percentage: any): boolean {
|
||||
return _.every([_.isNumber(percentage), percentage >= 0, percentage <= 100]);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user