From c376adc0a8791aa4b395c5776aa10ed10e7397f0 Mon Sep 17 00:00:00 2001 From: thelamer Date: Mon, 13 May 2019 20:30:54 -0700 Subject: [PATCH] handle array type stacks in the gateway application --- public/js/gateway.js | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/public/js/gateway.js b/public/js/gateway.js index 7e56110..08edbb6 100644 --- a/public/js/gateway.js +++ b/public/js/gateway.js @@ -7,14 +7,31 @@ $( document ).ready(function() { var labels = container.Labels; if (labels.stacktype){ if (labels.appport && container.State == 'running'){ - var iconurl = labels.stackurl.replace('.yml','.png').replace('/templates/','/icons/'); - var linkurl = window.location.href.replace('taisun-gateway', 'user:' + pass + '@' + labels.appport); - $('#stacks').append('\ -
\ -
\ -

'+ labels.stackname + '

\ -
\ - '); + var apport = labels.appport; + if (isNaN(apport)){ + var dropdownlinks = ''; + var ports = JSON.parse(apport); + $(ports).each(function( key, value ){ + var iconurl = labels.stackurl.replace('.yml','.png').replace('/templates/','/icons/'); + var linkurl = window.location.href.replace('taisun-gateway', 'user:' + pass + '@' + value[Object.keys(value)[0]]); + $('#stacks').append('\ +
\ +
\ +

'+ Object.keys(value)[0] + '

\ +
\ + '); + }); + } + else{ + var iconurl = labels.stackurl.replace('.yml','.png').replace('/templates/','/icons/'); + var linkurl = window.location.href.replace('taisun-gateway', 'user:' + pass + '@' + labels.appport); + $('#stacks').append('\ +
\ +
\ +

'+ labels.stackname + '

\ +
\ + '); + } } else if (labels.devport && container.State == 'running' && labels.ide == 'VDI'){ var linkurl = window.location.href.replace('taisun-gateway', 'user:' + pass + '@' + taisunport) + '/desktop/' + container.Id;