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="M22 14.044A6 6 0 0 0 13.689 21H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h18a1 1 0 0 1 1 1v10.044zm-9.94-2.361L5.648 6.238 4.353 7.762l7.72 6.555 7.581-6.56-1.308-1.513-6.285 5.439zM19.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-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/mail-star-fill.svg", "repo_id": "owncloud", "token_count": 270 }
800
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M17.657 15.657L12 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-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/map-pin-5-fill.svg", "repo_id": "owncloud", "token_count": 133 }
801
<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 10zm5.051-3.796l-.862-3.447a1 1 0 0 0-.97-.757H8.781a1 1 0 0 0-.97.757l-.862 3.447A7.967 7.967 0 0 0 12 20a7.967 7.967 0 0 0 5.051-1.796zM10 12h4v-1.5l-1.038-3.635a1 1 0 0 0-1.924 0L10 10.5V12z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/markup-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/markup-fill.svg", "repo_id": "owncloud", "token_count": 248 }
802
<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-8zm-.53 5.763c-.684-.684-1.792-.684-2.475 0-.684.683-.684 1.791 0 2.474L11 13.243l3.005-3.006c.684-.683.684-1.791 0-2.474-.683-.684-1.791-.684-2.475 0l-.53.53-.53-.53z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/mental-health-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/mental-health-fill.svg", "repo_id": "owncloud", "token_count": 308 }
803
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M12 3a3 3 0 0 0-3 3v6a3 3 0 0 0 6 0V6a3 3 0 0 0-3-3zm0-2a5 5 0 0 1 5 5v6a5 5 0 0 1-10 0V6a5 5 0 0 1 5-5zM2.192 13.962l1.962-.393a8.003 8.003 0 0 0 15.692 0l1.962.393C20.896 18.545 16.85 22 12 22s-8.896-3.455-9.808-8.038z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/mic-2-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/mic-2-line.svg", "repo_id": "owncloud", "token_count": 226 }
804
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M3 3h18a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zm10 10v-1h3v-2h-2.586l2.122-2.121-1.415-1.415L12 8.586 9.879 6.464 8.464 7.88 10.586 10H8v2h3v1H8v2h3v2h2v-2h3v-2h-3z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/money-cny-box-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/money-cny-box-fill.svg", "repo_id": "owncloud", "token_count": 220 }
805
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M9.822 2.238a9 9 0 0 0 11.94 11.94C20.768 18.654 16.775 22 12 22 6.477 22 2 17.523 2 12c0-4.775 3.346-8.768 7.822-9.762zm8.342.053L19 2.5v1l-.836.209a2 2 0 0 0-1.455 1.455L16.5 6h-1l-.209-.836a2 2 0 0 0-1.455-1.455L13 3.5v-1l.836-.209A2 2 0 0 0 15.29.836L15.5 0h1l.209.836a2 2 0 0 0 1.455 1.455zm5 5L24 7.5v1l-.836.209a2 2 0 0 0-1.455 1.455L21.5 11h-1l-.209-.836a2 2 0 0 0-1.455-1.455L18 8.5v-1l.836-.209a2 2 0 0 0 1.455-1.455L20.5 5h1l.209.836a2 2 0 0 0 1.455 1.455z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/moon-clear-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/moon-clear-fill.svg", "repo_id": "owncloud", "token_count": 376 }
806
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M18.001 20H20v2h-8C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10a9.985 9.985 0 0 1-3.999 8zM12 10a2 2 0 1 0 0-4 2 2 0 0 0 0 4zm-4 4a2 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 4zm-4 4a2 2 0 1 0 0-4 2 2 0 0 0 0 4z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/movie-2-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/movie-2-fill.svg", "repo_id": "owncloud", "token_count": 223 }
807
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M19 22H5a3 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-2zM5 6v6h6V6H5zm0 7v2h10v-2H5zm0 3v2h10v-2H5zm2-8h2v2H7V8z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/newspaper-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/newspaper-fill.svg", "repo_id": "owncloud", "token_count": 213 }
808
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0H24V24H0z"/> <path d="M20 3c.552 0 1 .448 1 1v16c0 .552-.448 1-1 1H4c-.552 0-1-.448-1-1V4c0-.552.448-1 1-1h16zm-1 2H5v14h14V5zm-2 2v10h-2.5V9.5H12V17H7V7h10z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/npmjs-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/npmjs-line.svg", "repo_id": "owncloud", "token_count": 181 }
809
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M9.07 7L6 11.606V20h12V7H9.07zM8 5h11a1 1 0 0 1 1 1v15a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V11l4-6zm5-4h5a1 1 0 0 1 1 1v2h-7V2a1 1 0 0 1 1-1zM8 12h2v6H8v-6z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/oil-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/oil-line.svg", "repo_id": "owncloud", "token_count": 196 }
810
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M20 22H4a1 1 0 0 1-1-1V8h18v13a1 1 0 0 1-1 1zm1-16H3V3a1 1 0 0 1 1-1h16a1 1 0 0 1 1 1v3zM7 11v4h4v-4H7zm0 6v2h10v-2H7zm6-5v2h4v-2h-4z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/pages-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/pages-fill.svg", "repo_id": "owncloud", "token_count": 190 }
811
<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 2v14h14V5H5zm4 2h3.5a3.5 3.5 0 0 1 0 7H11v3H9V7zm2 2v3h1.5a1.5 1.5 0 0 0 0-3H11z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/parking-box-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/parking-box-line.svg", "repo_id": "owncloud", "token_count": 201 }
812
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M16.596 1.04l6.347 6.346a.5.5 0 0 1-.277.848l-1.474.23-5.656-5.656.212-1.485a.5.5 0 0 1 .848-.283zM4.595 20.15c3.722-3.331 7.995-4.328 12.643-5.52l.446-4.018-4.297-4.297-4.018.446c-1.192 4.648-2.189 8.92-5.52 12.643L2.454 18.01c2.828-3.3 3.89-6.953 5.303-13.081l6.364-.707 5.657 5.657-.707 6.364c-6.128 1.414-9.782 2.475-13.081 5.303L4.595 20.15zm5.284-6.03a2 2 0 1 1 2.828-2.828A2 2 0 0 1 9.88 14.12z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/pen-nib-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/pen-nib-line.svg", "repo_id": "owncloud", "token_count": 338 }
813
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M18 2a1 1 0 0 1 1 1v7h-2V4H7v16h5v2H6a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1h12zm0 10a3 3 0 0 1 3 3v1h1v5a1 1 0 0 1-1 1h-6a1 1 0 0 1-1-1v-5h1v-1a3 3 0 0 1 3-3zm2 6h-4v2h4v-2zm-2-4c-.508 0-1 .45-1 1v1h2v-1a1 1 0 0 0-1-1z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/phone-lock-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/phone-lock-line.svg", "repo_id": "owncloud", "token_count": 245 }
814
<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="M11.5 2a9.5 9.5 0 0 1 9.5 9.5 9.46 9.46 0 0 1-1.003 4.254l2.463 2.464a1 1 0 0 1 0 1.414l-2.828 2.828a1 1 0 0 1-1.414 0l-2.464-2.463A9.46 9.46 0 0 1 11.5 21a9.5 9.5 0 0 1 0-19zm5.303 13.388l-1.414 1.414 3.536 3.535 1.414-1.414-3.536-3.535zm1.864-6.105l-9.384 9.384c.7.216 1.445.333 2.217.333a7.48 7.48 0 0 0 2.74-.516l-.972-.974a1 1 0 0 1 0-1.414l2.828-2.828a1 1 0 0 1 1.414 0l.974.972A7.48 7.48 0 0 0 19 11.5c0-.772-.117-1.516-.333-2.217zM11.5 4a7.5 7.5 0 0 0-4.136 13.757L17.757 7.364A7.493 7.493 0 0 0 11.5 4z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/ping-pong-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/ping-pong-line.svg", "repo_id": "owncloud", "token_count": 410 }
815
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M2 18h10v2H2v-2zm0-7h20v2H2v-2zm0-7h20v2H2V4zm16 14v-3h2v3h3v2h-3v3h-2v-3h-3v-2h3z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/play-list-add-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/play-list-add-fill.svg", "repo_id": "owncloud", "token_count": 162 }
816
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M22 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-.5h1.929L4.48 6.212A2 2 0 0 1 6.319 5H8V3h3v2h2V3h3v2h1.681a2 2 0 0 1 1.838 1.212L21.571 11H23.5a.5.5 0 0 1 .5.5v.72a1 1 0 0 1-.757.97L22 13.5zM4 15v2a1 1 0 0 0 1 1h3.245a.5.5 0 0 0 .44-.736C7.88 15.754 6.318 15 4 15zm16 0c-2.317 0-3.879.755-4.686 2.264a.5.5 0 0 0 .441.736H19a1 1 0 0 0 1-1v-2zM6 7l-1.451 3.629A1 1 0 0 0 5.477 12h13.046a1 1 0 0 0 .928-1.371L18 7H6z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/police-car-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/police-car-fill.svg", "repo_id": "owncloud", "token_count": 414 }
817
<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-1h9.81a6.481 6.481 0 0 1 4.69-2c1.843 0 3.507.767 4.69 2H22a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1zm-5.5-5a4.5 4.5 0 1 0 0-9 4.5 4.5 0 0 0 0 9zm0-2a2.5 2.5 0 1 1 0-5 2.5 2.5 0 0 1 0 5zM4 13v2h2v-2H4zm4 0v2h2v-2H8z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/projector-2-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/projector-2-fill.svg", "repo_id": "owncloud", "token_count": 272 }
818
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M15 3h6v6h-6V3zM9 3v6H3V3h6zm6 18v-6h6v6h-6zm-6 0H3v-6h6v6zM3 11h18v2H3v-2z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/qr-scan-2-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/qr-scan-2-fill.svg", "repo_id": "owncloud", "token_count": 154 }
819
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M6 3V1h2v2h13.008c.548 0 .992.445.992.993v16.014a1 1 0 0 1-.992.993H2.992A.993.993 0 0 1 2 20.007V3.993A1 1 0 0 1 2.992 3H6zM4 5v14h16V5H4zm5 10a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm5-6h4v2h-4V9zm0 4h4v2h-4v-2z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/radio-2-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/radio-2-line.svg", "repo_id": "owncloud", "token_count": 220 }
820
<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="M18 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1h12zm-1 2H7v16h10V4zm-2 11v2h-2v-2h2zm-4 0v2H9v-2h2zm2-9v2h2v2h-2.001L13 12h-2l-.001-2H9V8h2V6h2z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/remote-control-2-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/remote-control-2-line.svg", "repo_id": "owncloud", "token_count": 222 }
821
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"> <!-- MIT License: https://opensource.org/licenses/MIT --> <!-- author: https://github.com/elizavetaRa --> <!-- author: https://github.com/javfg --> <g> <path d="m 37.423886,409.76833 c 8.814712,-6.95646 120.222434,-71.85964 120.222434,-71.85964 l 27.07357,54.07055 25.81395,-157.15224 155.26367,5.7784 -143.93042,5.28848 L 193.22,444.46886 150.0905,358.7781 Z M 224,136 V 0 H 24 C 10.7,0 0,10.7 0,24 v 464 c 0,13.3 10.7,24 24,24 h 336 c 13.3,0 24,-10.7 24,-24 V 160 H 248 c -13.2,0 -24,-10.8 -24,-24 z M 384,121.9 V 128 H 256 V 0 h 6.1 c 6.4,0 12.5,2.5 17,7 l 97.9,98 c 4.5,4.5 7,10.6 7,16.9 z" /> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/resource-type-root-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/resource-type-root-fill.svg", "repo_id": "owncloud", "token_count": 355 }
822
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M9 9.86L5.968 12 9 14.14V9.86zm1.908 7.463a.5.5 0 0 1-.696.12l-7.133-5.035a.5.5 0 0 1 0-.816l7.133-5.036a.5.5 0 0 1 .788.409v10.07a.5.5 0 0 1-.092.288zM18 14.14V9.86L14.968 12 18 14.14zm-5.921-1.732a.5.5 0 0 1 0-.816l7.133-5.036a.5.5 0 0 1 .788.409v10.07a.5.5 0 0 1-.788.409l-7.133-5.036z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/rewind-mini-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/rewind-mini-line.svg", "repo_id": "owncloud", "token_count": 277 }
823
<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 10 0 2.136-.67 4.116-1.811 5.741L17 12h3a8 8 0 1 0-2.46 5.772l.998 1.795A9.961 9.961 0 0 1 12 22C6.477 22 2 17.523 2 12S6.477 2 12 2zm0 5a3 3 0 0 1 3 3v1h1v5H8v-5h1v-1a3 3 0 0 1 3-3zm2 6h-4v1h4v-1zm-2-4a1 1 0 0 0-.993.883L11 10v1h2v-1a1 1 0 0 0-.883-.993L12 9z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/rotate-lock-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/rotate-lock-line.svg", "repo_id": "owncloud", "token_count": 267 }
824
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M10 20H6v2H4v-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.333V22h-2v-1.333l-7.418 1.236A.5.5 0 0 1 10 21.41V20zm2-.36l8-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-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/safe-2-fill.svg", "repo_id": "owncloud", "token_count": 318 }
825
<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.343zm0 2.829l-1.414 1.414C17.212 10.96 17 11.46 17 12l4 .001c0-.54-.212-1.041-.586-1.415L19 9.172zm-14 0l-1.414 1.414C3.212 10.96 3 11.46 3 12l4 .001c0-.54-.212-1.041-.586-1.415L5 9.172z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/scales-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/scales-fill.svg", "repo_id": "owncloud", "token_count": 386 }
826
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M4.293 6.707L9 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 5v4h2V5h-2zm-3 0v4h2V5h-2zM9 5v4h2V5H9z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/sd-card-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/sd-card-fill.svg", "repo_id": "owncloud", "token_count": 185 }
827
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M3.741 1.408l18.462 10.154a.5.5 0 0 1 0 .876L3.741 22.592A.5.5 0 0 1 3 22.154V1.846a.5.5 0 0 1 .741-.438zM5 13v6.617L18.85 12 5 4.383V11h5v2H5z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/send-plane-2-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/send-plane-2-line.svg", "repo_id": "owncloud", "token_count": 179 }
828
<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-6h2v5zm8-9H9a5.992 5.992 0 0 0-4.854 2.473A8.003 8.003 0 0 1 12 6V2l8 6-8 6v-4z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/share-forward-2-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/share-forward-2-fill.svg", "repo_id": "owncloud", "token_count": 177 }
829
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M7 8V6a5 5 0 1 1 10 0v2h3a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h3zm0 2H5v10h14V10h-2v2h-2v-2H9v2H7v-2zm2-2h6V6a3 3 0 0 0-6 0v2z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/shopping-bag-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/shopping-bag-line.svg", "repo_id": "owncloud", "token_count": 202 }
830
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0H24V24H0z"/> <path d="M2.808 1.393l17.677 17.678-1.414 1.414-3.683-3.682L12 21 .69 6.997c.914-.74 1.902-1.391 2.95-1.942L1.394 2.808l1.415-1.415zm.771 5.999L12 17.817l1.967-2.437-8.835-8.836c-.532.254-1.05.536-1.552.848zM12 3c4.284 0 8.22 1.497 11.31 3.996l-5.407 6.693-1.422-1.422 3.939-4.876C17.922 5.841 15.027 5 12 5c-.873 0-1.735.07-2.58.207L7.725 3.51C9.094 3.177 10.527 3 12 3z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/signal-wifi-off-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/signal-wifi-off-line.svg", "repo_id": "owncloud", "token_count": 315 }
831
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M12.032 12L9 9.86v4.28L12.032 12zM7.5 17.535a.5.5 0 0 1-.5-.5V6.965a.5.5 0 0 1 .788-.409l7.133 5.036a.5.5 0 0 1 0 .816l-7.133 5.036a.5.5 0 0 1-.288.091zM16 7a1 1 0 0 1 2 0v10a1 1 0 1 1-2 0V7z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/skip-forward-mini-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/skip-forward-mini-line.svg", "repo_id": "owncloud", "token_count": 211 }
832
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M8.17 3A3.001 3.001 0 0 1 11 1h2c1.306 0 2.417.835 2.83 2H21a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5.17zM4 5v14h16V5h-4.17A3.001 3.001 0 0 1 13 7h-2a3.001 3.001 0 0 1-2.83-2H4zm7-2a1 1 0 0 0 0 2h2a1 1 0 0 0 0-2h-2zm-1 6l5 3-5 3V9z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/slideshow-4-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/slideshow-4-line.svg", "repo_id": "owncloud", "token_count": 259 }
833
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M2.88 18.054a35.897 35.897 0 0 1 8.531-16.32.8.8 0 0 1 1.178 0c.166.18.304.332.413.455a35.897 35.897 0 0 1 8.118 15.865c-2.141.451-4.34.747-6.584.874l-2.089 4.178a.5.5 0 0 1-.894 0l-2.089-4.178a44.019 44.019 0 0 1-6.584-.874zm6.698-1.123l1.157.066L12 19.527l1.265-2.53 1.157-.066a42.137 42.137 0 0 0 4.227-.454A33.913 33.913 0 0 0 12 4.09a33.913 33.913 0 0 0-6.649 12.387c1.395.222 2.805.374 4.227.454zM12 15a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0-2a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/space-ship-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/space-ship-line.svg", "repo_id": "owncloud", "token_count": 369 }
834
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M12 13.333l-9.223 6.149A.5.5 0 0 1 2 19.066V4.934a.5.5 0 0 1 .777-.416L12 10.667V4.934a.5.5 0 0 1 .777-.416l10.599 7.066a.5.5 0 0 1 0 .832l-10.599 7.066a.5.5 0 0 1-.777-.416v-5.733z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/speed-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/speed-fill.svg", "repo_id": "owncloud", "token_count": 200 }
835
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M12 18.26l-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.928z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/star-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/star-fill.svg", "repo_id": "owncloud", "token_count": 155 }
836
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0H24V24H0z"/> <path d="M8 3v2H6v4c0 2.21 1.79 4 4 4s4-1.79 4-4V5h-2V3h3c.552 0 1 .448 1 1v5c0 2.973-2.162 5.44-5 5.917V16.5c0 1.933 1.567 3.5 3.5 3.5 1.497 0 2.775-.94 3.275-2.263C16.728 17.27 16 16.22 16 15c0-1.657 1.343-3 3-3s3 1.343 3 3c0 1.371-.92 2.527-2.176 2.885C19.21 20.252 17.059 22 14.5 22 11.462 22 9 19.538 9 16.5v-1.583C6.162 14.441 4 11.973 4 9V4c0-.552.448-1 1-1h3z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/stethoscope-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/stethoscope-fill.svg", "repo_id": "owncloud", "token_count": 309 }
837
<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-6H5zm1 1h8v3H6v-3zM3 3h18v2H3V3z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/store-3-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/store-3-fill.svg", "repo_id": "owncloud", "token_count": 175 }
838
<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-1h6zm-6 9H7v8h2v-8zm4 0h-2v8h2v-8zm4 0h-2v8h2v-8zm-3-7h-4v4h4V3z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/suitcase-3-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/suitcase-3-fill.svg", "repo_id": "owncloud", "token_count": 263 }
839
<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="M6 4v4h12V4h2.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 4H6zm3 13H7v2h2v-2zm0-3H7v2h2v-2zm0-3H7v2h2v-2zm7-9v4H8V2h8z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/survey-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/survey-fill.svg", "repo_id": "owncloud", "token_count": 221 }
840
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M10.83 13h2.34A3 3 0 1 1 16 15H8a3 3 0 1 1 2.83-2zM4 5v14h16V5H4zM3 3h18a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zm5 10a1 1 0 1 0 0-2 1 1 0 0 0 0 2zm8 0a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/tape-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/tape-line.svg", "repo_id": "owncloud", "token_count": 219 }
841
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M3 3h18a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zm1 2v14h16V5H4zm8 10h6v2h-6v-2zm-3.333-3L5.838 9.172l1.415-1.415L11.495 12l-4.242 4.243-1.415-1.415L8.667 12z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/terminal-box-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/terminal-box-line.svg", "repo_id": "owncloud", "token_count": 212 }
842
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M2 9h3v12H2a1 1 0 0 1-1-1V10a1 1 0 0 1 1-1zm5.293-1.293l6.4-6.4a.5.5 0 0 1 .654-.047l.853.64a1.5 1.5 0 0 1 .553 1.57L14.6 8H21a2 2 0 0 1 2 2v2.104a2 2 0 0 1-.15.762l-3.095 7.515a1 1 0 0 1-.925.619H8a1 1 0 0 1-1-1V8.414a1 1 0 0 1 .293-.707z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/thumb-up-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/thumb-up-fill.svg", "repo_id": "owncloud", "token_count": 244 }
843
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M17 2h3a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1h3V0h2v2h6V0h2v2zM7 8v2h10V8H7zm0 4v2h10v-2H7z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/todo-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/todo-fill.svg", "repo_id": "owncloud", "token_count": 177 }
844
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M18.5 10l4.4 11h-2.155l-1.201-3h-4.09l-1.199 3h-2.154L16.5 10h2zM10 2v2h6v2h-1.968a18.222 18.222 0 0 1-3.62 6.301 14.864 14.864 0 0 0 2.336 1.707l-.751 1.878A17.015 17.015 0 0 1 9 13.725a16.676 16.676 0 0 1-6.201 3.548l-.536-1.929a14.7 14.7 0 0 0 5.327-3.042A18.078 18.078 0 0 1 4.767 8h2.24A16.032 16.032 0 0 0 9 10.877a16.165 16.165 0 0 0 2.91-4.876L2 6V4h6V2h2zm7.5 10.885L16.253 16h2.492L17.5 12.885z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/translate-2.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/translate-2.svg", "repo_id": "owncloud", "token_count": 332 }
845
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M15.414 5h5.594c.548 0 .992.445.992 1v14c0 .552-.455 1-.992 1H2.992A.994.994 0 0 1 2 20V6c0-.552.455-1 .992-1h5.594L6.05 2.464 7.464 1.05 11.414 5h1.172l3.95-3.95 1.414 1.414L15.414 5z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/tv-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/tv-fill.svg", "repo_id": "owncloud", "token_count": 193 }
846
<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="M8 2v2H5l-.001 10h14L19 4h-3V2h4a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1h4zm10.999 14h-14L5 20h14l-.001-4zM17 17v2h-2v-2h2zM12 2l4 4h-3v5h-2V6H8l4-4z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/uninstall-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/uninstall-line.svg", "repo_id": "owncloud", "token_count": 219 }
847
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M20 22h-2v-2a3 3 0 0 0-3-3H9a3 3 0 0 0-3 3v2H4v-2a5 5 0 0 1 5-5h6a5 5 0 0 1 5 5v2zm-8-9a6 6 0 1 1 0-12 6 6 0 0 1 0 12zm0-2a4 4 0 1 0 0-8 4 4 0 0 0 0 8z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/user-3-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/user-3-line.svg", "repo_id": "owncloud", "token_count": 190 }
848
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M12 14v2a6 6 0 0 0-6 6H4a8 8 0 0 1 8-8zm0-1c-3.315 0-6-2.685-6-6s2.685-6 6-6 6 2.685 6 6-2.685 6-6 6zm0-2c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm8.828 10.071L18 24l-2.828-2.929c-1.563-1.618-1.563-4.24 0-5.858a3.904 3.904 0 0 1 5.656 0c1.563 1.618 1.563 4.24 0 5.858zm-1.438-1.39c.813-.842.813-2.236 0-3.078a1.904 1.904 0 0 0-2.78 0c-.813.842-.813 2.236 0 3.079L18 21.12l1.39-1.44z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/user-location-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/user-location-line.svg", "repo_id": "owncloud", "token_count": 360 }
849
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M12 14v2a6 6 0 0 0-6 6H4a8 8 0 0 1 8-8zm0-1c-3.315 0-6-2.685-6-6s2.685-6 6-6 6 2.685 6 6-2.685 6-6 6zm0-2c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm6 10.5l-2.939 1.545.561-3.272-2.377-2.318 3.286-.478L18 14l1.47 2.977 3.285.478-2.377 2.318.56 3.272L18 21.5z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/user-star-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/user-star-line.svg", "repo_id": "owncloud", "token_count": 268 }
850
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M13 6V4H5V2h10v4h1a1 1 0 0 1 1 1v2.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-1V7a1 1 0 0 1 1-1h11zm2 2H3v10h12V8zm2 4.359l4 2.8V8.84l-4 2.8v.718zM5 10h2v2H5v-2z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/vidicon-2-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/vidicon-2-line.svg", "repo_id": "owncloud", "token_count": 242 }
851
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M3.316 3L12 18l8.684-15H23L12 22 1 3h2.316zm4.342 0L12 10.5 16.342 3h2.316L12 14.5 5.342 3h2.316z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/vuejs-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/vuejs-line.svg", "repo_id": "owncloud", "token_count": 146 }
852
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`OcAvatarCount > dynamically calculates font size 1`] = `"<span class="oc-avatar-count" style="width: 100px; height: 100px; font-size: 40px;">+2</span>"`;
owncloud/web/packages/design-system/src/components/OcAvatarCount/__snapshots__/OcAvatarCount.spec.ts.snap/0
{ "file_path": "owncloud/web/packages/design-system/src/components/OcAvatarCount/__snapshots__/OcAvatarCount.spec.ts.snap", "repo_id": "owncloud", "token_count": 83 }
853
import OcCheckbox from './OcCheckbox.vue' import { mount } from 'web-test-helpers' describe('OcCheckbox', () => { function getWrapperWithProps(props) { return mount(OcCheckbox, { props: { label: 'test label', ...props } }) } const checkboxSelector = "input[type='checkbox']" describe('input id', () => { it('should set the provided id for the input', () => { const wrapper = getWrapperWithProps({ id: 'test-id' }) const checkBoxElement = wrapper.find(checkboxSelector) expect(checkBoxElement.exists()).toBeTruthy() expect(checkBoxElement.attributes('id')).toBe('test-id') }) }) describe('input label', () => { it('should set the provided label for the input', () => { const wrapper = getWrapperWithProps({ id: 'test-id' }) const checkBoxLabelElement = wrapper.find('label') expect(checkBoxLabelElement.exists()).toBeTruthy() expect(checkBoxLabelElement.attributes('for')).toBe('test-id') expect(checkBoxLabelElement.text()).toBe('test label') }) it("should hide label if 'hideLabel' prop is enabled", () => { const wrapper = getWrapperWithProps({ hideLabel: true }) const checkBoxLabelElement = wrapper.find('label') expect(checkBoxLabelElement.exists()).toBeTruthy() expect(checkBoxLabelElement.attributes('class')).toContain('oc-invisible-sr') }) it('should have cursor pointer property if not disabled', () => { const wrapper = getWrapperWithProps({ disabled: false }) const checkBoxLabelElement = wrapper.find('label') expect(checkBoxLabelElement.exists()).toBeTruthy() expect(checkBoxLabelElement.attributes('class')).toContain('oc-cursor-pointer') }) }) describe('input size', () => { it.each([ { size: 'small', class: 'oc-checkbox-s' }, { size: 'medium', class: 'oc-checkbox-m' }, { size: 'large', class: 'oc-checkbox-l' } ])('valid size options', (item) => { const wrapper = getWrapperWithProps({ size: item.size }) const checkboxElement = wrapper.find<HTMLInputElement>(checkboxSelector) expect(checkboxElement.exists()).toBeTruthy() expect(checkboxElement.attributes('class')).toContain(item.class) }) }) describe('set checked', () => { it('should set check on input change', async () => { const wrapper = await getWrapperWithProps({}) const checkbox = wrapper.find<HTMLInputElement>(checkboxSelector) expect(checkbox.element.checked).toBeFalsy() await checkbox.setValue(true) expect(wrapper.emitted('update:modelValue')).toBeTruthy() expect(checkbox.element.checked).toBeTruthy() }) }) describe('set outline', () => { it('should show outline', async () => { const wrapper = await getWrapperWithProps({ outline: true }) const checkbox = wrapper.find(`${checkboxSelector}.oc-checkbox-outline`) expect(checkbox.exists()).toBeTruthy() }) }) })
owncloud/web/packages/design-system/src/components/OcCheckbox/OcCheckbox.spec.ts/0
{ "file_path": "owncloud/web/packages/design-system/src/components/OcCheckbox/OcCheckbox.spec.ts", "repo_id": "owncloud", "token_count": 1106 }
854
import OcHiddenAnnouncer from './OcHiddenAnnouncer.vue' import { mount } from 'web-test-helpers' describe('OcHiddenAnnouncer', () => { function getWrapper(props = {}) { return mount(OcHiddenAnnouncer, { props: { announcement: 'Hidden announcer (please inspect element)', ...props } }) } describe('level', () => { it.each(['polite', 'assertive', 'off'])( 'should set the provided label as aria live', (level) => { const wrapper = getWrapper({ level: level }) expect(wrapper.attributes('aria-live')).toBe(level) } ) }) describe('announcement', () => { it('should render the provided announcement text', () => { const wrapper = getWrapper() expect(wrapper.text()).toBe('Hidden announcer (please inspect element)') }) }) })
owncloud/web/packages/design-system/src/components/OcHiddenAnnouncer/OcHiddenAnnouncer.spec.ts/0
{ "file_path": "owncloud/web/packages/design-system/src/components/OcHiddenAnnouncer/OcHiddenAnnouncer.spec.ts", "repo_id": "owncloud", "token_count": 322 }
855
import OcNotificationMessage from './OcNotificationMessage.vue' import { defaultPlugins, mount } from 'web-test-helpers' describe('OcNotificationMessage', () => { beforeEach(() => { vi.useFakeTimers() }) afterEach(() => { vi.useRealTimers() }) describe('title prop', () => { it('should set notification message title', () => { const wrapper = getWrapper() expect(wrapper.find(selectors.messageTitle).text()).toBe('Test passed') }) }) describe('message prop', () => { it('should render message, if message is provided', () => { const wrapper = getWrapper({ message: 'This is a test notification message' }) const messageEl = wrapper.find(selectors.messageContent) expect(messageEl.exists()).toBeTruthy() expect(messageEl.text()).toBe('This is a test notification message') }) it('should not render message, if message is not provided', () => { const wrapper = getWrapper({}) const messageEl = wrapper.find(selectors.messageContent) expect(messageEl.exists()).toBeFalsy() }) }) describe('status prop', () => { it('should not allow values other than passive, primary, success, warning, danger', () => { expect(OcNotificationMessage.props.status.validator('invalid')).toBeFalsy() }) it.each(['passive', 'primary', 'success', 'warning', 'danger'])( 'should set provided status as class for wrapper', (status) => { const wrapper = getWrapper({ status: status }) expect(wrapper.attributes('class')).toContain(`oc-notification-message-${status}`) } ) it('should set status as icon variation', () => { const wrapper = getWrapper({ status: 'primary' }) const iconElement = wrapper.find('oc-icon-stub') expect(iconElement.exists()).toBeTruthy() expect(iconElement.attributes('variation')).toBe('primary') }) describe('role and aria live of message content wrapper', () => { it("should set role as 'status' and aria-live as 'polite' if status is not danger", () => { const wrapper = getWrapper({}) const messageContentEl = wrapper.find(selectors.messageWrapper) expect(messageContentEl.attributes('role')).toBe('status') expect(messageContentEl.attributes('aria-live')).toBe('polite') }) it("should set role as 'alert' and aria-live as 'assertive' if status is danger", () => { const wrapper = getWrapper({ status: 'danger' }) const messageContentEl = wrapper.find(selectors.messageWrapper) expect(messageContentEl.attributes('role')).toBe('alert') expect(messageContentEl.attributes('aria-live')).toBe('assertive') }) }) }) describe('errorLogContent prop', () => { it('should render OcErrorLogComponent, if errorLogContent is provided', async () => { const wrapper = getWrapper({ errorLogContent: 'X-REQUEST-ID: 1234' }) const errorLogToggleButtonEl = wrapper.find(selectors.errorLogToggleButton) expect(errorLogToggleButtonEl.exists()).toBeTruthy() await errorLogToggleButtonEl.trigger('click') const errorLogEl = wrapper.find(selectors.errorLog) expect(errorLogEl.exists()).toBeTruthy() }) it('should not render OcErrorLogComponent, if errorLogContent is not provided', () => { const wrapper = getWrapper() const errorLogToggleButtonEl = wrapper.find(selectors.errorLogToggleButton) expect(errorLogToggleButtonEl.exists()).toBeFalsy() }) }) it('should emit close after set timout', () => { const wrapper = getWrapper({ timeout: 1 }) expect(wrapper.emitted('close')).toBeFalsy() vi.advanceTimersByTime(1000) expect(wrapper.emitted('close')).toBeTruthy() }) const selectors = { messageTitle: '.oc-notification-message-title', messageContent: '.oc-notification-message-content', messageWrapper: '.oc-notification-message div', errorLog: '.oc-error-log', errorLogToggleButton: '.oc-notification-message-error-log-toggle-button' } function getWrapper(props = {}) { return mount(OcNotificationMessage, { props: { ...props, title: 'Test passed' }, global: { stubs: { 'oc-icon': true }, plugins: defaultPlugins() } }) } })
owncloud/web/packages/design-system/src/components/OcNotificationMessage/OcNotificationMessage.spec.ts/0
{ "file_path": "owncloud/web/packages/design-system/src/components/OcNotificationMessage/OcNotificationMessage.spec.ts", "repo_id": "owncloud", "token_count": 1580 }
856
export type Recipient = { name: string icon?: { name: string label: string } isLoadingAvatar?: boolean hasAvatar?: boolean avatar?: string }
owncloud/web/packages/design-system/src/components/OcRecipient/types.ts/0
{ "file_path": "owncloud/web/packages/design-system/src/components/OcRecipient/types.ts", "repo_id": "owncloud", "token_count": 56 }
857
<template> <component :is="type" :class="$_ocTag_class" :to="to" @click="$_ocTag_click"> <!-- @slot Content of the tag --> <slot /> </component> </template> <script lang="ts"> import { defineComponent } from 'vue' import { getSizeClass } from '../../utils/sizeClasses' export default defineComponent({ name: 'OcTag', status: 'ready', release: '2.0.0', props: { /** * Specify which component should be used for the tag. * Can be `span`, `button`, `router-link` or `a`. */ type: { type: String, required: false, default: 'span', validator: (type: string) => ['span', 'button', 'router-link', 'a'].includes(type) }, /** * Target of the router link */ to: { type: [String, Object], required: false, default: null }, /** * The size of the tag. Defaults to medium. * `small, medium, large` */ size: { type: String, default: 'medium', validator: (value: string) => { return ['small', 'medium', 'large'].includes(value) } }, /** * Enables fully rounded borders */ rounded: { type: Boolean, default: false, required: false } }, emits: ['click'], computed: { $_ocTag_class() { const classes = ['oc-tag', `oc-tag-${getSizeClass(this.size)}`] this.type === 'router-link' || this.type === 'a' ? classes.push('oc-tag-link') : classes.push(`oc-tag-${this.type}`) if (this.rounded) { classes.push('oc-tag-rounded') } return classes } }, methods: { $_ocTag_click(event) { /** * Emitted as soon as the user clicks on the tag * @type {event} */ this.$emit('click', event) } } }) </script> <style lang="scss"> .oc-tag { align-items: center; background-color: var(--oc-color-background-default); border: 1px solid var(--oc-color-text-muted); border-radius: 7px; box-sizing: border-box; color: var(--oc-color-text-muted); display: inline-flex; gap: var(--oc-space-xsmall); text-decoration: none; &-s { font-size: 0.75rem; padding: var(--oc-space-xsmall); } &-m { font-size: 0.875rem; min-height: 2.125rem; padding: var(--oc-space-xsmall) var(--oc-space-small); } &-l { font-size: 1.5rem; min-height: 2.75rem; padding: var(--oc-space-small) var(--oc-space-medium); } &-rounded { border-radius: 99px; padding-left: var(--oc-space-small); padding-right: var(--oc-space-small); } .oc-icon > svg { fill: var(--oc-color-text-muted); } &-link, &-button { transition: color $transition-duration-short ease-in-out; .oc-icon > svg { transition: fill $transition-duration-short ease-in-out; } &:hover, &:focus { color: var(--oc-color-swatch-primary-hover); cursor: pointer; text-decoration: none; .oc-icon > svg { fill: var(--oc-color-swatch-primary-hover); } } } } </style> <docs> Component to display various information. ```js <oc-tag> <oc-icon name="links" /> Shared via link </oc-tag> ``` ## Different sizes of the tag component ```js <div> <oc-tag size="small"> <oc-icon name="links" size="small" /> Small tag </oc-tag> <oc-tag size="medium"> <oc-icon name="links" size="medium" /> Medium tag </oc-tag> <oc-tag size="large"> <oc-icon name="links" size="large" /> Large tag </oc-tag> </div> ``` ## Different types of the tag component The tag component can be rendered as a different element if desired. You can specify such element via property `type`. ```js <oc-grid gutter="small" flex="true"> <oc-tag class="oc-mr-s"> <oc-icon name="group" /> Shared with other people </oc-tag> <oc-tag class="oc-mr-s" type="a"> <oc-icon name="links" /> Shared via link </oc-tag> <oc-tag class="oc-mr-s" type="button">Expires in 2 days</oc-tag> </oc-grid> ``` </docs>
owncloud/web/packages/design-system/src/components/OcTag/OcTag.vue/0
{ "file_path": "owncloud/web/packages/design-system/src/components/OcTag/OcTag.vue", "repo_id": "owncloud", "token_count": 1723 }
858
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`OcTableCell > Uses correct element 1`] = `"<th class="oc-table-cell oc-table-cell-align-right oc-table-cell-align-bottom oc-table-cell-width-shrink">Hello world!</th>"`;
owncloud/web/packages/design-system/src/components/_OcTableCell/__snapshots__/OcTableCell.spec.ts.snap/0
{ "file_path": "owncloud/web/packages/design-system/src/components/_OcTableCell/__snapshots__/OcTableCell.spec.ts.snap", "repo_id": "owncloud", "token_count": 92 }
859
export const EVENT_THEAD_CLICKED = 'thead-clicked' as const export const EVENT_TROW_CLICKED = 'highlight' as const export const EVENT_TROW_MOUNTED = 'rowMounted' as const export const EVENT_TROW_CONTEXTMENU = 'contextmenuClicked' as const export const EVENT_ITEM_DROPPED = 'itemDropped' as const export const EVENT_ITEM_DROPPED_BREADCRUMB = 'itemDroppedBreadcrumb' as const export const EVENT_ITEM_DRAGGED = 'itemDragged' as const export const EVENT_FILE_DROPPED = 'fileDropped' as const export const EVENT_SORT = 'sort' as const export const AVAILABLE_SIZES = [ 'xsmall', 'small', 'medium', 'large', 'xlarge', 'xxlarge', 'xxxlarge' ]
owncloud/web/packages/design-system/src/helpers/constants.ts/0
{ "file_path": "owncloud/web/packages/design-system/src/helpers/constants.ts", "repo_id": "owncloud", "token_count": 236 }
860
.oc-label:not(:empty) { margin-bottom: 0.2rem; display: inline-block; }
owncloud/web/packages/design-system/src/styles/theme/oc-label.scss/0
{ "file_path": "owncloud/web/packages/design-system/src/styles/theme/oc-label.scss", "repo_id": "owncloud", "token_count": 33 }
861
--- z-index: modal: value: '9999'
owncloud/web/packages/design-system/src/tokens/ods/z-index.yaml/0
{ "file_path": "owncloud/web/packages/design-system/src/tokens/ods/z-index.yaml", "repo_id": "owncloud", "token_count": 21 }
862
{ "name": "@ownclouders/prettier-config", "private": false, "version": "0.0.1", "main": "index.js", "license": "AGPL-3.0", "author": "ownCloud GmbH <devops@owncloud.com>", "homepage": "https://github.com/owncloud/web/tree/master/packages/prettier-config", "repository": { "type": "git", "url": "https://github.com/owncloud/web", "directory": "packages/prettier-config" }, "exports": { ".": "./index.js" }, "dependencies": { "prettier": "^3.0.0" } }
owncloud/web/packages/prettier-config/package.json/0
{ "file_path": "owncloud/web/packages/prettier-config/package.json", "repo_id": "owncloud", "token_count": 219 }
863
<template> <div class="oc-ml-s"> <oc-text-input v-model="filterTerm" class="oc-text-truncate oc-mr-s oc-mt-m" :label="$gettext('Filter members')" /> <div ref="membersListRef" data-testid="space-members"> <div v-if="!filteredGroupMembers.length"> <h3 class="oc-text-bold oc-text-medium" v-text="$gettext('No members found')" /> </div> <div v-if="filteredGroupMembers.length" class="oc-mb-m" data-testid="group-members"> <h3 class="oc-text-bold oc-text-medium" v-text="$gettext('Members')" /> <members-role-section :group-members="filteredGroupMembers" /> </div> </div> </div> </template> <script lang="ts"> import { computed, defineComponent, inject, ref, watch, unref, Ref } from 'vue' import MembersRoleSection from '../../Groups/SideBar/MembersRoleSection.vue' import Fuse from 'fuse.js' import Mark from 'mark.js' import { Group } from '@ownclouders/web-client/src/generated' import { defaultFuseOptions } from '@ownclouders/web-pkg' export default defineComponent({ name: 'GroupsMembersPanel', components: { MembersRoleSection }, setup() { const group = inject<Ref<Group>>('group') const filterTerm = ref('') const markInstance = ref(null) const membersListRef = ref(null) const filterMembers = (collection, term) => { if (!(term || '').trim()) { return collection } const searchEngine = new Fuse(collection, { ...defaultFuseOptions, keys: ['displayName'] }) return searchEngine.search(term).map((r) => r.item) } const members = computed(() => { if (group) { return unref(group).members.sort((a, b) => a.displayName.localeCompare(b.displayName)) } return [] }) const filteredGroupMembers = computed(() => { return filterMembers(unref(members), unref(filterTerm)) }) watch(filterTerm, () => { if (unref(membersListRef)) { markInstance.value = new Mark(unref(membersListRef)) unref(markInstance).unmark() const searchTermRegex = unref(filterTerm) unref(markInstance).mark(searchTermRegex, { element: 'span', className: 'mark-highlight' }) } }) return { filterTerm, membersListRef, members, filteredGroupMembers } } }) </script>
owncloud/web/packages/web-app-admin-settings/src/components/Groups/SideBar/MembersPanel.vue/0
{ "file_path": "owncloud/web/packages/web-app-admin-settings/src/components/Groups/SideBar/MembersPanel.vue", "repo_id": "owncloud", "token_count": 945 }
864
<template> <div id="user-list"> <div class="user-filters oc-flex oc-flex-between oc-flex-wrap oc-flex-bottom oc-mx-m oc-mb-m"> <slot name="filter" /> </div> <slot v-if="!users.length" name="noResults" /> <oc-table v-else class="users-table" :sort-by="sortBy" :sort-dir="sortDir" :fields="fields" :data="paginatedItems" :highlighted="highlighted" :sticky="true" :header-position="fileListHeaderY" :hover="true" @sort="handleSort" @contextmenu-clicked="showContextMenuOnRightClick" @highlight="rowClicked" > <template #selectHeader> <oc-checkbox size="large" class="oc-ml-s" :label="$gettext('Select all users')" :model-value="allUsersSelected" hide-label @update:model-value="allUsersSelected ? unselectAllUsers() : selectUsers(paginatedItems)" /> </template> <template #select="{ item }"> <oc-checkbox class="oc-ml-s" size="large" :model-value="isUserSelected(item)" :option="item" :label="getSelectUserLabel(item)" hide-label @update:model-value="selectUser(item)" @click.stop="rowClicked([item, $event])" /> </template> <template #avatar="{ item }"> <avatar-image :width="32" :userid="item.id" :user-name="item.displayName" /> </template> <template #role="{ item }"> <template v-if="item.appRoleAssignments">{{ getRoleDisplayNameByUser(item) }}</template> </template> <template #accountEnabled="{ item }"> <span v-if="item.accountEnabled === false" class="oc-flex oc-flex-middle"> <oc-icon name="stop-circle" fill-type="line" class="oc-mr-s" /><span v-text="$gettext('Forbidden')" /> </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('Allowed')" /> </span> </template> <template #actions="{ item }"> <oc-button v-oc-tooltip="$gettext('Details')" appearance="raw" class="oc-mr-xs quick-action-button oc-p-xs users-table-btn-details" @click="showDetails(item)" > <oc-icon name="information" fill-type="line" /> </oc-button> <oc-button v-oc-tooltip="$gettext('Edit')" appearance="raw" class="oc-mr-xs quick-action-button oc-p-xs users-table-btn-edit" @click="showEditPanel(item)" > <oc-icon name="pencil" fill-type="line" /> </oc-button> <context-menu-quick-action ref="contextMenuButtonRef" :item="item" class="users-table-btn-action-dropdown" @quick-action-clicked="showContextMenuOnBtnClick($event, item)" > <template #contextMenu> <slot name="contextMenu" :user="item" /> </template> </context-menu-quick-action> </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> </div> </template> </oc-table> </div> </template> <script lang="ts"> import { useGettext } from 'vue3-gettext' import { defineComponent, PropType, ref, unref, computed } from 'vue' import { displayPositionedDropdown, eventBus, SortDir, useKeyboardActions } from '@ownclouders/web-pkg' import { SideBarEventTopics } from '@ownclouders/web-pkg' import { AppRole, User } from '@ownclouders/web-client/src/generated' import { ContextMenuQuickAction } from '@ownclouders/web-pkg' import { useFileListHeaderPosition, usePagination } from '@ownclouders/web-pkg' import { Pagination } from '@ownclouders/web-pkg' import { perPageDefault, perPageStoragePrefix } from 'web-app-admin-settings/src/defaults' import { storeToRefs } from 'pinia' import { useUserSettingsStore } from '../../composables/stores/userSettings' import { useKeyboardTableMouseActions, useKeyboardTableNavigation } from '../../composables/keyboardActions' import { findIndex } from 'lodash-es' export default defineComponent({ name: 'UsersList', components: { ContextMenuQuickAction, Pagination }, props: { roles: { type: Array as PropType<AppRole[]>, required: true } }, setup(props) { const { $gettext } = useGettext() const contextMenuButtonRef = ref(undefined) const sortBy = ref<string>('onPremisesSamAccountName') const sortDir = ref<string>(SortDir.Asc) const { y: fileListHeaderY } = useFileListHeaderPosition('#admin-settings-app-bar') const lastSelectedUserIndex = ref(0) const lastSelectedUserId = ref(null) const userSettingsStore = useUserSettingsStore() const { users, selectedUsers } = storeToRefs(userSettingsStore) const isUserSelected = (user) => { return unref(selectedUsers).some((s) => s.id === user.id) } const selectUser = (selectedUser: User) => { lastSelectedUserIndex.value = findIndex(unref(users), (u) => u.id === selectedUser.id) lastSelectedUserId.value = selectedUser.id keyActions.resetSelectionCursor() const isUserSelected = unref(selectedUsers).find((user) => user.id === selectedUser.id) if (!isUserSelected) { return userSettingsStore.addSelectedUser(selectedUser) } userSettingsStore.setSelectedUsers( unref(selectedUsers).filter((user) => user.id !== selectedUser.id) ) } const unselectAllUsers = () => { userSettingsStore.setSelectedUsers([]) } const selectUsers = (users: User[]) => { userSettingsStore.setSelectedUsers(users) } const showDetails = (user) => { if (!isUserSelected(user)) { selectUser(user) } eventBus.publish(SideBarEventTopics.open) } const showEditPanel = (user) => { if (!isUserSelected(user)) { selectUser(user) } eventBus.publish(SideBarEventTopics.openWithPanel, 'EditPanel') } const showUserAssigmentPanel = (user) => { if (!isUserSelected(user)) { selectUser(user) } eventBus.publish(SideBarEventTopics.openWithPanel, 'UserAssignmentsPanel') } const rowClicked = (data) => { const resource = data[0] const eventData = data[1] const isCheckboxClicked = eventData?.target.getAttribute('type') === 'checkbox' const contextActionClicked = eventData?.target?.closest('div')?.id === 'oc-files-context-menu' if (contextActionClicked) { return } if (eventData?.metaKey) { return eventBus.publish('app.resources.list.clicked.meta', resource) } if (eventData?.shiftKey) { return eventBus.publish('app.resources.list.clicked.shift', { resource, skipTargetSelection: isCheckboxClicked }) } if (isCheckboxClicked) { return } unselectAllUsers() selectUser(resource) } const showContextMenuOnBtnClick = (data, user) => { const { dropdown, event } = data if (dropdown?.tippy === undefined) { return } if (!isUserSelected(user)) { selectUser(user) } displayPositionedDropdown(dropdown.tippy, event, unref(contextMenuButtonRef)) } const showContextMenuOnRightClick = (row, event, user) => { event.preventDefault() const dropdown = row.$el.getElementsByClassName('users-table-btn-action-dropdown')[0] if (dropdown === undefined) { return } if (!isUserSelected(user)) { selectUser(user) } displayPositionedDropdown(dropdown._tippy, event, unref(contextMenuButtonRef)) } const getRoleDisplayNameByUser = (user: User) => { const assignedRole = user.appRoleAssignments[0] return ( $gettext( props.roles.find((role) => role.id === assignedRole?.appRoleId)?.displayName || '' ) || '-' ) } const orderBy = (list, prop, desc) => { return [...list].sort((user1, user2) => { let a, b switch (prop) { case 'role': a = getRoleDisplayNameByUser(user1) b = getRoleDisplayNameByUser(user2) break case 'accountEnabled': a = ('accountEnabled' in user1 ? user1.accountEnabled : true).toString() b = ('accountEnabled' in user2 ? user2.accountEnabled : true).toString() break default: a = user1[prop] || '' b = user2[prop] || '' } return desc ? b.localeCompare(a) : a.localeCompare(b) }) } const items = computed(() => { return orderBy(unref(users), unref(sortBy), unref(sortDir) === SortDir.Desc) }) const { items: paginatedItems, page: currentPage, total: totalPages } = usePagination({ items, perPageDefault, perPageStoragePrefix }) const keyActions = useKeyboardActions() useKeyboardTableNavigation( keyActions, paginatedItems, selectedUsers, lastSelectedUserIndex, lastSelectedUserId ) useKeyboardTableMouseActions( keyActions, paginatedItems, selectedUsers, lastSelectedUserIndex, lastSelectedUserId ) return { showDetails, showEditPanel, showUserAssigmentPanel, isUserSelected, rowClicked, contextMenuButtonRef, showContextMenuOnBtnClick, showContextMenuOnRightClick, fileListHeaderY, getRoleDisplayNameByUser, items, sortBy, sortDir, paginatedItems, currentPage, totalPages, orderBy, selectedUsers, selectUser, selectUsers, unselectAllUsers, users } }, data() { return { markInstance: null } }, computed: { allUsersSelected() { return this.paginatedItems.length === this.selectedUsers.length }, footerTextTotal() { return this.$gettext('%{userCount} users in total', { userCount: this.users.length.toString() }) }, fields() { return [ { name: 'select', title: '', type: 'slot', width: 'shrink', headerType: 'slot' }, { name: 'avatar', title: '', type: 'slot', width: 'shrink' }, { name: 'onPremisesSamAccountName', title: this.$gettext('User name'), sortable: true }, { name: 'displayName', title: this.$gettext('First and last name'), sortable: true, tdClass: 'mark-element' }, { name: 'mail', title: this.$gettext('Email'), sortable: true }, { name: 'role', title: this.$gettext('Role'), type: 'slot', sortable: true }, { name: 'accountEnabled', title: this.$gettext('Login'), type: 'slot', sortable: true }, { name: 'actions', title: this.$gettext('Actions'), sortable: false, type: 'slot', alignH: 'right' } ] }, highlighted() { return this.selectedUsers.map((user) => user.id) } }, methods: { handleSort(event) { this.sortBy = event.sortBy this.sortDir = event.sortDir }, getSelectUserLabel(user) { return this.$gettext('Select %{ user }', { user: user.displayName }, true) } } }) </script> <style lang="scss"> .users-table { .oc-table-header-cell-actions, .oc-table-data-cell-actions { white-space: nowrap; } .oc-table-header-cell-role, .oc-table-data-cell-role, .oc-table-header-cell-accountEnabled, .oc-table-data-cell-accountEnabled { display: none; @media only screen and (min-width: 1200px) { display: table-cell; } } .oc-table-header-cell-displayName, .oc-table-data-cell-displayName { display: none; @media only screen and (min-width: 1000px) { display: table-cell; } } &-squashed { .oc-table-header-cell-role, .oc-table-data-cell-role, .oc-table-header-cell-accountEnabled, .oc-table-data-cell-accountEnabled { display: none; @media only screen and (min-width: 1600px) { display: table-cell; } } .oc-table-header-cell-displayName, .oc-table-data-cell-displayName { display: none; @media only screen and (min-width: 1400px) { display: table-cell; } } .oc-table-header-cell-mail, .oc-table-data-cell-mail { display: none; @media only screen and (min-width: 1200px) { display: table-cell; } } } } </style>
owncloud/web/packages/web-app-admin-settings/src/components/Users/UsersList.vue/0
{ "file_path": "owncloud/web/packages/web-app-admin-settings/src/components/Users/UsersList.vue", "repo_id": "owncloud", "token_count": 5893 }
865
import { computed, Ref, unref } from 'vue' import { useGettext } from 'vue3-gettext' import { UserAction, useModals, useCapabilityStore } from '@ownclouders/web-pkg' import { Group } from '@ownclouders/web-client/src/generated' import RemoveFromGroupsModal from '../../../components/Users/RemoveFromGroupsModal.vue' export const useUserActionsRemoveFromGroups = ({ groups }: { groups: Ref<Group[]> }) => { const { dispatchModal } = useModals() const { $gettext, $ngettext } = useGettext() const capabilityStore = useCapabilityStore() const handler = ({ resources }) => { dispatchModal({ title: $ngettext( 'Remove user "%{user}" from groups', 'Remove %{userCount} users from groups ', resources.length, { user: resources[0].displayName, userCount: resources.length.toString() } ), customComponent: RemoveFromGroupsModal, customComponentAttrs: () => ({ users: resources, groups: unref(groups) }) }) } const actions = computed((): UserAction[] => [ { name: 'remove-users-from-groups', icon: 'subtract', componentType: 'button', class: 'oc-users-actions-remove-from-groups-trigger', label: () => $gettext('Remove from groups'), isVisible: ({ resources }) => { if (capabilityStore.graphUsersReadOnlyAttributes.includes('user.memberOf')) { return false } return resources.length > 0 }, handler } ]) return { actions } }
owncloud/web/packages/web-app-admin-settings/src/composables/actions/users/useUserActionsRemoveFromGroups.ts/0
{ "file_path": "owncloud/web/packages/web-app-admin-settings/src/composables/actions/users/useUserActionsRemoveFromGroups.ts", "repo_id": "owncloud", "token_count": 607 }
866
import { defaultPlugins, mount } from 'web-test-helpers' import { mock } from 'vitest-mock-extended' import { Resource } from '@ownclouders/web-client/src/helpers' import ContextActions from '../../../../src/components/Groups/ContextActions.vue' import { useGroupActionsDelete, useGroupActionsEdit } from 'web-app-admin-settings/src/composables/actions' import { computed, ref } from 'vue' import { Action } from '@ownclouders/web-pkg' function createMockActionComposables(module) { const mockModule: Record<string, any> = {} for (const m of Object.keys(module)) { mockModule[m] = vi.fn(() => ({ actions: ref([]) })) } return mockModule } vi.mock('@ownclouders/web-pkg', async (importOriginal) => { const original = await importOriginal() return createMockActionComposables(original) }) vi.mock( 'web-app-admin-settings/src/composables/actions/groups/useGroupActionsDelete', async (importOriginal) => { const original = await importOriginal() return createMockActionComposables(original) } ) vi.mock( 'web-app-admin-settings/src/composables/actions/groups/useGroupActionsEdit', async (importOriginal) => { const original = await importOriginal() return createMockActionComposables(original) } ) const selectors = { actionMenuItemStub: 'action-menu-item-stub' } describe.skip('ContextActions', () => { describe('menu sections', () => { it('do not render when no action enabled', () => { const { wrapper } = getWrapper() expect(wrapper.findAll(selectors.actionMenuItemStub).length).toBe(0) }) it('render enabled actions', () => { const enabledComposables = [useGroupActionsDelete, useGroupActionsEdit] vi.mocked(useGroupActionsDelete).mockImplementation(() => ({ actions: computed(() => [mock<Action>({ isVisible: () => true })]), deleteGroups: null })) vi.mocked(useGroupActionsEdit).mockImplementation(() => ({ actions: computed(() => [mock<Action>({ isVisible: () => true })]) })) const { wrapper } = getWrapper() expect(wrapper.findAll(selectors.actionMenuItemStub).length).toBe(enabledComposables.length) }) }) }) function getWrapper() { return { wrapper: mount(ContextActions, { props: { actionOptions: { resources: [mock<Resource>()] } }, global: { stubs: { 'action-menu-item': true }, plugins: [...defaultPlugins()] } }) } }
owncloud/web/packages/web-app-admin-settings/tests/unit/components/Groups/ContextActions.spec.ts/0
{ "file_path": "owncloud/web/packages/web-app-admin-settings/tests/unit/components/Groups/ContextActions.spec.ts", "repo_id": "owncloud", "token_count": 918 }
867
import AddToGroupsModal from '../../../../src/components/Users/AddToGroupsModal.vue' import { defaultComponentMocks, defaultPlugins, mockAxiosResolve, shallowMount } from 'web-test-helpers' import { mock } from 'vitest-mock-extended' import { Group, User } from '@ownclouders/web-client/src/generated' import { Modal, useMessages } from '@ownclouders/web-pkg' import { useUserSettingsStore } from '../../../../src/composables/stores/userSettings' describe('AddToGroupsModal', () => { it('renders the input', () => { const { wrapper } = getWrapper() expect(wrapper.find('group-select-stub').exists()).toBeTruthy() }) describe('method "onConfirm"', () => { it('adds all users to the given groups', async () => { const users = [mock<User>({ memberOf: [] }), mock<User>({ memberOf: [] })] const groups = [mock<Group>(), mock<Group>()] const { wrapper, mocks } = getWrapper({ users, groups }) mocks.$clientService.graphAuthenticated.groups.addMember.mockResolvedValue(undefined) mocks.$clientService.graphAuthenticated.users.getUser.mockResolvedValue( mockAxiosResolve({ id: 'e3515ffb-d264-4dfc-8506-6c239f6673b5' }) ) wrapper.vm.selectedOptions = groups await wrapper.vm.onConfirm() const { showMessage } = useMessages() expect(showMessage).toHaveBeenCalled() const { upsertUser } = useUserSettingsStore() expect(upsertUser).toHaveBeenCalledTimes(users.length) }) it('should show message on error', async () => { vi.spyOn(console, 'error').mockImplementation(() => undefined) const users = [mock<User>({ memberOf: [] }), mock<User>({ memberOf: [] })] const groups = [mock<Group>(), mock<Group>()] const { wrapper, mocks } = getWrapper({ users, groups }) mocks.$clientService.graphAuthenticated.groups.addMember.mockRejectedValue(new Error('')) mocks.$clientService.graphAuthenticated.users.getUser.mockRejectedValue(new Error('')) wrapper.vm.selectedOptions = groups await wrapper.vm.onConfirm() const { showErrorMessage } = useMessages() expect(showErrorMessage).toHaveBeenCalled() const { upsertUser } = useUserSettingsStore() expect(upsertUser).not.toHaveBeenCalled() }) }) }) function getWrapper({ users = [mock<User>()], groups = [mock<Group>()] } = {}) { const mocks = defaultComponentMocks() return { mocks, wrapper: shallowMount(AddToGroupsModal, { props: { modal: mock<Modal>(), users, groups }, global: { provide: mocks, plugins: [...defaultPlugins()], stubs: { GroupSelect: true } } }) } }
owncloud/web/packages/web-app-admin-settings/tests/unit/components/Users/AddToGroupsModal.spec.ts/0
{ "file_path": "owncloud/web/packages/web-app-admin-settings/tests/unit/components/Users/AddToGroupsModal.spec.ts", "repo_id": "owncloud", "token_count": 1044 }
868
import { useUserActionsAddToGroups } from '../../../../../src/composables/actions/users/useUserActionsAddToGroups' import { mock } from 'vitest-mock-extended' import { ref, unref } from 'vue' import { User } from '@ownclouders/web-client/src/generated' import { getComposableWrapper, writable } from 'web-test-helpers' import { useCapabilityStore, useModals } from '@ownclouders/web-pkg' describe('useUserActionsAddToGroups', () => { describe('method "isVisible"', () => { it.each([ { resources: [], isVisible: false }, { resources: [mock<User>()], isVisible: true }, { resources: [mock<User>(), mock<User>()], isVisible: true } ])('requires at least one user to be enabled', ({ resources, isVisible }) => { getWrapper({ setup: ({ actions }) => { expect(unref(actions)[0].isVisible({ resources })).toEqual(isVisible) } }) }) it('returns false if included in capability readOnlyUserAttributes list', () => { getWrapper({ setup: ({ actions }) => { const capabilityStore = useCapabilityStore() writable(capabilityStore).graphUsersReadOnlyAttributes = ['user.memberOf'] expect(unref(actions)[0].isVisible({ resources: [mock<User>()] })).toEqual(false) } }) }) }) describe('method "handler"', () => { it('creates a modal', () => { getWrapper({ setup: async ({ actions }) => { const { dispatchModal } = useModals() await unref(actions)[0].handler({ resources: [mock<User>()] }) expect(dispatchModal).toHaveBeenCalled() } }) }) }) }) function getWrapper({ setup }: { setup: (instance: ReturnType<typeof useUserActionsAddToGroups>) => void }) { return { wrapper: getComposableWrapper(() => { const instance = useUserActionsAddToGroups({ groups: ref([]) }) setup(instance) }) } }
owncloud/web/packages/web-app-admin-settings/tests/unit/composables/actions/users/useUserActionsAddToGroups.spec.ts/0
{ "file_path": "owncloud/web/packages/web-app-admin-settings/tests/unit/composables/actions/users/useUserActionsAddToGroups.spec.ts", "repo_id": "owncloud", "token_count": 763 }
869
import { z } from 'zod' const AppProviderSchema = z.object({ icon: z.string(), name: z.string() }) const MimeTypeSchema = z.object({ allow_creation: z.boolean().optional(), app_providers: z.array(AppProviderSchema), default_application: z.string().optional(), description: z.string().optional(), ext: z.string().optional(), mime_type: z.string(), name: z.string().optional() }) export const AppListSchema = z.object({ 'mime-types': z.array(MimeTypeSchema) })
owncloud/web/packages/web-app-external/src/schemas.ts/0
{ "file_path": "owncloud/web/packages/web-app-external/src/schemas.ts", "repo_id": "owncloud", "token_count": 170 }
870
<template> <div v-if="!isEmbedModeEnabled" class="oc-flex"> <oc-button v-for="action in filteredActions" :key="action.label()" v-oc-tooltip="action.label()" :aria-label="action.label()" appearance="raw" class="oc-mr-xs quick-action-button oc-p-xs" :class="`files-quick-action-${action.name}`" @click="action.handler({ space, resources: [item] })" > <oc-icon :name="action.icon" fill-type="line" /> </oc-button> </div> </template> <script lang="ts"> import { computed, defineComponent, PropType } from 'vue' import { ActionExtension, useEmbedMode, useExtensionRegistry } from '@ownclouders/web-pkg' import { Resource, SpaceResource } from '@ownclouders/web-client' import { unref } from 'vue' export default defineComponent({ name: 'QuickActions', props: { item: { type: Object as PropType<Resource>, required: true }, space: { type: Object as PropType<SpaceResource>, default: undefined } }, setup(props) { const extensionRegistry = useExtensionRegistry() const { isEnabled: isEmbedModeEnabled } = useEmbedMode() const filteredActions = computed(() => { return unref(extensionRegistry) .requestExtensions<ActionExtension>('action', ['resource.quick-action']) .map((e) => e.action) .filter(({ isVisible }) => isVisible({ space: props.space, resources: [props.item] })) }) return { filteredActions, isEmbedModeEnabled } } }) </script> <style lang="scss"> .quick-action-button { &:hover { background-color: var(--oc-color-background-secondary) !important; } } </style>
owncloud/web/packages/web-app-files/src/components/FilesList/QuickActions.vue/0
{ "file_path": "owncloud/web/packages/web-app-files/src/components/FilesList/QuickActions.vue", "repo_id": "owncloud", "token_count": 659 }
871
<template> <div id="new-collaborators-form" data-testid="new-collaborators-form"> <div :class="['oc-flex', 'oc-width-1-1', { 'new-collaborators-form-cern': isRunningOnEos }]"> <oc-select v-if="isRunningOnEos" id="files-share-account-type-input" v-model="accountType" :options="accountTypes" :label="$gettext('Account type')" class="cern-account-type-input" :reduce="(option) => option.description" > <template #option="{ description }"> <span class="option oc-text-xsmall" v-text="description" /> </template> <template #selected-option="{ description }"> <span class="option oc-text-xsmall" v-text="description" /> </template> </oc-select> <oc-select id="files-share-invite-input" ref="ocSharingAutocomplete" :class="['oc-width-1-1', { 'cern-files-share-invite-input': isRunningOnEos }]" :model-value="selectedCollaborators" :options="autocompleteResults" :loading="searchInProgress" :multiple="true" :filter="filterRecipients" :label="selectedCollaboratorsLabel" aria-describedby="files-share-invite-hint" :dropdown-should-open=" ({ open, search }) => open && search.length >= minSearchLength && !searchInProgress " @search:input="onSearch" @update:model-value="resetFocusOnInvite" @open="onOpen" @close="onClose" > <template #option="option"> <autocomplete-item class="mark-element" :item="option" /> </template> <template #no-options> <span v-text="$gettext('No users or groups found.')" /> </template> <template #selected-option-container="{ option, deselect }"> <recipient-container :key="option.id" :recipient="option" :deselect="deselect" /> </template> <template #open-indicator> <!-- Empty to hide the caret --> <span /> </template> </oc-select> </div> <div class="oc-flex oc-flex-between oc-flex-wrap oc-mb-l oc-mt-s"> <role-dropdown mode="create" :show-icon="isRunningOnEos" class="role-selection-dropdown" @option-change="collaboratorRoleChanged" /> <div class="oc-flex"> <div v-if="expirationDate" class="oc-flex oc-flex-middle"> <oc-icon v-oc-tooltip="formattedExpirationDate" class="files-collaborators-collaborator-expiration" data-testid="recipient-info-expiration-date" :aria-label="formattedExpirationDate" name="calendar-event" fill-type="line" /> <span class="oc-invisible-sr" v-text="screenreaderShareExpiration" /> </div> <oc-button id="show-more-share-options-btn" class="oc-mx-s" :aria-label="$gettext('Show more actions')" appearance="raw" > <oc-icon name="more-2" /> <oc-drop ref="showMoreShareOptionsDropRef" :drop-id="'show-more-share-options-drop'" :toggle="'#show-more-share-options-btn'" mode="click" padding-size="small" > <oc-list class="collaborator-edit-dropdown-options-list" :aria-label="'shareEditOptions'" > <li class="oc-rounded oc-menu-item-hover"> <expiration-datepicker v-if="!saving" :share-types="selectedCollaborators.map(({ shareType }) => shareType)" @option-change="collaboratorExpiryChanged" /> </li> </oc-list> </oc-drop> </oc-button> <oc-button id="new-collaborators-form-create-button" key="new-collaborator-save-button" data-testid="new-collaborators-form-create-button" :disabled="!$_isValid || saving" :variation="saving ? 'passive' : 'primary'" :appearance="saving ? 'outline' : 'filled'" submit="submit" :show-spinner="savingDelayed" @click="share" > <span v-text="$gettext(saveButtonLabel)" /> </oc-button> </div> <div class="oc-width-1-1 oc-mt-s"> <oc-checkbox v-if="isRunningOnEos" v-model="notifyEnabled" :value="false" :label="$gettext('Notify via mail')" /> </div> </div> <oc-hidden-announcer level="assertive" :announcement="announcement" /> </div> </template> <script lang="ts"> import { debounce } from 'lodash-es' import PQueue from 'p-queue' import Mark from 'mark.js' import { storeToRefs } from 'pinia' import AutocompleteItem from './AutocompleteItem.vue' import RoleDropdown from '../RoleDropdown.vue' import RecipientContainer from './RecipientContainer.vue' import ExpirationDatepicker from './ExpirationDatepicker.vue' import { CollaboratorAutoCompleteItem, CollaboratorShare, GraphShareRoleIdMap, ShareRole, ShareTypes } from '@ownclouders/web-client/src/helpers/share' import { useCapabilityStore, useClientService, useMessages, useSpacesStore, useConfigStore, useSharesStore, useUserStore } from '@ownclouders/web-pkg' import { computed, defineComponent, inject, ref, unref, watch, onMounted, nextTick } from 'vue' import { Resource, SpaceResource } from '@ownclouders/web-client' import { formatDateFromDateTime, formatRelativeDateFromDateTime } from '@ownclouders/web-pkg' import { DateTime } from 'luxon' import { OcDrop } from 'design-system/src/components' import { useTask } from 'vue-concurrency' import { useGettext } from 'vue3-gettext' import { buildSpace, isProjectSpaceResource } from '@ownclouders/web-client/src/helpers' // just a dummy function to trick gettext tools const $gettext = (str) => { return str } export default defineComponent({ name: 'InviteCollaboratorForm', components: { AutocompleteItem, RoleDropdown, RecipientContainer, ExpirationDatepicker }, props: { saveButtonLabel: { type: String, required: false, default: () => $gettext('Share') }, inviteLabel: { type: String, required: false, default: '' } }, setup() { const { $gettext } = useGettext() const clientService = useClientService() const { showMessage, showErrorMessage } = useMessages() const spacesStore = useSpacesStore() const { upsertSpace, upsertSpaceMember } = spacesStore const capabilityStore = useCapabilityStore() const capabilityRefs = storeToRefs(capabilityStore) const configStore = useConfigStore() const userStore = useUserStore() const sharesStore = useSharesStore() const { addShare } = sharesStore const { collaboratorShares, graphRoles } = storeToRefs(sharesStore) const searchQuery = ref('') const searchInProgress = ref(false) const autocompleteResults = ref<CollaboratorAutoCompleteItem[]>([]) const saving = ref(false) const savingDelayed = ref(false) const notifyEnabled = ref(false) const expirationDate = ref<string>() const selectedCollaborators = ref<CollaboratorAutoCompleteItem[]>([]) const announcement = ref<string>() const selectedRole = ref<ShareRole>() const resource = inject<Resource>('resource') const space = inject<SpaceResource>('space') const resourceIsSpace = computed(() => unref(resource).type === 'space') const markInstance = ref(null) const isOpen = ref(false) const onOpen = () => { isOpen.value = true } const onClose = () => { isOpen.value = false } watch(saving, (newValue) => { if (!newValue) { savingDelayed.value = false return } setTimeout(() => { if (!unref(saving)) { savingDelayed.value = false return } savingDelayed.value = true }, 700) }) watch([autocompleteResults, isOpen], async () => { if (!unref(isOpen)) { return } await nextTick() unref(markInstance)?.unmark() unref(markInstance)?.mark(unref(searchQuery), { element: 'span', className: 'mark-highlight' }) }) onMounted(async () => { selectedRole.value = unref(resourceIsSpace) ? unref(graphRoles).find(({ id }) => id === GraphShareRoleIdMap.SpaceViewer) : unref(graphRoles).find(({ id }) => id === GraphShareRoleIdMap.Viewer) await nextTick() markInstance.value = new Mark('.mark-element') }) const accountType = ref('standard') const accountTypes = [ { prefix: '', description: 'standard' }, { prefix: 'a:', description: 'secondary' }, { prefix: 'a:', description: 'service' }, { prefix: 'l:', description: 'guest' }, { prefix: 'sm:', description: 'federated' } ] const createSharesConcurrentRequests = computed(() => { return configStore.options.concurrentRequests.shares.create }) const fetchRecipientsTask = useTask(function* (signal, query: string) { const client = clientService.graphAuthenticated const { data: userData } = yield client.users.listUsers( 'displayName', null, null, `"${query}"` ) const { data: groupData } = yield client.groups.listGroups('displayName', null, `"${query}"`) const users = (userData.value || []).map((u) => ({ ...u, shareType: unref(resourceIsSpace) ? ShareTypes.spaceUser.value : ShareTypes.user.value })) as CollaboratorAutoCompleteItem[] const groups = (groupData.value || []).map((u) => ({ ...u, shareType: unref(resourceIsSpace) ? ShareTypes.spaceGroup.value : ShareTypes.group.value })) as CollaboratorAutoCompleteItem[] autocompleteResults.value = [...users, ...groups] .filter((collaborator: CollaboratorAutoCompleteItem) => { if (collaborator.id === userStore.user.id) { // filter current user return false } const selected = unref(selectedCollaborators).some(({ id }) => collaborator.id === id) const existingShares = unref(collaboratorShares).filter((c) => !c.indirect) const exists = existingShares.some((s) => s.sharedWith.id === collaborator.id) if (selected || exists) { return false } announcement.value = $gettext('Person was added') return true }) .map((collaborator) => ({ id: collaborator.id, displayName: collaborator.displayName, shareType: collaborator.shareType, mail: collaborator.mail })) satisfies CollaboratorAutoCompleteItem[] searchInProgress.value = false }).restartable() const fetchRecipients = async (query: string) => { await fetchRecipientsTask.perform(query) } const share = async () => { saving.value = true const saveQueue = new PQueue({ concurrency: unref(createSharesConcurrentRequests) }) const savePromises = [] const errors: { displayName: string; error: Error }[] = [] const addedShares: CollaboratorShare[] = [] unref(selectedCollaborators).forEach(({ id, shareType, displayName }) => { const type = [ShareTypes.group.value, ShareTypes.spaceGroup.value].includes(shareType) ? 'group' : 'user' savePromises.push( saveQueue.add(async () => { try { const shares = await addShare({ clientService, space: unref(space), resource: unref(resource), options: { roles: [unref(selectedRole).id], expirationDateTime: unref(expirationDate), recipients: [ { objectId: id, '@libre.graph.recipient.type': type } ] } }) addedShares.push(...shares) } catch (error) { console.error(error) errors.push({ displayName, error }) throw error } }) ) }) if (isProjectSpaceResource(unref(resource))) { const graphResponse = await clientService.graphAuthenticated.drives.getDrive( unref(resource).id ) upsertSpace(buildSpace(graphResponse.data)) addedShares.forEach((member) => { upsertSpaceMember({ member }) }) } const results = await Promise.allSettled(savePromises) if (results.length !== errors.length) { showMessage({ title: $gettext('Share was added successfully') }) } errors.forEach((e) => { showErrorMessage({ title: $gettext('Failed to add share for "%{displayName}"', { displayName: e.displayName }), errors: [e.error] }) }) expirationDate.value = null selectedCollaborators.value = [] saving.value = false } return { minSearchLength: capabilityRefs.sharingSearchMinLength, isRunningOnEos: computed(() => configStore.options.runningOnEos), saving, savingDelayed, ...useMessages(), searchInProgress, searchQuery, autocompleteResults, onOpen, onClose, expirationDate, selectedRole, announcement, selectedCollaborators, fetchRecipients, share, // CERN accountType, accountTypes, notifyEnabled, // unit tests fetchRecipientsTask } }, computed: { $_isValid() { return this.selectedCollaborators.length > 0 }, selectedCollaboratorsLabel() { return this.inviteLabel || this.$gettext('Search') }, formattedExpirationDate() { return this.expirationDate === null ? null : formatDateFromDateTime( DateTime.fromISO(this.expirationDate).endOf('day'), this.$language.current ) }, expirationDateRelative() { return this.expirationDate === null ? null : formatRelativeDateFromDateTime( DateTime.fromISO(this.expirationDate).endOf('day'), this.$language.current ) }, screenreaderShareExpiration() { return this.$gettext('Share expires %{ expiryDateRelative } (%{ expiryDate })', { expiryDateRelative: this.expirationDateRelative, expiryDate: this.expirationDate }) } }, mounted() { this.fetchRecipients = debounce(this.fetchRecipients, 500) }, methods: { onSearch(query: string) { this.autocompleteResults = [] this.searchQuery = query if (query.length < this.minSearchLength) { this.searchInProgress = false return } this.searchInProgress = true // CERN if (this.isRunningOnEos) { const prefix = this.accountTypes.find((t) => t.description === this.accountType)?.prefix || '' query = `${prefix}${query}` } this.fetchRecipients(query) }, filterRecipients(recipients: CollaboratorAutoCompleteItem[], query: string) { if (recipients.length < 1) { return [] } // Allow advanced queries query = query.split(':')[1] || query return recipients.filter( (recipient) => recipient.shareType === ShareTypes.remote.value || recipient.displayName.toLocaleLowerCase().indexOf(query.toLocaleLowerCase()) > -1 ) }, collaboratorRoleChanged(role: ShareRole) { this.selectedRole = role }, collaboratorExpiryChanged({ expirationDate }: { expirationDate: string }) { this.expirationDate = expirationDate ;(this.$refs.showMoreShareOptionsDropRef as InstanceType<typeof OcDrop>).hide() }, resetFocusOnInvite(event: CollaboratorAutoCompleteItem[]) { this.selectedCollaborators = event this.autocompleteResults = [] this.$nextTick(() => { const inviteInput = document.getElementById('files-share-invite-input') inviteInput.focus() }) } } }) </script> <style lang="scss"> .role-selection-dropdown { max-width: 150px; } #new-collaborators-form-create-button { padding-left: 30px; padding-right: 30px; } .new-collaborators-form-cern > .cern-files-share-invite-input { width: 75%; } .new-collaborators-form-cern > .cern-account-type-input { width: 30%; } </style>
owncloud/web/packages/web-app-files/src/components/SideBar/Shares/Collaborators/InviteCollaborator/InviteCollaboratorForm.vue/0
{ "file_path": "owncloud/web/packages/web-app-files/src/components/SideBar/Shares/Collaborators/InviteCollaborator/InviteCollaboratorForm.vue", "repo_id": "owncloud", "token_count": 7228 }
872
<template> <oc-button id="context-menu-trigger-whitespace" appearance="raw"> <oc-drop drop-id="context-menu-drop-whitespace" toggle="#context-menu-trigger-whitespace" position="bottom-end" mode="click" class="whitespace-context-actions-list" close-on-click padding-size="small" > <oc-list> <action-menu-item v-for="(action, actionIndex) in menuItemsActions" :key="`section-${action.name}-action-${actionIndex}`" :action="action" :action-options="actionOptions" class="oc-px-s oc-rounded oc-menu-item-hover" :data-testid="`whitespace-context-menu-item-${action.name}`" /> </oc-list> </oc-drop> </oc-button> </template> <script lang="ts"> import { computed, defineComponent, PropType, unref } from 'vue' import { useGettext } from 'vue3-gettext' import { useFileActionsPaste, useFileActionsShowDetails, useResourcesStore } from '@ownclouders/web-pkg' import { useFileActionsCreateNewFolder } from '@ownclouders/web-pkg' import { SpaceResource } from '@ownclouders/web-client/src' import { ActionMenuItem } from '@ownclouders/web-pkg' import { storeToRefs } from 'pinia' export default defineComponent({ name: 'WhitespaceContextMenu', components: { ActionMenuItem }, props: { space: { type: Object as PropType<SpaceResource>, required: false, default: null } }, setup(props) { const { $gettext } = useGettext() const resourcesStore = useResourcesStore() const { currentFolder } = storeToRefs(resourcesStore) const contextMenuLabel = computed(() => $gettext('Show context menu')) const actionOptions = computed(() => ({ space: props.space, resources: [currentFolder.value] })) const { actions: createNewFolderAction } = useFileActionsCreateNewFolder({ space: props.space }) const { actions: showDetailsAction } = useFileActionsShowDetails() const { actions: pasteAction } = useFileActionsPaste() const menuItemsActions = computed(() => { return [ ...unref(createNewFolderAction), ...unref(pasteAction), ...unref(showDetailsAction) ].filter((item) => item.isVisible(unref(actionOptions))) }) return { contextMenuLabel, actionOptions, currentFolder, menuItemsActions } } }) </script> <style lang="scss"> #context-menu-trigger-whitespace { visibility: hidden; width: 0; height: 0; } .whitespace-context-actions-list { .oc-card { padding-left: 0px !important; padding-right: 0px !important; } text-align: left; white-space: normal; a, button, span { display: inline-flex; font-weight: normal !important; gap: 10px; justify-content: flex-start; vertical-align: top; width: 100%; text-align: left; } } </style>
owncloud/web/packages/web-app-files/src/components/Spaces/WhitespaceContextMenu.vue/0
{ "file_path": "owncloud/web/packages/web-app-files/src/components/Spaces/WhitespaceContextMenu.vue", "repo_id": "owncloud", "token_count": 1118 }
873
export * from './upload'
owncloud/web/packages/web-app-files/src/helpers/resource/actions/index.ts/0
{ "file_path": "owncloud/web/packages/web-app-files/src/helpers/resource/actions/index.ts", "repo_id": "owncloud", "token_count": 8 }
874
import { FolderLoader, FolderLoaderTask, TaskContext } from '../folder' import { Router } from 'vue-router' import { useTask } from 'vue-concurrency' import { isLocationSharesActive } from '@ownclouders/web-pkg' import { buildOutgoingShareResource } from '@ownclouders/web-client/src/helpers/share/functionsNG' export class FolderLoaderSharedViaLink implements FolderLoader { public isEnabled(): boolean { return true } public isActive(router: Router): boolean { return isLocationSharesActive(router, 'files-shares-via-link') } public getTask(context: TaskContext): FolderLoaderTask { const { userStore, spacesStore, clientService, configStore, resourcesStore } = 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.listSharedByMe() const resources = value .filter((s) => s.permissions.some(({ link }) => !!link)) .map((driveItem) => buildOutgoingShareResource({ driveItem, user: userStore.user })) resourcesStore.initResourceList({ currentFolder: null, resources }) }) } }
owncloud/web/packages/web-app-files/src/services/folder/loaderSharedViaLink.ts/0
{ "file_path": "owncloud/web/packages/web-app-files/src/services/folder/loaderSharedViaLink.ts", "repo_id": "owncloud", "token_count": 483 }
875
<template> <div class="oc-flex oc-width-1-1"> <files-view-wrapper> <app-bar :breadcrumbs="breadcrumbs" :has-bulk-actions="true" :is-side-bar-open="isSideBarOpen" :space="space" /> <app-loading-spinner v-if="areResourcesLoading" /> <template v-else> <no-content-message v-if="isEmpty" id="files-trashbin-empty" class="files-empty" icon="delete-bin-7" icon-fill-type="line" > <template #message> <span>{{ noContentMessage }}</span> </template> </no-content-message> <resource-table v-else v-model:selectedIds="selectedResourcesIds" :is-side-bar-open="isSideBarOpen" :fields-displayed="['name', 'ddate']" :are-paths-displayed="true" :are-thumbnails-displayed="false" :resources="paginatedResources" :are-resources-clickable="false" :header-position="fileListHeaderY" :sort-by="sortBy" :sort-dir="sortDir" :space="space" :has-actions="showActions" @sort="handleSort" > <template #contextMenu="{ resource }"> <context-actions v-if="isResourceInSelection(resource)" :action-options="{ space, resources: selectedResources }" /> </template> <template #footer> <pagination :pages="paginationPages" :current-page="paginationPage" /> <list-info v-if="paginatedResources.length > 0" class="oc-width-1-1 oc-my-s" :files="totalResourcesCount.files" :folders="totalResourcesCount.folders" /> </template> </resource-table> </template> </files-view-wrapper> <file-side-bar :is-open="isSideBarOpen" :active-panel="sideBarActivePanel" :space="space" /> </div> </template> <script lang="ts"> import { storeToRefs } from 'pinia' import { AppBar, ContextActions, FileSideBar, useUserStore, useCapabilityStore, useResourcesStore } from '@ownclouders/web-pkg' import FilesViewWrapper from '../../components/FilesViewWrapper.vue' import ListInfo from '../../components/FilesList/ListInfo.vue' import { ResourceTable } from '@ownclouders/web-pkg' import { AppLoadingSpinner } from '@ownclouders/web-pkg' import { NoContentMessage } from '@ownclouders/web-pkg' import { Pagination } from '@ownclouders/web-pkg' import { eventBus } from '@ownclouders/web-pkg' import { useResourcesViewDefaults } from '../../composables' import { computed, defineComponent, PropType, onMounted, onBeforeUnmount, unref } from 'vue' import { Resource } from '@ownclouders/web-client' import { createLocationTrash } from '@ownclouders/web-pkg' import { isProjectSpaceResource, SpaceResource } from '@ownclouders/web-client/src/helpers' import { useDocumentTitle } from '@ownclouders/web-pkg' import { useGettext } from 'vue3-gettext' export default defineComponent({ name: 'GenericTrash', components: { AppBar, AppLoadingSpinner, ContextActions, FileSideBar, FilesViewWrapper, ListInfo, NoContentMessage, Pagination, ResourceTable }, props: { space: { type: Object as PropType<SpaceResource>, required: false, default: null }, itemId: { type: [String, Number], required: false, default: null } }, setup(props) { const { $gettext } = useGettext() const capabilityStore = useCapabilityStore() const capabilityRefs = storeToRefs(capabilityStore) const userStore = useUserStore() const { user } = storeToRefs(userStore) const resourcesStore = useResourcesStore() const { totalResourcesCount } = storeToRefs(resourcesStore) let loadResourcesEventToken: string const noContentMessage = computed(() => { return props.space.driveType === 'personal' ? $gettext('You have no deleted files') : $gettext('Space has no deleted files') }) const titleSegments = computed(() => { const segments = [$gettext('Deleted files')] segments.unshift(props.space.name) return segments }) useDocumentTitle({ titleSegments }) const resourcesViewDefaults = useResourcesViewDefaults<Resource, any, any[]>() const performLoaderTask = async () => { await resourcesViewDefaults.loadResourcesTask.perform(props.space) resourcesViewDefaults.refreshFileListHeaderPosition() resourcesViewDefaults.scrollToResourceFromRoute( unref(resourcesViewDefaults.paginatedResources), 'files-app-bar' ) } onMounted(() => { performLoaderTask() loadResourcesEventToken = eventBus.subscribe('app.files.list.load', () => { performLoaderTask() }) }) onBeforeUnmount(() => { eventBus.unsubscribe('app.files.list.load', loadResourcesEventToken) }) return { ...resourcesViewDefaults, user, noContentMessage, totalResourcesCount } }, computed: { isEmpty() { return this.paginatedResources.length < 1 }, breadcrumbs() { let currentNodeName = this.space?.name if (this.space.driveType === 'personal') { currentNodeName = this.$gettext('Personal') } return [ { text: this.$gettext('Deleted files'), to: createLocationTrash('files-trash-overview') }, { text: currentNodeName, onClick: () => eventBus.publish('app.files.list.load') } ] }, showActions() { return ( !isProjectSpaceResource(this.space) || this.space.isEditor(this.user) || this.space.isManager(this.user) ) } } }) </script>
owncloud/web/packages/web-app-files/src/views/spaces/GenericTrash.vue/0
{ "file_path": "owncloud/web/packages/web-app-files/src/views/spaces/GenericTrash.vue", "repo_id": "owncloud", "token_count": 2488 }
876
import { defaultPlugins, shallowMount } from 'web-test-helpers' import EmbedActions from 'web-app-files/src/components/EmbedActions/EmbedActions.vue' import { FileAction, useEmbedMode, useFileActionsCreateLink } from '@ownclouders/web-pkg' import { mock } from 'vitest-mock-extended' import { ref } from 'vue' import { Resource } from '@ownclouders/web-client' vi.mock('@ownclouders/web-pkg', async (importOriginal) => ({ ...(await importOriginal<any>()), useFileActionsCreateLink: vi.fn(), useEmbedMode: vi.fn() })) const selectors = Object.freeze({ btnSelect: '[data-testid="button-select"]', btnCancel: '[data-testid="button-cancel"]', btnShare: '[data-testid="button-share"]' }) describe('EmbedActions', () => { describe('select action', () => { it('should disable select action when no resources are selected', () => { const { wrapper } = getWrapper() expect(wrapper.find(selectors.btnSelect).attributes()).toHaveProperty('disabled') }) it('should enable select action when at least one resource is selected', () => { const { wrapper } = getWrapper({ selectedIds: ['1'] }) expect(wrapper.find(selectors.btnSelect).attributes()).not.toHaveProperty('disabled') }) it('should emit select event when the select action is triggered', async () => { const { wrapper, mocks } = getWrapper({ selectedIds: ['1'] }) await wrapper.find(selectors.btnSelect).trigger('click') expect(mocks.postMessageMock).toHaveBeenCalledWith('owncloud-embed:select', [{ id: '1' }]) }) it('should enable select action when embedTarget is set to location', () => { const { wrapper } = getWrapper({ isLocationPicker: true }) expect(wrapper.find(selectors.btnSelect).attributes()).not.toHaveProperty('disabled') }) it('should emit select event with currentFolder as selected resource when select action is triggered', async () => { const { wrapper, mocks } = getWrapper({ currentFolder: { id: '1' }, isLocationPicker: true }) await wrapper.find(selectors.btnSelect).trigger('click') expect(mocks.postMessageMock).toHaveBeenCalledWith('owncloud-embed:select', [{ id: '1' }]) }) }) describe('cancel action', () => { it('should emit cancel event when the cancel action is triggered', async () => { const { wrapper, mocks } = getWrapper({ selectedIds: ['1'] }) await wrapper.find(selectors.btnCancel).trigger('click') expect(mocks.postMessageMock).toHaveBeenCalledWith('owncloud-embed:cancel', null) }) }) describe('share action', () => { it('should disable share action when no resources are selected', () => { const { wrapper } = getWrapper() expect(wrapper.find(selectors.btnShare).attributes()).toHaveProperty('disabled') }) it('should disable share action when the "Create Link"-action is disabled', () => { const { wrapper } = getWrapper({ selectedIds: ['1'], createLinksActionEnabled: false }) expect(wrapper.find(selectors.btnShare).attributes()).toHaveProperty('disabled') }) it('should enable share action when at least one resource is selected and link creation is enabled', () => { const { wrapper } = getWrapper({ selectedIds: ['1'] }) expect(wrapper.find(selectors.btnShare).attributes()).not.toHaveProperty('disabled') }) it('should hide share action when embedTarget is set to location', () => { const { wrapper } = getWrapper({ isLocationPicker: true }) expect(wrapper.find(selectors.btnShare).exists()).toBe(false) }) it('should call the handler of the "Create Link"-action', async () => { const { wrapper, mocks } = getWrapper({ selectedIds: ['1'] }) await wrapper.find(selectors.btnShare).trigger('click') expect(mocks.createLinkHandlerMock).toHaveBeenCalledTimes(1) }) }) }) function getWrapper( { selectedIds = [], currentFolder = undefined, createLinksActionEnabled = true, isLocationPicker = false } = { selectedIds: [] } ) { const postMessageMock = vi.fn() vi.mocked(useEmbedMode).mockReturnValue( mock<ReturnType<typeof useEmbedMode>>({ isLocationPicker: ref(isLocationPicker), postMessage: postMessageMock }) ) const createLinkHandlerMock = vi.fn() vi.mocked(useFileActionsCreateLink).mockReturnValue( mock<ReturnType<typeof useFileActionsCreateLink>>({ actions: ref([ mock<FileAction>({ isVisible: () => createLinksActionEnabled, handler: createLinkHandlerMock }) ]) }) ) const resources = selectedIds.map((id) => ({ id })) as Resource[] return { mocks: { createLinkHandlerMock, postMessageMock }, wrapper: shallowMount(EmbedActions, { global: { stubs: { OcButton: false }, plugins: [ ...defaultPlugins({ piniaOptions: { resourcesStore: { currentFolder, selectedIds, resources } } }) ] } }) } }
owncloud/web/packages/web-app-files/tests/unit/components/EmbedActions/EmbedActions.spec.ts/0
{ "file_path": "owncloud/web/packages/web-app-files/tests/unit/components/EmbedActions/EmbedActions.spec.ts", "repo_id": "owncloud", "token_count": 1808 }
877
import { ref } from 'vue' import SpaceHeader from 'web-app-files/src/components/Spaces/SpaceHeader.vue' import { Drive } from '@ownclouders/web-client/src/generated' import { SpaceResource, buildSpace } from '@ownclouders/web-client/src/helpers' import { defaultPlugins, mount, defaultComponentMocks } from 'web-test-helpers' describe('SpaceHeader', () => { it('should add the "squashed"-class when the sidebar is opened', () => { const wrapper = getWrapper({ space: buildSpace({ id: '1' } as unknown as Drive), isSideBarOpen: true }) expect(wrapper.find('.space-header-squashed').exists()).toBeTruthy() expect(wrapper.html()).toMatchSnapshot() }) describe('space image', () => { it('should show the default image if no other image is set', () => { const wrapper = getWrapper({ space: buildSpace({ id: '1' } as unknown as Drive) }) expect(wrapper.find('.space-header-image-default').exists()).toBeTruthy() expect(wrapper.html()).toMatchSnapshot() }) it('should show the set image', async () => { const spaceMock = { spaceImageData: { webDavUrl: '/' } } const wrapper = getWrapper({ space: { ...buildSpace({ id: '1' } as unknown as Drive), ...spaceMock } }) await wrapper.vm.loadPreviewTask.last expect(wrapper.find('.space-header-image-default').exists()).toBeFalsy() expect(wrapper.find('.space-header-image img').exists()).toBeTruthy() expect(wrapper.html()).toMatchSnapshot() }) it('should take full width in mobile view', () => { const spaceMock = { spaceImageData: { webDavUrl: '/' } } const wrapper = getWrapper({ space: { ...buildSpace({ id: '1' } as unknown as Drive), ...spaceMock }, isMobileWidth: true }) expect(wrapper.find('.space-header').classes()).not.toContain('oc-flex') expect(wrapper.find('.space-header-image').classes()).toContain('space-header-image-expanded') }) }) }) function getWrapper({ space = {} as SpaceResource, isSideBarOpen = false, isMobileWidth = false }) { const mocks = defaultComponentMocks() mocks.$previewService.loadPreview.mockResolvedValue('blob:image') return mount(SpaceHeader, { props: { space, isSideBarOpen }, global: { mocks, plugins: [...defaultPlugins()], provide: { ...mocks, isMobileWidth: ref(isMobileWidth) }, stubs: { 'quota-modal': true, 'space-context-actions': true } } }) }
owncloud/web/packages/web-app-files/tests/unit/components/Spaces/SpaceHeader.spec.ts/0
{ "file_path": "owncloud/web/packages/web-app-files/tests/unit/components/Spaces/SpaceHeader.spec.ts", "repo_id": "owncloud", "token_count": 936 }
878
import { computed, ref } from 'vue' import { mock, mockDeep } from 'vitest-mock-extended' import { Resource, SpaceResource } from '@ownclouders/web-client/src/helpers' import GenericSpace from 'web-app-files/src/views/spaces/GenericSpace.vue' import { useResourcesViewDefaults } from 'web-app-files/src/composables/resourcesViewDefaults' import { useResourcesViewDefaultsMock } from 'web-app-files/tests/mocks/useResourcesViewDefaultsMock' import { defaultPlugins, mount, defaultComponentMocks, defaultStubs, RouteLocation, ComponentProps } from 'web-test-helpers' import { AppBar, useBreadcrumbsFromPath, useExtensionRegistry } from '@ownclouders/web-pkg' import { useBreadcrumbsFromPathMock } from '../../../mocks/useBreadcrumbsFromPathMock' import { useExtensionRegistryMock } from 'web-test-helpers/src/mocks/useExtensionRegistryMock' import { h } from 'vue' const mockCreateFolder = vi.fn() const mockUseEmbedMode = vi.fn().mockReturnValue({ isEnabled: computed(() => false) }) vi.mock('web-app-files/src/composables/resourcesViewDefaults') vi.mock('web-app-files/src/composables/keyboardActions') vi.mock('@ownclouders/web-pkg', async (importOriginal) => ({ ...(await importOriginal<any>()), useBreadcrumbsFromPath: vi.fn(), useExtensionRegistry: vi.fn(), useFileActionsCreateNewFolder: () => ({ actions: [{ handler: mockCreateFolder }] }), useEmbedMode: vi.fn().mockImplementation(() => mockUseEmbedMode()), useFileActions: vi.fn(() => ({})), useOpenWithDefaultApp: vi.fn(() => ({})) })) const selectors = Object.freeze({ btnCreateFolder: '[data-testid="btn-new-folder"]', actionsCreateAndUpload: '[data-testid="actions-create-and-upload"]' }) describe('GenericSpace 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() }) describe('space header', () => { it('does not render the space header in the personal space', () => { const { wrapper } = getMountedWrapper() expect(wrapper.find('space-header-stub').exists()).toBeFalsy() }) it('does not render the space header in a nested project space', () => { const { wrapper } = getMountedWrapper({ props: { item: '/someFolder', space: mock<SpaceResource>({ driveType: 'project' }) } }) expect(wrapper.find('space-header-stub').exists()).toBeFalsy() }) it('renders the space header on a space frontpage', () => { const { wrapper } = getMountedWrapper({ props: { space: mock<SpaceResource>({ driveType: 'project' }) } }) expect(wrapper.find('space-header-stub').exists()).toBeTruthy() }) }) 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').exists()).toBeTruthy() }) }) describe('breadcrumbs', () => { it.each([ { driveType: 'personal', expectedItems: 1 }, { driveType: 'project', expectedItems: 2 }, { driveType: 'share', expectedItems: 3 } ])('include root item(s)', ({ driveType, expectedItems }) => { const space = { id: 1, getDriveAliasAndItem: vi.fn(), driveType, isOwner: () => driveType === 'personal' } const { wrapper } = getMountedWrapper({ files: [mockDeep<Resource>()], props: { space } }) expect(wrapper.findComponent<typeof AppBar>('app-bar-stub').props().breadcrumbs.length).toBe( expectedItems ) }) it('include the root item and the current folder', () => { const folderName = 'someFolder' const { wrapper } = getMountedWrapper({ files: [mockDeep<Resource>()], props: { item: `/${folderName}` }, breadcrumbsFromPath: [{ text: folderName }] }) expect(wrapper.findComponent<typeof AppBar>('app-bar-stub').props().breadcrumbs.length).toBe( 2 ) expect( wrapper.findComponent<typeof AppBar>('app-bar-stub').props().breadcrumbs[1].text ).toEqual(folderName) }) it('omit the "page"-query of the current route', () => { const currentRoute = { name: 'files-spaces-generic', path: '/', query: { page: '2' } } const { wrapper } = getMountedWrapper({ files: [mockDeep<Resource>()], props: { item: 'someFolder' }, currentRoute }) const breadCrumbItem = wrapper.findComponent<typeof AppBar>('app-bar-stub').props() .breadcrumbs[0] expect((breadCrumbItem.to as RouteLocation).query.page).toBeUndefined() }) }) describe('loader task', () => { it('re-loads the resources on item change', async () => { const { wrapper, mocks } = getMountedWrapper() await wrapper.vm.loadResourcesTask.last expect(mocks.refreshFileListHeaderPosition).toHaveBeenCalledTimes(1) await wrapper.setProps({ item: 'newItem' }) await wrapper.vm.loadResourcesTask.last expect(mocks.refreshFileListHeaderPosition).toHaveBeenCalledTimes(2) }) it('re-loads the resources on space change', async () => { const { wrapper, mocks } = getMountedWrapper() await wrapper.vm.loadResourcesTask.last expect(mocks.refreshFileListHeaderPosition).toHaveBeenCalledTimes(1) await wrapper.setProps({ space: mockDeep<SpaceResource>() }) await wrapper.vm.loadResourcesTask.last expect(mocks.refreshFileListHeaderPosition).toHaveBeenCalledTimes(2) }) }) describe('empty folder upload hint', () => { it('renders if the user can upload to the current folder', () => { const { wrapper } = getMountedWrapper({ currentFolder: mock<Resource>({ canUpload: () => true }) }) expect(wrapper.find('.file-empty-upload-hint').exists()).toBeTruthy() }) it('does not render if the user can not upload to the current folder', () => { const { wrapper } = getMountedWrapper({ currentFolder: mock<Resource>({ canUpload: () => false }) }) expect(wrapper.find('.file-empty-upload-hint').exists()).toBeFalsy() }) }) describe('whitespace context menu', () => { it('shows whitespace context menu on right click in whitespace', async () => { const { wrapper } = getMountedWrapper() await wrapper.vm.loadResourcesTask.last await wrapper.find('#files-view').trigger('contextmenu') await wrapper.vm.$nextTick() expect(wrapper.vm.whitespaceContextMenu).toBeDefined() }) }) describe('for a single file', () => { describe('on EOS for single shared resources', () => { it('renders the ResourceDetails component if no currentFolder id is present', () => { const { wrapper } = getMountedWrapper({ currentFolder: mock<Resource>({ fileId: '' }), files: [mock<Resource>({ isFolder: false })], runningOnEos: true }) expect(wrapper.find('resource-details-stub').exists()).toBeTruthy() }) it('renders the ResourceDetails component if currentFolder path matches single shared resource path', () => { const path = 'foo' const { wrapper } = getMountedWrapper({ currentFolder: { ...mock<Resource>(), path }, files: [{ ...mock<Resource>(), path }], runningOnEos: true }) expect(wrapper.find('resource-details-stub').exists()).toBeTruthy() }) }) describe('on public links', () => { it('renders the ResourceDetails component', () => { const { wrapper } = getMountedWrapper({ currentFolder: { ...mock<Resource>() }, files: [{ ...mock<Resource>(), isFolder: false }], space: mock<SpaceResource>({ id: '1', getDriveAliasAndItem: vi.fn(), name: 'Personal space', driveType: 'public' }) }) expect(wrapper.find('resource-details-stub').exists()).toBeTruthy() }) }) }) describe('create and upload actions', () => { const AppBarStub = { template: '<div><slot name="actions" /></div>' } it('should not render create folder button when not in embed mode', () => { const { wrapper } = getMountedWrapper({ stubs: { 'app-bar': AppBarStub, CreateAndUpload: true } }) expect(wrapper.find(selectors.btnCreateFolder).exists()).toBe(false) }) it('should render create and upload actions when not in embed mode', () => { const { wrapper } = getMountedWrapper({ stubs: { 'app-bar': AppBarStub, CreateAndUpload: true } }) expect(wrapper.find(selectors.actionsCreateAndUpload).exists()).toBe(true) }) it('should render create folder button when in embed mode', () => { mockUseEmbedMode.mockReturnValue({ isEnabled: computed(() => true) }) const { wrapper } = getMountedWrapper({ stubs: { 'app-bar': AppBarStub, CreateAndUpload: true } }) expect(wrapper.find(selectors.btnCreateFolder).exists()).toBe(true) }) it('should not render create and upload actions when in embed mode', () => { mockUseEmbedMode.mockReturnValue({ isEnabled: computed(() => true) }) const { wrapper } = getMountedWrapper({ stubs: { 'app-bar': AppBarStub, CreateAndUpload: true } }) expect(wrapper.find(selectors.actionsCreateAndUpload).exists()).toBe(false) }) it('should call createNewFolderAction when create folder button is clicked', () => { mockUseEmbedMode.mockReturnValue({ isEnabled: computed(() => true) }) const { wrapper } = getMountedWrapper({ stubs: { 'app-bar': AppBarStub, CreateAndUpload: true } }) // @ts-expect-error even though the vm object is not specified on WrapperLike, it actually is present there wrapper.findComponent(selectors.btnCreateFolder).vm.$emit('click') expect(mockCreateFolder).toHaveBeenCalledTimes(1) }) }) }) function getMountedWrapper({ mocks = {}, props = {}, files = [], loading = false, currentRoute = { name: 'files-spaces-generic', path: '/' }, currentFolder = mock<Resource>(), runningOnEos = false, space = mock<SpaceResource>({ id: '1', getDriveAliasAndItem: vi.fn(), name: 'Personal space', driveType: '' }), breadcrumbsFromPath = [], stubs = {} } = {}) { const resourcesViewDetailsMock = useResourcesViewDefaultsMock({ paginatedResources: ref(files), areResourcesLoading: ref(loading) }) vi.mocked(useResourcesViewDefaults).mockImplementation(() => resourcesViewDetailsMock) vi.mocked(useBreadcrumbsFromPath).mockImplementation(() => useBreadcrumbsFromPathMock({ breadcrumbsFromPath: vi.fn(() => breadcrumbsFromPath) }) ) const extensions = [ { id: 'com.github.owncloud.web.files.folder-view.resource-table', type: 'folderView', scopes: ['resource', 'space', 'favorite'], folderView: { name: 'resource-table', label: 'Switch to default view', icon: { name: 'menu-line', fillType: 'none' }, component: h('div', { class: 'resource-table' }) } } ] vi.mocked(useExtensionRegistry).mockImplementation(() => useExtensionRegistryMock({ requestExtensions<ExtensionType>(type: string, scopes: string[]) { return extensions as ExtensionType[] } }) ) const defaultMocks = { ...defaultComponentMocks({ currentRoute: mock<RouteLocation>(currentRoute) }), ...(mocks && mocks) } const propsData: ComponentProps<typeof GenericSpace> = { space, item: '/', itemId: undefined, ...props } return { mocks: { ...defaultMocks, ...resourcesViewDetailsMock }, wrapper: mount(GenericSpace, { props: propsData, global: { plugins: [ ...defaultPlugins({ piniaOptions: { configState: { options: { runningOnEos } }, resourcesStore: { currentFolder } } }) ], mocks: defaultMocks, provide: defaultMocks, stubs: { ...defaultStubs, 'resource-details': true, portal: true, ...stubs } } }) } }
owncloud/web/packages/web-app-files/tests/unit/views/spaces/GenericSpace.spec.ts/0
{ "file_path": "owncloud/web/packages/web-app-files/tests/unit/views/spaces/GenericSpace.spec.ts", "repo_id": "owncloud", "token_count": 5083 }
879
import { FederatedConnection, FederatedUser } from '@ownclouders/web-pkg' export const getConnectionId = (user: FederatedUser) => { return `${user.user_id}@${user.idp}` } export const buildConnection = (user: FederatedUser): FederatedConnection => { return { id: getConnectionId(user), ...user } }
owncloud/web/packages/web-app-ocm/src/functions.ts/0
{ "file_path": "owncloud/web/packages/web-app-ocm/src/functions.ts", "repo_id": "owncloud", "token_count": 106 }
880
<template> <div class="preview-details" :class="{ lightbox: isFullScreenModeActivated }"> <div class="oc-background-brand oc-p-s oc-width-large oc-flex oc-flex-middle oc-flex-center oc-flex-around preview-controls-action-bar" > <oc-button v-oc-tooltip="previousDescription" class="preview-controls-previous" appearance="raw-inverse" variation="brand" :aria-label="previousDescription" @click="$emit('togglePrevious')" > <oc-icon size="large" name="arrow-drop-left" variation="inherit" /> </oc-button> <p v-if="!isFolderLoading" class="oc-m-rm preview-controls-action-count"> <span aria-hidden="true" v-text="ariaHiddenFileCount" /> <span class="oc-invisible-sr" v-text="screenreaderFileCount" /> </p> <oc-button v-oc-tooltip="nextDescription" class="preview-controls-next" appearance="raw-inverse" variation="brand" :aria-label="nextDescription" @click="$emit('toggleNext')" > <oc-icon size="large" name="arrow-drop-right" variation="inherit" /> </oc-button> <div class="oc-flex"> <oc-button v-oc-tooltip=" isFullScreenModeActivated ? exitFullScreenDescription : enterFullScreenDescription " class="preview-controls-fullscreen" appearance="raw-inverse" variation="brand" :aria-label=" isFullScreenModeActivated ? exitFullScreenDescription : enterFullScreenDescription " @click="$emit('toggleFullScreen')" > <oc-icon fill-type="line" :name="isFullScreenModeActivated ? 'fullscreen-exit' : 'fullscreen'" variation="inherit" /> </oc-button> </div> <div v-if="isImage" class="oc-flex oc-flex-middle"> <div class="oc-flex"> <oc-button v-oc-tooltip="imageShrinkDescription" class="preview-controls-image-shrink" appearance="raw-inverse" variation="brand" :aria-label="imageShrinkDescription" @click="imageShrink" > <oc-icon fill-type="line" name="zoom-out" variation="inherit" /> </oc-button> <oc-button v-oc-tooltip="imageOriginalSizeDescription" class="preview-controls-image-original-size oc-ml-s oc-mr-s" appearance="raw-inverse" variation="brand" :aria-label="imageOriginalSizeDescription" @click="$emit('setZoom', 1)" > <span v-text="currentZoomDisplayValue" /> </oc-button> <oc-button v-oc-tooltip="imageZoomDescription" class="preview-controls-image-zoom" appearance="raw-inverse" variation="brand" :aria-label="imageZoomDescription" @click="imageZoom" > <oc-icon fill-type="line" name="zoom-in" variation="inherit" /> </oc-button> </div> <div class="oc-ml-m"> <oc-button v-oc-tooltip="imageRotateLeftDescription" class="preview-controls-rotate-left" appearance="raw-inverse" variation="brand" :aria-label="imageRotateLeftDescription" @click="imageRotateLeft" > <oc-icon fill-type="line" name="anticlockwise" variation="inherit" /> </oc-button> <oc-button v-oc-tooltip="imageRotateRightDescription" class="preview-controls-rotate-right" appearance="raw-inverse" variation="brand" :aria-label="imageRotateRightDescription" @click="imageRotateRight" > <oc-icon fill-type="line" name="clockwise" variation="inherit" /> </oc-button> </div> <div class="oc-ml-m"> <oc-button v-oc-tooltip="imageResetDescription" class="preview-controls-image-reset" appearance="raw-inverse" variation="brand" :aria-label="imageResetDescription" @click="$emit('resetImage')" > <oc-icon fill-type="line" name="refresh" variation="inherit" /> </oc-button> </div> </div> </div> </div> </template> <script lang="ts"> import { computed, defineComponent, PropType } from 'vue' import { useGettext } from 'vue3-gettext' import { Resource } from '@ownclouders/web-client/src' export default defineComponent({ name: 'MediaControls', props: { files: { type: Array as PropType<Resource[]>, required: true }, activeIndex: { type: Number, required: true }, isFullScreenModeActivated: { type: Boolean, default: false }, isFolderLoading: { type: Boolean, default: false }, isImage: { type: Boolean, default: false }, currentImageZoom: { type: Number, default: 1 }, currentImageRotation: { type: Number, default: 0 } }, emits: [ 'setRotation', 'setZoom', 'toggleFullScreen', 'toggleNext', 'togglePrevious', 'resetImage' ], setup(props, { emit }) { const { $gettext } = useGettext() const currentZoomDisplayValue = computed(() => { return `${(props.currentImageZoom * 100).toFixed(0)}%` }) const ariaHiddenFileCount = computed(() => { return $gettext('%{ displayIndex } of %{ availableMediaFiles }', { displayIndex: (props.activeIndex + 1).toString(), availableMediaFiles: props.files.length.toString() }) }) const screenreaderFileCount = computed(() => { return $gettext('Media file %{ displayIndex } of %{ availableMediaFiles }', { displayIndex: (props.activeIndex + 1).toString(), availableMediaFiles: props.files.length.toString() }) }) const calculateZoom = (zoom, factor) => { return Math.round(zoom * factor * 20) / 20 } const imageShrink = () => { emit('setZoom', Math.max(0.1, calculateZoom(props.currentImageZoom, 0.8))) } const imageZoom = () => { const maxZoomValue = calculateZoom(9, 1.25) emit('setZoom', Math.min(calculateZoom(props.currentImageZoom, 1.25), maxZoomValue)) } const imageRotateLeft = () => { emit('setRotation', props.currentImageRotation === -270 ? 0 : props.currentImageRotation - 90) } const imageRotateRight = () => { emit('setRotation', props.currentImageRotation === 270 ? 0 : props.currentImageRotation + 90) } return { currentZoomDisplayValue, screenreaderFileCount, ariaHiddenFileCount, enterFullScreenDescription: $gettext('Enter full screen mode'), exitFullScreenDescription: $gettext('Exit full screen mode'), imageShrinkDescription: $gettext('Shrink the image'), imageZoomDescription: $gettext('Enlarge the image'), imageResetDescription: $gettext('Reset'), imageOriginalSizeDescription: $gettext('Show the image at its normal size'), imageRotateLeftDescription: $gettext('Rotate the image 90 degrees to the left'), imageRotateRightDescription: $gettext('Rotate the image 90 degrees to the right'), previousDescription: $gettext('Show previous media file in folder'), nextDescription: $gettext('Show next media file in folder'), imageShrink, imageZoom, imageRotateLeft, imageRotateRight } } }) </script> <style lang="scss" scoped> .preview-details.lightbox { z-index: 1000; opacity: 0.9; } .preview-controls-action-count { color: var(--oc-color-swatch-brand-contrast); } .preview-controls-image-original-size { width: 42px; } </style>
owncloud/web/packages/web-app-preview/src/components/MediaControls.vue/0
{ "file_path": "owncloud/web/packages/web-app-preview/src/components/MediaControls.vue", "repo_id": "owncloud", "token_count": 3540 }
881
<template> <div v-if="isSearchBarEnabled" id="files-global-search" ref="searchBar" class="oc-flex" data-custom-key-bindings-disabled="true" > <oc-search-bar id="files-global-search-bar" ref="search" :label="searchLabel" :type-ahead="true" :value="term" :placeholder="searchLabel" :button-hidden="true" :show-cancel-button="showCancelButton" :show-advanced-search-button="listProviderAvailable" cancel-button-variation="brand" cancel-button-appearance="raw-inverse" :cancel-handler="cancelSearch" @advanced-search="onKeyUpEnter" @input="updateTerm" @clear="onClear" @click="showPreview" @keyup.esc="hideOptionsDrop" @keyup.up="onKeyUpUp" @keyup.down="onKeyUpDown" @keyup.enter="onKeyUpEnter" > <template #locationFilter> <search-bar-filter v-if="locationFilterAvailable" :current-folder-available="currentFolderAvailable" @update:model-value="onLocationFilterChange" /> </template> </oc-search-bar> <oc-button v-oc-tooltip="$gettext('Display search bar')" :aria-label="$gettext('Click to display and focus the search bar')" class="mobile-search-btn oc-mr-l" appearance="raw-inverse" variation="brand" @click="showSearchBar" > <oc-icon name="search" fill-type="line"></oc-icon> </oc-button> <oc-drop id="files-global-search-options" ref="optionsDropRef" mode="manual" target="#files-global-search-bar" close-on-click > <oc-list class="oc-list-divider"> <li v-if="loading" class="loading spinner oc-flex oc-flex-center oc-flex-middle oc-text-muted" > <oc-spinner size="small" :aria-hidden="true" aria-label="" /> <span class="oc-ml-s">{{ $gettext('Searching ...') }}</span> </li> <li v-else-if="showNoResults" id="no-results" class="oc-flex oc-flex-center"> {{ $gettext('No results') }} </li> <template v-else> <li v-for="provider in displayProviders" :key="provider.id" class="provider"> <oc-list> <li class="oc-text-truncate oc-flex oc-flex-between oc-text-muted provider-details"> <span class="display-name" v-text="$gettext(provider.displayName)" /> <span v-if="!!provider.listSearch"> <router-link class="more-results" :to="getSearchResultLocation(provider.id)"> <span>{{ getMoreResultsDetailsTextForProvider(provider) }}</span> </router-link> </span> </li> <li v-for="providerSearchResultValue in getSearchResultForProvider(provider).values" :key="providerSearchResultValue.id" :data-search-id="providerSearchResultValue.id" :class="{ active: isPreviewElementActive(providerSearchResultValue.id) }" class="preview oc-flex oc-flex-middle" > <component :is="provider.previewSearch.component" class="preview-component" :provider="provider" :search-result="providerSearchResultValue" /> </li> </oc-list> </li> </template> </oc-list> </oc-drop> </div> <div v-else><!-- no search provider available --></div> </template> <script lang="ts"> import { createLocationCommon, isLocationCommonActive, isLocationSpacesActive, queryItemAsString, useAuthStore, useCapabilityStore, useResourcesStore } from '@ownclouders/web-pkg' import Mark from 'mark.js' import { storeToRefs } from 'pinia' import { debounce } from 'lodash-es' import { useRouteQuery, useRouter } from '@ownclouders/web-pkg' import { eventBus } from '@ownclouders/web-pkg' import { computed, defineComponent, GlobalComponents, inject, Ref, ref, unref, watch } from 'vue' import { SearchLocationFilterConstants } from '@ownclouders/web-pkg' import { SearchBarFilter } from '@ownclouders/web-pkg' import { useAvailableProviders } from '../composables' export default defineComponent({ name: 'SearchBar', components: { SearchBarFilter }, setup() { const router = useRouter() const capabilityStore = useCapabilityStore() const showCancelButton = ref(false) const isMobileWidth = inject<Ref<boolean>>('isMobileWidth') const scopeQueryValue = useRouteQuery('scope') const availableProviders = useAvailableProviders() const authStore = useAuthStore() const { userContextReady } = storeToRefs(authStore) const resourcesStore = useResourcesStore() const { currentFolder } = storeToRefs(resourcesStore) const locationFilterId = ref(SearchLocationFilterConstants.allFiles) const optionsDropRef = ref(null) const activePreviewIndex = ref(null) const term = ref('') const restoreSearchFromRoute = ref(false) const searchResults = ref([]) const loading = ref(false) const currentFolderAvailable = ref(false) const fullTextSearchEnabled = computed(() => capabilityStore.searchContent?.enabled) const listProviderAvailable = computed(() => unref(availableProviders).some((p) => !!p.listSearch) ) const locationFilterAvailable = computed(() => // FIXME: use capability as soon as we have one unref(availableProviders).some((p) => !!p.listSearch) ) watch(isMobileWidth, () => { const searchBarEl = document.getElementById('files-global-search-bar') const optionDropVisible = !!document.querySelector('.tippy-box[data-state="visible"]') if (!unref(isMobileWidth)) { searchBarEl.style.visibility = 'visible' showCancelButton.value = false } else { if (optionDropVisible) { searchBarEl.style.visibility = 'visible' showCancelButton.value = true } else { searchBarEl.style.visibility = 'hidden' showCancelButton.value = false } } }) const optionsDrop = computed(() => { return unref(optionsDropRef) as InstanceType<GlobalComponents['OcDrop']> }) const scope = computed(() => { if (unref(currentFolderAvailable) && unref(currentFolder)?.fileId) { return unref(currentFolder).fileId } return queryItemAsString(unref(scopeQueryValue)) }) const useScope = computed(() => { return ( unref(currentFolderAvailable) && unref(locationFilterId) === SearchLocationFilterConstants.currentFolder ) }) const search = async () => { searchResults.value = [] if (!unref(term)) { return } const terms: string[] = [] let nameQuery = `name:"*${unref(term)}*"` if (unref(fullTextSearchEnabled)) { nameQuery = `(name:"*${unref(term)}*" OR content:"${unref(term)}")` } terms.push(nameQuery) if (unref(useScope)) { terms.push(`scope:${unref(scope)}`) } loading.value = true for (const availableProvider of unref(availableProviders)) { if (availableProvider.previewSearch?.available) { searchResults.value.push({ providerId: availableProvider.id, result: await availableProvider.previewSearch.search(terms.join(' ')) }) } } loading.value = false } const onKeyUpEnter = () => { if (!unref(listProviderAvailable)) { return } if (unref(optionsDrop)) { unref(optionsDrop).hide() } if (unref(activePreviewIndex) === null) { router.push(getSearchResultLocation('files.sdk')) } if (unref(activePreviewIndex) !== null) { unref(optionsDrop) .$el.querySelectorAll('.preview') [unref(activePreviewIndex)].firstChild.click() } } const getSearchResultLocation = (providerId: string) => { const currentQuery = unref(router.currentRoute).query return createLocationCommon('files-common-search', { query: { ...(currentQuery && { ...currentQuery }), term: unref(term), ...(unref(scope) && { scope: unref(scope) }), useScope: unref(useScope).toString(), provider: providerId } }) } const onLocationFilterChange = (event) => { locationFilterId.value = event.value.id if (!unref(term)) { return } if (isLocationCommonActive(router, 'files-common-search')) { onKeyUpEnter() return } search() } const showPreview = async () => { if (!unref(term)) { return } unref(optionsDrop).show() await search() } const updateTerm = (input) => { restoreSearchFromRoute.value = false term.value = input if (!unref(term)) { return unref(optionsDrop).hide() } return unref(optionsDrop).show() } const debouncedSearch = debounce(search, 500) watch(term, () => { if (unref(restoreSearchFromRoute)) { restoreSearchFromRoute.value = false return } debouncedSearch() }) return { userContextReady, showCancelButton, onLocationFilterChange, currentFolderAvailable, listProviderAvailable, locationFilterAvailable, scopeQueryValue, optionsDrop, optionsDropRef, activePreviewIndex, term, restoreSearchFromRoute, onKeyUpEnter, searchResults, loading, availableProviders, search, showPreview, updateTerm, getSearchResultLocation } }, data() { return { activeProvider: undefined, optionsVisible: false, markInstance: null, clearTermEvent: null } }, computed: { showNoResults() { return this.searchResults.every(({ result }) => !result.values.length) }, isSearchBarEnabled() { return this.availableProviders.length && this.userContextReady }, displayProviders() { /** * Computed to filter and sort providers that will be displayed * Only show providers which actually hold results */ return this.availableProviders.filter( (provider) => this.getSearchResultForProvider(provider).values.length ) }, searchLabel() { return this.$gettext('Enter search term') } }, watch: { searchResults: { handler() { this.activePreviewIndex = null this.$nextTick(() => { if (this.showNoResults) { return } if (this.optionsDrop) { this.markInstance = new Mark(this.optionsDrop.$refs.drop) this.markInstance.unmark() this.markInstance.mark(this.term, { element: 'span', className: 'mark-highlight', exclude: ['.provider-details *'] }) } }) }, deep: true }, $route: { handler(r) { this.parseRouteQuery(r) }, immediate: false } }, created() { this.clearTermEvent = eventBus.subscribe('app.search.term.clear', () => { this.term = '' }) this.parseRouteQuery(this.$route, true) }, beforeUnmount() { eventBus.unsubscribe('app.search.term.clear', this.clearTermEvent) }, methods: { onClear() { this.term = '' this.optionsDrop.hide() }, findNextPreviewIndex(previous = false) { const elements = Array.from(document.querySelectorAll('li.preview')) let index = this.activePreviewIndex !== null ? this.activePreviewIndex : previous ? elements.length : -1 const increment = previous ? -1 : 1 do { index += increment if (index < 0 || index > elements.length - 1) { return null } } while (elements[index].classList.contains('disabled')) return index }, onKeyUpUp() { this.activePreviewIndex = this.findNextPreviewIndex(true) this.scrollToActivePreviewOption() }, onKeyUpDown() { this.activePreviewIndex = this.findNextPreviewIndex(false) this.scrollToActivePreviewOption() }, scrollToActivePreviewOption() { if (typeof this.optionsDrop.$el.scrollTo !== 'function') { return } const previewElements = this.optionsDrop.$el.querySelectorAll('.preview') this.optionsDrop.$el.scrollTo( 0, this.activePreviewIndex === null ? 0 : previewElements[this.activePreviewIndex].getBoundingClientRect().y - previewElements[this.activePreviewIndex].getBoundingClientRect().height ) }, getSearchResultForProvider(provider) { return this.searchResults.find(({ providerId }) => providerId === provider.id)?.result }, parseRouteQuery(route, initialLoad = false) { const currentFolderAvailable = (isLocationSpacesActive(this.$router, 'files-spaces-generic') || !!this.scopeQueryValue) && !isLocationSpacesActive(this.$router, 'files-spaces-projects') if (this.currentFolderAvailable !== currentFolderAvailable) { this.currentFolderAvailable = currentFolderAvailable } this.$nextTick(() => { if (!this.availableProviders.length) { return } const routeTerm = route?.query?.term const input = this.$el.getElementsByTagName('input')[0] if (!input || !routeTerm) { return } this.restoreSearchFromRoute = initialLoad this.term = routeTerm input.value = routeTerm }) }, getMoreResultsDetailsTextForProvider(provider) { const searchResult = this.getSearchResultForProvider(provider) if (!searchResult || !searchResult.totalResults) { return this.$gettext('Show all results') } return this.$ngettext( 'Show %{totalResults} result', 'Show %{totalResults} results', searchResult.totalResults, { totalResults: searchResult.totalResults } ) }, isPreviewElementActive(searchId) { const previewElements = this.optionsDrop.$el.querySelectorAll('.preview') return previewElements[this.activePreviewIndex]?.dataset?.searchId === searchId }, showSearchBar() { document.getElementById('files-global-search-bar').style.visibility = 'visible' const inputElement = document.getElementsByClassName('oc-search-input')[0] as HTMLElement inputElement.focus() this.showCancelButton = true }, cancelSearch() { document.getElementById('files-global-search-bar').style.visibility = 'hidden' this.showCancelButton = false }, hideOptionsDrop() { this.optionsDrop.hide() } } }) </script> <style lang="scss"> #files-global-search { .mobile-search-btn { display: none; @media (max-width: 639px) { display: inline-flex; } } .oc-search-input { background-color: var(--oc-color-input-bg); transition: 0s; height: 2.3rem; @media (max-width: 639px) { border: none; display: inline; } } #files-global-search-bar { width: 452px; @media (max-width: 959px) { width: 300px; } @media (max-width: 639px) { visibility: hidden; background-color: var(--oc-color-swatch-brand-default); position: absolute; height: 48px; left: 0; right: 0; margin: 0 auto; top: 0; width: 95vw !important; z-index: 9; .oc-search-input-icon { padding: 0 var(--oc-space-xlarge); } input, input:not(:placeholder-shown) { background-color: var(--oc-color-input-bg); border: 1px solid var(--oc-color-input-border); z-index: var(--oc-z-index-modal); margin: 0 auto; } } } #files-global-search-options { width: 450px; overflow-y: auto; max-height: calc(100vh - 60px); text-decoration: none; .oc-card { padding: 0 !important; } @media (max-width: 969px) { width: 300px; } @media (max-width: 639px) { width: 93vw !important; } ul { li.provider-details, li.loading, li#no-results { padding: var(--oc-space-xsmall) var(--oc-space-small); } li { position: relative; font-size: var(--oc-font-size-small); &.provider-details { font-size: var(--oc-font-size-xsmall); } &.preview { min-height: 44px; font-size: inherit; padding: var(--oc-space-xsmall) var(--oc-space-small); &:hover, &.active { background-color: var(--oc-color-background-highlight); } &.disabled { background-color: var(--oc-color-background-muted); pointer-events: none; opacity: 0.7; filter: grayscale(0.6); } } } } } } </style>
owncloud/web/packages/web-app-search/src/portals/SearchBar.vue/0
{ "file_path": "owncloud/web/packages/web-app-search/src/portals/SearchBar.vue", "repo_id": "owncloud", "token_count": 7498 }
882
import { OwnCloudServer } from 'web-app-webfinger/src/discovery/types' import { ClientService } from '@ownclouders/web-pkg' import { urlJoin } from '@ownclouders/web-client/src/utils' interface OwnCloudInstancesResponse { subject: string links: OwnCloudServer[] } const OWNCLOUD_REL = 'http://webfinger.owncloud/rel/server-instance' export class WebfingerDiscovery { private serverUrl: string private clientService: ClientService constructor(serverUrl: string, clientService: ClientService) { this.serverUrl = serverUrl this.clientService = clientService } public async discoverOwnCloudServers(): Promise<OwnCloudServer[]> { const client = this.clientService.httpAuthenticated const url = urlJoin(this.serverUrl, '.well-known', 'webfinger') + `?resource=${encodeURI(this.serverUrl)}` const response = (await client.get<OwnCloudInstancesResponse>(url)).data return response.links.filter((o) => o.rel === OWNCLOUD_REL) } }
owncloud/web/packages/web-app-webfinger/src/discovery/webfingerDiscovery.ts/0
{ "file_path": "owncloud/web/packages/web-app-webfinger/src/discovery/webfingerDiscovery.ts", "repo_id": "owncloud", "token_count": 307 }
883
#!/bin/sh # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ # # Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" git_user_id=$1 git_repo_id=$2 release_note=$3 git_host=$4 if [ "$git_host" = "" ]; then git_host="github.com" echo "[INFO] No command line input provided. Set \$git_host to $git_host" fi if [ "$git_user_id" = "" ]; then git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi if [ "$release_note" = "" ]; then release_note="Minor update" echo "[INFO] No command line input provided. Set \$release_note to $release_note" fi # Initialize the local directory as a Git repository git init # Adds the files in the local repository and stages them for commit. git add . # Commits the tracked changes and prepares them to be pushed to a remote repository. git commit -m "$release_note" # Sets the new remote git_remote=$(git remote) if [ "$git_remote" = "" ]; then # git remote not defined if [ "$GIT_TOKEN" = "" ]; then echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git else git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git fi fi git pull origin master # Pushes (Forces) the changes in the local repository up to the remote repository echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" git push origin master 2>&1 | grep -v 'To https'
owncloud/web/packages/web-client/src/generated/git_push.sh/0
{ "file_path": "owncloud/web/packages/web-client/src/generated/git_push.sh", "repo_id": "owncloud", "token_count": 674 }
884
import { intersection } from 'lodash-es' // dummy to trick gettext string extraction into recognizing strings const $gettext = (str) => { return str } export class ShareType { private readonly _key: string private readonly _value: number private readonly _label: string private readonly _icon: string constructor(key: string, value: number, label: string, icon: string) { this._key = key this._value = value this._label = label this._icon = icon } get key(): string { return this._key } get value(): number { return this._value } get label(): string { return this._label } get icon(): string { return this._icon } } export abstract class ShareTypes { static readonly user = new ShareType('user', 0, $gettext('User'), 'user') static readonly group = new ShareType('group', 1, $gettext('Group'), 'group') static readonly link = new ShareType('link', 3, $gettext('Link'), 'link') static readonly guest = new ShareType('guest', 4, $gettext('Guest'), 'global') static readonly remote = new ShareType('remote', 6, $gettext('Federated'), 'earth') static readonly spaceUser = new ShareType('spaceUser', 7, $gettext('User'), 'user') static readonly spaceGroup = new ShareType('spaceGroup', 8, $gettext('Group'), 'group') static readonly individuals = [this.user, this.guest, this.remote, this.spaceUser] static readonly collectives = [this.group, this.spaceGroup] static readonly unauthenticated = [this.link] static readonly authenticated = [ this.user, this.group, this.guest, this.remote, this.spaceUser, this.spaceGroup ] static readonly all = [ this.user, this.group, this.link, this.guest, this.remote, this.spaceUser, this.spaceGroup ] static isIndividual(type: ShareType): boolean { return this.individuals.includes(type) } static isCollective(type: ShareType): boolean { return this.collectives.includes(type) } static isUnauthenticated(type: ShareType): boolean { return this.unauthenticated.includes(type) } static isAuthenticated(type: ShareType): boolean { return this.authenticated.includes(type) } static getByValue(value: number): ShareType { return this.all.find((type) => type.value === value) } static getByValues(values: number[]): ShareType[] { return values.map((value) => this.getByValue(value)) } static getValues(types: ShareType[]): number[] { return types.map((t) => t.value) } static containsAnyValue(types: ShareType[], values: number[]): boolean { return intersection(this.getValues(types), values).length > 0 } }
owncloud/web/packages/web-client/src/helpers/share/type.ts/0
{ "file_path": "owncloud/web/packages/web-client/src/helpers/share/type.ts", "repo_id": "owncloud", "token_count": 870 }
885
import { XMLBuilder } from 'fast-xml-parser' import { DavProperties, DavPropertyValue } from '../constants' import { SpaceResource, isPublicSpaceResource } from '../../helpers' import { Headers } from 'webdav' const getNamespacedDavProps = (obj: Partial<Record<DavPropertyValue, unknown>>) => { return Object.keys(obj).reduce<Record<string, string>>((acc, val) => { const davNamespace = DavProperties.DavNamespace.includes(val as DavPropertyValue) acc[davNamespace ? `d:${val}` : `oc:${val}`] = obj[val] || '' return acc }, {}) } export const buildPropFindBody = ( properties: DavPropertyValue[] = [], { pattern, filterRules, limit = 0 }: { pattern?: string filterRules?: Partial<Record<DavPropertyValue, unknown>> limit?: number } = {} ): string => { let bodyType = 'd:propfind' if (pattern) { bodyType = 'oc:search-files' } if (filterRules) { bodyType = 'oc:filter-files' } const object = properties.reduce((obj, item) => Object.assign(obj, { [item]: null }), {}) const props = getNamespacedDavProps(object) const xmlObj = { [bodyType]: { 'd:prop': props, '@@xmlns:d': 'DAV:', '@@xmlns:oc': 'http://owncloud.org/ns', ...(pattern && { 'oc:search': { 'oc:pattern': pattern, 'oc:limit': limit } }), ...(filterRules && { 'oc:filter-rules': getNamespacedDavProps(filterRules) }) } } const builder = new XMLBuilder({ format: true, ignoreAttributes: false, attributeNamePrefix: '@@', suppressEmptyNode: true }) return builder.build(xmlObj) } export const buildPropPatchBody = ( properties: Partial<Record<DavPropertyValue, unknown>> ): string => { const xmlObj = { 'd:propertyupdate': { 'd:set': { 'd:prop': getNamespacedDavProps(properties) }, '@@xmlns:d': 'DAV:', '@@xmlns:oc': 'http://owncloud.org/ns' } } const builder = new XMLBuilder({ format: true, ignoreAttributes: false, attributeNamePrefix: '@@', suppressEmptyNode: true }) return builder.build(xmlObj) } export const buildPublicLinkAuthHeader = (password: string) => { return 'Basic ' + Buffer.from('public:' + password).toString('base64') } export const buildAuthHeader = (token: string, space: SpaceResource = null): Headers => { if (isPublicSpaceResource(space)) { // TODO: make check cleaner if (space.driveAlias.startsWith('ocm/')) { return { Authorization: `Bearer ${space.id}` } } if (space.publicLinkPassword) { return { Authorization: buildPublicLinkAuthHeader(space.publicLinkPassword) } } return {} } return { Authorization: `Bearer ${token}` } }
owncloud/web/packages/web-client/src/webdav/client/builders.ts/0
{ "file_path": "owncloud/web/packages/web-client/src/webdav/client/builders.ts", "repo_id": "owncloud", "token_count": 1005 }
886
import { WebDavOptions } from './types' import { urlJoin } from '../utils' import { DAV, buildAuthHeader } from './client' import { buildResource } from '../helpers' import { unref } from 'vue' export const ListFileVersionsFactory = (dav: DAV, { accessToken }: WebDavOptions) => { return { async listFileVersions(id: string) { const headers = buildAuthHeader(unref(accessToken)) // eslint-disable-next-line @typescript-eslint/no-unused-vars const [currentFolder, ...versions] = await dav.propfind( urlJoin('meta', id, 'v', { leadingSlash: true }), { headers } ) return versions.map(buildResource) } } }
owncloud/web/packages/web-client/src/webdav/listFileVersions.ts/0
{ "file_path": "owncloud/web/packages/web-client/src/webdav/listFileVersions.ts", "repo_id": "owncloud", "token_count": 247 }
887
{ "name": "ownCloud", "short_name": "ownCloud", "icons": [{ "src": "img/owncloud-app-icon.png", "sizes": "512x512", "type": "image/png" }], "start_url": "/", "display": "fullscreen", "orientation": "portrait", "background_color": "#FFFFFF", "theme_color": "#375f7E" }
owncloud/web/packages/web-container/manifest.json/0
{ "file_path": "owncloud/web/packages/web-container/manifest.json", "repo_id": "owncloud", "token_count": 128 }
888
export { default as AppBar } from './AppBar.vue'
owncloud/web/packages/web-pkg/src/components/AppBar/index.ts/0
{ "file_path": "owncloud/web/packages/web-pkg/src/components/AppBar/index.ts", "repo_id": "owncloud", "token_count": 17 }
889
<template> <context-action-menu :menu-sections="menuSections" :action-options="_actionOptions" /> </template> <script lang="ts"> import ContextActionMenu from '../ContextActions/ContextActionMenu.vue' import { useFileActionsOpenShortcut, ActionExtension, useExtensionRegistry, useFileActionsToggleHideShare } from '../../composables' import { computed, defineComponent, PropType, Ref, toRef, unref } from 'vue' import { useFileActionsCopyQuickLink, useFileActionsPaste, useFileActionsShowDetails, useFileActionsShowShares, useFileActionsEnableSync, useFileActionsCopy, useFileActionsDisableSync, useFileActionsDelete, useFileActionsDownloadArchive, useFileActionsEmptyTrashBin, useFileActionsMove, useFileActionsRestore, useFileActionsDownloadFile, useFileActionsRename, useFileActionsSetImage, useFileActionsNavigate, useFileActionsFavorite, useFileActionsCreateSpaceFromResource, useFileActionsSetReadme, useFileActions } from '../../composables/actions/files' import { FileActionOptions } from '../../composables/actions' export default defineComponent({ name: 'ContextActions', components: { ContextActionMenu }, props: { actionOptions: { type: Object as PropType<FileActionOptions>, required: true } }, setup(props) { const { editorActions } = useFileActions() const { actions: enableSyncActions } = useFileActionsEnableSync() const { actions: hideShareActions } = useFileActionsToggleHideShare() const { actions: copyActions } = useFileActionsCopy() const { actions: createQuickLinkActions } = useFileActionsCopyQuickLink() const { actions: disableSyncActions } = useFileActionsDisableSync() const { actions: deleteActions } = useFileActionsDelete() const { actions: downloadArchiveActions } = useFileActionsDownloadArchive() const { actions: downloadFileActions } = useFileActionsDownloadFile() const { actions: favoriteActions } = useFileActionsFavorite() const { actions: emptyTrashBinActions } = useFileActionsEmptyTrashBin() const { actions: moveActions } = useFileActionsMove() const { actions: navigateActions } = useFileActionsNavigate() const { actions: pasteActions } = useFileActionsPaste() const { actions: renameActions } = useFileActionsRename() const { actions: restoreActions } = useFileActionsRestore() const { actions: setSpaceImageActions } = useFileActionsSetImage() const { actions: setSpaceReadmeActions } = useFileActionsSetReadme() const { actions: showDetailsActions } = useFileActionsShowDetails() const { actions: createSpaceFromResourceActions } = useFileActionsCreateSpaceFromResource() const { actions: showSharesActions } = useFileActionsShowShares() const { actions: openShortcutActions } = useFileActionsOpenShortcut() const extensionRegistry = useExtensionRegistry() const extensionContextActions = computed(() => { return extensionRegistry .requestExtensions<ActionExtension>('action', ['resource.context-menu']) .map((e) => e.action) }) // type cast to make vue-tsc aware of the type const actionOptions = toRef(props, 'actionOptions') as Ref<FileActionOptions> const menuItemsBatchActions = computed(() => [ ...unref(enableSyncActions), ...unref(disableSyncActions), ...unref(downloadArchiveActions), ...unref(moveActions), ...unref(copyActions), ...unref(emptyTrashBinActions), ...unref(deleteActions), ...unref(restoreActions), ...unref(createSpaceFromResourceActions) ].filter((item) => item.isVisible(unref(actionOptions))) ) const menuItemsContext = computed(() => { const fileHandlers = [...unref(openShortcutActions), ...unref(editorActions)] return [...fileHandlers] .filter((item) => item.isVisible(unref(actionOptions))) .sort((x, y) => Number(y.hasPriority) - Number(x.hasPriority)) }) const menuItemsShare = computed(() => { return [...unref(showSharesActions), ...unref(createQuickLinkActions)].filter((item) => item.isVisible(unref(actionOptions)) ) }) const menuItemsActions = computed(() => { return [ ...unref(downloadArchiveActions), ...unref(downloadFileActions), ...unref(deleteActions), ...unref(moveActions), ...unref(copyActions), ...unref(pasteActions), ...unref(renameActions), ...unref(createSpaceFromResourceActions), ...unref(restoreActions), ...unref(enableSyncActions), ...unref(disableSyncActions), ...unref(hideShareActions), ...unref(setSpaceImageActions), ...unref(setSpaceReadmeActions), ...unref(extensionContextActions) ].filter((item) => item.isVisible(unref(actionOptions))) }) const menuItemsSidebar = computed(() => { const fileHandlers = [...unref(navigateActions)] return [ ...unref(favoriteActions).map((action) => { action.keepOpen = true return action }), ...fileHandlers, ...unref(showDetailsActions) ].filter((item) => item.isVisible(unref(actionOptions))) }) const menuSections = computed(() => { const sections = [] if (unref(actionOptions).resources.length > 1) { if (unref(menuItemsBatchActions).length) { sections.push({ name: 'batch-actions', items: [...unref(menuItemsBatchActions)] }) } sections.push({ name: 'batch-details', items: [...unref(showDetailsActions)] }) return sections } if (unref(menuItemsContext).length) { sections.push({ name: 'context', items: unref(menuItemsContext) }) } if (unref(menuItemsShare).length) { sections.push({ name: 'share', items: unref(menuItemsShare) }) } if (unref(menuItemsActions).length) { sections.push({ name: 'actions', items: unref(menuItemsActions) }) } if (unref(menuItemsSidebar).length) { sections.push({ name: 'sidebar', items: unref(menuItemsSidebar) }) } return sections }) return { menuSections, _actionOptions: actionOptions } } }) </script>
owncloud/web/packages/web-pkg/src/components/FilesList/ContextActions.vue/0
{ "file_path": "owncloud/web/packages/web-pkg/src/components/FilesList/ContextActions.vue", "repo_id": "owncloud", "token_count": 2519 }
890
<template> <oc-button v-if="availableLinkTypeOptions.length > 1" :id="`link-role-dropdown-toggle-${dropUuid}`" appearance="raw" gap-size="none" class="oc-text-left link-role-dropdown-toggle" > <span class="link-current-role" v-text="currentLinkRoleLabel || $gettext('Select a role')" /> <oc-icon name="arrow-down-s" /> </oc-button> <span v-else v-oc-tooltip="getLinkRoleByType(modelValue)?.description" class="link-current-role oc-mr-m" v-text="currentLinkRoleLabel" /> <oc-drop v-if="availableLinkTypeOptions.length > 1" class="link-role-dropdown" :drop-id="`link-role-dropdown-${dropUuid}`" :toggle="`#link-role-dropdown-toggle-${dropUuid}`" padding-size="small" mode="click" :offset="dropOffset" close-on-click > <oc-list class="role-dropdown-list"> <li v-for="(type, i) in availableLinkTypeOptions" :key="`role-dropdown-${i}`"> <oc-button :id="`files-role-${getLinkId(type)}`" :class="{ selected: isSelectedType(type), 'oc-background-primary-gradient': isSelectedType(type) }" :appearance="isSelectedType(type) ? 'raw-inverse' : 'raw'" :variation="isSelectedType(type) ? 'primary' : 'passive'" justify-content="space-between" class="oc-p-s" @click="updateSelectedType(type)" > <span class="oc-flex oc-flex-middle"> <oc-icon :name="getLinkRoleByType(type).icon" class="oc-pl-s oc-pr-m" variation="inherit" /> <span> <span class="role-dropdown-list-option-label oc-text-bold oc-display-block oc-width-1-1" v-text="$gettext(getLinkRoleByType(type).displayName)" /> <span class="oc-text-small">{{ $gettext(getLinkRoleByType(type).description) }}</span> </span> </span> <span class="oc-flex"> <oc-icon v-if="isSelectedType(type)" name="check" variation="inherit" /> </span> </oc-button> </li> </oc-list> </oc-drop> </template> <script lang="ts"> import * as uuid from 'uuid' import { defineComponent, PropType } from 'vue' import { computed } from 'vue' import { useGettext } from 'vue3-gettext' import { SharingLinkType } from '@ownclouders/web-client/src/generated' import { useLinkTypes } from '../composables' export default defineComponent({ name: 'LinkRoleDropdown', props: { modelValue: { type: Object as PropType<SharingLinkType>, required: true }, availableLinkTypeOptions: { type: Array as PropType<SharingLinkType[]>, required: true }, dropOffset: { type: String, default: undefined } }, emits: ['update:modelValue'], setup(props, { emit }) { const { $gettext } = useGettext() const { getLinkRoleByType } = useLinkTypes() const isSelectedType = (type: SharingLinkType) => { return props.modelValue === type } const updateSelectedType = (type: SharingLinkType) => { emit('update:modelValue', type) } const currentLinkRoleLabel = computed(() => { return $gettext(getLinkRoleByType(props.modelValue)?.label) }) const dropUuid = uuid.v4() // FIXME: only needed for e2e and acceptance tests, map id to human readable element id const getLinkId = (type: SharingLinkType) => { const id = getLinkRoleByType(type).id const map = { internal: 'internal', view: 'viewer', upload: 'contributor', edit: 'editor', createOnly: 'uploader', blocksDownload: 'blocksDownload' } return map[id] } return { isSelectedType, updateSelectedType, currentLinkRoleLabel, dropUuid, getLinkRoleByType, getLinkId } } }) </script> <style lang="scss" scoped> @media (max-width: $oc-breakpoint-medium-default) { .link-role-dropdown { width: 100%; } } @media (min-width: $oc-breakpoint-medium-default) { .link-role-dropdown { width: 400px; } } .role-dropdown-list span { line-height: 1.3; } .role-dropdown-list li { margin: var(--oc-space-xsmall) 0; &:first-child { margin-top: 0; } &:last-child { margin-bottom: 0; } .oc-button { text-align: left; width: 100%; gap: var(--oc-space-medium); &:hover, &:focus { background-color: var(--oc-color-background-hover); text-decoration: none; } } .selected span { color: var(--oc-color-swatch-primary-contrast); } } </style>
owncloud/web/packages/web-pkg/src/components/LinkRoleDropdown.vue/0
{ "file_path": "owncloud/web/packages/web-pkg/src/components/LinkRoleDropdown.vue", "repo_id": "owncloud", "token_count": 2042 }
891
<template> <div class="file_info oc-flex oc-flex-between oc-p-s"> <div class="oc-flex oc-flex-middle"> <resource-icon v-if="isSubPanelActive" :resource="resource" size="large" class="file_info__icon oc-mr-s oc-position-relative" /> <div class="file_info__body oc-text-overflow"> <h3 data-testid="files-info-name" class="oc-font-semibold"> <resource-name :name="resource.name" :extension="resource.extension" :type="resource.type" :full-path="resource.webDavPath" :is-extension-displayed="areFileExtensionsShown" :is-path-displayed="false" :truncate-name="false" /> </h3> </div> </div> </div> </template> <script lang="ts"> import { computed, defineComponent, inject } from 'vue' import { Resource } from '@ownclouders/web-client' import { useResourcesStore } from '../../../composables' import ResourceIcon from '../../FilesList/ResourceIcon.vue' import ResourceName from '../../FilesList/ResourceName.vue' export default defineComponent({ name: 'FileInfo', components: { ResourceIcon, ResourceName }, props: { isSubPanelActive: { type: Boolean, default: true } }, setup() { const resourcesStore = useResourcesStore() const resource = inject<Resource>('resource') const areFileExtensionsShown = computed(() => resourcesStore.areFileExtensionsShown) return { resource, areFileExtensionsShown } } }) </script> <style lang="scss"> .file_info { &.sidebar-panel__file_info { border-bottom: 1px solid var(--oc-color-border); } button { white-space: nowrap; } &__body { text-align: left; h3 { font-size: var(--oc-font-size-medium); margin: 0; word-break: break-all; } } &__favorite { .oc-star { display: inline-block; &-shining svg { fill: #ffba0a !important; path:not([fill='none']) { stroke: var(--oc-color-swatch-passive-default); } } } } } </style>
owncloud/web/packages/web-pkg/src/components/SideBar/Files/FileInfo.vue/0
{ "file_path": "owncloud/web/packages/web-pkg/src/components/SideBar/Files/FileInfo.vue", "repo_id": "owncloud", "token_count": 938 }
892
<template> <div class="oc-flex oc-flex-middle"> <div v-if="viewModes.length > 1" class="viewmode-switch-buttons oc-button-group oc-visible@s oc-mr-s" > <oc-button v-for="viewMode in viewModes" :key="viewMode.name" v-oc-tooltip="$gettext(viewMode.label)" :class="viewMode.name" :appearance="viewModeCurrent === viewMode.name ? 'filled' : 'outline'" :aria-label="$gettext(viewMode.label)" @click="setViewMode(viewMode)" > <oc-icon :name="viewMode.icon.name" :fill-type="viewMode.icon.fillType" size="small" variation="inherit" /> </oc-button> </div> <oc-button id="files-view-options-btn" key="files-view-options-btn" v-oc-tooltip="viewOptionsButtonLabel" data-testid="files-view-options-btn" :aria-label="viewOptionsButtonLabel" appearance="raw" class="oc-my-s oc-p-xs" > <oc-icon name="settings-3" fill-type="line" /> </oc-button> <oc-drop drop-id="files-view-options-drop" toggle="#files-view-options-btn" mode="click" class="oc-width-auto" padding-size="medium" > <oc-list> <li v-if="hasHiddenFiles" class="files-view-options-list-item"> <oc-switch v-model:checked="hiddenFilesShownModel" data-testid="files-switch-hidden-files" :label="$gettext('Show hidden files')" @update:checked="updateHiddenFilesShownModel" /> </li> <li v-if="hasFileExtensions" class="files-view-options-list-item"> <oc-switch v-model:checked="fileExtensionsShownModel" data-testid="files-switch-files-extensions-files" :label="$gettext('Show file extensions')" @update:checked="updateFileExtensionsShownModel" /> </li> <li v-if="hasPagination" class="files-view-options-list-item"> <oc-page-size v-if="!queryParamsLoading" :selected="queryItemAsString(itemsPerPageCurrent)" data-testid="files-pagination-size" :label="$gettext('Items per page')" :options="paginationOptions" class="files-pagination-size" @change="setItemsPerPage" /> </li> <li v-if="viewModes.find((v) => v.name === FolderViewModeConstants.name.tiles)" class="files-view-options-list-item oc-visible@s oc-flex oc-flex-between oc-flex-middle" > <label for="tiles-size-slider" v-text="$gettext('Tile size')" /> <input id="tiles-size-slider" v-model="viewSizeCurrent" type="range" :min="1" :max="viewSizeMax" class="oc-range" data-testid="files-tiles-size-slider" /> </li> </oc-list> </oc-drop> </div> </template> <script lang="ts"> import { computed, defineComponent, PropType, ref, unref, watch } from 'vue' import { useGettext } from 'vue3-gettext' import { queryItemAsString, useRoute, useRouteQuery, useRouteQueryPersisted, useRouter, PaginationConstants, FolderViewModeConstants, useRouteName, useResourcesStore, useViewSizeMax } from '../composables' import { FolderView } from '../ui/types' import { storeToRefs } from 'pinia' export default defineComponent({ props: { hasHiddenFiles: { type: Boolean, default: true }, hasFileExtensions: { type: Boolean, default: true }, hasPagination: { type: Boolean, default: true }, paginationOptions: { type: Array as PropType<string[]>, default: () => PaginationConstants.options }, perPageQueryName: { type: String, default: () => PaginationConstants.perPageQueryName }, perPageDefault: { type: String, default: () => PaginationConstants.perPageDefault }, perPageStoragePrefix: { type: String, required: true }, viewModeDefault: { type: String, required: false, default: () => FolderViewModeConstants.defaultModeName }, viewModes: { type: Array as PropType<FolderView[]>, default: () => [] } }, setup(props) { const router = useRouter() const currentRoute = useRoute() const { $gettext } = useGettext() const resourcesStore = useResourcesStore() const { setAreHiddenFilesShown, setAreFileExtensionsShown } = resourcesStore const { areHiddenFilesShown, areFileExtensionsShown } = storeToRefs(resourcesStore) const queryParamsLoading = ref(false) const currentPageQuery = useRouteQuery('page') const currentPage = computed(() => { if (!unref(currentPageQuery)) { return 1 } return parseInt(queryItemAsString(unref(currentPageQuery))) }) const itemsPerPageQuery = useRouteQueryPersisted({ name: props.perPageQueryName, defaultValue: props.perPageDefault, storagePrefix: props.perPageStoragePrefix }) const routeName = useRouteName() const viewModeQuery = useRouteQueryPersisted({ name: `${unref(routeName)}-${FolderViewModeConstants.queryName}`, defaultValue: props.viewModeDefault }) const viewSizeQuery = useRouteQueryPersisted({ name: FolderViewModeConstants.tilesSizeQueryName, defaultValue: FolderViewModeConstants.tilesSizeDefault.toString() }) const setItemsPerPage = (itemsPerPage: string) => { return router.replace({ query: { ...unref(currentRoute).query, [props.perPageQueryName]: itemsPerPage, ...(unref(currentPage) > 1 && { page: '1' }) } }) } const setViewMode = (mode: FolderView) => { viewModeQuery.value = mode.name } watch( [itemsPerPageQuery, viewModeQuery, viewSizeQuery], (params) => { queryParamsLoading.value = params.some((p) => !p) }, { immediate: true, deep: true } ) const viewSizeMax = useViewSizeMax() return { FolderViewModeConstants, viewModeCurrent: viewModeQuery, viewSizeCurrent: viewSizeQuery, viewSizeMax, itemsPerPageCurrent: itemsPerPageQuery, queryParamsLoading, queryItemAsString, setItemsPerPage, setViewMode, areHiddenFilesShown, areFileExtensionsShown, setAreHiddenFilesShown, setAreFileExtensionsShown, viewOptionsButtonLabel: $gettext('Display customization options of the files list') } }, computed: { hiddenFilesShownModel: { get() { return this.areHiddenFilesShown }, set(value) { this.setAreHiddenFilesShown(value) } }, fileExtensionsShownModel: { get() { return this.areFileExtensionsShown }, set(value) { this.setAreFileExtensionsShown(value) } } }, methods: { updateHiddenFilesShownModel(event) { this.hiddenFilesShownModel = event }, updateFileExtensionsShownModel(event) { this.fileExtensionsShownModel = event } } }) </script> <style lang="scss" scoped> .viewmode-switch-buttons { flex-flow: initial; } #files-view-options-btn { vertical-align: middle; border: 3px solid transparent; &:hover { background-color: var(--oc-color-background-hover); border-radius: 3px; } } .files-view-options-list-item { &:not(:last-child) { margin-bottom: var(--oc-space-medium); } & > * { display: flex; justify-content: space-between; } & + & { margin-top: var(--oc-space-small); } } .oc-range { -webkit-appearance: none; -webkit-transition: 0.2s; border-radius: 0.3rem; background: var(--oc-color-border); height: 0.5rem; opacity: 0.7; outline: none; transition: opacity 0.2s; width: 100%; max-width: 50%; &:hover { opacity: 1; } &::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; background: var(--oc-color-swatch-primary-default); border-radius: 50%; cursor: pointer; height: 1rem; width: 1rem; } &::-moz-range-thumb { background: var(--oc-color-swatch-primary-default); border-radius: 50%; cursor: pointer; height: 1rem; width: 1rem; } } </style>
owncloud/web/packages/web-pkg/src/components/ViewOptions.vue/0
{ "file_path": "owncloud/web/packages/web-pkg/src/components/ViewOptions.vue", "repo_id": "owncloud", "token_count": 3629 }
893
import { isLocationCommonActive, isLocationPublicActive, isLocationSharesActive, isLocationSpacesActive } from '../../../router' import { useIsFilesAppActive } from '../helpers' import { useRouter } from '../../router' import { FileAction, FileActionOptions } from '../types' import { useIsSearchActive } from '../helpers' import { computed, unref } from 'vue' import { useGettext } from 'vue3-gettext' import { useDownloadFile } from '../../download' import { isIncomingShareResource } from '@ownclouders/web-client/src/helpers' export const useFileActionsDownloadFile = () => { const router = useRouter() const { $gettext } = useGettext() const isFilesAppActive = useIsFilesAppActive() const isSearchActive = useIsSearchActive() const { downloadFile } = useDownloadFile() const handler = ({ space, resources }: FileActionOptions) => { downloadFile(space, resources[0]) } const actions = computed((): FileAction[] => [ { name: 'download-file', icon: 'file-download', handler, label: () => { return $gettext('Download') }, isVisible: ({ resources }) => { if ( unref(isFilesAppActive) && !unref(isSearchActive) && !isLocationSpacesActive(router, 'files-spaces-generic') && !isLocationPublicActive(router, 'files-public-link') && !isLocationCommonActive(router, 'files-common-favorites') && !isLocationCommonActive(router, 'files-common-search') && !isLocationSharesActive(router, 'files-shares-with-me') && !isLocationSharesActive(router, 'files-shares-with-others') && !isLocationSharesActive(router, 'files-shares-via-link') ) { return false } if (resources.length !== 1) { return false } if (resources[0].isFolder) { return false } if (isIncomingShareResource(resources[0]) && !resources[0].syncEnabled) { return false } return resources[0].canDownload() }, componentType: 'button', class: 'oc-files-actions-download-file-trigger' } ]) return { actions } }
owncloud/web/packages/web-pkg/src/composables/actions/files/useFileActionsDownloadFile.ts/0
{ "file_path": "owncloud/web/packages/web-pkg/src/composables/actions/files/useFileActionsDownloadFile.ts", "repo_id": "owncloud", "token_count": 861 }
894
export * from './useIsSearchActive' export * from './useFileActionsDeleteResources' export * from './useIsFilesAppActive'
owncloud/web/packages/web-pkg/src/composables/actions/helpers/index.ts/0
{ "file_path": "owncloud/web/packages/web-pkg/src/composables/actions/helpers/index.ts", "repo_id": "owncloud", "token_count": 36 }
895
import { eventBus } from '../../../services/eventBus' import { SideBarEventTopics } from '../../sideBar' import { computed } from 'vue' import { SpaceAction, SpaceActionOptions } from '../types' import { useGettext } from 'vue3-gettext' import { useResourcesStore } from '../../piniaStores' export const useSpaceActionsShowMembers = () => { const { $gettext } = useGettext() const resourcesStore = useResourcesStore() const handler = ({ resources }: SpaceActionOptions) => { resourcesStore.setSelection(resources.map(({ id }) => id)) eventBus.publish(SideBarEventTopics.openWithPanel, 'space-share') } const actions = computed((): SpaceAction[] => [ { name: 'show-members', icon: 'group', label: () => $gettext('Members'), handler, isVisible: ({ resources }) => resources.length === 1, componentType: 'button', class: 'oc-files-actions-show-details-trigger' } ]) return { actions } }
owncloud/web/packages/web-pkg/src/composables/actions/spaces/useSpaceActionsShowMembers.ts/0
{ "file_path": "owncloud/web/packages/web-pkg/src/composables/actions/spaces/useSpaceActionsShowMembers.ts", "repo_id": "owncloud", "token_count": 329 }
896
import { useService } from '../service' import { ArchiverService } from '../../services' export const useArchiverService = (): ArchiverService => { return useService('$archiverService') }
owncloud/web/packages/web-pkg/src/composables/archiverService/useArchiverService.ts/0
{ "file_path": "owncloud/web/packages/web-pkg/src/composables/archiverService/useArchiverService.ts", "repo_id": "owncloud", "token_count": 53 }
897
import { computed, unref } from 'vue' import { useConfigStore } from '../piniaStores' export const useEmbedMode = () => { const configStore = useConfigStore() const isEnabled = computed(() => configStore.options.embed?.enabled) const isLocationPicker = computed(() => { return configStore.options.embed?.target === 'location' }) const messagesTargetOrigin = computed(() => configStore.options.embed?.messagesOrigin) const isDelegatingAuthentication = computed( () => unref(isEnabled) && configStore.options.embed?.delegateAuthentication ) const delegateAuthenticationOrigin = computed( () => configStore.options.embed?.delegateAuthenticationOrigin ) const postMessage = <Payload>(name: string, data?: Payload): void => { const options: WindowPostMessageOptions = {} if (unref(messagesTargetOrigin)) { options.targetOrigin = unref(messagesTargetOrigin) } window.parent.postMessage({ name, data }, options) } const verifyDelegatedAuthenticationOrigin = (eventOrigin: string): boolean => { if (!unref(delegateAuthenticationOrigin)) { return true } return unref(delegateAuthenticationOrigin) === eventOrigin } return { isEnabled, isLocationPicker, messagesTargetOrigin, isDelegatingAuthentication, postMessage, verifyDelegatedAuthenticationOrigin } }
owncloud/web/packages/web-pkg/src/composables/embedMode/useEmbedMode.ts/0
{ "file_path": "owncloud/web/packages/web-pkg/src/composables/embedMode/useEmbedMode.ts", "repo_id": "owncloud", "token_count": 422 }
898
import { LoadingService } from '../../services' import { useService } from '../service' export const useLoadingService = (): LoadingService => { return useService('$loadingService') }
owncloud/web/packages/web-pkg/src/composables/loadingService/useLoadingService.ts/0
{ "file_path": "owncloud/web/packages/web-pkg/src/composables/loadingService/useLoadingService.ts", "repo_id": "owncloud", "token_count": 49 }
899