Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: updates info table row jsdoc #20697

Merged
merged 18 commits into from
May 30, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ui/lib/core/addon/components/info-table-row.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
{{else if @formatDate}}
{{date-format @value @formatDate}}
{{else if @formatTtl}}
{{this.formattedTtl}}
{{format-duration @value}}
{{else}}
{{#if (eq @type "array")}}
<InfoTableItemArray
Expand Down
38 changes: 16 additions & 22 deletions ui/lib/core/addon/components/info-table-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { typeOf } from '@ember/utils';
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
import { convertFromSeconds, largestUnitFromSeconds } from 'core/utils/duration-utils';

/**
* @module InfoTableRow
Expand All @@ -19,19 +18,22 @@ import { convertFromSeconds, largestUnitFromSeconds } from 'core/utils/duration-
* <InfoTableRow @value={{5}} @label="TTL" @helperText="Some description"/>
* ```
*
* @param label=null {string} - The display name for the value.
* @param helperText=null {string} - Text to describe the value displayed beneath the label.
* @param value=null {any} - The the data to be displayed - by default the content of the component will only show if there is a value. Also note that special handling is given to boolean values - they will render `Yes` for true and `No` for false. Overridden by block if exists
* @param [alwaysRender=false] {Boolean} - Indicates if the component content should be always be rendered. When false, the value of `value` will be used to determine if the component should render.
* @param [defaultShown] {String} - Text that renders as value if alwaysRender=true. Eg. "Vault default"
* @param [tooltipText] {String} - Text if a tooltip should display over the value.
* @param [isTooltipCopyable] {Boolean} - Allows tooltip click to copy
* @param [type=array] {string} - The type of value being passed in. This is used for when you want to trim an array. For example, if you have an array value that can equal length 15+ this will trim to show 5 and count how many more are there
* @param [isLink=true] {Boolean} - Passed through to InfoTableItemArray. Indicates if the item should contain a link-to component. Only setup for arrays, but this could be changed if needed.
* @param [modelType=null] {string} - Passed through to InfoTableItemArray. Tells what model you want data for the allOptions to be returned from. Used in conjunction with the the isLink.
* @param [queryParam] {String} - Passed through to InfoTableItemArray. If you want to specific a tab for the View All XX to display to. Ex= role
* @param [backend] {String} - Passed through to InfoTableItemArray. To specify secrets backend to point link to Ex= transformation
* @param [viewAll] {String} - Passed through to InfoTableItemArray. Specify the word at the end of the link View all.
* @param {string} label=null - The display name for the value.
* @param {string} helperText=null - Text to describe the value displayed beneath the label.
* @param {any} value=null - The the data to be displayed - by default the content of the component will only show if there is a value. Also note that special handling is given to boolean values - they will render `Yes` for true and `No` for false. Overridden by block if exists
* @param {boolean} [alwaysRender=false] - Indicates if the component content should be always be rendered. When false, the value of `value` will be used to determine if the component should render.
* @param {string} [defaultShown] - Text that renders as value if alwaysRender=true. Eg. "Vault default"
* @param {string} [tooltipText] - Text if a tooltip should display over the value.
* @param {boolean} [isTooltipCopyable] - Allows tooltip click to copy
* @param {string} [formatDate] - A string of the desired date format that's passed to the date-format helper to render timestamps (ex. "MMM d yyyy, h:mm:ss aaa", see: https://date-fns.org/v2.30.0/docs/format)
* @param {boolean} [formatTtl=false] - When true, value is passed to the format-duration helper, useful for TTL values
* @param {string} [type=array] - The type of value being passed in. This is used for when you want to trim an array. For example, if you have an array value that can equal length 15+ this will trim to show 5 and count how many more are there
* * InfoTableItemArray *
* @param {boolean} [isLink=true] - Passed through to InfoTableItemArray. Indicates if the item should contain a link-to component. Only setup for arrays, but this could be changed if needed.
* @param {string} [modelType=null] - Passed through to InfoTableItemArray. Tells what model you want data for the allOptions to be returned from. Used in conjunction with the the isLink.
* @param {string} [queryParam] - Passed through to InfoTableItemArray. If you want to specific a tab for the View All XX to display to. Ex= role
* @param {string} [backend] - Passed through to InfoTableItemArray. To specify secrets backend to point link to Ex= transformation
* @param {string} [viewAll] - Passed through to InfoTableItemArray. Specify the word at the end of the link View all.
*/

export default class InfoTableRowComponent extends Component {
Expand Down Expand Up @@ -62,14 +64,6 @@ export default class InfoTableRowComponent extends Component {
return false;
}
}
get formattedTtl() {
const { value } = this.args;
if (Number.isInteger(value)) {
const unit = largestUnitFromSeconds(value);
return `${convertFromSeconds(value, unit)}${unit}`;
}
return value;
}

@action
calculateLabelOverflow(el) {
Expand Down