@@ -3,7 +3,7 @@ var foldingCharacter = ":";
33
44var CmdParser = require ( 'cmdparser' ) ;
55function loadTree ( ) {
6- $ . get ( '/ apiv1/connection' , function ( isConnected ) {
6+ $ . get ( 'apiv1/connection' , function ( isConnected ) {
77 if ( isConnected ) {
88 $ ( '#keyTree' ) . bind ( "loaded.jstree" , function ( ) {
99 var tree = getKeyTree ( ) ;
@@ -41,43 +41,43 @@ function loadTree () {
4141 if ( node !== - 1 ) {
4242 var path = getFullKeyPath ( node ) ;
4343 var root = getRootConnection ( node ) ;
44- return '/ apiv1/keystree/' + encodeURIComponent ( root ) + '/' + encodeURIComponent ( path ) + '?absolute=false' ;
44+ return 'apiv1/keystree/' + encodeURIComponent ( root ) + '/' + encodeURIComponent ( path ) + '?absolute=false' ;
4545 }
4646 var root = getRootConnection ( node ) ;
47- return '/ apiv1/keystree/' + encodeURIComponent ( root ) ;
47+ return 'apiv1/keystree/' + encodeURIComponent ( root ) ;
4848 }
4949 }
5050 } ,
5151 types : {
5252 types : {
5353 "root" : {
5454 icon : {
55- image : '/ images/treeRoot.png'
55+ image : 'images/treeRoot.png'
5656 }
5757 } ,
5858 "string" : {
5959 icon : {
60- image : '/ images/treeString.png'
60+ image : 'images/treeString.png'
6161 }
6262 } ,
6363 "hash" : {
6464 icon : {
65- image : '/ images/treeHash.png'
65+ image : 'images/treeHash.png'
6666 }
6767 } ,
6868 "set" : {
6969 icon : {
70- image : '/ images/treeSet.png'
70+ image : 'images/treeSet.png'
7171 }
7272 } ,
7373 "list" : {
7474 icon : {
75- image : '/ images/treeList.png'
75+ image : 'images/treeList.png'
7676 }
7777 } ,
7878 "zset" : {
7979 icon : {
80- image : '/ images/treeZSet.png'
80+ image : 'images/treeZSet.png'
8181 }
8282 }
8383 }
@@ -141,15 +141,15 @@ function treeNodeSelected (event, data) {
141141 var connectionId = pathParts . slice ( 0 , 1 ) [ 0 ] ;
142142 if ( pathParts . length === 1 ) {
143143 var hostAndPort = pathParts [ 0 ] . split ( ':' ) ;
144- $ . get ( '/ apiv1/server/info' , function ( data , status ) {
144+ $ . get ( 'apiv1/server/info' , function ( data , status ) {
145145 if ( status != 'success' ) {
146146 return alert ( "Could not load server info" ) ;
147147 }
148148 data = JSON . parse ( data ) ;
149149 data . forEach ( function ( instance ) {
150150 if ( instance . host == hostAndPort [ 0 ] && instance . port == hostAndPort [ 1 ] ) {
151151 instance . connectionId = connectionId ;
152- var html = new EJS ( { url : '/ templates/serverInfo.ejs' } ) . render ( instance ) ;
152+ var html = new EJS ( { url : 'templates/serverInfo.ejs' } ) . render ( instance ) ;
153153 $ ( '#body' ) . html ( html ) ;
154154 return setupAddKeyButton ( ) ;
155155 }
@@ -170,9 +170,9 @@ function getRootConnection (node) {
170170
171171function loadKey ( connectionId , key , index ) {
172172 if ( index ) {
173- $ . get ( '/ apiv1/key/' + encodeURIComponent ( connectionId ) + "/" + encodeURIComponent ( key ) + "/" + index , processData ) ;
173+ $ . get ( 'apiv1/key/' + encodeURIComponent ( connectionId ) + "/" + encodeURIComponent ( key ) + "/" + index , processData ) ;
174174 } else {
175- $ . get ( '/ apiv1/key/' + encodeURIComponent ( connectionId ) + "/" + encodeURIComponent ( key ) , processData ) ;
175+ $ . get ( 'apiv1/key/' + encodeURIComponent ( connectionId ) + "/" + encodeURIComponent ( key ) , processData ) ;
176176 }
177177 function processData ( data , status ) {
178178 if ( status != 'success' ) {
@@ -210,7 +210,7 @@ function loadKey (connectionId, key, index) {
210210 }
211211}
212212function selectTreeNodeBranch ( data ) {
213- var html = new EJS ( { url : '/ templates/editBranch.ejs' } ) . render ( data ) ;
213+ var html = new EJS ( { url : 'templates/editBranch.ejs' } ) . render ( data ) ;
214214 $ ( '#body' ) . html ( html ) ;
215215}
216216function setupEditListButton ( ) {
@@ -295,7 +295,7 @@ function setupEditZSetButton () {
295295
296296function setupAddKeyButton ( connectionId ) {
297297 $ ( '#keyValue' ) . keyup ( function ( ) {
298- var action = "/ apiv1/key/" + encodeURIComponent ( connectionId ) + "/" + encodeURIComponent ( $ ( this ) . val ( ) ) ;
298+ var action = "apiv1/key/" + encodeURIComponent ( connectionId ) + "/" + encodeURIComponent ( $ ( this ) . val ( ) ) ;
299299 $ ( '#addKeyForm' ) . attr ( "action" , action ) ;
300300 } ) ;
301301 $ ( '#keyType' ) . change ( function ( ) {
@@ -361,7 +361,7 @@ function setupEditHashButton () {
361361}
362362
363363function selectTreeNodeString ( data ) {
364- var html = new EJS ( { url : '/ templates/editString.ejs' } ) . render ( data ) ;
364+ var html = new EJS ( { url : 'templates/editString.ejs' } ) . render ( data ) ;
365365 $ ( '#body' ) . html ( html ) ;
366366
367367 try {
@@ -374,7 +374,7 @@ function selectTreeNodeString (data) {
374374 $ ( '#stringValue' ) . val ( data . value ) ;
375375 $ ( '#jqtree_string_div' ) . html ( JSONTree . create ( JSON . parse ( data . value ) ) ) ;
376376 $ ( '#stringValue' ) . keyup ( function ( ) {
377- $ ( '#stringValueClippy' ) . clippy ( { 'text' : $ ( this ) . val ( ) , clippy_path : "/ clippy-jquery/clippy.swf" } ) ;
377+ $ ( '#stringValueClippy' ) . clippy ( { 'text' : $ ( this ) . val ( ) , clippy_path : "clippy-jquery/clippy.swf" } ) ;
378378 var dataTree ;
379379 try {
380380 dataTree = JSONTree . create ( JSON . parse ( $ ( this ) . val ( ) ) ) ;
@@ -412,12 +412,12 @@ function selectTreeNodeString (data) {
412412}
413413
414414function selectTreeNodeHash ( data ) {
415- var html = new EJS ( { url : '/ templates/editHash.ejs' } ) . render ( data ) ;
415+ var html = new EJS ( { url : 'templates/editHash.ejs' } ) . render ( data ) ;
416416 $ ( '#body' ) . html ( html ) ;
417417}
418418
419419function selectTreeNodeSet ( data ) {
420- var html = new EJS ( { url : '/ templates/editSet.ejs' } ) . render ( data ) ;
420+ var html = new EJS ( { url : 'templates/editSet.ejs' } ) . render ( data ) ;
421421 $ ( '#body' ) . html ( html ) ;
422422 $ ( '#addSetMemberForm' ) . ajaxForm ( {
423423 beforeSubmit : function ( ) {
@@ -445,7 +445,7 @@ function selectTreeNodeSet (data) {
445445
446446function selectTreeNodeList ( data ) {
447447 if ( data . items . length > 0 ) {
448- var html = new EJS ( { url : '/ templates/editList.ejs' } ) . render ( data ) ;
448+ var html = new EJS ( { url : 'templates/editList.ejs' } ) . render ( data ) ;
449449 $ ( '#body' ) . html ( html ) ;
450450 $ ( '#addListValueForm' ) . ajaxForm ( {
451451 beforeSubmit : function ( ) {
@@ -476,7 +476,7 @@ function selectTreeNodeList (data) {
476476
477477function selectTreeNodeZSet ( data ) {
478478 if ( data . items . length > 0 ) {
479- var html = new EJS ( { url : '/ templates/editZSet.ejs' } ) . render ( data ) ;
479+ var html = new EJS ( { url : 'templates/editZSet.ejs' } ) . render ( data ) ;
480480 $ ( '#body' ) . html ( html ) ;
481481 } else {
482482 alert ( 'Index out of bounds' ) ;
@@ -500,7 +500,7 @@ function addKey (connectionId, key) {
500500 var pathParts = getKeyTree ( ) . get_path ( connectionId , true ) ;
501501 connectionId = pathParts . slice ( 0 , 1 ) [ 0 ] ;
502502 }
503- $ ( '#addKeyForm' ) . attr ( 'action' , '/ apiv1/key/' + encodeURIComponent ( connectionId ) + "/" + encodeURIComponent ( key ) ) ;
503+ $ ( '#addKeyForm' ) . attr ( 'action' , 'apiv1/key/' + encodeURIComponent ( connectionId ) + "/" + encodeURIComponent ( key ) ) ;
504504 $ ( '#keyValue' ) . val ( key ) ;
505505 $ ( '#addKeyModal' ) . modal ( 'show' ) ;
506506 setupAddKeyButton ( connectionId ) ;
@@ -513,7 +513,7 @@ function deleteKey (connectionId, key) {
513513 }
514514 var result = confirm ( 'Are you sure you want to delete "' + key + ' from ' + connectionId + '"?' ) ;
515515 if ( result ) {
516- $ . post ( '/ apiv1/key/' + encodeURIComponent ( connectionId ) + '/' + encodeURIComponent ( key ) + '?action=delete' , function ( data , status ) {
516+ $ . post ( 'apiv1/key/' + encodeURIComponent ( connectionId ) + '/' + encodeURIComponent ( key ) + '?action=delete' , function ( data , status ) {
517517 if ( status != 'success' ) {
518518 return alert ( "Could not delete key" ) ;
519519 }
@@ -530,7 +530,7 @@ function deleteBranch (connectionId, branchPrefix) {
530530 var query = branchPrefix + ':*' ;
531531 var result = confirm ( 'Are you sure you want to delete "' + query + ' from ' + connectionId + '"? This will delete all children as well!' ) ;
532532 if ( result ) {
533- $ . post ( '/ apiv1/keys/' + encodeURIComponent ( connectionId ) + "/" + encodeURIComponent ( query ) + '?action=delete' , function ( data , status ) {
533+ $ . post ( 'apiv1/keys/' + encodeURIComponent ( connectionId ) + "/" + encodeURIComponent ( query ) + '?action=delete' , function ( data , status ) {
534534 if ( status != 'success' ) {
535535 return alert ( "Could not delete branch" ) ;
536536 }
@@ -669,7 +669,7 @@ function loadCommandLine () {
669669 refreshTree ( ) ;
670670 rl . write ( "OK" ) ;
671671 } else {
672- $ . post ( '/ apiv1/exec' , { cmd : line , connection : $ ( '#selectedConnection' ) . val ( ) } , function ( data , status ) {
672+ $ . post ( 'apiv1/exec' , { cmd : line , connection : $ ( '#selectedConnection' ) . val ( ) } , function ( data , status ) {
673673 rl . prompt ( ) ;
674674
675675 if ( status != 'success' ) {
@@ -856,7 +856,7 @@ var cmdparser = new CmdParser([
856856] , {
857857 key : function ( partial , callback ) {
858858 var redisConnection = $ ( '#selectedConnection' ) . val ( ) ;
859- $ . get ( '/ apiv1/keys/' + encodeURIComponent ( redisConnection ) + "/" + partial + '*?limit=20' , function ( data , status ) {
859+ $ . get ( 'apiv1/keys/' + encodeURIComponent ( redisConnection ) + "/" + partial + '*?limit=20' , function ( data , status ) {
860860 if ( status != 'success' ) {
861861 return callback ( new Error ( "Could not get keys" ) ) ;
862862 }
@@ -876,7 +876,7 @@ var prevCLIOpen;
876876var configLoaded = false ;
877877
878878function getServerInfo ( callback ) {
879- $ . get ( '/ apiv1/server/info' , function ( data , status ) {
879+ $ . get ( 'apiv1/server/info' , function ( data , status ) {
880880 callback ( JSON . parse ( data ) )
881881 } ) ;
882882}
@@ -888,7 +888,7 @@ function removeServer (connectionId) {
888888 }
889889 var result = confirm ( 'Are you sure you want to disconnect from "' + connectionId + '"?' ) ;
890890 if ( result ) {
891- $ . post ( '/ logout/' + encodeURIComponent ( connectionId ) , function ( err , status ) {
891+ $ . post ( 'logout/' + encodeURIComponent ( connectionId ) , function ( err , status ) {
892892 if ( status != 'success' ) {
893893 return alert ( "Could not remove instance" ) ;
894894 }
@@ -936,13 +936,13 @@ function saveConfig () {
936936 var sidebarWidth = $ ( '#sideBar' ) . width ( ) ;
937937 var locked = ! $ ( '#lockCommandButton' ) . hasClass ( 'disabled' ) ;
938938 var CLIHeight = $ ( '#commandLineContainer' ) . height ( ) ;
939- $ . get ( '/ config' , function ( config ) {
939+ $ . get ( 'config' , function ( config ) {
940940 if ( config ) {
941941 config [ "sidebarWidth" ] = sidebarWidth ;
942942 config [ "locked" ] = locked ;
943943 config [ "CLIHeight" ] = CLIHeight ;
944944 config [ "CLIOpen" ] = CLIOpen ;
945- $ . post ( '/ config' , config , function ( data , status ) {
945+ $ . post ( 'config' , config , function ( data , status ) {
946946 } ) ;
947947 } else {
948948 var config = {
@@ -952,13 +952,13 @@ function saveConfig () {
952952 "CLIOpen" : CLIOpen ,
953953 "default_connections" : [ ]
954954 } ;
955- $ . post ( '/ config' , config , function ( data , status ) {
955+ $ . post ( 'config' , config , function ( data , status ) {
956956 } ) ;
957957 }
958958 } ) ;
959959}
960960function loadConfig ( callback ) {
961- $ . get ( '/ config' , function ( data ) {
961+ $ . get ( 'config' , function ( data ) {
962962 if ( data ) {
963963 if ( data [ 'sidebarWidth' ] ) {
964964 $ ( '#sideBar' ) . width ( data [ 'sidebarWidth' ] ) ;
@@ -1085,7 +1085,7 @@ $(function() {
10851085 * Export redis data.
10861086 */
10871087 $ ( '#app-container' ) . on ( 'submit' , '#redisExportForm' , function ( ) {
1088- window . open ( "/ tools/export?" + $ ( this ) . serialize ( ) , '_blank' ) ;
1088+ window . open ( "tools/export?" + $ ( this ) . serialize ( ) , '_blank' ) ;
10891089 return false ;
10901090 } ) ;
10911091
@@ -1097,7 +1097,7 @@ $(function() {
10971097
10981098 $ . ajax ( {
10991099 type : 'POST' ,
1100- url : '/ tools/import' ,
1100+ url : 'tools/import' ,
11011101 data : $ ( this ) . serialize ( ) ,
11021102 dataType : 'JSON' ,
11031103 success : function ( res ) {
@@ -1117,7 +1117,7 @@ $(function() {
11171117 $ ( '#redisImportData' ) . on ( 'click' , function ( ) {
11181118 $ . ajax ( {
11191119 type : 'POST' ,
1120- url : '/ tools/forms/import' ,
1120+ url : 'tools/forms/import' ,
11211121 success : function ( res ) {
11221122 $ ( '#body' ) . html ( res ) ;
11231123 }
@@ -1130,7 +1130,7 @@ $(function() {
11301130 $ ( '#redisExportData' ) . on ( 'click' , function ( ) {
11311131 $ . ajax ( {
11321132 type : 'POST' ,
1133- url : '/ tools/forms/export' ,
1133+ url : 'tools/forms/export' ,
11341134 success : function ( res ) {
11351135 $ ( '#body' ) . html ( res ) ;
11361136 }
0 commit comments