|
|
|
@ -77,7 +77,7 @@ export const generateColumns = ( |
|
|
|
|
const selected = selection(kind, uid); |
|
|
|
|
const hasUID = uid != null; // Panels don't have UID! Likely should not be shown on pages with manage options
|
|
|
|
|
return ( |
|
|
|
|
<div {...p.cellProps} className={p.cellStyle}> |
|
|
|
|
<div {...p.cellProps}> |
|
|
|
|
<div className={styles.checkbox}> |
|
|
|
|
<Checkbox |
|
|
|
|
disabled={!hasUID} |
|
|
|
@ -99,7 +99,7 @@ export const generateColumns = ( |
|
|
|
|
width = Math.max(availableWidth * 0.2, 300); |
|
|
|
|
columns.push({ |
|
|
|
|
Cell: (p) => { |
|
|
|
|
let classNames = cx(p.cellStyle, styles.cellWrapper); |
|
|
|
|
let classNames = cx(styles.nameCellStyle); |
|
|
|
|
let name = access.name.values.get(p.row.index); |
|
|
|
|
if (!name?.length) { |
|
|
|
|
name = 'Missing title'; // normal for panels
|
|
|
|
@ -113,7 +113,9 @@ export const generateColumns = ( |
|
|
|
|
}, |
|
|
|
|
id: `column-name`, |
|
|
|
|
field: access.name!, |
|
|
|
|
Header: 'Name', |
|
|
|
|
Header: () => { |
|
|
|
|
return <div className={styles.headerNameStyle}>Name</div>; |
|
|
|
|
}, |
|
|
|
|
width, |
|
|
|
|
}); |
|
|
|
|
availableWidth -= width; |
|
|
|
@ -122,33 +124,15 @@ export const generateColumns = ( |
|
|
|
|
columns.push(makeTypeColumn(access.kind, access.panel_type, width, styles)); |
|
|
|
|
availableWidth -= width; |
|
|
|
|
|
|
|
|
|
// Show datasources if we have any
|
|
|
|
|
if (access.ds_uid && onDatasourceChange) { |
|
|
|
|
width = DATASOURCE_COLUMN_WIDTH; |
|
|
|
|
columns.push( |
|
|
|
|
makeDataSourceColumn( |
|
|
|
|
access.ds_uid, |
|
|
|
|
width, |
|
|
|
|
styles.typeIcon, |
|
|
|
|
styles.datasourceItem, |
|
|
|
|
styles.invalidDatasourceItem, |
|
|
|
|
onDatasourceChange |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
|
availableWidth -= width; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
width = Math.max(availableWidth / 2.5, 200); |
|
|
|
|
columns.push(makeTagsColumn(access.tags, width, styles.tagList, onTagSelected)); |
|
|
|
|
availableWidth -= width; |
|
|
|
|
|
|
|
|
|
const meta = response.view.dataFrame.meta?.custom as SearchResultMeta; |
|
|
|
|
if (meta?.locationInfo && availableWidth > 0) { |
|
|
|
|
width = Math.max(availableWidth / 1.75, 300); |
|
|
|
|
availableWidth -= width; |
|
|
|
|
columns.push({ |
|
|
|
|
Cell: (p) => { |
|
|
|
|
const parts = (access.location?.values.get(p.row.index) ?? '').split('/'); |
|
|
|
|
return ( |
|
|
|
|
<div {...p.cellProps} className={cx(p.cellStyle, styles.locationCellStyle)}> |
|
|
|
|
<div {...p.cellProps} className={cx(styles.locationCellStyle)}> |
|
|
|
|
{parts.map((p) => { |
|
|
|
|
const info = meta.locationInfo[p]; |
|
|
|
|
return info ? ( |
|
|
|
@ -165,10 +149,30 @@ export const generateColumns = ( |
|
|
|
|
id: `column-location`, |
|
|
|
|
field: access.location ?? access.url, |
|
|
|
|
Header: 'Location', |
|
|
|
|
width: availableWidth, |
|
|
|
|
width, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Show datasources if we have any
|
|
|
|
|
if (access.ds_uid && onDatasourceChange) { |
|
|
|
|
width = DATASOURCE_COLUMN_WIDTH; |
|
|
|
|
columns.push( |
|
|
|
|
makeDataSourceColumn( |
|
|
|
|
access.ds_uid, |
|
|
|
|
width, |
|
|
|
|
styles.typeIcon, |
|
|
|
|
styles.datasourceItem, |
|
|
|
|
styles.invalidDatasourceItem, |
|
|
|
|
onDatasourceChange |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
|
availableWidth -= width; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (availableWidth > 0) { |
|
|
|
|
columns.push(makeTagsColumn(access.tags, availableWidth, styles.tagList, onTagSelected)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (sortField) { |
|
|
|
|
columns.push({ |
|
|
|
|
Header: () => <div className={styles.sortedHeader}>{getFieldDisplayName(sortField)}</div>, |
|
|
|
@ -223,7 +227,7 @@ function makeDataSourceColumn( |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
return ( |
|
|
|
|
<div {...p.cellProps} className={cx(p.cellStyle, datasourceItemClass)}> |
|
|
|
|
<div {...p.cellProps} className={cx(datasourceItemClass)}> |
|
|
|
|
{dslist.map((v, i) => { |
|
|
|
|
const settings = srv.getInstanceSettings(v); |
|
|
|
|
const icon = settings?.meta?.info?.logos?.small; |
|
|
|
@ -283,16 +287,12 @@ function makeTypeColumn( |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case 'panel': |
|
|
|
|
icon = 'public/img/icons/unicons/graph-bar.svg'; |
|
|
|
|
icon = 'public/img/icons/mono/library-panel.svg'; |
|
|
|
|
const type = typeField.values.get(i); |
|
|
|
|
if (type) { |
|
|
|
|
txt = type; |
|
|
|
|
const info = config.panels[txt]; |
|
|
|
|
if (info?.name) { |
|
|
|
|
const v = info.info?.logos.small; |
|
|
|
|
if (v && v.endsWith('.svg')) { |
|
|
|
|
icon = v; |
|
|
|
|
} |
|
|
|
|
txt = info.name; |
|
|
|
|
} else { |
|
|
|
|
switch (type) { |
|
|
|
@ -302,7 +302,6 @@ function makeTypeColumn( |
|
|
|
|
break; |
|
|
|
|
case 'singlestat': // auto-migration
|
|
|
|
|
txt = 'Singlestat'; |
|
|
|
|
icon = `public/app/plugins/panel/stat/img/icn-singlestat-panel.svg`; |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
icon = `public/img/icons/unicons/question.svg`; // plugin not found
|
|
|
|
@ -333,7 +332,7 @@ function makeTagsColumn( |
|
|
|
|
Cell: (p) => { |
|
|
|
|
const tags = field.values.get(p.row.index); |
|
|
|
|
return tags ? ( |
|
|
|
|
<div {...p.cellProps} className={p.cellStyle}> |
|
|
|
|
<div {...p.cellProps}> |
|
|
|
|
<TagList className={tagListClass} tags={tags} onClick={onTagSelected} /> |
|
|
|
|
</div> |
|
|
|
|
) : null; |
|
|
|
|