@knime/hub-features 1.22.4 → 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knime/hub-features",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.0",
|
|
4
4
|
"description": "Vue components & composables for shared hub features",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"ofetch": "^1.4.1",
|
|
38
38
|
"typescript": "^5.9.3",
|
|
39
39
|
"@knime/components": "1.45.9",
|
|
40
|
-
"@knime/
|
|
41
|
-
"@knime/
|
|
40
|
+
"@knime/styles": "1.15.0",
|
|
41
|
+
"@knime/utils": "1.10.1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"consola": "3.x",
|
|
@@ -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
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
153
|
+
try {
|
|
154
|
+
const accountInfo = await doHubRequest(`/accounts/name/${accountName}`, {
|
|
155
|
+
headers: {
|
|
156
|
+
Prefer: "representation=minimal",
|
|
157
|
+
},
|
|
158
|
+
});
|
|
148
159
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
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
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
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 = ({
|