UNPKG

mattermost-redux

Version:

Common code (API client, Redux stores, logic, utility functions) for building a Mattermost client

79 lines (78 loc) 2.84 kB
"use strict"; // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. Object.defineProperty(exports, "__esModule", { value: true }); exports.getAllLogs = void 0; exports.getLogs = getLogs; exports.getPlainLogs = getPlainLogs; exports.getAudits = getAudits; exports.getConfig = getConfig; exports.getLdapGroups = getLdapGroups; exports.getLdapGroupsCount = getLdapGroupsCount; exports.getEnvironmentConfig = getEnvironmentConfig; exports.getComplianceReports = getComplianceReports; exports.getClusterInfo = getClusterInfo; exports.getUserAccessTokens = getUserAccessTokens; exports.getDataRetentionCustomPolicies = getDataRetentionCustomPolicies; exports.getDataRetentionCustomPoliciesCount = getDataRetentionCustomPoliciesCount; exports.getDataRetentionCustomPolicy = getDataRetentionCustomPolicy; exports.getAdminAnalytics = getAdminAnalytics; exports.getPluginStatuses = getPluginStatuses; exports.getPluginStatus = getPluginStatus; const create_selector_1 = require("mattermost-redux/selectors/create_selector"); function getLogs(state) { return state.entities.admin.logs; } function getPlainLogs(state) { return state.entities.admin.plainLogs; } exports.getAllLogs = (0, create_selector_1.createSelector)('getAllLogs', getLogs, (logs) => { return Object.values(logs).reduce((acc, log) => { // @ts-expect-error: object that is returned from the server contains an array of logs but ts gets confused that its one log object acc.push(...log); return acc; }, []); }); function getAudits(state) { return state.entities.admin.audits; } function getConfig(state) { return state.entities.admin.config; } function getLdapGroups(state) { return state.entities.admin.ldapGroups; } function getLdapGroupsCount(state) { return state.entities.admin.ldapGroupsCount; } function getEnvironmentConfig(state) { return state.entities.admin.environmentConfig; } function getComplianceReports(state) { return state.entities.admin.complianceReports; } function getClusterInfo(state) { return state.entities.admin.clusterInfo; } function getUserAccessTokens(state) { return state.entities.admin.userAccessTokens; } function getDataRetentionCustomPolicies(state) { return state.entities.admin.dataRetentionCustomPolicies; } function getDataRetentionCustomPoliciesCount(state) { return state.entities.admin.dataRetentionCustomPoliciesCount; } function getDataRetentionCustomPolicy(state, id) { const policy = getDataRetentionCustomPolicies(state); return policy[id]; } function getAdminAnalytics(state) { return state.entities.admin.analytics; } function getPluginStatuses(state) { return state.entities.admin.pluginStatuses; } function getPluginStatus(state, id) { return getPluginStatuses(state)?.[id]; }