@knime/hub-features 1.22.3 → 1.23.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @knime/hub-features
2
2
 
3
+ ## 1.23.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 368d638: Fix error when fetching versions if user that created the version is no longer available
8
+
9
+ ## 1.22.4
10
+
11
+ ### Patch Changes
12
+
13
+ - 12e9b4a: Auto-expand RFC error toast when details list is empty
14
+
3
15
  ## 1.22.3
4
16
 
5
17
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knime/hub-features",
3
- "version": "1.22.3",
3
+ "version": "1.23.0",
4
4
  "description": "Vue components & composables for shared hub features",
5
5
  "repository": {
6
6
  "type": "git",
@@ -70,18 +70,28 @@ export const useVersionsApi = ({
70
70
  }>;
71
71
  };
72
72
 
73
- const fetchResourceLabels = ({
73
+ const fetchResourceLabels = async ({
74
74
  resourceType,
75
75
  resourceId,
76
76
  }: {
77
77
  resourceType: "savepoint";
78
78
  resourceId: string;
79
- }) => {
80
- return doHubRequest(
81
- `/validation/validation/resources/${resourceType}/${resourceId}/labels`,
82
- ).catch(() => ({ assignedLabels: [] })) as Promise<{
83
- assignedLabels: Array<AssignedLabel>;
84
- }>;
79
+ }): Promise<{
80
+ assignedLabels: Array<AssignedLabel>;
81
+ }> => {
82
+ try {
83
+ return await doHubRequest(
84
+ `/validation/validation/resources/${resourceType}/${resourceId}/labels`,
85
+ );
86
+ } catch (error) {
87
+ consola.error("useVersionsApi::Failed to fetch resource labels", {
88
+ resourceId,
89
+ resourceType,
90
+ error,
91
+ });
92
+
93
+ return { assignedLabels: [] };
94
+ }
85
95
  };
86
96
 
87
97
  const deleteVersion = ({
@@ -140,36 +150,50 @@ export const useVersionsApi = ({
140
150
  }: {
141
151
  accountName: string;
142
152
  }): Promise<HubAvatarData> => {
143
- const accountInfo = await doHubRequest(`/accounts/name/${accountName}`, {
144
- headers: {
145
- Prefer: "representation=minimal",
146
- },
147
- });
153
+ try {
154
+ const accountInfo = await doHubRequest(`/accounts/name/${accountName}`, {
155
+ headers: {
156
+ Prefer: "representation=minimal",
157
+ },
158
+ });
148
159
 
149
- return {
150
- kind: accountInfo.type === "TEAM" ? "group" : "account",
151
- name: accountInfo.name,
152
- image: {
153
- url: accountInfo.avatarUrl,
154
- altText: `${accountInfo.realName ?? accountInfo.name} profile image`,
155
- },
156
- };
160
+ return {
161
+ kind: accountInfo.type === "TEAM" ? "group" : "account",
162
+ name: accountInfo.name,
163
+ image: {
164
+ url: accountInfo.avatarUrl,
165
+ altText: `${accountInfo.realName ?? accountInfo.name} profile image`,
166
+ },
167
+ };
168
+ } catch (error) {
169
+ consola.error("useVersionsApi::Failed to fetch user avatar", {
170
+ accountName,
171
+ error,
172
+ });
173
+
174
+ return {
175
+ kind: "account",
176
+ name: "?",
177
+ tooltip: "unknown",
178
+ };
179
+ }
157
180
  };
158
181
 
159
182
  const loadSavepointMetadata = async (
160
183
  savepoint: ItemSavepoint,
161
184
  ): Promise<WithAvatar & WithLabels> => {
162
- return {
163
- avatar: await getAvatar({
164
- accountName: savepoint.version?.author ?? savepoint.author,
165
- }),
166
- labels: savepoint.itemVersionId
167
- ? await fetchResourceLabels({
168
- resourceType: "savepoint",
169
- resourceId: savepoint.itemVersionId,
170
- }).then((response) => response.assignedLabels)
171
- : [],
172
- };
185
+ const avatar = await getAvatar({
186
+ accountName: savepoint.version?.author ?? savepoint.author,
187
+ });
188
+
189
+ const labels = savepoint.itemVersionId
190
+ ? await fetchResourceLabels({
191
+ resourceType: "savepoint",
192
+ resourceId: savepoint.itemVersionId,
193
+ }).then((response) => response.assignedLabels)
194
+ : [];
195
+
196
+ return { avatar, labels };
173
197
  };
174
198
 
175
199
  const fetchItemSavepoints = ({
@@ -35,7 +35,14 @@ const { copy, copied } = useClipboard({
35
35
  copiedDuring: 3000,
36
36
  });
37
37
 
38
- const showDetails = ref(false);
38
+ const hasDetails =
39
+ props.details?.length ||
40
+ props.status !== undefined ||
41
+ props.date !== undefined ||
42
+ props.requestId !== undefined ||
43
+ props.errorId !== undefined;
44
+ // don't show 'Show details' button if there are no details to show
45
+ const showDetails = ref(!hasDetails);
39
46
 
40
47
  const formatDate = (date: Date): string =>
41
48
  date ? formatDateTimeString(date.getTime()) : "";