UI/Truncate long secret names (#13032)
* small bar chart attr fix * truncates and adds ellipsis of label is long * adds tooltip for long labels * updates storybook * adds changelog * only calculate overflow if query selectors grab elements * moves tooltip pointer to left
This commit is contained in:
parent
7bc177abc6
commit
bfc6467e55
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:bug
|
||||||
|
ui: Fixes long secret key names overlapping masked values
|
||||||
|
```
|
|
@ -90,3 +90,17 @@
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.label-overflow {
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
|
||||||
|
// inline display necessary for nested elements so ellipsis shows
|
||||||
|
> div {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
> div > span {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
font-size: $size-7;
|
font-size: $size-7;
|
||||||
text-transform: none;
|
text-transform: none;
|
||||||
margin: 8px 0px 0 -4px;
|
margin: 8px 0px 0 -4px;
|
||||||
|
|
||||||
.box {
|
.box {
|
||||||
position: relative;
|
position: relative;
|
||||||
color: $white;
|
color: $white;
|
||||||
|
@ -10,6 +11,11 @@
|
||||||
padding: 0.5rem;
|
padding: 0.5rem;
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.fit-content {
|
||||||
|
max-width: fit-content;
|
||||||
|
}
|
||||||
|
|
||||||
@include css-top-arrow(8px, $grey, 1px, $grey-dark, 20px);
|
@include css-top-arrow(8px, $grey, 1px, $grey-dark, 20px);
|
||||||
&.ember-basic-dropdown-content--below.ember-basic-dropdown--transitioning-in {
|
&.ember-basic-dropdown-content--below.ember-basic-dropdown--transitioning-in {
|
||||||
animation: drop-fade-above 0.15s;
|
animation: drop-fade-above 0.15s;
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
* @param {string} title - title of the chart
|
* @param {string} title - title of the chart
|
||||||
* @param {array} mapLegend - array of objects with key names 'key' and 'label' for the map legend
|
* @param {array} mapLegend - array of objects with key names 'key' and 'label' for the map legend
|
||||||
* @param {object} dataset - dataset for the chart
|
* @param {object} dataset - dataset for the chart
|
||||||
* @param {array} tooltipData - misc. information needed to display tooltip (i.e. total clients from query params)
|
* @param {any} tooltipData - misc. information needed to display tooltip (i.e. total clients from query params)
|
||||||
* @param {string} [description] - description of the chart
|
* @param {string} [description] - description of the chart
|
||||||
* @param {string} [labelKey=label] - labelKey is the key name in the dataset passed in that corresponds to the value labeling the y-axis
|
* @param {string} [labelKey=label] - labelKey is the key name in the dataset passed in that corresponds to the value labeling the y-axis
|
||||||
* @param {function} [onClick] - takes function from parent and passes it to click event on data bars
|
* @param {function} [onClick] - takes function from parent and passes it to click event on data bars
|
||||||
|
|
|
@ -42,6 +42,7 @@ export default Component.extend({
|
||||||
tooltipText: '',
|
tooltipText: '',
|
||||||
isTooltipCopyable: false,
|
isTooltipCopyable: false,
|
||||||
defaultShown: '',
|
defaultShown: '',
|
||||||
|
hasLabelOverflow: false, // is calculated and set in didInsertElement
|
||||||
|
|
||||||
valueIsBoolean: computed('value', function() {
|
valueIsBoolean: computed('value', function() {
|
||||||
return typeOf(this.value) === 'boolean';
|
return typeOf(this.value) === 'boolean';
|
||||||
|
@ -63,4 +64,16 @@ export default Component.extend({
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
didInsertElement() {
|
||||||
|
this._super(...arguments);
|
||||||
|
const labelDiv = this.element.querySelector('div');
|
||||||
|
const labelText = this.element.querySelector('.is-label');
|
||||||
|
if (labelDiv && labelText) {
|
||||||
|
if (labelText.offsetWidth > labelDiv.offsetWidth) {
|
||||||
|
labelDiv.classList.add('label-overflow');
|
||||||
|
this.set('hasLabelOverflow', true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,23 @@
|
||||||
{{#if (or alwaysRender value)}}
|
{{#if (or alwaysRender value)}}
|
||||||
<div class="column is-one-quarter" data-test-label-div>
|
<div class="column is-one-quarter" data-test-label-div>
|
||||||
{{#if label}}
|
{{#if label}}
|
||||||
<span class="is-label has-text-grey-dark" data-test-row-label="{{label}}">{{label}}</span>
|
{{#if hasLabelOverflow}}
|
||||||
|
<ToolTip
|
||||||
|
@verticalPosition="below"
|
||||||
|
@horizontalPosition="left"
|
||||||
|
as |T|>
|
||||||
|
<T.trigger @tabindex=false>
|
||||||
|
<span class="is-label has-text-grey-dark" data-test-row-label="{{label}}">{{label}}</span>
|
||||||
|
</T.trigger>
|
||||||
|
<T.content @class="tool-tip">
|
||||||
|
<div class="box fit-content">
|
||||||
|
{{label}}
|
||||||
|
</div>
|
||||||
|
</T.content>
|
||||||
|
</ToolTip>
|
||||||
|
{{else}}
|
||||||
|
<span class="is-label has-text-grey-dark" data-test-row-label="{{label}}">{{label}}</span>
|
||||||
|
{{/if}}
|
||||||
{{#if helperText}}
|
{{#if helperText}}
|
||||||
<div>
|
<div>
|
||||||
<span class="is-label helper-text has-text-grey">{{helperText}}</span>
|
<span class="is-label helper-text has-text-grey">{{helperText}}</span>
|
||||||
|
|
|
@ -19,6 +19,7 @@ that the value breaks under the label on smaller viewports.
|
||||||
| [backend] | <code>String</code> | | Passed through to InfoTableItemArray. To specify secrets backend to point link to Ex: transformation |
|
| [backend] | <code>String</code> | | Passed through to InfoTableItemArray. To specify secrets backend to point link to Ex: transformation |
|
||||||
| [viewAll] | <code>String</code> | | Passed through to InfoTableItemArray. Specify the word at the end of the link View all. |
|
| [viewAll] | <code>String</code> | | Passed through to InfoTableItemArray. Specify the word at the end of the link View all. |
|
||||||
| [tooltipText] | <code>String</code> | | Text if a tooltip should display over the value. |
|
| [tooltipText] | <code>String</code> | | Text if a tooltip should display over the value. |
|
||||||
|
| [isTooltipCopyable] | <code>Boolean</code> | | Allows tooltip click to copy |
|
||||||
| [defaultShown] | <code>String</code> | | Text that renders as value if alwaysRender=true. Eg. "Vault default" |
|
| [defaultShown] | <code>String</code> | | Text that renders as value if alwaysRender=true. Eg. "Vault default" |
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
|
|
|
@ -16,14 +16,18 @@ storiesOf('InfoTable/InfoTableRow', module)
|
||||||
@label={{label}}
|
@label={{label}}
|
||||||
@helperText={{helperText}}
|
@helperText={{helperText}}
|
||||||
@alwaysRender={{alwaysRender}}
|
@alwaysRender={{alwaysRender}}
|
||||||
@tooltipText={{tooltipText}} />
|
@defaultShown={{defaultShown}}
|
||||||
|
@tooltipText={{tooltipText}}
|
||||||
|
@isTooltipCopyable={{isTooltipCopyable}} />
|
||||||
`,
|
`,
|
||||||
context: {
|
context: {
|
||||||
label: text('Label', 'TTL'),
|
label: text('Label', 'TTL'),
|
||||||
value: text('Value', '30m (hover to see the tooltip!)'),
|
value: text('Value', '30m (hover to see the tooltip!)'),
|
||||||
helperText: text('helperText', 'This is helperText - for a short description'),
|
helperText: text('helperText', 'This is helperText - for a short description'),
|
||||||
alwaysRender: boolean('Always render?', false),
|
alwaysRender: boolean('Always render?', false),
|
||||||
|
defaultShown: text('Default value', 'Some default value'),
|
||||||
tooltipText: text('tooltipText', 'This is tooltipText'),
|
tooltipText: text('tooltipText', 'This is tooltipText'),
|
||||||
|
isTooltipCopyable: boolean('Allow tooltip to be copied', true),
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
{ notes }
|
{ notes }
|
||||||
|
|
Loading…
Reference in New Issue