@xen-orchestra/web-core 0.0.3 → 0.0.5

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 (53) hide show
  1. package/env.d.ts +0 -1
  2. package/lib/assets/css/_typography.pcss +1 -0
  3. package/lib/assets/css/typography/_utils.pcss +6 -0
  4. package/lib/components/LegendTitle.vue +9 -7
  5. package/lib/components/UiTag.vue +3 -7
  6. package/lib/components/backdrop/Backdrop.vue +11 -0
  7. package/lib/components/cell-object/CellObject.vue +54 -0
  8. package/lib/components/cell-text/CellText.vue +40 -0
  9. package/lib/components/chip/UiChip.vue +3 -4
  10. package/lib/components/console/RemoteConsole.vue +1 -1
  11. package/lib/components/divider/Divider.vue +25 -0
  12. package/lib/components/{DonutChart.vue → donut-chart/DonutChart.vue} +28 -24
  13. package/lib/components/donut-chart-with-legend/DonutChartWithLegend.vue +27 -0
  14. package/lib/components/dropdown/DropdownItem.vue +1 -4
  15. package/lib/components/head-bar/HeadBar.vue +78 -0
  16. package/lib/components/input/UiInput.vue +133 -0
  17. package/lib/components/legend/LegendGroup.vue +44 -0
  18. package/lib/components/{UiLegend.vue → legend/LegendItem.vue} +35 -17
  19. package/lib/components/legend/LegendList.vue +19 -0
  20. package/lib/components/object-link/ObjectLink.vue +87 -0
  21. package/lib/components/search-bar/SearchBar.vue +60 -0
  22. package/lib/components/stacked-bar/StackedBarSegment.vue +2 -8
  23. package/lib/components/state-hero/ComingSoonHero.vue +6 -2
  24. package/lib/components/state-hero/LoadingHero.vue +8 -2
  25. package/lib/components/state-hero/ObjectNotFoundHero.vue +1 -1
  26. package/lib/components/state-hero/StateHero.vue +27 -9
  27. package/lib/components/tab/TabList.vue +1 -0
  28. package/lib/components/table/UiTable.vue +6 -0
  29. package/lib/components/task/QuickTaskButton.vue +62 -0
  30. package/lib/components/task/QuickTaskItem.vue +91 -0
  31. package/lib/components/task/QuickTaskList.vue +48 -0
  32. package/lib/components/task/QuickTaskPanel.vue +65 -0
  33. package/lib/components/task/QuickTaskTabBar.vue +46 -0
  34. package/lib/components/tree/TreeItem.vue +8 -8
  35. package/lib/components/tree/TreeItemLabel.vue +28 -16
  36. package/lib/composables/item-counter.composable.md +25 -0
  37. package/lib/composables/item-counter.composable.ts +32 -0
  38. package/lib/composables/tab-list.composable.ts +33 -0
  39. package/lib/composables/tree/branch.ts +5 -5
  40. package/lib/i18n.ts +53 -0
  41. package/lib/layouts/CoreLayout.vue +2 -11
  42. package/lib/locales/de.json +7 -1
  43. package/lib/locales/en.json +23 -1
  44. package/lib/locales/fa.json +46 -0
  45. package/lib/locales/fr.json +23 -1
  46. package/lib/types/novnc.d.ts +342 -0
  47. package/lib/types/tab.type.ts +17 -0
  48. package/lib/types/task.type.ts +13 -0
  49. package/lib/types/utility.type.ts +1 -1
  50. package/lib/utils/if-else.utils.ts +3 -3
  51. package/lib/utils/open-url.utils.ts +3 -0
  52. package/package.json +3 -3
  53. package/lib/components/UiSeparator.vue +0 -11
@@ -0,0 +1,342 @@
1
+ // [WARNING] Temporary file to fix typecheck error
2
+ // Remove if this PR is merged: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/70022
3
+ // Type definitions for @novnc/novnc 1.5
4
+ // Project: https://github.com/novnc/noVNC
5
+ // Definitions by: Jake Jarvis <https://github.com/jakejarvis>
6
+ // Maksim Ovcharik <https://github.com/ovcharik>
7
+ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
8
+
9
+ /* eslint-disable no-use-before-define */
10
+
11
+ declare module '@novnc/novnc/lib/rfb' {
12
+ /**
13
+ * An `object` specifying the credentials to provide to the server when authenticating.
14
+ */
15
+ interface NoVncCredentials {
16
+ /** The user that authenticates */
17
+ username: string
18
+ /** Password for the user */
19
+ password: string
20
+ /** Target machine or session */
21
+ target: string
22
+ }
23
+
24
+ /**
25
+ * An `object` specifying extra details about how the connection should be made.
26
+ */
27
+ interface NoVncOptions {
28
+ /**
29
+ * A `boolean` indicating if the remote server should be shared or if any other connected
30
+ * clients should be disconnected. Enabled by default.
31
+ */
32
+ shared?: boolean
33
+ /**
34
+ * An `object` specifying the credentials to provide to the server when authenticating.
35
+ */
36
+ credentials?: NoVncCredentials
37
+ /**
38
+ * A `string` specifying the ID to provide to any VNC repeater encountered.
39
+ */
40
+ repeaterID?: string
41
+ /**
42
+ * An `Array` of `string`s specifying the sub-protocols to use in the WebSocket connection.
43
+ * Empty by default.
44
+ */
45
+ wsProtocols?: string[]
46
+ }
47
+
48
+ interface NoVncEvents {
49
+ /**
50
+ * The `connect` event is fired after all the handshaking with the server is completed and the
51
+ * connection is fully established. After this event the `NoVncClient` object is ready to
52
+ * receive graphics updates and to send input.
53
+ */
54
+ connect: CustomEvent<Record<string, never>>
55
+
56
+ /**
57
+ * The `disconnect` event is fired when the connection has been terminated. The `detail`
58
+ * property is an `object` that contains the property `clean`. `clean` is a `boolean` indicating
59
+ * if the termination was clean or not. In the event of an unexpected termination or an error
60
+ * `clean` will be set to false.
61
+ */
62
+ disconnect: CustomEvent<{ clean: boolean }>
63
+
64
+ /**
65
+ * The `credentialsrequired` event is fired when the server requests more credentials than were
66
+ * specified to {@link NoVncClient}. The `detail` property is an `object` containing the
67
+ * property `types` which is an `Array` of `string` listing the credentials that are required.
68
+ */
69
+ credentialsrequired: CustomEvent<{ types: Array<keyof NoVncCredentials> }>
70
+
71
+ /**
72
+ * The `securityfailure` event is fired when the handshaking process with the server fails
73
+ * during the security negotiation step. The `detail` property is an `object` containing the
74
+ * following properties:
75
+ *
76
+ * | Property | Type | Description
77
+ * | -------- | ----------- | -----------
78
+ * | `status` | `number` | The failure status code
79
+ * | `reason` | `string` | The **optional** reason for the failure
80
+ *
81
+ * The property `status` corresponds to the
82
+ * [SecurityResult](https://github.com/rfbproto/rfbproto/blob/master/rfbproto.rst#securityresult)
83
+ * status code in cases of failure. A status of zero will not be sent in this event since that
84
+ * indicates a successful security handshaking process. The optional property `reason` is
85
+ * provided by the server and thus the language of the string is not known. However most servers
86
+ * will probably send English strings. The server can choose to not send a reason and in these
87
+ * cases the `reason` property will be omitted.
88
+ */
89
+ securityfailure: CustomEvent<{ status: number; reason?: string }>
90
+
91
+ /**
92
+ * The `clipboard` event is fired when the server has sent clipboard data. The `detail` property
93
+ * is an `object` containing the property `text` which is a `string` with the clipboard data.
94
+ */
95
+ clipboard: CustomEvent<{ text: string }>
96
+
97
+ /**
98
+ * The `bell` event is fired when the server has requested an audible bell.
99
+ */
100
+ bell: CustomEvent<Record<string, never>>
101
+
102
+ /**
103
+ * The `desktopname` event is fired when the name of the remote desktop changes. The `detail`
104
+ * property is an `object` with the property `name` which is a `string` specifying the new name.
105
+ */
106
+ desktopname: CustomEvent<{ name: string }>
107
+
108
+ /**
109
+ * The `capabilities` event is fired whenever an entry is added or removed from `capabilities`.
110
+ * The `detail` property is an `object` with the property `capabilities` containing the new
111
+ * value of `capabilities`.
112
+ */
113
+ capabilities: CustomEvent<{ capabilities: NoVncClient['capabilities'] }>
114
+ }
115
+
116
+ type NoVncEventType = keyof NoVncEvents
117
+ type NoVncEvent = NoVncEvents[NoVncEventType]
118
+
119
+ class NoVncEventTarget extends EventTarget {
120
+ protected _listeners: Map<NoVncEventType, (event: Event) => void>
121
+
122
+ addEventListener<T extends NoVncEventType>(type: T, listener: (event: NoVncEvents[T]) => void): void
123
+ addEventListener(type: string, listener: (event: CustomEvent) => void): void
124
+
125
+ removeEventListener<T extends NoVncEventType>(type: T, listener: (event: NoVncEvents[T]) => void): void
126
+ removeEventListener(type: string, listener: (event: CustomEvent) => void): void
127
+
128
+ dispatchEvent(event: NoVncEvent | CustomEvent): boolean
129
+ }
130
+
131
+ /**
132
+ * The `NoVncClient` object represents a single connection to a VNC server. It communicates using
133
+ * a WebSocket that must provide a standard NoVncClient protocol stream.
134
+ */
135
+ export default class NoVncClient extends NoVncEventTarget {
136
+ readonly _rfbConnectionState: string
137
+ readonly _target: Element
138
+ readonly _url: string | null
139
+
140
+ /**
141
+ * Returns a new `NoVncClient` object and initiates a new connection to a specified VNC server.
142
+ *
143
+ * @param target - A block {@link HTMLElement} that specifies where the `NoVncClient` object
144
+ * should attach itself. The existing contents of the `HTMLElement` will be untouched, but new
145
+ * elements will be added during the lifetime of the `NoVncClient` object.
146
+ * @param url - A `string`, {@link WebSocket}, or {@link RTCDataChannel} specifying the VNC server to connect
147
+ * to. This must be a valid WebSocket URL.
148
+ * @param options - An {@link NoVncOptions} specifying extra details about how the connection
149
+ * should be made.
150
+ */
151
+ constructor(target: Element, url: string | WebSocket | RTCDataChannel, options?: NoVncOptions)
152
+
153
+ /**
154
+ * Is a `boolean` indicating if any events (e.g. key presses or mouse movement) should be
155
+ * prevented from being sent to the server. Disabled by default.
156
+ */
157
+ viewOnly: boolean
158
+
159
+ /**
160
+ * Is a `boolean` indicating if keyboard focus should automatically be moved to the remote
161
+ * session when a `mousedown` or `touchstart` event is received. Enabled by default.
162
+ */
163
+ focusOnClick: boolean
164
+
165
+ /**
166
+ * Is a `boolean` indicating if the remote session should be clipped to its container. When
167
+ * disabled scrollbars will be shown to handle the resulting overflow. Disabled by default.
168
+ */
169
+ clipViewport: boolean
170
+
171
+ /**
172
+ * Is a `boolean` indicating if mouse events should control the relative position of a clipped
173
+ * remote session. Only relevant if `clipViewport` is enabled. Disabled by default.
174
+ */
175
+ dragViewport: boolean
176
+
177
+ /**
178
+ * Is a `boolean` indicating if the remote session should be scaled locally so it fits its
179
+ * container. When disabled it will be centered if the remote session is smaller than its
180
+ * container, or handled according to `clipViewport` if it is larger. Disabled by default.
181
+ */
182
+ scaleViewport: boolean
183
+
184
+ /**
185
+ * Is a `boolean` indicating if a request to resize the remote session should be sent whenever
186
+ * the container changes dimensions. Disabled by default.
187
+ */
188
+ resizeSession: boolean
189
+
190
+ /**
191
+ * Is a `boolean` indicating whether a dot cursor should be shown instead of a zero-sized or
192
+ * fully-transparent cursor if the server sets such invisible cursor. Disabled by default.
193
+ */
194
+ showDotCursor: boolean
195
+
196
+ /**
197
+ * Is a valid CSS [background](https://developer.mozilla.org/en-US/docs/Web/CSS/background)
198
+ * style value indicating which background style should be applied to the element containing the
199
+ * remote session screen. The default value is `rgb(40, 40, 40)` (solid gray color).
200
+ */
201
+ background: string
202
+
203
+ /**
204
+ * Is an `int` in range `[0-9]` controlling the desired JPEG quality. Value `0` implies low
205
+ * quality and `9` implies high quality. Default value is `6`.
206
+ */
207
+ qualityLevel: number
208
+
209
+ /**
210
+ * Is an `int` in range `[0-9]` controlling the desired compression level. Value `0` means no
211
+ * compression. Level 1 uses a minimum of CPU resources and achieves weak compression ratios,
212
+ * while level 9 offers best compression but is slow in terms of CPU consumption on the server
213
+ * side. Use high levels with very slow network connections. Default value is `2`.
214
+ */
215
+ compressionLevel: number
216
+
217
+ /**
218
+ * Is an `object` indicating which optional extensions are available on the server. Some methods
219
+ * may only be called if the corresponding capability is set. The following capabilities are
220
+ * defined:
221
+ *
222
+ * | name | type | description
223
+ * | -------- | --------- | -----------
224
+ * | `power` | `boolean` | Machine power control is available
225
+ */
226
+ readonly capabilities: {
227
+ /** Machine power control is available */
228
+ power: boolean
229
+ }
230
+
231
+ /**
232
+ * Disconnect from the server.
233
+ */
234
+ disconnect(): void
235
+
236
+ /**
237
+ * Send credentials to server. Should be called after the
238
+ * {@link NoVncEventType.credentialsrequired} event has fired.
239
+ *
240
+ * @param credentials An {@link NoVncCredentials} specifying the credentials to provide to the
241
+ * server when authenticating.
242
+ */
243
+ sendCredentials(credentials: NoVncCredentials): void
244
+
245
+ /**
246
+ * Send a key event to the server.
247
+ *
248
+ * @param keysym A `number` specifying the NoVncClient keysym to send. Can be `0` if a valid
249
+ * **`code`** is specified.
250
+ * @param code A `string` specifying the physical key to send. Valid values are those that can
251
+ * be specified to {@link KeyboardEvent.code}. If the physical key cannot be determined then
252
+ * `null` shall be specified.
253
+ * @param down A `boolean` specifying if a press or a release event should be sent. If omitted
254
+ * then both a press and release event are sent.
255
+ */
256
+ sendKey(keysym: number, code: string | null, down?: boolean): void
257
+
258
+ /**
259
+ * Send the key sequence *left Control*, *left Alt*, *Delete*. This is a convenience wrapper
260
+ * around {@link sendKey}.
261
+ */
262
+ sendCtrlAltDel(): void
263
+
264
+ /**
265
+ * Sets the keyboard focus on the remote session. Keyboard events will be sent to the remote
266
+ * server after this point.
267
+ *
268
+ * @param options A {@link FocusOptions} providing options to control how the focus will be
269
+ * performed. Please see {@link HTMLElement.focus} for available options.
270
+ */
271
+ focus(options?: FocusOptions): void
272
+
273
+ /**
274
+ * Remove keyboard focus on the remote session. Keyboard events will no longer be sent to the
275
+ * remote server after this point.
276
+ */
277
+ blur(): void
278
+
279
+ /**
280
+ * Request to shut down the remote machine. The capability `power` must be set for this method
281
+ * to have any effect.
282
+ */
283
+ machineShutdown(): void
284
+
285
+ /**
286
+ * Request a clean reboot of the remote machine. The capability `power` must be set for this
287
+ * method to have any effect.
288
+ */
289
+ machineReboot(): void
290
+
291
+ /**
292
+ * Request a forced reset of the remote machine. The capability `power` must be set for this
293
+ * method to have any effect.
294
+ */
295
+ machineReset(): void
296
+
297
+ /**
298
+ * Send clipboard data to the remote server.
299
+ *
300
+ * @param text A `string` specifying the clipboard data to send.
301
+ */
302
+ clipboardPasteFrom(text: string): void
303
+ }
304
+ }
305
+
306
+ declare module '@novnc/novnc/core/util/browser' {
307
+ let isTouchDevice: boolean
308
+ let dragThreshold: number
309
+
310
+ const supportsCursorURIs: boolean
311
+ const hasScrollbarGutter: boolean
312
+
313
+ function isMac(): boolean
314
+
315
+ function isWindows(): boolean
316
+
317
+ function isIOS(): boolean
318
+
319
+ function isSafari(): boolean
320
+
321
+ function isFirefox(): boolean
322
+ }
323
+
324
+ declare module '@novnc/novnc/core/input/util' {
325
+ interface KeyboardEventBase {
326
+ char?: string
327
+ charCode?: number
328
+ code: string
329
+ key: string
330
+ keyCode?: number
331
+ location?: number
332
+ type?: string
333
+ }
334
+
335
+ function getKeycode(event: KeyboardEventBase): string
336
+
337
+ function getKey(event: KeyboardEventBase): string
338
+
339
+ function getKeysym(event: KeyboardEventBase): number
340
+ }
341
+
342
+ /* eslint-enable no-use-before-define */
@@ -0,0 +1,17 @@
1
+ import type { Ref } from 'vue'
2
+
3
+ export type Tab = {
4
+ isActive: boolean
5
+ activate: () => void
6
+ bindings: {
7
+ onClick: (event: MouseEvent) => void
8
+ active: boolean
9
+ }
10
+ }
11
+
12
+ export type TabList<TName extends string> = {
13
+ currentTab: Ref<TName | undefined>
14
+ activate: (name: TName | undefined) => void
15
+ isActive: (name: TName) => boolean
16
+ tabs: Record<TName, Tab>
17
+ }
@@ -0,0 +1,13 @@
1
+ export type TaskStatus = 'pending' | 'success' | 'failure'
2
+
3
+ export type TaskTab = TaskStatus | 'all'
4
+
5
+ export type Task = {
6
+ id: string | number
7
+ name: string
8
+ status: TaskStatus
9
+ tag?: string
10
+ start?: number
11
+ end?: number
12
+ subtasks?: Task[]
13
+ }
@@ -1,3 +1,3 @@
1
1
  export type MaybeArray<T> = T | T[]
2
2
 
3
- export type Noop = () => void
3
+ export type VoidFunction = () => void
@@ -1,4 +1,4 @@
1
- import type { MaybeArray, Noop } from '@core/types/utility.type'
1
+ import type { MaybeArray, VoidFunction } from '@core/types/utility.type'
2
2
  import { toArray } from '@core/utils/to-array.utils'
3
3
  import { watch, type WatchOptions, type WatchSource } from 'vue'
4
4
 
@@ -6,8 +6,8 @@ export interface IfElseOptions extends Pick<WatchOptions, 'immediate'> {}
6
6
 
7
7
  export function ifElse(
8
8
  source: WatchSource<boolean>,
9
- onTrue: MaybeArray<Noop>,
10
- onFalse: MaybeArray<Noop>,
9
+ onTrue: MaybeArray<VoidFunction>,
10
+ onFalse: MaybeArray<VoidFunction>,
11
11
  options?: IfElseOptions
12
12
  ) {
13
13
  const onTrueFunctions = toArray(onTrue)
@@ -0,0 +1,3 @@
1
+ export function openUrl(url: string, targetBlank?: boolean) {
2
+ window.open(url, targetBlank ? '_blank' : '_self')
3
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xen-orchestra/web-core",
3
3
  "type": "module",
4
- "version": "0.0.3",
4
+ "version": "0.0.5",
5
5
  "private": false,
6
6
  "exports": {
7
7
  "./*": {
@@ -26,7 +26,7 @@
26
26
  "pinia": "^2.1.7",
27
27
  "vue": "^3.4.13",
28
28
  "vue-i18n": "^9.9.0",
29
- "vue-router": "^4.2.5"
29
+ "vue-router": "^4.4.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/lodash-es": "^4.17.12",
@@ -35,7 +35,7 @@
35
35
  "pinia": "^2.1.7",
36
36
  "vue": "^3.4.13",
37
37
  "vue-i18n": "^9.9.0",
38
- "vue-router": "^4.2.5"
38
+ "vue-router": "^4.4.0"
39
39
  },
40
40
  "homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@xen-orchestra/web-core",
41
41
  "bugs": "https://github.com/vatesfr/xen-orchestra/issues",
@@ -1,11 +0,0 @@
1
- <template>
2
- <hr class="ui-separator" />
3
- </template>
4
-
5
- <style lang="postcss" scoped>
6
- .ui-separator {
7
- border: none;
8
- border-top: 0.1rem solid var(--color-grey-500);
9
- border-right: 0.1rem solid var(--color-grey-500);
10
- }
11
- </style>