Skip to content

Commit

Permalink
Use @src and @test aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamalama committed Jan 26, 2024
1 parent 045970c commit 5415b2d
Show file tree
Hide file tree
Showing 162 changed files with 609 additions and 603 deletions.
2 changes: 1 addition & 1 deletion __mocks__/kinto-http.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DEFAULT_SERVERINFO } from "../src/reducers/session";
import { DEFAULT_SERVERINFO } from "@src/reducers/session";
import { vi } from 'vitest';

export const mockFetchServerInfo = vi.fn().mockReturnValue(DEFAULT_SERVERINFO);
Expand Down
4 changes: 2 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "../css/styles.css";
import { Layout } from "./components/Layout";
import { history, store } from "./store/configureStore";
import { Layout } from "@src/components/Layout";
import { history, store } from "@src/store/configureStore";
import "bootstrap/dist/css/bootstrap.css";
import * as React from "react";
import { Provider } from "react-redux";
Expand Down
4 changes: 2 additions & 2 deletions src/actions/bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
GROUP_CREATE_REQUEST,
GROUP_DELETE_REQUEST,
GROUP_UPDATE_REQUEST,
} from "../constants";
} from "@src/constants";
import type {
BucketData,
BucketUpdate,
Expand All @@ -25,7 +25,7 @@ import type {
GroupUpdate,
HistoryFilters,
ResourceHistoryEntry,
} from "../types";
} from "@src/types";

export function createBucket(
bid: string,
Expand Down
4 changes: 2 additions & 2 deletions src/actions/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import {
RECORD_CREATE_REQUEST,
RECORD_DELETE_REQUEST,
RECORD_UPDATE_REQUEST,
} from "../constants";
} from "@src/constants";
import type {
HistoryFilters,
RecordData,
RecordUpdate,
ResourceHistoryEntry,
} from "../types";
} from "@src/types";

export function collectionBusy(busy: boolean): {
type: "COLLECTION_BUSY";
Expand Down
4 changes: 2 additions & 2 deletions src/actions/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
GROUP_HISTORY_REQUEST,
GROUP_HISTORY_SUCCESS,
GROUP_RESET,
} from "../constants";
import type { ResourceHistoryEntry } from "../types";
} from "@src/constants";
import type { ResourceHistoryEntry } from "@src/types";

export function groupBusy(busy: boolean): {
type: "GROUP_BUSY";
Expand Down
4 changes: 2 additions & 2 deletions src/actions/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import {
NOTIFICATION_ADDED,
NOTIFICATION_CLEAR,
NOTIFICATION_REMOVED,
} from "../constants";
import type { ClientError } from "../types";
} from "@src/constants";
import type { ClientError } from "@src/types";

const DEFAULT_NOTIFICATIONS_TIMEOUT = 4000; // milliseconds

Expand Down
4 changes: 2 additions & 2 deletions src/actions/record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
RECORD_HISTORY_REQUEST,
RECORD_HISTORY_SUCCESS,
RECORD_RESET,
} from "../constants";
import type { ResourceHistoryEntry } from "../types";
} from "@src/constants";
import type { ResourceHistoryEntry } from "@src/types";

export function recordBusy(busy: boolean): {
type: "RECORD_BUSY";
Expand Down
4 changes: 2 additions & 2 deletions src/actions/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
ROUTE_LOAD_SUCCESS,
ROUTE_REDIRECT,
ROUTE_UPDATED,
} from "../constants";
} from "@src/constants";
import type {
BucketResource,
CollectionResource,
Expand All @@ -13,7 +13,7 @@ import type {
RecordResource,
RouteParams,
RouteResources,
} from "../types";
} from "@src/types";
import type { Location } from "history";

export function routeUpdated(
Expand Down
2 changes: 1 addition & 1 deletion src/actions/servers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SERVERS_ADD, SERVERS_CLEAR } from "../constants";
import { SERVERS_ADD, SERVERS_CLEAR } from "@src/constants";

export function addServer(
server: string,
Expand Down
6 changes: 3 additions & 3 deletions src/actions/session.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { notifyError } from "./notifications";
import {
SESSION_AUTHENTICATED,
SESSION_AUTHENTICATION_FAILED,
Expand All @@ -13,9 +14,8 @@ import {
SESSION_SETUP,
SESSION_SETUP_COMPLETE,
SESSION_STORE_REDIRECT_URL,
} from "../constants";
import type { ActionType, AuthData, ServerInfo } from "../types";
import { notifyError } from "./notifications";
} from "@src/constants";
import type { ActionType, AuthData, ServerInfo } from "@src/types";

type NavigationResult = ActionType<typeof notifyError> | { type: null };

Expand Down
4 changes: 2 additions & 2 deletions src/actions/signoff.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as constants from "../constants";
import type { SignoffCollectionsInfo } from "../types";
import * as constants from "@src/constants";
import type { SignoffCollectionsInfo } from "@src/types";

export function confirmRequestReview(): {
type: "SIGNOFF_CONFIRM_REVIEW_REQUEST";
Expand Down
2 changes: 1 addition & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { AuthData } from "./types";
import type { AuthData } from "@src/types";
import KintoClient from "kinto-http";

let client: KintoClient;
Expand Down
4 changes: 2 additions & 2 deletions src/components/AdminLink.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { RouteParams } from "../types";
import url from "../url";
import type { RouteParams } from "@src/types";
import url from "@src/url";
import { PureComponent } from "react";
import * as React from "react";
import { Link } from "react-router-dom";
Expand Down
10 changes: 5 additions & 5 deletions src/components/AuthForm.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as ServersActions from "../actions/servers";
import * as SessionActions from "../actions/session";
import { ANONYMOUS_AUTH, SINGLE_SERVER } from "../constants";
import type { ServerEntry, SessionState } from "../types";
import { getAuthLabel, getServerByPriority, omit } from "../utils";
import BaseForm from "./BaseForm";
import ServerHistory from "./ServerHistory";
import { RJSFSchema } from "@rjsf/utils";
import * as ServersActions from "@src/actions/servers";
import * as SessionActions from "@src/actions/session";
import { ANONYMOUS_AUTH, SINGLE_SERVER } from "@src/constants";
import type { ServerEntry, SessionState } from "@src/types";
import { getAuthLabel, getServerByPriority, omit } from "@src/utils";
import React, { useState } from "react";

const KNOWN_AUTH_METHODS = [
Expand Down
2 changes: 1 addition & 1 deletion src/components/Breadcrumbs/Breadcrumbs.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { breadcrumbifyPath } from "../../locationUtils";
import "./style.css";
import { breadcrumbifyPath } from "@src/locationUtils";
import React from "react";
import { NavLink, useLocation } from "react-router-dom";

Expand Down
14 changes: 9 additions & 5 deletions src/components/HistoryTable.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import * as NotificationActions from "../actions/notifications";
import { getClient } from "../client";
import type { RecordData, ResourceHistoryEntry, RouteLocation } from "../types";
import { diffJson, humanDate, parseHistoryFilters, timeago } from "../utils";
import { omit, sortHistoryEntryPermissions } from "../utils";
import AdminLink from "./AdminLink";
import PaginatedTable from "./PaginatedTable";
import Spinner from "./Spinner";
import * as NotificationActions from "@src/actions/notifications";
import { getClient } from "@src/client";
import type {
RecordData,
ResourceHistoryEntry,
RouteLocation,
} from "@src/types";
import { diffJson, humanDate, parseHistoryFilters, timeago } from "@src/utils";
import { omit, sortHistoryEntryPermissions } from "@src/utils";
import type { Location } from "history";
import React, { useState } from "react";
import { Eye } from "react-bootstrap-icons";
Expand Down
14 changes: 7 additions & 7 deletions src/components/HomePage.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as NotificationActions from "../actions/notifications";
import * as ServersActions from "../actions/servers";
import * as SessionActions from "../actions/session";
import { useAppDispatch, useAppSelector } from "../hooks/app";
import { loadSession } from "../store/localStore";
import type { OpenIDAuth, PortierAuth, TokenAuth } from "../types";
import { getServerByPriority, isObject } from "../utils";
import AuthForm from "./AuthForm";
import Spinner from "./Spinner";
import * as NotificationActions from "@src/actions/notifications";
import * as ServersActions from "@src/actions/servers";
import * as SessionActions from "@src/actions/session";
import { useAppDispatch, useAppSelector } from "@src/hooks/app";
import { loadSession } from "@src/store/localStore";
import type { OpenIDAuth, PortierAuth, TokenAuth } from "@src/types";
import { getServerByPriority, isObject } from "@src/utils";
import * as React from "react";
import { useParams } from "react-router";

Expand Down
52 changes: 26 additions & 26 deletions src/components/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
import { HomePage } from "../components/HomePage";
import { Sidebar } from "../components/Sidebar";
import { BucketPermissions } from "../components/bucket/BucketPermissions";
import { CollectionPermissions } from "../components/collection/CollectionPermissions";
import { GroupPermissions } from "../components/group/GroupPermissions";
import { RecordPermissions } from "../components/record/RecordPermissions";
import Notifications from "../containers/Notifications";
import BucketAttributesPage from "../containers/bucket/BucketAttributesPage";
import BucketCollectionsPage from "../containers/bucket/BucketCollectionsPage";
import BucketCreatePage from "../containers/bucket/BucketCreatePage";
import BucketGroupsPage from "../containers/bucket/BucketGroupsPage";
import BucketHistoryPage from "../containers/bucket/BucketHistoryPage";
import CollectionAttributesPage from "../containers/collection/CollectionAttributesPage";
import CollectionCreatePage from "../containers/collection/CollectionCreatePage";
import CollectionHistoryPage from "../containers/collection/CollectionHistoryPage";
import CollectionRecordsPage from "../containers/collection/CollectionRecordsPage";
import GroupAttributesPage from "../containers/group/GroupAttributesPage";
import GroupCreatePage from "../containers/group/GroupCreatePage";
import GroupHistoryPage from "../containers/group/GroupHistoryPage";
import RecordAttributesPage from "../containers/record/RecordAttributesPage";
import RecordBulkPage from "../containers/record/RecordBulkPage";
import RecordCreatePage from "../containers/record/RecordCreatePage";
import RecordHistoryPage from "../containers/record/RecordHistoryPage";
import SimpleReviewPage from "../containers/signoff/SimpleReviewPage";
import { useAppSelector } from "../hooks/app";
import { CreateRoute } from "../routes";
import Breadcrumbs from "./Breadcrumbs";
import { SessionInfoBar } from "./SessionInfoBar";
import { HomePage } from "@src/components/HomePage";
import { Sidebar } from "@src/components/Sidebar";
import { BucketPermissions } from "@src/components/bucket/BucketPermissions";
import { CollectionPermissions } from "@src/components/collection/CollectionPermissions";
import { GroupPermissions } from "@src/components/group/GroupPermissions";
import { RecordPermissions } from "@src/components/record/RecordPermissions";
import Notifications from "@src/containers/Notifications";
import BucketAttributesPage from "@src/containers/bucket/BucketAttributesPage";
import BucketCollectionsPage from "@src/containers/bucket/BucketCollectionsPage";
import BucketCreatePage from "@src/containers/bucket/BucketCreatePage";
import BucketGroupsPage from "@src/containers/bucket/BucketGroupsPage";
import BucketHistoryPage from "@src/containers/bucket/BucketHistoryPage";
import CollectionAttributesPage from "@src/containers/collection/CollectionAttributesPage";
import CollectionCreatePage from "@src/containers/collection/CollectionCreatePage";
import CollectionHistoryPage from "@src/containers/collection/CollectionHistoryPage";
import CollectionRecordsPage from "@src/containers/collection/CollectionRecordsPage";
import GroupAttributesPage from "@src/containers/group/GroupAttributesPage";
import GroupCreatePage from "@src/containers/group/GroupCreatePage";
import GroupHistoryPage from "@src/containers/group/GroupHistoryPage";
import RecordAttributesPage from "@src/containers/record/RecordAttributesPage";
import RecordBulkPage from "@src/containers/record/RecordBulkPage";
import RecordCreatePage from "@src/containers/record/RecordCreatePage";
import RecordHistoryPage from "@src/containers/record/RecordHistoryPage";
import SimpleReviewPage from "@src/containers/signoff/SimpleReviewPage";
import { useAppSelector } from "@src/hooks/app";
import { CreateRoute } from "@src/routes";
import * as React from "react";
import { Redirect, Route, Switch } from "react-router-dom";

Expand Down
4 changes: 2 additions & 2 deletions src/components/Notifications.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as actions from "../actions/notifications";
import type { Notifications } from "../types";
import * as actions from "@src/actions/notifications";
import type { Notifications } from "@src/types";
import React from "react";
import { AlertList } from "react-bs-notifier";

Expand Down
10 changes: 5 additions & 5 deletions src/components/PermissionsForm.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { useAppSelector } from "../hooks/app";
import BaseForm from "./BaseForm";
import { RJSFSchema } from "@rjsf/utils";
import { useAppSelector } from "@src/hooks/app";
import {
formDataToPermissions,
permissionsToFormData,
preparePermissionsForm,
} from "../permission";
import type { Permissions } from "../types";
import BaseForm from "./BaseForm";
import { RJSFSchema } from "@rjsf/utils";
} from "@src/permission";
import type { Permissions } from "@src/types";
import React from "react";
import { useParams } from "react-router";

Expand Down
4 changes: 2 additions & 2 deletions src/components/ServerHistory.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ANONYMOUS_AUTH } from "../constants";
import { debounce } from "../utils";
import { ANONYMOUS_AUTH } from "@src/constants";
import { debounce } from "@src/utils";
import React, { useCallback, useState } from "react";
import Dropdown from "react-bootstrap/Dropdown";
import DropdownButton from "react-bootstrap/DropdownButton";
Expand Down
4 changes: 2 additions & 2 deletions src/components/SessionInfoBar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as SessionActions from "../actions/session";
import { useAppDispatch, useAppSelector } from "../hooks/app";
import * as SessionActions from "@src/actions/session";
import { useAppDispatch, useAppSelector } from "@src/hooks/app";
import * as React from "react";
import { BoxArrowRight } from "react-bootstrap-icons";
import { QuestionCircleFill } from "react-bootstrap-icons";
Expand Down
12 changes: 6 additions & 6 deletions src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as SessionActions from "../actions/session";
import { SIDEBAR_MAX_LISTED_COLLECTIONS } from "../constants";
import { useAppDispatch, useAppSelector } from "../hooks/app";
import { canCreateBucket } from "../permission";
import type { BucketEntry, RouteParams } from "../types";
import url from "../url";
import AdminLink from "./AdminLink";
import Spinner from "./Spinner";
import * as SessionActions from "@src/actions/session";
import { SIDEBAR_MAX_LISTED_COLLECTIONS } from "@src/constants";
import { useAppDispatch, useAppSelector } from "@src/hooks/app";
import { canCreateBucket } from "@src/permission";
import type { BucketEntry, RouteParams } from "@src/types";
import url from "@src/url";
import * as React from "react";
import { Plus } from "react-bootstrap-icons";
import { XCircleFill } from "react-bootstrap-icons";
Expand Down
10 changes: 5 additions & 5 deletions src/components/bucket/BucketAttributes.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import * as BucketActions from "../../actions/bucket";
import BucketForm from "./BucketForm";
import BucketTabs from "./BucketTabs";
import * as BucketActions from "@src/actions/bucket";
import Spinner from "@src/components/Spinner";
import type {
BucketData,
BucketRouteMatch,
BucketState,
Capabilities,
SessionState,
} from "../../types";
import Spinner from "../Spinner";
import BucketForm from "./BucketForm";
import BucketTabs from "./BucketTabs";
} from "@src/types";
import React, { useCallback } from "react";

export type OwnProps = {
Expand Down
8 changes: 4 additions & 4 deletions src/components/bucket/BucketCollections.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as BucketActions from "../../actions/bucket";
import BucketTabs from "./BucketTabs";
import { DataList, ListActions } from "./CollectionDataList";
import * as BucketActions from "@src/actions/bucket";
import type {
BucketRouteMatch,
BucketState,
Capabilities,
SessionState,
} from "../../types";
import BucketTabs from "./BucketTabs";
import { DataList, ListActions } from "./CollectionDataList";
} from "@src/types";
import type { Location } from "history";
import React, { useEffect } from "react";

Expand Down
6 changes: 3 additions & 3 deletions src/components/bucket/BucketCreate.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as BucketActions from "../../actions/bucket";
import type { BucketState, SessionState } from "../../types";
import Spinner from "../Spinner";
import BucketForm from "./BucketForm";
import * as BucketActions from "@src/actions/bucket";
import Spinner from "@src/components/Spinner";
import type { BucketState, SessionState } from "@src/types";
import React from "react";

export type StateProps = {
Expand Down
12 changes: 6 additions & 6 deletions src/components/bucket/BucketForm.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { canEditBucket } from "../../permission";
import type { BucketData, BucketState, SessionState } from "../../types";
import { omit } from "../../utils";
import BaseForm from "../BaseForm";
import JSONEditor from "../JSONEditor";
import Spinner from "../Spinner";
import DeleteForm from "./DeleteForm";
import { RJSFSchema } from "@rjsf/utils";
import BaseForm from "@src/components/BaseForm";
import JSONEditor from "@src/components/JSONEditor";
import Spinner from "@src/components/Spinner";
import { canEditBucket } from "@src/permission";
import type { BucketData, BucketState, SessionState } from "@src/types";
import { omit } from "@src/utils";
import React from "react";
import { Check2 } from "react-bootstrap-icons";
import { Link } from "react-router-dom";
Expand Down
Loading

0 comments on commit 5415b2d

Please sign in to comment.