diff options
author | Angel Avila | 2014-06-05 19:30:31 +0000 |
---|---|---|
committer | Angel Avila | 2014-06-10 19:37:53 +0000 |
commit | 296e1843edd4efadd700217fed46ed7d86d2786d (patch) | |
tree | 0ffc32d180522fa46e2bf269c7ae73a14faf956c | |
parent | d3ccd25b3139f9e9ec4bed411c6c73501ff60960 (diff) | |
download | org.eclipse.osee-296e1843edd4efadd700217fed46ed7d86d2786d.tar.gz org.eclipse.osee-296e1843edd4efadd700217fed46ed7d86d2786d.tar.xz org.eclipse.osee-296e1843edd4efadd700217fed46ed7d86d2786d.zip |
feature[ats_63072]: Add PCR Type selection to Dispo GUI
Change-Id: Iac0d2509f168b3a92be188b4c0ed37d357ee7a0e
9 files changed, 162 insertions, 63 deletions
diff --git a/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/DispoAnnotationData.java b/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/DispoAnnotationData.java index aef456f6fd4..ba9edbd07f5 100644 --- a/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/DispoAnnotationData.java +++ b/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/DispoAnnotationData.java @@ -133,7 +133,11 @@ public class DispoAnnotationData implements Identifiable<String> { } public boolean isValid() { - return isConnected && isResolutionValid; + return isConnected && isResolutionValid && isResolutionTypeValid(); + } + + public boolean isResolutionTypeValid() { + return resolutionType != null && !resolutionType.equalsIgnoreCase("None") && !resolutionType.equalsIgnoreCase("null"); } public void disconnect() { diff --git a/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/importer/DispoItemDataCopierTest.java b/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/importer/DispoItemDataCopierTest.java index 2753cc9e54a..a751fc05613 100644 --- a/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/importer/DispoItemDataCopierTest.java +++ b/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/importer/DispoItemDataCopierTest.java @@ -132,6 +132,7 @@ public class DispoItemDataCopierTest { newAnnotation.setId(GUID.create()); newAnnotation.setLocationRefs(locationRef); newAnnotation.setResolution("C1234"); + newAnnotation.setResolutionType("C1234"); newAnnotation.setIsResolutionValid(true); newAnnotation.setDeveloperNotes("Notes"); dispoConnector.connectAnnotation(newAnnotation, discrepanciesList); diff --git a/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/internal/DispoApiTest.java b/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/internal/DispoApiTest.java index 504ffe08bcf..1fa31247935 100644 --- a/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/internal/DispoApiTest.java +++ b/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/internal/DispoApiTest.java @@ -31,7 +31,6 @@ import org.eclipse.osee.disposition.model.DispoSetData; import org.eclipse.osee.disposition.model.DispoSetDescriptorData; import org.eclipse.osee.framework.core.data.IOseeBranch; import org.eclipse.osee.framework.jdk.core.type.Identifiable; -import org.eclipse.osee.framework.jdk.core.type.Pair; import org.eclipse.osee.framework.jdk.core.type.ResultSet; import org.eclipse.osee.framework.jdk.core.type.ResultSets; import org.eclipse.osee.orcs.data.ArtifactId; @@ -278,8 +277,7 @@ public class DispoApiTest { // Only need to createUpdatedItem with updateStatus = True when annotation is valid and current status is INCOMPLETE annotationToCreate.setResolution("VALID"); when(dispoItem.getStatus()).thenReturn("COMPLETE"); - Pair<Boolean, String> validationResults = new Pair<Boolean, String>(true, "CODE"); - when(validator.validate(Matchers.any(DispoAnnotationData.class))).thenReturn(validationResults); + when(validator.validate(Matchers.any(DispoAnnotationData.class))).thenReturn(true); String acutal = dispoApi.createDispoAnnotation(program, itemId.getGuid(), annotationToCreate, "name"); assertEquals(expectedId, acutal); @@ -376,19 +374,23 @@ public class DispoApiTest { // reset loc ref to null and set new (invalid) resolution newAnnotation.setLocationRefs(null); - Pair<Boolean, String> valdiationResult = new Pair<Boolean, String>(true, "C"); - when(validator.validate(Matchers.any(DispoAnnotationData.class))).thenReturn(valdiationResult); + when(validator.validate(Matchers.any(DispoAnnotationData.class))).thenReturn(true); newAnnotation.setResolution("CPCR 13"); actual = dispoApi.editDispoAnnotation(program, itemId.getGuid(), expectedId, newAnnotation, "name"); assertTrue(actual); - newAnnotation.setResolution("VALID"); // Since PCR validation isn't hooked up yet, only valid resolution is "VALID" + // reset the resolution and change just the resolution type + newAnnotation.setLocationRefs(null); + when(validator.validate(Matchers.any(DispoAnnotationData.class))).thenReturn(true); + newAnnotation.setResolution(null); + newAnnotation.setResolutionType("None"); actual = dispoApi.editDispoAnnotation(program, itemId.getGuid(), expectedId, newAnnotation, "name"); assertTrue(actual); // notes are the only thing being modified, no need to disconnect or connect newAnnotation.setLocationRefs(null); newAnnotation.setResolution(null); + newAnnotation.setResolutionType(null); newAnnotation.setDeveloperNotes(""); actual = dispoApi.editDispoAnnotation(program, itemId.getGuid(), expectedId, newAnnotation, "name"); assertTrue(actual); diff --git a/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/internal/DispoConnectorTest.java b/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/internal/DispoConnectorTest.java index c67031780c9..1a008e24101 100644 --- a/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/internal/DispoConnectorTest.java +++ b/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/internal/DispoConnectorTest.java @@ -84,6 +84,7 @@ public class DispoConnectorTest { DispoAnnotationData annotationOne = new DispoAnnotationData(); annotationOne.setLocationRefs("1-5, 12-18, 20"); annotationOne.setIsResolutionValid(true); + annotationOne.setResolutionType("Code"); annotationOne.setId(annotIdOne); JSONArray idsOfCoveredDisc = new JSONArray(); annotationOne.setIdsOfCoveredDiscrepancies(idsOfCoveredDisc); @@ -116,6 +117,8 @@ public class DispoConnectorTest { // This will test a single annotation that covers most but not all discrepancies DispoAnnotationData annotationOne = new DispoAnnotationData(); annotationOne.setLocationRefs("1-5, 12-18"); + annotationOne.setIsResolutionValid(true); + annotationOne.setResolutionType("Code"); annotationOne.setId(annotIdOne); JSONArray idsOfCoveredDisc = new JSONArray(); annotationOne.setIdsOfCoveredDiscrepancies(idsOfCoveredDisc); @@ -211,6 +214,7 @@ public class DispoConnectorTest { JSONArray idsOfCoveredDisc = new JSONArray(); annotationOne.setIdsOfCoveredDiscrepancies(idsOfCoveredDisc); annotationOne.setIsResolutionValid(true); + annotationOne.setResolutionType("OTHER"); annotationOne.setId(annotIdOne); dispoConnector.connectAnnotation(annotationOne, dispoItem.getDiscrepanciesList()); @@ -228,6 +232,7 @@ public class DispoConnectorTest { annotationOne.setLocationRefs("1-5"); annotationOne.setId(annotIdOne); annotationOne.setIsResolutionValid(true); + annotationOne.setResolutionType("test"); JSONArray idsOfCoveredDiscOne = new JSONArray(); annotationOne.setIdsOfCoveredDiscrepancies(idsOfCoveredDiscOne); annotationsAsList.add(annotationToJsonObj(annotationOne)); @@ -236,6 +241,7 @@ public class DispoConnectorTest { annotationTwo.setLocationRefs("12-18"); annotationTwo.setId(annotIdTwo); annotationTwo.setIsResolutionValid(true); + annotationTwo.setResolutionType("Req"); JSONArray idsOfCoveredDiscTwo = new JSONArray(); annotationTwo.setIdsOfCoveredDiscrepancies(idsOfCoveredDiscTwo); annotationsAsList.add(annotationToJsonObj(annotationTwo)); @@ -244,6 +250,7 @@ public class DispoConnectorTest { annotationThree.setLocationRefs("20"); annotationThree.setId(annotIdThree); annotationThree.setIsResolutionValid(true); + annotationThree.setResolutionType("Undetermined"); JSONArray idsOfCoveredDiscThree = new JSONArray(); annotationThree.setIdsOfCoveredDiscrepancies(idsOfCoveredDiscThree); annotationsAsList.add(annotationToJsonObj(annotationThree)); @@ -285,6 +292,7 @@ public class DispoConnectorTest { annotationOne.setLocationRefs("5, 1-3"); annotationOne.setId(annotIdOne); annotationOne.setIsResolutionValid(true); + annotationOne.setResolutionType("CODE"); JSONArray idsOfCoveredDiscOne = new JSONArray(); annotationOne.setIdsOfCoveredDiscrepancies(idsOfCoveredDiscOne); @@ -292,6 +300,7 @@ public class DispoConnectorTest { annotationTwo.setLocationRefs("12-15"); annotationTwo.setId(annotIdTwo); annotationTwo.setIsResolutionValid(true); + annotationTwo.setResolutionType("CODE"); JSONArray idsOfCoveredDiscTwo = new JSONArray(); annotationTwo.setIdsOfCoveredDiscrepancies(idsOfCoveredDiscTwo); @@ -300,6 +309,7 @@ public class DispoConnectorTest { annotationThree.setId(annotIdThree); JSONArray idsOfCoveredDiscThree = new JSONArray(); annotationThree.setIsResolutionValid(true); + annotationThree.setResolutionType("CODE"); annotationThree.setIdsOfCoveredDiscrepancies(idsOfCoveredDiscThree); DispoAnnotationData annotationFour = new DispoAnnotationData(); @@ -307,6 +317,7 @@ public class DispoConnectorTest { annotationFour.setId(annotIdFour); JSONArray idsOfCoveredDiscFour = new JSONArray(); annotationFour.setIsResolutionValid(true); + annotationFour.setResolutionType("CODE"); annotationFour.setIdsOfCoveredDiscrepancies(idsOfCoveredDiscFour); DispoAnnotationData annotationFive = new DispoAnnotationData(); @@ -314,6 +325,7 @@ public class DispoConnectorTest { annotationFive.setId(annotIdFive); JSONArray idsOfCoveredDiscFive = new JSONArray(); annotationFive.setIsResolutionValid(true); + annotationFive.setResolutionType("CODE"); annotationFive.setIdsOfCoveredDiscrepancies(idsOfCoveredDiscFive); JSONObject discrepanciesList = dispoItem.getDiscrepanciesList(); diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoApiImpl.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoApiImpl.java index e0db60818e1..4bdce8d2104 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoApiImpl.java +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoApiImpl.java @@ -35,7 +35,6 @@ import org.eclipse.osee.executor.admin.ExecutorAdmin; import org.eclipse.osee.framework.core.data.IOseeBranch; import org.eclipse.osee.framework.jdk.core.type.Identifiable; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; -import org.eclipse.osee.framework.jdk.core.type.Pair; import org.eclipse.osee.framework.jdk.core.type.ResultSet; import org.eclipse.osee.framework.jdk.core.util.Strings; import org.eclipse.osee.logger.Log; @@ -131,14 +130,6 @@ public class DispoApiImpl implements DispoApi { int indexOfAnnotation = annotationsList.length(); annotationToCreate.setIndex(indexOfAnnotation); - String resolution = annotationToCreate.getResolution(); - Pair<Boolean, String> resolutionValidAndType = new Pair<Boolean, String>(false, "NONE"); - if (resolution != null) { - resolutionValidAndType = validateResolution(annotationToCreate); - } - annotationToCreate.setIsResolutionValid(resolutionValidAndType.getFirst()); - annotationToCreate.setResolutionType(resolutionValidAndType.getSecond()); - JSONObject discrepanciesList = dispoItem.getDiscrepanciesList(); dispoConnector.connectAnnotation(annotationToCreate, discrepanciesList); @@ -243,23 +234,30 @@ public class DispoApiImpl implements DispoApi { consolidatedAnnotation.setCustomerNotes(newCustomerNotes); } + boolean needToReconnect = false; // now if the new Annotation modified the location Reference or resolution then disconnect the annotation and try to match it to discrepancies again String newLocationRefs = newAnnotation.getLocationRefs(); String newResolution = newAnnotation.getResolution(); - if (newLocationRefs != null || newResolution != null) { - if (newResolution != null) { - consolidatedAnnotation.setResolution(newResolution); - Pair<Boolean, String> resolutionValidAndType = validateResolution(consolidatedAnnotation); - consolidatedAnnotation.setIsResolutionValid(resolutionValidAndType.getFirst()); - consolidatedAnnotation.setResolutionType(resolutionValidAndType.getSecond()); - } - if (newLocationRefs != null) { - consolidatedAnnotation.setLocationRefs(newLocationRefs); - } + String newResolutionType = newAnnotation.getResolutionType(); + if (newResolution != null) { + consolidatedAnnotation.setResolution(newResolution); + consolidatedAnnotation.setIsResolutionValid(validateResolution(consolidatedAnnotation)); + needToReconnect = true; + } + if (newResolutionType != null) { + consolidatedAnnotation.setResolutionType(newAnnotation.getResolutionType()); + needToReconnect = true; + } + if (newLocationRefs != null) { + consolidatedAnnotation.setLocationRefs(newLocationRefs); + needToReconnect = true; + } + if (needToReconnect == true) { consolidatedAnnotation.disconnect(); dispoConnector.connectAnnotation(consolidatedAnnotation, discrepanciesList); } + // JSONObject annotationAsJsonObject = DispoUtil.annotationToJsonObj(consolidatedAnnotation); annotationsList.put(indexOfAnnotation, annotationAsJsonObject); @@ -441,7 +439,7 @@ public class DispoApiImpl implements DispoApi { return newList; } - private Pair<Boolean, String> validateResolution(DispoAnnotationData annotation) { + private boolean validateResolution(DispoAnnotationData annotation) { return resolutionValidator.validate(annotation); } diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoDataFactory.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoDataFactory.java index c9d8effbe45..d1b0797f321 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoDataFactory.java +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoDataFactory.java @@ -74,9 +74,10 @@ public class DispoDataFactory { public void initAnnotation(DispoAnnotationData annotationToInit) { annotationToInit.setIdsOfCoveredDiscrepancies(new JSONArray()); - annotationToInit.setCustomerNotes("--Enter Notes--"); - annotationToInit.setDeveloperNotes("--Enter Notes--"); + annotationToInit.setCustomerNotes(""); + annotationToInit.setDeveloperNotes(""); annotationToInit.setResolution(""); + annotationToInit.setResolutionType("None"); } public DispoItem createUpdatedItem(JSONArray annotationsList, JSONObject discrepanciesList) throws JSONException { diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoResolutionValidator.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoResolutionValidator.java index 1680a9d6cbd..1c998badd70 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoResolutionValidator.java +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoResolutionValidator.java @@ -11,7 +11,6 @@ package org.eclipse.osee.disposition.rest.internal; import org.eclipse.osee.disposition.model.DispoAnnotationData; -import org.eclipse.osee.framework.jdk.core.type.Pair; import org.eclipse.osee.logger.Log; /** @@ -33,34 +32,13 @@ public class DispoResolutionValidator { logger.trace("Stopping ResolutionValidator..."); } - public Pair<Boolean, String> validate(DispoAnnotationData annotation) { + public boolean validate(DispoAnnotationData annotation) { String pcr = annotation.getResolution().toUpperCase().trim(); boolean isValid = false; - String type = "NONE"; - if (pcr.matches("^\\s*[CTROU]\\d{4,6}\\s*$")) { + if (pcr.matches("^\\s*[a-zA-Z]{1,}\\s*\\d{1,}$")) { isValid = true; - if (pcr.startsWith("C")) { - type = "CODE"; - } else if (pcr.startsWith("T")) { - type = "TEST"; - } else if (pcr.startsWith("R")) { - type = "REQ"; - } else if (pcr.startsWith("O")) { - type = "OTHER"; - } else if (pcr.startsWith("U")) { - type = "UNDETERMINED"; - } } - boolean isOpen = checkStatus(pcr); - - Pair<Boolean, String> toReturn = new Pair<Boolean, String>(isOpen && isValid, type); - return toReturn; - } - - private boolean checkStatus(String pcrNumber) { - // Default is true for now - // Will implement ATS validation later to check status of RPCR against DB - return true; + return isValid; } } diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/util/DispoHtmlWriter.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/util/DispoHtmlWriter.java index c16d09be1a4..a7eec376f53 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/util/DispoHtmlWriter.java +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/util/DispoHtmlWriter.java @@ -40,6 +40,7 @@ public class DispoHtmlWriter { private final String subTableHeadersEnd ="\" width=\"30\"></th>"+ "<th width=\"325\">Points</th>"+ + "<th width=\"75\">Type</th>"+ "<th width=\"150\">PCR</th>"+ "<th width=\"500\">Developer Notes</th>"+ "<th width=\"500\">Customer Notes</th>"+ @@ -139,9 +140,6 @@ public class DispoHtmlWriter { public String createSetTable(Iterable<DispoItem> dispoItems) throws IOException, JSONException { StringBuilder writer = new StringBuilder(); for (DispoItem item : dispoItems) { - if (item.getName().equalsIgnoreCase("WPS_X_wps_weapon_weight_moment_drag_download_processing_rkt3")) { - System.out.println(""); - } writer.append("<tr id=\""); writer.append(item.getGuid()); if (item.getStatus().equals(DispoStrings.Item_Pass)) { @@ -214,10 +212,45 @@ public class DispoHtmlWriter { appendable.append("</textarea></td>"); } + private void addSubTableDataDropDown(Appendable appendable, String data, boolean isValid) throws IOException { + appendable.append("<td class=\"annotationData\" >"); + if (isValid) { + appendable.append("<select class=\"annotationInput"); + } else { + appendable.append("<select class=\"annotationInputInvalid"); + } + appendable.append("\" onchange=\"submitAnnotationData(this);\">"); + + addOptionToSelect(appendable, data, "None", true); + addOptionToSelect(appendable, data, "Code", false); + addOptionToSelect(appendable, data, "Test", false); + addOptionToSelect(appendable, data, "Requirement", false); + addOptionToSelect(appendable, data, "Other", false); + addOptionToSelect(appendable, data, "Undetermined", false); + + appendable.append(data); + appendable.append("</select></td>"); + } + + private void addOptionToSelect(Appendable appendable, String data, String optionValue, boolean isDefault) throws IOException { + appendable.append("<option value=\""); + appendable.append(optionValue); + appendable.append("\""); + if (data.equalsIgnoreCase(optionValue)) { + appendable.append(" selected"); + } + if (isDefault) { + appendable.append(" disabled"); + } + appendable.append(">"); + appendable.append(optionValue); + appendable.append("</option>"); + } + // @formatter:off public String createSubTable(List<DispoAnnotationData> annotations) throws IOException { StringBuilder sb = new StringBuilder(); - sb.append("<td colspan=\"8\">"); + sb.append("<td colspan=\"9\">"); sb.append("<table class=\"table subTable\">"); sb.append(createHeadersForSubTable(annotations.size())); for(DispoAnnotationData annotation :annotations) { @@ -228,7 +261,12 @@ public class DispoHtmlWriter { if(!annotation.getResolution().isEmpty() && !annotation.getIsResolutionValid()){ isResolutionValid = false; } + boolean isResolutionTypeValid = true; + if(!annotation.isResolutionTypeValid()){ + isResolutionTypeValid = false; + } addSubTableData(sb, annotation.getLocationRefs(), annotation.getIsConnected()); + addSubTableDataDropDown(sb, annotation.getResolutionType(), isResolutionTypeValid); addSubTableData(sb, annotation.getResolution(), isResolutionValid); addSubTableData(sb, annotation.getDeveloperNotes(), true); addSubTableData(sb, annotation.getCustomerNotes(), true); @@ -238,6 +276,12 @@ public class DispoHtmlWriter { // add on empty row sb.append("<tr>"); sb.append("<td class=\"annotationData\"><textarea class=\"annotationInput\" onchange=\"submitAnnotationData(this);\" ondblclick=\"annotationDblClick(this);\"></textarea></d>"); + sb.append("<td class=\"annotationData\"><select class=\"annotationInputDisabled\" onchange=\"submitAnnotationData(this);\" ondblclick=\"annotationDblClick(this);\" disabled>"); + sb.append("<option value=\"None\" selected>None</option>"); + sb.append("<option value=\"Code\">Code</option><option value=\"Test\">Test</option>"); + sb.append("<option value=\"Requirement\">Requirement</option><option value=\"Other\">Other</option>"); + sb.append("<option value=\"Undetermined\">Undetermined</option>"); + sb.append("</select></td>"); sb.append("<td class=\"annotationData\"><textarea class=\"annotationInputDisabled\" onchange=\"submitAnnotationData(this);\" ondblclick=\"annotationDblClick(this);\" readonly=\"true\"></textarea></td>"); sb.append("<td class=\"annotationData\"><textarea class=\"annotationInputDisabled\" onchange=\"submitAnnotationData(this);\" ondblclick=\"annotationDblClick(this);\" readonly=\"true\"></textarea></td>"); sb.append("<td class=\"annotationData\"><textarea class=\"annotationInputDisabled\" onchange=\"submitAnnotationData(this);\" ondblclick=\"annotationDblClick(this);\" readonly=\"true\"></textarea></td>"); diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/util/html/dispo.html b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/util/html/dispo.html index 1146b67379d..768920d0eb2 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/util/html/dispo.html +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/util/html/dispo.html @@ -64,7 +64,7 @@ var programSelect = document.getElementById("programSelect"); var setSelect = document.getElementById("setSelect"); var path = "http://<?serverPort?>/dispo/program/"; - var cellsToValueSubTable = ["locationRefs", "resolution", "developerNotes", "customerNotes"]; + var cellsToValueSubTable = ["locationRefs", "resolutionType", "resolution", "developerNotes", "customerNotes"]; var cellsToValueMainTable = ["itemName", "status", "totalPoints", "failures", "discrepancyLocations", "POC", "version"]; var dispoTableBody = document.getElementById("dispoTableBody"); var dispoTable = document.getElementById("dispoTable"); @@ -326,6 +326,9 @@ var value = selectedElement.value; var key = cellsToValueSubTable[cellIndex]; + if(key == 'resolutionType') { + value = value.toUpperCase(); + } var jsonObject = {}; jsonObject[key] = value; @@ -470,9 +473,6 @@ var itemObject = eval('(' + this.responseText + ')'); var statusCell = itemRow.cells[1]; - if (statusCell.innerHTML != itemObject.status) { - - } statusCell.innerHTML = itemObject.status; @@ -497,6 +497,13 @@ annotationRow.cells[0].firstChild.className = "annotationInput"; } if (!annotationObject.isResolutionValid) { + annotationRow.cells[1].firstChild.className = "annotationInputInvalid"; + annotationRow.cells[2].firstChild.className = "annotationInputInvalid"; + } else { + annotationRow.cells[1].firstChild.className = "annotationInput"; + annotationRow.cells[2].firstChild.className = "annotationInput"; + } + if (annotationObject.resolutionType == "None") { annotationRow.cells[1].firstChild.className = "annotationInputInvalid"; } else { annotationRow.cells[1].firstChild.className = "annotationInput"; @@ -669,6 +676,50 @@ } </script> <script> + function addAnnotationCellSelect(rowElement, index) { + var newCell = rowElement.insertCell(index); + newCell.className = "annotationData"; + var newSelect = document.createElement("select"); + newCell.appendChild(newSelect); + + newSelect.disabled = true; + newSelect.className = "annotationInputDisabled"; + + optionText = "None"; + addOptionToSelect(newSelect, optionText, "None", true); + + var optionText = "Code"; + addOptionToSelect(newSelect, optionText, optionText, false); + + optionText = "Test"; + addOptionToSelect(newSelect, optionText, optionText, false); + + optionText = "Requirement"; + addOptionToSelect(newSelect, optionText, optionText, false); + + optionText = "Other"; + addOptionToSelect(newSelect, optionText, optionText, false); + + optionText = "Undetermined"; + addOptionToSelect(newSelect, optionText, optionText, false); + + newSelect.setAttribute('onchange', 'submitAnnotationData(this);'); + + newSelect.focus(); + } +</script> +<script> + function addOptionToSelect(selectEl, optionText, optionValue, isDefault) { + var newOption = document.createElement("option"); + newOption.text = optionText; + newOption.value = optionValue; + if(isDefault) { + newOption.selected = true; + } + selectEl.add(newOption); + } +</script> +<script> function addNewRow(currentRow) { var subTable = currentRow.parentNode.parentNode; var newRow = subTable.insertRow(currentRow.rowIndex + 1); @@ -679,7 +730,11 @@ var cellsLength = currentRow.cells.length; for (index = 0; index < cellsLength - 1; index++) { - addAnnotationCell(newRow, index); + if(index != 1) { // + addAnnotationCell(newRow, index); + } else { + addAnnotationCellSelect(newRow, index); + } } addDeleteButton(newRow, cellsLength); @@ -692,6 +747,10 @@ for (index = 0; index < cellsLength - 1; index++) { var inputEl = annotationCells[index].firstChild; inputEl.readOnly = false; + if(index == 1) { // if it's the Type element enable and set to focus + inputEl.disabled = false; + inputEl.focus(); + } inputEl.className = "annotationInput"; } annotationCells[cellsLength - 1].firstChild.disabled = false; // enable Delete Button |