Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
37c753bd
Commit
37c753bd
authored
Aug 20, 2018
by
kevalbhatt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2724 : UI enhancement for Avro schemas and other JSON-valued attributes
parent
6de9428f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
147 additions
and
26 deletions
+147
-26
common.scss
dashboardv2/public/css/scss/common.scss
+78
-0
override.scss
dashboardv2/public/css/scss/override.scss
+2
-1
CommonViewFunction.js
dashboardv2/public/js/utils/CommonViewFunction.js
+34
-24
Utils.js
dashboardv2/public/js/utils/Utils.js
+33
-1
No files found.
dashboardv2/public/css/scss/common.scss
View file @
37c753bd
...
...
@@ -78,4 +78,81 @@
.details-backbutton
{
display
:
block
!
important
;
}
}
pre
{
background-color
:
ghostwhite
;
border
:
1px
solid
silver
;
padding
:
10px
;
white-space
:
-
moz-pre-wrap
;
/* Mozilla, supported since 1999 */
white-space
:
-
pre-wrap
;
/* Opera */
white-space
:
-
o-pre-wrap
;
/* Opera */
white-space
:
pre-wrap
;
/* CSS3 - Text module (Candidate Recommendation) http://www.w3.org/TR/css3-text/#white-space */
word-wrap
:
break-word
;
/* IE 5.5+ */
&
.code-block
{
code
{
position
:
relative
;
max-height
:
400px
;
display
:
block
;
overflow
:
auto
;
}
position
:
relative
;
overflow
:
hidden
;
&
.shrink
{
height
:
40px
;
white-space
:
-
moz-pre-wrap
;
/* Mozilla, supported since 1999 */
white-space
:
-
pre-wrap
;
/* Opera */
white-space
:
-
o-pre-wrap
;
/* Opera */
white-space
:
pre-wrap
;
/* CSS3 - Text module (Candidate Recommendation) http://www.w3.org/TR/css3-text/#white-space */
word-wrap
:
break-word
;
/* IE 5.5+ */
code
{
height
:
40px
;
}
&
.fixed-height
{
height
:
75px
;
code
{
height
:
54px
;
}
}
&
.medium-height
{
height
:
100px
;
}
.expand-collapse-button
{
i
:before
{
content
:
"\f107"
;
}
}
}
.expand-collapse-button
{
position
:
absolute
;
right
:
3px
;
top
:
4px
;
z-index
:
1
;
i
:before
{
content
:
"\f106"
;
}
}
.json-key
{
color
:
brown
;
}
.json-value
{
color
:
navy
;
}
.json-string
{
color
:
olive
;
}
}
code
{
font-family
:
monospace
;
}
}
\ No newline at end of file
dashboardv2/public/css/scss/override.scss
View file @
37c753bd
...
...
@@ -102,7 +102,8 @@
}
td
{
div
.scroll-y
{
div
.scroll-y
,
pre
.scroll-y
{
max-height
:
200px
;
overflow-y
:
auto
;
}
...
...
dashboardv2/public/js/utils/CommonViewFunction.js
View file @
37c753bd
...
...
@@ -134,7 +134,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
if
(
_
.
isString
(
inputOutputField
)
||
_
.
isBoolean
(
inputOutputField
)
||
_
.
isNumber
(
inputOutputField
))
{
var
tempVarfor$check
=
inputOutputField
.
toString
();
if
(
tempVarfor$check
.
indexOf
(
"$"
)
==
-
1
)
{
valueOfArray
.
push
(
'<span>'
+
_
.
escape
(
inputOutputField
)
+
'</span>'
);
valueOfArray
.
push
(
'<span
class="json-string"
>'
+
_
.
escape
(
inputOutputField
)
+
'</span>'
);
}
}
else
if
(
_
.
isObject
(
inputOutputField
)
&&
!
id
)
{
var
attributesList
=
inputOutputField
;
...
...
@@ -144,30 +144,28 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
attributesList
=
attributesList
.
attributes
;
}
}
_
.
each
(
attributesList
,
function
(
objValue
,
objKey
)
{
var
value
=
objValue
,
tempVarfor$check
=
objKey
.
toString
();
if
(
tempVarfor$check
.
indexOf
(
"$"
)
==
-
1
)
{
if
(
_
.
isObject
(
value
))
{
value
=
JSON
.
stringify
(
value
);
}
if
(
extractJSON
)
{
if
(
extractJSON
&&
extractJSON
.
extractKey
)
{
if
(
_
.
isObject
(
extractJSON
.
extractKey
))
{
_
.
each
(
extractJSON
.
extractKey
,
function
(
extractKey
)
{
if
(
objKey
===
extractKey
)
{
valueOfArray
.
push
(
'<span>'
+
_
.
escape
(
objKey
)
+
':'
+
_
.
escape
(
value
)
+
'</span>'
);
}
});
}
else
if
(
_
.
isString
(
extractJSON
.
extractKey
)
&&
extractJSON
.
extractKey
===
objKey
)
{
valueOfArray
.
push
(
_
.
escape
(
value
));
}
if
(
extractJSON
&&
extractJSON
.
extractKey
)
{
var
newAttributesList
=
{};
_
.
each
(
attributesList
,
function
(
objValue
,
objKey
)
{
var
value
=
_
.
isObject
(
objValue
)
?
objValue
:
_
.
escape
(
objValue
),
tempVarfor$check
=
objKey
.
toString
();
if
(
tempVarfor$check
.
indexOf
(
"$"
)
==
-
1
)
{
if
(
_
.
isObject
(
extractJSON
.
extractKey
))
{
_
.
each
(
extractJSON
.
extractKey
,
function
(
extractKey
)
{
if
(
objKey
===
extractKey
)
{
newAttributesList
[
_
.
escape
(
objKey
)]
=
value
;
}
});
}
else
if
(
_
.
isString
(
extractJSON
.
extractKey
)
&&
extractJSON
.
extractKey
===
objKey
)
{
newAttributesList
[
_
.
escape
(
objKey
)]
=
value
;
}
}
else
{
valueOfArray
.
push
(
'<span>'
+
_
.
escape
(
objKey
)
+
':'
+
_
.
escape
(
value
)
+
'</span>'
);
}
}
});
});
valueOfArray
.
push
(
Utils
.
JSONPrettyPrint
(
newAttributesList
));
}
else
{
valueOfArray
.
push
(
Utils
.
JSONPrettyPrint
(
attributesList
));
}
}
if
(
id
&&
inputOutputField
)
{
var
name
=
Utils
.
getName
(
inputOutputField
);
...
...
@@ -232,7 +230,19 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
val
=
_
.
escape
(
keyValue
);
}
if
(
isTable
)
{
table
+=
'<tr><td>'
+
_
.
escape
(
key
)
+
'</td><td><div '
+
(
_
.
isObject
(
valueObject
[
key
])
?
'class="scroll-y"'
:
''
)
+
'>'
+
val
+
'</div></td></tr>'
;
var
htmlTag
=
'<div class="scroll-y">'
+
val
+
'</div>'
;
if
(
_
.
isObject
(
valueObject
[
key
]))
{
var
matchedLinkString
=
val
.
match
(
/href|value-loader
\w
*/g
),
matchedJson
=
val
.
match
(
/json-value|json-string
\w
*/g
),
isMatchLinkStringIsSingle
=
matchedLinkString
&&
matchedLinkString
.
length
==
1
,
isMatchJSONStringIsSingle
=
matchedJson
&&
matchedJson
.
length
==
1
,
expandCollapseButton
=
""
;
if
((
matchedJson
&&
!
isMatchJSONStringIsSingle
)
||
(
matchedLinkString
&&
!
isMatchLinkStringIsSingle
))
{
var
expandCollapseButton
=
'<button class="expand-collapse-button"><i class="fa"></i></button>'
}
var
htmlTag
=
'<pre class="shrink code-block '
+
(
isMatchJSONStringIsSingle
?
'fixed-height'
:
''
)
+
'">'
+
expandCollapseButton
+
'<code>'
+
val
+
'</code></pre>'
;
}
table
+=
'<tr><td>'
+
_
.
escape
(
key
)
+
'</td><td>'
+
htmlTag
+
'</td></tr>'
;
}
else
{
table
+=
'<div>'
+
val
+
'</div>'
;
}
...
...
dashboardv2/public/js/utils/Utils.js
View file @
37c753bd
...
...
@@ -682,6 +682,30 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
var
regexp
=
/
(
ftp|http|https
)
:
\/\/(\w
+:
{0,1}\w
*@
)?(\S
+
)(
:
[
0-9
]
+
)?(\/
|
\/([\w
#!:.?+=&%@!
\-\/]))?
/
return
regexp
.
test
(
url
);
}
Utils
.
JSONPrettyPrint
=
function
(
obj
)
{
var
replacer
=
function
(
match
,
pIndent
,
pKey
,
pVal
,
pEnd
)
{
var
key
=
'<span class=json-key>'
;
var
val
=
'<span class=json-value>'
;
var
str
=
'<span class=json-string>'
;
var
r
=
pIndent
||
''
;
if
(
pKey
)
r
=
r
+
key
+
pKey
.
replace
(
/
[
":
]
/g
,
''
)
+
'</span>: '
;
if
(
pVal
)
r
=
r
+
(
pVal
[
0
]
==
'"'
?
str
:
val
)
+
pVal
+
'</span>'
;
return
r
+
(
pEnd
||
''
);
},
jsonLine
=
/^
(
*
)(
"
[\w]
+":
)?(
"
[^
"
]
*"|
[\w
.+-
]
*
)?([
,[{
])?
$/mg
;
if
(
obj
&&
_
.
isObject
(
obj
))
{
return
JSON
.
stringify
(
obj
,
null
,
3
)
.
replace
(
/&/g
,
'&'
).
replace
(
/
\\
"/g
,
'"'
)
.
replace
(
/</g
,
'<'
).
replace
(
/>/g
,
'>'
)
.
replace
(
jsonLine
,
replacer
);
}
else
{
return
{};
}
};
$
.
fn
.
toggleAttribute
=
function
(
attributeName
,
firstString
,
secondString
)
{
if
(
this
.
attr
(
attributeName
)
==
firstString
)
{
this
.
attr
(
attributeName
,
secondString
);
...
...
@@ -725,8 +749,15 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
$
(
'body'
).
removeAttr
(
"style"
);
$
(
this
).
trigger
(
'fullscreen_done'
,
[
$
(
this
).
parents
(
'.panel'
)]);
}
});
$
(
'body'
).
on
(
'click'
,
'pre.code-block .expand-collapse-button'
,
function
(
e
)
{
var
$el
=
$
(
this
).
parents
(
'.code-block'
);
if
(
$el
.
hasClass
(
'shrink'
))
{
$el
.
removeClass
(
'shrink'
);
}
else
{
$el
.
addClass
(
'shrink'
);
}
});
return
Utils
;
});
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment