AMBARI-24958 Ambari YARN Queue Manager allows duplicate names when using rename functionality (asnaik) (#2659)

diff --git a/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/queue.js b/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/queue.js
index d3adeb4..6405592 100644
--- a/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/queue.js
+++ b/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/queue.js
@@ -503,8 +503,9 @@
 
     queue.set('name',name);
 
+    //new queue name has to be unique  
     foundWithName = this.store.all('queue').find(function (q) {
-      return q.get('path') === [queue.get('parentPath'),queue.get('name')].join('.');
+      return q.get('name') === queue.get('name') && q.get('path') != queue.get('path');
     });
 
     if (!Em.isEmpty(foundWithName) && queue.changedAttributes().hasOwnProperty('name')) {