Support arrays of embedded types

This commit is contained in:
Vincent Fiduccia 2015-03-24 17:12:07 -07:00
parent df62d4315f
commit 90a6dd2557
3 changed files with 16 additions and 16 deletions

View File

@ -1,6 +1,6 @@
{
"name": "api-ui",
"version": "1.0.3",
"version": "1.0.4",
"description": "Embedded UI for any service that implements the Rancher API spec",
"contributors": [
"Go Daddy Operating Company, LLC. (http://godaddy.com)",
@ -16,7 +16,8 @@
"scripts": {
"start": "./node_modules/.bin/gulp server",
"clean": "./node_modules/.bin/gulp clean",
"build": "./node_modules/.bin/gulp build"
"build": "./node_modules/.bin/gulp build",
"upload": "./scripts/upload"
},
"devDependencies": {
"del": "^1.1.0",

View File

@ -19,7 +19,7 @@ function exec() {
VERSION=$(cat package.json | grep version | cut -f4 -d'"' | sed 's/-/_/g')
BUILD_DIR="dist/${VERSION}"
CDN="cdn.rancher.io/api-ui"
CDN="releases.rancher.com/api-ui"
echo "Uploading..."
exec gsutil -m cp -R $BUILD_DIR "gs://${CDN}/"
exec gsutil -m cp -R -z "js,css,map" $BUILD_DIR "gs://${CDN}/"

View File

@ -1437,7 +1437,7 @@ HTMLApi.prototype._flattenField = function(mode, name, field, data, depth)
var displayType = field._typeList[ field._typeList.length - 1];
var parentType = field._typeList[ field._typeList.length - 2];
if ( isEmbedded || (parentType && parentType == 'reference') )
if ( isEmbedded || (parentType && (parentType == 'reference' || parentType == 'array' || parentType == 'map')) )
{
var link = null;
if ( field.referenceCollection )
@ -1576,6 +1576,16 @@ HTMLApi.prototype._flattenInputs = function($form)
isMapValue = k.indexOf('.value{}') >= 0;
isJsonValue = k.indexOf('.json{}') >= 0;
name = k;
if ( isJsonValue )
name = name.replace(/\.json\{\}$/,'');
if ( isMapKey )
name = name.replace(/\.key\{\}$/,'');
if ( isMapValue )
name = name.replace(/\.value\{\}$/,'');
if ( isArray )
name = name.replace(/\[\]$/,'');
if ( isJsonValue )
{
try {
@ -1589,7 +1599,6 @@ HTMLApi.prototype._flattenInputs = function($form)
if ( isArray )
{
name = k.replace(/\[\]$/,'');
if ( typeof inputs[name] === "undefined" )
inputs[name] = [];
@ -1597,14 +1606,6 @@ HTMLApi.prototype._flattenInputs = function($form)
}
else if ( isMapKey || isMapValue )
{
name = k;
if ( isJsonValue )
name = name.replace(/\.json\{\}$/,'');
if ( isMapKey )
name = name.replace(/\.key\{\}$/,'');
else if ( isMapValue )
name = name.replace(/\.value\{\}$/,'');
if ( typeof maps[name] === 'undefined' )
{
maps[name] = {keys: [], values: []};
@ -1617,8 +1618,6 @@ HTMLApi.prototype._flattenInputs = function($form)
}
else if ( isJsonValue )
{
name = k;
name = name.replace(/\.json\{\}$/,'');
inputs[name] = v;
}
else