@knime/hub-features 1.8.4 → 1.9.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,19 @@
1
1
  # @knime/hub-features
2
2
 
3
+ ## 1.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 53ebfdc: Improve useVersionsAPI baseURL handling
8
+ - 73f42a2: Hub API: Added "discardUnversionedChanges"
9
+
10
+ ## 1.8.5
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [33f0fa5]
15
+ - @knime/components@1.28.3
16
+
3
17
  ## 1.8.4
4
18
 
5
19
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knime/hub-features",
3
- "version": "1.8.4",
3
+ "version": "1.9.0",
4
4
  "description": "Vue components & composables for shared hub features",
5
5
  "homepage": "https://knime.github.io/webapps-common/",
6
6
  "license": "GPL 3 and Additional Permissions according to Sec. 7 (SEE the file LICENSE)",
@@ -31,7 +31,7 @@
31
31
  "lodash-es": "4.17.21",
32
32
  "ofetch": "^1.4.1",
33
33
  "typescript": "^5.4.5",
34
- "@knime/components": "1.28.2",
34
+ "@knime/components": "1.28.3",
35
35
  "@knime/styles": "1.4.0",
36
36
  "@knime/utils": "1.4.0"
37
37
  },
@@ -36,6 +36,7 @@ defineEmits<{
36
36
  delete: [version: NamedItemVersion["version"]];
37
37
  restore: [version: NamedItemVersion["version"]];
38
38
  select: [version: NamedItemVersion["version"]];
39
+ discardCurrentState: [];
39
40
  }>();
40
41
 
41
42
  const labelsEventBus = useEventBus("versionLabels");
@@ -68,6 +69,7 @@ const closeLabelPopovers = throttle(() => {
68
69
  :current-state-savepoint="unversionedSavepoint"
69
70
  @select="$emit('select', CURRENT_STATE_VERSION)"
70
71
  @create-version="$emit('create')"
72
+ @discard="$emit('discardCurrentState')"
71
73
  />
72
74
  </div>
73
75
  </div>
@@ -16,29 +16,29 @@ import { DEFAULT_API_BASE_URL } from "../../common/constants";
16
16
  import { getFetchClient } from "../../common/ofetchClient";
17
17
 
18
18
  type UseVersionsApiOptions = {
19
- baseUrl?: string;
20
19
  customFetchClientOptions?: FetchOptions;
21
20
  };
22
21
 
23
22
  export const useVersionsApi = ({
24
- baseUrl,
25
23
  customFetchClientOptions,
26
24
  }: UseVersionsApiOptions) => {
27
- const $ofetch = getFetchClient(customFetchClientOptions);
25
+ const { baseURL = DEFAULT_API_BASE_URL, ...otherCustomOptions } =
26
+ customFetchClientOptions ?? {};
27
+
28
+ const $ofetch = getFetchClient({ baseURL, ...otherCustomOptions });
28
29
 
29
30
  const doHubRequest = (path: string, fetchOptions?: FetchOptions) => {
30
- const res = `${baseUrl ?? DEFAULT_API_BASE_URL}${path}`;
31
31
  const defaults: FetchOptions = {
32
32
  method: "GET",
33
33
  };
34
34
 
35
35
  try {
36
36
  consola.trace("useVersionsApi::calling", {
37
- path: res,
37
+ path,
38
38
  options: fetchOptions,
39
39
  });
40
40
 
41
- return $ofetch(res, {
41
+ return $ofetch(path, {
42
42
  ...defaults,
43
43
  ...fetchOptions,
44
44
  });
@@ -115,6 +115,12 @@ export const useVersionsApi = ({
115
115
  );
116
116
  };
117
117
 
118
+ const discardUnversionedChanges = ({ itemId }: { itemId: string }) => {
119
+ return doHubRequest(`/repository/${itemId}/workingArea`, {
120
+ method: "DELETE",
121
+ });
122
+ };
123
+
118
124
  const createVersion = ({
119
125
  itemId,
120
126
  title,
@@ -218,6 +224,7 @@ export const useVersionsApi = ({
218
224
  loadSavepointMetadata,
219
225
  deleteVersion,
220
226
  restoreVersion,
227
+ discardUnversionedChanges,
221
228
  createVersion,
222
229
  getAvatar,
223
230
  };