Skip to content

Commit

Permalink
feat(JAQPOT-180): add feature units
Browse files Browse the repository at this point in the history
  • Loading branch information
alarv committed Jul 17, 2024
1 parent 41fcb84 commit 3079151
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 23 deletions.
56 changes: 33 additions & 23 deletions src/app/api.schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ export interface paths {
* @description Retrieve a single model by its ID
*/
get: operations["getModelById"];
/**
* Delete a Model
* @description Delete a single model by its ID
*/
delete: operations["deleteModelById"];
};
"/v1/models/legacy/{id}": {
/**
* Get a legacy model
* @description Retrieve a single model by its ID
*/
get: operations["getLegacyModelById"];
/**
* Delete a Model
* @description Delete a single model by its ID
*/
delete: operations["deleteModelById"];
};
"/v1/models/{modelId}/predict": {
/**
Expand Down Expand Up @@ -216,6 +216,11 @@ export interface components {
* @example A feature name
*/
name: string;
/**
* @description A name for the feature that will appear on top of the form field
* @example A feature unit
*/
units?: string;
description?: string;
featureType: components["schemas"]["FeatureType"];
/**
Expand Down Expand Up @@ -505,22 +510,20 @@ export interface operations {
};
};
/**
* Get a legacy model
* @description Retrieve a single model by its ID
* Delete a Model
* @description Delete a single model by its ID
*/
getLegacyModelById: {
deleteModelById: {
parameters: {
path: {
/** @description The ID of the model to retrieve */
id: string;
/** @description The ID of the model to delete */
id: number;
};
};
responses: {
/** @description Successful Response */
200: {
content: {
"application/json": components["schemas"]["Model"];
};
/** @description Model deleted successfully */
204: {
content: never;
};
/** @description Model not found */
404: {
Expand All @@ -529,20 +532,22 @@ export interface operations {
};
};
/**
* Delete a Model
* @description Delete a single model by its ID
* Get a legacy model
* @description Retrieve a single model by its ID
*/
deleteModelById: {
getLegacyModelById: {
parameters: {
path: {
/** @description The ID of the model to delete */
id: number;
/** @description The ID of the model to retrieve */
id: string;
};
};
responses: {
/** @description Model deleted successfully */
204: {
content: never;
/** @description Successful Response */
200: {
content: {
"application/json": components["schemas"]["Model"];
};
};
/** @description Model not found */
404: {
Expand Down Expand Up @@ -675,6 +680,11 @@ export interface operations {
* @example Updated Feature Name
*/
name: string;
/**
* @description The units that this feature is using
* @example mg/L
*/
units?: string;
/** @example An updated description for this feature */
description?: string;
featureType: components["schemas"]["FeatureType"];
Expand Down
11 changes: 11 additions & 0 deletions src/app/dashboard/models/[modelId]/components/FeatureEditModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export default function FeatureEditModal({
>({
key: feature.key,
name: feature.name,
units: feature.units,
description: feature.description ?? '',
featureType: feature.featureType,
});
Expand Down Expand Up @@ -179,6 +180,16 @@ export default function FeatureEditModal({
isRequired
></Input>
</div>
<div>
<Input
label="Units"
name="units"
placeholder="Enter the feature units"
value={formData.units}
onChange={handleChange}
isDisabled={!isEdit}
></Input>
</div>
<div>
<Textarea
label="Description"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export default function FeaturesTab({ model }: FeaturesTabProps) {
<Table aria-label="Independent features table">
<TableHeader>
<TableColumn>Name</TableColumn>
<TableColumn>Units</TableColumn>
<TableColumn>Description</TableColumn>
<TableColumn>Type</TableColumn>
<TableColumn>Actions</TableColumn>
Expand All @@ -71,6 +72,7 @@ export default function FeaturesTab({ model }: FeaturesTabProps) {
{model.independentFeatures.map((independentFeature, index) => (
<TableRow key={index}>
<TableCell>{independentFeature.name}</TableCell>
<TableCell>{independentFeature.units}</TableCell>
<TableCell>
<div className="max-h-28 max-w-52 overflow-hidden text-ellipsis whitespace-nowrap">
{independentFeature.description}
Expand Down Expand Up @@ -102,6 +104,7 @@ export default function FeaturesTab({ model }: FeaturesTabProps) {
<Table aria-label="Dependent features table">
<TableHeader>
<TableColumn>Name</TableColumn>
<TableColumn>Units</TableColumn>
<TableColumn>Description</TableColumn>
<TableColumn>Type</TableColumn>
<TableColumn>Actions</TableColumn>
Expand All @@ -110,6 +113,7 @@ export default function FeaturesTab({ model }: FeaturesTabProps) {
{model.dependentFeatures.map((dependentFeature, index) => (
<TableRow key={index}>
<TableCell>{dependentFeature.name}</TableCell>
<TableCell>{dependentFeature.units}</TableCell>
<TableCell>{dependentFeature.description}</TableCell>
<TableCell>{dependentFeature.featureType}</TableCell>
<TableCell>
Expand Down

0 comments on commit 3079151

Please sign in to comment.