Skip to content

Commit

Permalink
GUI Launch form parameter 'metadata': display metadata class name on …
Browse files Browse the repository at this point in the history
…the Log form
  • Loading branch information
rodichenko committed Oct 2, 2023
1 parent 3eb4a6d commit 3305c1d
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 46 deletions.
12 changes: 10 additions & 2 deletions client/src/components/pipelines/launch/dialogs/MetadataBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export default class MetadataBrowser extends React.Component {
selectedMetadataClassEntity = this.state.selectedMetadataClassEntity[0].name;
folderId = this.state.selectedMetadataClassEntity[0].parent.parentId;
}
const entitiesIds = this.state.selectedMetadata.map(metadata => metadata.rowKey.value);
const entitiesIds = this.state.selectedMetadata.slice();
const metadataLibraryLocation = {
folderId: this.state.folderId,
metadataClassName: this.state.metadataClassName
Expand Down Expand Up @@ -375,7 +375,15 @@ export default class MetadataBrowser extends React.Component {
};

onSelectMetadataItems = (items) => {
const selectedMetadata = items || [];
const selectedMetadata = (items || []).map((o) => {
if (typeof o === 'number') {
return o;
}
if (typeof o === 'object' && o.rowKey) {
return Number(o.rowKey.value);
}
return undefined;
}).filter(Boolean);
this.setState({selectedMetadata});
};

Expand Down
112 changes: 68 additions & 44 deletions client/src/components/runs/logs/Log.js
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,8 @@ class Logs extends localization.LocalizedReactComponent {
</td>
</tr>
);
} else if (runParameter.name === CP_CAP_LIMIT_MOUNTS) {
}
if (runParameter.name === CP_CAP_LIMIT_MOUNTS) {
const values = (valueSelector() || '').split(',').map(v => v.trim());
const isNone = /^none$/i.test(valueSelector());
return (
Expand All @@ -486,59 +487,82 @@ class Logs extends localization.LocalizedReactComponent {
</td>
</tr>
);
} else {
let values = (valueSelector() || '').split(',').map(v => v.trim());
if (values.length === 1) {
}
if (/^metadata$/i.test(runParameter.type)) {
const [metadataFolder, metadataClassName, itemsStr] = (valueSelector() || '').split(':');
if (metadataFolder && metadataClassName && itemsStr) {
const itemsCount = itemsStr.split(/[,;]/).length;
return (
<tr
key={runParameter.name}>
<td className={styles.taskParameterName}>{runParameter.name}:</td>
<td>{values[0]}</td>
</tr>
);
} else if (values.length <= MAX_PARAMETER_VALUES_TO_DISPLAY + 1) {
return (
<tr key={runParameter.name}>
<td className={styles.taskParameterName}>
<span>{runParameter.name}:</span>
</td>
<td>
<ul>
{values.map((value, index) => <li key={index}>{value}</li>)}
</ul>
</td>
</tr>
);
} else {
return (
<tr key={runParameter.name}>
<td className={styles.taskParameterName}>
<span>{runParameter.name}:</span>
</td>
<td>
<ul>
{
values
.filter((value, index) => index < MAX_PARAMETER_VALUES_TO_DISPLAY)
.map((value, index) => <li key={index}>{value}</li>)
}
<li>
<Popover
placement="right"
content={
<div style={{maxHeight: '50vh', overflow: 'auto', paddingRight: 20}}>
{values.map((value, index) => <Row key={index}>{value}</Row>)}
</div>
}>
<a>And {values.length - MAX_PARAMETER_VALUES_TO_DISPLAY} more</a>
</Popover>
</li>
</ul>
<Link to={`/folder/${metadataFolder}/metadata/${metadataClassName}`}>
{metadataClassName} ({itemsCount})
</Link>
</td>
</tr>
);
}
return (
<tr
key={runParameter.name}>
<td className={styles.taskParameterName}>{runParameter.name}:</td>
<td>{valueSelector()}</td>
</tr>
);
}
let values = (valueSelector() || '').split(',').map(v => v.trim());
if (values.length === 1) {
return (
<tr
key={runParameter.name}>
<td className={styles.taskParameterName}>{runParameter.name}:</td>
<td>{values[0]}</td>
</tr>
);
}
if (values.length <= MAX_PARAMETER_VALUES_TO_DISPLAY + 1) {
return (
<tr key={runParameter.name}>
<td className={styles.taskParameterName}>
<span>{runParameter.name}:</span>
</td>
<td>
<ul>
{values.map((value, index) => <li key={index}>{value}</li>)}
</ul>
</td>
</tr>
);
}
return (
<tr key={runParameter.name}>
<td className={styles.taskParameterName}>
<span>{runParameter.name}:</span>
</td>
<td>
<ul>
{
values
.filter((value, index) => index < MAX_PARAMETER_VALUES_TO_DISPLAY)
.map((value, index) => <li key={index}>{value}</li>)
}
<li>
<Popover
placement="right"
content={
<div style={{maxHeight: '50vh', overflow: 'auto', paddingRight: 20}}>
{values.map((value, index) => <Row key={index}>{value}</Row>)}
</div>
}>
<a>And {values.length - MAX_PARAMETER_VALUES_TO_DISPLAY} more</a>
</Popover>
</li>
</ul>
</td>
</tr>
);
};

@computed
Expand Down

0 comments on commit 3305c1d

Please sign in to comment.