@backstage-community/plugin-entity-feedback 0.2.18 → 0.3.0

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.
Files changed (55) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +19 -0
  3. package/dist/api/EntityFeedbackApi.esm.js +8 -0
  4. package/dist/api/EntityFeedbackApi.esm.js.map +1 -0
  5. package/dist/api/EntityFeedbackClient.esm.js +109 -0
  6. package/dist/api/EntityFeedbackClient.esm.js.map +1 -0
  7. package/dist/{esm/FeedbackRatingsTable-O2SrWgAE.esm.js → components/FeedbackRatingsTable/FeedbackRatingsTable.esm.js} +3 -3
  8. package/dist/components/FeedbackRatingsTable/FeedbackRatingsTable.esm.js.map +1 -0
  9. package/dist/components/FeedbackResponseDialog/FeedbackResponseDialog.esm.js +169 -0
  10. package/dist/components/FeedbackResponseDialog/FeedbackResponseDialog.esm.js.map +1 -0
  11. package/dist/components/FeedbackResponseDialog/index.esm.js +2 -0
  12. package/dist/components/FeedbackResponseDialog/index.esm.js.map +1 -0
  13. package/dist/{esm/index-xB2VxWp7.esm.js → components/FeedbackResponseTable/FeedbackResponseTable.esm.js} +27 -4
  14. package/dist/components/FeedbackResponseTable/FeedbackResponseTable.esm.js.map +1 -0
  15. package/dist/components/FeedbackResponseTable/index.esm.js +2 -0
  16. package/dist/components/FeedbackResponseTable/index.esm.js.map +1 -0
  17. package/dist/{esm/LikeDislikeButtons-D7M8hiAk.esm.js → components/LikeDislikeButtons/LikeDislikeButtons.esm.js} +4 -4
  18. package/dist/components/LikeDislikeButtons/LikeDislikeButtons.esm.js.map +1 -0
  19. package/dist/components/LikeDislikeButtons/index.esm.js +2 -0
  20. package/dist/components/LikeDislikeButtons/index.esm.js.map +1 -0
  21. package/dist/components/LikeDislikeRatingsTable/LikeDislikeRatingsTable.esm.js +21 -0
  22. package/dist/components/LikeDislikeRatingsTable/LikeDislikeRatingsTable.esm.js.map +1 -0
  23. package/dist/components/LikeDislikeRatingsTable/index.esm.js +2 -0
  24. package/dist/components/LikeDislikeRatingsTable/index.esm.js.map +1 -0
  25. package/dist/{esm/StarredRatingButtons-7kGQPIqk.esm.js → components/StarredRatingButtons/StarredRatingButtons.esm.js} +4 -4
  26. package/dist/components/StarredRatingButtons/StarredRatingButtons.esm.js.map +1 -0
  27. package/dist/components/StarredRatingButtons/index.esm.js +2 -0
  28. package/dist/components/StarredRatingButtons/index.esm.js.map +1 -0
  29. package/dist/components/StarredRatingsTable/StarredRatingsTable.esm.js +19 -0
  30. package/dist/components/StarredRatingsTable/StarredRatingsTable.esm.js.map +1 -0
  31. package/dist/components/StarredRatingsTable/index.esm.js +2 -0
  32. package/dist/components/StarredRatingsTable/index.esm.js.map +1 -0
  33. package/dist/index.esm.js +3 -256
  34. package/dist/index.esm.js.map +1 -1
  35. package/dist/plugin.esm.js +146 -0
  36. package/dist/plugin.esm.js.map +1 -0
  37. package/dist/routes.esm.js +8 -0
  38. package/dist/routes.esm.js.map +1 -0
  39. package/package.json +9 -7
  40. package/dist/esm/FeedbackRatingsTable-O2SrWgAE.esm.js.map +0 -1
  41. package/dist/esm/FeedbackResponseDialog-FxuGsr7u.esm.js +0 -112
  42. package/dist/esm/FeedbackResponseDialog-FxuGsr7u.esm.js.map +0 -1
  43. package/dist/esm/LikeDislikeButtons-D7M8hiAk.esm.js.map +0 -1
  44. package/dist/esm/StarredRatingButtons-7kGQPIqk.esm.js.map +0 -1
  45. package/dist/esm/index-6WuZOQ2W.esm.js +0 -51
  46. package/dist/esm/index-6WuZOQ2W.esm.js.map +0 -1
  47. package/dist/esm/index-BNjpfNYP.esm.js +0 -30
  48. package/dist/esm/index-BNjpfNYP.esm.js.map +0 -1
  49. package/dist/esm/index-CV29yHQA.esm.js +0 -33
  50. package/dist/esm/index-CV29yHQA.esm.js.map +0 -1
  51. package/dist/esm/index-DKWcikxI.esm.js +0 -25
  52. package/dist/esm/index-DKWcikxI.esm.js.map +0 -1
  53. package/dist/esm/index-iIL-rmvF.esm.js +0 -46
  54. package/dist/esm/index-iIL-rmvF.esm.js.map +0 -1
  55. package/dist/esm/index-xB2VxWp7.esm.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @backstage-community/plugin-entity-feedback
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - f4e4277: Add comment boxes for each checked option in the Feedback Dialog box. Display those option responses as bullet points in the Feedback Response table.
8
+
9
+ ## 0.2.19
10
+
11
+ ### Patch Changes
12
+
13
+ - 063687c: Update dependencies to Backstage version 1.27
14
+ - Updated dependencies [063687c]
15
+ - @backstage-community/plugin-entity-feedback-common@0.1.5
16
+
3
17
  ## 0.2.18
4
18
 
5
19
  ### Patch Changes
package/README.md CHANGED
@@ -138,3 +138,22 @@ const groupPage = (
138
138
  ```
139
139
 
140
140
  Note: For a full example of this you can look at [this EntityPage](../../packages/app/src/components/catalog/EntityPage.tsx).
141
+
142
+ ## Local Development
143
+
144
+ To start the mocked example you need to run the front and backend.
145
+ Start the backend from `workspaces/entity-feedback/plugins/entity-feedback-backend`
146
+
147
+ ```sh
148
+ yarn install
149
+ yarn start
150
+ ```
151
+
152
+ Then start the frontend example from `workspaces/entity-feedback/plugins/entity-feedback`
153
+
154
+ ```sh
155
+ yarn install
156
+ yarn start
157
+ ```
158
+
159
+ Once that is running you can navigate to `http://localhost:3000/feedback`
@@ -0,0 +1,8 @@
1
+ import { createApiRef } from '@backstage/core-plugin-api';
2
+
3
+ const entityFeedbackApiRef = createApiRef({
4
+ id: "plugin.entity-feedback.service"
5
+ });
6
+
7
+ export { entityFeedbackApiRef };
8
+ //# sourceMappingURL=EntityFeedbackApi.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EntityFeedbackApi.esm.js","sources":["../../src/api/EntityFeedbackApi.ts"],"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 { createApiRef } from '@backstage/core-plugin-api';\nimport {\n EntityRatingsData,\n FeedbackResponse,\n Rating,\n Ratings,\n} from '@backstage-community/plugin-entity-feedback-common';\n\n/**\n * @public\n */\nexport const entityFeedbackApiRef = createApiRef<EntityFeedbackApi>({\n id: 'plugin.entity-feedback.service',\n});\n\n/**\n * @public\n */\nexport interface EntityFeedbackApi {\n getAllRatings(): Promise<EntityRatingsData[]>;\n\n getOwnedRatings(ownerRef: string): Promise<EntityRatingsData[]>;\n\n recordRating(entityRef: string, rating: string): Promise<void>;\n\n getRatings(entityRef: string): Promise<Omit<Rating, 'entityRef'>[]>;\n\n /**\n * Returns anonymized aggregated results for one entityRef\n */\n getRatingAggregates(entityRef: string): Promise<Ratings>;\n\n recordResponse(\n entityRef: string,\n response: Omit<FeedbackResponse, 'entityRef' | 'userRef'>,\n ): Promise<void>;\n\n getResponses(\n entityRef: string,\n ): Promise<Omit<FeedbackResponse, 'entityRef'>[]>;\n}\n"],"names":[],"mappings":";;AA2BO,MAAM,uBAAuB,YAAgC,CAAA;AAAA,EAClE,EAAI,EAAA,gCAAA;AACN,CAAC;;;;"}
@@ -0,0 +1,109 @@
1
+ import { ResponseError } from '@backstage/errors';
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5
+ var __publicField = (obj, key, value) => {
6
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
+ return value;
8
+ };
9
+ class EntityFeedbackClient {
10
+ constructor(options) {
11
+ __publicField(this, "discoveryApi");
12
+ __publicField(this, "fetchApi");
13
+ this.discoveryApi = options.discoveryApi;
14
+ this.fetchApi = options.fetchApi;
15
+ }
16
+ async getAllRatings() {
17
+ const baseUrl = await this.discoveryApi.getBaseUrl("entity-feedback");
18
+ const resp = await this.fetchApi.fetch(`${baseUrl}/ratings`, {
19
+ method: "GET"
20
+ });
21
+ if (!resp.ok) {
22
+ throw await ResponseError.fromResponse(resp);
23
+ }
24
+ return resp.json();
25
+ }
26
+ async getOwnedRatings(ownerRef) {
27
+ const baseUrl = await this.discoveryApi.getBaseUrl("entity-feedback");
28
+ const resp = await this.fetchApi.fetch(
29
+ `${baseUrl}/ratings?ownerRef=${encodeURIComponent(ownerRef)}`,
30
+ {
31
+ method: "GET"
32
+ }
33
+ );
34
+ if (!resp.ok) {
35
+ throw await ResponseError.fromResponse(resp);
36
+ }
37
+ return resp.json();
38
+ }
39
+ async recordRating(entityRef, rating) {
40
+ const baseUrl = await this.discoveryApi.getBaseUrl("entity-feedback");
41
+ const resp = await this.fetchApi.fetch(
42
+ `${baseUrl}/ratings/${encodeURIComponent(entityRef)}`,
43
+ {
44
+ headers: { "Content-Type": "application/json" },
45
+ method: "POST",
46
+ body: JSON.stringify({ rating })
47
+ }
48
+ );
49
+ if (!resp.ok) {
50
+ throw await ResponseError.fromResponse(resp);
51
+ }
52
+ }
53
+ async getRatings(entityRef) {
54
+ const baseUrl = await this.discoveryApi.getBaseUrl("entity-feedback");
55
+ const resp = await this.fetchApi.fetch(
56
+ `${baseUrl}/ratings/${encodeURIComponent(entityRef)}`,
57
+ {
58
+ method: "GET"
59
+ }
60
+ );
61
+ if (!resp.ok) {
62
+ throw await ResponseError.fromResponse(resp);
63
+ }
64
+ return resp.json();
65
+ }
66
+ async getRatingAggregates(entityRef) {
67
+ const baseUrl = await this.discoveryApi.getBaseUrl("entity-feedback");
68
+ const resp = await this.fetchApi.fetch(
69
+ `${baseUrl}/ratings/${encodeURIComponent(entityRef)}/aggregate`,
70
+ {
71
+ method: "GET"
72
+ }
73
+ );
74
+ if (!resp.ok) {
75
+ throw await ResponseError.fromResponse(resp);
76
+ }
77
+ return resp.json();
78
+ }
79
+ async recordResponse(entityRef, response) {
80
+ const baseUrl = await this.discoveryApi.getBaseUrl("entity-feedback");
81
+ const resp = await this.fetchApi.fetch(
82
+ `${baseUrl}/responses/${encodeURIComponent(entityRef)}`,
83
+ {
84
+ headers: { "Content-Type": "application/json" },
85
+ method: "POST",
86
+ body: JSON.stringify(response)
87
+ }
88
+ );
89
+ if (!resp.ok) {
90
+ throw await ResponseError.fromResponse(resp);
91
+ }
92
+ }
93
+ async getResponses(entityRef) {
94
+ const baseUrl = await this.discoveryApi.getBaseUrl("entity-feedback");
95
+ const resp = await this.fetchApi.fetch(
96
+ `${baseUrl}/responses/${encodeURIComponent(entityRef)}`,
97
+ {
98
+ method: "GET"
99
+ }
100
+ );
101
+ if (!resp.ok) {
102
+ throw await ResponseError.fromResponse(resp);
103
+ }
104
+ return resp.json();
105
+ }
106
+ }
107
+
108
+ export { EntityFeedbackClient };
109
+ //# sourceMappingURL=EntityFeedbackClient.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EntityFeedbackClient.esm.js","sources":["../../src/api/EntityFeedbackClient.ts"],"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 { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';\nimport { ResponseError } from '@backstage/errors';\nimport {\n EntityRatingsData,\n FeedbackResponse,\n Rating,\n Ratings,\n} from '@backstage-community/plugin-entity-feedback-common';\n\nimport { EntityFeedbackApi } from './EntityFeedbackApi';\n\n/**\n * @public\n */\nexport class EntityFeedbackClient implements EntityFeedbackApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly fetchApi: FetchApi;\n\n constructor(options: { discoveryApi: DiscoveryApi; fetchApi: FetchApi }) {\n this.discoveryApi = options.discoveryApi;\n this.fetchApi = options.fetchApi;\n }\n\n async getAllRatings(): Promise<EntityRatingsData[]> {\n const baseUrl = await this.discoveryApi.getBaseUrl('entity-feedback');\n const resp = await this.fetchApi.fetch(`${baseUrl}/ratings`, {\n method: 'GET',\n });\n\n if (!resp.ok) {\n throw await ResponseError.fromResponse(resp);\n }\n\n return resp.json();\n }\n\n async getOwnedRatings(ownerRef: string): Promise<EntityRatingsData[]> {\n const baseUrl = await this.discoveryApi.getBaseUrl('entity-feedback');\n const resp = await this.fetchApi.fetch(\n `${baseUrl}/ratings?ownerRef=${encodeURIComponent(ownerRef)}`,\n {\n method: 'GET',\n },\n );\n\n if (!resp.ok) {\n throw await ResponseError.fromResponse(resp);\n }\n\n return resp.json();\n }\n\n async recordRating(entityRef: string, rating: string) {\n const baseUrl = await this.discoveryApi.getBaseUrl('entity-feedback');\n const resp = await this.fetchApi.fetch(\n `${baseUrl}/ratings/${encodeURIComponent(entityRef)}`,\n {\n headers: { 'Content-Type': 'application/json' },\n method: 'POST',\n body: JSON.stringify({ rating }),\n },\n );\n\n if (!resp.ok) {\n throw await ResponseError.fromResponse(resp);\n }\n }\n\n async getRatings(entityRef: string): Promise<Omit<Rating, 'entityRef'>[]> {\n const baseUrl = await this.discoveryApi.getBaseUrl('entity-feedback');\n const resp = await this.fetchApi.fetch(\n `${baseUrl}/ratings/${encodeURIComponent(entityRef)}`,\n {\n method: 'GET',\n },\n );\n\n if (!resp.ok) {\n throw await ResponseError.fromResponse(resp);\n }\n\n return resp.json();\n }\n\n async getRatingAggregates(entityRef: string): Promise<Ratings> {\n const baseUrl = await this.discoveryApi.getBaseUrl('entity-feedback');\n const resp = await this.fetchApi.fetch(\n `${baseUrl}/ratings/${encodeURIComponent(entityRef)}/aggregate`,\n {\n method: 'GET',\n },\n );\n\n if (!resp.ok) {\n throw await ResponseError.fromResponse(resp);\n }\n\n return resp.json();\n }\n\n async recordResponse(\n entityRef: string,\n response: Omit<FeedbackResponse, 'entityRef' | 'userRef'>,\n ) {\n const baseUrl = await this.discoveryApi.getBaseUrl('entity-feedback');\n const resp = await this.fetchApi.fetch(\n `${baseUrl}/responses/${encodeURIComponent(entityRef)}`,\n {\n headers: { 'Content-Type': 'application/json' },\n method: 'POST',\n body: JSON.stringify(response),\n },\n );\n\n if (!resp.ok) {\n throw await ResponseError.fromResponse(resp);\n }\n }\n\n async getResponses(\n entityRef: string,\n ): Promise<Omit<FeedbackResponse, 'entityRef'>[]> {\n const baseUrl = await this.discoveryApi.getBaseUrl('entity-feedback');\n const resp = await this.fetchApi.fetch(\n `${baseUrl}/responses/${encodeURIComponent(entityRef)}`,\n {\n method: 'GET',\n },\n );\n\n if (!resp.ok) {\n throw await ResponseError.fromResponse(resp);\n }\n\n return resp.json();\n }\n}\n"],"names":[],"mappings":";;;;;;;;AA8BO,MAAM,oBAAkD,CAAA;AAAA,EAI7D,YAAY,OAA6D,EAAA;AAHzE,IAAiB,aAAA,CAAA,IAAA,EAAA,cAAA,CAAA,CAAA;AACjB,IAAiB,aAAA,CAAA,IAAA,EAAA,UAAA,CAAA,CAAA;AAGf,IAAA,IAAA,CAAK,eAAe,OAAQ,CAAA,YAAA,CAAA;AAC5B,IAAA,IAAA,CAAK,WAAW,OAAQ,CAAA,QAAA,CAAA;AAAA,GAC1B;AAAA,EAEA,MAAM,aAA8C,GAAA;AAClD,IAAA,MAAM,OAAU,GAAA,MAAM,IAAK,CAAA,YAAA,CAAa,WAAW,iBAAiB,CAAA,CAAA;AACpE,IAAA,MAAM,OAAO,MAAM,IAAA,CAAK,SAAS,KAAM,CAAA,CAAA,EAAG,OAAO,CAAY,QAAA,CAAA,EAAA;AAAA,MAC3D,MAAQ,EAAA,KAAA;AAAA,KACT,CAAA,C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U,GAAA,MAAM,IAAK,CAAA,YAAA,CAAa,WAAW,iBAAiB,CAAA,CAAA;AACpE,IAAM,MAAA,IAAA,GAAO,MAAM,IAAA,CAAK,QAAS,CAAA,KAAA;AAAA,MAC/B,CAAG,EAAA,OAAO,CAAc,WAAA,EAAA,kBAAA,CAAmB,SAAS,CAAC,CAAA,CAAA;AAAA,MACrD;AAAA,QACE,OAAA,EAAS,EAAE,cAAA,EAAgB,kBAAmB,EAAA;AAAA,QAC9C,MAAQ,EAAA,MAAA;AAAA,QACR,IAAA,EAAM,IAAK,CAAA,SAAA,CAAU,QAAQ,CAAA;AAAA,OAC/B;AAAA,KACF,CAAA;AAEA,IAAI,IAAA,CAAC,KAAK,EAAI,EAAA;AACZ,MAAM,MAAA,MAAM,aAAc,CAAA,YAAA,CAAa,IAAI,CAAA,CAAA;AAAA,KAC7C;AAAA,GACF;AAAA,EAEA,MAAM,aACJ,SACgD,EAAA;AAChD,IAAA,MAAM,OAAU,GAAA,MAAM,IAAK,CAAA,YAAA,CAAa,WAAW,iBAAiB,CAAA,CAAA;AACpE,IAAM,MAAA,IAAA,GAAO,MAAM,IAAA,CAAK,QAAS,CAAA,KAAA;AAAA,MAC/B,CAAG,EAAA,OAAO,CAAc,WAAA,EAAA,kBAAA,CAAmB,SAAS,CAAC,CAAA,CAAA;AAAA,MACrD;AAAA,QACE,MAAQ,EAAA,KAAA;AAAA,OACV;AAAA,KACF,CAAA;AAEA,IAAI,IAAA,CAAC,KAAK,EAAI,EAAA;AACZ,MAAM,MAAA,MAAM,aAAc,CAAA,YAAA,CAAa,IAAI,CAAA,CAAA;AAAA,KAC7C;AAEA,IAAA,OAAO,KAAK,IAAK,EAAA,CAAA;AAAA,GACnB;AACF;;;;"}
@@ -5,7 +5,7 @@ import { EntityRefLink } from '@backstage/plugin-catalog-react';
5
5
  import React from 'react';
6
6
  import useAsync from 'react-use/esm/useAsync';
7
7
  import '@backstage/errors';
8
- import { entityFeedbackApiRef } from '../index.esm.js';
8
+ import { entityFeedbackApiRef } from '../../api/EntityFeedbackApi.esm.js';
9
9
 
10
10
  const FeedbackRatingsTable = (props) => {
11
11
  const {
@@ -95,5 +95,5 @@ const FeedbackRatingsTable = (props) => {
95
95
  );
96
96
  };
97
97
 
98
- export { FeedbackRatingsTable as F };
99
- //# sourceMappingURL=FeedbackRatingsTable-O2SrWgAE.esm.js.map
98
+ export { FeedbackRatingsTable };
99
+ //# sourceMappingURL=FeedbackRatingsTable.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FeedbackRatingsTable.esm.js","sources":["../../../src/components/FeedbackRatingsTable/FeedbackRatingsTable.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 { parseEntityRef } from '@backstage/catalog-model';\nimport { ErrorPanel, SubvalueCell, Table } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { EntityRefLink } from '@backstage/plugin-catalog-react';\nimport { EntityRatingsData } from '@backstage-community/plugin-entity-feedback-common';\nimport React from 'react';\nimport useAsync from 'react-use/esm/useAsync';\n\nimport { entityFeedbackApiRef } from '../../api';\n\ninterface FeedbackRatingsTableProps {\n allEntities?: boolean;\n ownerRef?: string;\n ratingValues: string[];\n title?: string;\n}\n\nexport const FeedbackRatingsTable = (props: FeedbackRatingsTableProps) => {\n const {\n allEntities,\n ownerRef,\n ratingValues,\n title = 'Entity Ratings',\n } = props;\n const feedbackApi = useApi(entityFeedbackApiRef);\n\n const {\n error,\n loading,\n value: ratings,\n } = useAsync(async () => {\n if (allEntities) {\n return feedbackApi.getAllRatings();\n }\n\n if (!ownerRef) {\n return [];\n }\n\n return feedbackApi.getOwnedRatings(ownerRef);\n }, [allEntities, feedbackApi, ownerRef]);\n\n const columns = [\n { title: 'Title', field: 'entityTitle', hidden: true, searchable: true },\n {\n title: 'Entity',\n field: 'entityRef',\n highlight: true,\n customSort: (a: EntityRatingsData, b: EntityRatingsData) => {\n const titleA = a.entityTitle ?? parseEntityRef(a.entityRef).name;\n const titleB = b.entityTitle ?? parseEntityRef(b.entityRef).name;\n return titleA.localeCompare(titleB);\n },\n render: (rating: EntityRatingsData) => {\n const compoundRef = parseEntityRef(rating.entityRef);\n return (\n <SubvalueCell\n value={\n <EntityRefLink\n entityRef={rating.entityRef}\n defaultKind={compoundRef.kind}\n title={rating.entityTitle}\n />\n }\n subvalue={compoundRef.kind}\n />\n );\n },\n },\n ...ratingValues.map(ratingVal => ({\n title: ratingVal,\n field: `ratings.${ratingVal}`,\n })),\n ];\n\n // Exclude entities that don't have applicable ratings\n const ratingsRows = ratings?.filter(r =>\n Object.keys(r.ratings).some(v => ratingValues.includes(v)),\n );\n\n if (error) {\n return (\n <ErrorPanel\n defaultExpanded\n title=\"Failed to load feedback ratings\"\n error={error}\n />\n );\n }\n\n return (\n <Table<EntityRatingsData>\n columns={columns}\n data={ratingsRows ?? []}\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":";;;;;;;;;AAiCa,MAAA,oBAAA,GAAuB,CAAC,KAAqC,KAAA;AACxE,EAAM,MAAA;AAAA,IACJ,WAAA;AAAA,IACA,QAAA;AAAA,IACA,YAAA;AAAA,IACA,KAAQ,GAAA,gBAAA;AAAA,GACN,GAAA,KAAA,CAAA;AACJ,EAAM,MAAA,WAAA,GAAc,OAAO,oBAAoB,CAAA,CAAA;AAE/C,EAAM,MAAA;AAAA,IACJ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,CAAA;AAAA,QAC7B,MAAQ,EAAA,IAAA;AAAA,QACR,4BAA4B,CAAC,OAAA;AAAA,OAC/B;AAAA,MACA,KAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
@@ -0,0 +1,169 @@
1
+ import { stringifyEntityRef } from '@backstage/catalog-model';
2
+ import { Progress } from '@backstage/core-components';
3
+ import { useApi, errorApiRef } from '@backstage/core-plugin-api';
4
+ import Button from '@material-ui/core/Button';
5
+ import Checkbox from '@material-ui/core/Checkbox';
6
+ import Collapse from '@material-ui/core/Collapse';
7
+ import Dialog from '@material-ui/core/Dialog';
8
+ import DialogActions from '@material-ui/core/DialogActions';
9
+ import DialogContent from '@material-ui/core/DialogContent';
10
+ import DialogTitle from '@material-ui/core/DialogTitle';
11
+ import FormControl from '@material-ui/core/FormControl';
12
+ import FormControlLabel from '@material-ui/core/FormControlLabel';
13
+ import FormGroup from '@material-ui/core/FormGroup';
14
+ import FormLabel from '@material-ui/core/FormLabel';
15
+ import Grid from '@material-ui/core/Grid';
16
+ import Switch from '@material-ui/core/Switch';
17
+ import TextField from '@material-ui/core/TextField';
18
+ import Typography from '@material-ui/core/Typography';
19
+ import { makeStyles } from '@material-ui/core/styles';
20
+ import React, { useState } from 'react';
21
+ import useAsyncFn from 'react-use/esm/useAsyncFn';
22
+ import '@backstage/errors';
23
+ import { entityFeedbackApiRef } from '../../api/EntityFeedbackApi.esm.js';
24
+
25
+ const defaultFeedbackResponses = [
26
+ { id: "incorrect", label: "Incorrect info" },
27
+ { id: "missing", label: "Missing info" },
28
+ { id: "other", label: "Other" }
29
+ ];
30
+ const useStyles = makeStyles(
31
+ (theme) => ({
32
+ contactConsent: {
33
+ marginTop: theme.spacing(1.5)
34
+ },
35
+ commentBoxes: {
36
+ marginBottom: theme.spacing(1.5)
37
+ },
38
+ boxContainer: {
39
+ marginBottom: theme.spacing(1.5),
40
+ marginTop: theme.spacing(1.5),
41
+ marginLeft: theme.spacing(1),
42
+ paddingRight: theme.spacing(1)
43
+ },
44
+ formLabel: {
45
+ marginBottom: theme.spacing(1.5)
46
+ },
47
+ dialogActions: {
48
+ justifyContent: "flex-start"
49
+ }
50
+ }),
51
+ { name: "BackstageEntityFeedbackDialog" }
52
+ );
53
+ const FeedbackResponseDialog = (props) => {
54
+ const {
55
+ entity,
56
+ feedbackDialogResponses = defaultFeedbackResponses,
57
+ feedbackDialogTitle = "Tell us what could be better",
58
+ open,
59
+ onClose
60
+ } = props;
61
+ const classes = useStyles();
62
+ const errorApi = useApi(errorApiRef);
63
+ const feedbackApi = useApi(entityFeedbackApiRef);
64
+ const [responseSelections, setResponseSelections] = useState(
65
+ Object.fromEntries(feedbackDialogResponses.map((r) => [r.id, false]))
66
+ );
67
+ const [comments, setComments] = useState({
68
+ responseComments: {},
69
+ additionalComments: ""
70
+ });
71
+ const [consent, setConsent] = useState(true);
72
+ const [{ loading: saving }, saveResponse] = useAsyncFn(async () => {
73
+ const filteredResponseComments = Object.entries(
74
+ comments.responseComments
75
+ ).reduce((entry, [key, value]) => {
76
+ if (responseSelections[key]) {
77
+ entry[key] = value;
78
+ }
79
+ return entry;
80
+ }, {});
81
+ const filteredComments = {
82
+ ...comments,
83
+ responseComments: filteredResponseComments
84
+ };
85
+ try {
86
+ await feedbackApi.recordResponse(stringifyEntityRef(entity), {
87
+ comments: JSON.stringify(filteredComments),
88
+ consent,
89
+ response: Object.keys(responseSelections).filter((id) => responseSelections[id]).join(",")
90
+ });
91
+ onClose();
92
+ } catch (e) {
93
+ errorApi.post(e);
94
+ }
95
+ }, [comments, consent, entity, feedbackApi, onClose, responseSelections]);
96
+ return /* @__PURE__ */ React.createElement(Dialog, { open, onClose: () => !saving && onClose() }, saving && /* @__PURE__ */ React.createElement(Progress, null), /* @__PURE__ */ React.createElement(DialogTitle, null, feedbackDialogTitle), /* @__PURE__ */ React.createElement(DialogContent, null, /* @__PURE__ */ React.createElement(FormControl, { component: "fieldset", fullWidth: true }, /* @__PURE__ */ React.createElement(FormLabel, { component: "legend" }, "Select all that apply"), /* @__PURE__ */ React.createElement(FormGroup, { className: classes.boxContainer }, feedbackDialogResponses.map((response) => /* @__PURE__ */ React.createElement(Grid, { container: true, key: response.id, direction: "column", spacing: 1 }, /* @__PURE__ */ React.createElement(
97
+ FormControlLabel,
98
+ {
99
+ control: /* @__PURE__ */ React.createElement(
100
+ Checkbox,
101
+ {
102
+ checked: responseSelections[response.id],
103
+ disabled: saving,
104
+ name: response.id,
105
+ onChange: (e) => setResponseSelections({
106
+ ...responseSelections,
107
+ [e.target.name]: e.target.checked
108
+ }),
109
+ color: "primary"
110
+ }
111
+ ),
112
+ label: response.label
113
+ }
114
+ ), /* @__PURE__ */ React.createElement(Collapse, { in: responseSelections[response.id] }, /* @__PURE__ */ React.createElement(
115
+ TextField,
116
+ {
117
+ "data-testid": `feedback-response-dialog-collapse-comments-input-${responseSelections[response.id]}`,
118
+ disabled: saving,
119
+ className: classes.commentBoxes,
120
+ multiline: true,
121
+ minRows: 2,
122
+ fullWidth: true,
123
+ variant: "outlined",
124
+ value: comments.responseComments[response.id] || "",
125
+ onChange: (e) => setComments((prevComments) => ({
126
+ responseComments: {
127
+ ...prevComments.responseComments,
128
+ [response.id]: e.target.value
129
+ },
130
+ additionalComments: prevComments.additionalComments
131
+ }))
132
+ }
133
+ )))))), /* @__PURE__ */ React.createElement(FormControl, { fullWidth: true }, /* @__PURE__ */ React.createElement(FormLabel, { component: "legend", className: classes.formLabel }, "Additional comments"), /* @__PURE__ */ React.createElement(
134
+ TextField,
135
+ {
136
+ "data-testid": "feedback-response-dialog-comments-input",
137
+ disabled: saving,
138
+ multiline: true,
139
+ minRows: 2,
140
+ onChange: (e) => setComments((prevComments) => ({
141
+ responseComments: {
142
+ ...prevComments.responseComments
143
+ },
144
+ additionalComments: e.target.value
145
+ })),
146
+ variant: "outlined",
147
+ value: comments.additionalComments || ""
148
+ }
149
+ )), /* @__PURE__ */ React.createElement(Typography, { className: classes.contactConsent }, "May we contact you about your feedback?", /* @__PURE__ */ React.createElement(Grid, { component: "label", container: true, alignItems: "center", spacing: 1 }, /* @__PURE__ */ React.createElement(Grid, { item: true }, "No"), /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(
150
+ Switch,
151
+ {
152
+ checked: consent,
153
+ disabled: saving,
154
+ onChange: (e) => setConsent(e.target.checked)
155
+ }
156
+ )), /* @__PURE__ */ React.createElement(Grid, { item: true }, "Yes")))), /* @__PURE__ */ React.createElement(DialogActions, { className: classes.dialogActions }, /* @__PURE__ */ React.createElement(
157
+ Button,
158
+ {
159
+ color: "primary",
160
+ "data-testid": "feedback-response-dialog-submit-button",
161
+ disabled: saving,
162
+ onClick: saveResponse
163
+ },
164
+ "Submit"
165
+ ), /* @__PURE__ */ React.createElement(Button, { color: "primary", disabled: saving, onClick: onClose }, "Close")));
166
+ };
167
+
168
+ export { FeedbackResponseDialog };
169
+ //# sourceMappingURL=FeedbackResponseDialog.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FeedbackResponseDialog.esm.js","sources":["../../../src/components/FeedbackResponseDialog/FeedbackResponseDialog.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 { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport { Progress } from '@backstage/core-components';\nimport { ErrorApiError, errorApiRef, useApi } from '@backstage/core-plugin-api';\nimport Button from '@material-ui/core/Button';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport Collapse from '@material-ui/core/Collapse';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport DialogContent from '@material-ui/core/DialogContent';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport FormControl from '@material-ui/core/FormControl';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport FormGroup from '@material-ui/core/FormGroup';\nimport FormLabel from '@material-ui/core/FormLabel';\nimport Grid from '@material-ui/core/Grid';\nimport Switch from '@material-ui/core/Switch';\nimport TextField from '@material-ui/core/TextField';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles, Theme } from '@material-ui/core/styles';\nimport React, { ReactNode, useState } from 'react';\nimport useAsyncFn from 'react-use/esm/useAsyncFn';\n\nimport { entityFeedbackApiRef } from '../../api';\n\n/**\n * @public\n */\nexport interface EntityFeedbackResponse {\n id: string;\n label: string;\n}\nexport interface Comments {\n responseComments: {\n [key: string]: string;\n };\n additionalComments?: string;\n}\n\nconst defaultFeedbackResponses: EntityFeedbackResponse[] = [\n { id: 'incorrect', label: 'Incorrect info' },\n { id: 'missing', label: 'Missing info' },\n { id: 'other', label: 'Other' },\n];\n\n/**\n * @public\n */\nexport interface FeedbackResponseDialogProps {\n entity: Entity;\n feedbackDialogResponses?: EntityFeedbackResponse[];\n feedbackDialogTitle?: ReactNode;\n open: boolean;\n onClose: () => void;\n}\n\nconst useStyles = makeStyles<Theme>(\n theme => ({\n contactConsent: {\n marginTop: theme.spacing(1.5),\n },\n commentBoxes: {\n marginBottom: theme.spacing(1.5),\n },\n boxContainer: {\n marginBottom: theme.spacing(1.5),\n marginTop: theme.spacing(1.5),\n marginLeft: theme.spacing(1),\n paddingRight: theme.spacing(1),\n },\n formLabel: {\n marginBottom: theme.spacing(1.5),\n },\n dialogActions: {\n justifyContent: 'flex-start',\n },\n }),\n { name: 'BackstageEntityFeedbackDialog' },\n);\n\nexport const FeedbackResponseDialog = (props: FeedbackResponseDialogProps) => {\n const {\n entity,\n feedbackDialogResponses = defaultFeedbackResponses,\n feedbackDialogTitle = 'Tell us what could be better',\n open,\n onClose,\n } = props;\n const classes = useStyles();\n const errorApi = useApi(errorApiRef);\n const feedbackApi = useApi(entityFeedbackApiRef);\n const [responseSelections, setResponseSelections] = useState(\n Object.fromEntries(feedbackDialogResponses.map(r => [r.id, false])),\n );\n const [comments, setComments] = useState<Comments>({\n responseComments: {},\n additionalComments: '',\n });\n const [consent, setConsent] = useState(true);\n\n const [{ loading: saving }, saveResponse] = useAsyncFn(async () => {\n // filter out responses that were not selected\n const filteredResponseComments = Object.entries(\n comments.responseComments,\n ).reduce((entry, [key, value]) => {\n if (responseSelections[key]) {\n entry[key] = value;\n }\n return entry;\n }, {} as { [key: string]: string });\n\n const filteredComments = {\n ...comments,\n responseComments: filteredResponseComments,\n };\n try {\n await feedbackApi.recordResponse(stringifyEntityRef(entity), {\n comments: JSON.stringify(filteredComments),\n consent,\n response: Object.keys(responseSelections)\n .filter(id => responseSelections[id])\n .join(','),\n });\n onClose();\n } catch (e) {\n errorApi.post(e as ErrorApiError);\n }\n }, [comments, consent, entity, feedbackApi, onClose, responseSelections]);\n\n return (\n <Dialog open={open} onClose={() => !saving && onClose()}>\n {saving && <Progress />}\n <DialogTitle>{feedbackDialogTitle}</DialogTitle>\n <DialogContent>\n <FormControl component=\"fieldset\" fullWidth>\n <FormLabel component=\"legend\">Select all that apply</FormLabel>\n <FormGroup className={classes.boxContainer}>\n {feedbackDialogResponses.map((response: EntityFeedbackResponse) => (\n <Grid container key={response.id} direction=\"column\" spacing={1}>\n <FormControlLabel\n control={\n <Checkbox\n checked={responseSelections[response.id]}\n disabled={saving}\n name={response.id}\n onChange={e =>\n setResponseSelections({\n ...responseSelections,\n [e.target.name]: e.target.checked,\n })\n }\n color=\"primary\"\n />\n }\n label={response.label}\n />\n <Collapse in={responseSelections[response.id]}>\n <TextField\n data-testid={`feedback-response-dialog-collapse-comments-input-${\n responseSelections[response.id]\n }`}\n disabled={saving}\n className={classes.commentBoxes}\n multiline\n minRows={2}\n fullWidth\n variant=\"outlined\"\n value={comments.responseComments[response.id] || ''}\n onChange={e =>\n setComments(prevComments => ({\n responseComments: {\n ...prevComments.responseComments,\n [response.id]: e.target.value,\n },\n additionalComments: prevComments.additionalComments,\n }))\n }\n />\n </Collapse>\n </Grid>\n ))}\n </FormGroup>\n </FormControl>\n <FormControl fullWidth>\n <FormLabel component=\"legend\" className={classes.formLabel}>\n Additional comments\n </FormLabel>\n <TextField\n data-testid=\"feedback-response-dialog-comments-input\"\n disabled={saving}\n multiline\n minRows={2}\n onChange={e =>\n setComments(prevComments => ({\n responseComments: {\n ...prevComments.responseComments,\n },\n additionalComments: e.target.value,\n }))\n }\n variant=\"outlined\"\n value={comments.additionalComments || ''}\n />\n </FormControl>\n <Typography className={classes.contactConsent}>\n May we contact you about your feedback?\n <Grid component=\"label\" container alignItems=\"center\" spacing={1}>\n <Grid item>No</Grid>\n <Grid item>\n <Switch\n checked={consent}\n disabled={saving}\n onChange={e => setConsent(e.target.checked)}\n />\n </Grid>\n <Grid item>Yes</Grid>\n </Grid>\n </Typography>\n </DialogContent>\n <DialogActions className={classes.dialogActions}>\n <Button\n color=\"primary\"\n data-testid=\"feedback-response-dialog-submit-button\"\n disabled={saving}\n onClick={saveResponse}\n >\n Submit\n </Button>\n <Button color=\"primary\" disabled={saving} onClick={onClose}>\n Close\n </Button>\n </DialogActions>\n </Dialog>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAsDA,MAAM,wBAAqD,GAAA;AAAA,EACzD,EAAE,EAAA,EAAI,WAAa,EAAA,KAAA,EAAO,gBAAiB,EAAA;AAAA,EAC3C,EAAE,EAAA,EAAI,SAAW,EAAA,KAAA,EAAO,cAAe,EAAA;AAAA,EACvC,EAAE,EAAA,EAAI,OAAS,EAAA,KAAA,EAAO,OAAQ,EAAA;AAChC,CAAA,CAAA;AAaA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB,CAAU,KAAA,MAAA;AAAA,IACR,cAAgB,EAAA;AAAA,MACd,SAAA,EAAW,KAAM,CAAA,OAA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AAAA,MACC,KAAM,EAAA,SAAA;AAAA,MACN,aAAY,EAAA,wCAAA;AAAA,MACZ,QAAU,EAAA,MAAA;AAAA,MACV,OAAS,EAAA,YAAA;AAAA,KAAA;AAAA,IACV,QAAA;AAAA,GAED,kBACC,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAO,KAAM,EAAA,SAAA,EAAU,QAAU,EAAA,MAAA,EAAQ,OAAS,EAAA,OAAA,EAAA,EAAS,OAE5D,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,2 @@
1
+ export { FeedbackResponseDialog } from './FeedbackResponseDialog.esm.js';
2
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -4,15 +4,22 @@ import { EntityRefLink } from '@backstage/plugin-catalog-react';
4
4
  import Chip from '@material-ui/core/Chip';
5
5
  import { makeStyles } from '@material-ui/core/styles';
6
6
  import CheckIcon from '@material-ui/icons/Check';
7
+ import Typography from '@material-ui/core/Typography';
7
8
  import React from 'react';
8
9
  import useAsync from 'react-use/esm/useAsync';
9
10
  import '@backstage/errors';
10
- import { entityFeedbackApiRef } from '../index.esm.js';
11
- import '@backstage/catalog-model';
11
+ import { entityFeedbackApiRef } from '../../api/EntityFeedbackApi.esm.js';
12
12
 
13
13
  const useStyles = makeStyles((theme) => ({
14
14
  consentCheck: {
15
15
  color: theme.palette.status.ok
16
+ },
17
+ listItem: {
18
+ padding: "0",
19
+ marginTop: theme.spacing(1)
20
+ },
21
+ list: {
22
+ paddingLeft: "0"
16
23
  }
17
24
  }));
18
25
  const FeedbackResponseTable = (props) => {
@@ -48,7 +55,23 @@ const FeedbackResponseTable = (props) => {
48
55
  width: "35%",
49
56
  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
57
  },
51
- { title: "Comments", field: "comments", width: "40%" }
58
+ {
59
+ title: "Comments",
60
+ field: "comments",
61
+ width: "40%",
62
+ render: (response) => {
63
+ var _a;
64
+ let parsedComment;
65
+ try {
66
+ parsedComment = (response == null ? void 0 : response.comments) && JSON.parse(response.comments);
67
+ } catch (e) {
68
+ parsedComment = response.comments;
69
+ }
70
+ return /* @__PURE__ */ React.createElement("div", null, typeof parsedComment === "object" ? /* @__PURE__ */ React.createElement("ul", { className: classes.list }, (_a = Object.entries(parsedComment.responseComments)) == null ? void 0 : _a.map(
71
+ ([key, value]) => /* @__PURE__ */ React.createElement("li", { key, className: classes.listItem }, /* @__PURE__ */ React.createElement("strong", null, key, ":"), " ", value)
72
+ ), parsedComment.additionalComments && /* @__PURE__ */ React.createElement("li", { className: classes.listItem }, /* @__PURE__ */ React.createElement("strong", null, "additional:"), " ", parsedComment.additionalComments)) : /* @__PURE__ */ React.createElement(Typography, null, parsedComment));
73
+ }
74
+ }
52
75
  ];
53
76
  if (error) {
54
77
  return /* @__PURE__ */ React.createElement(
@@ -80,4 +103,4 @@ const FeedbackResponseTable = (props) => {
80
103
  };
81
104
 
82
105
  export { FeedbackResponseTable };
83
- //# sourceMappingURL=index-xB2VxWp7.esm.js.map
106
+ //# sourceMappingURL=FeedbackResponseTable.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FeedbackResponseTable.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 Typography from '@material-ui/core/Typography';\nimport React from 'react';\nimport useAsync from 'react-use/esm/useAsync';\n\nimport { entityFeedbackApiRef } from '../../api';\nimport { Comments } from '../FeedbackResponseDialog';\n\ntype ResponseRow = Omit<FeedbackResponse, 'entityRef'>;\n\nconst useStyles = makeStyles(theme => ({\n consentCheck: {\n color: theme.palette.status.ok,\n },\n listItem: {\n padding: '0',\n marginTop: theme.spacing(1),\n },\n list: {\n paddingLeft: '0',\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: string) => v.trim()) // removes whitespace\n .filter(Boolean) // removes accidental empty entries\n .map((res: string) => (\n <Chip key={res} size=\"small\" label={res} />\n ))}\n </>\n ),\n },\n {\n title: 'Comments',\n field: 'comments',\n width: '40%',\n render: (response: ResponseRow) => {\n // Check if comment is a stringified object\n let parsedComment;\n try {\n parsedComment =\n response?.comments && (JSON.parse(response.comments) as Comments);\n } catch (e) {\n // If parsing fails, assume it's a regular string\n parsedComment = response.comments;\n }\n return (\n <div>\n {typeof parsedComment === 'object' ? (\n <ul className={classes.list}>\n {Object.entries<string>(parsedComment.responseComments)?.map(\n ([key, value]) => (\n <li key={key} className={classes.listItem}>\n <strong>{key}:</strong> {value}\n </li>\n ),\n )}\n {parsedComment.additionalComments && (\n <li className={classes.listItem}>\n <strong>additional:</strong>{' '}\n {parsedComment.additionalComments}\n </li>\n )}\n </ul>\n ) : (\n <Typography>{parsedComment}</Typography>\n )}\n </div>\n );\n },\n },\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":";;;;;;;;;;;;AAgCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,YAAc,EAAA;AAAA,IACZ,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA,EAAA;AAAA,GAC9B;AAAA,EACA,QAAU,EAAA;AAAA,IACR,OAAS,EAAA,GAAA;AAAA,IACT,SAAA,EAAW,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,GAC5B;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,WAAa,EAAA,GAAA;AAAA,GACf;AACF,CAAE,CAAA,CAAA,CAAA;AAUW,MAAA,qBAAA,GAAwB,CAAC,KAAsC,KAAA;AAC1E,EAAA,MAAM,EAAE,SAAA,EAAW,KAAQ,GAAA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,oBAAA,KAAA,CAAA,aAAA,CAAC,QAAG,SAAW,EAAA,OAAA,CAAQ,4BACpB,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,IAAA,EAAO,aAAW,CAAU,EAAA,GAAA,EAC5B,cAAc,kBACjB,CAEJ,oBAEC,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,IAAA,EAAY,aAAc,CAE/B,CAAA,CAAA;AAAA,OAEJ;AAAA,KACF;AAAA,GACF,CAAA;AAEA,EAAA,IAAI,KAAO,EAAA;AACT,IACE,uBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,eAAe,EAAA,IAAA;AAAA,QACf,KAAM,EAAA,mCAAA;AAAA,QACN,KAAA;AAAA,OAAA;AAAA,KACF,CAAA;AAAA,GAEJ;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,OAAA;AAAA,MACA,IAAA,EAAO,gCAAa,EAAC;AAAA,MACrB,SAAW,EAAA,OAAA;AAAA,MACX,OAAS,EAAA;AAAA,QACP,mBAAqB,EAAA,KAAA;AAAA,QACrB,WAAa,EAAA,QAAA;AAAA,QACb,QAAU,EAAA,EAAA;AAAA,QACV,eAAiB,EAAA,CAAC,EAAI,EAAA,EAAA,EAAI,GAAG,CAAA;AAAA,QAC7B,MAAQ,EAAA,IAAA;AAAA,QACR,4BAA4B,CAAC,OAAA;AAAA,OAC/B;AAAA,MACA,KAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
@@ -0,0 +1,2 @@
1
+ export { FeedbackResponseTable } from './FeedbackResponseTable.esm.js';
2
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -12,8 +12,8 @@ import React, { useState, useCallback } from 'react';
12
12
  import useAsync from 'react-use/esm/useAsync';
13
13
  import useAsyncFn from 'react-use/esm/useAsyncFn';
14
14
  import '@backstage/errors';
15
- import { entityFeedbackApiRef } from '../index.esm.js';
16
- import { F as FeedbackResponseDialog } from './FeedbackResponseDialog-FxuGsr7u.esm.js';
15
+ import { entityFeedbackApiRef } from '../../api/EntityFeedbackApi.esm.js';
16
+ import { FeedbackResponseDialog } from '../FeedbackResponseDialog/FeedbackResponseDialog.esm.js';
17
17
 
18
18
  var FeedbackRatings = /* @__PURE__ */ ((FeedbackRatings2) => {
19
19
  FeedbackRatings2["like"] = "LIKE";
@@ -105,5 +105,5 @@ const LikeDislikeButtons = (props) => {
105
105
  ));
106
106
  };
107
107
 
108
- export { FeedbackRatings as F, LikeDislikeButtons as L };
109
- //# sourceMappingURL=LikeDislikeButtons-D7M8hiAk.esm.js.map
108
+ export { FeedbackRatings, LikeDislikeButtons };
109
+ //# sourceMappingURL=LikeDislikeButtons.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LikeDislikeButtons.esm.js","sources":["../../../src/components/LikeDislikeButtons/LikeDislikeButtons.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 { stringifyEntityRef } from '@backstage/catalog-model';\nimport { Progress } from '@backstage/core-components';\nimport {\n ErrorApiError,\n errorApiRef,\n identityApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\nimport { useAsyncEntity } from '@backstage/plugin-catalog-react';\nimport IconButton from '@material-ui/core/IconButton';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport ThumbDownIcon from '@material-ui/icons/ThumbDown';\nimport ThumbUpIcon from '@material-ui/icons/ThumbUp';\nimport ThumbDownOutlinedIcon from '@material-ui/icons/ThumbDownOutlined';\nimport ThumbUpOutlinedIcon from '@material-ui/icons/ThumbUpOutlined';\nimport React, { ReactNode, useCallback, useState } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport useAsyncFn from 'react-use/esm/useAsyncFn';\n\nimport { entityFeedbackApiRef } from '../../api';\nimport {\n EntityFeedbackResponse,\n FeedbackResponseDialog,\n} from '../FeedbackResponseDialog';\n\nexport enum FeedbackRatings {\n like = 'LIKE',\n dislike = 'DISLIKE',\n neutral = 'NEUTRAL',\n}\n\n/**\n * @public\n */\nexport interface LikeDislikeButtonsProps {\n feedbackDialogResponses?: EntityFeedbackResponse[];\n feedbackDialogTitle?: ReactNode;\n requestResponse?: boolean;\n}\n\nexport const LikeDislikeButtons = (props: LikeDislikeButtonsProps) => {\n const {\n feedbackDialogResponses,\n feedbackDialogTitle,\n requestResponse = true,\n } = props;\n const errorApi = useApi(errorApiRef);\n const feedbackApi = useApi(entityFeedbackApiRef);\n const identityApi = useApi(identityApiRef);\n const [rating, setRating] = useState<FeedbackRatings>(\n FeedbackRatings.neutral,\n );\n const [openFeedbackDialog, setOpenFeedbackDialog] = useState(false);\n const { entity, loading: loadingEntity } = useAsyncEntity();\n\n const { loading: loadingFeedback } = useAsync(async () => {\n // Wait until entity is loaded\n if (!entity) {\n return;\n }\n\n try {\n const identity = await identityApi.getBackstageIdentity();\n const prevFeedback = await feedbackApi.getRatings(\n stringifyEntityRef(entity),\n );\n setRating(\n (prevFeedback.find(r => r.userRef === identity.userEntityRef)?.rating ??\n rating) as FeedbackRatings,\n );\n } catch (e) {\n errorApi.post(e as ErrorApiError);\n }\n }, [entity, feedbackApi, setRating]);\n\n const [{ loading: savingFeedback }, saveFeedback] = useAsyncFn(\n async (feedback: FeedbackRatings) => {\n try {\n await feedbackApi.recordRating(stringifyEntityRef(entity!), feedback);\n setRating(feedback);\n } catch (e) {\n errorApi.post(e as ErrorApiError);\n }\n },\n [entity, feedbackApi, setRating],\n );\n\n const applyRating = useCallback(\n (feedback: FeedbackRatings) => {\n // Clear rating if feedback is same as current\n if (feedback === rating) {\n saveFeedback(FeedbackRatings.neutral);\n return;\n }\n\n saveFeedback(feedback);\n if (feedback === FeedbackRatings.dislike && requestResponse) {\n setOpenFeedbackDialog(true);\n }\n },\n [rating, requestResponse, saveFeedback, setOpenFeedbackDialog],\n );\n\n if (loadingEntity || loadingFeedback || savingFeedback) {\n return <Progress />;\n }\n\n return (\n <>\n <IconButton\n data-testid=\"entity-feedback-like-button\"\n onClick={() => applyRating(FeedbackRatings.like)}\n >\n {rating === FeedbackRatings.like ? (\n <Tooltip title=\"Liked\">\n <ThumbUpIcon fontSize=\"small\" />\n </Tooltip>\n ) : (\n <Tooltip title=\"Like\">\n <ThumbUpOutlinedIcon fontSize=\"small\" />\n </Tooltip>\n )}\n </IconButton>\n <IconButton\n data-testid=\"entity-feedback-dislike-button\"\n onClick={() => applyRating(FeedbackRatings.dislike)}\n >\n {rating === FeedbackRatings.dislike ? (\n <Tooltip title=\"Disliked\">\n <ThumbDownIcon fontSize=\"small\" />\n </Tooltip>\n ) : (\n <Tooltip title=\"Dislike\">\n <ThumbDownOutlinedIcon fontSize=\"small\" />\n </Tooltip>\n )}\n </IconButton>\n <FeedbackResponseDialog\n entity={entity!}\n open={openFeedbackDialog}\n onClose={() => setOpenFeedbackDialog(false)}\n feedbackDialogResponses={feedbackDialogResponses}\n feedbackDialogTitle={feedbackDialogTitle}\n />\n </>\n );\n};\n"],"names":["FeedbackRatings"],"mappings":";;;;;;;;;;;;;;;;;AAyCY,IAAA,eAAA,qBAAAA,gBAAL,KAAA;AACL,EAAAA,iBAAA,MAAO,CAAA,GAAA,MAAA,CAAA;AACP,EAAAA,iBAAA,SAAU,CAAA,GAAA,SAAA,CAAA;AACV,EAAAA,iBAAA,SAAU,CAAA,GAAA,SAAA,CAAA;AAHA,EAAAA,OAAAA,gBAAAA,CAAAA;AAAA,CAAA,EAAA,e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index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { FeedbackRatingsTable } from '../FeedbackRatingsTable/FeedbackRatingsTable.esm.js';
3
+ import { FeedbackRatings } from '../LikeDislikeButtons/LikeDislikeButtons.esm.js';
4
+
5
+ const LikeDislikeRatingsTable = (props) => {
6
+ const { allEntities, ownerRef, title } = props;
7
+ return /* @__PURE__ */ React.createElement(
8
+ FeedbackRatingsTable,
9
+ {
10
+ allEntities,
11
+ ownerRef,
12
+ ratingValues: Object.values(FeedbackRatings).filter(
13
+ (r) => r !== FeedbackRatings.neutral
14
+ ),
15
+ title
16
+ }
17
+ );
18
+ };
19
+
20
+ export { LikeDislikeRatingsTable };
21
+ //# sourceMappingURL=LikeDislikeRatingsTable.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LikeDislikeRatingsTable.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,2 @@
1
+ export { LikeDislikeRatingsTable } from './LikeDislikeRatingsTable.esm.js';
2
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -9,8 +9,8 @@ import React, { useState, useCallback } from 'react';
9
9
  import useAsync from 'react-use/esm/useAsync';
10
10
  import useAsyncFn from 'react-use/esm/useAsyncFn';
11
11
  import '@backstage/errors';
12
- import { entityFeedbackApiRef } from '../index.esm.js';
13
- import { F as FeedbackResponseDialog } from './FeedbackResponseDialog-FxuGsr7u.esm.js';
12
+ import { entityFeedbackApiRef } from '../../api/EntityFeedbackApi.esm.js';
13
+ import { FeedbackResponseDialog } from '../FeedbackResponseDialog/FeedbackResponseDialog.esm.js';
14
14
 
15
15
  var FeedbackRatings = /* @__PURE__ */ ((FeedbackRatings2) => {
16
16
  FeedbackRatings2[FeedbackRatings2["one"] = 1] = "one";
@@ -108,5 +108,5 @@ const StarredRatingButtons = (props) => {
108
108
  ));
109
109
  };
110
110
 
111
- export { FeedbackRatings as F, StarredRatingButtons as S };
112
- //# sourceMappingURL=StarredRatingButtons-7kGQPIqk.esm.js.map
111
+ export { FeedbackRatings, StarredRatingButtons };
112
+ //# sourceMappingURL=StarredRatingButtons.esm.js.map