Skip to content

Commit

Permalink
Merge branch 'release/3.1.0'
Browse files Browse the repository at this point in the history
# Conflicts:
#	Gruntfile.js
#	app/js/mms/directives/veNav.js
  • Loading branch information
skhudiky committed Aug 30, 2017
2 parents de9dcb7 + b29b1fc commit 452e711
Show file tree
Hide file tree
Showing 31 changed files with 470 additions and 289 deletions.
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ module.exports = function(grunt) {
options: {
publish: [{
id: 'gov.nasa.jpl:evm:zip',
version: '3.0.3',
version: '3.1.0',
path: 'deploy/'
}]
}
Expand Down
3 changes: 2 additions & 1 deletion app/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"c3": "~0.4.10",
"angulartics": "~1.1.0",
"angulartics-piwik": "~1.0.4",
"angular-diff-match-patch": "~0.4.0"
"angular-diff-match-patch": "~0.4.0",
"ngStorage": "https://github.com/gsklee/ngStorage.git#master"
},
"resolutions": {
"lodash": "3.9.3",
Expand Down
43 changes: 31 additions & 12 deletions app/js/mms/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

angular.module('mmsApp', ['mms', 'mms.directives', 'app.tpls', 'fa.directive.borderLayout', 'ui.bootstrap', 'ui.router', 'ui.tree', 'angular-growl', 'cfp.hotkeys', 'angulartics', 'angulartics.piwik', 'diff-match-patch'])
angular.module('mmsApp', ['mms', 'mms.directives', 'app.tpls', 'fa.directive.borderLayout', 'ui.bootstrap', 'ui.router', 'ui.tree', 'angular-growl', 'cfp.hotkeys', 'angulartics', 'angulartics.piwik', 'diff-match-patch', 'ngStorage'])
.config(function($stateProvider, $urlRouterProvider, $httpProvider) {


Expand Down Expand Up @@ -89,32 +89,51 @@ angular.module('mmsApp', ['mms', 'mms.directives', 'app.tpls', 'fa.directive.bor
views: {
'login@': {
templateUrl: 'partials/mms/select.html',
controller: function($scope, $rootScope, $state, orgObs, ProjectService, AuthService, growl) {
controller: function($scope, $rootScope, $state, orgObs, ProjectService, AuthService, growl, $localStorage) {
$rootScope.ve_title = 'View Editor'; //what to name this?
$scope.orgs = orgObs;
$localStorage.$default({org: orgObs[0]});
$scope.spin = false;
$scope.orgs = orgObs;
var orgId, projectId;
$scope.selectOrg = function(org) {
if (org) {
$localStorage.org = org;
orgId = org.id;
$scope.selectedOrg = org.name;
$scope.selectedProject = "";
$localStorage.org.orgName = org.name;
$scope.selectedOrg = $localStorage.org.name;
$scope.selectedProject = ""; // default here?
ProjectService.getProjects(orgId).then(function(data){
$scope.projects = data;
if (data.length > 0) {
$scope.selectProject(data[0]);
} else {
//no projects
if($localStorage.project && checkForProject(data, $localStorage.project) === 1){
$scope.selectedProject = $localStorage.project.name;
projectId = $localStorage.project.id;
}else{
$scope.selectProject(data[0]);
}
}
});
}
};
$scope.selectProject = function(project) {
$scope.selectProject = function(project) {
if (project) {
$scope.selectedProject = project.name;
projectId = project.id;
$localStorage.project = project;
$scope.selectedProject = $localStorage.project.name;
projectId = $localStorage.project.id;
}
};
if ($localStorage.org) {
$scope.selectOrg($localStorage.org);
}
var checkForProject = function(projectArray, project) {
for (var i = 0; i < projectArray.length; i++) {
if(projectArray[i].id === project.id){
return 1;
}
}
return 0;
};
$scope.spin = false;

$scope.continue = function() {
if (orgId && projectId) {
$scope.spin = true;
Expand Down
138 changes: 69 additions & 69 deletions app/js/mms/controllers/refs.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

angular.module('mmsApp')
.controller('RefsCtrl', ['$sce', '$q', '$filter', '$location', '$uibModal', '$scope', '$rootScope', '$state', '$timeout', '$window', 'growl', '_',
'UxService', 'ElementService', 'UtilsService', 'ProjectService', 'MmsAppUtils', 'ApplicationService',
'ElementService', 'ProjectService', 'MmsAppUtils', 'ApplicationService',
'orgOb', 'projectOb', 'refOb', 'refObs', 'tagObs', 'branchObs',
function($sce, $q, $filter, $location, $uibModal, $scope, $rootScope, $state, $timeout, $window, growl, _,
UxService, ElementService, UtilsService, ProjectService, MmsAppUtils, ApplicationService,
ElementService, ProjectService, MmsAppUtils, ApplicationService,
orgOb, projectOb, refOb, refObs, tagObs, branchObs) {

$rootScope.mms_refOb = refOb;
Expand Down Expand Up @@ -38,29 +38,20 @@ function($sce, $q, $filter, $location, $uibModal, $scope, $rootScope, $state, $t
$scope.fromParams = refOb;
$scope.refSelected = refOb;
}

$scope.htmlTooltip = $sce.trustAsHtml('Branch temporarily unavailable during duplication.');
// $scope.htmlTooltip = $sce.trustAsHtml('Branch temporarily unavailable during duplication.<br>Branch author will be notified by email upon completion.');
// var refPerm = projectOb && projectOb._editable;

$scope.bbApi.init = function() {
$scope.bbApi.addButton(UxService.getButtonBarButton("tree-add-branch"));
$scope.bbApi.addButton(UxService.getButtonBarButton("tree-add-tag"));
$scope.bbApi.addButton(UxService.getButtonBarButton("tree-delete"));
// $scope.bbApi.addButton(UxService.getButtonBarButton("tree-merge"));
// $scope.bbApi.setPermission("tree-add-branch", $scope.refPerm);
// $scope.bbApi.setPermission("tree-add-tag", $scope.refPerm);
// $scope.bbApi.setPermission("tree-delete", $scope.refPerm);
// $scope.bbApi.setPermission("tree-merge", $scope.refPerm);
};
$scope.$on('tree-add-branch', function(e) {
$scope.addBranch = function(e) {
addItem('Branch');
});
$scope.$on('tree-add-tag', function(e) {
};
$scope.addTag = function(e) {
addItem('Tag');
});
$scope.$on('tree-delete', function(e) {
};
$scope.deleteRef = function(e) {
deleteItem();
});
};
$scope.$on('fromParamChange', function(event, fromParams) {
var index = _.findIndex(refObs, {name: fromParams.refId});
if ( index > -1 ) {
Expand Down Expand Up @@ -90,26 +81,14 @@ function($sce, $q, $filter, $location, $uibModal, $scope, $rootScope, $state, $t
ProjectService.getRef(ref.id, projectOb.id).then(
function(data) {
$scope.refSelected = data;
},
},
function(error){
growl.error("Ref click handler error: " + error );
return;
}
);
};

// $scope.treeDblclickHandler = function(branch) {
// if ($state.includes('project.ref') && !$state.includes('project.ref.document')) {
// if (branch.type === 'group')
// $rootScope.ve_treeApi.expand_branch(branch);
// else if (branch.type === 'view' || branch.type === 'snapshot') {
// $state.go('project.ref.document', {documentId: branch.data.id, search: undefined});
// }
// } else if ($state.includes('project.ref.document')) {
// $rootScope.ve_treeApi.expand_branch(branch);
// }
// };

var addItem = function(itemType) {
$scope.itemType = itemType;
var branch = $scope.refSelected;
Expand Down Expand Up @@ -186,67 +165,88 @@ function($sce, $q, $filter, $location, $uibModal, $scope, $rootScope, $state, $t
$scope.branch.name = "";
$scope.branch.description = "";
$scope.branch.permission = "read";
$scope.branch.lastCommit = true;
$scope.branch.timestamp = new Date();
displayName = "Branch";
$scope.updateTimeOpt = function () {
$scope.branch.lastCommit = false;
};
} else if ($scope.itemType === 'Tag') {
$scope.configuration = {};
$scope.configuration.name = "";
$scope.configuration.description = "";
$scope.tag = {};
$scope.tag.name = "";
$scope.tag.description = "";
$scope.tag.lastCommit = true;
$scope.tag.timestamp = new Date();
displayName = "Tag";
$scope.updateTimeOpt = function () {
$scope.tag.lastCommit = false;
};
}

var handlePromise = function(promise) {
promise.then(function(data) {
growl.success(displayName + " is being created.");
// growl.info('Please wait for a completion email prior to viewing of the '+$scope.itemType+'.', {ttl: -1});
// refArr.push(refJson);
// var storeArr = refArr.toString();
// $window.localStorage.setItem('refArr', storeArr);
$uibModalInstance.close(data); //need to figure out a way to cache this stuff
}, function(reason) {
growl.error("Create " + displayName + " : " + reason.message);
}).finally(function() {
$scope.oking = false;
});
};

$scope.ok = function() {
if ($scope.oking) {
growl.info("Please wait...");
return;
}
$scope.oking = true;
var promise;
var date = new Date();
var promise, ts;
// Item specific promise:
if ($scope.itemType === 'Branch') {
var branchObj = {"name": $scope.branch.name, "type": "Branch",
if ($scope.itemType === 'Branch' && $scope.branch.name !== '') {
var branchObj = {"name": $scope.branch.name, "type": "Branch",
"description": $scope.branch.description};
branchObj.parentRefId = $scope.createParentRefId;
branchObj.permission = $scope.branch.permission;
branchObj.id = ApplicationService.createUniqueId();
promise = ProjectService.createRef( branchObj, projectOb.id );
refJson = {
name: $scope.branch.name,
id: $scope.branch.id,
type: $scope.itemType,
status: 'in progress', //will get status from JMS?
start_time: (date.getMonth() + 1) + "/" + date.getDate() + "/" + date.getFullYear() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds()
};
} else if ($scope.itemType === 'Tag') {
var tagObj = {"name": $scope.configuration.name, "type": "Tag",
"description": $scope.configuration.description};
if (!$scope.branch.lastCommit) {
// Make call to history?maxTimestamp to get closest commit id to branch off
ts = $filter('date')($scope.branch.timestamp, 'yyyy-MM-ddTHH:mm:ss.sssZ');
ProjectService.getRefHistory(branchObj.parentRefId, projectOb.id, ts)
.then(function(commits) {
branchObj.parentCommitId = commits[0].id;
promise = ProjectService.createRef( branchObj, projectOb.id );
handlePromise(promise);
});
} else {
promise = ProjectService.createRef( branchObj, projectOb.id );
handlePromise(promise);
}
} else if ($scope.itemType === 'Tag' && $scope.tag.name !== '') {
var tagObj = {"name": $scope.tag.name, "type": "Tag",
"description": $scope.tag.description};
tagObj.parentRefId = $scope.createParentRefId;
tagObj.id = ApplicationService.createUniqueId();
promise = ProjectService.createRef( tagObj, projectOb.id );
refJson = {
name: tagObj.name,
id: tagObj.id,
type: $scope.itemType,
status: 'in progress', //will get status from JMS?
start_time: (date.getMonth() + 1) + "/" + date.getDate() + "/" + date.getFullYear() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds()
};
if (!$scope.tag.lastCommit) {
ts = $filter('date')($scope.tag.timestamp, 'yyyy-MM-ddTHH:mm:ss.sssZ');
ProjectService.getRefHistory(tagObj.parentRefId, projectOb.id, ts)
.then(function(commits) {
tagObj.parentCommitId = commits[0].id;
promise = ProjectService.createRef( tagObj, projectOb.id );
handlePromise(promise);
});
} else {
promise = ProjectService.createRef( tagObj, projectOb.id );
handlePromise(promise);
}
} else {
growl.error("Add Item of Type " + $scope.itemType + " is not supported");
$scope.oking = false;
return;
}
promise.then(function(data) {
growl.success(displayName+" is being created.");
// growl.info('Please wait for a completion email prior to viewing of the '+$scope.itemType+'.', {ttl: -1});
refArr.push(refJson);
// var storeArr = refArr.toString();
// $window.localStorage.setItem('refArr', storeArr);
$uibModalInstance.close(data); //need to figure out a way to cache this stuff
}, function(reason) {
growl.error("Create "+displayName+" Error: " + reason.message);
}).finally(function() {
$scope.oking = false;
});
};

$scope.cancel = function() {
Expand Down
2 changes: 1 addition & 1 deletion app/js/mms/controllers/tree.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ function($anchorScroll, $q, $filter, $location, $uibModal, $scope, $rootScope, $
refId: refOb.id
}, 2).then(function(documentObs) {
for (var i = 0; i < documentObs.length; i++) {
if (!documentObs[i]._groupId) {
if (!documentObs[i]._groupId || documentObs[i]._groupId == projectOb.id) {
$scope.treeData.push({
label: documentObs[i].name,
type: 'view',
Expand Down
28 changes: 7 additions & 21 deletions app/js/mms/directives/veMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ angular.module('mmsApp')
*/
function veMenu(CacheService, $state, $templateCache, $sce) {
var template = $templateCache.get('partials/mms/veMenu.html');


var veMenuLink = function(scope, element, attrs) {

scope.htmlTooltip = $sce.trustAsHtml('Branch temporarily unavailable during duplication.<br><br>Branch author will be notified by email upon completion.');
scope.htmlTooltip = $sce.trustAsHtml('Branch temporarily unavailable during duplication.');
scope.currentProject = scope.project.name;
if (scope.ref) {
scope.currentRef = scope.ref;
Expand All @@ -47,10 +46,14 @@ function veMenu(CacheService, $state, $templateCache, $sce) {
}
};
scope.updateBranch = function(branch) {
$state.go($state.current.name, {projectId: scope.project.id, refId: branch.id, search: undefined}, {reload: true});
if (branch.status != 'creating') {
$state.go($state.current.name, {projectId: scope.project.id, refId: branch.id, search: undefined}, {reload: true});
}
};
scope.updateTag = function(tag) {
$state.go($state.current.name, {projectId: scope.project.id, refId: tag.id, search: undefined}, {reload: true});
if (tag.status != 'creating') {
$state.go($state.current.name, {projectId: scope.project.id, refId: tag.id, search: undefined}, {reload: true});
}
};
scope.refsView = function() {
$state.go('project', {projectId: scope.project.id}, {reload: true});
Expand All @@ -72,30 +75,13 @@ function veMenu(CacheService, $state, $templateCache, $sce) {
tag.push(refObs[i]);
}
scope.tags = tag;

var branches = [];
for (var j = 0; j < refObs.length; j++) {
if (refObs[j].type === "Branch")
branches.push(refObs[j]);
}
scope.branches = branches;

}

//var index = -1;
//if (createdRef.type === 'Branch') {
// index = _.findIndex(scope.branches, {name: createdRef.id});
// if ( index > -1 ) {
// scope.branches[index].loading = false;
// // scope.branches[index] = createdRef;
// }
//} else if (createdRef.type === 'Tag') {
// index = _.findIndex(scope.tags, {name: createdRef.id});
// if ( index > -1 ) {
// scope.tags[index].loading = false;
// // scope.tags[index] = createdRef;
// }
//}
});

var bcrumbs = [];
Expand Down
3 changes: 2 additions & 1 deletion app/js/mms/directives/veNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ function veNav($templateCache, $rootScope, $state, hotkeys, growl, $location, $u
scope.updateOrg = function() {
var instance = $uibModal.open({
templateUrl: 'partials/mms/selectModal.html',
windowClass: 've-dropdown-short-modal',
scope: scope,
controller: ['$scope', '$uibModalInstance', function($scope, $uibModalInstance) {

Expand Down Expand Up @@ -88,7 +89,7 @@ function veNav($templateCache, $rootScope, $state, hotkeys, growl, $location, $u
hotkeys.toggleCheatSheet();
};
scope.toggleAbout = function() {
scope.veV = '3.0.3';
scope.veV = '3.1.0';
scope.mmsV = 'Loading...';
ApplicationService.getMmsVersion().then(function(data) {
scope.mmsV = data;
Expand Down
Loading

0 comments on commit 452e711

Please sign in to comment.