Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CollectionObjectType form's name field defaults to a picklist #5216

Closed
sharadsw opened this issue Aug 12, 2024 · 3 comments
Closed

CollectionObjectType form's name field defaults to a picklist #5216

sharadsw opened this issue Aug 12, 2024 · 3 comments
Assignees
Labels
1 - Bug Incorrect behavior of the product
Milestone

Comments

@sharadsw
Copy link
Contributor

Describe the bug
The name field in a CollectionObjectType form defaults to the picklist created in #5170 instead of a text field

To Reproduce
Steps to reproduce the behavior:

  1. Go to a CollectionObjectType form via the url (eg: http://localhost/specify/view/collectionobjecttype/new/)
  2. See the name field is a picklist

Expected behavior
The field needs to be a text field so users can add a new CollectionObjectType

Screenshots
image

@sharadsw sharadsw added the 1 - Bug Incorrect behavior of the product label Aug 12, 2024
@sharadsw sharadsw self-assigned this Aug 12, 2024
@sharadsw sharadsw modified the milestones: 7.9.7, 7.9.8 Aug 12, 2024
@sharadsw
Copy link
Contributor Author

We need to add a default viewdef for CollectionObjectType where name is defined as a text field. COType currently does not have a default and so it leads to a 404 error when Specify tries to render the form

GET http://localhost/context/view.json?name=CollectionObjectType 404 (Not Found)
Unable to find a view definition for the "CollectionObjectType" view

Specify tries to autogenerate the view which results in name defaulting to the frontend picklist.

PrepType has a similar field name which does not default to its corresponding frontend picklist because PrepType has a default viewdef where name is set as a text field. We need to do something similar to this for CollectionObjectType

// http://localhost/context/view.json?name=PrepType

{
  "name": "PrepType",
  "class": "edu.ku.brc.specify.datamodel.PrepType",
  "busrules": "edu.ku.brc.specify.datamodel.busrules.PrepTypeBusRules",
  "resourcelabels": "false",
  "altviews": {
    "PrepType View": {
      "name": "PrepType View",
      "viewdef": "PrepType",
      "mode": "view",
      "validated": "false"
    },
    "PrepType Edit": {
      "name": "PrepType Edit",
      "viewdef": "PrepType",
      "mode": "edit",
      "validated": "true",
      "default": "true"
    }
  },
  "viewdefs": {
    "PrepType": "<viewdef type=\"form\" name=\"PrepType\" class=\"edu.ku.brc.specify.datamodel.PrepType\" gettable=\"edu.ku.brc.af.ui.forms.DataGetterForObj\" settable=\"edu.ku.brc.af.ui.forms.DataSetterForObj\">\n            \n            <desc>PrepType Data Entry Form</desc>\n            <columnDef>p,3dlu,p,6dlu,p</columnDef>\n            <rowDef>p,2dlu,p</rowDef>\n            \n            <rows>\n                <row>\n                    <cell type=\"label\" labelfor=\"1\" label=\"Name\" />\n                    <cell type=\"field\" id=\"1\" name=\"name\" uitype=\"text\" isrequired=\"true\" /> \n                    <cell type=\"field\" id=\"2\" name=\"isLoanable\" label=\"Is Loanable\" uitype=\"checkbox\" />\n                </row>\n            </rows>\n        </viewdef>\n        \n        "
  },
  "view": "<view name=\"PrepType\" class=\"edu.ku.brc.specify.datamodel.PrepType\" busrules=\"edu.ku.brc.specify.datamodel.busrules.PrepTypeBusRules\" resourcelabels=\"false\">\n            <desc>The PrepType Object form.</desc>\n            <altviews>\n                <altview name=\"PrepType View\" viewdef=\"PrepType\" mode=\"view\" validated=\"false\" />\n                <altview name=\"PrepType Edit\" viewdef=\"PrepType\" mode=\"edit\" validated=\"true\" default=\"true\" />\n            </altviews>\n        </view>\n        \n        ",
  "viewsetName": "SystemSetup",
  "viewsetLevel": "Backstop",
  "viewsetSource": "disk",
  "viewsetId": null,
  "viewsetFile": "backstop/system.views.xml"
}

The other solution could be to modify frontend picklist behavior such that Specify forms do not default to it. However, I think adding a default viewdef would be better as I imagine we need to do that for most new geo tables anyway.

@CarolineDenis CarolineDenis modified the milestones: 7.9.8, 7.9.7 Aug 13, 2024
@sharadsw
Copy link
Contributor Author

Here's a viewdef that we could potentially use later on:

<viewdef name="CollectionObjectType" class="edu.ku.brc.specify.datamodel.CollectionObjectType" type="form" gettable="edu.ku.brc.af.ui.forms.DataGetterForObj" settable="edu.ku.brc.af.ui.forms.DataSetterForObj">
	<desc>The CollectionObjectType Table</desc>
	<enableRules/>
	<columnDef>p,2px,p,2px,p,2px,p,2px,p,2px,p,p:g</columnDef>
	<rowDef auto="true" cell="p" sep="2px"/>
	<rows>
		<row>
			<cell type="label" labelfor="1" label="Name"/>
			<cell type="field" id="1" name="name" uitype="text" isrequired="true"/>
			<cell type="label" labelfor="2" label="Taxon Tree Definition"/>
			<cell type="field" id="2" name="taxontreedef" uitype="querycbx" isrequired="true"/>
		</row>
	</rows>
</viewdef>

@CarolineDenis
Copy link
Contributor

closed in favor of #5258

@CarolineDenis CarolineDenis closed this as not planned Won't fix, can't repro, duplicate, stale Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 - Bug Incorrect behavior of the product
Projects
None yet
Development

No branches or pull requests

2 participants