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

Add new geo view def + missing default #5258

Open
CarolineDenis opened this issue Sep 4, 2024 · 5 comments · May be fixed by #5266
Open

Add new geo view def + missing default #5258

CarolineDenis opened this issue Sep 4, 2024 · 5 comments · May be fixed by #5266
Labels
1 - Request Improvements or extensions to existing behavior
Milestone

Comments

@CarolineDenis
Copy link
Contributor

CarolineDenis commented Sep 4, 2024

A) The TreeDefItem form definitions are missing uiType by default.

Steps to reproduce the behavior:
1. Go to App Resources -> New or existing Form Definition
2. Click show all tables and select any TreeDefItem
3. Click Create and select [treename]TreeDefItem (i.e. TaxonTreeDefItem) from under Copy default view definition
4. See "Required attribute uiType is missing" error for multiple fields

B) Create custom form definition for CoJo table to fix child relationship fields

The CoJo form view is not displaying the childcog and childco relationship fields because they are not required fields. The situation is that one of these child fields must to filled out, but not both. Given this situation, we cannot have both of the fields be required. We need to create a custom default form definition for the CoJo table so that these two fields appear.

C) Create viewset definitions for the new geo tables

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

@CarolineDenis
Copy link
Contributor Author

NOTES:
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.

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>

@emenslin
Copy link
Collaborator

emenslin commented Sep 5, 2024

I made some very simple draft forms on https://elizabethgeoswissforms-edge.test.specifysystems.org/specify for:

  • CollectionObjectType
  • CollectionObjectGroup
  • CollectionObjectGroupJoin
  • CollectionObjectGroupType
  • Geography, lithostrat, chronostrat, storage, and taxon tree def items

These all just only have the fields that said they are required in the schema so they're all probably missing fields but this is a start

@acwhite211
Copy link
Member

Here is a CoJo form with the childCog and childCo fields not being both required, allowing for just one to be filled out.

<viewdef name="CollectionObjectGroupJoin" class="edu.ku.brc.specify.datamodel.CollectionObjectGroupJoin" type="form" gettable="edu.ku.brc.af.ui.forms.DataGetterForObj" settable="edu.ku.brc.af.ui.forms.DataSetterForObj">
    <desc>The CollectionObjectGroupJoin 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="Is Primary"/>
            <cell type="field" id="1" name="isPrimary" uitype="checkbox" isrequired="false"/>
        </row>
        <row>
            <cell type="label" labelfor="2" label="Is Substrate"/>
            <cell type="field" id="2" name="isSubstrate" uitype="checkbox" isrequired="false"/>
        </row>
        <row>
            <cell type="label" labelfor="3" label="Precedence"/>
            <cell type="field" id="3" name="precedence" uitype="text" isrequired="false"/>
        </row>
        <row>
            <cell type="label" labelfor="4" label="Parent COG"/>
            <cell type="field" id="4" name="parentCog" uitype="querycbx" isrequired="true"/>
        </row>
        <row>
            <cell type="label" labelfor="5" label="Child Collection Object Group"/>
            <cell type="field" id="5" name="childCog" uitype="querycbx" isrequired="false"/>
            <cell type="label" labelfor="6" label="Child Collection Object"/>
            <cell type="field" id="6" name="childCo" uitype="querycbx" isrequired="false"/>
        </row>
        <row>
            <cell type="label" labelfor="7" label="Version"/>
            <cell type="field" id="7" name="version" uitype="text" isrequired="false"/>
            <cell type="label" labelfor="8" label="Timestamp Created"/>
            <cell type="field" id="8" name="timestampCreated" uitype="text" isrequired="false"/>
            <cell type="label" labelfor="9" label="Timestamp Modified"/>
            <cell type="field" id="9" name="timestampModified" uitype="text" isrequired="false"/>
        </row>
        <row>
            <cell type="label" labelfor="10" label="Text 1"/>
            <cell type="field" id="10" name="text1" uitype="text" isrequired="false"/>
            <cell type="label" labelfor="11" label="Text 2"/>
            <cell type="field" id="11" name="text2" uitype="text" isrequired="false"/>
            <cell type="label" labelfor="12" label="Text 3"/>
            <cell type="field" id="12" name="text3" uitype="text" isrequired="false"/>
        </row>
        <row>
            <cell type="label" labelfor="13" label="Integer 1"/>
            <cell type="field" id="13" name="integer1" uitype="text" isrequired="false"/>
            <cell type="label" labelfor="14" label="Integer 2"/>
            <cell type="field" id="14" name="integer2" uitype="text" isrequired="false"/>
            <cell type="label" labelfor="15" label="Integer 3"/>
            <cell type="field" id="15" name="integer3" uitype="text" isrequired="false"/>
        </row>
        <row>
            <cell type="label" labelfor="16" label="Yesno 1"/>
            <cell type="field" id="16" name="Yesno1" uitype="checkbox" isrequired="false"/>
            <cell type="label" labelfor="17" label="Yesno 2"/>
            <cell type="field" id="17" name="Yesno2" uitype="checkbox" isrequired="false"/>
            <cell type="label" labelfor="18" label="Yesno 3"/>
            <cell type="field" id="18" name="Yesno3" uitype="checkbox" isrequired="false"/>
        </row>
    </rows>
</viewdef>

Working on the formatting a bit more to look better.
image

Maybe we should wait for #5266 to be merged, and we can add this form definition into the static file config directory, maybe at specify/config/common/viewset_registry.xml? The other option would be doing a migration on the SpAppResourceData table, but that would be messy.

@sharadsw
Copy link
Contributor

Some more defaults we need to remember to add:

@grantfitzsimmons
Copy link
Member

Remember that we aren't solely establishing defaults for geology; we need to consult the advisory committee for feedback. We want this form to be informed by the forms and interfaces we've observed while also striving to meaningfully evolve them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 - Request Improvements or extensions to existing behavior
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

5 participants