Skip to content

Commit

Permalink
Remove search service components, since this is now configured server…
Browse files Browse the repository at this point in the history
… side, rather then through the UI.
  • Loading branch information
jonathangreen committed Jan 18, 2024
1 parent 01d3c05 commit e7fc07d
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 177 deletions.
29 changes: 0 additions & 29 deletions src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
PatronAuthServicesData,
SitewideSettingsData,
MetadataServicesData,
SearchServicesData,
DiscoveryServicesData,
LibraryRegistrationsData,
CustomListsData,
Expand Down Expand Up @@ -86,9 +85,6 @@ export default class ActionCreator extends BaseActionCreator {
static readonly METADATA_SERVICES = "METADATA_SERVICES";
static readonly EDIT_METADATA_SERVICE = "EDIT_METADATA_SERVICE";
static readonly DELETE_METADATA_SERVICE = "DELETE_METADATA_SERVICE";
static readonly SEARCH_SERVICES = "SEARCH_SERVICES";
static readonly EDIT_SEARCH_SERVICE = "EDIT_SEARCH_SERVICE";
static readonly DELETE_SEARCH_SERVICE = "DELETE_SEARCH_SERVICE";
static readonly CATALOG_SERVICES = "CATALOG_SERVICES";
static readonly EDIT_CATALOG_SERVICE = "EDIT_CATALOG_SERVICE";
static readonly DELETE_CATALOG_SERVICE = "DELETE_CATALOG_SERVICE";
Expand Down Expand Up @@ -598,31 +594,6 @@ export default class ActionCreator extends BaseActionCreator {
).bind(this);
}

fetchSearchServices() {
const url = "/admin/search_services";
return this.fetchJSON<SearchServicesData>(
ActionCreator.SEARCH_SERVICES,
url
).bind(this);
}

editSearchService(data: FormData) {
const url = "/admin/search_services";
return this.postForm(ActionCreator.EDIT_SEARCH_SERVICE, url, data).bind(
this
);
}

deleteSearchService(identifier: string | number) {
const url = "/admin/search_service/" + identifier;
return this.postForm(
ActionCreator.DELETE_SEARCH_SERVICE,
url,
null,
"DELETE"
).bind(this);
}

fetchCatalogServices() {
const url = "/admin/catalog_services";
return this.fetchJSON<CatalogServicesData>(
Expand Down
2 changes: 0 additions & 2 deletions src/components/ConfigTabContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import PatronAuthServices from "./PatronAuthServices";
import SitewideAnnouncements from "./SitewideAnnouncements";
import SitewideSettings from "./SitewideSettings";
import MetadataServices from "./MetadataServices";
import SearchServices from "./SearchServices";
import CatalogServices from "./CatalogServices";
import DiscoveryServices from "./DiscoveryServices";
import {
Expand Down Expand Up @@ -46,7 +45,6 @@ export default class ConfigTabContainer extends TabContainer<
patronAuth: PatronAuthServices,
sitewideSettings: SitewideSettings,
metadata: MetadataServices,
search: SearchServices,
catalogServices: CatalogServices,
discovery: DiscoveryServices,
sitewideAnnouncements: SitewideAnnouncements,
Expand Down
81 changes: 0 additions & 81 deletions src/components/SearchServices.tsx

This file was deleted.

8 changes: 2 additions & 6 deletions src/components/SelfTestsCategory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import SelfTests from "./SelfTests";
import {
CollectionData,
PatronAuthServiceData,
SearchServiceData,
ServiceData,
} from "../interfaces";
import { Panel } from "library-simplified-reusable-components";
Expand All @@ -14,17 +13,14 @@ export interface SelfTestsCategoryProps {
type: string;
linkName: string;
csrfToken: string;
items: CollectionData[] | PatronAuthServiceData[] | SearchServiceData[];
items: CollectionData[] | PatronAuthServiceData[];
store: Store<RootState>;
}

export default class SelfTestsCategory extends React.Component<
SelfTestsCategoryProps
> {
handleUnnamed():
| CollectionData[]
| PatronAuthServiceData[]
| SearchServiceData[] {
handleUnnamed(): CollectionData[] | PatronAuthServiceData[] {
// It's possible for older systems to have services in which the name
// property is null, which will block the page from loading. We check for
// these services and assign them a placeholder name.
Expand Down
18 changes: 4 additions & 14 deletions src/components/SelfTestsTabContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ import * as React from "react";
import { Store } from "redux";
import { connect } from "react-redux";
import ActionCreator from "../actions";
import {
CollectionsData,
PatronAuthServicesData,
SearchServicesData,
} from "../interfaces";
import { CollectionsData, PatronAuthServicesData } from "../interfaces";
import { RootState } from "../store";
import LoadingIndicator from "@thepalaceproject/web-opds-client/lib/components/LoadingIndicator";
import ErrorMessage from "./ErrorMessage";
Expand All @@ -32,7 +28,7 @@ export interface SelfTestsTabContainerOwnProps extends TabContainerProps {

export interface SelfTestsTabContainerStateProps {
fetchError?: FetchErrorData;
items?: CollectionsData | PatronAuthServicesData | SearchServicesData;
items?: CollectionsData | PatronAuthServicesData;
isLoaded?: boolean;
}

Expand All @@ -54,7 +50,6 @@ export class SelfTestsTabContainer extends TabContainer<
DISPLAY_NAMES = {
collections: "Collections",
patronAuthServices: "Patron Authentication",
searchServices: "Search Service Configuration",
metadataServices: "Metadata Services",
};

Expand All @@ -80,7 +75,7 @@ export class SelfTestsTabContainer extends TabContainer<

getNames(category: string): string[] {
// The name used to look up data in the store: "collections",
// "patron_auth_services", "search_services".
// "patron_auth_services".
const keyName = category
.split(/(?=[A-Z])/)
.map((w) => w.toLowerCase())
Expand Down Expand Up @@ -134,12 +129,7 @@ function mapStateToProps(state, ownProps: SelfTestsTabContainerOwnProps) {

function mapDispatchToProps(dispatch, ownProps: SelfTestsTabContainerOwnProps) {
const actions = new ActionCreator();
const itemTypes = [
"Collections",
"PatronAuthServices",
"SearchServices",
"MetadataServices",
];
const itemTypes = ["Collections", "PatronAuthServices", "MetadataServices"];
return {
fetchItems: () =>
itemTypes.forEach((type) => dispatch(actions["fetch" + type]())),
Expand Down
7 changes: 1 addition & 6 deletions src/components/TroubleshootingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,7 @@ export default class TroubleshootingPage extends React.Component<

CATEGORIES = {
diagnostics: ["coverage_provider", "script", "monitor", "other"],
"self-tests": [
"collections",
"patronAuthServices",
"searchServices",
"metadataServices",
],
"self-tests": ["collections", "patronAuthServices", "metadataServices"],
};

constructor(props) {
Expand Down
4 changes: 0 additions & 4 deletions src/components/__tests__/ConfigTabContainer-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import IndividualAdmins from "../IndividualAdmins";
import PatronAuthServices from "../PatronAuthServices";
import SitewideSettings from "../SitewideSettings";
import MetadataServices from "../MetadataServices";
import SearchServices from "../SearchServices";
import CatalogServices from "../CatalogServices";
import DiscoveryServices from "../DiscoveryServices";
import SitewideAnnouncements from "../SitewideAnnouncements";
Expand Down Expand Up @@ -68,7 +67,6 @@ describe("ConfigTabContainer", () => {
PatronAuthServices,
SitewideSettings,
MetadataServices,
SearchServices,
CatalogServices,
DiscoveryServices,
SitewideAnnouncements,
Expand Down Expand Up @@ -135,7 +133,6 @@ describe("ConfigTabContainer", () => {
PatronAuthServices,
SitewideSettings,
MetadataServices,
SearchServices,
CatalogServices,
DiscoveryServices,
SitewideAnnouncements,
Expand Down Expand Up @@ -186,7 +183,6 @@ describe("ConfigTabContainer", () => {
PatronAuthServices,
SitewideSettings,
MetadataServices,
SearchServices,
CatalogServices,
DiscoveryServices,
SitewideAnnouncements,
Expand Down
19 changes: 4 additions & 15 deletions src/components/__tests__/SelfTestsTabContainer-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe("SelfTestsTabContainer", () => {
const nav = wrapper.find(".nav-tabs").at(0);
expect(nav.length).to.equal(1);
const tabs = nav.find("li");
expect(tabs.length).to.equal(4);
expect(tabs.length).to.equal(3);

const collectionsTab = tabs.at(0);
expect(collectionsTab.text()).to.equal("Collections");
Expand All @@ -73,22 +73,17 @@ describe("SelfTestsTabContainer", () => {
expect(patronAuthTab.text()).to.equal("Patron Authentication");
expect(patronAuthTab.hasClass("active")).to.be.false;

const searchTab = tabs.at(2);
expect(searchTab.text()).to.equal("Search Service Configuration");
expect(searchTab.hasClass("active")).to.be.false;

const metadataTab = tabs.at(3);
const metadataTab = tabs.at(2);
expect(metadataTab.text()).to.equal("Metadata Services");
expect(metadataTab.hasClass("active")).to.be.false;
});

it("renders tab content", () => {
const contentComponents = wrapper.find(".tab-content > div");
expect(contentComponents.length).to.equal(4);
expect(contentComponents.length).to.equal(3);
const [
collectionsContent,
patronAuthContent,
searchContent,
metadataContent,
] = contentComponents.map((c) => c.childAt(0));

Expand All @@ -98,7 +93,6 @@ describe("SelfTestsTabContainer", () => {
expect(collectionsContent.find(".self-tests-category").length).to.equal(1);

expect(patronAuthContent.find(LoadingIndicator).length).to.equal(1);
expect(searchContent.find(LoadingIndicator).length).to.equal(1);
expect(metadataContent.find(LoadingIndicator).length).to.equal(1);
});

Expand All @@ -114,7 +108,7 @@ describe("SelfTestsTabContainer", () => {
wrapper.setProps({ fetchError });

error = wrapper.find(ErrorMessage);
expect(error.length).to.equal(4);
expect(error.length).to.equal(3);
});

it("calls goToTab", () => {
Expand Down Expand Up @@ -163,11 +157,6 @@ describe("SelfTestsTabContainer", () => {
"patron_auth_service",
"patronAuth",
]);
expect(wrapper.instance().getNames("searchServices")).to.eql([
"search_services",
"search_service",
"search",
]);
expect(wrapper.instance().getNames("metadataServices")).to.eql([
"metadata_services",
"metadata_service",
Expand Down
6 changes: 0 additions & 6 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,12 +376,6 @@ export interface MetadataServicesData extends ServicesData {
metadata_services: MetadataServiceData[];
}

export interface SearchServiceData extends ServiceData {}

export interface SearchServicesData extends ServicesData {
search_services: SearchServiceData[];
}

export interface CatalogServiceData extends ServiceData {}

export interface CatalogServicesData extends ServicesData {
Expand Down
4 changes: 0 additions & 4 deletions src/reducers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import patronAuthServices from "./patronAuthServices";
import sitewideAnnouncements from "./sitewideAnnouncements";
import sitewideSettings from "./sitewideSettings";
import metadataServices from "./metadataServices";
import searchServices from "./searchServices";
import catalogServices from "./catalogServices";
import discoveryServices from "./discoveryServices";
import registerLibraryWithDiscoveryService from "./registerLibraryWithDiscoveryService";
Expand Down Expand Up @@ -50,7 +49,6 @@ import {
SitewideAnnouncementsData,
SitewideSettingsData,
MetadataServicesData,
SearchServicesData,
CatalogServicesData,
DiscoveryServicesData,
LibraryRegistrationsData,
Expand Down Expand Up @@ -82,7 +80,6 @@ export interface State {
sitewideAnnouncements: FetchEditState<SitewideAnnouncementsData>;
sitewideSettings: FetchEditState<SitewideSettingsData>;
metadataServices: FetchEditState<MetadataServicesData>;
searchServices: FetchEditState<SearchServicesData>;
catalogServices: FetchEditState<CatalogServicesData>;
discoveryServices: FetchEditState<DiscoveryServicesData>;
registerLibraryWithDiscoveryService: RegisterLibraryState;
Expand Down Expand Up @@ -123,7 +120,6 @@ export default combineReducers<State>({
sitewideAnnouncements,
sitewideSettings,
metadataServices,
searchServices,
catalogServices,
discoveryServices,
registerLibraryWithDiscoveryService,
Expand Down
10 changes: 0 additions & 10 deletions src/reducers/searchServices.ts

This file was deleted.

0 comments on commit e7fc07d

Please sign in to comment.