@backstage/plugin-catalog-react 1.1.4-next.0 → 1.1.4-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/alpha/package.json +1 -1
- package/dist/index.alpha.d.ts +13 -2
- package/dist/index.beta.d.ts +13 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.esm.js +30 -9
- package/dist/index.esm.js.map +1 -1
- package/package.json +16 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-react
|
|
2
2
|
|
|
3
|
+
## 1.1.4-next.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f6033d1121: humanizeEntityRef function can now be forced to include default namespace
|
|
8
|
+
- c86741a052: Support showing counts in option labels of the `EntityTagPicker`. You can enable this by adding the `showCounts` property
|
|
9
|
+
- 7d47def9c4: Removed dependency on `@types/jest`.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
- @backstage/catalog-client@1.1.0-next.2
|
|
12
|
+
- @backstage/catalog-model@1.1.1-next.0
|
|
13
|
+
- @backstage/core-components@0.11.1-next.3
|
|
14
|
+
- @backstage/core-plugin-api@1.0.6-next.3
|
|
15
|
+
- @backstage/errors@1.1.1-next.0
|
|
16
|
+
- @backstage/integration@1.3.1-next.2
|
|
17
|
+
- @backstage/plugin-permission-common@0.6.4-next.2
|
|
18
|
+
- @backstage/plugin-permission-react@0.4.5-next.2
|
|
19
|
+
|
|
20
|
+
## 1.1.4-next.1
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- 817f3196f6: Updated React Router dependencies to be peer dependencies.
|
|
25
|
+
- a6d551fad9: Properly handle free-text entity filtering in the case of empty tag arrays
|
|
26
|
+
- Updated dependencies
|
|
27
|
+
- @backstage/core-components@0.11.1-next.1
|
|
28
|
+
- @backstage/core-plugin-api@1.0.6-next.1
|
|
29
|
+
- @backstage/plugin-permission-react@0.4.5-next.1
|
|
30
|
+
|
|
3
31
|
## 1.1.4-next.0
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
package/alpha/package.json
CHANGED
package/dist/index.alpha.d.ts
CHANGED
|
@@ -431,7 +431,12 @@ export declare class EntityTagFilter implements EntityFilter {
|
|
|
431
431
|
}
|
|
432
432
|
|
|
433
433
|
/** @public */
|
|
434
|
-
export declare const EntityTagPicker: () => JSX.Element | null;
|
|
434
|
+
export declare const EntityTagPicker: (props: EntityTagPickerProps) => JSX.Element | null;
|
|
435
|
+
|
|
436
|
+
/** @public */
|
|
437
|
+
export declare type EntityTagPickerProps = {
|
|
438
|
+
showCounts?: boolean;
|
|
439
|
+
};
|
|
435
440
|
|
|
436
441
|
/**
|
|
437
442
|
* Filters entities where the text matches spec, title or tags.
|
|
@@ -441,6 +446,7 @@ export declare class EntityTextFilter implements EntityFilter {
|
|
|
441
446
|
readonly value: string;
|
|
442
447
|
constructor(value: string);
|
|
443
448
|
filterEntity(entity: Entity): boolean;
|
|
449
|
+
private toUpperArray;
|
|
444
450
|
}
|
|
445
451
|
|
|
446
452
|
/**
|
|
@@ -492,9 +498,14 @@ export declare function getEntityRelations(entity: Entity | undefined, relationT
|
|
|
492
498
|
/** @public */
|
|
493
499
|
export declare function getEntitySourceLocation(entity: Entity, scmIntegrationsApi: ScmIntegrationRegistry): EntitySourceLocation | undefined;
|
|
494
500
|
|
|
495
|
-
/**
|
|
501
|
+
/**
|
|
502
|
+
* @param defaultNamespace - if set to false then namespace is never omitted,
|
|
503
|
+
* if set to string which matches namespace of entity then omitted
|
|
504
|
+
*
|
|
505
|
+
* @public */
|
|
496
506
|
export declare function humanizeEntityRef(entityRef: Entity | CompoundEntityRef, opts?: {
|
|
497
507
|
defaultKind?: string;
|
|
508
|
+
defaultNamespace?: string | false;
|
|
498
509
|
}): string;
|
|
499
510
|
|
|
500
511
|
/**
|
package/dist/index.beta.d.ts
CHANGED
|
@@ -431,7 +431,12 @@ export declare class EntityTagFilter implements EntityFilter {
|
|
|
431
431
|
}
|
|
432
432
|
|
|
433
433
|
/** @public */
|
|
434
|
-
export declare const EntityTagPicker: () => JSX.Element | null;
|
|
434
|
+
export declare const EntityTagPicker: (props: EntityTagPickerProps) => JSX.Element | null;
|
|
435
|
+
|
|
436
|
+
/** @public */
|
|
437
|
+
export declare type EntityTagPickerProps = {
|
|
438
|
+
showCounts?: boolean;
|
|
439
|
+
};
|
|
435
440
|
|
|
436
441
|
/**
|
|
437
442
|
* Filters entities where the text matches spec, title or tags.
|
|
@@ -441,6 +446,7 @@ export declare class EntityTextFilter implements EntityFilter {
|
|
|
441
446
|
readonly value: string;
|
|
442
447
|
constructor(value: string);
|
|
443
448
|
filterEntity(entity: Entity): boolean;
|
|
449
|
+
private toUpperArray;
|
|
444
450
|
}
|
|
445
451
|
|
|
446
452
|
/**
|
|
@@ -492,9 +498,14 @@ export declare function getEntityRelations(entity: Entity | undefined, relationT
|
|
|
492
498
|
/** @public */
|
|
493
499
|
export declare function getEntitySourceLocation(entity: Entity, scmIntegrationsApi: ScmIntegrationRegistry): EntitySourceLocation | undefined;
|
|
494
500
|
|
|
495
|
-
/**
|
|
501
|
+
/**
|
|
502
|
+
* @param defaultNamespace - if set to false then namespace is never omitted,
|
|
503
|
+
* if set to string which matches namespace of entity then omitted
|
|
504
|
+
*
|
|
505
|
+
* @public */
|
|
496
506
|
export declare function humanizeEntityRef(entityRef: Entity | CompoundEntityRef, opts?: {
|
|
497
507
|
defaultKind?: string;
|
|
508
|
+
defaultNamespace?: string | false;
|
|
498
509
|
}): string;
|
|
499
510
|
|
|
500
511
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -431,7 +431,12 @@ export declare class EntityTagFilter implements EntityFilter {
|
|
|
431
431
|
}
|
|
432
432
|
|
|
433
433
|
/** @public */
|
|
434
|
-
export declare const EntityTagPicker: () => JSX.Element | null;
|
|
434
|
+
export declare const EntityTagPicker: (props: EntityTagPickerProps) => JSX.Element | null;
|
|
435
|
+
|
|
436
|
+
/** @public */
|
|
437
|
+
export declare type EntityTagPickerProps = {
|
|
438
|
+
showCounts?: boolean;
|
|
439
|
+
};
|
|
435
440
|
|
|
436
441
|
/**
|
|
437
442
|
* Filters entities where the text matches spec, title or tags.
|
|
@@ -441,6 +446,7 @@ export declare class EntityTextFilter implements EntityFilter {
|
|
|
441
446
|
readonly value: string;
|
|
442
447
|
constructor(value: string);
|
|
443
448
|
filterEntity(entity: Entity): boolean;
|
|
449
|
+
private toUpperArray;
|
|
444
450
|
}
|
|
445
451
|
|
|
446
452
|
/**
|
|
@@ -492,9 +498,14 @@ export declare function getEntityRelations(entity: Entity | undefined, relationT
|
|
|
492
498
|
/** @public */
|
|
493
499
|
export declare function getEntitySourceLocation(entity: Entity, scmIntegrationsApi: ScmIntegrationRegistry): EntitySourceLocation | undefined;
|
|
494
500
|
|
|
495
|
-
/**
|
|
501
|
+
/**
|
|
502
|
+
* @param defaultNamespace - if set to false then namespace is never omitted,
|
|
503
|
+
* if set to string which matches namespace of entity then omitted
|
|
504
|
+
*
|
|
505
|
+
* @public */
|
|
496
506
|
export declare function humanizeEntityRef(entityRef: Entity | CompoundEntityRef, opts?: {
|
|
497
507
|
defaultKind?: string;
|
|
508
|
+
defaultNamespace?: string | false;
|
|
498
509
|
}): string;
|
|
499
510
|
|
|
500
511
|
/**
|
package/dist/index.esm.js
CHANGED
|
@@ -371,7 +371,14 @@ function humanizeEntityRef(entityRef, opts) {
|
|
|
371
371
|
namespace = entityRef.namespace;
|
|
372
372
|
name = entityRef.name;
|
|
373
373
|
}
|
|
374
|
-
if (namespace ===
|
|
374
|
+
if (namespace === void 0 || namespace === "") {
|
|
375
|
+
namespace = DEFAULT_NAMESPACE;
|
|
376
|
+
}
|
|
377
|
+
if ((opts == null ? void 0 : opts.defaultNamespace) !== void 0) {
|
|
378
|
+
if ((opts == null ? void 0 : opts.defaultNamespace) === namespace) {
|
|
379
|
+
namespace = void 0;
|
|
380
|
+
}
|
|
381
|
+
} else if (namespace === DEFAULT_NAMESPACE) {
|
|
375
382
|
namespace = void 0;
|
|
376
383
|
}
|
|
377
384
|
kind = kind.toLocaleLowerCase("en-US");
|
|
@@ -474,9 +481,21 @@ class EntityTextFilter {
|
|
|
474
481
|
this.value = value;
|
|
475
482
|
}
|
|
476
483
|
filterEntity(entity) {
|
|
477
|
-
|
|
478
|
-
const
|
|
479
|
-
|
|
484
|
+
const words = this.toUpperArray(this.value.split(/\s/));
|
|
485
|
+
const exactMatch = this.toUpperArray([entity.metadata.tags]);
|
|
486
|
+
const partialMatch = this.toUpperArray([
|
|
487
|
+
entity.metadata.name,
|
|
488
|
+
entity.metadata.title
|
|
489
|
+
]);
|
|
490
|
+
for (const word of words) {
|
|
491
|
+
if (exactMatch.every((m) => m !== word) && partialMatch.every((m) => !m.includes(word))) {
|
|
492
|
+
return false;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
return true;
|
|
496
|
+
}
|
|
497
|
+
toUpperArray(value) {
|
|
498
|
+
return value.flat().filter((m) => Boolean(m)).map((m) => m.toLocaleUpperCase("en-US"));
|
|
480
499
|
}
|
|
481
500
|
}
|
|
482
501
|
class EntityOwnerFilter {
|
|
@@ -1189,7 +1208,7 @@ const icon$1 = /* @__PURE__ */ React.createElement(CheckBoxOutlineBlankIcon, {
|
|
|
1189
1208
|
const checkedIcon$1 = /* @__PURE__ */ React.createElement(CheckBoxIcon, {
|
|
1190
1209
|
fontSize: "small"
|
|
1191
1210
|
});
|
|
1192
|
-
const EntityTagPicker = () => {
|
|
1211
|
+
const EntityTagPicker = (props) => {
|
|
1193
1212
|
var _a, _b;
|
|
1194
1213
|
const classes = useStyles$8();
|
|
1195
1214
|
const {
|
|
@@ -1205,7 +1224,9 @@ const EntityTagPicker = () => {
|
|
|
1205
1224
|
facets: [facet],
|
|
1206
1225
|
filter: (_a2 = filters.kind) == null ? void 0 : _a2.getCatalogFilters()
|
|
1207
1226
|
});
|
|
1208
|
-
return
|
|
1227
|
+
return Object.fromEntries(
|
|
1228
|
+
facets[facet].map(({ value, count }) => [value, count])
|
|
1229
|
+
);
|
|
1209
1230
|
}, [filters.kind]);
|
|
1210
1231
|
const queryParamTags = useMemo(
|
|
1211
1232
|
() => [tagsParameter].flat().filter(Boolean),
|
|
@@ -1224,7 +1245,7 @@ const EntityTagPicker = () => {
|
|
|
1224
1245
|
tags: selectedTags.length ? new EntityTagFilter(selectedTags) : void 0
|
|
1225
1246
|
});
|
|
1226
1247
|
}, [selectedTags, updateFilters]);
|
|
1227
|
-
if (!(availableTags
|
|
1248
|
+
if (!Object.keys(availableTags != null ? availableTags : {}).length)
|
|
1228
1249
|
return null;
|
|
1229
1250
|
return /* @__PURE__ */ React.createElement(Box, {
|
|
1230
1251
|
pb: 1,
|
|
@@ -1234,7 +1255,7 @@ const EntityTagPicker = () => {
|
|
|
1234
1255
|
component: "label"
|
|
1235
1256
|
}, "Tags", /* @__PURE__ */ React.createElement(Autocomplete, {
|
|
1236
1257
|
multiple: true,
|
|
1237
|
-
options: availableTags,
|
|
1258
|
+
options: Object.keys(availableTags != null ? availableTags : {}),
|
|
1238
1259
|
value: selectedTags,
|
|
1239
1260
|
onChange: (_, value) => setSelectedTags(value),
|
|
1240
1261
|
renderOption: (option, { selected }) => /* @__PURE__ */ React.createElement(FormControlLabel, {
|
|
@@ -1243,7 +1264,7 @@ const EntityTagPicker = () => {
|
|
|
1243
1264
|
checkedIcon: checkedIcon$1,
|
|
1244
1265
|
checked: selected
|
|
1245
1266
|
}),
|
|
1246
|
-
label: option
|
|
1267
|
+
label: props.showCounts ? `${option} (${availableTags == null ? void 0 : availableTags[option]})` : option
|
|
1247
1268
|
}),
|
|
1248
1269
|
size: "small",
|
|
1249
1270
|
popupIcon: /* @__PURE__ */ React.createElement(ExpandMoreIcon, {
|