From b9a80f38d08971c0c608a757fc18981d7b135084 Mon Sep 17 00:00:00 2001 From: Rohit Date: Tue, 25 Jun 2019 20:06:10 -0400 Subject: [PATCH] mostly done with the wiring of new features --- .../components/coordinator/coordinator.html | 22 ++-- .../components/coordinator/js/update_guis.js | 119 ++++++++++++------ 2 files changed, 91 insertions(+), 50 deletions(-) diff --git a/client/app/components/coordinator/coordinator.html b/client/app/components/coordinator/coordinator.html index 7fcf3e0..fa0424a 100644 --- a/client/app/components/coordinator/coordinator.html +++ b/client/app/components/coordinator/coordinator.html @@ -318,7 +318,7 @@ - @@ -327,18 +327,18 @@
-
+
- + - + - +
- - + +
@@ -363,7 +363,7 @@ -
@@ -382,7 +382,7 @@ -
+
@@ -392,8 +392,8 @@
- - + +
diff --git a/client/app/components/coordinator/js/update_guis.js b/client/app/components/coordinator/js/update_guis.js index 89d2046..b6621c0 100644 --- a/client/app/components/coordinator/js/update_guis.js +++ b/client/app/components/coordinator/js/update_guis.js @@ -16,6 +16,38 @@ function getBagList(callback) }); } +function getBagCategoryList(callback) +{ + var service = new ROSLIB.Service({ + ros : ros, + name : '/aescape/bags/getCategoryList', + serviceType : 'demobot/TriggerList' + }); + + var request = new ROSLIB.ServiceRequest({}); + + service.callService(request, function(result) { + callback(result.message); + }); +} + +function getBagTagList(callback) +{ + var service = new ROSLIB.Service({ + ros : ros, + name : '/aescape/bags/getTagList', + serviceType : 'demobot/TriggerList' + }); + + var request = new ROSLIB.ServiceRequest({}); + + service.callService(request, function(result) { + callback(result.message); + }); +} + + + setTimeout(function(){ var $select = $('#bagList').selectize({ @@ -50,9 +82,25 @@ setTimeout(function(){ $(function () { $('[data-toggle="popover"]').popover() }) +}, 100); - var $select = $('#playBagFileName').selectize({ + +function displayTaggingOptions(mode) { + + var modeTag = '#' + mode + 'Tag'; + var fileNameSelector = '#' + mode + 'BagFileName'; + var categorySelector = '#' + mode + 'BagCategory'; + var tagSelector = '#' + mode + 'BagTags'; + + //Subscribe to topics from the backend which indicate recording or playback is complete + document.querySelector(modeTag).classList.add('open'); + //Putting this in a timeout to wait for the animation to finish completing + setTimeout(function(){ + document.querySelector(modeTag).setAttribute('overflow', 'visible'); + }, 600) + + var $fileNameSelect = $(fileNameSelector).selectize({ valueField: 'name', labelField: 'name', searchField: ['name'], @@ -61,13 +109,16 @@ setTimeout(function(){ placeholder : "Enter a name for the bag" }); - var selectize = $select[0].selectize; - selectize.clearOptions() - selectize.addOption([].map(function(bagName){ - return {name : bagName} - })); + var fileNameSelectize = $fileNameSelect[0].selectize; + fileNameSelectize.clearOptions() + // /aescape/bags/getBagList + getBagList(function(result){ + fileNameSelectize.addOption([].map(function(bagName){ + return {name : bagName} + })); + }) - var $select2 = $('#playBagCategory').selectize({ + var $categoryNameSelect = $(categorySelector).selectize({ valueField: 'name', labelField: 'name', searchField: ['name'], @@ -76,14 +127,15 @@ setTimeout(function(){ placeholder : "Enter or select a category for the bag" }); - var selectize2 = $select2[0].selectize; - //selectize.clearOptions() - results2 = ['Production', 'Test']; - selectize2.addOption(results2.map(function(bagName){ - return {name : bagName} - })); + var categoryNameSelectize = $categoryNameSelect[0].selectize; + categoryNameSelectize.clearOptions() + getBagCategoryList(function(result){ + categoryNameSelectize.addOption(['Production', 'Test'].map(function(bagName){ + return {name : bagName} + })); + }) - var $select3 = $('#playBagTags').selectize({ + var $tagSelect = $(tagSelector).selectize({ valueField: 'name', labelField: 'name', searchField: ['name'], @@ -93,31 +145,14 @@ setTimeout(function(){ placeholder : "Enter or select tags for the bag" }); - var selectize3 = $select3[0].selectize; - //selectize.clearOptions() - results3 = ['single-arm', 'dual-arm', 'palpation', 'demo']; - selectize3.addOption(results3.map(function(bagName){ - return {name : bagName} - })); + var tagSelectize = $tagSelect[0].selectize; + tagSelectize.clearOptions() + getBagTagList(function(results){ + tagSelectize.addOption(['single-arm', 'dual-arm', 'palpation', 'demo'].map(function(bagName){ + return {name : bagName} + })); + }) -}, 100); - - - -function displayTaggingOptions(id) { - - //populate the values in the select boxes on every display - // /aescape/bags/getCategoryList - // /aescape/bags/getTagList - // /aescape/bags/getBagList - - - //Subscribe to topics from the backend which indicate recording or playback is complete - document.getElementById(id).classList.add('open'); - //Putting this in a timeout to wait for the animation to finish completing - setTimeout(function(){ - document.getElementById(id).setAttribute('overflow', 'visible'); - }, 600) } function hideTaggingOptions(id, updateValues=false) { @@ -137,7 +172,13 @@ function updateBagMetadata(mode, bag_name, modified_bag_name, category, tags) { if(!bag_name) { return // error } - triggerService('/aescape/bags/updateBagMeta') + triggerService('/aescape/bags/updateBagMeta', { + mode : mode, + bag_name : bag_name, + modified_bag_name : modified_bag_name, + category : category, + tags : tags + }) }