New: App Sync Profiles

This commit is contained in:
Qstick
2021-05-18 00:17:04 -04:00
parent 29c4849bef
commit f64f8e915f
51 changed files with 1509 additions and 19 deletions

View File

@@ -0,0 +1,15 @@
import { createSelector } from 'reselect';
function createAppProfileSelector() {
return createSelector(
(state, { appProfileId }) => appProfileId,
(state) => state.settings.appProfiles.items,
(appProfileId, appProfiles) => {
return appProfiles.find((profile) => {
return profile.id === appProfileId;
});
}
);
}
export default createAppProfileSelector;

View File

@@ -0,0 +1,16 @@
import { createSelector } from 'reselect';
import createIndexerSelector from './createIndexerSelector';
function createIndexerAppProfileSelector() {
return createSelector(
(state) => state.settings.appProfiles.items,
createIndexerSelector(),
(appProfiles, indexer = {}) => {
return appProfiles.find((profile) => {
return profile.id === indexer.appProfileId;
});
}
);
}
export default createIndexerAppProfileSelector;

View File

@@ -0,0 +1,23 @@
import _ from 'lodash';
import { createSelector } from 'reselect';
import createAllIndexersSelector from './createAllIndexersSelector';
function createProfileInUseSelector(profileProp) {
return createSelector(
(state, { id }) => id,
createAllIndexersSelector(),
(id, indexers) => {
if (!id) {
return false;
}
if (_.some(indexers, { [profileProp]: id })) {
return true;
}
return false;
}
);
}
export default createProfileInUseSelector;