Skip to content

Commit

Permalink
feat: exclude observation join id from standard and author categories (
Browse files Browse the repository at this point in the history
…#674)

* exclude observation join id

* don't commit package.json changes

* add stuff back in

* reorder

* fix explorer local dev
  • Loading branch information
joyceyan authored Oct 31, 2023
1 parent 64316e0 commit 8661a4e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<script type="text/javascript">
window.CELLXGENE = {};
window.CELLXGENE.API = {
prefix: `http://localhost:<%= CXG_SERVER_PORT %>${location.pathname}/api/`,
prefix: `http://localhost:<%= CXG_SERVER_PORT %>${location.pathname}api/`,
version: "v0.3/",
};
</script>
Expand Down
2 changes: 2 additions & 0 deletions client/src/common/types/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export const STANDARD_CATEGORY_NAMES = [
"donor_id",
];

export const EXCLUDED_CATEGORY_NAMES = ["observation_joinid"];

/**
* Author of publication associated with a collection, populated from Crossref as part of collection publication
* metadata.
Expand Down
23 changes: 18 additions & 5 deletions client/src/components/categorical/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import React from "react";
import { connect } from "react-redux";
import * as globals from "../../globals";
import Category from "./category";
import { STANDARD_CATEGORY_NAMES } from "../../common/types/entities";
import {
EXCLUDED_CATEGORY_NAMES,
STANDARD_CATEGORY_NAMES,
} from "../../common/types/entities";
import {
CategoricalAnnotationColumnSchema,
Schema,
Expand All @@ -27,19 +30,23 @@ class Categories extends React.Component<{}, State> {
super(props);
this.state = {
createAnnoModeActive: false,
// eslint-disable-next-line react/no-unused-state --- FIXME: disabled temporarily
newCategoryText: "",
// eslint-disable-next-line react/no-unused-state --- FIXME: disabled temporarily
categoryToDuplicate: null,
expandedCats: new Set(),
};
}

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
handleChange = (name: any) => {
// eslint-disable-next-line react/no-unused-state --- FIXME: disabled temporarily
this.setState({ newCategoryText: name });
};

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
handleSelect = (name: any) => {
// eslint-disable-next-line react/no-unused-state --- FIXME: disabled temporarily
this.setState({ newCategoryText: name });
};

Expand Down Expand Up @@ -93,6 +100,14 @@ class Categories extends React.Component<{}, State> {
isCategoryNameStandard = (catName: string): boolean =>
STANDARD_CATEGORY_NAMES.includes(catName);

/**
* Determine if category is excluded.
* @param catName - Name of category.
* @returns True if given category name is in the set of standard category names.
*/
isCategoryNameExcluded = (catName: string): boolean =>
EXCLUDED_CATEGORY_NAMES.includes(catName);

/**
* Returns true if category is writable.
* @param schema - Matrix schema.
Expand All @@ -104,10 +119,7 @@ class Categories extends React.Component<{}, State> {

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types --- FIXME: disabled temporarily on migrate to TS.
render() {
const {
createAnnoModeActive,
expandedCats,
} = this.state;
const { createAnnoModeActive, expandedCats } = this.state;
// @ts-expect-error ts-migrate(2339) FIXME: Property 'schema' does not exis... Remove this comment to see the full error message
const { schema } = this.props;
/* Names for categorical, string and boolean types, sorted in display order. Will be rendered in this order */
Expand All @@ -121,6 +133,7 @@ class Categories extends React.Component<{}, State> {
const authorCategoryNames = selectableCategoryNames.filter(
(catName) =>
!this.isCategoryNameStandard(catName) &&
!this.isCategoryNameExcluded(catName) &&
(this.isCategoryDisplayable(schema, catName) ||
this.isCategoryWritable(schema, catName))
);
Expand Down

0 comments on commit 8661a4e

Please sign in to comment.