text stringlengths 1 2.83M | id stringlengths 16 152 | metadata dict | __index_level_0__ int64 0 949 |
|---|---|---|---|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M11 18H7.941c-.297-1.273-1.637-2.314-2.187-3a8 8 0 1 1 12.49.002c-.55.685-1.888 1.726-2.185 2.998H13v-5h-2v5zm5 2v1a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2v-1h8z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/lightbulb-fill.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/lightbulb-fill.svg",
"repo_id": "owncloud",
"token_count": 193
} | 760 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M4 3h16a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zm1 2v14h14V5H5zm2.5 4a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm-1 1h2v7.5h-2V10zm5.5.43c.584-.565 1.266-.93 2-.93 2.071 0 3.5 1.679 3.5 3.75v4.25h-2v-4.25a1.75 1.75 0 0 0-3.5 0v4.25h-2V10h2v.43z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/linkedin-box-line.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/linkedin-box-line.svg",
"repo_id": "owncloud",
"token_count": 272
} | 761 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M4 15h2v5h12V4H6v5H4V3a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-6zm6-4V8l5 4-5 4v-3H2v-2h8z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/login-box-line.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/login-box-line.svg",
"repo_id": "owncloud",
"token_count": 176
} | 762 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M22 14h-2V7.238l-7.928 7.1L4 7.216V19h11v2H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h18a1 1 0 0 1 1 1v10zM4.511 5l7.55 6.662L19.502 5H4.511zm16.903 14l2.122 2.121-1.415 1.415L20 20.414l-2.121 2.122-1.415-1.415L18.586 19l-2.122-2.121 1.415-1.415L20 17.586l2.121-2.122 1.415 1.415L21.414 19z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/mail-close-line.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/mail-close-line.svg",
"repo_id": "owncloud",
"token_count": 263
} | 763 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M22 13h-2V7.238l-7.928 7.1L4 7.216V19h10v2H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h18a1 1 0 0 1 1 1v9zM4.511 5l7.55 6.662L19.502 5H4.511zM19.5 21.75l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43L19.5 15l1.323 2.68 2.957.43-2.14 2.085.505 2.946L19.5 21.75z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/mail-star-line.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/mail-star-line.svg",
"repo_id": "owncloud",
"token_count": 253
} | 764 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M12 18.485l4.243-4.242a6 6 0 1 0-8.486 0L12 18.485zm5.657-2.828L12 21.314l-5.657-5.657a8 8 0 1 1 11.314 0zM5 22h14v2H5v-2z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/map-pin-5-line.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/map-pin-5-line.svg",
"repo_id": "owncloud",
"token_count": 165
} | 765 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path fill-rule="nonzero" d="M10 10.5l1.038-3.635a1 1 0 0 1 1.924 0L14 10.5V12h.72a1 1 0 0 1 .97.757l1.361 5.447a8 8 0 1 0-10.102 0l1.362-5.447A1 1 0 0 1 9.28 12H10v-1.5zm2 9.5a7.952 7.952 0 0 0 3.265-.694L13.938 14h-3.876l-1.327 5.306A7.95 7.95 0 0 0 12 20zm0 2C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/markup-line.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/markup-line.svg",
"repo_id": "owncloud",
"token_count": 274
} | 766 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0H24V24H0z"/>
<path d="M11 2c4.068 0 7.426 3.036 7.934 6.965l2.25 3.539c.148.233.118.58-.225.728L19 14.07V17c0 1.105-.895 2-2 2h-1.999L15 22H6v-3.694c0-1.18-.436-2.297-1.244-3.305C3.657 13.631 3 11.892 3 10c0-4.418 3.582-8 8-8zm0 2c-3.314 0-6 2.686-6 6 0 1.385.468 2.693 1.316 3.75C7.41 15.114 8 16.667 8 18.306V20h5l.002-3H17v-4.248l1.55-.664-1.543-2.425-.057-.442C16.566 6.251 14.024 4 11 4zm-.53 3.763l.53.53.53-.53c.684-.684 1.792-.684 2.475 0 .684.683.684 1.791 0 2.474L11 13.243l-3.005-3.006c-.684-.683-.684-1.791 0-2.474.683-.684 1.791-.684 2.475 0z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/mental-health-line.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/mental-health-line.svg",
"repo_id": "owncloud",
"token_count": 403
} | 767 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M12 1a5 5 0 0 1 5 5v4a5 5 0 0 1-10 0V6a5 5 0 0 1 5-5zM3.055 11H5.07a7.002 7.002 0 0 0 13.858 0h2.016A9.004 9.004 0 0 1 13 18.945V23h-2v-4.055A9.004 9.004 0 0 1 3.055 11z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/mic-fill.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/mic-fill.svg",
"repo_id": "owncloud",
"token_count": 190
} | 768 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M12 20h8v2h-8C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10a9.956 9.956 0 0 1-2 6h-2.708A8 8 0 1 0 12 20zm0-10a2 2 0 1 1 0-4 2 2 0 0 1 0 4zm-4 4a2 2 0 1 1 0-4 2 2 0 0 1 0 4zm8 0a2 2 0 1 1 0-4 2 2 0 0 1 0 4zm-4 4a2 2 0 1 1 0-4 2 2 0 0 1 0 4z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/movie-2-line.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/movie-2-line.svg",
"repo_id": "owncloud",
"token_count": 233
} | 769 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path fill-rule="nonzero" d="M16 20V4H4v15a1 1 0 0 0 1 1h11zm3 2H5a3 3 0 0 1-3-3V3a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v7h4v9a3 3 0 0 1-3 3zm-1-10v7a1 1 0 0 0 2 0v-7h-2zM6 6h6v6H6V6zm2 2v2h2V8H8zm-2 5h8v2H6v-2zm0 3h8v2H6v-2z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/newspaper-line.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/newspaper-line.svg",
"repo_id": "owncloud",
"token_count": 240
} | 770 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path fill-rule="nonzero" d="M14 20v-2.157c1.863-1.192 3.5-3.875 3.5-6.959 0-3.073-2-6.029-5.5-6.029s-5.5 2.956-5.5 6.03c0 3.083 1.637 5.766 3.5 6.958V20H3v-2h4.76C5.666 16.505 4 13.989 4 10.884 4 6.247 7.5 3 12 3s8 3.247 8 7.884c0 3.105-1.666 5.621-3.76 7.116H21v2h-7z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/omega.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/omega.svg",
"repo_id": "owncloud",
"token_count": 255
} | 771 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M5 8v12h14V8H5zm0-2h14V4H5v2zm15 16H4a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1h16a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1zM7 10h4v4H7v-4zm0 6h10v2H7v-2zm6-5h4v2h-4v-2z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/pages-line.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/pages-line.svg",
"repo_id": "owncloud",
"token_count": 202
} | 772 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path fill-rule="nonzero" d="M6 3h7a6 6 0 1 1 0 12h-3v6H6V3zm4 4v4h3a2 2 0 1 0 0-4h-3z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/parking-fill.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/parking-fill.svg",
"repo_id": "owncloud",
"token_count": 138
} | 773 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M12.9 6.858l4.242 4.243L7.242 21H3v-4.243l9.9-9.9zm1.414-1.414l2.121-2.122a1 1 0 0 1 1.414 0l2.829 2.829a1 1 0 0 1 0 1.414l-2.122 2.121-4.242-4.242z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/pencil-fill.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/pencil-fill.svg",
"repo_id": "owncloud",
"token_count": 186
} | 774 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path fill-rule="nonzero" d="M21 3a1 1 0 0 1 1 1v7h-2V5H4v14h6v2H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h18zm0 10a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1h-8a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1h8zM6.707 6.293l2.25 2.25L11 6.5V12H5.5l2.043-2.043-2.25-2.25 1.414-1.414z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/picture-in-picture-2-fill.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/picture-in-picture-2-fill.svg",
"repo_id": "owncloud",
"token_count": 246
} | 775 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M4 13v5h16v-5H4zm1.618-2h12.764a1 1 0 0 0 .894-1.447L18 7H6L4.724 9.553A1 1 0 0 0 5.618 11zM22 13.5V21a1 1 0 0 1-1 1h-1a1 1 0 0 1-1-1v-1H5v1a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-7.5l-1.243-.31A1 1 0 0 1 0 12.22v-.72a.5.5 0 0 1 .5-.5H2l2.447-4.894A2 2 0 0 1 6.237 5H8V3h3v2h2V3h3v2h1.764a2 2 0 0 1 1.789 1.106L22 11h1.5a.5.5 0 0 1 .5.5v.72a1 1 0 0 1-.757.97L22 13.5zM5 14c2.317 0 3.879.755 4.686 2.264a.5.5 0 0 1-.441.736H6a1 1 0 0 1-1-1v-2zm14 0v2a1 1 0 0 1-1 1h-3.245a.5.5 0 0 1-.44-.736C15.12 14.754 16.682 14 19 14z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/police-car-line.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/police-car-line.svg",
"repo_id": "owncloud",
"token_count": 428
} | 776 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M22 19v2h-2v-2H4v2H2v-2a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1h10.528A5.985 5.985 0 0 1 17 3c1.777 0 3.374.773 4.472 2H22a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1zM11.341 7H3v10h18v-3.528A6 6 0 0 1 11.341 7zM17 13a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM5 13h2v2H5v-2zm3 0h2v2H8v-2z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/projector-2-line.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/projector-2-line.svg",
"repo_id": "owncloud",
"token_count": 254
} | 777 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M15 3h6v5h-2V5h-4V3zM9 3v2H5v3H3V3h6zm6 18v-2h4v-3h2v5h-6zm-6 0H3v-5h2v3h4v2zM3 11h18v2H3v-2z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/qr-scan-2-line.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/qr-scan-2-line.svg",
"repo_id": "owncloud",
"token_count": 172
} | 778 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm0-6a4 4 0 1 0 0-8 4 4 0 0 0 0 8z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/radio-button-fill.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/radio-button-fill.svg",
"repo_id": "owncloud",
"token_count": 146
} | 779 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M21 5.937A11.985 11.985 0 0 1 14.194 9.8a2.5 2.5 0 0 0-4.388 0A11.985 11.985 0 0 1 3 5.937V3a1 1 0 0 1 1-1h16a1 1 0 0 1 1 1v2.937zm0 2.787V21a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V8.724A13.944 13.944 0 0 0 9.63 11.8a2.501 2.501 0 0 0 4.74 0A13.944 13.944 0 0 0 21 8.724z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/red-packet-fill.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/red-packet-fill.svg",
"repo_id": "owncloud",
"token_count": 250
} | 780 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M17 12a1 1 0 0 1 1 1v9H6v-9a1 1 0 0 1 1-1h10zm-7 2H8v2h2v-2zm2-8a6 6 0 0 1 5.368 3.316l-1.79.895a4 4 0 0 0-7.157 0l-1.789-.895A6 6 0 0 1 12 6zm0-4a10 10 0 0 1 8.946 5.527l-1.789.895A8 8 0 0 0 12 4a8 8 0 0 0-7.157 4.422l-1.79-.895A10 10 0 0 1 12 2z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/remote-control-fill.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/remote-control-fill.svg",
"repo_id": "owncloud",
"token_count": 248
} | 781 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512">
<!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) -->
<g>
<path d="M160 237H108V288H160V237Z" />
<path d="M160 320H108V370H160V320Z" />
<path d="M192 370V320H276V370H192Z" />
<path d="M192 288V237H276V288H192Z" />
<path fill-rule="evenodd" clip-rule="evenodd" d="M224 0V136C224 149.2 234.8 160 248 160H384V488C384 501.3 373.3 512 360 512H24C10.7 512 0 501.3 0 488V24C0 10.7 10.7 0 24 0H224ZM87 205C80.9249 205 76 209.925 76 216V391C76 397.075 80.9249 402 87 402H297C303.075 402 308 397.075 308 391V216C308 209.925 303.075 205 297 205H87Z" />
<path d="M384 128V121.9C384 115.6 381.5 109.5 377 105L279.1 7C274.6 2.5 268.5 0 262.1 0H256V128H384Z" />
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/resource-type-spreadsheet-fill.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/resource-type-spreadsheet-fill.svg",
"repo_id": "owncloud",
"token_count": 387
} | 782 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M2 9h2v12H2V9zm6-6h2v18H8V3zm6 9h2v9h-2v-9zm6-6h2v15h-2V6z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/rhythm-fill.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/rhythm-fill.svg",
"repo_id": "owncloud",
"token_count": 141
} | 783 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0H24V24H0z"/>
<path d="M21 19v2h-2v-2h2zm-4 0v2h-2v-2h2zm-4 0v2h-2v-2h2zm-4 0v2H7v-2h2zm-4 0v2H3v-2h2zm16-4v2h-2v-2h2zM5 15v2H3v-2h2zm0-4v2H3v-2h2zm11-8c2.687 0 4.882 2.124 4.995 4.783L21 8v5h-2V8c0-1.591-1.255-2.903-2.824-2.995L16 5h-5V3h5zM5 7v2H3V7h2zm0-4v2H3V3h2zm4 0v2H7V3h2z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/rounded-corner.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/rounded-corner.svg",
"repo_id": "owncloud",
"token_count": 305
} | 784 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M20 20.333V22h-2v-1.333l-7.418 1.236A.5.5 0 0 1 10 21.41V20H6v2H4v-2H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h7V1.59a.5.5 0 0 1 .582-.493l10.582 1.764a1 1 0 0 1 .836.986V6h1v2h-1v7h1v2h-1v2.153a1 1 0 0 1-.836.986L20 20.333zM4 5v13h6V5H4zm8 14.64l8-1.334V4.694l-8-1.333v16.278zM16.5 14c-.828 0-1.5-1.12-1.5-2.5S15.672 9 16.5 9s1.5 1.12 1.5 2.5-.672 2.5-1.5 2.5z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/safe-2-line.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/safe-2-line.svg",
"repo_id": "owncloud",
"token_count": 333
} | 785 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0H24V24H0z"/>
<path d="M13 2v1h7v2h-7v14h4v2H7v-2h4V5H4V3h7V2h2zM5 6.343l2.828 2.829C8.552 9.895 9 10.895 9 12c0 2.21-1.79 4-4 4s-4-1.79-4-4c0-1.105.448-2.105 1.172-2.828L5 6.343zm14 0l2.828 2.829C22.552 9.895 23 10.895 23 12c0 2.21-1.79 4-4 4s-4-1.79-4-4c0-1.105.448-2.105 1.172-2.828L19 6.343zM5 9.172l-1.414 1.414C3.212 10.96 3 11.46 3 12c0 1.105.895 2 2 2s2-.895 2-2c0-.54-.212-1.04-.586-1.414L5 9.172zm14 0l-1.414 1.414C17.212 10.96 17 11.46 17 12c0 1.105.895 2 2 2s2-.895 2-2c0-.54-.212-1.04-.586-1.414L19 9.172z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/scales-line.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/scales-line.svg",
"repo_id": "owncloud",
"token_count": 414
} | 786 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M6 7.828V20h12V4H9.828L6 7.828zm-1.707-1.12L9 2h10a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7.414a1 1 0 0 1 .293-.707zM15 5h2v4h-2V5zm-3 0h2v4h-2V5zM9 6h2v3H9V6z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/sd-card-line.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/sd-card-line.svg",
"repo_id": "owncloud",
"token_count": 211
} | 787 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M4 19h16v-5h2v6a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-6h2v5zM16.172 7l-3.95-3.95 1.414-1.414L20 8l-6.364 6.364-1.414-1.414L16.172 9H5V7h11.172z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/share-forward-2-line.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/share-forward-2-line.svg",
"repo_id": "owncloud",
"token_count": 183
} | 788 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M3.783 2.826L12 1l8.217 1.826a1 1 0 0 1 .783.976v9.987a6 6 0 0 1-2.672 4.992L12 23l-6.328-4.219A6 6 0 0 1 3 13.79V3.802a1 1 0 0 1 .783-.976zM12 13.5l2.939 1.545-.561-3.272 2.377-2.318-3.286-.478L12 6l-1.47 2.977-3.285.478 2.377 2.318-.56 3.272L12 13.5z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/shield-star-fill.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/shield-star-fill.svg",
"repo_id": "owncloud",
"token_count": 240
} | 789 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M15.366 3.438L18.577 9H22v2h-1.167l-.757 9.083a1 1 0 0 1-.996.917H4.92a1 1 0 0 1-.996-.917L3.166 11H2V9h3.422l3.212-5.562 1.732 1L7.732 9h8.535l-2.633-4.562 1.732-1zM13 13h-2v4h2v-4zm-4 0H7v4h2v-4zm8 0h-2v4h2v-4z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/shopping-basket-2-fill.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/shopping-basket-2-fill.svg",
"repo_id": "owncloud",
"token_count": 236
} | 790 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M21 21L3 21C2.73478 21 2.48043 20.8946 2.29289 20.7071C2.10536 20.5196 2 20.2652 2 20L2 4C2 3.73478 2.10536 3.48043 2.29289 3.29289C2.48043 3.10536 2.73478 3 3 3L21 3C21.2652 3 21.5196 3.10536 21.7071 3.29289C21.8946 3.48043 22 3.73478 22 4L22 20C22 20.2652 21.8946 20.5196 21.7071 20.7071C21.5196 20.8946 21.2652 21 21 21V21ZM15 19L15 5L4 5L4 19L15 19Z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/side-bar-right-fill.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/side-bar-right-fill.svg",
"repo_id": "owncloud",
"token_count": 278
} | 791 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M5 2h10l4.707 4.707a1 1 0 0 1 .293.707V21a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zm8 16v-8H8v2h3v6h2zm-5-5v2h2v-2H8zm6 0v2h2v-2h-2zm0-3v2h2v-2h-2zm-6 6v2h2v-2H8zm6 0v2h2v-2h-2z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/sim-card-2-fill.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/sim-card-2-fill.svg",
"repo_id": "owncloud",
"token_count": 234
} | 792 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M12 2c5.523 0 10 4.477 10 10v3.764a2 2 0 0 1-1.106 1.789L18 19v1a3 3 0 0 1-2.824 2.995L14.95 23a2.5 2.5 0 0 0 .044-.33L15 22.5V22a2 2 0 0 0-1.85-1.995L13 20h-2a2 2 0 0 0-1.995 1.85L9 22v.5c0 .171.017.339.05.5H9a3 3 0 0 1-3-3v-1l-2.894-1.447A2 2 0 0 1 2 15.763V12C2 6.477 6.477 2 12 2zm-4 9a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm8 0a2 2 0 1 0 0 4 2 2 0 0 0 0-4z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/skull-2-fill.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/skull-2-fill.svg",
"repo_id": "owncloud",
"token_count": 306
} | 793 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M13 21v2h-2v-2H3a1 1 0 0 1-1-1V6h20v14a1 1 0 0 1-1 1h-8zM8 10a3 3 0 1 0 3 3H8v-3zm5 0v2h6v-2h-6zm0 4v2h6v-2h-6zM2 3h20v2H2V3z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/slideshow-fill.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/slideshow-fill.svg",
"repo_id": "owncloud",
"token_count": 187
} | 794 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M4 9v4h16V9h2v5a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V9h2z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/space.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/space.svg",
"repo_id": "owncloud",
"token_count": 127
} | 795 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M12 15.968l4.247 2.377-.949-4.773 3.573-3.305-4.833-.573L12 5.275v10.693zm0 2.292l-7.053 3.948 1.575-7.928L.587 8.792l8.027-.952L12 .5l3.386 7.34 8.027.952-5.935 5.488 1.575 7.928L12 18.26z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/star-half-fill.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/star-half-fill.svg",
"repo_id": "owncloud",
"token_count": 201
} | 796 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M21 13v7a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-7H2v-2l1-5h18l1 5v2h-1zM5 13v6h14v-6H5zm-.96-2h15.92l-.6-3H4.64l-.6 3zM6 14h8v3H6v-3zM3 3h18v2H3V3z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/store-3-line.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/store-3-line.svg",
"repo_id": "owncloud",
"token_count": 198
} | 797 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0H24V24H0z"/>
<path d="M15 1c.552 0 1 .448 1 1v5h1V6h2v1h1c.552 0 1 .448 1 1v12c0 .552-.448 1-1 1h-1v1h-2v-1H7v1H5v-1H4c-.552 0-1-.448-1-1V8c0-.552.448-1 1-1h1V6h2v1h1V2c0-.552.448-1 1-1h6zm4 8H5v10h14V9zM9 10v8H7v-8h2zm4 0v8h-2v-8h2zm4 0v8h-2v-8h2zm-3-7h-4v4h4V3z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/suitcase-3-line.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/suitcase-3-line.svg",
"repo_id": "owncloud",
"token_count": 274
} | 798 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0L24 0 24 24 0 24z"/>
<path d="M17 2v2h3.007c.548 0 .993.445.993.993v16.014c0 .548-.445.993-.993.993H3.993C3.445 22 3 21.555 3 21.007V4.993C3 4.445 3.445 4 3.993 4H7V2h10zM7 6H5v14h14V6h-2v2H7V6zm2 10v2H7v-2h2zm0-3v2H7v-2h2zm0-3v2H7v-2h2zm6-6H9v2h6V4z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/survey-line.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/survey-line.svg",
"repo_id": "owncloud",
"token_count": 242
} | 799 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M21 2.992v18.016a1 1 0 0 1-.993.992H3.993A.993.993 0 0 1 3 21.008V2.992A1 1 0 0 1 3.993 2h16.014c.548 0 .993.444.993.992zm-9.707 10.13l-2.475-2.476-1.414 1.415 3.889 3.889 5.657-5.657-1.414-1.414-4.243 4.242z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/task-fill.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/task-fill.svg",
"repo_id": "owncloud",
"token_count": 207
} | 800 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M11 12l-7.071 7.071-1.414-1.414L8.172 12 2.515 6.343 3.929 4.93 11 12zm0 7h10v2H11v-2z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/terminal-fill.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/terminal-fill.svg",
"repo_id": "owncloud",
"token_count": 143
} | 801 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M14.6 8H21a2 2 0 0 1 2 2v2.104a2 2 0 0 1-.15.762l-3.095 7.515a1 1 0 0 1-.925.619H2a1 1 0 0 1-1-1V10a1 1 0 0 1 1-1h3.482a1 1 0 0 0 .817-.423L11.752.85a.5.5 0 0 1 .632-.159l1.814.907a2.5 2.5 0 0 1 1.305 2.853L14.6 8zM7 10.588V19h11.16L21 12.104V10h-6.4a2 2 0 0 1-1.938-2.493l.903-3.548a.5.5 0 0 0-.261-.571l-.661-.33-4.71 6.672c-.25.354-.57.644-.933.858zM5 11H3v8h2v-8z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/thumb-up-line.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/thumb-up-line.svg",
"repo_id": "owncloud",
"token_count": 324
} | 802 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M5 15v2a2 2 0 0 0 1.85 1.995L7 19h3v2H7a4 4 0 0 1-4-4v-2h2zm13-5l4.4 11h-2.155l-1.201-3h-4.09l-1.199 3h-2.154L16 10h2zm-1 2.885L15.753 16h2.492L17 12.885zM8 2v2h4v7H8v3H6v-3H2V4h4V2h2zm9 1a4 4 0 0 1 4 4v2h-2V7a2 2 0 0 0-2-2h-3V3h3zM6 6H4v3h2V6zm4 0H8v3h2V6z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/translate.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/translate.svg",
"repo_id": "owncloud",
"token_count": 283
} | 803 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M5 20h14v2H5v-2zm7-2a8 8 0 1 1 0-16 8 8 0 0 1 0 16z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/user-4-fill.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/user-4-fill.svg",
"repo_id": "owncloud",
"token_count": 122
} | 804 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M14 14.252V22H4a8 8 0 0 1 10-7.748zM12 13c-3.315 0-6-2.685-6-6s2.685-6 6-6 6 2.685 6 6-2.685 6-6 6zm8 4h3v2h-3v3.5L15 18l5-4.5V17z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/user-received-2-fill.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/user-received-2-fill.svg",
"repo_id": "owncloud",
"token_count": 178
} | 805 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M14 14.252V22H4a8 8 0 0 1 10-7.748zM12 13c-3.315 0-6-2.685-6-6s2.685-6 6-6 6 2.685 6 6-2.685 6-6 6zm7 3.586l2.121-2.122 1.415 1.415L20.414 18l2.122 2.121-1.415 1.415L19 19.414l-2.121 2.122-1.415-1.415L17.586 18l-2.122-2.121 1.415-1.415L19 16.586z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/user-unfollow-fill.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/user-unfollow-fill.svg",
"repo_id": "owncloud",
"token_count": 238
} | 806 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M17 9.2l5.213-3.65a.5.5 0 0 1 .787.41v12.08a.5.5 0 0 1-.787.41L17 14.8V19a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v4.2zM5 8v2h2V8H5z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/vidicon-fill.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/vidicon-fill.svg",
"repo_id": "owncloud",
"token_count": 195
} | 807 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M21 3v18H3V3h18zm-8 3h-2v12h2V6zM9 9H7v6h2V9zm8 0h-2v6h2V9z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/voice-recognition-fill.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/voice-recognition-fill.svg",
"repo_id": "owncloud",
"token_count": 139
} | 808 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M7.617 8.712l3.205-2.328A1.995 1.995 0 0 1 12.065 6a2.616 2.616 0 0 1 2.427 1.82c.186.583.356.977.51 1.182A4.992 4.992 0 0 0 19 11v2a6.986 6.986 0 0 1-5.402-2.547l-.697 3.955 2.061 1.73 2.223 6.108-1.88.684-2.04-5.604-3.39-2.845a2 2 0 0 1-.713-1.904l.509-2.885-.677.492-2.127 2.928-1.618-1.176L7.6 8.7l.017.012zM13.5 5.5a2 2 0 1 1 0-4 2 2 0 0 1 0 4zm-2.972 13.181l-3.214 3.83-1.532-1.285 2.976-3.546.746-2.18 1.791 1.5-.767 1.681z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/walk-fill.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/walk-fill.svg",
"repo_id": "owncloud",
"token_count": 356
} | 809 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g>
<path fill="none" d="M0 0H24V24H0z"/>
<path d="M3 5.479l7.377-1.016v7.127H3V5.48zm0 13.042l7.377 1.017v-7.04H3v6.023zm8.188 1.125L21 21v-8.502h-9.812v7.148zm0-15.292v7.236H21V3l-9.812 1.354z"/>
</g>
</svg>
| owncloud/web/packages/design-system/src/assets/icons/windows-fill.svg/0 | {
"file_path": "owncloud/web/packages/design-system/src/assets/icons/windows-fill.svg",
"repo_id": "owncloud",
"token_count": 187
} | 810 |
<template>
<oc-avatar-item
:width="width"
:icon-size="iconSize"
icon="cloud"
icon-fill-type="line"
icon-color="#5AAB9F"
:name="name"
:accessible-label="accessibleLabel"
/>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
import OcAvatarItem from '../OcAvatarItem/OcAvatarItem.vue'
export default defineComponent({
name: 'OcAvatarFederated',
status: 'ready',
release: '10.0.0',
components: { OcAvatarItem },
props: {
/**
* Name of the federated share used as an accessible label
*/
name: {
type: String,
required: true
},
/**
* Accessibility label used as alt. Use only in case the avatar is used alone.
* In case the avatar is used next to username or display name leave empty.
* If not specified, avatar will get `aria-hidden="true"`.
**/
accessibleLabel: {
type: String,
required: false,
default: ''
},
/**
* Describes the width of the avatar
*/
width: {
type: Number,
required: false,
default: 30
},
/**
* Describes the size of the avatar icon e.g.(small)
*/
iconSize: {
type: String,
required: false,
default: 'small'
}
}
})
</script>
<docs>
```js
<oc-avatar-federated name="Federated" accessible-label="Federated" />
```
</docs>
| owncloud/web/packages/design-system/src/components/OcAvatarFederated/OcAvatarFederated.vue/0 | {
"file_path": "owncloud/web/packages/design-system/src/components/OcAvatarFederated/OcAvatarFederated.vue",
"repo_id": "owncloud",
"token_count": 562
} | 811 |
<template>
<span @click="$emit('click', $event)">
<input
:id="id"
v-model="model"
type="checkbox"
name="checkbox"
:class="classes"
:value="option"
:disabled="disabled"
@keydown.enter="$emit('click', $event)"
/>
<label :for="id" :class="labelClasses" v-text="label" />
</span>
</template>
<script lang="ts">
import { defineComponent, PropType } from 'vue'
import { isEqual } from 'lodash-es'
import { getSizeClass } from '../../utils/sizeClasses'
import uniqueId from '../../utils/uniqueId'
/**
* A checkbox input element. The checkbox is either checked or unchecked.
*/
export default defineComponent({
name: 'OcCheckbox',
status: 'ready',
release: '1.0.0',
props: {
/**
* Id for the checkbox. If it's empty, a generated one will be used.
*/
id: {
type: String,
required: false,
default: () => uniqueId('oc-checkbox-')
},
/**
* Disables the checkbox
*/
disabled: {
type: Boolean,
default: false
},
/**
* The model of the checkbox. It determines, based on the option this checkbox represents, whether or not this
* checkbox is checked. Provide it as value or bind it with v-model.
*
* Can be any type, but most common is boolean for singular checkbox use, or array when used in a group of checkboxes.
**/
// eslint-disable-next-line vue/require-prop-types
modelValue: {
type: [Boolean, Array] as PropType<boolean | unknown[]>,
required: false,
default: false
},
/**
* The value/object this checkbox represents.
*
* Can be of any type. If `value` is an array, the type of the option needs to match the value item types. If the
* checkbox is used standalone (not in a group on a shared model) the option can be omitted.
**/
// eslint-disable-next-line vue/require-prop-types
option: {
required: false,
default: null
},
/**
* Label of the Checkbox
*
* Always required for aria-label property. If you want to hide the label, use `hideLabel` property.
**/
label: {
type: String,
required: true,
default: null
},
/**
* Is the label of the Checkbox visually hidden?
**/
hideLabel: {
type: Boolean,
required: false,
default: false
},
/**
* Size of the Checkbox. Valid values are `small`, `medium` and `large`.
* If not specified, defaults to `medium`
*/
size: {
type: String,
required: false,
default: 'medium',
validator: (size: string) => ['small', 'medium', 'large'].includes(size)
},
/**
* Show outline of checkbox
**/
outline: {
type: Boolean,
required: false,
default: false
}
},
emits: ['click', 'update:modelValue'],
computed: {
model: {
get() {
return this.modelValue
},
set: function (value) {
this.$emit('update:modelValue', value)
}
},
classes() {
return [
'oc-checkbox',
'oc-rounded',
'oc-checkbox-' + getSizeClass(this.size),
{ 'oc-checkbox-outline': this.outline },
{ 'oc-checkbox-checked': this.isChecked }
]
},
labelClasses() {
return {
'oc-invisible-sr': this.hideLabel,
'oc-cursor-pointer': !this.disabled
}
},
isChecked() {
if (typeof this.model === 'boolean') {
return this.model
}
return this.model.some((m) => isEqual(m, this.option))
}
}
})
</script>
<style lang="scss">
@mixin oc-form-check-size($factor) {
height: $oc-size-form-check-default * $factor;
width: $oc-size-form-check-default * $factor;
}
.oc-checkbox {
@include oc-form-check-size(1);
-webkit-appearance: none;
-moz-appearance: none;
background-position: 50% 50% !important;
background-repeat: no-repeat !important;
border: 2px solid var(--oc-color-input-border);
display: inline-block;
overflow: hidden;
vertical-align: middle;
background-color: transparent;
outline: none;
&-outline {
outline: solid 2px var(--oc-color-swatch-passive-default);
}
&-s {
@include oc-form-check-size(0.7);
}
&-m {
@include oc-form-check-size(1);
}
&-l {
@include oc-form-check-size(1.5);
}
&:hover {
cursor: pointer;
}
&:focus-visible {
outline: var(--oc-color-swatch-primary-default) auto 1px;
}
&-checked,
:checked,
&:indeterminate {
background-color: white;
}
&-checked,
:checked {
@include svg-fill($internal-form-checkbox-image, '#000', '#000');
}
&:indeterminate {
@include svg-fill($internal-form-checkbox-indeterminate-image, '#000', '#000');
}
&:disabled {
background-color: $form-radio-disabled-background;
}
&:disabled:checked {
@include svg-fill($internal-form-checkbox-image, '#000', $form-radio-disabled-icon-color);
}
&:disabled:indeterminate {
@include svg-fill(
$internal-form-checkbox-indeterminate-image,
'#000',
$form-radio-disabled-icon-color
);
}
}
label > .oc-checkbox + span {
margin-left: var(--oc-space-xsmall);
}
</style>
<docs>
```js
<template>
<section>
<h3 class="oc-heading-divider oc-mt-s">
Checkboxes Types
</h3>
<div class="oc-mb-s">
<oc-checkbox size="small" label="Small checkbox" aria-label="Small checkbox"/>
</div>
<div class="oc-mb-s">
<oc-checkbox :value="true" label="Medium checkbox (default)"/>
</div>
<div>
<oc-checkbox size="large" label="Large checkbox" />
</div>
</section>
</template>
```
```js
<template>
<section>
<h3 class="oc-heading-divider oc-mt-s">
Checkbox group with array model
</h3>
<div class="oc-mb-s">
<oc-checkbox
v-for="o in availableOptions"
:key="'option-' + o"
v-model="selectedOptions"
:option="o"
:label="o"
class="oc-mr-s"
/>
</div>
Selected option: {{ selectedOptions || "None" }}
</section>
</template>
<script>
export default {
data: () => ({
availableOptions: ["Water", "Wine", "Beer"],
selectedOptions: []
})
}
</script>
```
</docs>
| owncloud/web/packages/design-system/src/components/OcCheckbox/OcCheckbox.vue/0 | {
"file_path": "owncloud/web/packages/design-system/src/components/OcCheckbox/OcCheckbox.vue",
"repo_id": "owncloud",
"token_count": 2631
} | 812 |
<template>
<span
:id="id"
class="oc-invisible-sr oc-hidden-announcer"
:aria-live="level"
aria-atomic="true"
v-text="announcement"
/>
</template>
<script lang="ts">
import { defineComponent, PropType, HTMLAttributes } from 'vue'
/**
* Live regions for screen reader announcements
*
* ## Accessibility
*
* Screen reader software detect **dynamic** changes in regions registered as live regions (elements with attributes like `aria-live="polite"`, `aria-live="assertive"`). So when using this component or live regions in general make sure that the region already exists in the DOM and assistive technology can subscribe to its changes. [MDN explainer](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions):
*
* > Using JavaScript, it is possible to dynamically change parts of a page without requiring the entire page to reload — for instance, to update a list of search results on the fly, or to display a discreet alert or notification which does not require user interaction. While these changes are usually visually apparent to users who can see the page, they may not be obvious to users of assistive technologies. ARIA live regions fill this gap and provide a way to programmatically expose dynamic content changes in a way that can be announced by assistive technologies.
*
* ## Debugging
*
* Debug live regions without starting a screen reader using [NerdeRegion](https://chrome.google.com/webstore/detail/nerderegion/lkcampbojgmgobcfinlkgkodlnlpjieb).
*/
export default defineComponent({
name: 'OcHiddenAnnouncer',
status: 'ready',
release: '1.0.0',
props: {
/**
* `polite` adds the announcement to the screen reader speech queue at the end, `assertive` forces it to output directly, `off` disables the live region
**/
level: {
type: String as PropType<HTMLAttributes['aria-live']>,
required: false,
default: 'polite',
validator: (value: string) => {
return ['polite', 'assertive', 'off'].includes(value)
}
},
/**
* The announcement text itself.
**/
announcement: {
type: String,
required: true
}
},
data() {
return {
// Generate id for compatibility reasons
id: Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15)
}
}
})
</script>
<docs>
```js
<template>
<div>
<h3 class="oc-heading-divider">
Hidden announcer (please inspect element)
</h3>
<button @click="announce">Announce</button>
<oc-hidden-announcer level="polite" :announcement="announcement" />
</div>
</template>
<script>
export default {
data: () => {
return {
announcement: '',
announcementOnComplete: 'Upload has finished'
}
},
methods: {
announce() {
this.announcement = this.announcementOnComplete
}
}
}
</script>
```
</docs>
| owncloud/web/packages/design-system/src/components/OcHiddenAnnouncer/OcHiddenAnnouncer.vue/0 | {
"file_path": "owncloud/web/packages/design-system/src/components/OcHiddenAnnouncer/OcHiddenAnnouncer.vue",
"repo_id": "owncloud",
"token_count": 983
} | 813 |
<template>
<div
class="oc-fade-in oc-flex oc-flex-wrap oc-notification-message oc-box-shadow-medium oc-rounded oc-p-m"
:class="classes"
>
<div class="oc-flex oc-flex-wrap oc-flex-middle oc-flex-1" :role="role" :aria-live="ariaLive">
<div class="oc-flex oc-flex-middle oc-flex-between oc-width-1-1">
<div class="oc-flex oc-flex-middle">
<oc-icon :variation="iconVariation" name="information" fill-type="line" class="oc-mr-s" />
<div class="oc-notification-message-title">
{{ title }}
</div>
</div>
<oc-button appearance="raw" :aria-label="$gettext('Close')" @click="close"
><oc-icon name="close"
/></oc-button>
</div>
<div v-if="message || errorLogContent" class="oc-flex oc-flex-between oc-width-1-1 oc-mt-s">
<span
v-if="message"
class="oc-notification-message-content oc-text-muted oc-mr-s"
v-text="message"
/>
<oc-button
v-if="errorLogContent"
class="oc-notification-message-error-log-toggle-button"
gap-size="none"
appearance="raw"
@click="showErrorLog = !showErrorLog"
>
<span v-text="$gettext('Details')"></span>
<oc-icon :name="showErrorLog ? 'arrow-up-s' : 'arrow-down-s'" />
</oc-button>
</div>
<oc-error-log v-if="showErrorLog" class="oc-mt-m" :content="errorLogContent" />
</div>
</div>
</template>
<script lang="ts">
import { defineComponent, ref } from 'vue'
import OcIcon from '../OcIcon/OcIcon.vue'
import OcButton from '../OcButton/OcButton.vue'
import OcErrorLog from '../OcErrorLog/OcErrorLog.vue'
/**
* Notifications are used to inform users about errors, warnings and as confirmations for their actions.
*/
export default defineComponent({
name: 'OcNotificationMessage',
status: 'ready',
release: '1.0.0',
components: {
OcErrorLog,
OcIcon,
OcButton
},
props: {
/**
* Notification messages are sub components of the oc-notifications component.
* Messages can have one of the five states: `passive, primary, success, warning and danger`
*
* The status defines the color of the notification.
*/
status: {
type: String,
required: false,
default: 'passive',
validator: (value: string) => {
return ['passive', 'primary', 'success', 'warning', 'danger'].includes(value)
}
},
/**
* The title that will be displayed in notification
*/
title: {
type: String,
required: true
},
/**
* The message that will be displayed in notification
*/
message: {
type: String,
required: false,
default: null
},
/**
* The error log content that will be displayed in notification
*/
errorLogContent: {
type: String,
required: false,
default: null
},
/**
* Number of seconds the message shows. It will disappear after this time.
* If set to 0, message won't disappear automatically.
*/
timeout: {
type: Number,
required: false,
default: 5,
validator: (value: number) => value > 0
}
},
emits: ['close'],
setup: function () {
const showErrorLog = ref(false)
return {
showErrorLog
}
},
computed: {
classes() {
return `oc-notification-message-${this.status}`
},
iconVariation() {
return this.status
},
isStatusDanger() {
return this.status === 'danger'
},
role() {
return this.isStatusDanger ? 'alert' : 'status'
},
ariaLive() {
return this.isStatusDanger ? 'assertive' : 'polite'
}
},
mounted() {
/**
* Notification will be destroyed if timeout is set
*/
if (this.timeout !== 0) {
setTimeout(() => {
this.close()
}, this.timeout * 1000)
}
},
methods: {
close() {
/**
* The close event is emitted when the user clicks the close icon.
* @type {void}
*/
this.$emit('close')
}
}
})
</script>
<style lang="scss">
.oc-notification-message {
background-color: var(--oc-color-background-default) !important;
margin-top: var(--oc-space-small);
position: relative;
word-break: break-word;
&-title {
font-size: 1.15rem;
}
&-error-log-toggle-button {
word-break: keep-all;
}
}
</style>
<docs>
Please have a look at the component [OcNotifications](#/oC%20Components/OcNotifications) for example code.
</docs>
| owncloud/web/packages/design-system/src/components/OcNotificationMessage/OcNotificationMessage.vue/0 | {
"file_path": "owncloud/web/packages/design-system/src/components/OcNotificationMessage/OcNotificationMessage.vue",
"repo_id": "owncloud",
"token_count": 1942
} | 814 |
import { defaultPlugins, mount, shallowMount } from 'web-test-helpers'
import OcSearchBar from './OcSearchBar.vue'
describe('OcSearchBar', () => {
const selectors = {
searchButton: '.oc-search-button',
searchInput: '.oc-search-input',
searchButtonWrapper: '.oc-search-button-wrapper',
searchClearButton: '.oc-search-clear'
}
describe('search grid role', () => {
it('should be undefined if filter is enabled', () => {
const wrapper = getWrapper({ isFilter: true })
expect(wrapper.attributes('role')).toBe(undefined)
})
it('should be search if filter is disabled', () => {
const wrapper = getWrapper()
expect(wrapper.attributes('role')).toBe('search')
})
})
describe('small prop', () => {
describe('when small is true', () => {
const wrapper = getWrapper({ small: true })
it('should set small search button', () => {
expect(wrapper.find(selectors.searchButton).attributes('size')).toBe('small')
})
it('should set small search grid', () => {
expect(wrapper.attributes('class')).toContain('oc-search-small')
})
it('should set spinner size as xsmall', () => {
const spinnerStub = wrapper.find('oc-spinner-stub')
expect(spinnerStub.attributes('size')).toBe('xsmall')
})
})
it('should set medium search grid and search button if not enabled', () => {
const wrapper = getWrapper({ small: false })
expect(wrapper.attributes('class')).not.toContain('oc-search-small')
expect(wrapper.find(selectors.searchButton).attributes('size')).toBe('medium')
})
})
describe('icon prop', () => {
describe('when icon prop is not false', () => {
const wrapper = getWrapper({ icon: 'mdi-icon' })
it('should render icon', () => {
const iconStub = wrapper.find('oc-icon-stub[name="mdi-icon"]')
expect(iconStub.exists()).toBeTruthy()
expect(iconStub.attributes('name')).toBe('mdi-icon')
})
})
it('should not render icon if false', () => {
const wrapper = getWrapper({ icon: false })
const iconStub = wrapper.find('.oc-search-icon')
expect(iconStub.exists()).toBeFalsy()
})
})
describe('loading prop', () => {
describe('when loading', () => {
const wrapper = getWrapper({ icon: 'mdi-icon', loading: true })
it('should show spinner', () => {
const spinnerStub = wrapper.find('oc-spinner-stub')
expect(spinnerStub.exists()).toBeTruthy()
expect(spinnerStub.attributes('style')).not.toBe('display: none;')
})
it('should not show icon if loading', () => {
const iconStub = wrapper.find('oc-icon-stub')
expect(iconStub.exists()).toBeTruthy()
expect(iconStub.attributes('style')).toBe('display: none;')
})
it('should set search input as disabled', () => {
const searchInput = wrapper.find(selectors.searchInput)
expect(searchInput.attributes('disabled')).toBe('')
})
it('should set search button as disabled', () => {
const wrapper = getWrapper({ icon: 'mdi-icon', loading: true, value: 'kiran' })
const searchInput = wrapper.find(selectors.searchButton)
expect(searchInput.attributes('disabled')).toBe('true')
})
})
describe('when not loading', () => {
const wrapper = getWrapper({ icon: 'mdi-icon', loading: false })
it('should not show spinner', () => {
const spinnerStub = wrapper.find('oc-spinner-stub')
expect(spinnerStub.exists()).toBeTruthy()
expect(spinnerStub.attributes('style')).toBe('display: none;')
})
it('should enable search input', () => {
const searchInput = wrapper.find(selectors.searchInput)
expect(searchInput.attributes('disabled')).toBe(undefined)
})
it('should enable search button', async () => {
await wrapper.find(selectors.searchInput).setValue('a') // search query should also be not null
expect(wrapper.find(selectors.searchButton).attributes('disabled')).toBe('false')
})
})
})
describe('button label prop', () => {
it('should set the provided button label on search button', () => {
const wrapper = getWrapper({ buttonLabel: 'Search Elastic' })
expect(wrapper.find(selectors.searchButton).text()).toBe('Search Elastic')
})
})
describe('button hidden prop', () => {
it('should add invisible class to search button if enabled', () => {
const wrapper = getWrapper({ buttonHidden: true })
const searchButtonWrapper = wrapper.find(selectors.searchButtonWrapper)
expect(searchButtonWrapper.attributes('class')).toContain('oc-invisible-sr')
})
it('should add button class to input if disabled', () => {
const wrapper = getWrapper({ buttonHidden: false })
const searchInput = wrapper.find(selectors.searchInput)
expect(searchInput.attributes('class')).toContain('oc-search-input-button')
})
})
describe('aria-label for the loading spinner', () => {
it('should add provided loading accessible label', () => {
const wrapper = getWrapper({ loadingAccessibleLabel: 'Spinner is spinning' })
const spinnerEl = wrapper.find('oc-spinner-stub')
expect(spinnerEl.attributes('arialabel')).toBe('Spinner is spinning')
})
it('should add loading accessible label if not provided', () => {
const wrapper = getWrapper()
const spinnerEl = wrapper.find('oc-spinner-stub')
expect(spinnerEl.attributes('arialabel')).toBe('Loading results')
})
})
describe('search input', () => {
it('should set provided label as input aria label', () => {
const wrapper = getWrapper()
const searchInput = wrapper.find(selectors.searchInput)
expect(searchInput.attributes('aria-label')).toBe('Test search label')
})
it('should set provided placeholder as input placeholder', () => {
const wrapper = getWrapper({ placeholder: 'Start typing..' })
const searchInput = wrapper.find(selectors.searchInput)
expect(searchInput.attributes('placeholder')).toBe('Start typing..')
})
it('should emit input event on typing', async () => {
const wrapper = getWrapper()
const searchInput = wrapper.find(selectors.searchInput)
expect(wrapper.emitted('input')).toBeFalsy()
await searchInput.setValue('abc')
expect(wrapper.emitted('input')).toBeTruthy()
})
})
describe('type ahead prop', () => {
it('the search event is triggered on each entered character if enabled', async () => {
const wrapper = getWrapper({ typeAhead: true })
const searchInput = wrapper.find(selectors.searchInput)
expect(wrapper.emitted('input')).toBeFalsy()
expect(wrapper.emitted('search')).toBeFalsy()
await searchInput.setValue('a')
expect(wrapper.emitted('input')).toBeTruthy()
expect(wrapper.emitted('search')).toBeTruthy()
})
it('the search event is not triggered on each entered character if disabled', async () => {
const wrapper = getWrapper({ typeAhead: false })
const searchInput = wrapper.find(selectors.searchInput)
expect(wrapper.emitted('input')).toBeFalsy()
expect(wrapper.emitted('search')).toBeFalsy()
await searchInput.setValue('a')
expect(wrapper.emitted('input')).toBeTruthy()
expect(wrapper.emitted('search')).toBeFalsy()
})
})
describe('when search button is clicked', () => {
it('should emit search event if search query is not null', async () => {
const wrapper = getMountedWrapper()
const searchInput = wrapper.find(selectors.searchInput)
await searchInput.setValue('a')
expect(wrapper.emitted('search')).toBeFalsy()
const searchButton = wrapper.find(selectors.searchButton)
await searchButton.trigger('click')
expect(wrapper.emitted('search')).toBeTruthy()
})
it('should not emit search event if search query is null', async () => {
const wrapper = getMountedWrapper()
expect(wrapper.emitted('search')).toBeFalsy()
const searchButton = wrapper.find(selectors.searchButton)
await searchButton.trigger('click')
expect(wrapper.emitted('search')).toBeFalsy()
})
})
})
function getWrapper(props = {}) {
return shallowMount(OcSearchBar, {
props: {
...props,
label: 'Test search label'
},
global: {
renderStubDefaultSlot: true,
plugins: [...defaultPlugins()]
}
})
}
function getMountedWrapper() {
return mount(OcSearchBar, {
props: { label: 'abc' },
global: {
plugins: [...defaultPlugins()]
}
})
}
| owncloud/web/packages/design-system/src/components/OcSearchBar/OcSearchBar.spec.ts/0 | {
"file_path": "owncloud/web/packages/design-system/src/components/OcSearchBar/OcSearchBar.spec.ts",
"repo_id": "owncloud",
"token_count": 3165
} | 815 |
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`OcTag > uses correct component when type is specified 1`] = `
"<button class="oc-tag oc-tag-m oc-tag-button">
<!-- @slot Content of the tag -->
</button>"
`;
| owncloud/web/packages/design-system/src/components/OcTag/__snapshots__/OcTag.spec.ts.snap/0 | {
"file_path": "owncloud/web/packages/design-system/src/components/OcTag/__snapshots__/OcTag.spec.ts.snap",
"repo_id": "owncloud",
"token_count": 84
} | 816 |
<template>
<oc-table-cell
type="td"
:align-h="alignH"
:align-v="alignV"
:width="width"
:wrap="wrap"
class="oc-td"
>
<slot />
</oc-table-cell>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
import OcTableCell from '../_OcTableCell/_OcTableCell.vue'
export default defineComponent({
name: 'OcTd',
status: 'ready',
release: '2.1.0',
components: { OcTableCell },
props: {
alignH: {
type: String,
default: 'left',
validator: (alignment: string) => ['left', 'center', 'right'].includes(alignment)
},
alignV: {
type: String,
default: 'middle',
validator: (alignment: string) => ['top', 'middle', 'bottom'].includes(alignment)
},
width: {
type: String,
default: 'auto',
validator: (width: string) => ['auto', 'shrink', 'expand'].includes(width)
},
wrap: {
type: String,
default: null,
validator: (wrap: string) => ['break', 'nowrap', 'truncate'].includes(wrap) || !wrap
}
}
})
</script>
| owncloud/web/packages/design-system/src/components/_OcTableCellData/_OcTableCellData.vue/0 | {
"file_path": "owncloud/web/packages/design-system/src/components/_OcTableCellData/_OcTableCellData.vue",
"repo_id": "owncloud",
"token_count": 456
} | 817 |
export * from './colors'
export * from './constants'
export * from './types'
| owncloud/web/packages/design-system/src/helpers/index.ts/0 | {
"file_path": "owncloud/web/packages/design-system/src/helpers/index.ts",
"repo_id": "owncloud",
"token_count": 26
} | 818 |
[class*="oc-float-"] {
max-width: 100%;
}
.oc-float-left {
float: left;
}
.oc-float-right {
float: right;
}
[class*="oc-position-center-left"],
[class*="oc-position-center-right"] {
top: 50%;
transform: translateY(-50%);
}
[class*="oc-position-bottom"],
[class*="oc-position-center"],
[class*="oc-position-left"],
[class*="oc-position-right"],
[class*="oc-position-top"] {
max-width: 100%;
position: absolute !important;
}
.oc-position-absolute {
position: absolute !important;
}
.oc-position-relative {
position: relative !important;
}
.oc-position-medium {
margin: 30px 0;
max-width: calc(100% - 60px);
}
.oc-position-bottom-center {
bottom: 0;
box-sizing: border-box;
left: 50%;
max-width: 100%;
transform: translateX(-50%);
}
.oc-position-cover {
bottom: 0;
left: 0;
position: absolute;
right: 0;
top: 0;
}
.oc-position-fixed {
position: fixed !important;
}
.oc-position-center {
box-sizing: border-box;
left: 50%;
max-width: 100%;
top: 50%;
transform: translate(-50%, -50%);
width: max-content;
}
.oc-position-small {
margin: 15px;
max-width: calc(100% - 30px);
}
.oc-position-center-right {
right: 0;
}
| owncloud/web/packages/design-system/src/styles/theme/oc-position.scss/0 | {
"file_path": "owncloud/web/packages/design-system/src/styles/theme/oc-position.scss",
"repo_id": "owncloud",
"token_count": 471
} | 819 |
const __logger = (v) => v
export default __logger
| owncloud/web/packages/design-system/src/utils/logger.ts/0 | {
"file_path": "owncloud/web/packages/design-system/src/utils/logger.ts",
"repo_id": "owncloud",
"token_count": 18
} | 820 |
{
"name": "@ownclouders/tsconfig",
"private": false,
"version": "0.0.4",
"license": "AGPL-3.0",
"author": "ownCloud GmbH <devops@owncloud.com>",
"homepage": "https://github.com/owncloud/web/tree/master/packages/tsconfig",
"repository": {
"type": "git",
"url": "https://github.com/owncloud/web",
"directory": "packages/tsconfig"
}
}
| owncloud/web/packages/tsconfig/package.json/0 | {
"file_path": "owncloud/web/packages/tsconfig/package.json",
"repo_id": "owncloud",
"token_count": 150
} | 821 |
<template>
<ul class="oc-list">
<li
v-for="(member, index) in groupMembers"
:key="index"
class="oc-flex oc-flex-middle oc-mb-s"
data-testid="group-members-list"
>
<oc-avatar :user-name="member.displayName" :width="36" class="oc-mr-s" />
<span>{{ member.displayName }}</span>
</li>
</ul>
</template>
<script lang="ts">
import { defineComponent, PropType } from 'vue'
import { User } from '@ownclouders/web-client/src/helpers'
export default defineComponent({
name: 'MembersRoleSection',
props: {
groupMembers: {
type: Array as PropType<User[]>,
required: false,
default: () => []
}
}
})
</script>
| owncloud/web/packages/web-app-admin-settings/src/components/Groups/SideBar/MembersRoleSection.vue/0 | {
"file_path": "owncloud/web/packages/web-app-admin-settings/src/components/Groups/SideBar/MembersRoleSection.vue",
"repo_id": "owncloud",
"token_count": 287
} | 822 |
export * from './useGeneralActionsResetLogo'
export * from './useGeneralActionsUploadLogo'
| owncloud/web/packages/web-app-admin-settings/src/composables/actions/general/index.ts/0 | {
"file_path": "owncloud/web/packages/web-app-admin-settings/src/composables/actions/general/index.ts",
"repo_id": "owncloud",
"token_count": 29
} | 823 |
export * from './actions'
export * from './stores'
| owncloud/web/packages/web-app-admin-settings/src/composables/index.ts/0 | {
"file_path": "owncloud/web/packages/web-app-admin-settings/src/composables/index.ts",
"repo_id": "owncloud",
"token_count": 16
} | 824 |
import CreateGroupModal from '../../../../src/components/Groups/CreateGroupModal.vue'
import {
defaultComponentMocks,
defaultPlugins,
mockAxiosReject,
mockAxiosResolve,
shallowMount
} from 'web-test-helpers'
import { mock } from 'vitest-mock-extended'
import { AxiosResponse } from 'axios'
import { Modal, eventBus, useMessages } from '@ownclouders/web-pkg'
import { useGroupSettingsStore } from '../../../../src/composables'
describe('CreateGroupModal', () => {
describe('computed method "isFormInvalid"', () => {
it('should be true if any data set is invalid', () => {
const { wrapper } = getWrapper()
wrapper.vm.formData.displayName.valid = false
expect(wrapper.vm.isFormInvalid).toBeTruthy()
})
it('should be false if no data set is invalid', () => {
const { wrapper } = getWrapper()
Object.keys(wrapper.vm.formData).forEach((key) => {
wrapper.vm.formData[key].valid = true
})
expect(wrapper.vm.isFormInvalid).toBeFalsy()
})
})
describe('method "validateDisplayName"', () => {
it('should be false when displayName is empty', async () => {
const { wrapper } = getWrapper()
wrapper.vm.group.displayName = ''
expect(await wrapper.vm.validateDisplayName()).toBeFalsy()
})
it('should be false when displayName is longer than 255 characters', async () => {
const { wrapper } = getWrapper()
wrapper.vm.group.displayName = 'n'.repeat(256)
expect(await wrapper.vm.validateDisplayName()).toBeFalsy()
})
it('should be false when displayName is already existing', async () => {
const { wrapper, mocks } = getWrapper()
const graphMock = mocks.$clientService.graphAuthenticated
wrapper.vm.group.displayName = 'admins'
const getGroupSub = graphMock.groups.getGroup.mockResolvedValue(
mock<AxiosResponse>({ data: { displayName: 'admins' } })
)
expect(await wrapper.vm.validateDisplayName()).toBeFalsy()
expect(getGroupSub).toHaveBeenCalled()
})
it('should be true when displayName is valid', async () => {
const { wrapper, mocks } = getWrapper()
const graphMock = mocks.$clientService.graphAuthenticated
const getGroupSub = graphMock.groups.getGroup.mockRejectedValue(() => mockAxiosReject())
wrapper.vm.group.displayName = 'users'
expect(await wrapper.vm.validateDisplayName()).toBeTruthy()
expect(getGroupSub).toHaveBeenCalled()
})
})
describe('method "onConfirm"', () => {
it('should not create group if form is invalid', async () => {
vi.spyOn(console, 'error').mockImplementation(() => undefined)
const { wrapper } = getWrapper()
const eventSpy = vi.spyOn(eventBus, 'publish')
try {
await wrapper.vm.onConfirm()
} catch (error) {}
const { showMessage } = useMessages()
expect(showMessage).not.toHaveBeenCalled()
expect(eventSpy).not.toHaveBeenCalled()
})
it('should create group on success', async () => {
const { wrapper, mocks } = getWrapper()
mocks.$clientService.graphAuthenticated.groups.getGroup.mockRejectedValueOnce(new Error(''))
wrapper.vm.group.displayName = 'foo bar'
await wrapper.vm.validateDisplayName()
mocks.$clientService.graphAuthenticated.groups.createGroup.mockResolvedValueOnce(
mockAxiosResolve({ id: 'e3515ffb-d264-4dfc-8506-6c239f6673b5' })
)
await wrapper.vm.onConfirm()
const { showMessage } = useMessages()
expect(showMessage).toHaveBeenCalled()
const { upsertGroup } = useGroupSettingsStore()
expect(upsertGroup).toHaveBeenCalled()
})
it('should show message on error', async () => {
vi.spyOn(console, 'error').mockImplementation(() => undefined)
const { wrapper, mocks } = getWrapper()
mocks.$clientService.graphAuthenticated.groups.getGroup.mockRejectedValue(new Error(''))
wrapper.vm.group.displayName = 'foo bar'
await wrapper.vm.validateDisplayName()
mocks.$clientService.graphAuthenticated.groups.createGroup.mockRejectedValue(
mockAxiosResolve({ id: 'e3515ffb-d264-4dfc-8506-6c239f6673b5' })
)
await wrapper.vm.onConfirm()
const { showErrorMessage } = useMessages()
expect(showErrorMessage).toHaveBeenCalled()
const { upsertGroup } = useGroupSettingsStore()
expect(upsertGroup).not.toHaveBeenCalled()
})
})
})
function getWrapper() {
const mocks = defaultComponentMocks()
return {
mocks,
wrapper: shallowMount(CreateGroupModal, {
props: {
modal: mock<Modal>()
},
global: {
mocks,
provide: mocks,
plugins: [...defaultPlugins()]
}
})
}
}
| owncloud/web/packages/web-app-admin-settings/tests/unit/components/Groups/CreateGroupModal.spec.ts/0 | {
"file_path": "owncloud/web/packages/web-app-admin-settings/tests/unit/components/Groups/CreateGroupModal.spec.ts",
"repo_id": "owncloud",
"token_count": 1822
} | 825 |
import CreateUserModal from '../../../../src/components/Users/CreateUserModal.vue'
import {
defaultComponentMocks,
defaultPlugins,
mockAxiosReject,
mockAxiosResolve,
shallowMount
} from 'web-test-helpers'
import { mock } from 'vitest-mock-extended'
import { AxiosResponse } from 'axios'
import { Modal, eventBus, useMessages } from '@ownclouders/web-pkg'
import { useUserSettingsStore } from '../../../../src/composables/stores/userSettings'
describe('CreateUserModal', () => {
describe('computed method "isFormInvalid"', () => {
it('should be true if any data set is invalid', () => {
const { wrapper } = getWrapper()
wrapper.vm.formData.userName.valid = false
expect(wrapper.vm.isFormInvalid).toBeTruthy()
})
})
it('should be false if no data set is invalid', () => {
const { wrapper } = getWrapper()
Object.keys(wrapper.vm.formData).forEach((key) => {
wrapper.vm.formData[key].valid = true
})
expect(wrapper.vm.isFormInvalid).toBeFalsy()
})
describe('method "validateUserName"', () => {
it('should be false when userName is empty', async () => {
const { wrapper } = getWrapper()
wrapper.vm.user.onPremisesSamAccountName = ''
expect(await wrapper.vm.validateUserName()).toBeFalsy()
})
it('should be false when userName is longer than 255 characters', async () => {
const { wrapper } = getWrapper()
wrapper.vm.user.onPremisesSamAccountName = 'n'.repeat(256)
expect(await wrapper.vm.validateUserName()).toBeFalsy()
})
it('should be false when userName contains white spaces', async () => {
const { wrapper } = getWrapper()
wrapper.vm.user.onPremisesSamAccountName = 'jan owncCloud'
expect(await wrapper.vm.validateUserName()).toBeFalsy()
})
it('should be false when userName starts with a numeric value', async () => {
const { wrapper } = getWrapper()
wrapper.vm.user.onPremisesSamAccountName = '1moretry'
expect(await wrapper.vm.validateUserName()).toBeFalsy()
})
it('should be false when userName is already existing', async () => {
const { wrapper, mocks } = getWrapper()
const graphMock = mocks.$clientService.graphAuthenticated
const getUserStub = graphMock.users.getUser.mockResolvedValue(
mock<AxiosResponse>({ data: { onPremisesSamAccountName: 'jan' } })
)
wrapper.vm.user.onPremisesSamAccountName = 'jan'
expect(await wrapper.vm.validateUserName()).toBeFalsy()
expect(getUserStub).toHaveBeenCalled()
})
it('should be true when userName is valid', async () => {
const { wrapper, mocks } = getWrapper()
const graphMock = mocks.$clientService.graphAuthenticated
const getUserStub = graphMock.users.getUser.mockRejectedValue(() => mockAxiosReject())
wrapper.vm.user.onPremisesSamAccountName = 'jana'
expect(await wrapper.vm.validateUserName()).toBeTruthy()
expect(getUserStub).toHaveBeenCalled()
})
})
describe('method "validateDisplayName"', () => {
it('should be false when displayName is empty', () => {
const { wrapper } = getWrapper()
wrapper.vm.user.displayName = ''
expect(wrapper.vm.validateDisplayName()).toBeFalsy()
})
it('should be false when displayName is longer than 255 characters', async () => {
const { wrapper } = getWrapper()
wrapper.vm.user.displayName = 'n'.repeat(256)
expect(await wrapper.vm.validateDisplayName()).toBeFalsy()
})
it('should be true when displayName is valid', () => {
const { wrapper } = getWrapper()
wrapper.vm.user.displayName = 'jana'
expect(wrapper.vm.validateDisplayName()).toBeTruthy()
})
})
describe('method "validateEmail"', () => {
it('should be false when email is invalid', () => {
const { wrapper } = getWrapper()
wrapper.vm.user.mail = 'jana@'
expect(wrapper.vm.validateEmail()).toBeFalsy()
})
it('should be true when email is valid', () => {
const { wrapper } = getWrapper()
wrapper.vm.user.mail = 'jana@owncloud.com'
expect(wrapper.vm.validateEmail()).toBeTruthy()
})
})
describe('method "validatePassword"', () => {
it('should be false when password is empty', () => {
const { wrapper } = getWrapper()
wrapper.vm.user.passwordProfile.password = ''
expect(wrapper.vm.validatePassword()).toBeFalsy()
})
it('should be true when password is valid', () => {
const { wrapper } = getWrapper()
wrapper.vm.user.passwordProfile.password = 'asecret'
expect(wrapper.vm.validatePassword()).toBeTruthy()
})
})
describe('method "onConfirm"', () => {
it('should not create user if form is invalid', async () => {
vi.spyOn(console, 'error').mockImplementation(() => undefined)
const { wrapper } = getWrapper()
const eventSpy = vi.spyOn(eventBus, 'publish')
try {
await wrapper.vm.onConfirm()
} catch (error) {}
const { showMessage } = useMessages()
expect(showMessage).not.toHaveBeenCalled()
expect(eventSpy).not.toHaveBeenCalled()
})
it('should create user on success', async () => {
const { wrapper, mocks } = getWrapper()
mocks.$clientService.graphAuthenticated.users.getUser.mockRejectedValueOnce(new Error(''))
wrapper.vm.user.onPremisesSamAccountName = 'foo'
await wrapper.vm.validateUserName()
wrapper.vm.user.displayName = 'foo bar'
wrapper.vm.validateDisplayName()
wrapper.vm.user.mail = 'foo@bar.com'
wrapper.vm.validateEmail()
wrapper.vm.user.passwordProfile.password = 'asecret'
wrapper.vm.validatePassword()
mocks.$clientService.graphAuthenticated.users.createUser.mockResolvedValue(
mockAxiosResolve({ id: 'e3515ffb-d264-4dfc-8506-6c239f6673b5' })
)
mocks.$clientService.graphAuthenticated.users.getUser.mockResolvedValueOnce(
mockAxiosResolve({ id: 'e3515ffb-d264-4dfc-8506-6c239f6673b5' })
)
await wrapper.vm.onConfirm()
const { upsertUser } = useUserSettingsStore()
expect(upsertUser).toHaveBeenCalled()
const { showMessage } = useMessages()
expect(showMessage).toHaveBeenCalled()
})
it('should show message on error', async () => {
vi.spyOn(console, 'error').mockImplementation(() => undefined)
const { wrapper, mocks } = getWrapper()
mocks.$clientService.graphAuthenticated.users.getUser.mockRejectedValue(new Error(''))
wrapper.vm.user.onPremisesSamAccountName = 'foo'
await wrapper.vm.validateUserName()
wrapper.vm.user.displayName = 'foo bar'
wrapper.vm.validateDisplayName()
wrapper.vm.user.mail = 'foo@bar.com'
wrapper.vm.validateEmail()
wrapper.vm.user.passwordProfile.password = 'asecret'
wrapper.vm.validatePassword()
mocks.$clientService.graphAuthenticated.users.createUser.mockResolvedValue(
mockAxiosResolve({ id: 'e3515ffb-d264-4dfc-8506-6c239f6673b5' })
)
const eventSpy = vi.spyOn(eventBus, 'publish')
await wrapper.vm.onConfirm()
const { showErrorMessage } = useMessages()
expect(showErrorMessage).toHaveBeenCalled()
expect(eventSpy).not.toHaveBeenCalled()
})
})
})
function getWrapper() {
const mocks = defaultComponentMocks()
return {
mocks,
wrapper: shallowMount(CreateUserModal, {
props: {
modal: mock<Modal>()
},
global: {
mocks,
provide: mocks,
plugins: [...defaultPlugins()]
}
})
}
}
| owncloud/web/packages/web-app-admin-settings/tests/unit/components/Users/CreateUserModal.spec.ts/0 | {
"file_path": "owncloud/web/packages/web-app-admin-settings/tests/unit/components/Users/CreateUserModal.spec.ts",
"repo_id": "owncloud",
"token_count": 2937
} | 826 |
import { useCapabilityStore, useModals } from '@ownclouders/web-pkg'
import { useUserActionsCreateUser } from '../../../../../src/composables/actions/users/useUserActionsCreateUser'
import { unref } from 'vue'
import { getComposableWrapper, writable } from 'web-test-helpers'
describe('useUserActionsCreateUser', () => {
describe('method "isVisible"', () => {
it.each([true, false])(
'is enabled based on the capability',
(capabilityCreateUsersDisabled) => {
getWrapper({
setup: ({ actions }) => {
const capabilityStore = useCapabilityStore()
writable(capabilityStore).graphUsersCreateDisabled = capabilityCreateUsersDisabled
expect(unref(actions)[0].isVisible()).toEqual(!capabilityCreateUsersDisabled)
}
})
}
)
})
describe('method "handler"', () => {
it('creates a modal', () => {
getWrapper({
setup: async ({ actions }) => {
const { dispatchModal } = useModals()
await unref(actions)[0].handler()
expect(dispatchModal).toHaveBeenCalled()
}
})
})
})
})
function getWrapper({
setup
}: {
setup: (instance: ReturnType<typeof useUserActionsCreateUser>) => void
}) {
return {
wrapper: getComposableWrapper(() => {
const instance = useUserActionsCreateUser()
setup(instance)
})
}
}
| owncloud/web/packages/web-app-admin-settings/tests/unit/composables/actions/users/useUserActionsCreateUser.spec.ts/0 | {
"file_path": "owncloud/web/packages/web-app-admin-settings/tests/unit/composables/actions/users/useUserActionsCreateUser.spec.ts",
"repo_id": "owncloud",
"token_count": 552
} | 827 |
{
"name": "draw-io",
"version": "0.0.0",
"private": true,
"description": "ownCloud web draw.io integration",
"license": "AGPL-3.0",
"devDependencies": {
"web-test-helpers": "workspace:*"
},
"peerDependencies": {
"@ownclouders/web-client": "workspace:*",
"@ownclouders/web-pkg": "workspace:*",
"luxon": "3.2.1"
}
}
| owncloud/web/packages/web-app-draw-io/package.json/0 | {
"file_path": "owncloud/web/packages/web-app-draw-io/package.json",
"repo_id": "owncloud",
"token_count": 155
} | 828 |
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`The app provider extension > should be able to load an iFrame via get 1`] = `
"<iframe src="https://example.test/d12ab86/loe009157-MzBw" class="oc-width-1-1 oc-height-1-1" title="" example-app" app content area" allowfullscreen=""></iframe>
<!--v-if-->"
`;
exports[`The app provider extension > should be able to load an iFrame via post 1`] = `
"<!--v-if-->
<div class="oc-height-1-1 oc-width-1-1">
<form action="https://example.test/d12ab86/loe009157-MzBw" target="app-iframe" method="post"><input type="submit" class="oc-hidden" value="[object Object]">
<div><input name="access_token" type="hidden" value="asdfsadfsadf"></div>
<div><input name="access_token_ttl" type="hidden" value="123456"></div>
</form> <iframe name="app-iframe" class="oc-width-1-1 oc-height-1-1" title="" example-app" app content area" allowfullscreen=""></iframe>
</div>"
`;
exports[`The app provider extension > should fail for unauthenticated users 1`] = `
"<!--v-if-->
<!--v-if-->"
`;
| owncloud/web/packages/web-app-external/tests/unit/__snapshots__/app.spec.ts.snap/0 | {
"file_path": "owncloud/web/packages/web-app-external/tests/unit/__snapshots__/app.spec.ts.snap",
"repo_id": "owncloud",
"token_count": 388
} | 829 |
<template>
<div class="resource-details oc-flex oc-flex-column oc-flex-middle">
<div class="oc-width-1-3@l oc-width-1-2@m oc-width-3-4">
<file-info />
<file-details class="oc-mb" />
<file-actions />
</div>
</div>
</template>
<script lang="ts">
import { computed, defineComponent, PropType, unref } from 'vue'
import { Resource, SpaceResource } from '@ownclouders/web-client/src/helpers'
import FileActions from '../SideBar/Actions/FileActions.vue'
import FileDetails from '../SideBar/Details/FileDetails.vue'
import { useFileActions, FileInfo } from '@ownclouders/web-pkg'
import { useRouteQuery } from '@ownclouders/web-pkg'
export default defineComponent({
components: {
FileActions,
FileDetails,
FileInfo
},
provide() {
return {
resource: computed(() => this.singleResource),
space: computed(() => this.space)
}
},
props: {
singleResource: {
type: Object as PropType<Resource>,
required: false,
default: null
},
space: {
type: Object as PropType<SpaceResource>,
required: false,
default: null
}
},
setup(props) {
const { getDefaultEditorAction } = useFileActions()
const openWithDefaultAppQuery = useRouteQuery('openWithDefaultApp')
const fileActionsOptions = {
resources: [props.singleResource],
space: props.space
}
const defaultEditorAction = getDefaultEditorAction(fileActionsOptions)
if (unref(openWithDefaultAppQuery) === 'true' && defaultEditorAction) {
defaultEditorAction.handler({ ...fileActionsOptions })
}
return {
defaultEditorAction
}
}
})
</script>
| owncloud/web/packages/web-app-files/src/components/FilesList/ResourceDetails.vue/0 | {
"file_path": "owncloud/web/packages/web-app-files/src/components/FilesList/ResourceDetails.vue",
"repo_id": "owncloud",
"token_count": 625
} | 830 |
<template>
<oc-recipient
:data-testid="`recipient-container-${formattedRecipient.name}`"
class="files-share-invite-recipient"
:recipient="formattedRecipient"
>
<template #append>
<oc-button
class="files-share-invite-recipient-btn-remove"
appearance="raw"
:aria-label="btnDeselectRecipientLabel"
@click.stop="deselect(recipient)"
>
<oc-icon name="close" size="small" />
</oc-button>
</template>
</oc-recipient>
</template>
<script lang="ts">
import { avatarUrl } from '../../../../../helpers/user'
import { CollaboratorAutoCompleteItem, ShareTypes } from '@ownclouders/web-client/src/helpers/share'
import { defineComponent, PropType } from 'vue'
import { Recipient } from 'design-system/src/components/OcRecipient/types'
import { useCapabilityStore, useConfigStore } from '@ownclouders/web-pkg'
import { storeToRefs } from 'pinia'
export default defineComponent({
props: {
recipient: {
type: Object as PropType<CollaboratorAutoCompleteItem>,
required: true
},
deselect: {
type: Function,
required: false,
default: null
}
},
setup() {
const capabilityStore = useCapabilityStore()
const capabilityRefs = storeToRefs(capabilityStore)
const configStore = useConfigStore()
const { serverUrl } = storeToRefs(configStore)
return {
serverUrl,
userProfilePicture: capabilityRefs.sharingUserProfilePicture
}
},
data(): { formattedRecipient: Recipient } {
return {
formattedRecipient: {
name: this.recipient.displayName,
icon: this.getRecipientIcon(),
hasAvatar: [ShareTypes.user.value, ShareTypes.spaceUser.value].includes(
this.recipient.shareType
),
isLoadingAvatar: true
}
}
},
computed: {
btnDeselectRecipientLabel() {
return this.$gettext('Deselect %{name}', { name: this.recipient.displayName })
}
},
async created() {
if (this.userProfilePicture && this.formattedRecipient.hasAvatar) {
try {
this.formattedRecipient.avatar = await avatarUrl({
clientService: this.$clientService,
server: this.serverUrl,
username: this.recipient.displayName
})
} catch (error) {
console.error(error)
}
}
this.formattedRecipient.isLoadingAvatar = false
},
methods: {
getRecipientIcon() {
switch (this.recipient.shareType) {
case ShareTypes.group.value:
return {
name: ShareTypes.group.icon,
label: this.$gettext('Group')
}
case ShareTypes.guest.value:
return {
name: ShareTypes.guest.icon,
label: this.$gettext('Guest user')
}
case ShareTypes.remote.value:
return {
name: ShareTypes.remote.icon,
label: this.$gettext('Remote user')
}
default:
return {
name: ShareTypes.user.icon,
label: this.$gettext('User')
}
}
}
}
})
</script>
<style lang="scss">
.files-share-invite-recipient {
margin: 4px 2px 0;
padding: 0 0.25em;
overflow-wrap: anywhere;
.oc-recipient-avatar {
min-width: 16.8px;
}
}
</style>
| owncloud/web/packages/web-app-files/src/components/SideBar/Shares/Collaborators/InviteCollaborator/RecipientContainer.vue/0 | {
"file_path": "owncloud/web/packages/web-app-files/src/components/SideBar/Shares/Collaborators/InviteCollaborator/RecipientContainer.vue",
"repo_id": "owncloud",
"token_count": 1404
} | 831 |
export * from './spaces'
| owncloud/web/packages/web-app-files/src/composables/actions/index.ts/0 | {
"file_path": "owncloud/web/packages/web-app-files/src/composables/actions/index.ts",
"repo_id": "owncloud",
"token_count": 9
} | 832 |
import { Language } from 'vue3-gettext'
import { Resource } from '@ownclouders/web-client'
import { extractExtensionFromFile } from '@ownclouders/web-client/src/helpers'
import {
ConflictDialog,
ResolveConflict,
resolveFileNameDuplicate,
ResolveStrategy,
ResourcesStore,
UppyResource
} from '@ownclouders/web-pkg'
interface ConflictedResource {
name: string
type: string
}
export class ResourceConflict extends ConflictDialog {
resourcesStore: ResourcesStore
constructor(resourcesStore: ResourcesStore, language: Language) {
const { $gettext, $ngettext } = language
super($gettext, $ngettext)
this.resourcesStore = resourcesStore
}
getConflicts(files: UppyResource[]): ConflictedResource[] {
const conflicts: ConflictedResource[] = []
for (const file of files) {
const relativeFilePath = file.meta.relativePath
if (relativeFilePath) {
// Logic for folders, applies to all files inside folder and subfolders
const rootFolder = relativeFilePath.replace(/^\/+/, '').split('/')[0]
const exists = this.resourcesStore.resources.find((f) => f.name === rootFolder)
if (exists) {
if (conflicts.some((conflict) => conflict.name === rootFolder)) {
continue
}
conflicts.push({ name: rootFolder, type: 'folder' })
continue
}
}
// Logic for files
const exists = this.resourcesStore.resources.find(
(f) => f.name === file.name && !file.meta.relativeFolder
)
if (exists) {
conflicts.push({ name: file.name, type: 'file' })
}
}
return conflicts
}
async displayOverwriteDialog(
files: UppyResource[],
conflicts: ConflictedResource[]
): Promise<UppyResource[]> {
let fileCount = 0
let folderCount = 0
const resolvedFileConflicts = []
const resolvedFolderConflicts = []
let doForAllConflicts = false
let allConflictsStrategy
let doForAllConflictsFolders = false
let allConflictsStrategyFolders
for (const conflict of conflicts) {
const isFolder = conflict.type === 'folder'
const conflictArray = isFolder ? resolvedFolderConflicts : resolvedFileConflicts
if (doForAllConflicts && !isFolder) {
conflictArray.push({
name: conflict.name,
strategy: allConflictsStrategy
})
continue
}
if (doForAllConflictsFolders && isFolder) {
conflictArray.push({
name: conflict.name,
strategy: allConflictsStrategyFolders
})
continue
}
const conflictsLeft =
conflicts.filter((c) => c.type === conflict.type).length -
(isFolder ? folderCount : fileCount)
const resolvedConflict: ResolveConflict = await this.resolveFileExists(
{ name: conflict.name, isFolder } as Resource,
conflictsLeft,
isFolder,
true
)
isFolder ? folderCount++ : fileCount++
if (resolvedConflict.doForAllConflicts) {
if (isFolder) {
doForAllConflictsFolders = true
allConflictsStrategyFolders = resolvedConflict.strategy
} else {
doForAllConflicts = true
allConflictsStrategy = resolvedConflict.strategy
}
}
conflictArray.push({
name: conflict.name,
strategy: resolvedConflict.strategy
})
}
const filesToSkip = resolvedFileConflicts
.filter((e) => e.strategy === ResolveStrategy.SKIP)
.map((e) => e.name)
const foldersToSkip = resolvedFolderConflicts
.filter((e) => e.strategy === ResolveStrategy.SKIP)
.map((e) => e.name)
files = files.filter((e) => !filesToSkip.includes(e.name))
files = files.filter(
(file) =>
!foldersToSkip.some((folderName) => file.meta.relativeFolder.split('/')[1] === folderName)
)
const filesToKeepBoth = resolvedFileConflicts
.filter((e) => e.strategy === ResolveStrategy.KEEP_BOTH)
.map((e) => e.name)
const foldersToKeepBoth = resolvedFolderConflicts
.filter((e) => e.strategy === ResolveStrategy.KEEP_BOTH)
.map((e) => e.name)
for (const fileName of filesToKeepBoth) {
const file = files.find((e) => e.name === fileName && !e.meta.relativeFolder)
const extension = extractExtensionFromFile({ name: fileName } as Resource)
file.name = resolveFileNameDuplicate(fileName, extension, this.resourcesStore.resources)
file.meta.name = file.name
if (file.xhrUpload?.endpoint) {
file.xhrUpload.endpoint = file.xhrUpload.endpoint.replace(
new RegExp(`/${encodeURIComponent(fileName)}`),
`/${encodeURIComponent(file.name)}`
)
}
}
for (const folder of foldersToKeepBoth) {
const filesInFolder = files.filter((e) => e.meta.relativeFolder.split('/')[1] === folder)
for (const file of filesInFolder) {
const newFolderName = resolveFileNameDuplicate(folder, '', this.resourcesStore.resources)
file.meta.relativeFolder = file.meta.relativeFolder.replace(
new RegExp(`/${folder}`),
`/${newFolderName}`
)
file.meta.relativePath = file.meta.relativePath.replace(
new RegExp(`/${folder}/`),
`/${newFolderName}/`
)
file.meta.tusEndpoint = file.meta.tusEndpoint.replace(
new RegExp(`/${encodeURIComponent(folder)}$`),
`/${encodeURIComponent(newFolderName)}`
)
if (file.xhrUpload?.endpoint) {
file.xhrUpload.endpoint = file.xhrUpload.endpoint.replace(
new RegExp(`/${encodeURIComponent(folder)}$`),
`/${encodeURIComponent(newFolderName)}`
)
}
if (file.tus?.endpoint) {
file.tus.endpoint = file.tus.endpoint.replace(
new RegExp(`/${encodeURIComponent(folder)}$`),
`/${encodeURIComponent(newFolderName)}`
)
}
}
}
return files
}
}
| owncloud/web/packages/web-app-files/src/helpers/resource/actions/upload.ts/0 | {
"file_path": "owncloud/web/packages/web-app-files/src/helpers/resource/actions/upload.ts",
"repo_id": "owncloud",
"token_count": 2478
} | 833 |
import { FolderLoader, FolderLoaderTask, TaskContext } from '../folder'
import { Router } from 'vue-router'
import { useTask } from 'vue-concurrency'
import { buildIncomingShareResource } from '@ownclouders/web-client/src/helpers/share/functionsNG'
import { isLocationSharesActive } from '@ownclouders/web-pkg'
export class FolderLoaderSharedWithMe implements FolderLoader {
public isEnabled(): boolean {
return true
}
public isActive(router: Router): boolean {
return isLocationSharesActive(router, 'files-shares-with-me')
}
public getTask(context: TaskContext): FolderLoaderTask {
const { spacesStore, clientService, configStore, resourcesStore, sharesStore } = context
// eslint-disable-next-line @typescript-eslint/no-unused-vars
return useTask(function* (signal1, signal2) {
resourcesStore.clearResourceList()
resourcesStore.setAncestorMetaData({})
if (configStore.options.routing.fullShareOwnerPaths) {
yield spacesStore.loadMountPoints({ graphClient: clientService.graphAuthenticated })
}
const {
data: { value }
} = yield clientService.graphAuthenticated.drives.listSharedWithMe()
const resources = value.map((driveItem) =>
buildIncomingShareResource({ driveItem, graphRoles: sharesStore.graphRoles })
)
resourcesStore.initResourceList({ currentFolder: null, resources })
})
}
}
| owncloud/web/packages/web-app-files/src/services/folder/loaderSharedWithMe.ts/0 | {
"file_path": "owncloud/web/packages/web-app-files/src/services/folder/loaderSharedWithMe.ts",
"repo_id": "owncloud",
"token_count": 465
} | 834 |
<template>
<div class="oc-flex oc-width-1-1">
<files-view-wrapper>
<app-bar
:breadcrumbs="breadcrumbs"
:show-actions-on-selection="true"
:has-bulk-actions="true"
:has-hidden-files="false"
:has-file-extensions="false"
:has-pagination="false"
:is-side-bar-open="isSideBarOpen"
:view-modes="viewModes"
:view-mode-default="FolderViewModeConstants.name.tiles"
>
<template #actions>
<create-space v-if="hasCreatePermission" class="oc-mr-s" />
<div v-if="!selectedResourcesIds?.length" class="oc-flex oc-flex-middle oc-pl-s">
<span v-text="$gettext('Learn about spaces')" />
<oc-contextual-helper
:text="$gettext('Spaces are special folders built for collaboration.')"
class="oc-ml-xs"
/>
</div>
</template>
</app-bar>
<app-loading-spinner v-if="areResourcesLoading" />
<template v-else>
<no-content-message
v-if="!spaces.length"
id="files-spaces-empty"
class="files-empty"
icon="layout-grid"
>
<template #message>
<span v-text="$gettext('You don\'t have access to any spaces')" />
</template>
</no-content-message>
<div v-else class="spaces-list oc-mt-l">
<div class="spaces-list-filters oc-flex oc-flex-right oc-px-m oc-mb-m">
<oc-text-input
id="spaces-filter"
v-model="filterTerm"
:label="$gettext('Search')"
autocomplete="off"
/>
</div>
<component
:is="folderView.component"
v-model:selectedIds="selectedResourcesIds"
resource-type="space"
:are-thumbnails-displayed="true"
:resources="paginatedItems"
:fields-displayed="tableDisplayFields"
:sort-fields="sortFields"
:sort-by="sortBy"
:sort-dir="sortDir"
:header-position="fileListHeaderY"
:view-size="viewSize"
v-bind="folderView.componentAttrs?.()"
@sort="handleSort"
@row-mounted="rowMounted"
>
<template #image="{ resource }">
<template v-if="viewMode === FolderViewModeConstants.name.tiles">
<img
v-if="imageContentObject[resource.id]"
class="tile-preview"
:src="imageContentObject[resource.id]['data']"
alt=""
/>
</template>
<template v-else>
<img
v-if="imageContentObject[resource.id]"
class="table-preview oc-mr-s"
:src="imageContentObject[resource.id]['data']"
alt=""
width="33"
height="33"
/>
<oc-resource-icon v-else class="oc-mr-s" :resource="resource" />
</template>
</template>
<template #actions="{ resource }">
<oc-button
v-oc-tooltip="showSpaceMemberLabel"
:aria-label="showSpaceMemberLabel"
appearance="raw"
@click="openSidebarSharePanel(resource as SpaceResource)"
>
<oc-icon name="group" fill-type="line" />
</oc-button>
</template>
<template #contextMenu="{ resource }">
<space-context-actions
:action-options="{ resources: [resource] as SpaceResource[] }"
/>
</template>
<template #footer>
<pagination :pages="totalPages" :current-page="currentPage" />
<div class="oc-text-nowrap oc-text-center oc-width-1-1 oc-my-s">
<p class="oc-text-muted">{{ footerTextTotal }}</p>
<p v-if="filterTerm" class="oc-text-muted">{{ footerTextFilter }}</p>
</div>
</template>
<!--- table -->
<template #status="{ resource }">
<span v-if="resource.disabled" class="oc-flex oc-flex-middle">
<oc-icon name="stop-circle" fill-type="line" class="oc-mr-s" /><span
v-text="$gettext('Disabled')"
/>
</span>
<span v-else class="oc-flex oc-flex-middle">
<oc-icon name="play-circle" fill-type="line" class="oc-mr-s" /><span
v-text="$gettext('Enabled')"
/>
</span>
</template>
<template #manager="{ resource }">
{{ getManagerNames(resource) }}
</template>
<template #members="{ resource }">
{{ getMemberCount(resource) }}
</template>
<template #totalQuota="{ resource }">
{{ getTotalQuota(resource) }}
</template>
<template #usedQuota="{ resource }"> {{ getUsedQuota(resource) }}</template>
<template #remainingQuota="{ resource }"> {{ getRemainingQuota(resource) }}</template>
</component>
</div>
</template>
</files-view-wrapper>
<file-side-bar
:is-open="isSideBarOpen"
:active-panel="sideBarActivePanel"
:space="selectedSpace"
/>
</div>
</template>
<script lang="ts">
import {
onMounted,
computed,
defineComponent,
unref,
ref,
watch,
nextTick,
onBeforeUnmount
} from 'vue'
import { useTask } from 'vue-concurrency'
import Mark from 'mark.js'
import Fuse from 'fuse.js'
import {
AppLoadingSpinner,
useConfigStore,
useResourcesStore,
useSpacesStore,
FolderViewExtension,
useExtensionRegistry
} from '@ownclouders/web-pkg'
import { AppBar } from '@ownclouders/web-pkg'
import CreateSpace from '../../components/AppBar/CreateSpace.vue'
import {
useAbility,
useClientService,
FolderViewModeConstants,
useRouteQueryPersisted,
useSort,
useRouteName,
usePagination,
useRouter,
useRoute,
Pagination,
FileSideBar,
ImageDimension,
NoContentMessage,
ProcessorType,
usePreviewService
} from '@ownclouders/web-pkg'
import SpaceContextActions from '../../components/Spaces/SpaceContextActions.vue'
import {
isProjectSpaceResource,
ProjectSpaceResource,
Resource,
SpaceResource
} from '@ownclouders/web-client/src/helpers'
import FilesViewWrapper from '../../components/FilesViewWrapper.vue'
import { ResourceTable, ResourceTiles } from '@ownclouders/web-pkg'
import { eventBus } from '@ownclouders/web-pkg'
import { SideBarEventTopics, useSideBar } from '@ownclouders/web-pkg'
import { WebDAV } from '@ownclouders/web-client/src/webdav'
import { sortFields as availableSortFields } from '@ownclouders/web-pkg'
import { defaultFuseOptions, formatFileSize, ResourceIcon } from '@ownclouders/web-pkg'
import { useGettext } from 'vue3-gettext'
import { useKeyboardActions } from '@ownclouders/web-pkg'
import {
useKeyboardTableNavigation,
useKeyboardTableMouseActions,
useKeyboardTableActions
} from 'web-app-files/src/composables/keyboardActions'
import { orderBy } from 'lodash-es'
import { useResourcesViewDefaults } from '../../composables'
export default defineComponent({
components: {
AppBar,
AppLoadingSpinner,
CreateSpace,
FileSideBar,
FilesViewWrapper,
NoContentMessage,
Pagination,
ResourceIcon,
ResourceTiles,
ResourceTable,
SpaceContextActions
},
setup() {
const spacesStore = useSpacesStore()
const router = useRouter()
const route = useRoute()
const clientService = useClientService()
const { can } = useAbility()
const { current: currentLanguage, $gettext } = useGettext()
const filterTerm = ref('')
const markInstance = ref(undefined)
const imageContentObject = ref({})
const previewService = usePreviewService()
const configStore = useConfigStore()
const { setSelection, initResourceList, clearResourceList } = useResourcesStore()
const loadResourcesTask = useTask(function* () {
clearResourceList()
yield spacesStore.reloadProjectSpaces({ graphClient: clientService.graphAuthenticated })
initResourceList({ currentFolder: null, resources: unref(spaces) })
})
const {
viewSize,
fileListHeaderY,
scrollToResourceFromRoute,
areResourcesLoading,
selectedResourcesIds,
selectedResources
} = useResourcesViewDefaults({ loadResourcesTask })
let loadPreviewToken: string = null
const runtimeSpaces = computed(() => {
return spacesStore.spaces.filter(isProjectSpaceResource) || []
})
const selectedSpace = computed(() => {
if (unref(selectedResources).length === 1) {
return unref(selectedResources)[0] as ProjectSpaceResource
}
return null
})
const tableDisplayFields = [
'image',
'name',
'manager',
'members',
'totalQuota',
'usedQuota',
'remainingQuota',
'status',
'mdate'
]
const sortFields = availableSortFields
const {
sortBy,
sortDir,
items: spaces,
handleSort
} = useSort<SpaceResource>({
items: runtimeSpaces,
fields: sortFields
})
const filter = (spaces: Array<Resource>, filterTerm: string) => {
if (!(filterTerm || '').trim()) {
return spaces
}
const searchEngine = new Fuse(spaces, { ...defaultFuseOptions, keys: ['name'] })
return searchEngine.search(filterTerm).map((r) => r.item)
}
const items = computed(() =>
orderBy(filter(unref(spaces), unref(filterTerm)), unref(sortBy), unref(sortDir))
)
const {
items: paginatedItems,
page: currentPage,
total: totalPages
} = usePagination({
items,
perPageDefault: '50',
perPageStoragePrefix: 'spaces-list'
})
watch(filterTerm, async () => {
const instance = unref(markInstance)
if (!instance) {
return
}
await router.push({ ...unref(route), query: { ...unref(route).query, page: '1' } })
instance.unmark()
instance.mark(unref(filterTerm), {
element: 'span',
className: 'mark-highlight',
exclude: ['th *', 'tfoot *']
})
})
const hasCreatePermission = computed(() => can('create-all', 'Drive'))
const extensionRegistry = useExtensionRegistry()
const viewModes = computed(() => {
return [
...extensionRegistry
.requestExtensions<FolderViewExtension>('folderView', ['space'])
.map((e) => e.folderView)
]
})
const routeName = useRouteName()
const viewMode = useRouteQueryPersisted({
name: `${unref(routeName)}-${FolderViewModeConstants.queryName}`,
defaultValue: FolderViewModeConstants.name.tiles
})
const keyActions = useKeyboardActions()
useKeyboardTableNavigation(keyActions, runtimeSpaces, viewMode)
useKeyboardTableMouseActions(keyActions, viewMode)
useKeyboardTableActions(keyActions)
const getManagerNames = (space: SpaceResource) => {
const allManagers = space.spaceRoles.manager
const managers = allManagers.length > 2 ? allManagers.slice(0, 2) : allManagers
let managerStr = managers.map((m) => m.displayName).join(', ')
if (allManagers.length > 2) {
managerStr += `... +${allManagers.length - 2}`
}
return managerStr
}
const getTotalQuota = (space: SpaceResource) => {
if (space.spaceQuota.total === 0) {
return $gettext('Unrestricted')
}
return formatFileSize(space.spaceQuota.total, currentLanguage)
}
const getUsedQuota = (space: SpaceResource) => {
if (space.spaceQuota.used === undefined) {
return '-'
}
return formatFileSize(space.spaceQuota.used, currentLanguage)
}
const getRemainingQuota = (space: SpaceResource) => {
if (space.spaceQuota.remaining === undefined) {
return '-'
}
return formatFileSize(space.spaceQuota.remaining, currentLanguage)
}
const getMemberCount = (space: SpaceResource) => {
return (
space.spaceRoles.manager.length +
space.spaceRoles.editor.length +
space.spaceRoles.viewer.length
)
}
onMounted(async () => {
await loadResourcesTask.perform()
loadPreviewToken = eventBus.subscribe(
'app.files.spaces.uploaded-image',
(space: SpaceResource) => {
loadPreview(space)
}
)
scrollToResourceFromRoute(unref(spaces), 'files-app-bar')
nextTick(() => {
markInstance.value = new Mark('.spaces-table')
})
})
onBeforeUnmount(() => {
eventBus.unsubscribe('app.files.spaces.uploaded-image', loadPreviewToken)
})
const footerTextTotal = computed(() => {
return $gettext('%{spaceCount} spaces in total', {
spaceCount: unref(spaces).length.toString()
})
})
const footerTextFilter = computed(() => {
return $gettext('%{spaceCount} matching spaces', {
spaceCount: unref(items).length.toString()
})
})
const displayThumbnails = computed(() => configStore.options.displayThumbnails)
const rowMounted = (space: SpaceResource) => {
loadPreview(space)
}
const loadPreview = async (space: SpaceResource) => {
if (!unref(displayThumbnails) || !space.spaceImageData) {
return
}
const resource = await (clientService.webdav as WebDAV).getFileInfo(space, {
path: `.space/${space.spaceImageData.name}`
})
const processor =
unref(viewMode) === FolderViewModeConstants.name.tiles
? ProcessorType.enum.fit
: ProcessorType.enum.thumbnail
const dimensions =
unref(viewMode) === FolderViewModeConstants.name.tiles
? ImageDimension.Tile
: ImageDimension.Thumbnail
const thumbnail = await previewService.loadPreview({
space,
resource,
dimensions,
processor
})
imageContentObject.value[space.id] = {
fileId: space.spaceImageData.id,
data: thumbnail
}
}
const folderView = computed(() => {
const viewModeName = unref(viewMode) || FolderViewModeConstants.name.tiles
return unref(viewModes).find((v) => v.name === viewModeName)
})
return {
...useSideBar(),
spaces,
clientService,
loadResourcesTask,
areResourcesLoading,
selectedResourcesIds,
selectedSpace,
handleSort,
sortBy,
sortDir,
sortFields,
hasCreatePermission,
viewModes,
viewMode,
folderView,
tableDisplayFields,
FolderViewModeConstants,
getManagerNames,
getTotalQuota,
getUsedQuota,
getRemainingQuota,
getMemberCount,
paginatedItems,
filterTerm,
totalPages,
currentPage,
footerTextTotal,
footerTextFilter,
items,
imageContentObject,
rowMounted,
setSelection,
viewSize,
fileListHeaderY
}
},
computed: {
breadcrumbs() {
return [
{
text: this.$gettext('Spaces'),
onClick: () => this.loadResourcesTask.perform(),
isStativNav: true
}
]
},
showSpaceMemberLabel() {
return this.$gettext('Show members')
}
},
methods: {
openSidebarSharePanel(space: SpaceResource) {
this.setSelection([space.id])
eventBus.publish(SideBarEventTopics.openWithPanel, 'space-share')
}
}
})
</script>
<style lang="scss">
#files-spaces-empty {
height: 75vh;
}
.table-preview {
border-radius: 3px;
}
.state-trashed {
.tile-preview,
.tile-default-image > svg {
filter: grayscale(100%);
opacity: 80%;
}
}
</style>
| owncloud/web/packages/web-app-files/src/views/spaces/Projects.vue/0 | {
"file_path": "owncloud/web/packages/web-app-files/src/views/spaces/Projects.vue",
"repo_id": "owncloud",
"token_count": 7070
} | 835 |
import ListInfo from '../../../../src/components/FilesList/ListInfo.vue'
import { defaultPlugins, shallowMount } from 'web-test-helpers'
describe('ListInfo', () => {
describe('files and folders prop', () => {
const wrapper = getWrapper()
const itemElement = wrapper.find('p')
it('should set data test attributes', () => {
expect(itemElement.attributes('data-test-items')).toBe('5')
expect(itemElement.attributes('data-test-files')).toBe('2')
expect(itemElement.attributes('data-test-folders')).toBe('3')
expect(itemElement.attributes('data-test-spaces')).toBe('1')
})
it('should show text with files and folders total and individual count', () => {
expect(itemElement.text()).toBe('5 items in total (2 files, 3 folders)')
})
describe('item noun used inside information text', () => {
it.each([
{
prop: { files: -1, folders: -1 },
expectedText: '-2 items in total (-1 files, -1 folders)'
},
{
prop: { files: 0.1, folders: 0.1 },
expectedText: '0.2 items in total (0.1 files, 0.1 folders)'
},
{ prop: { files: 0, folders: 0 }, expectedText: '0 items in total (0 files, 0 folders)' },
{ prop: { files: 0, folders: 1 }, expectedText: '1 item in total (0 files, 1 folder)' },
{ prop: { files: 1, folders: 0 }, expectedText: '1 item in total (1 file, 0 folders)' },
{ prop: { files: 1, folders: 1 }, expectedText: '2 items in total (1 file, 1 folder)' },
{ prop: { files: 2, folders: 2 }, expectedText: '4 items in total (2 files, 2 folders)' }
])('should be singular or plural according to item, files and folders count', (cases) => {
const wrapper = getWrapper(cases.prop)
const itemElement = wrapper.find('p')
expect(itemElement.text()).toBe(cases.expectedText)
})
})
})
describe('size prop', () => {
it('should not set the size attribute if not provided', () => {
const wrapper = getWrapper()
const itemElement = wrapper.find('p')
expect(itemElement.attributes('data-test-size')).toBe(undefined)
})
it.each([-1, 0, 1, 0.1, 100000.01])(
'should set data test size property if provided',
(size) => {
const wrapper = getWrapper({ size: size })
expect(wrapper.find('p').attributes('data-test-size')).toBe(size.toString())
}
)
describe('when size prop is zero or smaller', () => {
it.each([0, -1])('should not contain size information inside text', (size) => {
const wrapper = getWrapper({ size: size })
const itemElement = wrapper.find('p')
expect(itemElement.text()).toBe('5 items in total (2 files, 3 folders)')
})
})
describe('when size prop is greater than zero', () => {
it.each`
size | expectedSize
${0.1} | ${'0 B'}
${1} | ${'1 B'}
${100} | ${'100 B'}
${10000} | ${'10 kB'}
${10000000} | ${'10 MB'}
${10000000000} | ${'10 GB'}
${10000000000000} | ${'10 TB'}
`('should calculate size units', ({ size, expectedSize }) => {
const wrapper = getWrapper({ size: size })
expect(wrapper.find('p').text()).toBe(
`5 items with ${expectedSize} in total (2 files, 3 folders)`
)
})
})
})
})
function getWrapper(props = {}) {
return shallowMount(ListInfo, {
props: {
files: 2,
folders: 3,
spaces: 1,
...props
},
global: {
plugins: [...defaultPlugins()]
}
})
}
| owncloud/web/packages/web-app-files/tests/unit/components/FilesList/ListInfo.spec.ts/0 | {
"file_path": "owncloud/web/packages/web-app-files/tests/unit/components/FilesList/ListInfo.spec.ts",
"repo_id": "owncloud",
"token_count": 1519
} | 836 |
import ListItem from '../../../../../../src/components/SideBar/Shares/Collaborators/ListItem.vue'
import {
CollaboratorShare,
GraphSharePermission,
ShareRole,
ShareTypes
} from '@ownclouders/web-client/src/helpers/share'
import {
defaultPlugins,
mount,
defaultStubs,
defaultComponentMocks,
nextTicks,
mockAxiosResolve
} from 'web-test-helpers'
import { useMessages, useSharesStore, useSpacesStore } from '@ownclouders/web-pkg'
import EditDropdown from '../../../../../../src/components/SideBar/Shares/Collaborators/EditDropdown.vue'
import RoleDropdown from '../../../../../../src/components/SideBar/Shares/Collaborators/RoleDropdown.vue'
import { mock } from 'vitest-mock-extended'
import { Resource, SpaceResource } from '@ownclouders/web-client'
vi.mock('@ownclouders/web-client/src/helpers/space/functions', () => ({
buildSpace: vi.fn((space) => space)
}))
vi.mock('uuid', () => ({
v4: () => {
return '00000000-0000-0000-0000-000000000000'
}
}))
const selectors = {
userAvatarImage: 'avatar-image-stub.files-collaborators-collaborator-indicator',
notUserAvatar: 'oc-avatar-item-stub.files-collaborators-collaborator-indicator',
collaboratorAdditionalInfo: '.files-collaborators-collaborator-additional-info',
collaboratorName: '.files-collaborators-collaborator-name',
accessDetailsButton: '.files-collaborators-collaborator-access-details-button',
collaboratorRole: '.files-collaborators-collaborator-role',
collaboratorEdit: '.files-collaborators-collaborator-edit',
shareInheritanceIndicators: '.oc-resource-indicators',
expirationDateIcon: '[data-testid="recipient-info-expiration-date"]'
}
const getShareMock = ({
sharedWith,
shareType,
expirationDateTime
}: Partial<CollaboratorShare> = {}): CollaboratorShare => ({
id: '1',
sharedWith: sharedWith || { id: '3', displayName: 'einstein' },
sharedBy: { id: '2', displayName: 'marie' },
permissions: [],
shareType: shareType || ShareTypes.user.value,
role: mock<ShareRole>({ description: '', displayName: '' }),
resourceId: '1',
indirect: false,
expirationDateTime: expirationDateTime || ''
})
describe('Collaborator ListItem component', () => {
describe('displays the correct image/icon according to the shareType', () => {
describe('user and spaceUser share type', () => {
it.each([ShareTypes.user.value, ShareTypes.spaceUser.value])(
'should display a users avatar',
(shareType) => {
const { wrapper } = createWrapper({ share: getShareMock({ shareType }) })
expect(wrapper.find(selectors.userAvatarImage).exists()).toBeTruthy()
expect(wrapper.find(selectors.notUserAvatar).exists()).toBeFalsy()
}
)
it('sets user info on the avatar', () => {
const share = getShareMock()
const { wrapper } = createWrapper({ share })
expect(wrapper.find(selectors.userAvatarImage).attributes('userid')).toEqual(
share.sharedWith.id
)
expect(wrapper.find(selectors.userAvatarImage).attributes('user-name')).toEqual(
share.sharedWith.displayName
)
})
})
describe('non-user share types', () => {
it.each(
ShareTypes.all.filter(
(shareType) => ![ShareTypes.user, ShareTypes.spaceUser].includes(shareType)
)
)('should display an oc-avatar-item for any non-user share types', (shareType) => {
const { wrapper } = createWrapper({ share: getShareMock({ shareType: shareType.value }) })
expect(wrapper.find(selectors.userAvatarImage).exists()).toBeFalsy()
expect(wrapper.find(selectors.notUserAvatar).exists()).toBeTruthy()
expect(wrapper.find(selectors.notUserAvatar).attributes().name).toEqual(shareType.key)
})
it('should display an oc-avatar-item for space group shares', () => {
const { wrapper } = createWrapper({
share: getShareMock({
shareType: ShareTypes.spaceGroup.value,
sharedWith: { id: '1', displayName: 'someGroup' }
})
})
expect(wrapper.find(selectors.userAvatarImage).exists()).toBeFalsy()
expect(wrapper.find(selectors.notUserAvatar).exists()).toBeTruthy()
})
})
})
describe('share info', () => {
it('shows the collaborator display name', () => {
const share = getShareMock()
const { wrapper } = createWrapper({ share })
expect(wrapper.find(selectors.collaboratorName).text()).toEqual(share.sharedWith.displayName)
})
it('shows the share expiration date if given', () => {
const { wrapper } = createWrapper({
share: getShareMock({ expirationDateTime: '2000-01-01' })
})
expect(wrapper.find(selectors.expirationDateIcon).exists()).toBeTruthy()
})
})
describe('modifiable property', () => {
it('shows interactive elements when modifiable', () => {
const { wrapper } = createWrapper({ modifiable: true })
expect(wrapper.find(selectors.collaboratorRole).exists()).toBeTruthy()
})
it('hides interactive elements when not modifiable', () => {
const { wrapper } = createWrapper({ modifiable: false })
expect(wrapper.find(selectors.collaboratorRole).exists()).toBeFalsy()
})
})
describe('share inheritance indicators', () => {
it('show when sharedParentRoute is given', () => {
const { wrapper } = createWrapper({
sharedParentRoute: { params: { driveAliasAndItem: '/folder' } }
})
expect(wrapper.find(selectors.shareInheritanceIndicators).exists()).toBeTruthy()
expect(wrapper.html()).toMatchSnapshot()
})
it('do not show when sharedParentRoute is not given', () => {
const { wrapper } = createWrapper()
expect(wrapper.find(selectors.shareInheritanceIndicators).exists()).toBeFalsy()
})
})
describe('remove share', () => {
it('emits the "removeShare" event', () => {
const { wrapper } = createWrapper()
wrapper.findComponent<typeof EditDropdown>('edit-dropdown-stub').vm.$emit('removeShare')
expect(wrapper.emitted().onDelete).toBeTruthy()
})
})
describe('change share role', () => {
it('calls "changeShare" for regular resources', () => {
const { wrapper } = createWrapper()
wrapper.findComponent<typeof RoleDropdown>('role-dropdown-stub').vm.$emit('optionChange', {
permissions: [GraphSharePermission.readBasic]
})
const sharesStore = useSharesStore()
expect(sharesStore.updateShare).toHaveBeenCalled()
})
it('calls "upsertSpaceMember" for space resources', async () => {
const resource = mock<SpaceResource>({ driveType: 'project' })
const { wrapper } = createWrapper({
share: getShareMock({ shareType: ShareTypes.spaceUser.value }),
resource
})
wrapper.findComponent<typeof RoleDropdown>('role-dropdown-stub').vm.$emit('optionChange', {
permissions: [GraphSharePermission.readBasic]
})
await nextTicks(4)
const spacesStore = useSpacesStore()
expect(spacesStore.upsertSpaceMember).toHaveBeenCalled()
})
it('shows a message on error', async () => {
const resource = mock<SpaceResource>({ driveType: 'project' })
vi.spyOn(console, 'error').mockImplementation(() => undefined)
const { wrapper } = createWrapper()
vi.spyOn(wrapper.vm, 'saveShareChanges').mockImplementation(() => {
throw new Error()
})
wrapper.findComponent<typeof RoleDropdown>('role-dropdown-stub').vm.$emit('optionChange', {
share: getShareMock({ shareType: ShareTypes.spaceUser.value }),
resource
})
await nextTicks(4)
const sharesStore = useSharesStore()
expect(sharesStore.updateShare).not.toHaveBeenCalled()
const messagesStore = useMessages()
expect(messagesStore.showErrorMessage).toHaveBeenCalled()
})
})
describe('change expiration date', () => {
it('calls "changeShare" for regular resources', () => {
const { wrapper } = createWrapper()
wrapper
.findComponent<typeof EditDropdown>('edit-dropdown-stub')
.vm.$emit('expirationDateChanged', {
shareExpirationChanged: new Date()
})
const sharesStore = useSharesStore()
expect(sharesStore.updateShare).toHaveBeenCalled()
})
it('shows a message on error', () => {
vi.spyOn(console, 'error').mockImplementation(() => undefined)
const { wrapper } = createWrapper()
vi.spyOn(wrapper.vm, 'saveShareChanges').mockImplementation(() => {
throw new Error()
})
wrapper
.findComponent<typeof EditDropdown>('edit-dropdown-stub')
.vm.$emit('expirationDateChanged', {
shareExpirationChanged: new Date()
})
const sharesStore = useSharesStore()
expect(sharesStore.updateShare).not.toHaveBeenCalled()
const messagesStore = useMessages()
expect(messagesStore.showErrorMessage).toHaveBeenCalled()
})
})
})
function createWrapper({
share = getShareMock(),
modifiable = true,
sharedParentRoute = null,
resource = mock<Resource>()
} = {}) {
const mocks = defaultComponentMocks()
mocks.$clientService.graphAuthenticated.drives.getDrive.mockResolvedValue(
mockAxiosResolve(undefined)
)
return {
wrapper: mount(ListItem, {
props: {
share,
modifiable,
sharedParentRoute
},
global: {
plugins: [...defaultPlugins()],
mocks,
provide: { ...mocks, resource },
renderStubDefaultSlot: true,
stubs: {
...defaultStubs,
'oc-icon': true,
'avatar-image': true,
'router-link': true,
'oc-info-drop': true,
'oc-table-simple': true,
'oc-tr': true,
'oc-td': true,
'oc-tag': true,
'oc-pagination': true,
'oc-avatar-item': true,
'role-dropdown': true,
'edit-dropdown': true,
translate: false
}
}
})
}
}
| owncloud/web/packages/web-app-files/tests/unit/components/SideBar/Shares/Collaborators/ListItem.spec.ts/0 | {
"file_path": "owncloud/web/packages/web-app-files/tests/unit/components/SideBar/Shares/Collaborators/ListItem.spec.ts",
"repo_id": "owncloud",
"token_count": 3864
} | 837 |
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`SpaceHeader > should add the "squashed"-class when the sidebar is opened 1`] = `
"<div class="space-header oc-p-m oc-flex space-header-squashed">
<div class="space-header-image">
<div class="space-header-image-default oc-flex oc-flex-middle oc-flex-center"><span class="oc-icon oc-icon-xxl oc-icon-passive oc-px-m oc-py-m"><!----></span></div>
</div>
<div class="space-header-infos">
<div class="oc-flex oc-mb-s oc-flex-middle oc-flex-between">
<div class="oc-flex oc-flex-middle space-header-infos-heading">
<h2 class="space-header-name"></h2> <button type="button" aria-label="Show context menu" class="oc-button oc-rounded oc-button-m oc-button-justify-content-center oc-button-gap-m oc-button-passive oc-button-passive-raw oc-ml-s" id="space-context-btn">
<!--v-if-->
<!-- @slot Content of the button --> <span class="oc-icon oc-icon-m oc-icon-passive"><!----></span>
</button>
<div id="space-context-drop" class="oc-drop oc-box-shadow-medium oc-rounded" options="[object Object]">
<div class="oc-card oc-card-body oc-background-secondary oc-p-s">
<space-context-actions-stub actionoptions="[object Object]"></space-context-actions-stub>
</div>
</div>
</div>
<!--v-if-->
</div>
<!--v-if-->
<div class="markdown-container">
<!--v-if-->
</div>
<!--v-if-->
</div>
</div>"
`;
exports[`SpaceHeader > space image > should show the default image if no other image is set 1`] = `
"<div class="space-header oc-p-m oc-flex">
<div class="space-header-image">
<div class="space-header-image-default oc-flex oc-flex-middle oc-flex-center"><span class="oc-icon oc-icon-xxl oc-icon-passive oc-px-m oc-py-m"><!----></span></div>
</div>
<div class="space-header-infos">
<div class="oc-flex oc-mb-s oc-flex-middle oc-flex-between">
<div class="oc-flex oc-flex-middle space-header-infos-heading">
<h2 class="space-header-name"></h2> <button type="button" aria-label="Show context menu" class="oc-button oc-rounded oc-button-m oc-button-justify-content-center oc-button-gap-m oc-button-passive oc-button-passive-raw oc-ml-s" id="space-context-btn">
<!--v-if-->
<!-- @slot Content of the button --> <span class="oc-icon oc-icon-m oc-icon-passive"><!----></span>
</button>
<div id="space-context-drop" class="oc-drop oc-box-shadow-medium oc-rounded" options="[object Object]">
<div class="oc-card oc-card-body oc-background-secondary oc-p-s">
<space-context-actions-stub actionoptions="[object Object]"></space-context-actions-stub>
</div>
</div>
</div>
<!--v-if-->
</div>
<!--v-if-->
<div class="markdown-container">
<!--v-if-->
</div>
<!--v-if-->
</div>
</div>"
`;
exports[`SpaceHeader > space image > should show the set image 1`] = `
"<div class="space-header oc-p-m oc-flex">
<div class="space-header-image"><img class="oc-cursor-pointer" alt="" src="blob:image"></div>
<div class="space-header-infos">
<div class="oc-flex oc-mb-s oc-flex-middle oc-flex-between">
<div class="oc-flex oc-flex-middle space-header-infos-heading">
<h2 class="space-header-name"></h2> <button type="button" aria-label="Show context menu" class="oc-button oc-rounded oc-button-m oc-button-justify-content-center oc-button-gap-m oc-button-passive oc-button-passive-raw oc-ml-s" id="space-context-btn">
<!--v-if-->
<!-- @slot Content of the button --> <span class="oc-icon oc-icon-m oc-icon-passive"><!----></span>
</button>
<div id="space-context-drop" class="oc-drop oc-box-shadow-medium oc-rounded" options="[object Object]">
<div class="oc-card oc-card-body oc-background-secondary oc-p-s">
<space-context-actions-stub actionoptions="[object Object]"></space-context-actions-stub>
</div>
</div>
</div>
<!--v-if-->
</div>
<!--v-if-->
<div class="markdown-container">
<!--v-if-->
</div>
<!--v-if-->
</div>
</div>"
`;
| owncloud/web/packages/web-app-files/tests/unit/components/Spaces/__snapshots__/SpaceHeader.spec.ts.snap/0 | {
"file_path": "owncloud/web/packages/web-app-files/tests/unit/components/Spaces/__snapshots__/SpaceHeader.spec.ts.snap",
"repo_id": "owncloud",
"token_count": 1793
} | 838 |
import GenericTrash from '../../../../src/views/spaces/GenericTrash.vue'
import { useResourcesViewDefaults } from 'web-app-files/src/composables'
import { useResourcesViewDefaultsMock } from 'web-app-files/tests/mocks/useResourcesViewDefaultsMock'
import { ref } from 'vue'
import { mock } from 'vitest-mock-extended'
import { Resource } from '@ownclouders/web-client'
import { SpaceResource } from '@ownclouders/web-client/src/helpers'
import {
defaultPlugins,
mount,
defaultComponentMocks,
defaultStubs,
RouteLocation,
PartialComponentProps,
ComponentProps
} from 'web-test-helpers'
import { AppBar } from '@ownclouders/web-pkg'
vi.mock('web-app-files/src/composables')
describe('GenericTrash view', () => {
it('appBar always present', () => {
const { wrapper } = getMountedWrapper()
expect(wrapper.find('app-bar-stub').exists()).toBeTruthy()
})
it('sideBar always present', () => {
const { wrapper } = getMountedWrapper()
expect(wrapper.find('file-side-bar-stub').exists()).toBeTruthy()
})
it('shows the personal space breadcrumb', () => {
const { wrapper } = getMountedWrapper()
expect(
wrapper.findComponent<typeof AppBar>('app-bar-stub').props().breadcrumbs[1].text
).toEqual('Personal space')
})
it('shows the project space breadcrumb', () => {
const space = mock<SpaceResource>({ driveType: 'project' })
const { wrapper } = getMountedWrapper({ props: { space } })
expect(
wrapper.findComponent<typeof AppBar>('app-bar-stub').props().breadcrumbs[1].text
).toEqual(space.name)
})
describe('different files view states', () => {
it('shows the loading spinner during loading', () => {
const { wrapper } = getMountedWrapper({ loading: true })
expect(wrapper.find('oc-spinner-stub').exists()).toBeTruthy()
})
it('shows the no-content-message after loading', () => {
const { wrapper } = getMountedWrapper()
expect(wrapper.find('oc-spinner-stub').exists()).toBeFalsy()
expect(wrapper.find('.no-content-message').exists()).toBeTruthy()
})
it('shows the files table when files are available', () => {
const { wrapper } = getMountedWrapper({ files: [mock<Resource>()] })
expect(wrapper.find('.no-content-message').exists()).toBeFalsy()
expect(wrapper.find('resource-table-stub').exists()).toBeTruthy()
})
})
})
function getMountedWrapper({
mocks = {},
props = {} as PartialComponentProps<typeof GenericTrash>,
files = [],
loading = false
} = {}) {
vi.mocked(useResourcesViewDefaults).mockImplementation(() =>
useResourcesViewDefaultsMock({
paginatedResources: ref(files),
areResourcesLoading: ref(loading)
})
)
const defaultMocks = {
...defaultComponentMocks({
currentRoute: mock<RouteLocation>({ name: 'files-trash-generic' })
}),
...(mocks && mocks)
}
const propsData: ComponentProps<typeof GenericTrash> = {
space: mock<SpaceResource>({ id: '1', getDriveAliasAndItem: vi.fn(), name: 'Personal space' }),
...props
}
return {
mocks: defaultMocks,
wrapper: mount(GenericTrash, {
props: propsData,
global: {
plugins: [...defaultPlugins()],
mocks: defaultMocks,
stubs: { ...defaultStubs, portal: true }
}
})
}
}
| owncloud/web/packages/web-app-files/tests/unit/views/spaces/GenericTrash.spec.ts/0 | {
"file_path": "owncloud/web/packages/web-app-files/tests/unit/views/spaces/GenericTrash.spec.ts",
"repo_id": "owncloud",
"token_count": 1219
} | 839 |
import App from './views/App.vue'
import { defineWebApplication, useRouter, useUserStore } from '@ownclouders/web-pkg'
import translations from '../l10n/translations.json'
import { extensions } from './extensions'
import { RouteRecordRaw } from 'vue-router'
import { useGettext } from 'vue3-gettext'
const routes: RouteRecordRaw[] = [
{
path: '/',
redirect: () => {
return { name: 'ocm-app-invitations' }
}
},
{
path: '/invitations',
name: 'ocm-app-invitations',
component: App,
meta: {
patchCleanPath: true,
title: 'Invitations'
}
}
]
export default defineWebApplication({
setup() {
const { $gettext } = useGettext()
const router = useRouter()
const userStore = useUserStore()
const appInfo = {
name: $gettext('ScienceMesh'),
id: 'ocm',
color: '#AE291D',
icon: 'contacts-book',
isFileEditor: false,
applicationMenu: {
enabled: () => {
return !!userStore.user
}
}
}
router.addRoute({
path: '/accept',
redirect: () => {
return { path: `/${appInfo.id}` }
}
})
const navItems = [
{
name: $gettext('Invitations'),
icon: 'user-shared',
route: {
path: `/${appInfo.id}/invitations?`
},
enabled: () => true
}
]
return {
appInfo,
routes,
navItems,
extensions: extensions(),
translations
}
}
})
| owncloud/web/packages/web-app-ocm/src/index.ts/0 | {
"file_path": "owncloud/web/packages/web-app-ocm/src/index.ts",
"repo_id": "owncloud",
"token_count": 661
} | 840 |
<template>
<audio :key="`media-audio-${file.id}`" controls preload="preload" :autoplay="isAutoPlayEnabled">
<source :src="file.url" :type="file.mimeType" />
</audio>
</template>
<script lang="ts">
import { defineComponent, PropType } from 'vue'
import { CachedFile } from '../../helpers/types'
export default defineComponent({
name: 'MediaAudio',
props: {
file: {
type: Object as PropType<CachedFile>,
required: true
},
isAutoPlayEnabled: {
type: Boolean,
default: true
}
}
})
</script>
| owncloud/web/packages/web-app-preview/src/components/Sources/MediaAudio.vue/0 | {
"file_path": "owncloud/web/packages/web-app-preview/src/components/Sources/MediaAudio.vue",
"repo_id": "owncloud",
"token_count": 210
} | 841 |
<template>
<component
:is="listSearch.component"
:search-result="searchResult"
:loading="loading"
@search="search"
/>
</template>
<script lang="ts">
import { computed, defineComponent, ref, unref } from 'vue'
import { queryItemAsString, useRouteQuery } from '@ownclouders/web-pkg'
import { useAvailableProviders } from '../composables'
export default defineComponent({
setup() {
const availableProviders = useAvailableProviders()
const providerId = useRouteQuery('provider')
const listSearch = computed(() => {
const { listSearch } = unref(availableProviders).find(
(provider) => provider.id === queryItemAsString(unref(providerId))
)
return listSearch
})
// The resources always have to be loaded from the server first.
// Therefore, the loading spinner is active by default, which prevents incorrect results from being displayed.
const loading = ref(true)
const searchResult = ref({
values: [],
totalResults: null
})
const search = async (term: string) => {
loading.value = true
try {
searchResult.value = await unref(listSearch).search(term || '')
} catch (e) {
searchResult.value = {
values: [],
totalResults: null
}
console.error(e)
}
loading.value = false
}
return { listSearch, loading, searchResult, search }
}
})
</script>
| owncloud/web/packages/web-app-search/src/views/List.vue/0 | {
"file_path": "owncloud/web/packages/web-app-search/src/views/List.vue",
"repo_id": "owncloud",
"token_count": 518
} | 842 |
import translations from '../l10n/translations.json'
import Resolve from './views/Resolve.vue'
// just a dummy function to trick gettext tools
function $gettext(msg) {
return msg
}
const appInfo = {
name: $gettext('Webfinger'),
id: 'webfinger',
icon: 'fingerprint',
isFileEditor: false
}
const routes = () => [
{
name: 'webfinger-root',
path: '/',
redirect: () => {
return { name: 'webfinger-resolve' }
},
meta: {
authContext: 'anonymous'
}
},
{
path: '/resolve',
name: 'webfinger-resolve',
component: Resolve,
meta: {
authContext: 'idp',
title: $gettext('Resolve destination'),
entryPoint: true
}
}
]
export default {
appInfo,
routes,
translations
}
| owncloud/web/packages/web-app-webfinger/src/index.ts/0 | {
"file_path": "owncloud/web/packages/web-app-webfinger/src/index.ts",
"repo_id": "owncloud",
"token_count": 301
} | 843 |
/* tslint:disable */
/* eslint-disable */
/**
* Libre Graph API
* Libre Graph is a free API for cloud collaboration inspired by the MS Graph API.
*
* The version of the OpenAPI document: v1.0.4
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
export * from "./api";
export * from "./configuration";
| owncloud/web/packages/web-client/src/generated/index.ts/0 | {
"file_path": "owncloud/web/packages/web-client/src/generated/index.ts",
"repo_id": "owncloud",
"token_count": 128
} | 844 |
import { Identity, SharingLinkType, UnifiedRoleDefinition } from '../../generated'
import { Resource } from '../resource'
export enum GraphSharePermission {
createUpload = 'libre.graph/driveItem/upload/create',
createPermissions = 'libre.graph/driveItem/permissions/create',
createChildren = 'libre.graph/driveItem/children/create',
readBasic = 'libre.graph/driveItem/basic/read',
readPath = 'libre.graph/driveItem/path/read',
readQuota = 'libre.graph/driveItem/quota/read',
readContent = 'libre.graph/driveItem/content/read',
readChildren = 'libre.graph/driveItem/children/read',
readDeleted = 'libre.graph/driveItem/deleted/read',
updatePath = 'libre.graph/driveItem/path/update',
updateDeleted = 'libre.graph/driveItem/deleted/update',
deleteStandard = 'libre.graph/driveItem/standard/delete'
}
export interface ShareResource extends Resource {
sharedWith: Array<{ shareType: number } & Identity>
sharedBy: Identity[]
outgoing: boolean
driveId: string
}
export interface OutgoingShareResource extends ShareResource {}
export interface IncomingShareResource extends ShareResource {
hidden: boolean
syncEnabled: boolean
shareRoles: UnifiedRoleDefinition[]
sharePermissions: GraphSharePermission[]
}
export interface ShareRole extends UnifiedRoleDefinition {
icon?: string
label?: string
}
export interface Share {
id: string
resourceId: string
indirect: boolean
sharedBy: Identity
shareType: number
expirationDateTime?: string
}
export interface CollaboratorShare extends Share {
permissions: GraphSharePermission[]
sharedWith: Identity
role: ShareRole
}
export interface LinkShare extends Share {
displayName: string
hasPassword: boolean
isQuickLink: boolean
type: SharingLinkType
webUrl: string
preventsDownload?: boolean
}
export interface CollaboratorAutoCompleteItem {
id: string
displayName: string
shareType: number
mail?: string
}
| owncloud/web/packages/web-client/src/helpers/share/types.ts/0 | {
"file_path": "owncloud/web/packages/web-client/src/helpers/share/types.ts",
"repo_id": "owncloud",
"token_count": 548
} | 845 |
import { Ref, unref } from 'vue'
import {
Headers,
ProgressEventCallback,
RequestOptionsCustom,
WebDAVClient,
createClient
} from 'webdav'
import { v4 as uuidV4 } from 'uuid'
import { encodePath, urlJoin } from '../../utils'
import { DavMethod, DavPropertyValue } from '../constants'
import { buildPropFindBody, buildPropPatchBody } from './builders'
import { parseError, parseMultiStatus, parseTusHeaders } from './parsers'
import { WebDavResponseResource } from '../../helpers'
import { HttpError } from '../../errors'
interface DAVOptions {
accessToken: Ref<string>
baseUrl: string
language: Ref<string>
}
interface DavResult {
body: WebDavResponseResource[] | undefined
status: number
result: Response
}
export class DAV {
private accessToken: Ref<string>
private client: WebDAVClient
private davPath: string
private language: Ref<string>
constructor({ accessToken, baseUrl, language }: DAVOptions) {
this.davPath = urlJoin(baseUrl, 'remote.php/dav')
this.accessToken = accessToken
this.client = createClient(this.davPath, {})
this.language = language
}
public mkcol(path: string, { headers = {} }: { headers?: Headers } = {}) {
return this.request(DavMethod.mkcol, path, { headers })
}
public async propfind(
path: string,
{
depth = 1,
properties = [],
headers = {}
}: { depth?: number; properties?: DavPropertyValue[]; headers?: Headers } = {}
) {
const requestHeaders = { ...headers, Depth: depth.toString() }
const { body, result } = await this.request(DavMethod.propfind, path, {
body: buildPropFindBody(properties),
headers: requestHeaders
})
if (body?.length) {
// add tus info to current folder only
body[0].tusSupport = parseTusHeaders(result.headers)
}
return body
}
public async report(
path: string,
{
pattern = '',
filterRules = null,
limit = 30,
properties,
headers = {}
}: {
pattern?: string
filterRules?: Partial<Record<DavPropertyValue, unknown>>
limit?: number
properties?: DavPropertyValue[]
headers?: Headers
} = {}
) {
const { body, result } = await this.request(DavMethod.report, path, {
body: buildPropFindBody(properties, { pattern, filterRules, limit }),
headers
})
return {
results: body,
range: result.headers.get('content-range')
}
}
public copy(
source: string,
target: string,
{ overwrite = false, headers = {} }: { overwrite?: boolean; headers?: Headers } = {}
) {
const targetUrl = urlJoin(this.davPath, encodePath(target))
return this.request(DavMethod.copy, source, {
headers: { ...headers, Destination: targetUrl, overwrite: overwrite ? 'T' : 'F' }
})
}
public move(
source: string,
target: string,
{ overwrite = false, headers = {} }: { overwrite?: boolean; headers?: Headers } = {}
) {
const targetUrl = urlJoin(this.davPath, encodePath(target))
return this.request(DavMethod.move, source, {
headers: { ...headers, Destination: targetUrl, overwrite: overwrite ? 'T' : 'F' }
})
}
public put(
path: string,
content: string | ArrayBuffer,
{
headers = {},
onUploadProgress,
previousEntityTag,
overwrite
}: {
headers?: Headers
onUploadProgress?: ProgressEventCallback
previousEntityTag?: string
overwrite?: boolean
} = {}
) {
const requestHeaders = { ...headers }
if (previousEntityTag) {
// will ensure that no other client uploaded a different version meanwhile
requestHeaders['If-Match'] = previousEntityTag
} else if (!overwrite) {
// will trigger 412 precondition failed if a file already exists
requestHeaders['If-None-Match'] = '*'
}
return this.request(DavMethod.put, path, {
body: content,
headers: requestHeaders,
options: { onUploadProgress }
})
}
public delete(path: string, { headers = {} }: { headers?: Headers } = {}) {
return this.request(DavMethod.delete, path, { headers })
}
public propPatch(
path: string,
properties: Partial<Record<DavPropertyValue, unknown>>,
{ headers = {} }: { headers?: Headers } = {}
) {
const body = buildPropPatchBody(properties)
return this.request(DavMethod.proppatch, path, { body, headers })
}
public getFileUrl(path: string) {
return urlJoin(this.davPath, encodePath(path))
}
private buildHeaders(headers: Headers = {}): Headers {
return {
'Accept-Language': unref(this.language),
'Content-Type': 'application/xml; charset=utf-8',
'X-Requested-With': 'XMLHttpRequest',
'X-Request-ID': uuidV4(),
...headers
}
}
private async request(
method: DavMethod,
path: string,
{
body,
headers,
options
}: {
body?: string | ArrayBuffer
headers?: Headers
options?: Partial<RequestOptionsCustom>
} = {}
): Promise<DavResult> {
const url = urlJoin(this.davPath, encodePath(path), { leadingSlash: true })
const requestOptions = {
url,
method,
headers: this.buildHeaders(headers),
data: body,
...options
} as RequestOptionsCustom
try {
const result = (await this.client.customRequest('', requestOptions)) as unknown as Response
let resultBody: WebDavResponseResource[]
if (result.status === 207) {
const parsedBody = await result.text()
resultBody = await parseMultiStatus(parsedBody)
}
return {
body: resultBody,
status: result.status,
result
}
} catch (error) {
const { response } = error
const body = await response.text()
const errorMessage = parseError(body)
throw new HttpError(errorMessage, response, response.status)
}
}
}
| owncloud/web/packages/web-client/src/webdav/client/dav.ts/0 | {
"file_path": "owncloud/web/packages/web-client/src/webdav/client/dav.ts",
"repo_id": "owncloud",
"token_count": 2179
} | 846 |
import {
buildDeletedResource,
buildResource,
Resource,
WebDavResponseResource
} from '../helpers/resource'
import { DavProperties, DavProperty, DavPropertyValue } from './constants'
import {
buildPublicSpaceResource,
buildWebDavSpacesTrashPath,
isPublicSpaceResource,
SpaceResource
} from '../helpers'
import { urlJoin } from '../utils'
import { DAV, buildAuthHeader } from './client'
import { GetPathForFileIdFactory } from './getPathForFileId'
import { WebDavOptions } from './types'
import { unref } from 'vue'
export type ListFilesOptions = {
depth?: number
davProperties?: DavPropertyValue[]
isTrash?: boolean
}
export const ListFilesFactory = (
dav: DAV,
pathForFileIdFactory: ReturnType<typeof GetPathForFileIdFactory>,
{ accessToken }: WebDavOptions
) => {
return {
async listFiles(
space: SpaceResource,
{ path, fileId }: { path?: string; fileId?: string | number } = {},
{ depth = 1, davProperties, isTrash = false }: ListFilesOptions = {}
): Promise<ListFilesResult> {
let webDavResources: WebDavResponseResource[]
const headers = buildAuthHeader(unref(accessToken), space)
if (isPublicSpaceResource(space)) {
webDavResources = await dav.propfind(urlJoin(space.webDavPath, path), {
depth,
headers,
properties: davProperties || DavProperties.PublicLink
})
// FIXME: strip out token, ooof
webDavResources.forEach((r) => {
r.filename = r.filename.split('/').slice(1).join('/')
})
// FIXME: This is a workaround for https://github.com/owncloud/ocis/issues/4758
if (webDavResources.length === 1) {
webDavResources[0].filename = urlJoin(space.id, path, {
leadingSlashes: true
})
}
// We remove the /${publicLinkToken} prefix so the name is relative to the public link root
// At first we tried to do this in buildResource but only the public link root resource knows it's a public link
webDavResources.forEach((resource) => {
resource.filename = resource.filename.split('/').slice(2).join('/')
})
if (
(!path || path === '/') &&
depth > 0 &&
space.driveAlias.startsWith('ocm/') &&
webDavResources[0].props[DavProperty.PublicLinkItemType] === 'file'
) {
// ocm public single file shares are missing the current folder in the webdav response from the server.
// therefore we need to create a dummy resource here to use it as current folder.
webDavResources = [
{
basename: space.fileId,
type: 'directory',
filename: '',
props: {}
} as WebDavResponseResource,
...webDavResources
]
}
if (!path) {
const [rootFolder, ...children] = webDavResources
return {
resource: buildPublicSpaceResource({
...rootFolder,
id: space.id,
driveAlias: space.driveAlias,
webDavPath: space.webDavPath
}),
children: children.map(buildResource)
} as ListFilesResult
}
const resources = webDavResources.map(buildResource)
return { resource: resources[0], children: resources.slice(1) } as ListFilesResult
}
const listFilesCorrectedPath = async () => {
const correctPath = await pathForFileIdFactory.getPathForFileId(fileId.toString())
return this.listFiles(space, { path: correctPath }, { depth, davProperties })
}
try {
let webDavPath = urlJoin(space.webDavPath, path)
if (isTrash) {
webDavPath = buildWebDavSpacesTrashPath(space.id.toString())
}
webDavResources = await dav.propfind(webDavPath, {
depth,
headers,
properties: davProperties || DavProperties.Default
})
if (isTrash) {
return {
resource: buildResource(webDavResources[0]),
children: webDavResources.slice(1).map(buildDeletedResource)
} as ListFilesResult
}
const resources = webDavResources.map(buildResource)
if (fileId && fileId !== resources[0].fileId) {
return listFilesCorrectedPath()
}
return { resource: resources[0], children: resources.slice(1) } as ListFilesResult
} catch (e) {
if (e.statusCode === 404 && fileId) {
return listFilesCorrectedPath()
}
throw e
}
}
}
}
export interface ListFilesResult {
resource: Resource
children?: Resource[]
}
| owncloud/web/packages/web-client/src/webdav/listFiles.ts/0 | {
"file_path": "owncloud/web/packages/web-client/src/webdav/listFiles.ts",
"repo_id": "owncloud",
"token_count": 1967
} | 847 |
<template>
<div class="oc-flex oc-flex-middle oc-flex-center oc-height-1-1 oc-width-1-1">
<oc-spinner id="app-loading-spinner" size="large" :aria-hidden="true" aria-label="" />
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
export default defineComponent({
name: 'AppLoadingSpinner'
})
</script>
| owncloud/web/packages/web-pkg/src/components/AppLoadingSpinner.vue/0 | {
"file_path": "owncloud/web/packages/web-pkg/src/components/AppLoadingSpinner.vue",
"repo_id": "owncloud",
"token_count": 128
} | 848 |
<template>
<div id="ghost-element" class="ghost-element">
<div class="ghost-element-layer1 oc-rounded">
<resource-icon class="oc-p-xs" :resource="previewItems[0]" />
<div v-if="showSecondLayer" class="ghost-element-layer2 oc-rounded" />
<div v-if="showThirdLayer" class="ghost-element-layer3 oc-rounded" />
</div>
<span class="badge">{{ itemCount }}</span>
</div>
</template>
<script lang="ts">
import { defineComponent, PropType } from 'vue'
import { Resource } from '@ownclouders/web-client/src'
import ResourceIcon from './ResourceIcon.vue'
/**
* Please head to the ownCloud web ResourceTable component (https://github.com/owncloud/web/blob/master/packages/web-app-files/src/components/FilesList/ResourceTable.vue) for a demo of the Ghost Element.
*/
export default defineComponent({
name: 'ResourceGhostElement',
components: { ResourceIcon },
props: {
previewItems: {
type: Array as PropType<Resource[]>,
required: true
}
},
computed: {
layerCount() {
return Math.min(this.previewItems.length, 3)
},
showSecondLayer() {
return this.layerCount > 1
},
showThirdLayer() {
return this.layerCount > 2
},
itemCount() {
return this.previewItems.length
}
}
})
</script>
<style lang="scss">
.ghost-element-layer1 {
.ghost-element-layer2 {
position: absolute;
background-color: var(--oc-color-background-hover);
filter: brightness(0.82);
top: 3px;
left: 3px;
right: -3px;
bottom: -3px;
z-index: -1;
}
.ghost-element-layer3 {
position: absolute;
background-color: var(--oc-color-background-hover);
filter: brightness(0.72);
top: 6px;
left: 6px;
right: -6px;
bottom: -6px;
z-index: -2;
}
position: relative;
background-color: var(--oc-color-background-hover);
}
.ghost-element {
background-color: transparent;
padding-top: var(--oc-space-xsmall);
padding-left: 5px;
z-index: var(--oc-z-index-modal);
position: absolute;
.icon-wrapper {
position: relative;
}
.badge {
position: absolute;
top: -2px;
right: -8px;
padding: var(--oc-space-xsmall);
line-height: var(--oc-space-small);
-webkit-border-radius: 30px;
-moz-border-radius: 30px;
border-radius: 30px;
min-width: var(--oc-space-small);
height: var(--oc-space-small);
text-align: center;
font-size: 12px;
background: red;
color: white;
}
}
</style>
| owncloud/web/packages/web-pkg/src/components/FilesList/ResourceGhostElement.vue/0 | {
"file_path": "owncloud/web/packages/web-pkg/src/components/FilesList/ResourceGhostElement.vue",
"repo_id": "owncloud",
"token_count": 987
} | 849 |
<template>
<div v-if="isLoading" id="oc-loading-indicator">
<oc-progress
:max="100"
:indeterminate="currentProgress === null"
:value="currentProgress"
size="small"
/>
</div>
</template>
<script lang="ts">
import { defineComponent, onBeforeUnmount, onMounted, ref } from 'vue'
import { eventBus, LoadingEventTopics } from '../services'
import { useLoadingService } from '../composables'
export default defineComponent({
name: 'LoadingIndicator',
setup() {
const loadingService = useLoadingService()
let addLoadingEventToken
let removeLoadingEventToken
let setProgressToken
const isLoading = ref(loadingService.isLoading)
const currentProgress = ref(loadingService.currentProgress)
const updateLoadingState = () => {
currentProgress.value = loadingService.currentProgress
isLoading.value = loadingService.isLoading
}
const setProgress = () => {
currentProgress.value = loadingService.currentProgress
}
onMounted(() => {
addLoadingEventToken = eventBus.subscribe(LoadingEventTopics.add, updateLoadingState)
removeLoadingEventToken = eventBus.subscribe(LoadingEventTopics.remove, updateLoadingState)
setProgressToken = eventBus.subscribe(LoadingEventTopics.setProgress, setProgress)
})
onBeforeUnmount(() => {
eventBus.unsubscribe(LoadingEventTopics.add, addLoadingEventToken)
eventBus.unsubscribe(LoadingEventTopics.remove, removeLoadingEventToken)
eventBus.unsubscribe(LoadingEventTopics.setProgress, setProgressToken)
})
return { isLoading, currentProgress }
}
})
</script>
<style lang="scss">
#oc-loading-indicator {
z-index: 10;
position: absolute;
top: 0;
width: 100%;
.oc-progress {
background-color: transparent;
height: 4px;
&-primary div {
background-color: var(--oc-color-swatch-primary-gradient);
}
&-indeterminate-first {
animation-duration: 4s;
}
&-indeterminate-second {
animation-duration: 4s;
animation-delay: 1s;
}
}
}
</style>
| owncloud/web/packages/web-pkg/src/components/LoadingIndicator.vue/0 | {
"file_path": "owncloud/web/packages/web-pkg/src/components/LoadingIndicator.vue",
"repo_id": "owncloud",
"token_count": 721
} | 850 |
export { default as FileInfo } from './FileInfo.vue'
| owncloud/web/packages/web-pkg/src/components/SideBar/Files/index.ts/0 | {
"file_path": "owncloud/web/packages/web-pkg/src/components/SideBar/Files/index.ts",
"repo_id": "owncloud",
"token_count": 17
} | 851 |
export * from './AppBar'
export * from './AppTemplates'
export * from './ContextActions'
export * from './FilesList'
export * from './Filters'
export * from './Modals'
export * from './SideBar'
export * from './Search'
export * from './Spaces'
export { default as AppLoadingSpinner } from './AppLoadingSpinner.vue'
export { default as AppTopBar } from './AppTopBar.vue'
export { default as BatchActions } from './BatchActions.vue'
export { default as ItemFilter } from './ItemFilter.vue'
export { default as ItemFilterToggle } from './ItemFilterToggle.vue'
export { default as LinkRoleDropdown } from './LinkRoleDropdown.vue'
export { default as LoadingIndicator } from './LoadingIndicator.vue'
export { default as NoContentMessage } from './NoContentMessage.vue'
export { default as Pagination } from './Pagination.vue'
export { default as QuotaSelect } from './QuotaSelect.vue'
export { default as SpaceQuota } from './SpaceQuota.vue'
export { default as SearchBarFilter } from './SearchBarFilter.vue'
export { default as ViewOptions } from './ViewOptions.vue'
export { default as PortalTarget } from './PortalTarget.vue'
export { default as CreateShortcutModal } from './CreateShortcutModal.vue'
export { default as CreateLinkModal } from './CreateLinkModal.vue'
export { default as TextEditor } from './TextEditor.vue'
| owncloud/web/packages/web-pkg/src/components/index.ts/0 | {
"file_path": "owncloud/web/packages/web-pkg/src/components/index.ts",
"repo_id": "owncloud",
"token_count": 412
} | 852 |
import { isLocationTrashActive } from '../../../router'
import { SpaceResource } from '@ownclouders/web-client/src/helpers'
import { isProjectSpaceResource } from '@ownclouders/web-client/src/helpers'
import { computed } from 'vue'
import { useClientService } from '../../clientService'
import { useRouter } from '../../router'
import { useGettext } from 'vue3-gettext'
import { FileAction, FileActionOptions } from '../types'
import {
useMessages,
useModals,
useUserStore,
useCapabilityStore,
useResourcesStore
} from '../../piniaStores'
export const useFileActionsEmptyTrashBin = () => {
const { showMessage, showErrorMessage } = useMessages()
const userStore = useUserStore()
const capabilityStore = useCapabilityStore()
const router = useRouter()
const { $gettext } = useGettext()
const clientService = useClientService()
const { dispatchModal } = useModals()
const resourcesStore = useResourcesStore()
const emptyTrashBin = ({ space }: { space: SpaceResource }) => {
return clientService.webdav
.clearTrashBin(space)
.then(() => {
showMessage({ title: $gettext('All deleted files were removed') })
resourcesStore.clearResources()
resourcesStore.resetSelection()
})
.catch((error) => {
console.error(error)
showErrorMessage({
title: $gettext('Failed to empty trash bin'),
errors: [error]
})
})
}
const handler = ({ space }: FileActionOptions) => {
dispatchModal({
variation: 'danger',
title: $gettext('Empty trash bin'),
confirmText: $gettext('Delete'),
message: $gettext(
'Are you sure you want to permanently delete the listed items? You can’t undo this action.'
),
hasInput: false,
onConfirm: () => emptyTrashBin({ space })
})
}
const actions = computed((): FileAction[] => [
{
name: 'empty-trash-bin',
icon: 'delete-bin-5',
label: () => $gettext('Empty trash bin'),
handler,
isVisible: ({ space }) => {
if (!isLocationTrashActive(router, 'files-trash-generic')) {
return false
}
if (!capabilityStore.filesPermanentDeletion) {
return false
}
if (
isProjectSpaceResource(space) &&
!space.canRemoveFromTrashbin({ user: userStore.user })
) {
return false
}
return true
},
isDisabled: () => {
return resourcesStore.activeResources.length === 0
},
componentType: 'button',
class: 'oc-files-actions-empty-trash-bin-trigger',
variation: 'danger',
appearance: 'filled'
}
])
return {
actions,
// HACK: exported for unit tests:
emptyTrashBin
}
}
| owncloud/web/packages/web-pkg/src/composables/actions/files/useFileActionsEmptyTrashBin.ts/0 | {
"file_path": "owncloud/web/packages/web-pkg/src/composables/actions/files/useFileActionsEmptyTrashBin.ts",
"repo_id": "owncloud",
"token_count": 1080
} | 853 |
import { cloneStateObject } from '../../../helpers/store'
import { isSameResource } from '../../../helpers/resource'
import { Resource, SpaceResource } from '@ownclouders/web-client/src/helpers'
import PQueue from 'p-queue'
import { isLocationSpacesActive } from '../../../router'
import { dirname } from 'path'
import { createFileRouteOptions } from '../../../helpers'
import { computed, unref } from 'vue'
import { queryItemAsString } from '../../appDefaults'
import { useGetMatchingSpace } from '../../spaces'
import { useRouteQuery } from '../../router'
import { useLoadingService } from '../../loadingService'
import { useClientService } from '../../clientService'
import { useRouter } from '../../router'
import { useGettext } from 'vue3-gettext'
import { ref } from 'vue'
import {
useMessages,
useModals,
useSpacesStore,
useConfigStore,
useSharesStore,
useResourcesStore
} from '../../piniaStores'
import { storeToRefs } from 'pinia'
import { LoadingTaskCallbackArguments } from '../../../services'
export const useFileActionsDeleteResources = () => {
const configStore = useConfigStore()
const messageStore = useMessages()
const { showMessage, showErrorMessage } = messageStore
const router = useRouter()
const language = useGettext()
const { getMatchingSpace } = useGetMatchingSpace()
const { $gettext, $ngettext } = language
const clientService = useClientService()
const loadingService = useLoadingService()
const { dispatchModal } = useModals()
const spacesStore = useSpacesStore()
const sharesStore = useSharesStore()
const resourcesStore = useResourcesStore()
const { currentFolder } = storeToRefs(resourcesStore)
const queue = new PQueue({
concurrency: configStore.options.concurrentRequests.resourceBatchActions
})
const deleteOps = []
const resourcesToDelete = ref([])
const currentPageQuery = useRouteQuery('page', '1')
const currentPage = computed(() => {
return parseInt(queryItemAsString(unref(currentPageQuery)))
})
const itemsPerPageQuery = useRouteQuery('items-per-page', '1')
const itemsPerPage = computed(() => {
return parseInt(queryItemAsString(unref(itemsPerPageQuery)))
})
const resources = computed(() => {
return cloneStateObject(unref(resourcesToDelete))
})
const dialogTitle = computed(() => {
const currentResources = unref(resources)
const isFolder = currentResources[0].type === 'folder'
let title = null
if (currentResources.length === 1) {
if (isFolder) {
title = $gettext(
'Permanently delete folder %{name}',
{
name: currentResources[0].name
},
true
)
} else {
title = $gettext(
'Permanently delete file %{name}',
{
name: currentResources[0].name
},
true
)
}
return title
}
return $ngettext(
'Permanently delete selected resource?',
'Permanently delete %{amount} selected resources?',
currentResources.length,
{ amount: currentResources.length },
false
)
})
const dialogMessage = computed(() => {
const currentResources = unref(resources)
const isFolder = currentResources[0].type === 'folder'
if (currentResources.length === 1) {
if (isFolder) {
return $gettext(
'Are you sure you want to delete this folder? All its content will be permanently removed. This action cannot be undone.'
)
}
return $gettext(
'Are you sure you want to delete this file? All its content will be permanently removed. This action cannot be undone.'
)
}
return $gettext(
'Are you sure you want to delete all selected resources? All their content will be permanently removed. This action cannot be undone.'
)
})
const trashbin_deleteOp = (space: SpaceResource, resource: Resource) => {
return clientService.webdav
.clearTrashBin(space, {
id: resource.id
})
.then(() => {
resourcesStore.removeResources([resource])
resourcesStore.resetSelection()
const translated = $gettext(
'"%{file}" was deleted successfully',
{ file: resource.name },
true
)
showMessage({ title: translated })
})
.catch((error) => {
if (error.statusCode === 423) {
// TODO: we need a may retry option ....
const p = queue.add(() => {
return trashbin_deleteOp(space, resource)
})
deleteOps.push(p)
return
}
console.error(error)
const translated = $gettext('Failed to delete "%{file}"', { file: resource.name }, true)
showErrorMessage({
title: translated,
errors: [error]
})
})
}
const trashbin_delete = async (space: SpaceResource) => {
// TODO: use clear all if all files are selected
// FIXME: Implement proper batch delete and add loading indicator
for (const file of unref(resources)) {
const p = queue.add(() => {
return trashbin_deleteOp(space, file)
})
deleteOps.push(p)
}
await Promise.all(deleteOps)
}
const deleteFiles = ({
space,
files,
loadingCallbackArgs,
firstRun
}: {
space: SpaceResource
files: Resource[]
loadingCallbackArgs: LoadingTaskCallbackArguments
firstRun?: boolean
}) => {
const { setProgress } = loadingCallbackArgs
const promises = []
const removedFiles = []
for (const [i, file] of files.entries()) {
const promise = clientService.webdav
.deleteFile(space, file)
.then(() => {
removedFiles.push(file)
})
.catch((error) => {
let title = $gettext('Failed to delete "%{file}"', { file: file.name })
if (error.statusCode === 423) {
if (firstRun) {
return deleteFiles({ space, files: [file], loadingCallbackArgs, firstRun: false })
}
title = $gettext('Failed to delete "%{file}" - the file is locked', { file: file.name })
}
messageStore.showErrorMessage({ title, errors: [error] })
})
.finally(() => {
setProgress({ total: files.length, current: i + 1 })
})
promises.push(promise)
}
return Promise.all(promises).then(() => {
resourcesStore.removeResources(removedFiles)
resourcesStore.resetSelection()
sharesStore.pruneShares()
if (removedFiles.length) {
const title =
removedFiles.length === 1 && files.length === 1
? $gettext('"%{item}" was moved to trash bin', { item: removedFiles[0].name })
: $ngettext(
'%{itemCount} item was moved to trash bin',
'%{itemCount} items were moved to trash bin',
removedFiles.length,
{ itemCount: removedFiles.length.toString() },
true
)
messageStore.showMessage({ title })
}
})
}
const filesList_delete = (resources: Resource[]) => {
resourcesToDelete.value = [...resources]
const resourceSpaceMapping: Record<string, { space: SpaceResource; resources: Resource[] }> =
unref(resources).reduce((acc, resource) => {
if (resource.storageId in acc) {
acc[resource.storageId].resources.push(resource)
return acc
}
const matchingSpace = getMatchingSpace(resource)
if (!(matchingSpace.id in acc)) {
acc[matchingSpace.id] = { space: matchingSpace, resources: [] }
}
acc[matchingSpace.id].resources.push(resource)
return acc
}, {})
return Object.values(resourceSpaceMapping).map(
({ space: spaceForDeletion, resources: resourcesForDeletion }) => {
return loadingService.addTask(
(loadingCallbackArgs) => {
return deleteFiles({
space: spaceForDeletion,
files: resourcesForDeletion,
loadingCallbackArgs
}).then(async () => {
// Load quota
if (
isLocationSpacesActive(router, 'files-spaces-generic') &&
!['public', 'share'].includes(spaceForDeletion?.driveType)
) {
const graphClient = clientService.graphAuthenticated
const driveResponse = await graphClient.drives.getDrive(
unref(resources)[0].storageId
)
spacesStore.updateSpaceField({
id: driveResponse.data.id,
field: 'spaceQuota',
value: driveResponse.data.quota
})
}
if (
unref(resourcesToDelete).length &&
isSameResource(unref(resourcesToDelete)[0], unref(currentFolder))
) {
// current folder is being deleted
return router.push(
createFileRouteOptions(spaceForDeletion, {
path: dirname(unref(resourcesToDelete)[0].path),
fileId: unref(resourcesToDelete)[0].parentFolderId
})
)
}
const activeFilesCount = resourcesStore.activeResources.length
const pageCount = Math.ceil(unref(activeFilesCount) / unref(itemsPerPage))
if (unref(currentPage) > 1 && unref(currentPage) > pageCount) {
// reset pagination to avoid empty lists (happens when deleting all items on the last page)
currentPageQuery.value = pageCount.toString()
}
})
},
{ indeterminate: false }
)
}
)
}
const displayDialog = (space: SpaceResource, resources: Resource[]) => {
resourcesToDelete.value = [...resources]
dispatchModal({
variation: 'danger',
title: unref(dialogTitle),
message: unref(dialogMessage),
confirmText: $gettext('Delete'),
onConfirm: () => trashbin_delete(space)
})
}
return {
displayDialog,
// HACK: exported for unit tests:
filesList_delete
}
}
| owncloud/web/packages/web-pkg/src/composables/actions/helpers/useFileActionsDeleteResources.ts/0 | {
"file_path": "owncloud/web/packages/web-pkg/src/composables/actions/helpers/useFileActionsDeleteResources.ts",
"repo_id": "owncloud",
"token_count": 4188
} | 854 |
import { Resource, SpaceResource } from '@ownclouders/web-client/src'
import { Group, User } from '@ownclouders/web-client/src/generated'
import { RouteLocationRaw } from 'vue-router'
import { IconFillType } from '../../helpers'
export type ActionOptions = Record<string, unknown | unknown[]>
export interface Action<T = ActionOptions> {
name: string
icon: string
iconFillType?: IconFillType
variation?: string
appearance?: string
id?: string
img?: string
componentType: 'button' | 'router-link' // FIXME: Should be determined by handler/route
class?: string
hasPriority?: boolean
hideLabel?: boolean
shortcut?: string
keepOpen?: boolean
opensInNewWindow?: boolean
isExternal?: boolean
ext?: string
label(options?: T): string
isVisible(options?: T): boolean
// componentType: button
handler?(options?: T): Promise<void> | void
// componentType: router-link
route?(options?: T): RouteLocationRaw
// can be used to display the action in a disabled state in the UI
isDisabled?(options?: T): boolean
disabledTooltip?(options?: T): string
}
export type FileActionOptions<T extends Resource = Resource> = {
space: SpaceResource
resources?: T[]
}
export type FileAction<T extends Resource = Resource> = Action<FileActionOptions<T>>
export type GroupActionOptions = {
resources: Group[]
}
export type GroupAction = Action<GroupActionOptions>
export type SpaceActionOptions = {
resources?: SpaceResource[]
}
export type SpaceAction = Action<SpaceActionOptions>
export type UserActionOptions = {
resources: User[]
}
export type UserAction = Action<UserActionOptions>
| owncloud/web/packages/web-pkg/src/composables/actions/types.ts/0 | {
"file_path": "owncloud/web/packages/web-pkg/src/composables/actions/types.ts",
"repo_id": "owncloud",
"token_count": 457
} | 855 |
export * from './useAuthService'
export * from './useRequest'
| owncloud/web/packages/web-pkg/src/composables/authContext/index.ts/0 | {
"file_path": "owncloud/web/packages/web-pkg/src/composables/authContext/index.ts",
"repo_id": "owncloud",
"token_count": 19
} | 856 |
export * from './useEventBus'
| owncloud/web/packages/web-pkg/src/composables/eventBus/index.ts/0 | {
"file_path": "owncloud/web/packages/web-pkg/src/composables/eventBus/index.ts",
"repo_id": "owncloud",
"token_count": 10
} | 857 |
export * from './useLocalStorage'
| owncloud/web/packages/web-pkg/src/composables/localStorage/index.ts/0 | {
"file_path": "owncloud/web/packages/web-pkg/src/composables/localStorage/index.ts",
"repo_id": "owncloud",
"token_count": 10
} | 858 |
import { defineStore } from 'pinia'
import { v4 as uuidV4 } from 'uuid'
import { ref, unref } from 'vue'
export interface Message {
id: string
title: string
desc?: string
errors?: Error[]
errorLogContent?: string
timeout?: number
status?: string
}
export const useMessages = defineStore('messages', () => {
const messages = ref<Message[]>([])
const showMessage = (data: Omit<Message, 'id'>) => {
const message = { ...data, id: uuidV4() as string }
messages.value.push(message)
return message
}
const getXRequestIdsFromErrors = (errors: Message['errors']) => {
const getXRequestID = (error: any): string | null => {
/**
* x-request-id response headers might be very nested in ownCloud SDK,
* only remove records if you are sure they aren't valid anymore.
* FIXME: remove/simplify as soon as SDK has been removed
*/
if (error.response?.res?.res?.headers?.['x-request-id']) {
return error.response.res.res.headers['x-request-id']
}
if (error.response?.headers?.map?.['x-request-id']) {
return error.response.headers.map['x-request-id']
}
if (error.response?.res?.headers?.['x-request-id']) {
return error.response.res.headers['x-request-id']
}
if (error.response?.headers?.['x-request-id']) {
return error.response.headers['x-request-id']
}
return null
}
return errors
.map((error) => getXRequestID(error))
.filter((xRequestId) => xRequestId !== null)
.map((item) => `X-Request-Id: ${item}`)
.join('\r\n')
}
const showErrorMessage = (data: Omit<Message, 'id'>) => {
const message = {
id: uuidV4() as string,
status: 'danger',
timeout: 0,
...(data.errors && { errorLogContent: getXRequestIdsFromErrors(data.errors) }),
...data
}
messages.value.push(message)
return message
}
const removeMessage = (message: Message) => {
messages.value = unref(messages).filter(({ id }) => message.id !== id)
}
return {
messages,
showMessage,
showErrorMessage,
removeMessage
}
})
export type MessageStore = ReturnType<typeof useMessages>
| owncloud/web/packages/web-pkg/src/composables/piniaStores/messages.ts/0 | {
"file_path": "owncloud/web/packages/web-pkg/src/composables/piniaStores/messages.ts",
"repo_id": "owncloud",
"token_count": 861
} | 859 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.