mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 17:02:49 +03:00
cloud console: update reducer state shape for entitlements
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7991 GitOrigin-RevId: 4d9e492e7dbccffd374fe536cf74daedcdad4524
This commit is contained in:
parent
ea76e01b0f
commit
b8355dba6a
@ -897,8 +897,8 @@ const proMainReducer = (state = { ...mainState, ...defaultState }, action) => {
|
||||
project: {
|
||||
...state.project,
|
||||
loading: false,
|
||||
entitlements: action.data.entitlements,
|
||||
},
|
||||
projectEntitlements: action?.data?.entitlements,
|
||||
};
|
||||
case ERROR_FETCHING_LUX_PROJECT_ENTITLEMENTS:
|
||||
return {
|
||||
|
@ -302,7 +302,8 @@ class Main extends React.Component {
|
||||
|
||||
// get the plan name and entitlements array from the project
|
||||
const {
|
||||
project: { plan_name = '', entitlements = [] },
|
||||
project: { plan_name = '' },
|
||||
projectEntitlements = [],
|
||||
} = this.props;
|
||||
|
||||
// entitlements are added only for projects on the
|
||||
@ -320,7 +321,7 @@ class Main extends React.Component {
|
||||
// if the plan is one of the new plans, check if the
|
||||
// metrics entitlement is enabled
|
||||
const { entitlement: { config_is_enabled } = {} } =
|
||||
entitlements.find(
|
||||
projectEntitlements.find(
|
||||
({ entitlement: { type } }) =>
|
||||
type === Project_Entitlement_Types_Enum.ConsoleMetricsTab
|
||||
) || {};
|
||||
@ -682,6 +683,7 @@ const mapStateToProps = (state, ownProps) => {
|
||||
projectName: project.name,
|
||||
projectId: project.id,
|
||||
requestHeaders: state.tables.dataHeaders,
|
||||
projectEntitlements: state.main.projectEntitlements,
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -15,6 +15,7 @@ const defaultState = {
|
||||
privileges: [],
|
||||
metricsFQDN: '',
|
||||
},
|
||||
projectEntitlements: [],
|
||||
};
|
||||
|
||||
export default defaultState;
|
||||
|
Loading…
Reference in New Issue
Block a user