@backstage-community/plugin-entity-feedback 0.2.18
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 +821 -0
- package/README.md +140 -0
- package/dist/esm/FeedbackRatingsTable-O2SrWgAE.esm.js +99 -0
- package/dist/esm/FeedbackRatingsTable-O2SrWgAE.esm.js.map +1 -0
- package/dist/esm/FeedbackResponseDialog-FxuGsr7u.esm.js +112 -0
- package/dist/esm/FeedbackResponseDialog-FxuGsr7u.esm.js.map +1 -0
- package/dist/esm/LikeDislikeButtons-D7M8hiAk.esm.js +109 -0
- package/dist/esm/LikeDislikeButtons-D7M8hiAk.esm.js.map +1 -0
- package/dist/esm/StarredRatingButtons-7kGQPIqk.esm.js +112 -0
- package/dist/esm/StarredRatingButtons-7kGQPIqk.esm.js.map +1 -0
- package/dist/esm/index-6WuZOQ2W.esm.js +51 -0
- package/dist/esm/index-6WuZOQ2W.esm.js.map +1 -0
- package/dist/esm/index-BNjpfNYP.esm.js +30 -0
- package/dist/esm/index-BNjpfNYP.esm.js.map +1 -0
- package/dist/esm/index-CV29yHQA.esm.js +33 -0
- package/dist/esm/index-CV29yHQA.esm.js.map +1 -0
- package/dist/esm/index-DKWcikxI.esm.js +25 -0
- package/dist/esm/index-DKWcikxI.esm.js.map +1 -0
- package/dist/esm/index-iIL-rmvF.esm.js +46 -0
- package/dist/esm/index-iIL-rmvF.esm.js.map +1 -0
- package/dist/esm/index-xB2VxWp7.esm.js +83 -0
- package/dist/esm/index-xB2VxWp7.esm.js.map +1 -0
- package/dist/index.d.ts +152 -0
- package/dist/index.esm.js +257 -0
- package/dist/index.esm.js.map +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { F as FeedbackRatingsTable } from './FeedbackRatingsTable-O2SrWgAE.esm.js';
|
|
3
|
+
import { F as FeedbackRatings } from './LikeDislikeButtons-D7M8hiAk.esm.js';
|
|
4
|
+
import '@backstage/catalog-model';
|
|
5
|
+
import '@backstage/core-components';
|
|
6
|
+
import '@backstage/core-plugin-api';
|
|
7
|
+
import '@backstage/plugin-catalog-react';
|
|
8
|
+
import 'react-use/esm/useAsync';
|
|
9
|
+
import '@backstage/errors';
|
|
10
|
+
import '../index.esm.js';
|
|
11
|
+
import '@material-ui/core/IconButton';
|
|
12
|
+
import '@material-ui/core/Tooltip';
|
|
13
|
+
import '@material-ui/icons/ThumbDown';
|
|
14
|
+
import '@material-ui/icons/ThumbUp';
|
|
15
|
+
import '@material-ui/icons/ThumbDownOutlined';
|
|
16
|
+
import '@material-ui/icons/ThumbUpOutlined';
|
|
17
|
+
import 'react-use/esm/useAsyncFn';
|
|
18
|
+
import './FeedbackResponseDialog-FxuGsr7u.esm.js';
|
|
19
|
+
import '@material-ui/core/Button';
|
|
20
|
+
import '@material-ui/core/Checkbox';
|
|
21
|
+
import '@material-ui/core/Dialog';
|
|
22
|
+
import '@material-ui/core/DialogActions';
|
|
23
|
+
import '@material-ui/core/DialogContent';
|
|
24
|
+
import '@material-ui/core/DialogTitle';
|
|
25
|
+
import '@material-ui/core/FormControl';
|
|
26
|
+
import '@material-ui/core/FormControlLabel';
|
|
27
|
+
import '@material-ui/core/FormGroup';
|
|
28
|
+
import '@material-ui/core/FormLabel';
|
|
29
|
+
import '@material-ui/core/Grid';
|
|
30
|
+
import '@material-ui/core/Switch';
|
|
31
|
+
import '@material-ui/core/TextField';
|
|
32
|
+
import '@material-ui/core/Typography';
|
|
33
|
+
import '@material-ui/core/styles';
|
|
34
|
+
|
|
35
|
+
const LikeDislikeRatingsTable = (props) => {
|
|
36
|
+
const { allEntities, ownerRef, title } = props;
|
|
37
|
+
return /* @__PURE__ */ React.createElement(
|
|
38
|
+
FeedbackRatingsTable,
|
|
39
|
+
{
|
|
40
|
+
allEntities,
|
|
41
|
+
ownerRef,
|
|
42
|
+
ratingValues: Object.values(FeedbackRatings).filter(
|
|
43
|
+
(r) => r !== FeedbackRatings.neutral
|
|
44
|
+
),
|
|
45
|
+
title
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export { LikeDislikeRatingsTable };
|
|
51
|
+
//# sourceMappingURL=index-6WuZOQ2W.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-6WuZOQ2W.esm.js","sources":["../../src/components/LikeDislikeRatingsTable/LikeDislikeRatingsTable.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\n\nimport { FeedbackRatingsTable } from '../FeedbackRatingsTable';\nimport { FeedbackRatings } from '../LikeDislikeButtons';\n\n/**\n * @public\n */\nexport interface LikeDislikeRatingsTableProps {\n allEntities?: boolean;\n ownerRef?: string;\n title?: string;\n}\n\nexport const LikeDislikeRatingsTable = (\n props: LikeDislikeRatingsTableProps,\n) => {\n const { allEntities, ownerRef, title } = props;\n\n return (\n <FeedbackRatingsTable\n allEntities={allEntities}\n ownerRef={ownerRef}\n ratingValues={Object.values(FeedbackRatings).filter(\n r => r !== FeedbackRatings.neutral,\n )}\n title={title}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8Ba,MAAA,uBAAA,GAA0B,CACrC,KACG,KAAA;AACH,EAAA,MAAM,EAAE,WAAA,EAAa,QAAU,EAAA,KAAA,EAAU,GAAA,KAAA,CAAA;AAEzC,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,oBAAA;AAAA,IAAA;AAAA,MACC,WAAA;AAAA,MACA,QAAA;AAAA,MACA,YAAc,EAAA,MAAA,CAAO,MAAO,CAAA,eAAe,CAAE,CAAA,MAAA;AAAA,QAC3C,CAAA,CAAA,KAAK,MAAM,eAAgB,CAAA,OAAA;AAAA,OAC7B;AAAA,MACA,KAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export { F as FeedbackRatings, S as StarredRatingButtons } from './StarredRatingButtons-7kGQPIqk.esm.js';
|
|
2
|
+
import '@backstage/catalog-model';
|
|
3
|
+
import '@backstage/core-components';
|
|
4
|
+
import '@backstage/core-plugin-api';
|
|
5
|
+
import '@backstage/plugin-catalog-react';
|
|
6
|
+
import '@material-ui/core/IconButton';
|
|
7
|
+
import '@material-ui/icons/StarOutline';
|
|
8
|
+
import '@material-ui/icons/Star';
|
|
9
|
+
import 'react';
|
|
10
|
+
import 'react-use/esm/useAsync';
|
|
11
|
+
import 'react-use/esm/useAsyncFn';
|
|
12
|
+
import '@backstage/errors';
|
|
13
|
+
import '../index.esm.js';
|
|
14
|
+
import './FeedbackResponseDialog-FxuGsr7u.esm.js';
|
|
15
|
+
import '@material-ui/core/Button';
|
|
16
|
+
import '@material-ui/core/Checkbox';
|
|
17
|
+
import '@material-ui/core/Dialog';
|
|
18
|
+
import '@material-ui/core/DialogActions';
|
|
19
|
+
import '@material-ui/core/DialogContent';
|
|
20
|
+
import '@material-ui/core/DialogTitle';
|
|
21
|
+
import '@material-ui/core/FormControl';
|
|
22
|
+
import '@material-ui/core/FormControlLabel';
|
|
23
|
+
import '@material-ui/core/FormGroup';
|
|
24
|
+
import '@material-ui/core/FormLabel';
|
|
25
|
+
import '@material-ui/core/Grid';
|
|
26
|
+
import '@material-ui/core/Switch';
|
|
27
|
+
import '@material-ui/core/TextField';
|
|
28
|
+
import '@material-ui/core/Typography';
|
|
29
|
+
import '@material-ui/core/styles';
|
|
30
|
+
//# sourceMappingURL=index-BNjpfNYP.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-BNjpfNYP.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export { F as FeedbackRatings, L as LikeDislikeButtons } from './LikeDislikeButtons-D7M8hiAk.esm.js';
|
|
2
|
+
import '@backstage/catalog-model';
|
|
3
|
+
import '@backstage/core-components';
|
|
4
|
+
import '@backstage/core-plugin-api';
|
|
5
|
+
import '@backstage/plugin-catalog-react';
|
|
6
|
+
import '@material-ui/core/IconButton';
|
|
7
|
+
import '@material-ui/core/Tooltip';
|
|
8
|
+
import '@material-ui/icons/ThumbDown';
|
|
9
|
+
import '@material-ui/icons/ThumbUp';
|
|
10
|
+
import '@material-ui/icons/ThumbDownOutlined';
|
|
11
|
+
import '@material-ui/icons/ThumbUpOutlined';
|
|
12
|
+
import 'react';
|
|
13
|
+
import 'react-use/esm/useAsync';
|
|
14
|
+
import 'react-use/esm/useAsyncFn';
|
|
15
|
+
import '@backstage/errors';
|
|
16
|
+
import '../index.esm.js';
|
|
17
|
+
import './FeedbackResponseDialog-FxuGsr7u.esm.js';
|
|
18
|
+
import '@material-ui/core/Button';
|
|
19
|
+
import '@material-ui/core/Checkbox';
|
|
20
|
+
import '@material-ui/core/Dialog';
|
|
21
|
+
import '@material-ui/core/DialogActions';
|
|
22
|
+
import '@material-ui/core/DialogContent';
|
|
23
|
+
import '@material-ui/core/DialogTitle';
|
|
24
|
+
import '@material-ui/core/FormControl';
|
|
25
|
+
import '@material-ui/core/FormControlLabel';
|
|
26
|
+
import '@material-ui/core/FormGroup';
|
|
27
|
+
import '@material-ui/core/FormLabel';
|
|
28
|
+
import '@material-ui/core/Grid';
|
|
29
|
+
import '@material-ui/core/Switch';
|
|
30
|
+
import '@material-ui/core/TextField';
|
|
31
|
+
import '@material-ui/core/Typography';
|
|
32
|
+
import '@material-ui/core/styles';
|
|
33
|
+
//# sourceMappingURL=index-CV29yHQA.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-CV29yHQA.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export { F as FeedbackResponseDialog } from './FeedbackResponseDialog-FxuGsr7u.esm.js';
|
|
2
|
+
import '@backstage/catalog-model';
|
|
3
|
+
import '@backstage/core-components';
|
|
4
|
+
import '@backstage/core-plugin-api';
|
|
5
|
+
import '@material-ui/core/Button';
|
|
6
|
+
import '@material-ui/core/Checkbox';
|
|
7
|
+
import '@material-ui/core/Dialog';
|
|
8
|
+
import '@material-ui/core/DialogActions';
|
|
9
|
+
import '@material-ui/core/DialogContent';
|
|
10
|
+
import '@material-ui/core/DialogTitle';
|
|
11
|
+
import '@material-ui/core/FormControl';
|
|
12
|
+
import '@material-ui/core/FormControlLabel';
|
|
13
|
+
import '@material-ui/core/FormGroup';
|
|
14
|
+
import '@material-ui/core/FormLabel';
|
|
15
|
+
import '@material-ui/core/Grid';
|
|
16
|
+
import '@material-ui/core/Switch';
|
|
17
|
+
import '@material-ui/core/TextField';
|
|
18
|
+
import '@material-ui/core/Typography';
|
|
19
|
+
import '@material-ui/core/styles';
|
|
20
|
+
import 'react';
|
|
21
|
+
import 'react-use/esm/useAsyncFn';
|
|
22
|
+
import '@backstage/errors';
|
|
23
|
+
import '../index.esm.js';
|
|
24
|
+
import '@backstage/plugin-catalog-react';
|
|
25
|
+
//# sourceMappingURL=index-DKWcikxI.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-DKWcikxI.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { F as FeedbackRatingsTable } from './FeedbackRatingsTable-O2SrWgAE.esm.js';
|
|
3
|
+
import { F as FeedbackRatings } from './StarredRatingButtons-7kGQPIqk.esm.js';
|
|
4
|
+
import '@backstage/catalog-model';
|
|
5
|
+
import '@backstage/core-components';
|
|
6
|
+
import '@backstage/core-plugin-api';
|
|
7
|
+
import '@backstage/plugin-catalog-react';
|
|
8
|
+
import 'react-use/esm/useAsync';
|
|
9
|
+
import '@backstage/errors';
|
|
10
|
+
import '../index.esm.js';
|
|
11
|
+
import '@material-ui/core/IconButton';
|
|
12
|
+
import '@material-ui/icons/StarOutline';
|
|
13
|
+
import '@material-ui/icons/Star';
|
|
14
|
+
import 'react-use/esm/useAsyncFn';
|
|
15
|
+
import './FeedbackResponseDialog-FxuGsr7u.esm.js';
|
|
16
|
+
import '@material-ui/core/Button';
|
|
17
|
+
import '@material-ui/core/Checkbox';
|
|
18
|
+
import '@material-ui/core/Dialog';
|
|
19
|
+
import '@material-ui/core/DialogActions';
|
|
20
|
+
import '@material-ui/core/DialogContent';
|
|
21
|
+
import '@material-ui/core/DialogTitle';
|
|
22
|
+
import '@material-ui/core/FormControl';
|
|
23
|
+
import '@material-ui/core/FormControlLabel';
|
|
24
|
+
import '@material-ui/core/FormGroup';
|
|
25
|
+
import '@material-ui/core/FormLabel';
|
|
26
|
+
import '@material-ui/core/Grid';
|
|
27
|
+
import '@material-ui/core/Switch';
|
|
28
|
+
import '@material-ui/core/TextField';
|
|
29
|
+
import '@material-ui/core/Typography';
|
|
30
|
+
import '@material-ui/core/styles';
|
|
31
|
+
|
|
32
|
+
const StarredRatingsTable = (props) => {
|
|
33
|
+
const { allEntities, ownerRef, title } = props;
|
|
34
|
+
return /* @__PURE__ */ React.createElement(
|
|
35
|
+
FeedbackRatingsTable,
|
|
36
|
+
{
|
|
37
|
+
allEntities,
|
|
38
|
+
ownerRef,
|
|
39
|
+
ratingValues: Object.values(FeedbackRatings).filter((o) => typeof o === "number").map((r) => r.toString()),
|
|
40
|
+
title
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export { StarredRatingsTable };
|
|
46
|
+
//# sourceMappingURL=index-iIL-rmvF.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-iIL-rmvF.esm.js","sources":["../../src/components/StarredRatingsTable/StarredRatingsTable.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\n\nimport { FeedbackRatingsTable } from '../FeedbackRatingsTable';\nimport { FeedbackRatings } from '../StarredRatingButtons';\n\n/**\n * @public\n */\nexport interface StarredRatingsTableProps {\n allEntities?: boolean;\n ownerRef?: string;\n title?: string;\n}\n\nexport const StarredRatingsTable = (props: StarredRatingsTableProps) => {\n const { allEntities, ownerRef, title } = props;\n\n return (\n <FeedbackRatingsTable\n allEntities={allEntities}\n ownerRef={ownerRef}\n ratingValues={Object.values(FeedbackRatings)\n .filter(o => typeof o === 'number')\n .map(r => r.toString())}\n title={title}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8Ba,MAAA,mBAAA,GAAsB,CAAC,KAAoC,KAAA;AACtE,EAAA,MAAM,EAAE,WAAA,EAAa,QAAU,EAAA,KAAA,EAAU,GAAA,KAAA,CAAA;AAEzC,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,oBAAA;AAAA,IAAA;AAAA,MACC,WAAA;AAAA,MACA,QAAA;AAAA,MACA,YAAc,EAAA,MAAA,CAAO,MAAO,CAAA,eAAe,EACxC,MAAO,CAAA,CAAA,CAAA,KAAK,OAAO,CAAA,KAAM,QAAQ,CACjC,CAAA,GAAA,CAAI,CAAK,CAAA,KAAA,CAAA,CAAE,UAAU,CAAA;AAAA,MACxB,KAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { ErrorPanel, Table } from '@backstage/core-components';
|
|
2
|
+
import { useApi } from '@backstage/core-plugin-api';
|
|
3
|
+
import { EntityRefLink } from '@backstage/plugin-catalog-react';
|
|
4
|
+
import Chip from '@material-ui/core/Chip';
|
|
5
|
+
import { makeStyles } from '@material-ui/core/styles';
|
|
6
|
+
import CheckIcon from '@material-ui/icons/Check';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import useAsync from 'react-use/esm/useAsync';
|
|
9
|
+
import '@backstage/errors';
|
|
10
|
+
import { entityFeedbackApiRef } from '../index.esm.js';
|
|
11
|
+
import '@backstage/catalog-model';
|
|
12
|
+
|
|
13
|
+
const useStyles = makeStyles((theme) => ({
|
|
14
|
+
consentCheck: {
|
|
15
|
+
color: theme.palette.status.ok
|
|
16
|
+
}
|
|
17
|
+
}));
|
|
18
|
+
const FeedbackResponseTable = (props) => {
|
|
19
|
+
const { entityRef, title = "Entity Responses" } = props;
|
|
20
|
+
const classes = useStyles();
|
|
21
|
+
const feedbackApi = useApi(entityFeedbackApiRef);
|
|
22
|
+
const {
|
|
23
|
+
error,
|
|
24
|
+
loading,
|
|
25
|
+
value: responses
|
|
26
|
+
} = useAsync(async () => {
|
|
27
|
+
if (!entityRef) {
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
return feedbackApi.getResponses(entityRef);
|
|
31
|
+
}, [entityRef, feedbackApi]);
|
|
32
|
+
const columns = [
|
|
33
|
+
{
|
|
34
|
+
title: "User",
|
|
35
|
+
field: "userRef",
|
|
36
|
+
width: "15%",
|
|
37
|
+
render: (response) => /* @__PURE__ */ React.createElement(EntityRefLink, { entityRef: response.userRef, defaultKind: "user" })
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
title: "OK to contact?",
|
|
41
|
+
field: "consent",
|
|
42
|
+
width: "10%",
|
|
43
|
+
render: (response) => response.consent ? /* @__PURE__ */ React.createElement(CheckIcon, { className: classes.consentCheck }) : ""
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
title: "Responses",
|
|
47
|
+
field: "response",
|
|
48
|
+
width: "35%",
|
|
49
|
+
render: (response) => /* @__PURE__ */ React.createElement(React.Fragment, null, (response.response || "").split(",").map((v) => v.trim()).filter(Boolean).map((res) => /* @__PURE__ */ React.createElement(Chip, { key: res, size: "small", label: res })))
|
|
50
|
+
},
|
|
51
|
+
{ title: "Comments", field: "comments", width: "40%" }
|
|
52
|
+
];
|
|
53
|
+
if (error) {
|
|
54
|
+
return /* @__PURE__ */ React.createElement(
|
|
55
|
+
ErrorPanel,
|
|
56
|
+
{
|
|
57
|
+
defaultExpanded: true,
|
|
58
|
+
title: "Failed to load feedback responses",
|
|
59
|
+
error
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
return /* @__PURE__ */ React.createElement(
|
|
64
|
+
Table,
|
|
65
|
+
{
|
|
66
|
+
columns,
|
|
67
|
+
data: responses != null ? responses : [],
|
|
68
|
+
isLoading: loading,
|
|
69
|
+
options: {
|
|
70
|
+
emptyRowsWhenPaging: false,
|
|
71
|
+
loadingType: "linear",
|
|
72
|
+
pageSize: 20,
|
|
73
|
+
pageSizeOptions: [20, 50, 100],
|
|
74
|
+
paging: true,
|
|
75
|
+
showEmptyDataSourceMessage: !loading
|
|
76
|
+
},
|
|
77
|
+
title
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export { FeedbackResponseTable };
|
|
83
|
+
//# sourceMappingURL=index-xB2VxWp7.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-xB2VxWp7.esm.js","sources":["../../src/components/FeedbackResponseTable/FeedbackResponseTable.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ErrorPanel, Table } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { EntityRefLink } from '@backstage/plugin-catalog-react';\nimport { FeedbackResponse } from '@backstage-community/plugin-entity-feedback-common';\nimport Chip from '@material-ui/core/Chip';\nimport { makeStyles } from '@material-ui/core/styles';\nimport CheckIcon from '@material-ui/icons/Check';\nimport React from 'react';\nimport useAsync from 'react-use/esm/useAsync';\n\nimport { entityFeedbackApiRef } from '../../api';\n\ntype ResponseRow = Omit<FeedbackResponse, 'entityRef'>;\n\nconst useStyles = makeStyles(theme => ({\n consentCheck: {\n color: theme.palette.status.ok,\n },\n}));\n\n/**\n * @public\n */\nexport interface FeedbackResponseTableProps {\n entityRef: string;\n title?: string;\n}\n\nexport const FeedbackResponseTable = (props: FeedbackResponseTableProps) => {\n const { entityRef, title = 'Entity Responses' } = props;\n const classes = useStyles();\n const feedbackApi = useApi(entityFeedbackApiRef);\n\n const {\n error,\n loading,\n value: responses,\n } = useAsync(async () => {\n if (!entityRef) {\n return [];\n }\n\n return feedbackApi.getResponses(entityRef);\n }, [entityRef, feedbackApi]);\n\n const columns = [\n {\n title: 'User',\n field: 'userRef',\n width: '15%',\n render: (response: ResponseRow) => (\n <EntityRefLink entityRef={response.userRef} defaultKind=\"user\" />\n ),\n },\n {\n title: 'OK to contact?',\n field: 'consent',\n width: '10%',\n render: (response: ResponseRow) =>\n response.consent ? <CheckIcon className={classes.consentCheck} /> : '',\n },\n {\n title: 'Responses',\n field: 'response',\n width: '35%',\n render: (response: ResponseRow) => (\n <>\n {(response.response || '')\n .split(',')\n .map(v => v.trim()) // removes whitespace\n .filter(Boolean) // removes accidental empty entries\n .map(res => (\n <Chip key={res} size=\"small\" label={res} />\n ))}\n </>\n ),\n },\n { title: 'Comments', field: 'comments', width: '40%' },\n ];\n\n if (error) {\n return (\n <ErrorPanel\n defaultExpanded\n title=\"Failed to load feedback responses\"\n error={error}\n />\n );\n }\n\n return (\n <Table<ResponseRow>\n columns={columns}\n data={(responses ?? []) as ResponseRow[]}\n isLoading={loading}\n options={{\n emptyRowsWhenPaging: false,\n loadingType: 'linear',\n pageSize: 20,\n pageSizeOptions: [20, 50, 100],\n paging: true,\n showEmptyDataSourceMessage: !loading,\n }}\n title={title}\n />\n );\n};\n"],"names":[],"mappings":"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"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { Entity } from '@backstage/catalog-model';
|
|
2
|
+
import React, { ReactNode } from 'react';
|
|
3
|
+
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
4
|
+
import { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';
|
|
5
|
+
import { EntityRatingsData, Rating, Ratings, FeedbackResponse } from '@backstage-community/plugin-entity-feedback-common';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
interface EntityFeedbackResponse {
|
|
11
|
+
id: string;
|
|
12
|
+
label: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
interface FeedbackResponseDialogProps {
|
|
18
|
+
entity: Entity;
|
|
19
|
+
feedbackDialogResponses?: EntityFeedbackResponse[];
|
|
20
|
+
feedbackDialogTitle?: ReactNode;
|
|
21
|
+
open: boolean;
|
|
22
|
+
onClose: () => void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
interface FeedbackResponseTableProps {
|
|
29
|
+
entityRef: string;
|
|
30
|
+
title?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
interface LikeDislikeButtonsProps {
|
|
37
|
+
feedbackDialogResponses?: EntityFeedbackResponse[];
|
|
38
|
+
feedbackDialogTitle?: ReactNode;
|
|
39
|
+
requestResponse?: boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
interface LikeDislikeRatingsTableProps {
|
|
46
|
+
allEntities?: boolean;
|
|
47
|
+
ownerRef?: string;
|
|
48
|
+
title?: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @public
|
|
53
|
+
*/
|
|
54
|
+
interface StarredRatingButtonsProps {
|
|
55
|
+
feedbackDialogResponses?: EntityFeedbackResponse[];
|
|
56
|
+
feedbackDialogTitle?: ReactNode;
|
|
57
|
+
requestResponse?: boolean;
|
|
58
|
+
requestResponseThreshold?: number;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @public
|
|
63
|
+
*/
|
|
64
|
+
interface StarredRatingsTableProps {
|
|
65
|
+
allEntities?: boolean;
|
|
66
|
+
ownerRef?: string;
|
|
67
|
+
title?: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @public
|
|
72
|
+
*/
|
|
73
|
+
declare const entityFeedbackPlugin: _backstage_core_plugin_api.BackstagePlugin<{
|
|
74
|
+
root: _backstage_core_plugin_api.RouteRef<undefined>;
|
|
75
|
+
}, {}, {}>;
|
|
76
|
+
/**
|
|
77
|
+
* @public
|
|
78
|
+
*/
|
|
79
|
+
declare const LikeDislikeButtons: (props: LikeDislikeButtonsProps) => React.JSX.Element;
|
|
80
|
+
/**
|
|
81
|
+
* @public
|
|
82
|
+
*/
|
|
83
|
+
declare const StarredRatingButtons: (props: StarredRatingButtonsProps) => React.JSX.Element;
|
|
84
|
+
/**
|
|
85
|
+
* @public
|
|
86
|
+
*/
|
|
87
|
+
declare const FeedbackResponseDialog: (props: FeedbackResponseDialogProps) => React.JSX.Element;
|
|
88
|
+
/**
|
|
89
|
+
* @public
|
|
90
|
+
*/
|
|
91
|
+
declare const EntityFeedbackResponseContent: () => React.JSX.Element;
|
|
92
|
+
/**
|
|
93
|
+
* @public
|
|
94
|
+
*/
|
|
95
|
+
declare const FeedbackResponseTable: (props: FeedbackResponseTableProps) => React.JSX.Element;
|
|
96
|
+
/**
|
|
97
|
+
* @public
|
|
98
|
+
*/
|
|
99
|
+
declare const EntityLikeDislikeRatingsCard: () => React.JSX.Element;
|
|
100
|
+
/**
|
|
101
|
+
* @public
|
|
102
|
+
*/
|
|
103
|
+
declare const LikeDislikeRatingsTable: (props: LikeDislikeRatingsTableProps) => React.JSX.Element;
|
|
104
|
+
/**
|
|
105
|
+
* @public
|
|
106
|
+
*/
|
|
107
|
+
declare const EntityStarredRatingsCard: () => React.JSX.Element;
|
|
108
|
+
/**
|
|
109
|
+
* @public
|
|
110
|
+
*/
|
|
111
|
+
declare const StarredRatingsTable: (props: StarredRatingsTableProps) => React.JSX.Element;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @public
|
|
115
|
+
*/
|
|
116
|
+
declare const entityFeedbackApiRef: _backstage_core_plugin_api.ApiRef<EntityFeedbackApi>;
|
|
117
|
+
/**
|
|
118
|
+
* @public
|
|
119
|
+
*/
|
|
120
|
+
interface EntityFeedbackApi {
|
|
121
|
+
getAllRatings(): Promise<EntityRatingsData[]>;
|
|
122
|
+
getOwnedRatings(ownerRef: string): Promise<EntityRatingsData[]>;
|
|
123
|
+
recordRating(entityRef: string, rating: string): Promise<void>;
|
|
124
|
+
getRatings(entityRef: string): Promise<Omit<Rating, 'entityRef'>[]>;
|
|
125
|
+
/**
|
|
126
|
+
* Returns anonymized aggregated results for one entityRef
|
|
127
|
+
*/
|
|
128
|
+
getRatingAggregates(entityRef: string): Promise<Ratings>;
|
|
129
|
+
recordResponse(entityRef: string, response: Omit<FeedbackResponse, 'entityRef' | 'userRef'>): Promise<void>;
|
|
130
|
+
getResponses(entityRef: string): Promise<Omit<FeedbackResponse, 'entityRef'>[]>;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* @public
|
|
135
|
+
*/
|
|
136
|
+
declare class EntityFeedbackClient implements EntityFeedbackApi {
|
|
137
|
+
private readonly discoveryApi;
|
|
138
|
+
private readonly fetchApi;
|
|
139
|
+
constructor(options: {
|
|
140
|
+
discoveryApi: DiscoveryApi;
|
|
141
|
+
fetchApi: FetchApi;
|
|
142
|
+
});
|
|
143
|
+
getAllRatings(): Promise<EntityRatingsData[]>;
|
|
144
|
+
getOwnedRatings(ownerRef: string): Promise<EntityRatingsData[]>;
|
|
145
|
+
recordRating(entityRef: string, rating: string): Promise<void>;
|
|
146
|
+
getRatings(entityRef: string): Promise<Omit<Rating, 'entityRef'>[]>;
|
|
147
|
+
getRatingAggregates(entityRef: string): Promise<Ratings>;
|
|
148
|
+
recordResponse(entityRef: string, response: Omit<FeedbackResponse, 'entityRef' | 'userRef'>): Promise<void>;
|
|
149
|
+
getResponses(entityRef: string): Promise<Omit<FeedbackResponse, 'entityRef'>[]>;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export { type EntityFeedbackApi, EntityFeedbackClient, type EntityFeedbackResponse, EntityFeedbackResponseContent, EntityLikeDislikeRatingsCard, EntityStarredRatingsCard, FeedbackResponseDialog, type FeedbackResponseDialogProps, FeedbackResponseTable, type FeedbackResponseTableProps, LikeDislikeButtons, type LikeDislikeButtonsProps, LikeDislikeRatingsTable, type LikeDislikeRatingsTableProps, StarredRatingButtons, type StarredRatingButtonsProps, StarredRatingsTable, type StarredRatingsTableProps, entityFeedbackApiRef, entityFeedbackPlugin };
|