gawati / gawati-editor-ui

Gawati Client
GNU Affero General Public License v3.0
0 stars 0 forks source link

Metadata panel for metadata entry #34

Open kohsah opened 6 years ago

kohsah commented 6 years ago

1) Add a Tab Panel to DocumentForm that has a ReactSelect control .

2) The React Select should query the set of keyword metadata from current documents, and show them for selection. An additional options should allow looking up the portal data set (on the portal-ui system):

3) This is how the keywords are stored in the XML ...

           <an:classification source="#legacy">
                <an:keyword eId="ontology.dictionary.gawati.legacy.InternationalLaw" value="InternationalLaw" showAs="International Law" dictionary="#gawati-legacy"/>
                <an:keyword eId="ontology.dictionary.gawati.legacy.Treaty/Treaties" value="Treaty/Treaties" showAs="Treaty / Treaties" dictionary="#gawati-legacy"/>
                <an:keyword eId="ontology.dictionary.gawati.legacy.Agreement" value="Agreement" showAs="Agreement" dictionary="#gawati-legacy"/>
                <an:keyword eId="ontology.dictionary.gawati.legacy.Government" value="Government" showAs="Government" dictionary="#gawati-legacy"/>
            </an:classification>

The metadata panel allows such a block (or adding this ) in a document loaded into the editor.

kohsah commented 6 years ago

@surajpt - SubIssue1

getting this error, "Add Document" -> Click on "Metadata" tab in form :

TypeError: Cannot read property 'keyword' of undefined
ClassificationMetadataForm._this.renderClassificationForm
D:/develop/github/gawati/gawati-client/src/views/forms/ClassificationMetadataForm.js:105
  102 | renderClassificationForm = () => {
  103 |     const docClassifications = this.props.pkg.pkgIdentity.docClassifications;
  104 |     let result;
> 105 |     if(docClassifications.keyword!==undefined && docClassifications.keyword.length>0){
  106 |         result = this.renderClassifications(docClassifications.keyword);
  107 |     }else{
  108 |         result = this.renderNoClassifications();
View compiled
ClassificationMetadataForm._this.render
D:/develop/github/gawati/gawati-client/src/views/forms/ClassificationMetadataForm.js:132
  129 |     }
  130 | 
  131 |     render = () => {
> 132 |         return this.renderClassificationForm();
  133 |     }
  134 |   
  135 | };
View compiled
▶ 16 stack frames were collapsed.
This screen is visible only in development. It will not appear if the app crashes in production.
Open your browser’s developer console to further inspect this error.
kohsah commented 6 years ago

@surajpt - SubIssue2

image

kohsah commented 6 years ago

@surajpt - SubIssue3

Editing an existing document... attempted to type in add more metadata field, got this error immediately:

×
TypeError: Cannot read property 'length' of undefined
ClassificationMetadataForm._this.renderClassificationForm
D:/develop/github/gawati/gawati-client/src/views/forms/ClassificationMetadataForm.js:112
  109 |        }
  110 | 
  111 |        let metadataArray = [];
> 112 |        for(let i=0; i<this.state.metadata.length;i++){
  113 |            metadataArray.push({value:this.state.metadata[i].value, label:this.state.metadata[i].showAs});
  114 |        }
  115 | 
View compiled
ClassificationMetadataForm._this.render
D:/develop/github/gawati/gawati-client/src/views/forms/ClassificationMetadataForm.js:132
  129 |     }
  130 | 
  131 |     render = () => {
> 132 |         return this.renderClassificationForm();
  133 |     }
  134 |   
  135 | };
View compiled
▶ 18 stack frames were collapsed.
(anonymous function)
D:/develop/github/gawati/gawati-client/src/views/forms/ClassificationMetadataForm.js:64
  61 | axios.get(apiMetadata, {
  62 | }) 
  63 | .then(response => {
> 64 |     this.setState({ metadata: response.data.metadata});
  65 |     console.log(response);
  66 | })
  67 | .catch(function(error) {
View compiled
kohsah commented 6 years ago

@surajpt Subissue3 i have fixed, there was an unclosed comment in your commit for gawati-client-data

kohsah commented 6 years ago

@surajpt Subissue4 - When i select an item in the list nothing happens...

metadata_sel