Skip to content

Commit

Permalink
New dataplane tag UI (#10)
Browse files Browse the repository at this point in the history
* tags now appear as styled chips that offer clear UI on the name of a tag and its value. this change accounts for gateway mode dataplanes as well.

* added all of the Kuma logo colors to the CSS variables list for possible use in the tags list on data tables. style revisions for the tags.

* style revisions to the tags. added a border and some spacing to prevent them from stacking too close to one another when there are multiple tags on smaller screens.

* small adjustment to the humanReadableDate helper's output.
  • Loading branch information
Daryn St. Pierre authored Feb 4, 2020
1 parent 1da8521 commit 84d9d4b
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 6 deletions.
9 changes: 8 additions & 1 deletion src/assets/styles/variables.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,20 @@
--black-1: rgba(0, 0, 0, 0.75);
--green-1: #1b9844;

/* logo colors */
--logo-coral: #EE485D;
--logo-teal: #00CDDE;
--logo-mint: #00E8C2;
--logo-navy: #172350;
--logo-green: #3db664;

/* Topbar */
--topbar-height: 4rem;

/* Sidebar */
--sidebar-width: 240px;

/* Kongponents color remappings */
--KButtonPrimaryBase: #1155CB;
--KButtonPrimaryBase: var(--blue-4);
--KButtonPrimaryHover: #226ced;
}
94 changes: 92 additions & 2 deletions src/components/Skeletons/DataOverview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@
<!-- data -->
<div v-if="displayDataTable && !tableDataIsEmpty && tableData">
<KTable
class="{ 'data-table-is-hidden' : tableDataIsEmpty }"
:class="{ 'data-table-is-hidden' : tableDataIsEmpty }"
:options="tableDataFiltered"
has-hover
>
<!-- status -->
<template
v-if="displayTableDataStatus"
v-slot:status="{rowValue}"
Expand All @@ -50,6 +51,31 @@
<span class="entity-status__label">{{ rowValue }}</span>
</div>
</template>
<!-- tags -->
<template
v-slot:tags="{rowValue}"
>
<span
v-for="(item, key) in rowValue"
:key="key"
class="entity-tags"
:class="`entity-tags--${key}`"
>
<span
class="entity-tags__label"
:class="`entity-tags__label--${item.label.toLowerCase()}`"
:style="`color: var(${tagColors[key].text}) background-color: var(${tagColors[key].fill})`"
>
{{ item.label }}
</span>
<span
class="entity-tags__value"
:class="`entity-tags__value--${item.value}`"
>
{{ item.value }}
</span>
</span>
</template>
<template
slot="actions"
slot-scope="{ row }"
Expand Down Expand Up @@ -241,7 +267,39 @@ export default {
data () {
return {
pageSize: 12,
pageNumber: 0
pageNumber: 0,
lightText: '#fff',
darkText: '#000',
tagColors: [
{
fill: '--green-1',
text: this.darkText
},
{
fill: '--blue-2',
text: this.lightText
},
{
fill: '--blue-4',
text: this.lightText
},
{
fill: '--logo-coral',
text: this.darkText
},
{
fill: '--logo-mint',
text: this.darkText
},
{
fill: '--logo-navy',
text: this.lightText
},
{
fill: '--logo-green',
text: this.darkText
}
]
}
},
computed: {
Expand Down Expand Up @@ -313,6 +371,38 @@ export default {
margin-bottom: 2em;
}
.entity-tags {
display: inline-flex;
align-items: stretch;
font-size: 12px;
text-transform: uppercase;
background-color: #fff;
&:not(:last-of-type) {
margin-right: 0.5rem;
margin-bottom: 0.25rem;
}
}
.entity-tags__label {
--color: var(--blue-1);
position: relative;
background-color: var(--color);
color: #fff;
border-radius: 5px 0 0 5px;
padding: 0.15rem 0.5rem;
box-shadow: inset 0 0 0 1px var(--color);
}
.entity-tags__value {
background-color: #fff;
border-radius: 0 5px 5px 0;
padding: 0.15rem 0.5rem 0.15rem 0.75rem;
color: currentColor;
box-shadow: inset 0 0 0 1px currentColor;
}
@media only screen and (min-width: 841px) {
.info-grid {
Expand Down
3 changes: 2 additions & 1 deletion src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ export function humanReadableDate (tdate) {
return '1 week ago'
}

return 'on ' + systemDate
// return 'on ' + systemDate
return `on ${systemDate.toLocaleDateString()}`
}

/**
Expand Down
34 changes: 32 additions & 2 deletions src/views/Entities/EntityDataplanes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,42 @@ export default {
if (inbound) {
/** inbound */
for (let i = 0; i < inbound.length; i++) {
tags = dpTagCleaner(inbound[i].tags)
const rawTags = inbound[i].tags
const final = []
const tagKeys = Object.keys(rawTags)
const tagVals = Object.values(rawTags)
for (let x = 0; x < tagKeys.length; x++) {
final.push({
label: tagKeys[x],
value: tagVals[x]
})
}
tags = final
}
} else if (gateway) {
/** gateway */
tags = dpTagCleaner(gateway.tags)
const items = gateway.tags
for (let i = 0; i < Object.keys(items).length; i++) {
const final = []
const tagKeys = Object.keys(items)
const tagVals = Object.values(items)
for (let x = 0; x < tagKeys.length; x++) {
final.push({
label: tagKeys[x],
value: tagVals[x]
})
}
tags = final
}
}
} else {
tags = 'none'
}
/**
Expand Down

0 comments on commit 84d9d4b

Please sign in to comment.