@backstage/plugin-home 0.5.9-next.0 → 0.5.9-next.1
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 +16 -0
- package/README.md +83 -0
- package/dist/esm/Content-a00a3132.esm.js +351 -0
- package/dist/esm/Content-a00a3132.esm.js.map +1 -0
- package/dist/esm/RecentlyVisited-618bf2be.esm.js +40 -0
- package/dist/esm/RecentlyVisited-618bf2be.esm.js.map +1 -0
- package/dist/esm/TopVisited-918c6b5f.esm.js +40 -0
- package/dist/esm/TopVisited-918c6b5f.esm.js.map +1 -0
- package/dist/esm/{index-e7416f2d.esm.js → index-20932a73.esm.js} +4 -2
- package/dist/esm/{index-e7416f2d.esm.js.map → index-20932a73.esm.js.map} +1 -1
- package/dist/index.d.ts +181 -1
- package/dist/index.esm.js +198 -5
- package/dist/index.esm.js.map +1 -1
- package/package.json +11 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @backstage/plugin-home
|
|
2
2
|
|
|
3
|
+
## 0.5.9-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f997f771da: Adds Top/Recently Visited components to homepage
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/core-components@0.13.6-next.1
|
|
10
|
+
- @backstage/core-app-api@1.10.1-next.1
|
|
11
|
+
- @backstage/plugin-catalog-react@1.8.5-next.1
|
|
12
|
+
- @backstage/plugin-home-react@0.1.4-next.1
|
|
13
|
+
- @backstage/core-plugin-api@1.7.0-next.0
|
|
14
|
+
- @backstage/config@1.1.0
|
|
15
|
+
- @backstage/catalog-model@1.4.2
|
|
16
|
+
- @backstage/theme@0.4.2
|
|
17
|
+
- @backstage/types@1.1.1
|
|
18
|
+
|
|
3
19
|
## 0.5.9-next.0
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -242,6 +242,89 @@ const defaultConfig = [
|
|
|
242
242
|
<CustomHomepageGrid config={defaultConfig}>
|
|
243
243
|
```
|
|
244
244
|
|
|
245
|
+
## Page visit homepage component (HomePageTopVisited / HomePageRecentlyVisited)
|
|
246
|
+
|
|
247
|
+
This component shows the homepage user a view for "Recently visited" or "Top visited".
|
|
248
|
+
Being provided by the `<HomePageTopVisited/>` and `<HomePageRecentlyVisited/>` component, see it in use on a homepage example below:
|
|
249
|
+
|
|
250
|
+
```tsx
|
|
251
|
+
// packages/app/src/components/home/HomePage.tsx
|
|
252
|
+
import React from 'react';
|
|
253
|
+
import Grid from '@material-ui/core/Grid';
|
|
254
|
+
import {
|
|
255
|
+
HomePageTopVisited,
|
|
256
|
+
HomePageRecentlyVisited,
|
|
257
|
+
} from '@backstage/plugin-home';
|
|
258
|
+
|
|
259
|
+
export const homePage = (
|
|
260
|
+
<Grid container spacing={3}>
|
|
261
|
+
<Grid item xs={12} md={4}>
|
|
262
|
+
<HomePageTopVisited />
|
|
263
|
+
</Grid>
|
|
264
|
+
<Grid item xs={12} md={4}>
|
|
265
|
+
<HomePageRecentlyVisited />
|
|
266
|
+
</Grid>
|
|
267
|
+
</Grid>
|
|
268
|
+
);
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
There are some requirements to provide its functionality, so please ensure the following:
|
|
272
|
+
|
|
273
|
+
These components need an API to handle visit data, please refer to the [utility-apis](../../docs/api/utility-apis.md)
|
|
274
|
+
documentation for more information. Bellow you can see an example for two options:
|
|
275
|
+
|
|
276
|
+
```ts
|
|
277
|
+
// packages/app/src/apis.ts
|
|
278
|
+
// ...
|
|
279
|
+
import {
|
|
280
|
+
VisitsStorageApi,
|
|
281
|
+
VisitsWebStorageApi,
|
|
282
|
+
visitsApiRef,
|
|
283
|
+
} from '@backstage/plugin-home';
|
|
284
|
+
// ...
|
|
285
|
+
export const apis: AnyApiFactory[] = [
|
|
286
|
+
// Implementation that relies on a provided storageApi
|
|
287
|
+
createApiFactory({
|
|
288
|
+
api: visitsApiRef,
|
|
289
|
+
deps: {
|
|
290
|
+
storageApi: storageApiRef,
|
|
291
|
+
identityApi: identityApiRef,
|
|
292
|
+
},
|
|
293
|
+
factory: ({ storageApi, identityApi }) =>
|
|
294
|
+
VisitsStorageApi.create({ storageApi, identityApi }),
|
|
295
|
+
}),
|
|
296
|
+
|
|
297
|
+
// Or a localStorage data implementation, relies on WebStorage implementation of storageApi
|
|
298
|
+
createApiFactory({
|
|
299
|
+
api: visitsApiRef,
|
|
300
|
+
deps: {
|
|
301
|
+
identityApi: identityApiRef,
|
|
302
|
+
errorApi: errorApiRef
|
|
303
|
+
},
|
|
304
|
+
factory: ({ identityApi, errorApi }) => VisitsWebStorageApi.create({ identityApi, errorApi }),
|
|
305
|
+
}),
|
|
306
|
+
// ...
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
To monitor page visit activity and save it on behalf of the user a component is provided, please add it to your app.
|
|
310
|
+
See the example usage:
|
|
311
|
+
|
|
312
|
+
```ts
|
|
313
|
+
// packages/app/src/App.tsx
|
|
314
|
+
import { VisitListener } from '@backstage/plugin-home';
|
|
315
|
+
// ...
|
|
316
|
+
export default app.createRoot(
|
|
317
|
+
<>
|
|
318
|
+
<AlertDisplay />
|
|
319
|
+
<OAuthRequestDialog />
|
|
320
|
+
<AppRouter>
|
|
321
|
+
<VisitListener />
|
|
322
|
+
<Root>{routes}</Root>
|
|
323
|
+
</AppRouter>
|
|
324
|
+
</>,
|
|
325
|
+
);
|
|
326
|
+
```
|
|
327
|
+
|
|
245
328
|
## Contributing
|
|
246
329
|
|
|
247
330
|
### Homepage Components
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
import React, { createContext, useMemo, useCallback, useEffect } from 'react';
|
|
2
|
+
import { Button, makeStyles, Typography, Chip, ListItem, ListItemAvatar, ListItemText, Collapse, List } from '@material-ui/core';
|
|
3
|
+
import { Link } from '@backstage/core-components';
|
|
4
|
+
import { DateTime } from 'luxon';
|
|
5
|
+
import { colorVariants } from '@backstage/theme';
|
|
6
|
+
import { parseEntityRef } from '@backstage/catalog-model';
|
|
7
|
+
import { Skeleton } from '@material-ui/lab';
|
|
8
|
+
import { visitsApiRef } from '../index.esm.js';
|
|
9
|
+
import { useApi } from '@backstage/core-plugin-api';
|
|
10
|
+
import useAsync from 'react-use/lib/useAsync';
|
|
11
|
+
|
|
12
|
+
const defaultContextValueOnly = {
|
|
13
|
+
collapsed: true,
|
|
14
|
+
numVisitsOpen: 3,
|
|
15
|
+
numVisitsTotal: 8,
|
|
16
|
+
visits: [],
|
|
17
|
+
loading: true,
|
|
18
|
+
kind: "recent"
|
|
19
|
+
};
|
|
20
|
+
const defaultContextValue = {
|
|
21
|
+
...defaultContextValueOnly,
|
|
22
|
+
setCollapsed: () => {
|
|
23
|
+
},
|
|
24
|
+
setNumVisitsOpen: () => {
|
|
25
|
+
},
|
|
26
|
+
setNumVisitsTotal: () => {
|
|
27
|
+
},
|
|
28
|
+
setVisits: () => {
|
|
29
|
+
},
|
|
30
|
+
setLoading: () => {
|
|
31
|
+
},
|
|
32
|
+
setKind: () => {
|
|
33
|
+
},
|
|
34
|
+
setContext: () => {
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const Context = createContext(defaultContextValue);
|
|
38
|
+
const getFilteredSet = (setContext, contextKey) => (e) => setContext((state) => ({
|
|
39
|
+
...state,
|
|
40
|
+
[contextKey]: typeof e === "function" ? e(state[contextKey]) : e
|
|
41
|
+
}));
|
|
42
|
+
const ContextProvider = ({ children }) => {
|
|
43
|
+
const [context, setContext] = React.useState(
|
|
44
|
+
defaultContextValueOnly
|
|
45
|
+
);
|
|
46
|
+
const {
|
|
47
|
+
setCollapsed,
|
|
48
|
+
setNumVisitsOpen,
|
|
49
|
+
setNumVisitsTotal,
|
|
50
|
+
setVisits,
|
|
51
|
+
setLoading,
|
|
52
|
+
setKind
|
|
53
|
+
} = useMemo(
|
|
54
|
+
() => ({
|
|
55
|
+
setCollapsed: getFilteredSet(setContext, "collapsed"),
|
|
56
|
+
setNumVisitsOpen: getFilteredSet(setContext, "numVisitsOpen"),
|
|
57
|
+
setNumVisitsTotal: getFilteredSet(setContext, "numVisitsTotal"),
|
|
58
|
+
setVisits: getFilteredSet(setContext, "visits"),
|
|
59
|
+
setLoading: getFilteredSet(setContext, "loading"),
|
|
60
|
+
setKind: getFilteredSet(setContext, "kind")
|
|
61
|
+
}),
|
|
62
|
+
[setContext]
|
|
63
|
+
);
|
|
64
|
+
const value = {
|
|
65
|
+
...context,
|
|
66
|
+
setContext,
|
|
67
|
+
setCollapsed,
|
|
68
|
+
setNumVisitsOpen,
|
|
69
|
+
setNumVisitsTotal,
|
|
70
|
+
setVisits,
|
|
71
|
+
setLoading,
|
|
72
|
+
setKind
|
|
73
|
+
};
|
|
74
|
+
return /* @__PURE__ */ React.createElement(Context.Provider, { value }, children);
|
|
75
|
+
};
|
|
76
|
+
const useContext = () => {
|
|
77
|
+
const value = React.useContext(Context);
|
|
78
|
+
if (value === void 0)
|
|
79
|
+
throw new Error(
|
|
80
|
+
"VisitedByType useContext found undefined ContextValue, <ContextProvider/> could be missing"
|
|
81
|
+
);
|
|
82
|
+
return value;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const Actions = () => {
|
|
86
|
+
const { collapsed, setCollapsed, visits, numVisitsOpen, loading } = useContext();
|
|
87
|
+
const onClick = useCallback(
|
|
88
|
+
() => setCollapsed((prevCollapsed) => !prevCollapsed),
|
|
89
|
+
[setCollapsed]
|
|
90
|
+
);
|
|
91
|
+
const label = collapsed ? "View More" : "View Less";
|
|
92
|
+
if (!loading && visits.length <= numVisitsOpen)
|
|
93
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null);
|
|
94
|
+
return /* @__PURE__ */ React.createElement(Button, { variant: "text", onClick }, label);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const useStyles$4 = makeStyles((_theme) => ({
|
|
98
|
+
name: {
|
|
99
|
+
marginLeft: "0.8rem",
|
|
100
|
+
marginRight: "0.8rem"
|
|
101
|
+
}
|
|
102
|
+
}));
|
|
103
|
+
const ItemName = ({ visit }) => {
|
|
104
|
+
const classes = useStyles$4();
|
|
105
|
+
return /* @__PURE__ */ React.createElement(
|
|
106
|
+
Typography,
|
|
107
|
+
{
|
|
108
|
+
component: Link,
|
|
109
|
+
to: visit.pathname,
|
|
110
|
+
noWrap: true,
|
|
111
|
+
className: classes.name
|
|
112
|
+
},
|
|
113
|
+
visit.name
|
|
114
|
+
);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const ItemDetailHits = ({ visit }) => /* @__PURE__ */ React.createElement(Typography, { component: "span", variant: "caption", color: "textSecondary" }, visit.hits, " time", visit.hits > 1 ? "s" : "");
|
|
118
|
+
const ItemDetailTimeAgo = ({ visit }) => {
|
|
119
|
+
var _a;
|
|
120
|
+
const visitDate = DateTime.fromMillis(visit.timestamp);
|
|
121
|
+
return /* @__PURE__ */ React.createElement(
|
|
122
|
+
Typography,
|
|
123
|
+
{
|
|
124
|
+
component: "time",
|
|
125
|
+
variant: "caption",
|
|
126
|
+
color: "textSecondary",
|
|
127
|
+
dateTime: (_a = visitDate.toISO()) != null ? _a : void 0
|
|
128
|
+
},
|
|
129
|
+
visitDate >= DateTime.now().startOf("day") ? visitDate.toFormat("HH:mm") : visitDate.toRelative()
|
|
130
|
+
);
|
|
131
|
+
};
|
|
132
|
+
const ItemDetail = ({
|
|
133
|
+
visit,
|
|
134
|
+
type
|
|
135
|
+
}) => type === "time-ago" ? /* @__PURE__ */ React.createElement(ItemDetailTimeAgo, { visit }) : /* @__PURE__ */ React.createElement(ItemDetailHits, { visit });
|
|
136
|
+
|
|
137
|
+
const useStyles$3 = makeStyles((theme) => ({
|
|
138
|
+
chip: {
|
|
139
|
+
color: theme.palette.common.white,
|
|
140
|
+
fontWeight: "bold",
|
|
141
|
+
margin: 0
|
|
142
|
+
}
|
|
143
|
+
}));
|
|
144
|
+
const maybeEntity = (visit) => {
|
|
145
|
+
var _a;
|
|
146
|
+
try {
|
|
147
|
+
return parseEntityRef((_a = visit == null ? void 0 : visit.entityRef) != null ? _a : "");
|
|
148
|
+
} catch (e) {
|
|
149
|
+
return void 0;
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
const getColorByIndex = (index) => {
|
|
153
|
+
const variants = Object.keys(colorVariants);
|
|
154
|
+
const variantIndex = index % variants.length;
|
|
155
|
+
return colorVariants[variants[variantIndex]][0];
|
|
156
|
+
};
|
|
157
|
+
const getChipColor = (entity) => {
|
|
158
|
+
const defaultColor = getColorByIndex(0);
|
|
159
|
+
if (!entity)
|
|
160
|
+
return defaultColor;
|
|
161
|
+
const entityKinds = [
|
|
162
|
+
"component",
|
|
163
|
+
"template",
|
|
164
|
+
"api",
|
|
165
|
+
"group",
|
|
166
|
+
"user",
|
|
167
|
+
"resource",
|
|
168
|
+
"system",
|
|
169
|
+
"domain",
|
|
170
|
+
"location"
|
|
171
|
+
];
|
|
172
|
+
const foundIndex = entityKinds.indexOf(
|
|
173
|
+
entity.kind.toLocaleLowerCase("en-US")
|
|
174
|
+
);
|
|
175
|
+
return foundIndex === -1 ? defaultColor : getColorByIndex(foundIndex + 1);
|
|
176
|
+
};
|
|
177
|
+
const ItemCategory = ({ visit }) => {
|
|
178
|
+
var _a;
|
|
179
|
+
const classes = useStyles$3();
|
|
180
|
+
const entity = maybeEntity(visit);
|
|
181
|
+
return /* @__PURE__ */ React.createElement(
|
|
182
|
+
Chip,
|
|
183
|
+
{
|
|
184
|
+
size: "small",
|
|
185
|
+
className: classes.chip,
|
|
186
|
+
label: ((_a = entity == null ? void 0 : entity.kind) != null ? _a : "Other").toLocaleLowerCase("en-US"),
|
|
187
|
+
style: { background: getChipColor(entity) }
|
|
188
|
+
}
|
|
189
|
+
);
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
const useStyles$2 = makeStyles((_theme) => ({
|
|
193
|
+
avatar: {
|
|
194
|
+
minWidth: 0
|
|
195
|
+
}
|
|
196
|
+
}));
|
|
197
|
+
const VisitListItem = ({
|
|
198
|
+
visit,
|
|
199
|
+
detailType
|
|
200
|
+
}) => {
|
|
201
|
+
const classes = useStyles$2();
|
|
202
|
+
return /* @__PURE__ */ React.createElement(ListItem, { disableGutters: true }, /* @__PURE__ */ React.createElement(ListItemAvatar, { className: classes.avatar }, /* @__PURE__ */ React.createElement(ItemCategory, { visit })), /* @__PURE__ */ React.createElement(
|
|
203
|
+
ListItemText,
|
|
204
|
+
{
|
|
205
|
+
primary: /* @__PURE__ */ React.createElement(ItemName, { visit }),
|
|
206
|
+
secondary: /* @__PURE__ */ React.createElement(ItemDetail, { visit, type: detailType }),
|
|
207
|
+
disableTypography: true
|
|
208
|
+
}
|
|
209
|
+
));
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
const VisitListEmpty = () => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { variant: "body2", color: "textSecondary" }, "There are no visits to show yet."), /* @__PURE__ */ React.createElement(Typography, { variant: "body2", color: "textSecondary" }, "Once you start using Backstage, your visits will appear here as a quick link to carry on where you left off."));
|
|
213
|
+
|
|
214
|
+
const VisitListFew = () => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { variant: "body2", color: "textSecondary" }, "The more pages you visit, the more pages will appear here."));
|
|
215
|
+
|
|
216
|
+
const useStyles$1 = makeStyles((_theme) => ({
|
|
217
|
+
skeleton: {
|
|
218
|
+
borderRadius: 30
|
|
219
|
+
}
|
|
220
|
+
}));
|
|
221
|
+
const VisitListItemSkeleton = () => {
|
|
222
|
+
const classes = useStyles$1();
|
|
223
|
+
return /* @__PURE__ */ React.createElement(ListItem, { disableGutters: true }, /* @__PURE__ */ React.createElement(ListItemAvatar, null, /* @__PURE__ */ React.createElement(
|
|
224
|
+
Skeleton,
|
|
225
|
+
{
|
|
226
|
+
className: classes.skeleton,
|
|
227
|
+
variant: "rect",
|
|
228
|
+
width: 50,
|
|
229
|
+
height: 24
|
|
230
|
+
}
|
|
231
|
+
)), /* @__PURE__ */ React.createElement(
|
|
232
|
+
ListItemText,
|
|
233
|
+
{
|
|
234
|
+
primary: /* @__PURE__ */ React.createElement(Skeleton, { variant: "text", width: "100%", height: 28 }),
|
|
235
|
+
disableTypography: true
|
|
236
|
+
}
|
|
237
|
+
));
|
|
238
|
+
};
|
|
239
|
+
const VisitListSkeleton = ({
|
|
240
|
+
numVisitsOpen,
|
|
241
|
+
numVisitsTotal,
|
|
242
|
+
collapsed
|
|
243
|
+
}) => /* @__PURE__ */ React.createElement(React.Fragment, null, Array(numVisitsOpen).fill(null).map((_e, index) => /* @__PURE__ */ React.createElement(VisitListItemSkeleton, { key: index })), numVisitsTotal > numVisitsOpen && /* @__PURE__ */ React.createElement(Collapse, { in: !collapsed }, Array(numVisitsTotal - numVisitsOpen).fill(null).map((_e, index) => /* @__PURE__ */ React.createElement(VisitListItemSkeleton, { key: index }))));
|
|
244
|
+
|
|
245
|
+
const useStyles = makeStyles((_theme) => ({
|
|
246
|
+
title: {
|
|
247
|
+
marginBottom: "2rem"
|
|
248
|
+
}
|
|
249
|
+
}));
|
|
250
|
+
const VisitList = ({
|
|
251
|
+
title,
|
|
252
|
+
detailType,
|
|
253
|
+
visits = [],
|
|
254
|
+
numVisitsOpen = 3,
|
|
255
|
+
numVisitsTotal = 8,
|
|
256
|
+
collapsed = true,
|
|
257
|
+
loading = false
|
|
258
|
+
}) => {
|
|
259
|
+
const classes = useStyles();
|
|
260
|
+
let listBody = /* @__PURE__ */ React.createElement(React.Fragment, null);
|
|
261
|
+
if (loading) {
|
|
262
|
+
listBody = /* @__PURE__ */ React.createElement(
|
|
263
|
+
VisitListSkeleton,
|
|
264
|
+
{
|
|
265
|
+
numVisitsOpen,
|
|
266
|
+
numVisitsTotal,
|
|
267
|
+
collapsed
|
|
268
|
+
}
|
|
269
|
+
);
|
|
270
|
+
} else if (visits.length === 0) {
|
|
271
|
+
listBody = /* @__PURE__ */ React.createElement(VisitListEmpty, null);
|
|
272
|
+
} else if (visits.length < numVisitsOpen) {
|
|
273
|
+
listBody = /* @__PURE__ */ React.createElement(React.Fragment, null, visits.map((visit, index) => /* @__PURE__ */ React.createElement(VisitListItem, { visit, key: index, detailType })), /* @__PURE__ */ React.createElement(VisitListFew, null));
|
|
274
|
+
} else {
|
|
275
|
+
listBody = /* @__PURE__ */ React.createElement(React.Fragment, null, visits.slice(0, numVisitsOpen).map((visit, index) => /* @__PURE__ */ React.createElement(VisitListItem, { visit, key: index, detailType })), visits.length > numVisitsOpen && /* @__PURE__ */ React.createElement(Collapse, { in: !collapsed }, visits.slice(numVisitsOpen, numVisitsTotal).map((visit, index) => /* @__PURE__ */ React.createElement(
|
|
276
|
+
VisitListItem,
|
|
277
|
+
{
|
|
278
|
+
visit,
|
|
279
|
+
key: index,
|
|
280
|
+
detailType
|
|
281
|
+
}
|
|
282
|
+
))));
|
|
283
|
+
}
|
|
284
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { variant: "h5", className: classes.title }, title), /* @__PURE__ */ React.createElement(List, { dense: true, disablePadding: true }, listBody));
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
const VisitedByType = () => {
|
|
288
|
+
const { collapsed, numVisitsOpen, numVisitsTotal, visits, loading, kind } = useContext();
|
|
289
|
+
return /* @__PURE__ */ React.createElement(
|
|
290
|
+
VisitList,
|
|
291
|
+
{
|
|
292
|
+
visits,
|
|
293
|
+
title: kind === "top" ? "Top Visited" : "Recently Visited",
|
|
294
|
+
detailType: kind === "top" ? "hits" : "time-ago",
|
|
295
|
+
collapsed,
|
|
296
|
+
numVisitsOpen,
|
|
297
|
+
numVisitsTotal,
|
|
298
|
+
loading
|
|
299
|
+
}
|
|
300
|
+
);
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
const Content = ({
|
|
304
|
+
visits,
|
|
305
|
+
numVisitsOpen,
|
|
306
|
+
numVisitsTotal,
|
|
307
|
+
loading,
|
|
308
|
+
kind
|
|
309
|
+
}) => {
|
|
310
|
+
const { setContext, setVisits, setLoading } = useContext();
|
|
311
|
+
useEffect(() => {
|
|
312
|
+
const context = {};
|
|
313
|
+
context.kind = kind;
|
|
314
|
+
if (visits) {
|
|
315
|
+
context.visits = visits;
|
|
316
|
+
context.loading = false;
|
|
317
|
+
} else if (loading) {
|
|
318
|
+
context.loading = loading;
|
|
319
|
+
}
|
|
320
|
+
if (numVisitsOpen)
|
|
321
|
+
context.numVisitsOpen = numVisitsOpen;
|
|
322
|
+
if (numVisitsTotal)
|
|
323
|
+
context.numVisitsTotal = numVisitsTotal;
|
|
324
|
+
setContext((state) => ({ ...state, ...context }));
|
|
325
|
+
}, [setContext, kind, visits, loading, numVisitsOpen, numVisitsTotal]);
|
|
326
|
+
const visitsApi = useApi(visitsApiRef);
|
|
327
|
+
const { loading: reqLoading } = useAsync(async () => {
|
|
328
|
+
if (!visits && !loading && kind === "recent") {
|
|
329
|
+
return await visitsApi.list({
|
|
330
|
+
limit: numVisitsTotal != null ? numVisitsTotal : 8,
|
|
331
|
+
orderBy: [{ field: "timestamp", direction: "desc" }]
|
|
332
|
+
}).then(setVisits);
|
|
333
|
+
}
|
|
334
|
+
if (!visits && !loading && kind === "top") {
|
|
335
|
+
return await visitsApi.list({
|
|
336
|
+
limit: numVisitsTotal != null ? numVisitsTotal : 8,
|
|
337
|
+
orderBy: [{ field: "hits", direction: "desc" }]
|
|
338
|
+
}).then(setVisits);
|
|
339
|
+
}
|
|
340
|
+
return void 0;
|
|
341
|
+
}, [visitsApi, visits, loading, setVisits]);
|
|
342
|
+
useEffect(() => {
|
|
343
|
+
if (!loading) {
|
|
344
|
+
setLoading(reqLoading);
|
|
345
|
+
}
|
|
346
|
+
}, [loading, setLoading, reqLoading]);
|
|
347
|
+
return /* @__PURE__ */ React.createElement(VisitedByType, null);
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
export { Actions as A, Content as C, ContextProvider as a };
|
|
351
|
+
//# sourceMappingURL=Content-a00a3132.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Content-a00a3132.esm.js","sources":["../../src/homePageComponents/VisitedByType/Context.tsx","../../src/homePageComponents/VisitedByType/Actions.tsx","../../src/components/VisitList/ItemName.tsx","../../src/components/VisitList/ItemDetail.tsx","../../src/components/VisitList/ItemCategory.tsx","../../src/components/VisitList/VisitListItem.tsx","../../src/components/VisitList/VisitListEmpty.tsx","../../src/components/VisitList/VisitListFew.tsx","../../src/components/VisitList/VisitListSkeleton.tsx","../../src/components/VisitList/VisitList.tsx","../../src/homePageComponents/VisitedByType/VisitedByType.tsx","../../src/homePageComponents/VisitedByType/Content.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, { Dispatch, SetStateAction, createContext, useMemo } from 'react';\nimport { Visit } from '../../api/VisitsApi';\nimport { VisitedByTypeKind } from './Content';\n\nexport type ContextValueOnly = {\n collapsed: boolean;\n numVisitsOpen: number;\n numVisitsTotal: number;\n visits: Array<Visit>;\n loading: boolean;\n kind: VisitedByTypeKind;\n};\n\nexport type ContextValue = ContextValueOnly & {\n setCollapsed: Dispatch<SetStateAction<boolean>>;\n setNumVisitsOpen: Dispatch<SetStateAction<number>>;\n setNumVisitsTotal: Dispatch<SetStateAction<number>>;\n setVisits: Dispatch<SetStateAction<Array<Visit>>>;\n setLoading: Dispatch<SetStateAction<boolean>>;\n setKind: Dispatch<SetStateAction<VisitedByTypeKind>>;\n setContext: Dispatch<SetStateAction<ContextValueOnly>>;\n};\n\nconst defaultContextValueOnly: ContextValueOnly = {\n collapsed: true,\n numVisitsOpen: 3,\n numVisitsTotal: 8,\n visits: [],\n loading: true,\n kind: 'recent',\n};\n\nexport const defaultContextValue: ContextValue = {\n ...defaultContextValueOnly,\n setCollapsed: () => {},\n setNumVisitsOpen: () => {},\n setNumVisitsTotal: () => {},\n setVisits: () => {},\n setLoading: () => {},\n setKind: () => {},\n setContext: () => {},\n};\n\nexport const Context = createContext<ContextValue>(defaultContextValue);\n\nconst getFilteredSet =\n <T,>(\n setContext: Dispatch<SetStateAction<ContextValueOnly>>,\n contextKey: keyof ContextValueOnly,\n ) =>\n (e: SetStateAction<T>) =>\n setContext(state => ({\n ...state,\n [contextKey]:\n typeof e === 'function' ? (e as Function)(state[contextKey]) : e,\n }));\n\nexport const ContextProvider = ({ children }: { children: JSX.Element }) => {\n const [context, setContext] = React.useState<ContextValueOnly>(\n defaultContextValueOnly,\n );\n const {\n setCollapsed,\n setNumVisitsOpen,\n setNumVisitsTotal,\n setVisits,\n setLoading,\n setKind,\n } = useMemo(\n () => ({\n setCollapsed: getFilteredSet(setContext, 'collapsed'),\n setNumVisitsOpen: getFilteredSet(setContext, 'numVisitsOpen'),\n setNumVisitsTotal: getFilteredSet(setContext, 'numVisitsTotal'),\n setVisits: getFilteredSet(setContext, 'visits'),\n setLoading: getFilteredSet(setContext, 'loading'),\n setKind: getFilteredSet(setContext, 'kind'),\n }),\n [setContext],\n );\n\n const value: ContextValue = {\n ...context,\n setContext,\n setCollapsed,\n setNumVisitsOpen,\n setNumVisitsTotal,\n setVisits,\n setLoading,\n setKind,\n };\n\n return <Context.Provider value={value}>{children}</Context.Provider>;\n};\n\nexport const useContext = () => {\n const value = React.useContext(Context);\n\n if (value === undefined)\n throw new Error(\n 'VisitedByType useContext found undefined ContextValue, <ContextProvider/> could be missing',\n );\n\n return value;\n};\n\nexport default Context;\n","/*\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, { useCallback } from 'react';\nimport { Button } from '@material-ui/core';\nimport { useContext } from './Context';\n\nexport const Actions = () => {\n const { collapsed, setCollapsed, visits, numVisitsOpen, loading } =\n useContext();\n const onClick = useCallback(\n () => setCollapsed(prevCollapsed => !prevCollapsed),\n [setCollapsed],\n );\n const label = collapsed ? 'View More' : 'View Less';\n\n if (!loading && visits.length <= numVisitsOpen) return <></>;\n\n return (\n <Button variant=\"text\" onClick={onClick}>\n {label}\n </Button>\n );\n};\n","/*\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';\nimport { Typography, makeStyles } from '@material-ui/core';\nimport { Visit } from '../../api/VisitsApi';\nimport { Link } from '@backstage/core-components';\n\nconst useStyles = makeStyles(_theme => ({\n name: {\n marginLeft: '0.8rem',\n marginRight: '0.8rem',\n },\n}));\nexport const ItemName = ({ visit }: { visit: Visit }) => {\n const classes = useStyles();\n\n return (\n <Typography\n component={Link}\n to={visit.pathname}\n noWrap\n className={classes.name}\n >\n {visit.name}\n </Typography>\n );\n};\n","/*\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';\nimport { Typography } from '@material-ui/core';\nimport { Visit } from '../../api/VisitsApi';\nimport { DateTime } from 'luxon';\n\nconst ItemDetailHits = ({ visit }: { visit: Visit }) => (\n <Typography component=\"span\" variant=\"caption\" color=\"textSecondary\">\n {visit.hits} time{visit.hits > 1 ? 's' : ''}\n </Typography>\n);\n\nconst ItemDetailTimeAgo = ({ visit }: { visit: Visit }) => {\n const visitDate = DateTime.fromMillis(visit.timestamp);\n\n return (\n <Typography\n component=\"time\"\n variant=\"caption\"\n color=\"textSecondary\"\n dateTime={visitDate.toISO() ?? undefined}\n >\n {visitDate >= DateTime.now().startOf('day')\n ? visitDate.toFormat('HH:mm')\n : visitDate.toRelative()}\n </Typography>\n );\n};\n\nexport type ItemDetailType = 'time-ago' | 'hits';\n\nexport const ItemDetail = ({\n visit,\n type,\n}: {\n visit: Visit;\n type: ItemDetailType;\n}) =>\n type === 'time-ago' ? (\n <ItemDetailTimeAgo visit={visit} />\n ) : (\n <ItemDetailHits visit={visit} />\n );\n","/*\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';\nimport { Chip, makeStyles } from '@material-ui/core';\nimport { colorVariants } from '@backstage/theme';\nimport { Visit } from '../../api/VisitsApi';\nimport { CompoundEntityRef, parseEntityRef } from '@backstage/catalog-model';\n\nconst useStyles = makeStyles(theme => ({\n chip: {\n color: theme.palette.common.white,\n fontWeight: 'bold',\n margin: 0,\n },\n}));\nconst maybeEntity = (visit: Visit): CompoundEntityRef | undefined => {\n try {\n return parseEntityRef(visit?.entityRef ?? '');\n } catch (e) {\n return undefined;\n }\n};\nconst getColorByIndex = (index: number) => {\n const variants = Object.keys(colorVariants);\n const variantIndex = index % variants.length;\n return colorVariants[variants[variantIndex]][0];\n};\nconst getChipColor = (entity: CompoundEntityRef | undefined): string => {\n const defaultColor = getColorByIndex(0);\n if (!entity) return defaultColor;\n\n // IDEA: Use or replicate useAllKinds hook thus supporting all software catalog\n // registered kinds. See:\n // plugins/catalog-react/src/components/EntityKindPicker/kindFilterUtils.ts\n // Provide extension point to register your own color code.\n const entityKinds = [\n 'component',\n 'template',\n 'api',\n 'group',\n 'user',\n 'resource',\n 'system',\n 'domain',\n 'location',\n ];\n const foundIndex = entityKinds.indexOf(\n entity.kind.toLocaleLowerCase('en-US'),\n );\n return foundIndex === -1 ? defaultColor : getColorByIndex(foundIndex + 1);\n};\n\nexport const ItemCategory = ({ visit }: { visit: Visit }) => {\n const classes = useStyles();\n const entity = maybeEntity(visit);\n\n return (\n <Chip\n size=\"small\"\n className={classes.chip}\n label={(entity?.kind ?? 'Other').toLocaleLowerCase('en-US')}\n style={{ background: getChipColor(entity) }}\n />\n );\n};\n","/*\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';\nimport {\n ListItem,\n ListItemAvatar,\n ListItemText,\n makeStyles,\n} from '@material-ui/core';\nimport { Visit } from '../../api/VisitsApi';\nimport { ItemName } from './ItemName';\nimport { ItemDetail, ItemDetailType } from './ItemDetail';\nimport { ItemCategory } from './ItemCategory';\n\nconst useStyles = makeStyles(_theme => ({\n avatar: {\n minWidth: 0,\n },\n}));\nexport const VisitListItem = ({\n visit,\n detailType,\n}: {\n visit: Visit;\n detailType: ItemDetailType;\n}) => {\n const classes = useStyles();\n\n return (\n <ListItem disableGutters>\n <ListItemAvatar className={classes.avatar}>\n <ItemCategory visit={visit} />\n </ListItemAvatar>\n <ListItemText\n primary={<ItemName visit={visit} />}\n secondary={<ItemDetail visit={visit} type={detailType} />}\n disableTypography\n />\n </ListItem>\n );\n};\n","/*\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';\nimport { Typography } from '@material-ui/core';\n\nexport const VisitListEmpty = () => (\n <>\n <Typography variant=\"body2\" color=\"textSecondary\">\n There are no visits to show yet.\n </Typography>\n <Typography variant=\"body2\" color=\"textSecondary\">\n Once you start using Backstage, your visits will appear here as a quick\n link to carry on where you left off.\n </Typography>\n </>\n);\n","/*\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';\nimport { Typography } from '@material-ui/core';\n\nexport const VisitListFew = () => (\n <>\n <Typography variant=\"body2\" color=\"textSecondary\">\n The more pages you visit, the more pages will appear here.\n </Typography>\n </>\n);\n","/*\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';\nimport {\n Collapse,\n ListItem,\n ListItemAvatar,\n ListItemText,\n makeStyles,\n} from '@material-ui/core';\nimport { Skeleton } from '@material-ui/lab';\n\nconst useStyles = makeStyles(_theme => ({\n skeleton: {\n borderRadius: 30,\n },\n}));\n\nconst VisitListItemSkeleton = () => {\n const classes = useStyles();\n\n return (\n <ListItem disableGutters>\n <ListItemAvatar>\n <Skeleton\n className={classes.skeleton}\n variant=\"rect\"\n width={50}\n height={24}\n />\n </ListItemAvatar>\n <ListItemText\n primary={<Skeleton variant=\"text\" width=\"100%\" height={28} />}\n disableTypography\n />\n </ListItem>\n );\n};\n\nexport const VisitListSkeleton = ({\n numVisitsOpen,\n numVisitsTotal,\n collapsed,\n}: {\n numVisitsOpen: number;\n numVisitsTotal: number;\n collapsed: boolean;\n}) => (\n <>\n {Array(numVisitsOpen)\n .fill(null)\n .map((_e, index) => (\n <VisitListItemSkeleton key={index} />\n ))}\n {numVisitsTotal > numVisitsOpen && (\n <Collapse in={!collapsed}>\n {Array(numVisitsTotal - numVisitsOpen)\n .fill(null)\n .map((_e, index) => (\n <VisitListItemSkeleton key={index} />\n ))}\n </Collapse>\n )}\n </>\n);\n","/*\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';\nimport { Collapse, List, Typography, makeStyles } from '@material-ui/core';\nimport { Visit } from '../../api/VisitsApi';\nimport { VisitListItem } from './VisitListItem';\nimport { ItemDetailType } from './ItemDetail';\nimport { VisitListEmpty } from './VisitListEmpty';\nimport { VisitListFew } from './VisitListFew';\nimport { VisitListSkeleton } from './VisitListSkeleton';\n\nconst useStyles = makeStyles(_theme => ({\n title: {\n marginBottom: '2rem',\n },\n}));\n\nexport const VisitList = ({\n title,\n detailType,\n visits = [],\n numVisitsOpen = 3,\n numVisitsTotal = 8,\n collapsed = true,\n loading = false,\n}: {\n title: string;\n detailType: ItemDetailType;\n visits?: Visit[];\n numVisitsOpen?: number;\n numVisitsTotal?: number;\n collapsed?: boolean;\n loading?: boolean;\n}) => {\n const classes = useStyles();\n\n let listBody: React.ReactElement = <></>;\n if (loading) {\n listBody = (\n <VisitListSkeleton\n numVisitsOpen={numVisitsOpen}\n numVisitsTotal={numVisitsTotal}\n collapsed={collapsed}\n />\n );\n } else if (visits.length === 0) {\n listBody = <VisitListEmpty />;\n } else if (visits.length < numVisitsOpen) {\n listBody = (\n <>\n {visits.map((visit, index) => (\n <VisitListItem visit={visit} key={index} detailType={detailType} />\n ))}\n <VisitListFew />\n </>\n );\n } else {\n listBody = (\n <>\n {visits.slice(0, numVisitsOpen).map((visit, index) => (\n <VisitListItem visit={visit} key={index} detailType={detailType} />\n ))}\n {visits.length > numVisitsOpen && (\n <Collapse in={!collapsed}>\n {visits.slice(numVisitsOpen, numVisitsTotal).map((visit, index) => (\n <VisitListItem\n visit={visit}\n key={index}\n detailType={detailType}\n />\n ))}\n </Collapse>\n )}\n </>\n );\n }\n\n return (\n <>\n <Typography variant=\"h5\" className={classes.title}>\n {title}\n </Typography>\n <List dense disablePadding>\n {listBody}\n </List>\n </>\n );\n};\n","/*\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';\nimport { VisitList } from '../../components/VisitList';\nimport { useContext } from './Context';\n\nexport const VisitedByType = () => {\n const { collapsed, numVisitsOpen, numVisitsTotal, visits, loading, kind } =\n useContext();\n\n return (\n <VisitList\n visits={visits}\n title={kind === 'top' ? 'Top Visited' : 'Recently Visited'}\n detailType={kind === 'top' ? 'hits' : 'time-ago'}\n collapsed={collapsed}\n numVisitsOpen={numVisitsOpen}\n numVisitsTotal={numVisitsTotal}\n loading={loading}\n />\n );\n};\n","/*\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, { useEffect } from 'react';\nimport { VisitedByType } from './VisitedByType';\nimport { Visit, visitsApiRef } from '../../api/VisitsApi';\nimport { ContextValueOnly, useContext } from './Context';\nimport { useApi } from '@backstage/core-plugin-api';\nimport useAsync from 'react-use/lib/useAsync';\n\n/** @public */\nexport type VisitedByTypeKind = 'recent' | 'top';\n\n/** @public */\nexport type VisitedByTypeProps = {\n visits?: Array<Visit>;\n numVisitsOpen?: number;\n numVisitsTotal?: number;\n loading?: boolean;\n kind: VisitedByTypeKind;\n};\n\n/**\n * Display recently visited pages for the homepage\n * @public\n */\nexport const Content = ({\n visits,\n numVisitsOpen,\n numVisitsTotal,\n loading,\n kind,\n}: VisitedByTypeProps) => {\n const { setContext, setVisits, setLoading } = useContext();\n // Allows behavior override from properties\n useEffect(() => {\n const context: Partial<ContextValueOnly> = {};\n context.kind = kind;\n if (visits) {\n context.visits = visits;\n context.loading = false;\n } else if (loading) {\n context.loading = loading;\n }\n if (numVisitsOpen) context.numVisitsOpen = numVisitsOpen;\n if (numVisitsTotal) context.numVisitsTotal = numVisitsTotal;\n setContext(state => ({ ...state, ...context }));\n }, [setContext, kind, visits, loading, numVisitsOpen, numVisitsTotal]);\n\n // Fetches data from visitsApi in case visits and loading are not provided\n const visitsApi = useApi(visitsApiRef);\n const { loading: reqLoading } = useAsync(async () => {\n if (!visits && !loading && kind === 'recent') {\n return await visitsApi\n .list({\n limit: numVisitsTotal ?? 8,\n orderBy: [{ field: 'timestamp', direction: 'desc' }],\n })\n .then(setVisits);\n }\n if (!visits && !loading && kind === 'top') {\n return await visitsApi\n .list({\n limit: numVisitsTotal ?? 8,\n orderBy: [{ field: 'hits', direction: 'desc' }],\n })\n .then(setVisits);\n }\n return undefined;\n }, [visitsApi, visits, loading, setVisits]);\n useEffect(() => {\n if (!loading) {\n setLoading(reqLoading);\n }\n }, [loading, setLoading, reqLoading]);\n\n return <VisitedByType />;\n};\n"],"names":["useStyles"],"mappings":";;;;;;;;;;;AAuCA,MAAM,uBAA4C,GAAA;AAAA,EAChD,SAAW,EAAA,IAAA;AAAA,EACX,aAAe,EAAA,CAAA;AAAA,EACf,cAAgB,EAAA,CAAA;AAAA,EAChB,QAAQ,EAAC;AAAA,EACT,OAAS,EAAA,IAAA;AAAA,EACT,IAAM,EAAA,QAAA;AACR,CAAA,CAAA;AAEO,MAAM,mBAAoC,GAAA;AAAA,EAC/C,GAAG,uBAAA;AAAA,EACH,cAAc,MAAM;AAAA,GAAC;AAAA,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K,CAAA;AAAA,QACJ,OAAO,cAAkB,IAAA,IAAA,GAAA,cAAA,GAAA,CAAA;AAAA,QACzB,SAAS,CAAC,EAAE,OAAO,WAAa,EAAA,SAAA,EAAW,QAAQ,CAAA;AAAA,OACpD,CACA,CAAA,IAAA,CAAK,SAAS,CAAA,CAAA;AAAA,KACnB;AACA,IAAA,IAAI,CAAC,MAAA,IAAU,CAAC,OAAA,IAAW,SAAS,KAAO,EAAA;AACzC,MAAO,OAAA,MAAM,UACV,IAAK,CAAA;AAAA,QACJ,OAAO,cAAkB,IAAA,IAAA,GAAA,cAAA,GAAA,CAAA;AAAA,QACzB,SAAS,CAAC,EAAE,OAAO,MAAQ,EAAA,SAAA,EAAW,QAAQ,CAAA;AAAA,OAC/C,CACA,CAAA,IAAA,CAAK,SAAS,CAAA,CAAA;AAAA,KACnB;AACA,IAAO,OAAA,KAAA,CAAA,CAAA;AAAA,KACN,CAAC,SAAA,EAAW,MAAQ,EAAA,OAAA,EAAS,SAAS,CAAC,CAAA,CAAA;AAC1C,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,CAAC,OAAS,EAAA;AACZ,MAAA,UAAA,CAAW,UAAU,CAAA,CAAA;AAAA,KACvB;AAAA,GACC,EAAA,CAAC,OAAS,EAAA,UAAA,EAAY,UAAU,CAAC,CAAA,CAAA;AAEpC,EAAA,2CAAQ,aAAc,EAAA,IAAA,CAAA,CAAA;AACxB;;;;"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { C as Content } from './Content-a00a3132.esm.js';
|
|
2
|
+
export { A as Actions, a as ContextProvider } from './Content-a00a3132.esm.js';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import '@material-ui/core';
|
|
5
|
+
import '@backstage/core-components';
|
|
6
|
+
import 'luxon';
|
|
7
|
+
import '@backstage/theme';
|
|
8
|
+
import '@backstage/catalog-model';
|
|
9
|
+
import '@material-ui/lab';
|
|
10
|
+
import '../index.esm.js';
|
|
11
|
+
import '@backstage/core-plugin-api';
|
|
12
|
+
import '@backstage/plugin-home-react';
|
|
13
|
+
import '@backstage/core-app-api';
|
|
14
|
+
import 'react-router-dom';
|
|
15
|
+
import 'react-grid-layout';
|
|
16
|
+
import 'react-grid-layout/css/styles.css';
|
|
17
|
+
import 'react-resizable/css/styles.css';
|
|
18
|
+
import 'lodash';
|
|
19
|
+
import 'react-use/lib/useObservable';
|
|
20
|
+
import '@material-ui/core/Typography';
|
|
21
|
+
import '@material-ui/core/IconButton';
|
|
22
|
+
import '@material-ui/icons/Settings';
|
|
23
|
+
import '@material-ui/icons/Delete';
|
|
24
|
+
import '@rjsf/core-v5';
|
|
25
|
+
import '@rjsf/validator-ajv8';
|
|
26
|
+
import '@material-ui/core/List';
|
|
27
|
+
import '@material-ui/core/ListItem';
|
|
28
|
+
import '@material-ui/icons/Add';
|
|
29
|
+
import '@material-ui/core/ListItemText';
|
|
30
|
+
import '@material-ui/core/Button';
|
|
31
|
+
import '@material-ui/icons/Save';
|
|
32
|
+
import '@material-ui/icons/Edit';
|
|
33
|
+
import '@material-ui/icons/Cancel';
|
|
34
|
+
import 'zod';
|
|
35
|
+
import 'react-use/lib/useAsync';
|
|
36
|
+
|
|
37
|
+
const RecentlyVisitedContent = (props) => /* @__PURE__ */ React.createElement(Content, { ...props, kind: "recent" });
|
|
38
|
+
|
|
39
|
+
export { RecentlyVisitedContent as Content };
|
|
40
|
+
//# sourceMappingURL=RecentlyVisited-618bf2be.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecentlyVisited-618bf2be.esm.js","sources":["../../src/homePageComponents/VisitedByType/RecentlyVisited.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\nexport { Actions } from './Actions';\nexport { ContextProvider } from './Context';\nexport type { VisitedByTypeProps, VisitedByTypeKind } from './Content';\nimport React from 'react';\nimport { Content, VisitedByTypeProps } from './Content';\n\nconst RecentlyVisitedContent = (props: Partial<VisitedByTypeProps>) => (\n <Content {...props} kind=\"recent\" />\n);\n\nexport { RecentlyVisitedContent as Content };\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBM,MAAA,sBAAA,GAAyB,CAAC,KAC9B,qBAAA,KAAA,CAAA,aAAA,CAAC,WAAS,GAAG,KAAA,EAAO,MAAK,QAAS,EAAA;;;;"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { C as Content } from './Content-a00a3132.esm.js';
|
|
2
|
+
export { A as Actions, a as ContextProvider } from './Content-a00a3132.esm.js';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import '@material-ui/core';
|
|
5
|
+
import '@backstage/core-components';
|
|
6
|
+
import 'luxon';
|
|
7
|
+
import '@backstage/theme';
|
|
8
|
+
import '@backstage/catalog-model';
|
|
9
|
+
import '@material-ui/lab';
|
|
10
|
+
import '../index.esm.js';
|
|
11
|
+
import '@backstage/core-plugin-api';
|
|
12
|
+
import '@backstage/plugin-home-react';
|
|
13
|
+
import '@backstage/core-app-api';
|
|
14
|
+
import 'react-router-dom';
|
|
15
|
+
import 'react-grid-layout';
|
|
16
|
+
import 'react-grid-layout/css/styles.css';
|
|
17
|
+
import 'react-resizable/css/styles.css';
|
|
18
|
+
import 'lodash';
|
|
19
|
+
import 'react-use/lib/useObservable';
|
|
20
|
+
import '@material-ui/core/Typography';
|
|
21
|
+
import '@material-ui/core/IconButton';
|
|
22
|
+
import '@material-ui/icons/Settings';
|
|
23
|
+
import '@material-ui/icons/Delete';
|
|
24
|
+
import '@rjsf/core-v5';
|
|
25
|
+
import '@rjsf/validator-ajv8';
|
|
26
|
+
import '@material-ui/core/List';
|
|
27
|
+
import '@material-ui/core/ListItem';
|
|
28
|
+
import '@material-ui/icons/Add';
|
|
29
|
+
import '@material-ui/core/ListItemText';
|
|
30
|
+
import '@material-ui/core/Button';
|
|
31
|
+
import '@material-ui/icons/Save';
|
|
32
|
+
import '@material-ui/icons/Edit';
|
|
33
|
+
import '@material-ui/icons/Cancel';
|
|
34
|
+
import 'zod';
|
|
35
|
+
import 'react-use/lib/useAsync';
|
|
36
|
+
|
|
37
|
+
const TopVisitedContent = (props) => /* @__PURE__ */ React.createElement(Content, { ...props, kind: "top" });
|
|
38
|
+
|
|
39
|
+
export { TopVisitedContent as Content };
|
|
40
|
+
//# sourceMappingURL=TopVisited-918c6b5f.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TopVisited-918c6b5f.esm.js","sources":["../../src/homePageComponents/VisitedByType/TopVisited.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\nexport { Actions } from './Actions';\nexport { ContextProvider } from './Context';\nexport type { VisitedByTypeProps, VisitedByTypeKind } from './Content';\nimport React from 'react';\nimport { Content, VisitedByTypeProps } from './Content';\n\nconst TopVisitedContent = (props: Partial<VisitedByTypeProps>) => (\n <Content {...props} kind=\"top\" />\n);\n\nexport { TopVisitedContent as Content };\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBM,MAAA,iBAAA,GAAoB,CAAC,KACzB,qBAAA,KAAA,CAAA,aAAA,CAAC,WAAS,GAAG,KAAA,EAAO,MAAK,KAAM,EAAA;;;;"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useOutlet } from 'react-router-dom';
|
|
3
|
-
export { CustomHomepageGrid } from '../index.esm.js';
|
|
3
|
+
export { CustomHomepageGrid, VisitListener } from '../index.esm.js';
|
|
4
4
|
import '@backstage/core-plugin-api';
|
|
5
5
|
import '@backstage/plugin-home-react';
|
|
6
|
+
import '@backstage/core-app-api';
|
|
6
7
|
import 'react-grid-layout';
|
|
7
8
|
import 'react-grid-layout/css/styles.css';
|
|
8
9
|
import 'react-resizable/css/styles.css';
|
|
@@ -25,6 +26,7 @@ import '@material-ui/icons/Save';
|
|
|
25
26
|
import '@material-ui/icons/Edit';
|
|
26
27
|
import '@material-ui/icons/Cancel';
|
|
27
28
|
import 'zod';
|
|
29
|
+
import '@backstage/catalog-model';
|
|
28
30
|
|
|
29
31
|
const HomepageCompositionRoot = (props) => {
|
|
30
32
|
var _a;
|
|
@@ -34,4 +36,4 @@ const HomepageCompositionRoot = (props) => {
|
|
|
34
36
|
};
|
|
35
37
|
|
|
36
38
|
export { HomepageCompositionRoot };
|
|
37
|
-
//# sourceMappingURL=index-
|
|
39
|
+
//# sourceMappingURL=index-20932a73.esm.js.map
|