Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngel Avila2017-07-14 00:37:02 +0000
committerAngel Avila2017-07-18 21:13:32 +0000
commitacc40bff70166d350d4a0be1c5dbd7f102fcccbe (patch)
tree03867f3d4066313c4a496b36511bb27c42e126c6 /plugins/org.eclipse.osee.web.ui
parent9e7798002986ae572a2070a763296651c1563b98 (diff)
downloadorg.eclipse.osee-acc40bff70166d350d4a0be1c5dbd7f102fcccbe.tar.gz
org.eclipse.osee-acc40bff70166d350d4a0be1c5dbd7f102fcccbe.tar.xz
org.eclipse.osee-acc40bff70166d350d4a0be1c5dbd7f102fcccbe.zip
feature: Add live count update for sub grid
Diffstat (limited to 'plugins/org.eclipse.osee.web.ui')
-rw-r--r--plugins/org.eclipse.osee.web.ui/src/coverage/ui/index.html1
-rw-r--r--plugins/org.eclipse.osee.web.ui/src/dispo/css/user.css10
-rw-r--r--plugins/org.eclipse.osee.web.ui/src/dispo/js/ColumnFactory.js9
-rw-r--r--plugins/org.eclipse.osee.web.ui/src/dispo/js/CoverageFactory.js277
-rw-r--r--plugins/org.eclipse.osee.web.ui/src/dispo/js/coverageController.js42
-rw-r--r--plugins/org.eclipse.osee.web.ui/src/dispo/js/userController.js241
-rw-r--r--plugins/org.eclipse.osee.web.ui/src/dispo/ui/index.html1
-rw-r--r--plugins/org.eclipse.osee.web.ui/src/dispo/views/dropdown.html2
8 files changed, 336 insertions, 247 deletions
diff --git a/plugins/org.eclipse.osee.web.ui/src/coverage/ui/index.html b/plugins/org.eclipse.osee.web.ui/src/coverage/ui/index.html
index b9f09f098ec..72b8ebf0859 100644
--- a/plugins/org.eclipse.osee.web.ui/src/coverage/ui/index.html
+++ b/plugins/org.eclipse.osee.web.ui/src/coverage/ui/index.html
@@ -33,6 +33,7 @@
<script src="/dispo/js/resizer.js"></script>
<script src="/dispo/js/dispoApp.js"></script>
<script src="/dispo/js/ColumnFactory.js"></script>
+ <script src="/dispo/js/CoverageFactory.js"></script>
<script src="/dispo/js/userController.js"></script>
<script src="/dispo/js/adminController.js"></script>
<script src="/dispo/js/mainController.js"></script>
diff --git a/plugins/org.eclipse.osee.web.ui/src/dispo/css/user.css b/plugins/org.eclipse.osee.web.ui/src/dispo/css/user.css
index 79951fd7bac..e74ec03d7f6 100644
--- a/plugins/org.eclipse.osee.web.ui/src/dispo/css/user.css
+++ b/plugins/org.eclipse.osee.web.ui/src/dispo/css/user.css
@@ -313,13 +313,19 @@ input.cellInput:focus{
}
.almost-complete-parent {
- background-color: orange;'
+ background-color: yellow;'
}
.some-complete-parent {
- background-color: yellow;'
+ background-color: orange;'
}
.complete-parent {
background-color: #7eff39;'
}
+
+.coverage-invalid {
+ border: 2px dashed #ff8a8a;
+}
+
+
diff --git a/plugins/org.eclipse.osee.web.ui/src/dispo/js/ColumnFactory.js b/plugins/org.eclipse.osee.web.ui/src/dispo/js/ColumnFactory.js
index b441bbc8ed3..aa75f402b61 100644
--- a/plugins/org.eclipse.osee.web.ui/src/dispo/js/ColumnFactory.js
+++ b/plugins/org.eclipse.osee.web.ui/src/dispo/js/ColumnFactory.js
@@ -1,6 +1,5 @@
app.factory('ColumnFactory', function() {
var ColumnFactory = {};
- this.selectedItem = { methodNumber: '0'}
ColumnFactory.getColumns = function(type, width) {
if(type == 'testScript'){
@@ -10,10 +9,6 @@ app.factory('ColumnFactory', function() {
}
}
- ColumnFactory.setSelectedItem = function(item) {
- this.selectedItem = item;
- }
-
ColumnFactory.setResolutionTypeArray = function(type, array) {
if(type == 'testScript') {
for(var i = 0; i < subGridColumnsTestScript.length; i++) {
@@ -366,7 +361,8 @@ app.factory('ColumnFactory', function() {
}
} ];
- var resolutionTmpl = '<div class="ui-grid-cell-contents placeholder" ng-class="{\'placeholder-parent\': !row.entity.isLeaf, \'complete-parent\': grid.appScope.isComplete(row.entity), \'none-complete-parent\': grid.appScope.isNoneComplete(row.entity), \'some-complete-parent\': grid.appScope.isSomeComplete(row.entity), \'almost-complete-parent\': grid.appScope.isAlmostComplete(row.entity) }" title="TOOLTIP">{{ grid.appScope.getTextResolution(row.entity) }}</div>';
+ var textCoverageTmpl = '<div class="ui-grid-cell-contents" title="TOOLTIP">{{ grid.appScope.getTextCoverage(row.entity) }}</div>';
+ var resolutionTmpl = '<div class="ui-grid-cell-contents placeholder" ng-class="{\'placeholder-parent\': !row.entity.isLeaf, \'complete-parent\': row.entity.isAllComplete, \'none-complete-parent\': row.entity.isNoneComplete, \'some-complete-parent\': row.entity.isSomeComplete, \'almost-complete-parent\': row.entity.isAlmostComplete, \'coverage-invalid\': grid.appScope.isCausingInvalid(row.entity)}" title="TOOLTIP">{{ grid.appScope.getTextResolution(row.entity) }}</div>';
var origSubCellTmpl = '<div class="ui-grid-cell-contents" ng-class="{\'placeholder-parent\': true}" title="TOOLTIP">{{ grid.appScope.getTextResolutionType(row.entity) }}</div>';
var subGridOrigTmpl = '<div ng-class="{\'ui-grid-cell-contents\': true, annotationInput: true, invalid: grid.appScope.getInvalidLocRefs(row.entity), details: annotation.showDeets}" title="TOOLTIP">{{row.entity.locationRefs}}</div>';
var codeTemplate = '<div class="method-number">{{ grid.appScope.selectedItem.methodNumber }}</div>';
@@ -418,6 +414,7 @@ app.factory('ColumnFactory', function() {
}, {
field: 'customerNotes',
displayName: 'Text',
+ cellTemplate: textCoverageTmpl,
enableCellEdit: false,
}
];
diff --git a/plugins/org.eclipse.osee.web.ui/src/dispo/js/CoverageFactory.js b/plugins/org.eclipse.osee.web.ui/src/dispo/js/CoverageFactory.js
new file mode 100644
index 00000000000..a1486b561dc
--- /dev/null
+++ b/plugins/org.eclipse.osee.web.ui/src/dispo/js/CoverageFactory.js
@@ -0,0 +1,277 @@
+app.factory('CoverageFactory', function() {
+ var CoverageFactory = {};
+
+ var isCompleteCoverage = function(annotation) {
+ if(annotation.resolutionType === "" || annotation.resolution === "") {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ CoverageFactory.setTextForNonDefaultAnnotations = function(annotations, discrepancies) {
+ for(var i = 0; i < annotations.length; i++) {
+ if(!annotations[i].isDefault) {
+ var covered = annotations[i].idsOfCoveredDiscrepancies[0]
+
+ var text = discrepancies[covered];
+ if(!text == null)
+ return annotations[i].customerNotes = text;
+ else
+ return annotations[i].customerNotes = "no text found";
+ }
+ }
+ }
+
+ var getReasonWhyIncomplete = function(annotation) {
+ var toReturn = [];
+ if(annotation.resolutionType === "") {
+ toReturn.push("resolutionType");
+ }
+ if(annotation.resolution === "") {
+ toReturn.push("resolution");
+ }
+ return toReturn;
+ }
+
+ var isColumnAffectCompleteness = function(col) {
+ if(col.field == "resolutionType" || col.field == "resolution") {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ CoverageFactory.writeoutNode = function(childArray, currentLevel, dataArray) {
+ var id = 0;
+ childArray.forEach(function(childNode) {
+ if (childNode.children.length > 0) {
+ childNode.$$treeLevel = currentLevel;
+ id = childNode.id;
+ } else {
+ if ((id != childNode.parentId) || (childNode.id == childNode.parentId)) {
+ childNode.$$treeLevel = currentLevel;
+ }
+ }
+ dataArray.push(childNode);
+ CoverageFactory.writeoutNode(childNode.children, currentLevel + 1, dataArray);
+ });
+ };
+
+ CoverageFactory.treeAnnotations = function(annotations) {
+ var annotationsStack = annotations.slice();
+ var toReturn = [];
+
+ while (annotationsStack.length > 0) {
+ var annotation = annotationsStack[annotationsStack.length - 1] // peek
+ if (annotation.name.match(/\d+\.\w+\..+/gi)) {
+ var parentAnnotation = {};
+ annotation.id = annotation.guid;
+ var leadingLocRefs = annotation.locationRefs.split(".")[0];
+ parentAnnotation.locationRefs = leadingLocRefs;
+ parentAnnotation.id = annotation.guid;
+ parentAnnotation.guid = annotation.guid;
+ parentAnnotation.parentId = -1;
+
+ var metadata = {};
+ metadata.childrenComplete = true;
+ metadata.totalCount = 0;
+ metadata.completeCount = 0;
+ metadata.runningTotalCount = 0;
+ metadata.runningCompleteCount = 0;
+ parentAnnotation.isTopLevel = true;
+ parentAnnotation.childMetadata = metadata;
+
+ var childrenStack = getAnnotationsStartsWith(annotationsStack, leadingLocRefs, false, true);
+ var childrenAsTree = createTreeAnnotations(annotationsStack, parentAnnotation, childrenStack, 1, metadata);
+ parentAnnotation.children = childrenAsTree;
+ parentAnnotation.$treeLevel = 0;
+ populatePercentData(parentAnnotation);
+
+ toReturn.push(parentAnnotation);
+ } else {
+ annotationsStack.pop();
+ annotation.children = [];
+ annotation.$$treeLevel = -1;
+ annotation.isLeaf = true;
+
+ toReturn.push(annotation);
+ }
+ }
+
+ return toReturn;
+ }
+
+ // annotationsStack is the entire remaining stack of annotations
+ // parent is the calling parent place holder annotation
+ // childrenStack is the annotations that are to be under the parent
+ // level is the current tree level
+ // Metadata is used to pass information up to the calling parent annotation
+ var createTreeAnnotations = function(annotationsStack, parent, childrenStack, level, metadata) {
+ if (level >= 2) {
+ metadata.childrenComplete = true;
+ metadata.totalCount = 0;
+ metadata.completeCount = 0;
+ var children = getAnnotationsStartsWith(childrenStack, parent.locationRefs, false, true);
+ for (var i = 0; i < children.length; i++) {
+ metadata.totalCount++;
+ children[i].$$treeLevel = level;
+
+ children[i].children = [];
+ children[i].parentId = parent.id;
+ children[i].parentRef = parent;
+ children[i].isLeaf = true;
+ if (!children[i].isDefault && !isCompleteCoverage(children[i])) {
+ metadata.allComplete = false;
+ } else {
+ metadata.completeCount++;
+ }
+ metadata.customerNotes = children[i].customerNotes;
+ }
+ return children;
+ } else {
+ var toReturn = [];
+ while (childrenStack.length > 0) {
+ metadata.totalCount++;
+ var annotation = childrenStack[0]
+ var leadingLocRefs = createLocRef(annotation.locationRefs, level);
+
+ var self = {};
+ self.id = generateId();
+ self.parentId = parent.id;
+ self.parentRef = parent;
+ self.locationRefs = leadingLocRefs;
+ self.$$treeLevel = level;
+ var childMetadata = {};
+ self.children = createTreeAnnotations(annotationsStack, self, childrenStack, level + 1, childMetadata);
+ self.childMetadata = childMetadata
+ metadata.childrenComplete = metadata.childrenComplete && childMetadata.childMetadata;
+ if(metadata.childrenComplete) {
+ metadata.completeCount++;
+ }
+ metadata.runningTotalCount += childMetadata.totalCount;
+ metadata.runningCompleteCount += childMetadata.completeCount;
+ self.customerNotes = childMetadata.customerNotes;
+
+ toReturn.push(self);
+ }
+ return toReturn;
+ }
+ }
+
+ CoverageFactory.updatePercent = function(colDef, oldValue, annotation) {
+ var possibleCountChange = 0;
+
+ // We only need to update the count +/- 1 if the change is in one of the completeness fields
+ if(isColumnAffectCompleteness(colDef)) {
+ // We checked in ui-grides call back (gridApi.edit.on.afterCellEdit) that the newValue is different than the old
+ // Thus if it was empty before and the annotation as a whole is complete then the current change did the trick and we can add 1 to the complete count
+ if(oldValue == "" && isCompleteCoverage(annotation)) {
+ possibleCountChange = 1;
+ } else if(annotation[colDef.field] == "" && (getReasonWhyIncomplete(annotation).length == 1 && getReasonWhyIncomplete(annotation)[0] == colDef.field)) {
+ // If the new value is NOW empty we can assume it was not empty before so might need to subtract 1.
+ // Before being sure we need to make sure the only reason this annotation is now incomplete is because of this column
+ possibleCountChange = -1;
+ }
+ }
+
+
+ if(annotation.isLeaf) {
+ var parent = annotation.parentRef;
+ var topLevelParent = annotation;
+ while(parent != undefined && parent != null) {
+ topLevelParent = parent;
+ parent.childMetadata.completeCount += possibleCountChange;
+ parent = parent.parentRef;
+ }
+ topLevelParent.childMetadata.runningCompleteCount += possibleCountChange;
+ populatePercentData(topLevelParent);
+ }
+ }
+
+ var populatePercentData = function(annotation) {
+ var str = [];
+ var pct = (annotation.childMetadata.runningCompleteCount / annotation.childMetadata.runningTotalCount);
+ var pctStr = pct.toLocaleString("en", {style: "percent"});
+ str.push(annotation.childMetadata.runningCompleteCount, "/", annotation.childMetadata.runningTotalCount, " (", pctStr, ")");
+
+ annotation.percentCompleteStr = str.join("");
+
+ annotation.isAllComplete = false;
+ annotation.isNoneComplete = false;
+ annotation.isSomeComplete = false;
+ annotation.isAlmostComplete = false;
+
+ if(pct < .33) {
+ annotation.isNoneComplete = true;
+ } else if(pct > .33 && pct < .66) {
+ annotation.isSomeComplete = true;
+ } else if(pct > .66 && pct < 1) {
+ annotation.isAlmostComplete = true;
+ } else {
+ annotation.isAllComplete = true;
+ }
+ }
+
+
+ var getAnnotationsStartsWith = function(annotationsStack, startsWith, isWholeString, isPop) {
+ var searchStr = startsWith;
+ if(!isWholeString) {
+ searchStr = startsWith + ".";
+ }
+ var annotationsStackOrig = annotationsStack.slice();
+ var toReturn = [];
+ var toDelete = [];
+ for (var i = 0; i < annotationsStack.length; i++) {
+ var annotation = annotationsStackOrig[i];
+ if ((!isWholeString && annotation.locationRefs.startsWith(searchStr)) || (isWholeString && annotation.locationRefs == searchStr)) {
+ toDelete.push(i);
+ toReturn.push(annotation);
+ }
+ }
+ if (isPop) {
+ for (var i = toDelete.length - 1; i >= 0; i--) {
+ annotationsStack.splice(toDelete[i], 1);
+ }
+ }
+ return toReturn;
+ }
+
+ var createLocRef = function(fullLocRefs, level) {
+ var workingGenLocationRefs = "";
+ for (var i = 0; i <= level; i++) {
+ if (i > 0) {
+ workingGenLocationRefs += ".";
+ }
+ workingGenLocationRefs += fullLocRefs.split(".")[i];
+ }
+ return workingGenLocationRefs;
+ }
+
+ var generateId = function() {
+ var text = "";
+ var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+
+ for (var i = 0; i < 10; i++)
+ text += possible.charAt(Math.floor(Math.random() * possible.length));
+
+ return text;
+ }
+
+ var getText = function(annotation) {
+ if(annotation.customerNotes != undefined && annotation.customerNotes == "") {
+ var discrepancies = $scope.selectedItem.discrepancies;
+ var covered = annotation.idsOfCoveredDiscrepancies[0]
+
+ if(!discrepancies[covered] == null)
+ return discrepancies[covered].text;
+ else
+ return "";
+ } else {
+ return annotation.customerNotes;
+ }
+ }
+
+
+ return CoverageFactory;
+}); \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.web.ui/src/dispo/js/coverageController.js b/plugins/org.eclipse.osee.web.ui/src/dispo/js/coverageController.js
deleted file mode 100644
index d3b57ae5e99..00000000000
--- a/plugins/org.eclipse.osee.web.ui/src/dispo/js/coverageController.js
+++ /dev/null
@@ -1,42 +0,0 @@
-app.controller('coverageController', [
- '$rootScope',
- '$cookieStore',
- '$modal',
-
- function($rootScope, $cookieStore, $modal) {
- $rootScope.type = 'codeCoverage';
-
- $rootScope.setUserName = function() {
- $rootScope.attempts = 0;
- while(($rootScope.cachedName == null || $rootScope.cachedName == "") && $rootScope.attempts < 5) {
- var nameEnter=prompt("Please enter your name","");
- $cookieStore.put('cachedName', nameEnter);
- $rootScope.cachedName = nameEnter;
- $rootScope.attempts++;
- }
- if($rootScope>=5) {
- $rootScope.cachedName = "Need To Log In";
- }
-
- }
-
- $rootScope.cachedName = $cookieStore.get('cachedName');
- $rootScope.setUserName();
-
- $rootScope.resetUserName = function() {
- $rootScope.cachedName = null;
- $rootScope.setUserName();
- }
-
- // Help Modal
- $rootScope.showHelpModal = function() {
- var modalInstance = $modal.open({
- templateUrl: 'helpModal.html',
- size: 'large',
- windowClass: 'needsRerunModal'
- });
- }
-
- }]);
-
- \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.web.ui/src/dispo/js/userController.js b/plugins/org.eclipse.osee.web.ui/src/dispo/js/userController.js
index b93244e0d85..f75af19fd3a 100644
--- a/plugins/org.eclipse.osee.web.ui/src/dispo/js/userController.js
+++ b/plugins/org.eclipse.osee.web.ui/src/dispo/js/userController.js
@@ -12,7 +12,8 @@ app.controller('userController', [
'uiGridConstants',
'uiGridTreeViewConstants',
'ColumnFactory',
- function($scope, $modal, $rootScope, Program, Set, Item, Annotation, SetSearch, SourceFile, Config, uiGridConstants, uiGridTreeViewConstants, ColumnFactory) {
+ 'CoverageFactory',
+ function($scope, $modal, $rootScope, Program, Set, Item, Annotation, SetSearch, SourceFile, Config, uiGridConstants, uiGridTreeViewConstants, ColumnFactory, CoverageFactory) {
$scope.editItems = false;
$scope.selectedItems = [];
$scope.programSelection = null;
@@ -299,44 +300,21 @@ app.controller('userController', [
return annotation.resolution;
} else {
if(annotation.isTopLevel) {
- var str = [];
- var pct = (annotation.childMetadata.runningCompleteCount / annotation.childMetadata.runningTotalCount);
- pct = pct.toLocaleString("en", {style: "percent"});
- str.push(annotation.childMetadata.runningCompleteCount, "/", annotation.childMetadata.runningTotalCount, " (", pct, ")");
- return str.join("");
+ return annotation.percentCompleteStr;
} else {
return annotation.childMetadata.completeCount + " / " + annotation.childMetadata.totalCount;
}
}
}
- $scope.isComplete = function(annotation) {
- if(annotation.isTopLevel) {
- return annotation.childMetadata.runningCompleteCount == annotation.childMetadata.runningTotalCount;
+ $scope.getTextCoverage = function(annotation) {
+ if(annotation.isLeaf) {
+ return "";
+ } else {
+ return annotation.customerNotes;
}
}
- $scope.isNoneComplete = function(annotation) {
- if(annotation.isTopLevel) {
- var pct = annotation.childMetadata.runningCompleteCount / annotation.childMetadata.runningTotalCount;
- return pct <=.33;
- }
- }
-
- $scope.isSomeComplete = function(annotation) {
- if(annotation.isTopLevel) {
- var pct = annotation.childMetadata.runningCompleteCount / annotation.childMetadata.runningTotalCount;
- return .33 < pct && pct <=.5;
- }
- }
-
- $scope.isAlmostComplete = function(annotation) {
- if(annotation.isTopLevel) {
- var pct = annotation.childMetadata.runningCompleteCount / annotation.childMetadata.runningTotalCount;
- return .5 < pct && pct < 1;
- }
- }
-
$scope.subGridOptions = {
data: 'annotations',
enableHighlighting: true,
@@ -362,35 +340,18 @@ app.controller('userController', [
gridApi.edit.on.afterCellEdit($scope, function(rowEntity, colDef, newValue, oldValue) {
if (oldValue != newValue) {
- $scope.editAnnotation(rowEntity);
+ $scope.editAnnotation(colDef, oldValue, rowEntity);
}
});
};
- var id = 0;
- $scope.writeoutNode = function(childArray, currentLevel, dataArray) {
- childArray.forEach(function(childNode) {
- if (childNode.children.length > 0) {
- childNode.$$treeLevel = currentLevel;
- id = childNode.id;
- } else {
- if ((id != childNode.parentId) || (childNode.id == childNode.parentId)) {
- childNode.$$treeLevel = currentLevel;
- }
- }
- dataArray.push(childNode);
- $scope.writeoutNode(childNode.children, currentLevel + 1, dataArray);
- });
- };
-
$scope.subGridOptions.data = [];
$scope.subGridOptions.columnDefs = ColumnFactory.getSubGridColumns($rootScope.type);
$scope.getItemDetails = function(item, row) {
if (!$scope.isMultiEditView) {
$scope.selectedItem = item;
- ColumnFactory.setSelectedItem(item);
Annotation.query({
programId: $scope.programSelection,
setId: $scope.setSelection,
@@ -400,8 +361,9 @@ app.controller('userController', [
$scope.annotations = data;
if ($scope.isCoverage) {
$scope.annotations.sort(sortStuff);
- $scope.annotations = $scope.treeAnnotations(data);
- $scope.writeoutNode($scope.annotations, 0, $scope.subGridOptions.data);
+ CoverageFactory.setTextForNonDefaultAnnotations($scope.annotations, $scope.selectedItem.discrepancies);
+ $scope.annotations = CoverageFactory.treeAnnotations(data);
+ CoverageFactory.writeoutNode($scope.annotations, 0, $scope.subGridOptions.data);
} else {
var blankAnnotation = new Annotation();
$scope.annotations.push(blankAnnotation);
@@ -412,137 +374,7 @@ app.controller('userController', [
});
}
}
-
- $scope.treeAnnotations = function(annotations) {
- var annotationsStack = annotations.slice();
- var toReturn = [];
-
- while (annotationsStack.length > 0) {
- var annotation = annotationsStack[annotationsStack.length - 1] // peek
- if (annotation.name.match(/\d+\.\w+\..+/gi)) {
- var parentAnnotation = {};
- annotation.id = annotation.guid;
- var leadingLocRefs = annotation.locationRefs.split(".")[0];
- parentAnnotation.locationRefs = leadingLocRefs;
- parentAnnotation.id = annotation.guid;
- parentAnnotation.guid = annotation.guid;
- parentAnnotation.parentId = -1;
-
- var metadata = {};
- metadata.childrenComplete = true;
- metadata.totalCount = 0;
- metadata.completeCount = 0;
- metadata.runningTotalCount = 0;
- metadata.runningCompleteCount = 0;
- parentAnnotation.isTopLevel = true;
- parentAnnotation.childMetadata = metadata;
-
- var childrenStack = $scope.getAnnotationsStartsWith(annotationsStack, leadingLocRefs, false, true);
- var childrenAsTree = $scope.createTreeAnnotations(annotationsStack, parentAnnotation, childrenStack, 1, metadata);
- parentAnnotation.children = childrenAsTree;
- parentAnnotation.$treeLevel = 0;
-
- toReturn.push(parentAnnotation);
- } else {
- annotationsStack.pop();
- annotation.children = [];
- annotation.$$treeLevel = -1;
- annotation.isLeaf = true;
-
- toReturn.push(annotation);
- }
- }
-
- return toReturn;
- }
-
-
- $scope.createTreeAnnotations = function(annotationsStack, parent, childrenStack, level, metadata) {
- if (level >= 2) {
- metadata.childrenComplete = true;
- metadata.totalCount = 0;
- metadata.completeCount = 0;
- var children = $scope.getAnnotationsStartsWith(childrenStack, parent.locationRefs, false, true);
- for (var i = 0; i < children.length; i++) {
- metadata.totalCount++;
- children[i].$$treeLevel = level;
-
- children[i].children = [];
- children[i].parentId = parent.id;
- children[i].isLeaf = true;
- metadata.text = children[i].customerNotes;
- children[i].customerNotes = '';
- if ((children[i].resolution === "" || children[i].resolutionType === "") && !children[i].isDefault) {
- metadata.allComplete = false;
- } else {
- metadata.completeCount++;
- }
- }
- return children;
- } else {
- var toReturn = [];
- while (childrenStack.length > 0) {
- metadata.totalCount++;
- var annotation = childrenStack[0]
- var leadingLocRefs = $scope.createLocRef(annotation.locationRefs, level);
-
- var self = {};
- self.id = $scope.generateId();
- self.parentId = parent.id;
- self.locationRefs = leadingLocRefs;
- self.$$treeLevel = level;
- var childMetadata = {};
- self.children = $scope.createTreeAnnotations(annotationsStack, self, childrenStack, level + 1, childMetadata);
- self.childMetadata = childMetadata
- metadata.childrenComplete = metadata.childrenComplete && childMetadata.childMetadata;
- if(metadata.childrenComplete) {
- metadata.completeCount++;
- }
- metadata.runningTotalCount += childMetadata.totalCount;
- metadata.runningCompleteCount += childMetadata.completeCount;
-
- toReturn.push(self);
- }
- return toReturn;
- }
- }
-
- $scope.createLocRef = function(fullLocRefs, level) {
- var workingGenLocationRefs = "";
- for (var i = 0; i <= level; i++) {
- if (i > 0) {
- workingGenLocationRefs += ".";
- }
- workingGenLocationRefs += fullLocRefs.split(".")[i];
- }
- return workingGenLocationRefs;
- }
-
-
- $scope.getAnnotationsStartsWith = function(annotationsStack, startsWith, isWholeString, isPop) {
- var searchStr = startsWith;
- if(!isWholeString) {
- searchStr = startsWith + ".";
- }
- var annotationsStackOrig = annotationsStack.slice();
- var toReturn = [];
- var toDelete = [];
- for (var i = 0; i < annotationsStack.length; i++) {
- var annotation = annotationsStackOrig[i];
- if ((!isWholeString && annotation.locationRefs.startsWith(searchStr)) || (isWholeString && annotation.locationRefs == searchStr)) {
- toDelete.push(i);
- toReturn.push(annotation);
- }
- }
- if (isPop) {
- for (var i = toDelete.length - 1; i >= 0; i--) {
- annotationsStack.splice(toDelete[i], 1);
- }
- }
- return toReturn;
- }
-
$scope.searchAnnotations = function() {
Item.get({
programId: $scope.programSelection,
@@ -638,13 +470,12 @@ app.controller('userController', [
return annotation.resolution != null && annotation.resolution != "" && !annotation.isResolutionValid;
}
- $scope.editAnnotation = function editAnnotation(annotation) {
+ $scope.editAnnotation = function editAnnotation(colDef, oldValue, annotation) {
if ($scope.selectedItem.assignee == $rootScope.cachedName) {
- $scope.editAnnotationServerCall(annotation);
+ $scope.editAnnotationServerCall(colDef, oldValue, annotation);
} else if ($scope.selectedItem.assignee == "UnAssigned") {
var newItem = new Item();
newItem.assignee = $rootScope.cachedName;
-
Item.get({
programId: $scope.programSelection,
setId: $scope.setSelection,
@@ -657,33 +488,43 @@ app.controller('userController', [
itemId: $scope.selectedItem.guid,
}, newItem, function() {
$scope.selectedItem.assignee = $rootScope.cachedName;
- $scope.editAnnotationServerCall
+ $scope.editAnnotationServerCall(colDef, oldValue, annotation)
}, function(data) {
+ annotation[colDef.name] = oldValue;
alert("Could not make change, please try refreshing");
});
} else {
+ annotation[colDef.name] = oldValue;
$scope.selectedItem.assignee = data.assignee;
alert("This item was taken while you weren't looking. Double click on the assignee field for this item to steal it and make changes");
}
});
} else {
+ annotation[colDef.name] = oldValue;
alert("You are not assigned to this Item. Double click on the assignee field for this item to steal it and make changes");
}
}
- $scope.editAnnotationServerCall = function(annotation) {
+ $scope.editAnnotationServerCall = function(colDef, oldValue, annotation) {
if (annotation.guid == null) {
if (/[^\s]+/.test(annotation.locationRefs)) {
$scope.createAnnotation(annotation);
}
} else {
+ // Create a copy of the new object but remove the parent ref because JSON Stringify cannot handle circular references
+ // Stringify gets called because the payload needs to be parsed on transmit
+ // Might not need to do a clone but since this is a PUT and not a PATCH we send the entire object as is not just the single field that was updated
+ var newAnnotation = $scope.cloneObj(annotation);
+ newAnnotation.parentRef = null;
+
+
Annotation.update({
programId: $scope.programSelection,
setId: $scope.setSelection,
itemId: $scope.selectedItem.guid,
annotationId: annotation.guid,
userName: $rootScope.cachedName,
- }, annotation, function(annot) {
+ }, newAnnotation, function(annot) {
// get latest Annotation version from Server
Annotation.get({
programId: $scope.programSelection,
@@ -693,6 +534,9 @@ app.controller('userController', [
}, function(data) {
annotation.isConnected = data.isConnected;
annotation.isResolutionValid = data.isResolutionValid;
+ CoverageFactory.updatePercent(colDef, oldValue, annotation);
+ }, function(data) {
+ alert
});
// Get new latest Item version from server
@@ -830,17 +674,22 @@ app.controller('userController', [
"name": "NONE FOUND"
}];
- $scope.generateId = function() {
- var text = "";
- var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
-
- for (var i = 0; i < 10; i++)
- text += possible.charAt(Math.floor(Math.random() * possible.length));
-
- return text;
+
+ // Utils **************************************************************************
+ $scope.cloneObj = function(obj) {
+ var toReturn = {};
+ var keys = Object.keys(obj);
+ for(var i = 0; i < keys.length; i++) {
+ var key = keys[i];
+ toReturn[key] = obj[key];
+ }
+ return toReturn;
}
-
-
+
+ $scope.isCausingInvalid = function(annotation) {
+ return annotation.isLeaf && annotation.resolutionType != "" && annotation.resolution == "";
+ }
+
// MODALS -------------------------------------------------------------------------------------------------
$scope.showAssigneeModal = function() {
$scope.isMulitEditRequest = true;
diff --git a/plugins/org.eclipse.osee.web.ui/src/dispo/ui/index.html b/plugins/org.eclipse.osee.web.ui/src/dispo/ui/index.html
index e82aee87d14..511b6804cba 100644
--- a/plugins/org.eclipse.osee.web.ui/src/dispo/ui/index.html
+++ b/plugins/org.eclipse.osee.web.ui/src/dispo/ui/index.html
@@ -33,6 +33,7 @@
<script src="/dispo/js/resizer.js"></script>
<script src="/dispo/js/dispoApp.js"></script>
<script src="/dispo/js/ColumnFactory.js"></script>
+ <script src="/dispo/js/CoverageFactory.js"></script>
<script src="/dispo/js/userController.js"></script>
<script src="/dispo/js/adminController.js"></script>
<script src="/dispo/js/mainController.js"></script>
diff --git a/plugins/org.eclipse.osee.web.ui/src/dispo/views/dropdown.html b/plugins/org.eclipse.osee.web.ui/src/dispo/views/dropdown.html
index 666599f5d23..c38c1bf91a5 100644
--- a/plugins/org.eclipse.osee.web.ui/src/dispo/views/dropdown.html
+++ b/plugins/org.eclipse.osee.web.ui/src/dispo/views/dropdown.html
@@ -1 +1 @@
-<select ui-grid-edit-dropdown-osee class="form-control" ng-change="grid.appScope.$emit(uiGridEditConstants.events.END_CELL_EDIT)" ng-model="row.entity.resolutionType" ng-options="obj.value as obj.text for obj in editDropdownOptionsArray"></select>
+<select ui-grid-edit-dropdown-osee class="form-control" options-disabled="option.isDefault for option in editDropdownOptionsArray" ng-change="grid.appScope.$emit(uiGridEditConstants.events.END_CELL_EDIT)" ng-model="row.entity.resolutionType" ng-options="obj.value as obj.text for obj in editDropdownOptionsArray"></select>

Back to the top