Prettier support

This commit is contained in:
2021-03-10 21:14:32 -06:00
parent c51b527707
commit 0924490a6f
99 changed files with 5504 additions and 3979 deletions

View File

@@ -1,71 +1,66 @@
import {createReducer} from '@reduxjs/toolkit';
import { createReducer } from '@reduxjs/toolkit';
import {
DISPLAY_CONFIRM_YES_NO,
NOTIFY_APPLICATION_BUSY,
notifyRebootRequired,
SET_DISPLAY_SELECT_APPPLATFORM,
setAllowMount,
setApplicationReady,
setLinuxAppPlatform,
SET_DISPLAY_SELECT_APPPLATFORM
} from '../actions/common_actions';
export const createCommonReducer = (platformInfo, version) => {
return createReducer({
AllowMount: false,
AppBusy: false,
AppBusyTransparent: false,
AppPlatform: platformInfo.AppPlatform,
AppReady: false,
DisplayConfirmYesNo: false,
ConfirmTitle: null,
DisplaySelectAppPlatform: false,
Platform: platformInfo.Platform,
RebootRequired: false,
Version: version,
}, {
[DISPLAY_CONFIRM_YES_NO]: (state, action) => {
return {
...state,
DisplayConfirmYesNo: action.payload.show,
ConfirmTitle: action.payload.show ? action.payload.title : null,
}
return createReducer(
{
AllowMount: false,
AppBusy: false,
AppBusyTransparent: false,
AppPlatform: platformInfo.AppPlatform,
AppReady: false,
DisplayConfirmYesNo: false,
ConfirmTitle: null,
DisplaySelectAppPlatform: false,
Platform: platformInfo.Platform,
RebootRequired: false,
Version: version,
},
[SET_DISPLAY_SELECT_APPPLATFORM]: (state, action) => {
return {
...state,
DisplaySelectAppPlatform: action.payload,
}
},
[setAllowMount]: (state, action) => {
return {
...state,
AllowMount: action.payload,
}
},
[setApplicationReady]: (state, action) => {
return {
...state,
AppReady: action.payload,
};
},
[setLinuxAppPlatform]: (state, action) => {
return {
...state,
AppPlatform: action.payload,
}
},
[NOTIFY_APPLICATION_BUSY]: (state, action) => {
return {
...state,
AppBusy: action.payload.busy,
AppBusyTransparent: action.payload.busy && action.payload.transparent,
};
},
[notifyRebootRequired]: (state, action) => {
return {
...state,
RebootRequired: action.payload,
};
},
});
{
[DISPLAY_CONFIRM_YES_NO]: (state, action) => {
return {
...state,
DisplayConfirmYesNo: action.payload.show,
ConfirmTitle: action.payload.show ? action.payload.title : null,
};
},
[SET_DISPLAY_SELECT_APPPLATFORM]: (state, action) => {
return { ...state, DisplaySelectAppPlatform: action.payload };
},
[setAllowMount]: (state, action) => {
return { ...state, AllowMount: action.payload };
},
[setApplicationReady]: (state, action) => {
return {
...state,
AppReady: action.payload,
};
},
[setLinuxAppPlatform]: (state, action) => {
return { ...state, AppPlatform: action.payload };
},
[NOTIFY_APPLICATION_BUSY]: (state, action) => {
return {
...state,
AppBusy: action.payload.busy,
AppBusyTransparent: action.payload.busy && action.payload.transparent,
};
},
[notifyRebootRequired]: (state, action) => {
return {
...state,
RebootRequired: action.payload,
};
},
}
);
};

View File

@@ -1,9 +1,10 @@
import {createReducer} from '@reduxjs/toolkit';
import { createReducer } from '@reduxjs/toolkit';
import {
setAllowDownload,
SET_DOWNLOAD_BEGIN,
setAllowDownload,
setDownloadEnd,
setDownloadProgress
setDownloadProgress,
} from '../actions/download_actions';
const defaultDownloadState = {
@@ -17,37 +18,37 @@ const defaultDownloadState = {
DownloadType: null,
};
export const downloadReducer = createReducer({
...defaultDownloadState,
AllowDownload: false,
}, {
[setAllowDownload]: (state, action) => {
return {
...state,
AllowDownload: action.payload,
};
export const downloadReducer = createReducer(
{
...defaultDownloadState,
AllowDownload: false,
},
[SET_DOWNLOAD_BEGIN]: (state, action) => {
return {
...state,
...defaultDownloadState,
DownloadActive: true,
DownloadName: action.payload.name,
DownloadType: action.payload.type,
DownloadURL: action.payload.url,
}
},
[setDownloadEnd]: (state, action) => {
return {
...state,
...defaultDownloadState,
DownloadResult: action.payload,
};
},
[setDownloadProgress]: (state, action) => {
return {
...state,
DownloadProgress: action.payload,
}
{
[setAllowDownload]: (state, action) => {
return {
...state,
AllowDownload: action.payload,
};
},
[SET_DOWNLOAD_BEGIN]: (state, action) => {
return {
...state,
...defaultDownloadState,
DownloadActive: true,
DownloadName: action.payload.name,
DownloadType: action.payload.type,
DownloadURL: action.payload.url,
};
},
[setDownloadEnd]: (state, action) => {
return {
...state,
...defaultDownloadState,
DownloadResult: action.payload,
};
},
[setDownloadProgress]: (state, action) => {
return { ...state, DownloadProgress: action.payload };
},
}
});
);

View File

@@ -1,52 +1,53 @@
import {createReducer} from '@reduxjs/toolkit';
import { createReducer } from '@reduxjs/toolkit';
import {
CLEAR_ERROR,
CLEAR_INFO,
SET_ERROR_INFO,
SET_INFO
SET_INFO,
} from '../actions/error_actions';
export const errorReducer = createReducer({
DisplayError: false,
DisplayInfo: false,
ErrorCritical: false,
ErrorStack: [],
InfoStack: [],
}, {
[CLEAR_ERROR]: state => {
const errorStack = (state.ErrorStack.length > 0) ? state.ErrorStack.slice(1) : [];
return {
...state,
DisplayError: (errorStack.length > 0),
ErrorStack: errorStack,
}
export const errorReducer = createReducer(
{
DisplayError: false,
DisplayInfo: false,
ErrorCritical: false,
ErrorStack: [],
InfoStack: [],
},
[CLEAR_INFO]: state => {
const infoStack = (state.InfoStack.length > 0) ? state.InfoStack.slice(1) : [];
return {
...state,
DisplayInfo: (infoStack.length > 0),
InfoStack: infoStack,
}
},
[SET_ERROR_INFO]: (state, action) => {
const errorStack = [action.payload.msg, ...state.ErrorStack];
return {
...state,
DisplayError: true,
ErrorCritical: state.ErrorCritical || action.payload.critical,
ErrorStack: errorStack,
}
},
[SET_INFO]: (state, action) => {
const infoStack = [{
title: action.payload.title,
message: action.payload.msg
}, ...state.InfoStack];
return {
...state,
DisplayInfo: true,
InfoStack: infoStack,
}
{
[CLEAR_ERROR]: (state) => {
const errorStack =
state.ErrorStack.length > 0 ? state.ErrorStack.slice(1) : [];
return {
...state,
DisplayError: errorStack.length > 0,
ErrorStack: errorStack,
};
},
[CLEAR_INFO]: (state) => {
const infoStack =
state.InfoStack.length > 0 ? state.InfoStack.slice(1) : [];
return {
...state,
DisplayInfo: infoStack.length > 0,
InfoStack: infoStack,
};
},
[SET_ERROR_INFO]: (state, action) => {
const errorStack = [action.payload.msg, ...state.ErrorStack];
return {
...state,
DisplayError: true,
ErrorCritical: state.ErrorCritical || action.payload.critical,
ErrorStack: errorStack,
};
},
[SET_INFO]: (state, action) => {
const infoStack = [
{ title: action.payload.title, message: action.payload.msg },
...state.InfoStack,
];
return { ...state, DisplayInfo: true, InfoStack: infoStack };
},
}
});
);

View File

@@ -1,60 +1,51 @@
import {createReducer} from '@reduxjs/toolkit';
import { createReducer } from '@reduxjs/toolkit';
import {
setAutoInstallRelease,
setDismissDependencies,
setInstallActive,
setInstallComplete,
setInstallTestActive,
setMissingDependencies
setMissingDependencies,
} from '../actions/install_actions';
export const installReducer = createReducer({
AutoInstallRelease: false,
DismissDependencies: false,
InstallActive: false,
InstallResult: null,
InstallTestActive: false,
InstallType: null,
MissingDependencies: [],
}, {
[setAutoInstallRelease]: (state, action) => {
return {
...state,
AutoInstallRelease: action.payload,
}
export const installReducer = createReducer(
{
AutoInstallRelease: false,
DismissDependencies: false,
InstallActive: false,
InstallResult: null,
InstallTestActive: false,
InstallType: null,
MissingDependencies: [],
},
[setDismissDependencies]: (state, action) => {
return {
...state,
DismissDependencies: action.payload,
}
},
[setInstallActive]: (state, action) => {
return {
...state,
InstallActive: true,
InstallResult: null,
InstallType: action.payload,
};
},
[setInstallComplete]: (state, action) => {
return {
...state,
InstallActive: false,
InstallResult: action.payload,
InstallType: null,
}
},
[setInstallTestActive]: (state, action) => {
return {
...state,
InstallTestActive: action.payload,
}
},
[setMissingDependencies]: (state, action) => {
return {
...state,
MissingDependencies: action.payload,
}
{
[setAutoInstallRelease]: (state, action) => {
return { ...state, AutoInstallRelease: action.payload };
},
[setDismissDependencies]: (state, action) => {
return { ...state, DismissDependencies: action.payload };
},
[setInstallActive]: (state, action) => {
return {
...state,
InstallActive: true,
InstallResult: null,
InstallType: action.payload,
};
},
[setInstallComplete]: (state, action) => {
return {
...state,
InstallActive: false,
InstallResult: action.payload,
InstallType: null,
};
},
[setInstallTestActive]: (state, action) => {
return { ...state, InstallTestActive: action.payload };
},
[setMissingDependencies]: (state, action) => {
return { ...state, MissingDependencies: action.payload };
},
}
});
);

View File

@@ -1,4 +1,4 @@
import {createReducer} from '@reduxjs/toolkit';
import { createReducer } from '@reduxjs/toolkit';
import * as Constants from '../../constants';
import {
@@ -12,49 +12,49 @@ import {
SET_MOUNT_STATE,
SET_MOUNTED,
SET_PROVIDER_STATE,
setBusy
setBusy,
} from '../actions/mount_actions';
export const createMountReducer = state => {
export const createMountReducer = (state) => {
let providerList = [
...Constants.PROVIDER_LIST,
...(state.RemoteMounts || []),
...(state.S3Mounts || []),
];
const providerState = providerList
.map(provider => {
return {
[provider]: {
AutoMount: false,
AutoRestart: false,
MountLocation: '',
}
}
})
.reduce((map, obj) => {
return {...map, ...obj}
});
const mountState = providerList
.map(provider => {
return {
[provider]: {
AllowMount: false,
DriveLetters: [],
Mounted: false,
}
}
})
.reduce((map, obj) => {
return {...map, ...obj}
});
const autoMountProcessed =
providerList.map(provider => {
return {[provider]: false,}
.map((provider) => {
return {
[provider]: {
AutoMount: false,
AutoRestart: false,
MountLocation: '',
},
};
})
.reduce((map, obj) => {
return {...map, ...obj}
return { ...map, ...obj };
});
const mountState = providerList
.map((provider) => {
return {
[provider]: {
AllowMount: false,
DriveLetters: [],
Mounted: false,
},
};
})
.reduce((map, obj) => {
return { ...map, ...obj };
});
const autoMountProcessed = providerList
.map((provider) => {
return { [provider]: false };
})
.reduce((map, obj) => {
return { ...map, ...obj };
});
return createReducer(
@@ -71,52 +71,56 @@ export const createMountReducer = state => {
},
{
[addRemoteMount2]: (state, action) => {
let mountState = {...state.MountState};
let mountState = { ...state.MountState };
mountState[action.payload] = {
AllowMount: false,
DriveLetters: [],
Mounted: false,
};
let providerState = {...state.ProviderState};
let providerState = { ...state.ProviderState };
providerState[action.payload] = {
AutoMount: false,
AutoRestart: false,
MountLocation: '',
};
let autoMountProcessed = {...state.AutoMountProcessed};
let autoMountProcessed = { ...state.AutoMountProcessed };
autoMountProcessed[action.payload] = true;
return {
...state, AutoMountProcessed: autoMountProcessed,
MountState: mountState, ProviderState: providerState,
...state,
AutoMountProcessed: autoMountProcessed,
MountState: mountState,
ProviderState: providerState,
RemoteMounts: [...state.RemoteMounts, action.payload],
}
};
},
[addS3Mount2]: (state, action) => {
let mountState = {...state.MountState};
let mountState = { ...state.MountState };
mountState[action.payload] = {
AllowMount: false,
DriveLetters: [],
Mounted: false,
};
let providerState = {...state.ProviderState};
let providerState = { ...state.ProviderState };
providerState[action.payload] = {
AutoMount: false,
AutoRestart: false,
MountLocation: '',
};
let autoMountProcessed = {...state.AutoMountProcessed};
let autoMountProcessed = { ...state.AutoMountProcessed };
autoMountProcessed[action.payload] = true;
return {
...state, AutoMountProcessed: autoMountProcessed,
MountState: mountState, ProviderState: providerState,
...state,
AutoMountProcessed: autoMountProcessed,
MountState: mountState,
ProviderState: providerState,
S3Mounts: [...state.S3Mounts, action.payload],
}
};
},
[DISPLAY_CONFIGURATION]: (state, action) => {
return {
@@ -127,19 +131,19 @@ export const createMountReducer = state => {
};
},
[removeMount3]: (state, action) => {
let mountState = {...state.MountState};
let mountState = { ...state.MountState };
delete mountState[action.payload];
let providerState = {...state.ProviderState};
let providerState = { ...state.ProviderState };
delete providerState[action.payload];
let autoMountProcessed = {...state.AutoMountProcessed};
let autoMountProcessed = { ...state.AutoMountProcessed };
delete autoMountProcessed[action.payload];
const remoteMounts =
state.RemoteMounts.filter(i => i !== action.payload);
const s3Mounts =
state.S3Mounts.filter(i => i !== action.payload);
const remoteMounts = state.RemoteMounts.filter(
(i) => i !== action.payload
);
const s3Mounts = state.S3Mounts.filter((i) => i !== action.payload);
return {
...state,
AutoMountProcessed: autoMountProcessed,
@@ -150,7 +154,7 @@ export const createMountReducer = state => {
};
},
[RESET_MOUNTS_STATE]: (state, action) => {
return {...state, MountsBusy: false, MountState: mountState,}
return { ...state, MountsBusy: false, MountState: mountState };
},
[SET_AUTO_MOUNT_PROCESSED]: (state, action) => {
return {
@@ -158,7 +162,7 @@ export const createMountReducer = state => {
AutoMountProcessed: {
...state.AutoMountProcessed,
[action.payload.provider]: action.payload.processed,
}
},
};
},
[SET_ALLOW_MOUNT]: (state, action) => {
@@ -169,15 +173,13 @@ export const createMountReducer = state => {
[action.payload.provider]: {
...state.MountState[action.payload.provider],
AllowMount: action.payload.allow,
}
}
},
},
};
},
[setBusy]:
(state,
action) => {
return {...state, MountsBusy: action.payload};
},
[setBusy]: (state, action) => {
return { ...state, MountsBusy: action.payload };
},
[SET_MOUNT_STATE]: (state, action) => {
return {
...state,
@@ -185,9 +187,9 @@ export const createMountReducer = state => {
...state.MountState,
[action.payload.provider]: {
...state.MountState[action.payload.provider],
...action.payload.state
...action.payload.state,
},
}
},
};
},
[SET_MOUNTED]: (state, action) => {
@@ -198,8 +200,8 @@ export const createMountReducer = state => {
[action.payload.provider]: {
...state.MountState[action.payload.provider],
Mounted: action.payload.mounted,
}
}
},
},
};
},
[SET_PROVIDER_STATE]: (state, action) => {
@@ -209,10 +211,11 @@ export const createMountReducer = state => {
...state.ProviderState,
[action.payload.provider]: {
...state.ProviderState[action.payload.provider],
...action.payload.state
...action.payload.state,
},
}
},
};
}
});
},
}
);
};

View File

@@ -1,13 +1,16 @@
import {createReducer} from '@reduxjs/toolkit';
import {displayPinnedManager} from '../actions/pinned_manager_actions';
import { createReducer } from '@reduxjs/toolkit';
import { displayPinnedManager } from '../actions/pinned_manager_actions';
export const pinnedManagerReducer = createReducer({
DisplayPinnedManager: false,
}, {
[displayPinnedManager]: (state, action) => {
return {
...state,
DisplayPinnedManager: action.payload,
};
export const pinnedManagerReducer = createReducer(
{
DisplayPinnedManager: false,
},
});
{
[displayPinnedManager]: (state, action) => {
return {
...state,
DisplayPinnedManager: action.payload,
};
},
}
);

View File

@@ -1,11 +1,10 @@
import {createReducer} from '@reduxjs/toolkit';
import * as Actions from '../actions/release_version_actions';
import * as Constants from '../../constants';
import { createReducer } from '@reduxjs/toolkit';
const versionLookup = Constants.RELEASE_TYPES.map(k=> {
return {
[k]: ['unavailable']
};
import * as Constants from '../../constants';
import * as Actions from '../actions/release_version_actions';
const versionLookup = Constants.RELEASE_TYPES.map((k) => {
return { [k]: ['unavailable'] };
}).reduce((map, obj) => {
return {
...map,
@@ -13,95 +12,95 @@ const versionLookup = Constants.RELEASE_TYPES.map(k=> {
};
});
export const releaseVersionReducer = createReducer({
AllowDismissDependencies: false,
DismissNewReleasesAvailable: true,
InstalledVersion: 'none',
LocationsLookup: {},
NewReleasesAvailable: [],
NewReleasesAvailable2: [],
Release: Constants.DEFAULT_RELEASE,
ReleaseUpgradeAvailable: false,
UpgradeAvailable: false,
UpgradeData: null,
UpgradeVersion: null,
UpgradeDismissed: false,
Version: -1,
VersionLookup: versionLookup,
}, {
[Actions.CLEAR_UI_UPGRADE]: state => {
return {
...state,
UpgradeAvailable: false,
UpgradeDismissed: false,
UpgradeData: null,
UpgradeVersion: null,
};
export const releaseVersionReducer = createReducer(
{
AllowDismissDependencies: false,
DismissNewReleasesAvailable: true,
InstalledVersion: 'none',
LocationsLookup: {},
NewReleasesAvailable: [],
NewReleasesAvailable2: [],
Release: Constants.DEFAULT_RELEASE,
ReleaseUpgradeAvailable: false,
UpgradeAvailable: false,
UpgradeData: null,
UpgradeVersion: null,
UpgradeDismissed: false,
Version: -1,
VersionLookup: versionLookup,
},
[Actions.NOTIFY_ACTIVE_RELEASE]: (state, action) => {
return {
...state,
Release: action.payload.release,
Version: action.payload.version
};
},
[Actions.setAllowDismissDependencies]: (state, action) => {
return {
...state,
AllowDismissDependencies: action.payload,
};
},
[Actions.setDismissNewReleasesAvailable]: (state, action) => {
return {
...state,
DismissNewReleasesAvailable: action.payload,
};
},
[Actions.setDismissUIUpgrade]: (state, action) => {
return {
...state,
UpgradeDismissed: action.payload,
};
},
[Actions.setInstalledVersion]: (state, action) => {
return {
...state,
InstalledVersion: action.payload,
}
},
[Actions.setNewReleasesAvailable]: (state, action) => {
return {
...state,
DismissNewReleasesAvailable: false,
NewReleasesAvailable: action.payload,
};
},
[Actions.setNewReleasesAvailable2]: (state, action) => {
return {
...state,
NewReleasesAvailable2: action.payload,
};
},
[Actions.SET_RELEASE_DATA]: (state, action) => {
return {
...state,
LocationsLookup: action.payload.locations,
VersionLookup: action.payload.versions,
};
},
[Actions.setReleaseUpgradeAvailable]: (state, action) => {
return {
...state,
ReleaseUpgradeAvailable: action.payload,
};
},
[Actions.SET_UI_UPGRADE_DATA]: (state, action) => {
return {
...state,
UpgradeAvailable: true,
UpgradeData: action.payload.upgrade_data,
UpgradeVersion: action.payload.version,
UpgradeDismissed: false,
};
{
[Actions.CLEAR_UI_UPGRADE]: (state) => {
return {
...state,
UpgradeAvailable: false,
UpgradeDismissed: false,
UpgradeData: null,
UpgradeVersion: null,
};
},
[Actions.NOTIFY_ACTIVE_RELEASE]: (state, action) => {
return {
...state,
Release: action.payload.release,
Version: action.payload.version,
};
},
[Actions.setAllowDismissDependencies]: (state, action) => {
return {
...state,
AllowDismissDependencies: action.payload,
};
},
[Actions.setDismissNewReleasesAvailable]: (state, action) => {
return {
...state,
DismissNewReleasesAvailable: action.payload,
};
},
[Actions.setDismissUIUpgrade]: (state, action) => {
return {
...state,
UpgradeDismissed: action.payload,
};
},
[Actions.setInstalledVersion]: (state, action) => {
return { ...state, InstalledVersion: action.payload };
},
[Actions.setNewReleasesAvailable]: (state, action) => {
return {
...state,
DismissNewReleasesAvailable: false,
NewReleasesAvailable: action.payload,
};
},
[Actions.setNewReleasesAvailable2]: (state, action) => {
return {
...state,
NewReleasesAvailable2: action.payload,
};
},
[Actions.SET_RELEASE_DATA]: (state, action) => {
return {
...state,
LocationsLookup: action.payload.locations,
VersionLookup: action.payload.versions,
};
},
[Actions.setReleaseUpgradeAvailable]: (state, action) => {
return {
...state,
ReleaseUpgradeAvailable: action.payload,
};
},
[Actions.SET_UI_UPGRADE_DATA]: (state, action) => {
return {
...state,
UpgradeAvailable: true,
UpgradeData: action.payload.upgrade_data,
UpgradeVersion: action.payload.version,
UpgradeDismissed: false,
};
},
}
});
);

View File

@@ -1,20 +1,17 @@
import {createReducer} from '@reduxjs/toolkit';
import { createReducer } from '@reduxjs/toolkit';
import * as Actions from '../actions/skynet_actions';
export const skynetReducer = createReducer({
DisplayExport: false,
DisplayImport: false,
}, {
[Actions.displaySkynetExport]: (state, action) => {
return {
...state,
DisplayExport: action.payload,
}
export const skynetReducer = createReducer(
{
DisplayExport: false,
DisplayImport: false,
},
[Actions.displaySkynetImport]: (state, action) => {
return {
...state,
DisplayImport: action.payload,
}
},
});
{
[Actions.displaySkynetExport]: (state, action) => {
return { ...state, DisplayExport: action.payload };
},
[Actions.displaySkynetImport]: (state, action) => {
return { ...state, DisplayImport: action.payload };
},
}
);