Skip to content

Commit

Permalink
Pull request update/250203
Browse files Browse the repository at this point in the history
c6d1542 OSN-594. Reorganize core data hook imports into separate files
e2261aa OSN-598. Remove Advanced tab from GCP tenant data source
628fdbf OSN-592. Update store2 package to 2.14.4
  • Loading branch information
stanfra authored Feb 3, 2025
2 parents 7e72811 + c6d1542 commit 51e09ee
Show file tree
Hide file tree
Showing 47 changed files with 52 additions and 72 deletions.
8 changes: 4 additions & 4 deletions ngui/ui/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import TabsWrapper from "components/TabsWrapper";
import DataSourceNodesContainer from "containers/DataSourceNodesContainer";
import DataSourceSkusContainer from "containers/DataSourceSkusContainer";
import UploadCloudReportDataContainer from "containers/UploadCloudReportDataContainer";
import { useAllDataSources } from "hooks/coreData";
import { useAllDataSources } from "hooks/coreData/useAllDataSources";
import { useDataSources } from "hooks/useDataSources";
import { useIsFeatureEnabled } from "hooks/useIsFeatureEnabled";
import { useOpenSideModal } from "hooks/useOpenSideModal";
Expand All @@ -39,7 +39,8 @@ import {
AZURE_CNR,
GCP_CNR,
ALIBABA_CNR,
NEBIUS
NEBIUS,
GCP_TENANT
} from "utils/constants";
import { summarizeChildrenDetails } from "utils/dataSources";
import { SPACING_2 } from "utils/layouts";
Expand Down Expand Up @@ -364,7 +365,7 @@ const CloudAccountDetails = ({ data = {}, isLoading = false }) => {
discovery_infos: discoveryInfos
} = { ...details, ...childrenDetails };

const isTenant = type === AZURE_TENANT;
const isTenant = [AZURE_TENANT, GCP_TENANT].includes(type);
const isChildSubscription = Boolean(parentId);
const isSubscription = !isTenant && !isChildSubscription;

Expand Down
2 changes: 1 addition & 1 deletion ngui/ui/src/components/Dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import RecentModelsCardContainer from "containers/RecentModelsCardContainer";
import RecentTasksCardContainer from "containers/RecentTasksCardContainer";
import RecommendationsCardContainer from "containers/RecommendationsCardContainer";
import TopResourcesExpensesCardContainer from "containers/TopResourcesExpensesCardContainer";
import { useAllDataSources } from "hooks/coreData";
import { useAllDataSources } from "hooks/coreData/useAllDataSources";
import { useIsUpMediaQuery } from "hooks/useMediaQueries";
import { EMAIL_SUPPORT, DOCS_HYSTAX_OPTSCALE, SHOW_POLICY_QUERY_PARAM } from "urls";
import { ENVIRONMENT } from "utils/constants";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Typography from "@mui/material/Typography";
import { FormattedMessage } from "react-intl";
import CloudLabel from "components/CloudLabel";
import SubTitle from "components/SubTitle";
import { useAllDataSources } from "hooks/coreData";
import { useAllDataSources } from "hooks/coreData/useAllDataSources";
import { isEmpty } from "utils/arrays";

const ChildrenList = ({ parentId }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import CloudLabel from "components/CloudLabel";
import KeyValueLabel from "components/KeyValueLabel/KeyValueLabel";
import { useAllDataSources } from "hooks/coreData";
import { useAllDataSources } from "hooks/coreData/useAllDataSources";
import { AZURE_CNR } from "utils/constants";

const ParentDataSource = ({ parentDataSourceId }) => {
Expand Down
2 changes: 1 addition & 1 deletion ngui/ui/src/components/MainMenu/MainMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import CapabilityWrapper from "components/CapabilityWrapper";
import MenuGroupWrapper from "components/MenuGroupWrapper";
import MenuItem from "components/MenuItem";
import { PRODUCT_TOUR, useProductTour, PRODUCT_TOUR_IDS } from "components/Tour";
import { useGetOptscaleCapability } from "hooks/coreData";
import { useGetOptscaleCapability } from "hooks/coreData/useGetOptscaleCapability";

const SimpleItem = ({ menuItem, optscaleCapability }) => (
<CapabilityWrapper capability={menuItem.capability}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import IconButton from "components/IconButton";
import Table from "components/Table";
import TableLoader from "components/TableLoader";
import TextWithDataTestId from "components/TextWithDataTestId";
import { useAllDataSources } from "hooks/coreData";
import { useAllDataSources } from "hooks/coreData/useAllDataSources";
import { useIsAllowed } from "hooks/useAllowedActions";
import { intl } from "translations/react-intl-config";
import { isEmpty as isEmptyArray } from "utils/arrays";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import FormattedOrganizationCurrency from "components/FormattedOrganizationCurre
import IconButton from "components/IconButton";
import KeyValueLabel from "components/KeyValueLabel/KeyValueLabel";
import EditOrganizationCurrencyFormContainer from "containers/EditOrganizationCurrencyFormContainer";
import { useAllDataSources } from "hooks/coreData";
import { useAllDataSources } from "hooks/coreData/useAllDataSources";
import { useIsAllowed } from "hooks/useAllowedActions";
import { useOrganizationInfo } from "hooks/useOrganizationInfo";
import { ENVIRONMENT } from "utils/constants";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useTheme } from "@mui/material/styles";
import { FormattedMessage } from "react-intl";
import { Link as RouterLink } from "react-router-dom";
import SnackbarAlert from "components/SnackbarAlert";
import { useInvitations } from "hooks/coreData";
import { useInvitations } from "hooks/coreData/useInvitations";
import { SETTINGS_TABS } from "pages/Settings/Settings";
import { getSettingsUrl } from "urls";
import { isEmpty } from "utils/arrays";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Box } from "@mui/material";
import CloudLabel from "components/CloudLabel";
import { useAllDataSources } from "hooks/coreData";
import { useAllDataSources } from "hooks/coreData/useAllDataSources";
import { SPACING_1 } from "utils/layouts";

const SelectedCloudAccounts = ({ cloudAccountIds }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import CloudResourceId from "components/CloudResourceId";
import CloudTypeIcon from "components/CloudTypeIcon";
import IconLabel from "components/IconLabel";
import { useAllDataSources } from "hooks/coreData";
import { useAllDataSources } from "hooks/coreData/useAllDataSources";
import { getCloudResourceIdentifier } from "utils/resources";

const RecommendationListItemResourceLabel = ({ item }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import CaptionedCell from "components/CaptionedCell";
import CloudLabel from "components/CloudLabel";
import { useAllDataSources } from "hooks/coreData";
import { useAllDataSources } from "hooks/coreData/useAllDataSources";

const ResourceLocationCell = ({ dataSource, caption }) => {
const dataSources = useAllDataSources();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Table from "components/Table";
import TableCellActions from "components/TableCellActions";
import TextWithDataTestId from "components/TextWithDataTestId";
import Tooltip from "components/Tooltip";
import { useOrganizationPerspectives } from "hooks/coreData";
import { useOrganizationPerspectives } from "hooks/coreData/useOrganizationPerspectives";
import { useIsAllowed } from "hooks/useAllowedActions";
import { breakdowns } from "hooks/useBreakdownBy";
import { useOpenSideModal } from "hooks/useOpenSideModal";
Expand Down
2 changes: 1 addition & 1 deletion ngui/ui/src/components/TopAlertWrapper/TopAlertWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Box } from "@mui/material";
import { render as renderGithubButton } from "github-buttons";
import { FormattedMessage, useIntl } from "react-intl";
import { useDispatch } from "react-redux";
import { useAllDataSources } from "hooks/coreData";
import { useAllDataSources } from "hooks/coreData/useAllDataSources";
import { useGetToken } from "hooks/useGetToken";
import { useOrganizationInfo } from "hooks/useOrganizationInfo";
import { useRootData } from "hooks/useRootData";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import TableLoader from "components/TableLoader";
import TitleValue from "components/TitleValue";
import Tooltip from "components/Tooltip";
import WrapperCard from "components/WrapperCard";
import { useOrganizationPerspectives } from "hooks/coreData";
import { useOrganizationPerspectives } from "hooks/coreData/useOrganizationPerspectives";
import { getLast30DaysResourcesUrl, getResourcesExpensesUrl, RESOURCE_PERSPECTIVES } from "urls";
import { isEmpty as isEmptyArray } from "utils/arrays";
import { FORMATTED_MONEY_TYPES } from "utils/constants";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Controller, useFormContext } from "react-hook-form";
import { useIntl } from "react-intl";
import DataSourceMultiSelect from "components/DataSourceMultiSelect";
import { useAllDataSources } from "hooks/coreData";
import { useAllDataSources } from "hooks/coreData/useAllDataSources";
import { isEmpty as isEmptyArray } from "utils/arrays";
import { ALIBABA_CNR, AWS_CNR, AZURE_CNR, GCP_CNR, NEBIUS } from "utils/constants";
import { FormValues } from "../types";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useIntl } from "react-intl";
import { Selector } from "components/forms/common/fields";
import QuestionMark from "components/QuestionMark";
import { ItemContent } from "components/Selector";
import { useCurrentEmployee } from "hooks/coreData";
import { useCurrentEmployee } from "hooks/coreData/useCurrentEmployee";
import { FIELD_NAMES } from "../constants";

type OwnerSelectorProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { RESTAPI, bookEnvironment, createSshKey, getSshKeys } from "api";
import { BOOK_ENVIRONMENT, GET_SSH_KEYS, CREATE_SSH_KEY } from "api/restapi/actionTypes";
import BookEnvironmentForm from "components/forms/BookEnvironmentForm";
import { FormValues } from "components/forms/BookEnvironmentForm/types";
import { useCurrentEmployee } from "hooks/coreData";
import { useCurrentEmployee } from "hooks/coreData/useCurrentEmployee";
import { useIsAllowed } from "hooks/useAllowedActions";
import { useApiData } from "hooks/useApiData";
import { useApiState } from "hooks/useApiState";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useMutation } from "@apollo/client";
import CapabilityForm from "components/forms/CapabilityForm";
import { GET_OPTSCALE_CAPABILITY, UPDATE_OPTSCALE_CAPABILITY } from "graphql/api/restapi/queries";
import { useGetOptscaleCapability } from "hooks/coreData";
import { useGetOptscaleCapability } from "hooks/coreData/useGetOptscaleCapability";
import { useIsAllowed } from "hooks/useAllowedActions";
import { useOrganizationInfo } from "hooks/useOrganizationInfo";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ActionBar from "components/ActionBar";
import AssignmentRuleForm from "components/forms/AssignmentRuleForm";
import { FIELD_NAMES } from "components/forms/AssignmentRuleForm/utils";
import PageContentWrapper from "components/PageContentWrapper";
import { useAllDataSources } from "hooks/coreData";
import { useAllDataSources } from "hooks/coreData/useAllDataSources";
import { useApiData } from "hooks/useApiData";
import { useApiState } from "hooks/useApiState";
import { useAssignmentRulesAvailableFilters } from "hooks/useAssignmentRulesAvailableFilters";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import ActionBarResourceNameTitleText from "components/ActionBarResourceNameTitl
import AssignmentRuleForm from "components/forms/AssignmentRuleForm";
import { FIELD_NAMES } from "components/forms/AssignmentRuleForm/utils";
import PageContentWrapper from "components/PageContentWrapper";
import { useAllDataSources } from "hooks/coreData";
import { useAllDataSources } from "hooks/coreData/useAllDataSources";
import { useApiState } from "hooks/useApiState";
import { useAssignmentRulesAvailableFilters } from "hooks/useAssignmentRulesAvailableFilters";
import { useOrganizationInfo } from "hooks/useOrganizationInfo";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useMutation } from "@apollo/client";
import CreateResourcePerspectiveForm from "components/forms/CreateResourcePerspectiveForm";
import { GET_ORGANIZATION_PERSPECTIVES, UPDATE_ORGANIZATION_PERSPECTIVES } from "graphql/api/restapi/queries/restapi.queries";
import { useOrganizationPerspectives } from "hooks/coreData";
import { useOrganizationPerspectives } from "hooks/coreData/useOrganizationPerspectives";
import { useOrganizationInfo } from "hooks/useOrganizationInfo";

const CreateResourcePerspectiveContainer = ({ filters, breakdownBy, breakdownData, onSuccess, onCancel }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { deleteEmployee } from "api";
import { DELETE_EMPLOYEE } from "api/restapi/actionTypes";
import DeleteEmployeeForm from "components/forms/DeleteEmployeeForm";
import { FormValues } from "components/forms/DeleteEmployeeForm/types";
import { useCurrentEmployee } from "hooks/coreData";
import { useCurrentEmployee } from "hooks/coreData/useCurrentEmployee";
import { useApiState } from "hooks/useApiState";
import { useOrganizationInfo } from "hooks/useOrganizationInfo";
import { isError } from "utils/api";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useMutation } from "@apollo/client";
import DeleteResourcePerspective from "components/DeleteResourcePerspective";
import { GET_ORGANIZATION_PERSPECTIVES, UPDATE_ORGANIZATION_PERSPECTIVES } from "graphql/api/restapi/queries/restapi.queries";
import { useOrganizationPerspectives } from "hooks/coreData";
import { useOrganizationPerspectives } from "hooks/coreData/useOrganizationPerspectives";
import { useOrganizationInfo } from "hooks/useOrganizationInfo";
import { removeKey } from "utils/objects";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { GET_AVAILABLE_FILTERS } from "api/restapi/actionTypes";
import DisconnectCloudAccountForm from "components/forms/DisconnectCloudAccountForm";
import { getReasonValue } from "components/forms/DisconnectCloudAccountForm/utils";
import { DELETE_DATA_SOURCE, GET_DATA_SOURCES } from "graphql/api/restapi/queries/restapi.queries";
import { useAllDataSources } from "hooks/coreData";
import { useAllDataSources } from "hooks/coreData/useAllDataSources";
import { useRefetchApis } from "hooks/useRefetchApis";
import DataSourcesService, { DATASOURCE_SURVEY_TYPES } from "services/DataSourcesService";
import { CLOUD_ACCOUNTS } from "urls";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ActionBar from "components/ActionBar";
import AssignmentRuleForm from "components/forms/AssignmentRuleForm";
import { FIELD_NAMES } from "components/forms/AssignmentRuleForm/utils";
import PageContentWrapper from "components/PageContentWrapper";
import { useAllDataSources } from "hooks/coreData";
import { useAllDataSources } from "hooks/coreData/useAllDataSources";
import { useApiData } from "hooks/useApiData";
import { useApiState } from "hooks/useApiState";
import { useAssignmentRulesAvailableFilters } from "hooks/useAssignmentRulesAvailableFilters";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useDispatch } from "react-redux";
import { getPool } from "api";
import { GET_POOL } from "api/restapi/actionTypes";
import CloudAccountsOverview from "components/CloudAccountsOverview";
import { useAllDataSources } from "hooks/coreData";
import { useAllDataSources } from "hooks/coreData/useAllDataSources";
import { useApiData } from "hooks/useApiData";
import { useApiState } from "hooks/useApiState";
import { useOrganizationInfo } from "hooks/useOrganizationInfo";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Jira from "components/Integrations/Jira";
import { useCurrentEmployee } from "hooks/coreData";
import { useCurrentEmployee } from "hooks/coreData/useCurrentEmployee";
import EmployeesService from "services/EmployeesService";
import JiraOrganizationStatusService from "services/JiraOrganizationStatusService";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useQuery } from "@apollo/client";
import Slack from "components/Integrations/Slack";
import { GET_INSTALLATION_PATH } from "graphql/api/slacker/queries";
import { useCurrentEmployee } from "hooks/coreData";
import { useCurrentEmployee } from "hooks/coreData/useCurrentEmployee";
import EmployeesService from "services/EmployeesService";

const IntegrationsSlackContainer = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useNavigate } from "react-router-dom";
import MlRunsetTemplateForm from "components/forms/MlRunsetTemplateForm";
import { FIELD_NAMES } from "components/forms/MlRunsetTemplateForm/constants";
import { useAllDataSources } from "hooks/coreData";
import { useAllDataSources } from "hooks/coreData/useAllDataSources";
import MlRunsetTemplatesService from "services/MlRunsetTemplatesService";
import MlTasksService from "services/MlTasksService";
import { ML_RUNSET_TEMPLATES } from "urls";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useNavigate, useParams } from "react-router-dom";
import MlRunsetTemplateEdit from "components/MlRunsetTemplateEdit";
import { useAllDataSources } from "hooks/coreData";
import { useAllDataSources } from "hooks/coreData/useAllDataSources";
import MlRunsetTemplatesService from "services/MlRunsetTemplatesService";
import MlTasksService from "services/MlTasksService";
import { getMlRunsetTemplateUrl } from "urls";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useNavigate } from "react-router-dom";
import { areSearchParamsEqual } from "api/utils";
import { RESOURCE_FILTERS_NAMES } from "components/Filters/constants";
import Resources from "components/Resources";
import { useOrganizationPerspectives } from "hooks/coreData";
import { useOrganizationPerspectives } from "hooks/coreData/useOrganizationPerspectives";
import { useReactiveDefaultDateRange } from "hooks/useReactiveDefaultDateRange";
import { useReactiveSearchParams } from "hooks/useReactiveSearchParams";
import AvailableFiltersService from "services/AvailableFiltersService";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useDispatch } from "react-redux";
import { getSshKeys, createSshKey, updateSshKey } from "api";
import { GET_SSH_KEYS } from "api/restapi/actionTypes";
import SshSettings from "components/SshSettings";
import { useCurrentEmployee } from "hooks/coreData";
import { useCurrentEmployee } from "hooks/coreData/useCurrentEmployee";
import { useApiData } from "hooks/useApiData";
import { useApiState } from "hooks/useApiState";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useQuery } from "@apollo/client";
import UserEmailNotificationSettings from "components/UserEmailNotificationSettings";
import { GET_EMPLOYEE_EMAILS } from "graphql/api/restapi/queries/restapi.queries";
import { useCurrentEmployee } from "hooks/coreData";
import { useCurrentEmployee } from "hooks/coreData/useCurrentEmployee";

const UserEmailNotificationSettingsContainer = () => {
const currentEmployee = useCurrentEmployee();
Expand Down
21 changes: 0 additions & 21 deletions ngui/ui/src/hooks/coreData/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion ngui/ui/src/hooks/useAllowedActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useApiData } from "hooks/useApiData";
import { useOrganizationInfo } from "hooks/useOrganizationInfo";
import { hasIntersection, getLength, isIdentical } from "utils/arrays";
import { SCOPE_TYPES } from "utils/constants";
import { useOrganizationAllowedActions } from "./coreData";
import { useOrganizationAllowedActions } from "./coreData/useOrganizationAllowedActions";

const CHECK_PERMISSION_CONDITION = Object.freeze({
OR: "or",
Expand Down
2 changes: 1 addition & 1 deletion ngui/ui/src/hooks/useCustomOrganizationWeekends.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SHORT_WEEK_DAYS } from "utils/datetime";
import { useOrganizationFeatures } from "./coreData";
import { useOrganizationFeatures } from "./coreData/useOrganizationFeatures";

export const getValidCustomWeekends = (customWeekends) => {
if (Array.isArray(customWeekends)) {
Expand Down
2 changes: 1 addition & 1 deletion ngui/ui/src/hooks/useIsFeatureEnabled.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useOrganizationFeatures } from "./coreData";
import { useOrganizationFeatures } from "./coreData/useOrganizationFeatures";

export const useIsFeatureEnabled = (featureName) => {
const { [featureName]: featureFlag = 0 } = useOrganizationFeatures();
Expand Down
Loading

0 comments on commit 51e09ee

Please sign in to comment.