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="M8.5 5.5c1.412.47 2.048 2.159 2.327 4.023l-4.523 2.611 1 1.732 3.71-2.141C11.06 13.079 11 14.308 11 15c0 3-1 6-5 6s-4 0-4-4C2 9.5 5.5 4.5 8.5 5.5zM22.001 17v.436c-.005 3.564-.15 3.564-4 3.564-4 0-5-3-5-6 0-.691-.06-1.92-.014-3.274l3.71 2.14 1-1.732-4.523-2.61c.279-1.865.915-3.553 2.327-4.024 3-1 6.5 4 6.5 11.5zM13 2v9h-2V2h2z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/lungs-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/lungs-fill.svg", "repo_id": "owncloud", "token_count": 305 }
745
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M20 14.5v9L16.667 21H14v-4h2.667L20 14.5zM21 3a1 1 0 0 1 1 1v10.529A6 6 0 0 0 12.34 21L3.002 21a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h18zm0 14a2 2 0 0 1 .15 3.995L21 21v-4zM5.647 6.238L4.353 7.762l7.72 6.555 7.581-6.56-1.308-1.513-6.286 5.438-6.413-5.444z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/mail-volume-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/mail-volume-fill.svg", "repo_id": "owncloud", "token_count": 242 }
746
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M18.364 17.364L12 23.728l-6.364-6.364a9 9 0 1 1 12.728 0zM12 15a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm0-2a2 2 0 1 1 0-4 2 2 0 0 1 0 4z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/map-pin-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/map-pin-fill.svg", "repo_id": "owncloud", "token_count": 161 }
747
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M3 4h18v2H3V4zm6 7h12v2H9v-2zm-6 7h18v2H3v-2z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/menu-3-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/menu-3-fill.svg", "repo_id": "owncloud", "token_count": 127 }
748
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0H24V24H0z"/> <path d="M21 20c0 .552-.448 1-1 1H4c-.552 0-1-.448-1-1V4c0-.552.448-1 1-1h16c.552 0 1 .448 1 1v16zm-2-9V5h-5.999v2H15l-3 3-3-3h2V5H5v6h2v2H5v6h6v-2H9l3-3 3 3h-1.999v2H19v-6h-2v-2h2zm-8 2H9v-2h2v2zm4 0h-2v-2h2v2z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/merge-cells-vertical.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/merge-cells-vertical.svg", "repo_id": "owncloud", "token_count": 244 }
749
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M16.425 17.839A8.941 8.941 0 0 1 13 18.945V23h-2v-4.055A9.004 9.004 0 0 1 3.055 11H5.07a7.002 7.002 0 0 0 9.87 5.354l-1.551-1.55A5 5 0 0 1 7 10V8.414L1.393 2.808l1.415-1.415 19.799 19.8-1.415 1.414-4.767-4.768zm-7.392-7.392l2.52 2.52a3.002 3.002 0 0 1-2.52-2.52zm10.342 4.713l-1.443-1.442c.509-.81.856-1.73.997-2.718h2.016a8.95 8.95 0 0 1-1.57 4.16zm-2.91-2.909l-1.548-1.548c.054-.226.083-.46.083-.703V6a3 3 0 0 0-5.818-1.032L7.686 3.471A5 5 0 0 1 17 6v4a4.98 4.98 0 0 1-.534 2.251z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/mic-off-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/mic-off-line.svg", "repo_id": "owncloud", "token_count": 389 }
750
<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-1zm5.5 11v2H11v2h2v-2h1a2.5 2.5 0 1 0 0-5h-4a.5.5 0 1 1 0-1h5.5V8H13V6h-2v2h-1a2.5 2.5 0 0 0 0 5h4a.5.5 0 1 1 0 1H8.5z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/money-dollar-box-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/money-dollar-box-fill.svg", "repo_id": "owncloud", "token_count": 228 }
751
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M11.38 2.019a7.5 7.5 0 1 0 10.6 10.6C21.662 17.854 17.316 22 12.001 22 6.477 22 2 17.523 2 12c0-5.315 4.146-9.661 9.38-9.981z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/moon-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/moon-fill.svg", "repo_id": "owncloud", "token_count": 159 }
752
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M20 3v14a4 4 0 1 1-2-3.465V6H9v11a4 4 0 1 1-2-3.465V3h13z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/music-2-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/music-2-fill.svg", "repo_id": "owncloud", "token_count": 128 }
753
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M18 2v1.362L12.809 9.55a6.501 6.501 0 1 1-7.116 8.028l1.94-.486A4.502 4.502 0 0 0 16.5 16a4.5 4.5 0 0 0-6.505-4.03l-.228.122-.69-1.207L14.855 4 6.5 4V2H18z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/number-3.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/number-3.svg", "repo_id": "owncloud", "token_count": 182 }
754
<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 4.13-2.504 7.676-6.077 9.201l-2.518-6.55C14.354 14.148 15 13.15 15 12c0-1.657-1.343-3-3-3s-3 1.343-3 3c0 1.15.647 2.148 1.596 2.652l-2.518 6.55C4.504 19.675 2 16.13 2 12 2 6.477 6.477 2 12 2z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/open-source-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/open-source-fill.svg", "repo_id": "owncloud", "token_count": 216 }
755
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M19.228 18.732l1.768-1.768 1.767 1.768a2.5 2.5 0 1 1-3.535 0zM8.878 1.08l11.314 11.313a1 1 0 0 1 0 1.415l-8.485 8.485a1 1 0 0 1-1.414 0l-8.485-8.485a1 1 0 0 1 0-1.415l7.778-7.778-2.122-2.121L8.88 1.08zM11 6.03L3.929 13.1H18.07L11 6.03z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/paint-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/paint-fill.svg", "repo_id": "owncloud", "token_count": 237 }
756
<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="M20 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1h16zm-1 2H5v16h14V4zm-3 12v2H8v-2h8zM12 6a4 4 0 1 1 0 8 4 4 0 0 1 0-8zm0 2a2 2 0 1 0 0 4 2 2 0 0 0 0-4z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/passport-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/passport-line.svg", "repo_id": "owncloud", "token_count": 210 }
757
<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 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2zm1.031 6.099h-2.624c-.988 0-1.789.776-1.789 1.733v6.748l2.595-2.471h1.818c1.713 0 3.101-1.345 3.101-3.005s-1.388-3.005-3.1-3.005z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/pixelfed-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/pixelfed-fill.svg", "repo_id": "owncloud", "token_count": 211 }
758
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M7.752 5.439l10.508 6.13a.5.5 0 0 1 0 .863l-10.508 6.13A.5.5 0 0 1 7 18.128V5.871a.5.5 0 0 1 .752-.432z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/play-mini-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/play-mini-fill.svg", "repo_id": "owncloud", "token_count": 152 }
759
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M10.9 2.1l9.899 1.415 1.414 9.9-9.192 9.192a1 1 0 0 1-1.414 0l-9.9-9.9a1 1 0 0 1 0-1.414L10.9 2.1zm2.828 8.486a2 2 0 1 0 2.828-2.829 2 2 0 0 0-2.828 2.829z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/price-tag-3-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/price-tag-3-fill.svg", "repo_id": "owncloud", "token_count": 192 }
760
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0H24V24H0z"/> <path d="M11 2c4.068 0 7.426 3.036 7.934 6.965l2.25 3.539c.148.233.118.58-.225.728L19 14.07V17c0 1.105-.895 2-2 2h-1.999L15 22H6v-3.694c0-1.18-.436-2.297-1.244-3.305C3.657 13.631 3 11.892 3 10c0-4.418 3.582-8 8-8zm0 5c-.552 0-1 .448-1 1v.999L9 9c-.552 0-1 .448-1 1s.448 1 1 1l1-.001V12c0 .552.448 1 1 1s1-.448 1-1v-1h1c.552 0 1-.448 1-1s-.448-1-1-1h-1V8c0-.552-.448-1-1-1z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/psychotherapy-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/psychotherapy-fill.svg", "repo_id": "owncloud", "token_count": 317 }
761
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M8 18h10.237L20 19.385V9h1a1 1 0 0 1 1 1v13.5L17.545 20H9a1 1 0 0 1-1-1v-1zm-2.545-2L1 19.5V4a1 1 0 0 1 1-1h15a1 1 0 0 1 1 1v12H5.455z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/question-answer-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/question-answer-fill.svg", "repo_id": "owncloud", "token_count": 177 }
762
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M17 10V8h-2v2H5V6h14v4h-2zM6 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 5v14h16V5H4zm4 13a3 3 0 1 1 0-6 3 3 0 0 1 0 6z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/radio-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/radio-line.svg", "repo_id": "owncloud", "token_count": 214 }
763
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M5.5 21a4.5 4.5 0 1 1 0-9 4.5 4.5 0 0 1 0 9zm0-2a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5zm13 2a4.5 4.5 0 1 1 0-9 4.5 4.5 0 0 1 0 9zm0-2a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5zm-7.477-8.695L13 12v6h-2v-5l-2.719-2.266A2 2 0 0 1 8 7.671l2.828-2.828a2 2 0 0 1 2.829 0l1.414 1.414a6.969 6.969 0 0 0 3.917 1.975l-.01 2.015a8.962 8.962 0 0 1-5.321-2.575l-2.634 2.633zM16 5a2 2 0 1 1 0-4 2 2 0 0 1 0 4z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/riding-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/riding-line.svg", "repo_id": "owncloud", "token_count": 346 }
764
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M11 14v-3h2v3h5a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1h5zM2.51 8.837C3.835 4.864 7.584 2 12 2s8.166 2.864 9.49 6.837l-1.898.632a8.003 8.003 0 0 0-15.184 0l-1.897-.632zm3.796 1.265a6.003 6.003 0 0 1 11.388 0l-1.898.633a4.002 4.002 0 0 0-7.592 0l-1.898-.633z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/router-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/router-fill.svg", "repo_id": "owncloud", "token_count": 271 }
765
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M3 18h18a.5.5 0 0 1 .4.8l-2.1 2.8a1 1 0 0 1-.8.4h-13a1 1 0 0 1-.8-.4l-2.1-2.8A.5.5 0 0 1 3 18zM15 2.425V15a1 1 0 0 1-1 1H4.04a.5.5 0 0 1-.39-.812L14.11 2.113a.5.5 0 0 1 .89.312z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/sailboat-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/sailboat-fill.svg", "repo_id": "owncloud", "token_count": 209 }
766
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M4.257 5.671L12 13.414 13.414 12 5.671 4.257A9.959 9.959 0 0 1 12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12c0-2.401.846-4.605 2.257-6.329z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/scan-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/scan-fill.svg", "repo_id": "owncloud", "token_count": 172 }
767
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M11 2c4.968 0 9 4.032 9 9s-4.032 9-9 9-9-4.032-9-9 4.032-9 9-9zm8.485 16.071l2.829 2.828-1.415 1.415-2.828-2.829 1.414-1.414z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/search-2-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/search-2-fill.svg", "repo_id": "owncloud", "token_count": 172 }
768
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M6 8v2h12V8h-3V2h2v4h5v2h-2v12a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V8H2V6h5V2h2v6H6zm7-6v6h-2V2h2z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/sensor-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/sensor-fill.svg", "repo_id": "owncloud", "token_count": 167 }
769
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M17.5 2.474L23 12l-5.5 9.526h-11L1 12l5.5-9.526h11zm-1.155 2h-8.69L3.309 12l4.346 7.526h8.69L20.691 12l-4.346-7.526zM8.634 8.17l1.732-1 5 8.66-1.732 1-5-8.66z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/settings-6-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/settings-6-line.svg", "repo_id": "owncloud", "token_count": 197 }
770
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M13 14h-2a8.999 8.999 0 0 0-7.968 4.81A10.136 10.136 0 0 1 3 18C3 12.477 7.477 8 13 8V3l10 8-10 8v-5z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/share-forward-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/share-forward-fill.svg", "repo_id": "owncloud", "token_count": 146 }
771
<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="M3.783 2.826L12 1l8.217 1.826a1 1 0 0 1 .783.976v9.987a6 6 0 0 1-2.672 4.992L12 23l-6.328-4.219A6 6 0 0 1 3 13.79V3.802a1 1 0 0 1 .783-.976zM5 4.604v9.185a4 4 0 0 0 1.781 3.328L12 20.597l5.219-3.48A4 4 0 0 0 19 13.79V4.604L12 3.05 5 4.604zM12 11a2.5 2.5 0 1 1 0-5 2.5 2.5 0 0 1 0 5zm-4.473 5a4.5 4.5 0 0 1 8.946 0H7.527z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/shield-user-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/shield-user-line.svg", "repo_id": "owncloud", "token_count": 293 }
772
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M20 12a8 8 0 1 0-16 0v4h3a1 1 0 0 1 1 1v3h8v-3a1 1 0 0 1 1-1h3v-4zm-2 6v3a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1v-3H3a1 1 0 0 1-1-1v-5C2 6.477 6.477 2 12 2s10 4.477 10 10v5a1 1 0 0 1-1 1h-3zM7.5 14a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm9 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/skull-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/skull-line.svg", "repo_id": "owncloud", "token_count": 270 }
773
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M7 4v16h10V4H7zM6 2h12a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zm6 15a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/smartphone-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/smartphone-line.svg", "repo_id": "owncloud", "token_count": 168 }
774
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M15.936 2.5L21.5 8.067v7.87L15.936 21.5h-7.87L2.5 15.936v-7.87L8.066 2.5h7.87zM8 11v2h8v-2H8z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/spam-3-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/spam-3-fill.svg", "repo_id": "owncloud", "token_count": 160 }
775
<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-9 2H5v14h6v-4h2v4h6V5h-6v4h-2V5zm4 4l3 3-3 3v-2H9v2l-3-3 3-3v2h6V9z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/split-cells-horizontal.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/split-cells-horizontal.svg", "repo_id": "owncloud", "token_count": 205 }
776
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M15 14l-.117.007a1 1 0 0 0-.876.876L14 15v6H3.998A.996.996 0 0 1 3 20.007V3.993C3 3.445 3.445 3 3.993 3h16.014c.548 0 .993.447.993.999V14h-6zm6 2l-5 4.997V16h5z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/sticky-note-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/sticky-note-fill.svg", "repo_id": "owncloud", "token_count": 182 }
777
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M9.984 5.06a6.5 6.5 0 1 1 11.286 6.436A5.5 5.5 0 0 1 17.5 21L9 20.999a8 8 0 1 1 .984-15.94zm2.071.544a8.026 8.026 0 0 1 4.403 4.495 5.529 5.529 0 0 1 3.12.307 4.5 4.5 0 0 0-7.522-4.802z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/sun-cloudy-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/sun-cloudy-fill.svg", "repo_id": "owncloud", "token_count": 200 }
778
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zM7 9h2v4h2V9h2l-3-3.5L7 9zm10 6h-2v-4h-2v4h-2l3 3.5 3-3.5z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/swap-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/swap-fill.svg", "repo_id": "owncloud", "token_count": 177 }
779
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M22 11v10a1 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-1V11l2.447-4.894A2 2 0 0 1 6.237 5H9V3h6v2h2.764a2 2 0 0 1 1.789 1.106L22 11zm-2 2H4v5h16v-5zM4.236 11h15.528l-2-4H6.236l-2 4zM6.5 17a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm11 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/taxi-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/taxi-line.svg", "repo_id": "owncloud", "token_count": 288 }
780
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M20 9V5H4v4h16zm0 2H4v8h16v-8zM3 3h18a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zm2 9h3v5H5v-5zm0-6h2v2H5V6zm4 0h2v2H9V6z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/terminal-window-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/terminal-window-line.svg", "repo_id": "owncloud", "token_count": 199 }
781
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M21 3a1 1 0 0 1 1 1v5.5a2.5 2.5 0 1 0 0 5V20a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-5.5a2.5 2.5 0 1 0 0-5V4a1 1 0 0 1 1-1h18zm-5 6H8v6h8V9z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/ticket-2-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/ticket-2-fill.svg", "repo_id": "owncloud", "token_count": 183 }
782
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M5.33 3.271a3.5 3.5 0 0 1 4.472 4.474L20.647 18.59l-2.122 2.121L7.68 9.867a3.5 3.5 0 0 1-4.472-4.474L5.444 7.63a1.5 1.5 0 1 0 2.121-2.121L5.329 3.27zm10.367 1.884l3.182-1.768 1.414 1.414-1.768 3.182-1.768.354-2.12 2.121-1.415-1.414 2.121-2.121.354-1.768zm-7.071 7.778l2.121 2.122-4.95 4.95A1.5 1.5 0 0 1 3.58 17.99l.097-.107 4.95-4.95z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/tools-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/tools-fill.svg", "repo_id": "owncloud", "token_count": 300 }
783
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M2 5l7-3 6 3 6.303-2.701a.5.5 0 0 1 .697.46V19l-7 3-6-3-6.303 2.701a.5.5 0 0 1-.697-.46V5zm4 6v2h2v-2H6zm4 0v2h2v-2h-2zm6-.06l-1.237-1.238-1.061 1.06L14.939 12l-1.237 1.237 1.06 1.061L16 13.061l1.237 1.237 1.061-1.06L17.061 12l1.237-1.237-1.06-1.061L16 10.939z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/treasure-map-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/treasure-map-fill.svg", "repo_id": "owncloud", "token_count": 268 }
784
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M22.162 5.656a8.384 8.384 0 0 1-2.402.658A4.196 4.196 0 0 0 21.6 4c-.82.488-1.719.83-2.656 1.015a4.182 4.182 0 0 0-7.126 3.814 11.874 11.874 0 0 1-8.62-4.37 4.168 4.168 0 0 0-.566 2.103c0 1.45.738 2.731 1.86 3.481a4.168 4.168 0 0 1-1.894-.523v.052a4.185 4.185 0 0 0 3.355 4.101 4.21 4.21 0 0 1-1.89.072A4.185 4.185 0 0 0 7.97 16.65a8.394 8.394 0 0 1-6.191 1.732 11.83 11.83 0 0 0 6.41 1.88c7.693 0 11.9-6.373 11.9-11.9 0-.18-.005-.362-.013-.54a8.496 8.496 0 0 0 2.087-2.165z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/twitter-fill.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/twitter-fill.svg", "repo_id": "owncloud", "token_count": 364 }
785
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M4 19h16v-7h2v8a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-8h2v7zm9-10v7h-2V9H6l6-6 6 6h-5z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/upload-2-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/upload-2-line.svg", "repo_id": "owncloud", "token_count": 152 }
786
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M7.39 16.539a8 8 0 1 1 9.221 0l2.083 4.76a.5.5 0 0 1-.459.701H5.765a.5.5 0 0 1-.459-.7l2.083-4.761zm6.735-.693l1.332-.941a6 6 0 1 0-6.913 0l1.331.941L8.058 20h7.884l-1.817-4.154zM8.119 10.97l1.94-.485a2 2 0 0 0 3.882 0l1.94.485a4.002 4.002 0 0 1-7.762 0z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/user-5-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/user-5-line.svg", "repo_id": "owncloud", "token_count": 250 }
787
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M1 22a8 8 0 1 1 16 0h-2a6 6 0 1 0-12 0H1zm8-9c-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 4zM21.548.784A13.942 13.942 0 0 1 23 7c0 2.233-.523 4.344-1.452 6.216l-1.645-1.196A11.955 11.955 0 0 0 21 7c0-1.792-.393-3.493-1.097-5.02L21.548.784zm-3.302 2.4A9.97 9.97 0 0 1 19 7a9.97 9.97 0 0 1-.754 3.816l-1.677-1.22A7.99 7.99 0 0 0 17 7a7.99 7.99 0 0 0-.43-2.596l1.676-1.22z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/user-voice-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/user-voice-line.svg", "repo_id": "owncloud", "token_count": 371 }
788
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <g> <path fill="none" d="M0 0h24v24H0z"/> <path d="M20 7V5H4v14h16v-2h-8a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h8zM3 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 6v6h7V9h-7zm2 2h3v2h-3v-2z"/> </g> </svg>
owncloud/web/packages/design-system/src/assets/icons/wallet-2-line.svg/0
{ "file_path": "owncloud/web/packages/design-system/src/assets/icons/wallet-2-line.svg", "repo_id": "owncloud", "token_count": 204 }
789
import OcAvatarItem from './OcAvatarItem.vue' import { mount } from 'web-test-helpers' describe('OcAvatarItem', () => { function getWrapperWithProps(props = {}) { return mount(OcAvatarItem, { props: { ...props, name: 'test link' } }) } describe("when prop 'name' is provided", () => { it('should set data test user attribute on wrapper', () => { const wrapper = getWrapperWithProps() expect(wrapper.attributes('data-test-item-name')).toBe('test link') }) }) describe('accessibleLabel', () => { it('should not be set when value is empty string', () => { const wrapper = getWrapperWithProps({ accessibleLabel: '' }) expect(wrapper.attributes('aria-label')).toBeFalsy() expect(wrapper.attributes('role')).toBeFalsy() expect(wrapper.attributes('aria-hidden')).toBe('true') expect(wrapper.attributes('focusable')).toBe('false') }) it('should be set when value is not empty string', () => { const wrapper = getWrapperWithProps({ accessibleLabel: 'test label' }) expect(wrapper.attributes('aria-label')).toBe('test label') expect(wrapper.attributes('role')).toBe('img') expect(wrapper.attributes('aria-hidden')).toBeFalsy() expect(wrapper.attributes('focusable')).toBeFalsy() }) }) })
owncloud/web/packages/design-system/src/components/OcAvatarItem/OcAvatarItem.spec.ts/0
{ "file_path": "owncloud/web/packages/design-system/src/components/OcAvatarItem/OcAvatarItem.spec.ts", "repo_id": "owncloud", "token_count": 530 }
790
<template> <date-picker ref="datePicker" class="oc-datepicker" v-bind="$attrs" :popover="popperOpts"> <template #default="args"> <!-- @slot Default slot to use as the popover anchor for datepicker --> <!-- args is undefined during initial render, hence we check it here --> <slot v-if="args" :input-value="args.inputValue" :toggle-popover="args.togglePopover" :hide-popover="args.hidePopover" /> </template> </date-picker> </template> <script lang="ts"> import { computed, defineComponent } from 'vue' import { DatePicker } from 'v-calendar' import 'v-calendar/dist/style.css' /** * Datepicker component based on [v-calendar](https://vcalendar.io/). For detailed documentation, please visit https://vcalendar.io/vue-3.html */ export default defineComponent({ name: 'OcDatepicker', status: 'ready', release: '1.0.0', components: { DatePicker }, inheritAttrs: true, setup() { const popperOpts = computed(() => { return { modifiers: [ { name: 'fixVerticalPosition', enabled: true, phase: 'beforeWrite', requiresIfExists: ['offset', 'flip'], fn({ state }) { const dropHeight = state.modifiersData.fullHeight || state.elements.popper.offsetHeight const rect = state.elements.popper.getBoundingClientRect() const neededScreenSpace = state.elements.reference.offsetHeight + rect.top + dropHeight if (state.placement !== 'top-start' && neededScreenSpace > window.innerHeight) { state.styles.popper.top = `-${150}px` } } } ] } }) return { popperOpts } }, mounted() { this.$el.__datePicker = this.$refs.datePicker } }) </script> <style lang="scss"> .vc-pane-layout { color: var(--oc-color-text-default) !important; background-color: var(--oc-color-background-default) !important; } .vc-arrow svg path { fill: var(--oc-color-text-default) !important; } .vc-title { color: var(--oc-color-text-default) !important; } .vc-weekday { color: var(--oc-color-text-muted) !important; } .vc-day { color: var(--oc-color-text-default) !important; font-weight: var(--oc-font-weight-bold); } .vc-highlights { .vc-highlight { background-color: var(--oc-color-swatch-primary-default) !important; } + span { color: var(--oc-color-text-inverse) !important; } } .vc-day-content.is-disabled { color: var(--oc-color-text-muted) !important; background: none; cursor: not-allowed; font-weight: var(--oc-font-weight-extralight); } </style> <docs> ```js <template> <div> <oc-datepicker v-model="date"> <template #default="{ togglePopover }"> <oc-button @click="togglePopover">Open datepicker</oc-button> </template> </oc-datepicker> <p v-if="date" v-text="date" /> </div> </template> <script> export default { data: () => ({ date: null }) } </script> ``` </docs>
owncloud/web/packages/design-system/src/components/OcDatepicker/OcDatepicker.vue/0
{ "file_path": "owncloud/web/packages/design-system/src/components/OcDatepicker/OcDatepicker.vue", "repo_id": "owncloud", "token_count": 1286 }
791
import OcImage from './OcImage.vue' import { mount } from 'web-test-helpers' // @vitest-environment jsdom describe('OcImage', () => { function getWrapper(props = {}) { return mount(OcImage, { props: { src: 'http://someimage.jpg', ...props } }) } it('should set the provided src', () => { const wrapper = getWrapper() expect(wrapper.attributes('src')).toBe('http://someimage.jpg') }) it('should set the provided title for image', () => { const wrapper = getWrapper({ title: 'test title' }) expect(wrapper.attributes('title')).toBe('test title') }) it.each(['eager', 'lazy'])('should set the provided loading type for image', (loadingType) => { const wrapper = getWrapper({ loadingType: loadingType }) expect(wrapper.attributes('loading')).toBe(loadingType) }) it('should not accept value other than (lazy & eager) for prop loading type', () => { expect(OcImage.props.loadingType.validator('invalid')).toBeFalsy() }) describe('when alt is set', () => { const wrapper = getWrapper({ alt: 'test alt text' }) it('should set the provided alt for image', () => { expect(wrapper.attributes('alt')).toBe('test alt text') }) it('should set aria hidden property to "false"', () => { expect(wrapper.attributes('aria-hidden')).toBe('false') }) }) describe('when alt is not set', () => { it('should set aria hidden property to "true"', () => { const wrapper = getWrapper() expect(wrapper.attributes('aria-hidden')).toBe('true') }) }) })
owncloud/web/packages/design-system/src/components/OcImage/OcImage.spec.ts/0
{ "file_path": "owncloud/web/packages/design-system/src/components/OcImage/OcImage.spec.ts", "repo_id": "owncloud", "token_count": 569 }
792
import { shallowMount } from 'web-test-helpers' import PageSize from './OcPageSize.vue' const defaultProps = { options: [100, 500, 1000, 'All'], label: 'Items per page', selected: 100 } describe('OcPageSize', () => { it('emits change event when value is selected', () => { const wrapper = shallowMount(PageSize, { props: defaultProps }) wrapper .findComponent<typeof PageSize>('[data-testid="oc-page-size-select"]') .vm.$emit('update:modelValue', 500) expect(wrapper.emitted().change[0][0]).toEqual(500) }) it('displays label', () => { const wrapper = shallowMount(PageSize, { props: defaultProps }) const labelSelector = '[data-testid="oc-page-size-label"]' expect(wrapper.findAll(labelSelector).length).toEqual(1) expect(wrapper.find(labelSelector).text()).toEqual('Items per page') }) })
owncloud/web/packages/design-system/src/components/OcPageSize/OcPageSize.spec.ts/0
{ "file_path": "owncloud/web/packages/design-system/src/components/OcPageSize/OcPageSize.spec.ts", "repo_id": "owncloud", "token_count": 308 }
793
<template> <div> <label :for="id" class="oc-label" v-text="label" /> <oc-contextual-helper v-if="contextualHelper?.isEnabled" v-bind="contextualHelper?.data" class="oc-pl-xs" ></oc-contextual-helper> <vue-select ref="select" :disabled="disabled || readOnly" :filter="filter" :loading="loading" :searchable="searchable" :clearable="clearable" :multiple="multiple" class="oc-select" style="background: transparent" :dropdown-should-open="selectDropdownShouldOpen" :map-keydown="selectMapKeydown" v-bind="additionalAttributes" @update:model-value="$emit('update:modelValue', $event)" @click="onSelectClick()" @search:blur="onSelectBlur()" @keydown="onSelectKeyDown($event)" > <template #search="{ attributes, events }"> <input class="vs__search" v-bind="attributes" @input="userInput" v-on="events" /> </template> <template v-for="(index, name) in $slots" #[name]="data"> <slot v-if="name !== 'search'" :name="name" v-bind="data" /> </template> <template #no-options><div v-text="$gettext('No options available.')" /></template> <template #spinner="{ loading: loadingSpinner }"> <oc-spinner v-if="loadingSpinner" /> </template> <template #selected-option-container="{ option, deselect }"> <span class="vs__selected" :class="{ 'vs__selected-readonly': option.readonly }"> <slot name="selected-option" v-bind="option"> <oc-icon v-if="readOnly" name="lock" class="oc-mr-xs" size="small" /> {{ getOptionLabel(option) }} </slot> <span v-if="multiple" class="oc-flex oc-flex-middle oc-ml-s oc-mr-xs"> <oc-icon v-if="option.readonly" class="vs__deselect-lock" name="lock" size="small" /> <oc-button v-else appearance="raw" :title="$gettext('Deselect %{label}', { label: getOptionLabel(option) })" :aria-label="$gettext('Deselect %{label}', { label: getOptionLabel(option) })" class="vs__deselect oc-mx-rm" @mousedown.stop.prevent @click="deselect(option)" > <oc-icon name="close" size="small" /> </oc-button> </span> </span> </template> </vue-select> <div v-if="showMessageLine" class="oc-text-input-message" :class="{ 'oc-text-input-description': !!descriptionMessage, 'oc-text-input-warning': !!warningMessage, 'oc-text-input-danger': !!errorMessage }" > <oc-icon v-if="messageText !== null && !!descriptionMessage" name="information" size="small" fill-type="line" /> <span :id="messageId" :class="{ 'oc-text-input-description': !!descriptionMessage, 'oc-text-input-warning': !!warningMessage, 'oc-text-input-danger': !!errorMessage }" v-text="messageText" /> </div> </div> </template> <script lang="ts"> import Fuse from 'fuse.js' import uniqueId from '../../utils/uniqueId' import VueSelect from 'vue-select' import { defineComponent, ComponentPublicInstance, onMounted, ref, unref, VNodeRef, PropType } from 'vue' import { useGettext } from 'vue3-gettext' import 'vue-select/dist/vue-select.css' import { ContextualHelper } from '../../helpers' // the keycode property is deprecated in the JS event API, vue-select still works with it though enum KeyCode { Enter = 13 } /** * Select component with a trigger and dropdown based on [Vue Select](https://vue-select.org/) */ export default defineComponent({ name: 'OcSelect', status: 'ready', release: '4.3.0', components: { VueSelect }, inheritAttrs: true, props: { /** * The ID of the element. */ id: { type: String, required: false, default: () => uniqueId('oc-select-') }, /** * Function to filter items when searching */ filter: { type: Function, required: false, default: (items, search, props) => { if (items.length < 1) { return [] } const fuse = new Fuse(items, { ...(props.label && { keys: [props.label] }), shouldSort: true, threshold: 0, ignoreLocation: true, distance: 100, minMatchCharLength: 1 }) return search.length ? fuse.search(search).map(({ item }) => item) : (fuse as any).list } }, /** * Disable the select component */ disabled: { type: Boolean, required: false, default: false }, /** * Label of the select component * ATTENTION: this shadows the vue-select prop `label`. If you need access to that use `optionLabel`. */ label: { type: String, default: null }, /** * oc-contextual-helper can be injected here */ contextualHelper: { type: Object as PropType<ContextualHelper>, required: false, default: null }, /** * Key to use as label when option is an object * NOTE: this maps to the vue-select prop `label` */ optionLabel: { type: String, default: 'label' }, getOptionLabel: { type: Function, default(this: any, option) { if (typeof option === 'object') { // we pass this function down to vue-select // so it needs to work in this component and in vue-select // hence we need to handle optionLabel and label const key = this.optionLabel || this.label if (!option.hasOwnProperty(key)) { return console.warn( `[vue-select warn]: Label key "option.${key}" does not` + ` exist in options object ${JSON.stringify(option)}.\n` + 'https://vue-select.org/api/props.html#getoptionlabel' ) } return option[key] } return option } }, /** * Determines if the select field is searchable */ searchable: { type: Boolean, required: false, default: true }, /** * Determines if the select field is clearable */ clearable: { type: Boolean, required: false, default: false }, /** * Determines if the select field loading */ loading: { type: Boolean, required: false, default: false }, /** * A warning message which is shown below the select. */ warningMessage: { type: String, default: null }, /** * An error message which is shown below the select. */ errorMessage: { type: String, default: null }, /** * Whether or not vertical space below the select should be reserved for a one line message, * so that content actually appearing there doesn't shift the layout. */ fixMessageLine: { type: Boolean, default: false }, /** * A description text which is shown below the select field. */ descriptionMessage: { type: String, default: null }, /** * Determines if multiple options can be selected. */ multiple: { type: Boolean, default: false }, /** * Determines if the select field is read only. * * Read only field will be visualized by a lock item and additionally behaves like a disabled field. * Read only takes effect if the server won't allow to change the value at all, * disabled should be used instead, if the value can't be changed in a specific context. * * For example: If the backend doesn't allow to set the login states for users in general, use read only. * If it's not allowed to change for the current logged-in User, use disabled. * */ readOnly: { type: Boolean, default: false } }, emits: ['search:input', 'update:modelValue'], setup(props, { emit }) { const { $gettext } = useGettext() const select: VNodeRef = ref() const setComboBoxAriaLabel = () => { const comboBoxElement = (unref(select) as ComponentPublicInstance).$el.querySelector( 'div:first-child' ) comboBoxElement?.setAttribute('aria-label', $gettext('Search for option')) } const userInput = (event) => { /** * Triggers when a value of search input is changed * * @property {string} query search query */ emit('search:input', event.target.value) } onMounted(() => { setComboBoxAriaLabel() }) const dropdownEnabled = ref(false) const setDropdownEnabled = (enabled) => { dropdownEnabled.value = enabled } const selectDropdownShouldOpen = ({ noDrop, open, mutableLoading }) => { return !noDrop && open && !mutableLoading && unref(dropdownEnabled) } const onSelectClick = () => { setDropdownEnabled(true) } const onSelectBlur = () => { setDropdownEnabled(false) } const selectMapKeydown = (map, vm) => { return { ...map, [KeyCode.Enter]: (e: KeyboardEvent) => { if (!unref(dropdownEnabled)) { setDropdownEnabled(true) return } map[KeyCode.Enter](e) unref(select).searchEl.focus() } } } const onSelectKeyDown = (e: KeyboardEvent) => { if (e.key === 'Enter' || e.key === 'Tab') { return } setDropdownEnabled(true) } return { select, userInput, selectDropdownShouldOpen, selectMapKeydown, onSelectKeyDown, onSelectBlur, onSelectClick } }, computed: { additionalAttributes() { const additionalAttrs = {} additionalAttrs['input-id'] = this.id additionalAttrs['getOptionLabel'] = this.getOptionLabel additionalAttrs['label'] = this.optionLabel return { ...this.$attrs, ...additionalAttrs } }, showMessageLine() { return ( this.fixMessageLine || !!this.warningMessage || !!this.errorMessage || !!this.descriptionMessage ) }, messageText() { if (this.errorMessage) { return this.errorMessage } if (this.warningMessage) { return this.warningMessage } return this.descriptionMessage }, messageId() { return `${this.id}-message` } } }) </script> <style lang="scss"> .vs--disabled { cursor: not-allowed; .vs__clear, .vs__dropdown-toggle, .vs__open-indicator, .vs__search, .vs__selected { background-color: var(--oc-color-background-muted) !important; color: var(--oc-color-input-text-muted) !important; pointer-events: none; } .vs__actions { opacity: 0.3; } } .oc-select { line-height: normal; padding: 1px 0; color: var(--oc-color-input-text-default); .vs { &__search { color: var(--oc-color-input-text-default); } &__search::placeholder, &__dropdown-toggle, &__dropdown-menu { -webkit-appearance: none; background-color: var(--oc-color-background-highlight); border-radius: 0; border-radius: 5px; border: 1px solid var(--oc-color-input-border); box-sizing: border-box; color: var(--oc-color-input-text-default); line-height: inherit; margin: 0; max-width: 100%; outline: none; padding: 2px; transition-duration: 0.2s; transition-timing-function: ease-in-out; transition-property: color, background-color; width: 100%; } &__selected-readonly { background-color: var(--oc-color-background-muted) !important; } &__search, &__search:focus { padding: 0 5px; } &__dropdown-menu { padding: 0; background-color: var(--oc-color-background-default); margin-top: -1px; } &__clear, &__open-indicator, &__deselect { fill: var(--oc-color-input-text-default); } &__deselect { margin: 0 var(--oc-space-small); } &__dropdown-option, &__no-options { color: var(--oc-color-input-text-default); white-space: normal; padding: 6px 0.6rem; border-radius: 5px; line-height: var(--vs-line-height); &--highlight, &--selected { background-color: var(--oc-color-background-hover); color: var(--oc-color-swatch-brand-hover); } } &__actions { flex-flow: row wrap; gap: var(--oc-space-xsmall); svg { overflow: visible; } cursor: pointer; } &__clear svg { max-width: var(--oc-space-small); } &__selected-options { flex: auto; padding: 0; > * { padding: 0px 2px; margin: 2px 2px 2px 1px; color: var(--oc-color-input-text-default); } > *:not(input) { padding-left: 3px; background-color: var(--oc-color-background-default); fill: var(--oc-color-text-default); } } } &.vs--multiple { .vs { &__selected-options > *:not(input) { color: var(--oc-color-input-text-default); background-color: var(--oc-color-background-default); } } } &:focus-within { .vs__dropdown-menu, .vs__dropdown-toggle { border-color: var(--oc-color-swatch-passive-default); } } } .oc-background-highlight { .oc-select { .vs { &__search { color: var(--oc-color-input-text-default); } &__search::placeholder, &__dropdown-toggle, &__dropdown-menu { background-color: var(--oc-color-input-bg); } } &.vs--multiple { .vs__selected-options > *:not(input) { color: var(--oc-color-input-text-default); background-color: var(--oc-color-background-highlight); } } &:focus-within { .vs__dropdown-menu, .vs__dropdown-toggle { background-color: var(--oc-color-background-default); } } } } .vs--single { &.vs--open .vs__selected { opacity: 0.8 !important; } .vs__selected-options > *:not(input) { background-color: transparent !important; } } </style> <docs> For detailed documentation (props, slots, events, etc.), please visit https://vue-select.org/ ```js <template> <div class="oc-docs-width-medium"> <oc-select label="Custom label" v-model="selected" :options="['Bannana', 'Orange', 'Pear']" /> </div> </template> <script> export default { data: () => ({ selected: "Apple" }) }; </script> ``` ### Prevent user from clearing the selection If we want to disable the clear button from the `oc-select`, we can set prop `clearable` to false. This will also prevent clearing the selected value by hitting `delete`. ```js <template> <div class="oc-docs-width-medium"> <oc-select v-model="selected" :options="['Apple', 'Bannana', 'Orange', 'Pear']" :clearable="false" /> </div> </template> <script> export default { data: () => ({ selected: "Apple" }) }; </script> ``` ### Multiple selection ```js <template> <div class="oc-docs-width-medium"> <oc-select v-model="selected" :multiple="true" :options="options" /> </div> </template> <script> export default { data: () => ({ selected: ["Apple"] }), computed: { options() { return ["Apple", "Bannana", "Orange", "Pear"].filter(option => this.selected.indexOf(option) < 0); } } }; </script> ``` ### Disable search To prevent user from filtering options by typing a serach query into the `oc-select` component, set prop called `searchable` to false. ```js <template> <div class="oc-docs-width-medium"> <oc-select v-model="selected" :options="['Apple', 'Bannana', 'Orange', 'Pear']" :searchable="false" /> </div> </template> <script> export default { data: () => ({ selected: "Apple" }) }; </script> ``` ### Use objects as options If we want to select from a list of option objects, we can use `option-label` to select the key of the object to use as label. ```js <template> <div class="oc-docs-width-medium"> <oc-select label="Custom Label" option-label="title" :options="options" v-model="selected" class="oc-mb-m" /> </div> </template> <script> const options = [ { title: 'Apple', desc: 'An apple is an edible fruit produced by an apple tree (Malus domestica)' }, { title: 'Bannana', desc: 'Bannana is a genus of goblin spiders (family Oonopidae) native to Xishuangbanna prefecture, Yunnan Province, China, where it lives in the leaf-litter of tropical rainforest' }, { title: 'Orange', desc: 'The orange is the fruit of various citrus species in the family Rutaceae' }, ] export default { data: () => ({ selected: options[1], options }) } </script> ``` ### Using slots to display complex options Sometimes we need to display more complex options. This can include e.g. an option with a title and a description. To still display all those values exactly as we want to, we need to use scoped slots called `option` and `selected-option`. We can then retrieve all the values that we want to display from the slot parameters. It is important to specify the `option-label` prop on the `oc-select` to make filtering work. ```js <template> <div class="oc-docs-width-medium"> <oc-select label="Custom Label" :options="options" v-model="selected" class="oc-mb-m" > <template v-slot:option="{ title, desc }"> <span class="option"> <strong v-text="title" /> </span> <span class="option" v-text="desc" /> </template> <template #no-options> Your search query hasn't returned any results. </template> <template #selected-option="{ title, desc }"> <strong class="oc-mr-s" v-text="title" /> <small v-text="desc.slice(0, 20) + '...'" /> </template> </oc-select> <p> Selected: {{ selected }} </p> </div> </template> <script> const options = [ { title: "Apple", desc: "An apple is an edible fruit produced by an apple tree (Malus domestica)" }, { title: "Bannana", desc: "Bannana is a genus of goblin spiders (family Oonopidae) native to Xishuangbanna prefecture, Yunnan Province, China, where it lives in the leaf-litter of tropical rainforest" }, { title: "Orange", desc: "The orange is the fruit of various citrus species in the family Rutaceae" } ]; export default { data: () => ({ selected: options[0], options }) }; </script> <style> .option { display: block; } </style> ``` ## Loading spinner ```js <oc-select :options="['Apple', 'Bannana', 'Orange', 'Pear']" :multiple="true" :loading="true" /> ``` </docs>
owncloud/web/packages/design-system/src/components/OcSelect/OcSelect.vue/0
{ "file_path": "owncloud/web/packages/design-system/src/components/OcSelect/OcSelect.vue", "repo_id": "owncloud", "token_count": 8033 }
794
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`OcTextInput > password input field > password policy > displays error state if password does not match criteria 1`] = ` "<div class=""><label class="oc-label" for="oc-textinput-24"></label> <div class="oc-position-relative"> <!--v-if--> <div class="oc-text-input-password-wrapper"><input id="oc-textinput-24" aria-invalid="false" class="oc-text-input oc-input oc-rounded" type="password"> <button type="button" class="oc-button oc-rounded oc-button-s oc-button-justify-content-center oc-button-gap-m oc-button-passive oc-button-passive-raw oc-text-input-show-password-toggle oc-px-s oc-background-default"> <!--v-if--> <!-- @slot Content of the button --> <span class="oc-icon oc-icon-s oc-icon-passive"><!----></span> </button> <button type="button" class="oc-button oc-rounded oc-button-s oc-button-justify-content-center oc-button-gap-m oc-button-passive oc-button-passive-raw oc-text-input-copy-password-button oc-px-s oc-background-default"> <!--v-if--> <!-- @slot Content of the button --> <span class="oc-icon oc-icon-s oc-icon-passive"><!----></span> </button> <!--v-if--> </div> <portal to="app.design-system.password-policy"> <div class="oc-text-small oc-flex oc-flex-column"><span>Please enter a password that meets the following criteria:</span> <div class="oc-flex oc-flex-middle"><span class="oc-icon oc-icon-s oc-icon-danger"><!----></span> <span class="oc-text-input-danger">At least 8 characters</span></div> </div> </portal> <!--v-if--> </div> <!--v-if--> <portal-target name="app.design-system.password-policy"></portal-target> </div>" `; exports[`OcTextInput > password input field > password policy > displays success state if password matches criteria 1`] = ` "<div class=""><label class="oc-label" for="oc-textinput-25"></label> <div class="oc-position-relative"> <!--v-if--> <div class="oc-text-input-password-wrapper"><input id="oc-textinput-25" aria-invalid="false" class="oc-text-input oc-input oc-rounded" type="password"> <button type="button" class="oc-button oc-rounded oc-button-s oc-button-justify-content-center oc-button-gap-m oc-button-passive oc-button-passive-raw oc-text-input-show-password-toggle oc-px-s oc-background-default"> <!--v-if--> <!-- @slot Content of the button --> <span class="oc-icon oc-icon-s oc-icon-passive"><!----></span> </button> <button type="button" class="oc-button oc-rounded oc-button-s oc-button-justify-content-center oc-button-gap-m oc-button-passive oc-button-passive-raw oc-text-input-copy-password-button oc-px-s oc-background-default"> <!--v-if--> <!-- @slot Content of the button --> <span class="oc-icon oc-icon-s oc-icon-passive"><!----></span> </button> <!--v-if--> </div> <portal to="app.design-system.password-policy"> <div class="oc-text-small oc-flex oc-flex-column"><span>Please enter a password that meets the following criteria:</span> <div class="oc-flex oc-flex-middle"><span class="oc-icon oc-icon-s oc-icon-success"><!----></span> <span class="oc-text-input-success">At least 8 characters</span></div> </div> </portal> <!--v-if--> </div> <!--v-if--> <portal-target name="app.design-system.password-policy"></portal-target> </div>" `;
owncloud/web/packages/design-system/src/components/OcTextInput/__snapshots__/OcTextInput.spec.ts.snap/0
{ "file_path": "owncloud/web/packages/design-system/src/components/OcTextInput/__snapshots__/OcTextInput.spec.ts.snap", "repo_id": "owncloud", "token_count": 1297 }
795
<template> <thead class="oc-thead"> <slot /> </thead> </template> <script lang="ts"> import { defineComponent } from 'vue' export default defineComponent({ name: 'OcThead', status: 'ready', release: '2.1.0' }) </script> <style lang="scss"> .oc-thead { border-bottom: 1px solid var(--oc-color-border); } </style>
owncloud/web/packages/design-system/src/components/_OcTableHeader/_OcTableHeader.vue/0
{ "file_path": "owncloud/web/packages/design-system/src/components/_OcTableHeader/_OcTableHeader.vue", "repo_id": "owncloud", "token_count": 132 }
796
import { getSizeClass } from './utils/sizeClasses' import './utils/webFontLoader' import * as components from './components' import * as directives from './directives' const initializeCustomProps = (tokens = [], prefix) => { for (const param in tokens) { applyCustomProp(prefix + param, tokens[param]) } } export const applyCustomProp = (key: string, value: string | undefined) => { if (value === undefined) { return } ;(document.querySelector(':root') as HTMLElement).style.setProperty('--oc-' + key, value) } export default { install(app, options: any = {}) { const themeOptions = options.tokens initializeCustomProps(themeOptions?.breakpoints, 'breakpoint-') initializeCustomProps(themeOptions?.colorPalette, 'color-') initializeCustomProps(themeOptions?.fontSizes, 'font-size-') initializeCustomProps(themeOptions?.sizes, 'size-') initializeCustomProps(themeOptions?.spacing, 'space-') applyCustomProp('font-family', themeOptions?.fontFamily) Object.values(components).forEach((c) => app.component(c.name, c)) Object.values(directives).forEach((d) => app.directive(d.name, d)) } } export const utils = { getSizeClass } export * as components from './components' export * as composables from './composables' export * as directives from './directives' export * as helpers from './helpers'
owncloud/web/packages/design-system/src/index.ts/0
{ "file_path": "owncloud/web/packages/design-system/src/index.ts", "repo_id": "owncloud", "token_count": 444 }
797
body, h1, h2, h3, h4, h5, h6, p { color: var(--oc-color-text-default); } html * { font-family: var(--oc-font-family); } html, button { font-feature-settings: "cv11"; font-size: var(--oc-font-size-default); } a { color: var(--oc-color-swatch-primary-default); text-decoration: none; &:hover { color: var(--oc-color-swatch-primary-hover); } } .oc-heading-divider { border-bottom: calc(0.2px + 0.05em) solid var(--oc-color-border); padding-bottom: calc(5px + 0.1em); } /* -------------------------- */ /* --- wrapping behaviour --- */ /* -------------------------- */ /* * Prevent text from wrapping onto multiple lines */ .oc-text-nowrap { white-space: nowrap; } /* * Truncate text with an ellipsis if it's exceeding the available width */ .oc-text-overflow, .oc-text-truncate { max-width: 100%; overflow: hidden; } .oc-text-truncate { text-overflow: ellipsis; white-space: nowrap; } th.oc-text-truncate, td.oc-text-truncate { max-width: 0; } /* * Wrap long words onto the next line and break them if they are too long to fit */ .oc-text-break { overflow-wrap: break-word !important; white-space: unset !important; word-wrap: break-word !important; } th.oc-text-break, td.oc-text-break { word-break: break-all !important; } /* ----------------------- */ /* --- different sizes --- */ /* ----------------------- */ /* * x-small text size as defined by the `oc-font-size-xsmall` theme token. * By default 0.72rem. */ .oc-text-xsmall { font-size: var(--oc-font-size-xsmall); } /* * x-small text size as defined by the `oc-font-size-small` theme token. * By default 0.86rem. */ .oc-text-small { font-size: var(--oc-font-size-small); } /* * medium text size as defined by the `oc-font-size-medium` theme token. * By default 1rem. This is the base font size as defined on the html document. */ .oc-text-medium { font-size: var(--oc-font-size-medium); } /* * large text size as defined by the `oc-font-size-large` theme token. * By default 1.14rem. */ .oc-text-large { font-size: var(--oc-font-size-large); } /* * x-large text size as defined by the `oc-font-size-xlarge` theme token. * By default 1.29rem. */ .oc-text-xlarge { font-size: var(--oc-font-size-xlarge); } /* ------------------------- */ /* --- different weights --- */ /* ------------------------- */ /* * Normal font weight. */ .oc-text-normal { font-weight: 400; } /* * Bold font weight. */ .oc-text-bold { font-weight: 600; } /* ----------------- */ /* --- alignment --- */ /* ----------------- */ /* * Align horizontally centered. */ .oc-text-center { text-align: center; } /* * Align horizontally left. */ .oc-text-left { text-align: left; } /* * Align horizontally right. */ .oc-text-right { text-align: right; } /* ------------------------- */ /* --- special modifiers --- */ /* ------------------------- */ /* * Give text a muted color and small size. */ .oc-text-meta { color: var(--oc-color-text-muted); font-size: var(--oc-font-size-small); } /* * Give text a muted color. */ .oc-text-muted { color: var(--oc-color-text-muted); } /* * Transform text to all uppercase */ .oc-text-uppercase { text-transform: uppercase !important; } @each $weightKey, $weightValue in $weights { .oc-font-#{$weightKey} { font-weight: $weightValue; } }
owncloud/web/packages/design-system/src/styles/theme/oc-text.scss/0
{ "file_path": "owncloud/web/packages/design-system/src/styles/theme/oc-text.scss", "repo_id": "owncloud", "token_count": 1253 }
798
import uniqueId from './uniqueId' describe('uniqueId', () => { it('increases numeric part of the id independent of the chosen prefix', () => { expect(uniqueId()).toBe('1') expect(uniqueId()).toBe('2') expect(uniqueId('prefix-')).toBe('prefix-3') expect(uniqueId('another-prefix-')).toBe('another-prefix-4') expect(uniqueId()).toBe('5') }) })
owncloud/web/packages/design-system/src/utils/uniqueId.spec.ts/0
{ "file_path": "owncloud/web/packages/design-system/src/utils/uniqueId.spec.ts", "repo_id": "owncloud", "token_count": 135 }
799
<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="!filteredSpaceMembers.length"> <h3 class="oc-text-bold oc-text-medium" v-text="$gettext('No members found')" /> </div> <div v-if="filteredSpaceManagers.length" class="oc-mb-m" data-testid="space-members-role-managers" > <h3 class="oc-text-bold oc-text-medium" v-text="$gettext('Managers')" /> <members-role-section :members="filteredSpaceManagers" /> </div> <div v-if="filteredSpaceEditors.length" class="oc-mb-m" data-testid="space-members-role-editors" > <h3 class="oc-text-bold oc-text-medium" v-text="$gettext('Editors')" /> <members-role-section :members="filteredSpaceEditors" /> </div> <div v-if="filteredSpaceViewers.length" class="oc-mb-m" data-testid="space-members-role-viewers" > <h3 class="oc-text-bold oc-text-medium" v-text="$gettext('Viewers')" /> <members-role-section :members="filteredSpaceViewers" /> </div> </div> </div> </template> <script lang="ts"> import { computed, defineComponent, inject, ref, watch, unref } from 'vue' import { Resource } from '@ownclouders/web-client/src' import MembersRoleSection from './MembersRoleSection.vue' import Fuse from 'fuse.js' import Mark from 'mark.js' import { defaultFuseOptions } from '@ownclouders/web-pkg' export default defineComponent({ name: 'MembersPanel', components: { MembersRoleSection }, setup() { const resource = inject<Resource>('resource') 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 spaceMembers = computed(() => { return [ ...unref(resource).spaceRoles.manager.map((r) => ({ ...r, roleType: 'manager' })), ...unref(resource).spaceRoles.editor.map((r) => ({ ...r, roleType: 'editor' })), ...unref(resource).spaceRoles.viewer.map((r) => ({ ...r, roleType: 'viewer' })) ].sort((a, b) => a.displayName.localeCompare(b.displayName)) }) const filteredSpaceMembers = computed(() => { return filterMembers(unref(spaceMembers), unref(filterTerm)) }) const filteredSpaceManagers = computed(() => { return unref(filteredSpaceMembers).filter((m) => m.roleType === 'manager') }) const filteredSpaceEditors = computed(() => { return unref(filteredSpaceMembers).filter((m) => m.roleType === 'editor') }) const filteredSpaceViewers = computed(() => { return unref(filteredSpaceMembers).filter((m) => m.roleType === 'viewer') }) watch(filterTerm, () => { if (unref(membersListRef)) { markInstance.value = new Mark(unref(membersListRef)) unref(markInstance).unmark() unref(markInstance).mark(unref(filterTerm), { element: 'span', className: 'mark-highlight' }) } }) return { filterTerm, filteredSpaceMembers, filteredSpaceManagers, filteredSpaceEditors, filteredSpaceViewers, membersListRef } } }) </script>
owncloud/web/packages/web-app-admin-settings/src/components/Spaces/SideBar/MembersPanel.vue/0
{ "file_path": "owncloud/web/packages/web-app-admin-settings/src/components/Spaces/SideBar/MembersPanel.vue", "repo_id": "owncloud", "token_count": 1578 }
800
export * from './useGroupActionsCreateGroup' export * from './useGroupActionsDelete' export * from './useGroupActionsEdit'
owncloud/web/packages/web-app-admin-settings/src/composables/actions/groups/index.ts/0
{ "file_path": "owncloud/web/packages/web-app-admin-settings/src/composables/actions/groups/index.ts", "repo_id": "owncloud", "token_count": 37 }
801
import { useScrollTo } from '@ownclouders/web-pkg' import { Ref, unref } from 'vue' import { Key, KeyboardActions, ModifierKey } from '@ownclouders/web-pkg' import { find, findIndex } from 'lodash-es' import { Item } from '@ownclouders/web-client/src/helpers' export const useKeyboardTableNavigation = ( keyActions: KeyboardActions, paginatedResources: Ref<{ id: string }[]>, selectedRows: Ref<Item[]>, lastSelectedRowIndex: Ref<number>, lastSelectedRowId: Ref<string | null> ) => { const { scrollToResource } = useScrollTo() keyActions.bindKeyAction({ primary: Key.ArrowUp }, () => handleNavigateAction(true)) keyActions.bindKeyAction({ primary: Key.ArrowDown }, () => handleNavigateAction()) keyActions.bindKeyAction({ modifier: ModifierKey.Shift, primary: Key.ArrowUp }, () => handleShiftUpAction() ) keyActions.bindKeyAction({ modifier: ModifierKey.Shift, primary: Key.ArrowDown }, () => handleShiftDownAction() ) keyActions.bindKeyAction({ modifier: ModifierKey.Ctrl, primary: Key.A }, () => handleSelectAllAction() ) keyActions.bindKeyAction({ primary: Key.Space }, () => { const { lastSelectedRow, lastSelectedRowIndex } = getLastSelectedRow() if (lastSelectedRowIndex === -1) { selectedRows.value.push(lastSelectedRow) } else { selectedRows.value = unref(selectedRows).filter((item) => item.id !== lastSelectedRow.id) } }) keyActions.bindKeyAction({ primary: Key.Esc }, () => { keyActions.resetSelectionCursor() selectedRows.value = [] }) const handleNavigateAction = (up = false) => { const nextResource = !unref(lastSelectedRowId) ? getFirstResource() : getNextResource(up) if (nextResource === -1) { return } const nextResourceIndex = findIndex( paginatedResources.value, (resource) => resource.id === nextResource.id ) keyActions.resetSelectionCursor() selectedRows.value = [nextResource] lastSelectedRowIndex.value = nextResourceIndex lastSelectedRowId.value = String(nextResource.id) scrollToResource(nextResource.id, { topbarElement: 'admin-settings-app-bar' }) } const handleShiftUpAction = () => { const nextResource = getNextResource(true) if (nextResource === -1) { return } const nextResourceIndex = findIndex( paginatedResources.value, (resource) => resource.id === nextResource.id ) if (unref(keyActions.selectionCursor) > 0) { const { lastSelectedRow, lastSelectedRowIndex } = getLastSelectedRow() lastSelectedRowIndex === -1 ? selectedRows.value.push(lastSelectedRow) : (selectedRows.value = unref(selectedRows).filter( (item) => item.id !== lastSelectedRow.id )) } else { selectedRows.value.push(nextResource) } lastSelectedRowIndex.value = nextResourceIndex lastSelectedRowId.value = String(nextResource.id) keyActions.selectionCursor.value = unref(keyActions.selectionCursor) - 1 scrollToResource(nextResource.id, { topbarElement: 'admin-settings-app-bar' }) } const handleShiftDownAction = () => { const nextResource = getNextResource(false) if (nextResource === -1) { return } const nextResourceIndex = findIndex( paginatedResources.value, (resource) => resource.id === nextResource.id ) if (unref(keyActions.selectionCursor) < 0) { const lastSelectedRow = find( paginatedResources.value, (resource) => resource.id === lastSelectedRowId.value ) const lastSelectedRowIndex = findIndex( unref(selectedRows), (resource: any) => resource.id === lastSelectedRowId.value ) if (lastSelectedRowIndex === -1) { selectedRows.value.push(lastSelectedRow) } else { selectedRows.value = unref(selectedRows).filter((item) => item.id !== lastSelectedRow.id) } } else { selectedRows.value.push(nextResource) } lastSelectedRowIndex.value = nextResourceIndex lastSelectedRowId.value = String(nextResource.id) keyActions.selectionCursor.value = unref(keyActions.selectionCursor) + 1 scrollToResource(nextResource.id, { topbarElement: 'admin-settings-app-bar' }) } const handleSelectAllAction = () => { keyActions.resetSelectionCursor() selectedRows.value = [...unref(paginatedResources)] } const getNextResource = (previous = false) => { const latestSelectedResourceIndex = paginatedResources.value.findIndex( (resource) => resource.id === lastSelectedRowId.value ) if (latestSelectedResourceIndex === -1) { return -1 } const nextResourceIndex = latestSelectedResourceIndex + (previous ? -1 : 1) if (nextResourceIndex < 0 || nextResourceIndex >= paginatedResources.value.length) { return -1 } return paginatedResources.value[nextResourceIndex] } const getFirstResource = () => { return paginatedResources.value.length ? paginatedResources.value[0] : -1 } const getLastSelectedRow = () => { const lastSelectedRow = find( paginatedResources.value, (resource) => resource.id === lastSelectedRowId.value ) const lastSelectedRowIndex = findIndex( unref(selectedRows), (resource: any) => resource.id === lastSelectedRowId.value ) return { lastSelectedRow, lastSelectedRowIndex } } }
owncloud/web/packages/web-app-admin-settings/src/composables/keyboardActions/useKeyboardTableNavigation.ts/0
{ "file_path": "owncloud/web/packages/web-app-admin-settings/src/composables/keyboardActions/useKeyboardTableNavigation.ts", "repo_id": "owncloud", "token_count": 1968 }
802
import EditPanel from '../../../../../src/components/Groups/SideBar/EditPanel.vue' import { defaultComponentMocks, defaultPlugins, mockAxiosReject, mockAxiosResolve, mount } from 'web-test-helpers' import { mock } from 'vitest-mock-extended' import { AxiosResponse } from 'axios' import { eventBus, useMessages } from '@ownclouders/web-pkg' describe('EditPanel', () => { it('renders all available inputs', () => { const { wrapper } = getWrapper() expect(wrapper.html()).toMatchSnapshot() }) describe('method "revertChanges"', () => { it('should revert changes on property editGroup', () => { const { wrapper } = getWrapper() wrapper.vm.editGroup.displayName = 'users' wrapper.vm.revertChanges() expect(wrapper.vm.editGroup.displayName).toEqual('group') }) it('should revert changes on property formData', () => { const { wrapper } = getWrapper() wrapper.vm.formData.displayName.valid = false wrapper.vm.formData.displayName.errorMessage = 'error' wrapper.vm.revertChanges() expect(wrapper.vm.formData.displayName.valid).toBeTruthy() expect(wrapper.vm.formData.displayName.errorMessage).toEqual('') }) }) describe('method "validateDisplayName"', () => { it('should return true if displayName is valid', async () => { const { wrapper, mocks } = getWrapper() wrapper.vm.editGroup.displayName = 'users' const graphMock = mocks.$clientService.graphAuthenticated const getGroupStub = graphMock.groups.getGroup.mockRejectedValue(() => mockAxiosReject()) expect(await wrapper.vm.validateDisplayName()).toBeTruthy() expect(getGroupStub).toHaveBeenCalled() }) it('should return false if displayName is longer than 255 characters', async () => { const { wrapper } = getWrapper() wrapper.vm.editGroup.displayName = 'n'.repeat(256) expect(await wrapper.vm.validateDisplayName()).toBeFalsy() }) it('should return false if displayName is empty', async () => { const { wrapper } = getWrapper() wrapper.vm.editGroup.displayName = '' expect(await wrapper.vm.validateDisplayName()).toBeFalsy() }) it('should return false if displayName is already existing', async () => { const { wrapper, mocks } = getWrapper() wrapper.vm.editGroup.displayName = 'users' const graphMock = mocks.$clientService.graphAuthenticated const getGroupStub = graphMock.groups.getGroup.mockResolvedValue( mock<AxiosResponse>({ data: { displayName: 'group' } }) ) expect(await wrapper.vm.validateDisplayName()).toBeFalsy() expect(getGroupStub).toHaveBeenCalled() }) }) describe('method "onEditGroup"', () => { it('should emit event on success', async () => { const { wrapper, mocks } = getWrapper() const clientService = mocks.$clientService clientService.graphAuthenticated.groups.editGroup.mockResolvedValue(mockAxiosResolve()) clientService.graphAuthenticated.groups.getGroup.mockResolvedValue( mockAxiosResolve({ id: '1', displayName: 'administrators' }) ) const editGroup = { id: '1', name: 'administrators' } const busStub = vi.spyOn(eventBus, 'publish') const updatedGroup = await wrapper.vm.onEditGroup(editGroup) expect(updatedGroup.id).toEqual('1') expect(updatedGroup.displayName).toEqual('administrators') expect(busStub).toHaveBeenCalled() }) it('should show message on error', async () => { vi.spyOn(console, 'error').mockImplementation(() => undefined) const { wrapper, mocks } = getWrapper() const clientService = mocks.$clientService clientService.graphAuthenticated.groups.editGroup.mockImplementation(() => mockAxiosReject()) await wrapper.vm.onEditGroup({}) const { showErrorMessage } = useMessages() expect(showErrorMessage).toHaveBeenCalled() }) }) describe('computed method "invalidFormData"', () => { it('should be false if formData is invalid', () => { const { wrapper } = getWrapper() wrapper.vm.formData.displayName.valid = true expect(wrapper.vm.invalidFormData).toBeFalsy() }) it('should be true if formData is valid', () => { const { wrapper } = getWrapper() wrapper.vm.formData.displayName.valid = false expect(wrapper.vm.invalidFormData).toBeTruthy() }) }) }) function getWrapper() { const mocks = defaultComponentMocks() return { mocks, wrapper: mount(EditPanel, { props: { group: { displayName: 'group', members: [] } }, global: { mocks, provide: mocks, plugins: [...defaultPlugins()], stubs: { 'oc-text-input': true, 'avatar-image': true, 'oc-button': true, translate: true } } }) } }
owncloud/web/packages/web-app-admin-settings/tests/unit/components/Groups/SideBar/EditPanel.spec.ts/0
{ "file_path": "owncloud/web/packages/web-app-admin-settings/tests/unit/components/Groups/SideBar/EditPanel.spec.ts", "repo_id": "owncloud", "token_count": 1863 }
803
import RemoveFromGroupsModal from '../../../../src/components/Users/RemoveFromGroupsModal.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('RemoveFromGroupsModal', () => { it('renders the input', () => { const { wrapper } = getWrapper() expect(wrapper.find('group-select-stub').exists()).toBeTruthy() }) describe('method "onConfirm"', () => { it('removes all users from the given groups', async () => { const users = [ mock<User>({ memberOf: [{ id: '1' }] }), mock<User>({ memberOf: [{ id: '1' }] }) ] const groups = [mock<Group>({ id: '1' })] const { wrapper, mocks } = getWrapper({ users, groups }) mocks.$clientService.graphAuthenticated.groups.deleteMember.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: [{ id: '1' }] }), mock<User>({ memberOf: [{ id: '1' }] }) ] const groups = [mock<Group>({ id: '1' })] const { wrapper, mocks } = getWrapper({ users, groups }) mocks.$clientService.graphAuthenticated.groups.deleteMember.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(RemoveFromGroupsModal, { 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/RemoveFromGroupsModal.spec.ts/0
{ "file_path": "owncloud/web/packages/web-app-admin-settings/tests/unit/components/Users/RemoveFromGroupsModal.spec.ts", "repo_id": "owncloud", "token_count": 1120 }
804
[main] host = https://www.transifex.com [o:owncloud-org:p:owncloud-web:r:epub-reader] file_filter = locale/<lang>/LC_MESSAGES/app.po minimum_perc = 0 source_file = template.pot source_lang = en type = PO
owncloud/web/packages/web-app-epub-reader/l10n/.tx/config/0
{ "file_path": "owncloud/web/packages/web-app-epub-reader/l10n/.tx/config", "repo_id": "owncloud", "token_count": 86 }
805
<template> <div class="files-search-result oc-flex"> <files-view-wrapper> <app-bar :breadcrumbs="breadcrumbs" :has-bulk-actions="true" :is-side-bar-open="isSideBarOpen" /> <div v-if="displayFilter" class="files-search-result-filter oc-flex oc-mx-m oc-mb-m oc-mt-xs"> <div class="oc-mr-m oc-flex oc-flex-middle"> <oc-icon name="filter-2" class="oc-mr-xs" /> <span v-text="$gettext('Filter:')" /> </div> <item-filter v-if="availableMediaTypeValues.length" ref="mediaTypeFilter" :allow-multiple="true" :filter-label="$gettext('Type')" :filterable-attributes="['label']" :items="availableMediaTypeValues" class="files-search-filter-file-type oc-mr-s" display-name-attribute="label" filter-name="mediaType" > <template #image="{ item }"> <div class="file-category-option-wrapper oc-flex oc-flex-middle" :data-test-id="`media-type-${item.id.toLowerCase()}`" > <resource-icon :resource="getFakeResourceForIcon(item)" /> <span class="oc-ml-s">{{ item.label }}</span> </div> </template> </item-filter> <item-filter v-if="availableTags.length" ref="tagFilter" :allow-multiple="true" :filter-label="$gettext('Tags')" :filterable-attributes="['label']" :items="availableTags" :option-filter-label="$gettext('Filter tags')" :show-option-filter="true" class="files-search-filter-tags oc-mr-s" display-name-attribute="label" filter-name="tags" > <template #image="{ item }"> <div class="tag-option-wrapper oc-flex oc-flex-middle"> <oc-icon name="price-tag-3" size="small" /> <span class="oc-ml-s">{{ item.label }}</span> </div> </template> </item-filter> <item-filter v-if="availableLastModifiedValues.length" ref="lastModifiedFilter" :filter-label="$gettext('Last Modified')" :filterable-attributes="['label']" :items="availableLastModifiedValues" :show-option-filter="false" :close-on-click="true" class="files-search-filter-last-modified oc-mr-s" display-name-attribute="label" filter-name="lastModified" > <template #item="{ item }"> <span v-text="item.label" /> </template> </item-filter> <item-filter-toggle v-if="fullTextSearchEnabled" :filter-label="$gettext('Title only')" filter-name="titleOnly" class="files-search-filter-title-only oc-mr-s" /> </div> <app-loading-spinner v-if="loading" /> <template v-else> <no-content-message v-if="!paginatedResources.length" class="files-empty" icon="search" icon-fill-type="line" > <template #message> <p class="oc-text-muted"> <span v-if="!!$route.query.term" v-text="$gettext('No results found')" /> <span v-else v-text="$gettext('Search for files')" /> </p> </template> </no-content-message> <resource-table v-else v-model:selectedIds="selectedResourcesIds" :is-side-bar-open="isSideBarOpen" :header-position="fileListHeaderY" :resources="paginatedResources" :are-paths-displayed="true" :are-thumbnails-displayed="displayThumbnails" :has-actions="true" :is-selectable="true" :sort-by="sortBy" :sort-dir="sortDir" :fields-displayed="['name', 'size', 'tags', 'mdate']" :resource-dom-selector="resourceDomSelector" @file-click="triggerDefaultAction" @row-mounted="rowMounted" @sort="handleSort" > <template #additionalResourceContent="{ resource }"> <!-- eslint-disable vue/no-v-html --> <span v-if="resource.highlights" class="files-search-resource-highlights oc-text-truncate" v-html="resource.highlights" /> <!--eslint-enable--> </template> <template #contextMenu="{ resource }"> <context-actions v-if="isResourceInSelection(resource)" :action-options="{ space: getMatchingSpace(resource), resources: selectedResources }" /> </template> <template #footer> <pagination :pages="paginationPages" :current-page="paginationPage" /> <div v-if="searchResultExceedsLimit" class="oc-text-nowrap oc-text-center oc-width-1-1 oc-my-s" v-text="searchResultExceedsLimitText" /> <list-info v-else-if="paginatedResources.length > 0" class="oc-width-1-1 oc-my-s" :files="totalResourcesCount.files" :folders="totalResourcesCount.folders" :size="totalResourcesSize" /> </template> </resource-table> </template> </files-view-wrapper> <file-side-bar :is-open="isSideBarOpen" :active-panel="sideBarActivePanel" :space="selectedResourceSpace" /> </div> </template> <script lang="ts"> import { useResourcesViewDefaults } from '../../composables' import { AppLoadingSpinner, useCapabilityStore, useConfigStore, useResourcesStore } from '@ownclouders/web-pkg' import { VisibilityObserver } from '@ownclouders/web-pkg' import { ImageDimension } from '@ownclouders/web-pkg' import { NoContentMessage } from '@ownclouders/web-pkg' import { ResourceTable } from '@ownclouders/web-pkg' import { ContextActions, FileSideBar } from '@ownclouders/web-pkg' import { debounce } from 'lodash-es' import { useGettext } from 'vue3-gettext' import { AppBar } from '@ownclouders/web-pkg' import { computed, defineComponent, nextTick, onMounted, Ref, ref, unref, watch } from 'vue' import ListInfo from '../FilesList/ListInfo.vue' import { Pagination } from '@ownclouders/web-pkg' import { useFileActions } from '@ownclouders/web-pkg' import { searchLimit } from '../../search/sdk/list' import { Resource } from '@ownclouders/web-client' import FilesViewWrapper from '../FilesViewWrapper.vue' import { queryItemAsString, useClientService, useFileListHeaderPosition, useGetMatchingSpace, useRoute, useRouteQuery, useRouter } from '@ownclouders/web-pkg' import { onBeforeRouteLeave } from 'vue-router' import { useTask } from 'vue-concurrency' import { eventBus } from '@ownclouders/web-pkg' import { ItemFilter } from '@ownclouders/web-pkg' import { isLocationCommonActive } from '@ownclouders/web-pkg' import { ItemFilterToggle } from '@ownclouders/web-pkg' import { useKeyboardActions, ResourceIcon } from '@ownclouders/web-pkg' import { useKeyboardTableNavigation, useKeyboardTableMouseActions, useKeyboardTableActions } from 'web-app-files/src/composables/keyboardActions' import { extractDomSelector } from '@ownclouders/web-client/src/helpers' import { storeToRefs } from 'pinia' const visibilityObserver = new VisibilityObserver() type Tag = { id: string label: string } type LastModifiedKeyword = { id: string label: string } export default defineComponent({ components: { AppBar, FileSideBar, AppLoadingSpinner, ContextActions, ListInfo, Pagination, NoContentMessage, ResourceIcon, ResourceTable, FilesViewWrapper, ItemFilter, ItemFilterToggle }, props: { searchResult: { type: Object, default: function () { return { totalResults: null, values: [] } } }, loading: { type: Boolean, default: false } }, emits: ['search'], setup(props, { emit }) { const capabilityStore = useCapabilityStore() const router = useRouter() const route = useRoute() const { $gettext } = useGettext() const { y: fileListHeaderY } = useFileListHeaderPosition() const clientService = useClientService() const { getMatchingSpace } = useGetMatchingSpace() const resourcesStore = useResourcesStore() const { initResourceList, clearResourceList, updateResourceField } = resourcesStore const { totalResourcesCount, totalResourcesSize } = storeToRefs(resourcesStore) const configStore = useConfigStore() const { options: configOptions } = storeToRefs(configStore) const searchTermQuery = useRouteQuery('term') const scopeQuery = useRouteQuery('scope') const doUseScope = useRouteQuery('useScope') const resourcesView = useResourcesViewDefaults<Resource, any, any[]>() const keyActions = useKeyboardActions() useKeyboardTableNavigation(keyActions, resourcesView.paginatedResources, resourcesView.viewMode) useKeyboardTableMouseActions(keyActions, resourcesView.viewMode) useKeyboardTableActions(keyActions) const searchTerm = computed(() => { return queryItemAsString(unref(searchTermQuery)) }) const availableTags = ref<Tag[]>([]) const tagFilter = ref<InstanceType<typeof ItemFilter> | null>(null) const mediaTypeFilter = ref<InstanceType<typeof ItemFilter> | null>() const tagParam = useRouteQuery('q_tags') const lastModifiedParam = useRouteQuery('q_lastModified') const mediaTypeParam = useRouteQuery('q_mediaType') const titleOnlyParam = useRouteQuery('q_titleOnly') const fullTextSearchEnabled = computed(() => capabilityStore.searchContent?.enabled) const displayFilter = computed(() => { return ( unref(fullTextSearchEnabled) || unref(availableTags).length || capabilityStore.searchLastMofifiedDate?.enabled ) }) const loadAvailableTagsTask = useTask(function* () { const { data: { value: tags = [] } } = yield clientService.graphAuthenticated.tags.getTags() availableTags.value = [...tags.map((t) => ({ id: t, label: t }))] }) onBeforeRouteLeave(() => { eventBus.publish('app.search.term.clear') }) // transifex hack b/c dynamically fetched values from backend will otherwise not be automatically translated const lastModifiedTranslations = { today: $gettext('today'), yesterday: $gettext('yesterday'), 'this week': $gettext('this week'), 'last week': $gettext('last week'), 'last 7 days': $gettext('last 7 days'), 'this month': $gettext('this month'), 'last month': $gettext('last month'), 'last 30 days': $gettext('last 30 days'), 'this year': $gettext('this year'), 'last year': $gettext('last year') } const lastModifiedFilter = ref<InstanceType<typeof ItemFilter> | null>() const availableLastModifiedValues = ref<LastModifiedKeyword[]>( capabilityStore.searchLastMofifiedDate.keywords?.map((k: string) => ({ id: k, label: lastModifiedTranslations[k] })) || [] ) const mediaTypeMapping = { file: { label: $gettext('File'), icon: 'txt' }, folder: { label: $gettext('Folder'), icon: 'folder' }, document: { label: $gettext('Document'), icon: 'doc' }, spreadsheet: { label: $gettext('Spreadsheet'), icon: 'xls' }, presentation: { label: $gettext('Presentation'), icon: 'ppt' }, pdf: { label: $gettext('PDF'), icon: 'pdf' }, image: { label: $gettext('Image'), icon: 'jpg' }, video: { label: $gettext('Video'), icon: 'mp4' }, audio: { label: $gettext('Audio'), icon: 'mp3' }, archive: { label: $gettext('Archive'), icon: 'zip' } } const availableMediaTypeValues = computed(() => { return ( capabilityStore.searchMediaType.keywords?.filter((key) => mediaTypeMapping[key]) || [] ).map((key) => ({ id: key, ...mediaTypeMapping[key] })) }) const getFakeResourceForIcon = (item) => { return { type: 'file', extension: item.icon, isFolder: item.icon == 'folder' } as Resource } const buildSearchTerm = (manuallyUpdateFilterChip = false) => { const query: string[] = [] const humanSearchTerm = unref(searchTerm) const isTitleOnlySearch = queryItemAsString(unref(titleOnlyParam)) == 'true' const useFullTextSearch = unref(fullTextSearchEnabled) && !isTitleOnlySearch if (!!humanSearchTerm) { let nameQuery = `name:"*${humanSearchTerm}*"` if (useFullTextSearch) { nameQuery = `(name:"*${humanSearchTerm}*" OR content:"${humanSearchTerm}")` } query.push(nameQuery) } const humanScopeQuery = unref(scopeQuery) const isScopedSearch = unref(doUseScope) === 'true' if (isScopedSearch && humanScopeQuery) { query.push(`scope:${humanScopeQuery}`) } const updateFilter = (v: Ref<InstanceType<typeof ItemFilter>>) => { if (manuallyUpdateFilterChip && unref(v)) { /** * Handles edge cases where a filter is not being applied via the filter directly, * e.g. when clicking on a tag in the files list. * We need to manually update the selected items in the ItemFilter component because normally * it only does this on mount or when interacting with the filter directly. */ unref(v).setSelectedItemsBasedOnQuery() } } const humanTagsParams = queryItemAsString(unref(tagParam)) if (humanTagsParams) { const tags = humanTagsParams.split('+').map((t) => `"${t}"`) query.push(`tag:(${tags.join(' OR ')})`) updateFilter(tagFilter) } const lastModifiedParams = queryItemAsString(unref(lastModifiedParam)) if (lastModifiedParams) { query.push(`mtime:${lastModifiedParams}`) updateFilter(lastModifiedFilter) } const mediaTypeParams = queryItemAsString(unref(mediaTypeParam)) if (mediaTypeParams) { const mediatypes = mediaTypeParams.split('+').map((t) => `"${t}"`) query.push(`mediatype:(${mediatypes.join(' OR ')})`) updateFilter(mediaTypeFilter) } return query .sort((a, b) => Number(a.startsWith('scope:')) - Number(b.startsWith('scope:'))) .join(' AND ') } const breadcrumbs = computed(() => { return [ { text: unref(searchTerm) ? $gettext('Search results for "%{searchTerm}"', { searchTerm: unref(searchTerm) }) : $gettext('Search') } ] }) const resourceDomSelector = ({ id, shareId }: Resource) => { let selectorStr = id.toString() if (shareId) { selectorStr += shareId } return extractDomSelector(selectorStr) } onMounted(async () => { // Store resources are shared across table views, therefore // the store state needs a reset to prevent the old list of resources // from being rendered while the request retrieves the new resources from the server. clearResourceList() if (capabilityStore.filesTags) { await loadAvailableTagsTask.perform() } emit('search', buildSearchTerm()) }) watch( () => unref(route).query, (newVal, oldVal) => { // return early if this view is not active, no search needed { const isSearchViewActive = isLocationCommonActive(router, 'files-common-search') if (!isSearchViewActive) { return } } // return early if the search term or filter has not changed, no search needed { const isSameTerm = newVal?.term === oldVal?.term const isSameFilter = [ 'q_titleOnly', 'q_tags', 'q_lastModified', 'q_mediaType', 'useScope' ].every((key) => newVal[key] === oldVal[key]) if (isSameTerm && isSameFilter) { return } } emit('search', buildSearchTerm(true)) }, { deep: true } ) return { ...useFileActions(), ...resourcesView, configOptions, loadAvailableTagsTask, fileListHeaderY, fullTextSearchEnabled, getMatchingSpace, availableTags, tagFilter, breadcrumbs, displayFilter, availableLastModifiedValues, lastModifiedFilter, mediaTypeFilter, availableMediaTypeValues, getFakeResourceForIcon, resourceDomSelector, initResourceList, clearResourceList, updateResourceField, totalResourcesCount, totalResourcesSize } }, computed: { displayThumbnails() { return !this.configOptions.disablePreviews }, itemCount() { return this.totalResourcesCount.files + this.totalResourcesCount.folders }, rangeSupported() { return this.searchResult.totalResults }, searchResultExceedsLimit() { return ( !this.rangeSupported || (this.searchResult.totalResults && this.searchResult.totalResults > searchLimit) ) }, searchResultExceedsLimitText() { if (!this.rangeSupported) { return this.$gettext('Showing up to %{searchLimit} results', { searchLimit: searchLimit.toString() }) } return this.$gettext( 'Found %{totalResults}, showing the %{itemCount} best matching results', { itemCount: this.itemCount.toString(), totalResults: this.searchResult.totalResults } ) } }, watch: { searchResult: { handler: async function () { if (!this.searchResult) { return } this.clearResourceList() this.initResourceList({ currentFolder: null, resources: this.searchResult.values.length ? this.searchResult.values.map((searchResult) => searchResult.data) : [] }) await nextTick() this.scrollToResourceFromRoute(this.paginatedResources, 'files-app-bar') } } }, beforeUnmount() { visibilityObserver.disconnect() }, methods: { rowMounted(resource: Resource, component) { if (!this.displayThumbnails) { return } const loadPreview = async () => { const preview = await this.$previewService.loadPreview( { space: this.getMatchingSpace(resource), resource, dimensions: ImageDimension.Thumbnail }, true ) if (preview) { this.updateResourceField({ id: resource.id, field: 'thumbnail', value: preview }) } } const debounced = debounce(({ unobserve }) => { unobserve() loadPreview() }, 250) visibilityObserver.observe(component.$el, { onEnter: debounced, onExit: debounced.cancel }) } } }) </script> <style lang="scss"> .files-search-resource-highlights { font-size: 0.8125rem; color: var(--oc-color-text-muted); mark { background: #fff74c; font-style: normal; font-weight: var(--oc-font-weight-semibold); } } </style>
owncloud/web/packages/web-app-files/src/components/Search/List.vue/0
{ "file_path": "owncloud/web/packages/web-app-files/src/components/Search/List.vue", "repo_id": "owncloud", "token_count": 8235 }
806
<template> <div id="oc-files-file-link" class="oc-position-relative"> <div class="oc-flex"> <h3 class="oc-text-bold oc-text-medium oc-m-rm" v-text="linksHeading" /> <oc-contextual-helper v-if="helpersEnabled" class="oc-pl-xs" v-bind="viaLinkHelp" /> </div> <p v-if="!canCreateLinks({ space, resource })" data-testid="files-links-no-share-permissions-message" class="oc-mt-m" v-text="$gettext('You do not have permission to create links')" /> <div v-if="quicklink || canCreateLinks({ space, resource })" class="oc-mt-m"> <name-and-copy v-if="quicklink" :link-share="quicklink" /> <create-quick-link v-else-if="canCreateLinks({ space, resource })" :expiration-rules="expirationRules" @create-public-link="addNewLink(true)" /> <details-and-edit v-if="quicklink" :can-rename="false" :expiration-rules="expirationRules" :is-folder-share="resource.isFolder" :is-modifiable="canEditLink(quicklink)" :is-password-enforced="isPasswordEnforcedForLinkType(quicklink.type)" :is-password-removable="canDeletePublicLinkPassword(quicklink)" :link-share="quicklink" @update-link="handleLinkUpdate" @remove-public-link="deleteLinkConfirmation" /> <hr class="oc-my-m" /> <oc-button v-if="canCreateLinks({ space, resource })" id="files-file-link-add" variation="primary" appearance="raw" data-testid="files-link-add-btn" @click="addNewLink(false)" > <span v-text="$gettext('Add link')" /></oc-button> </div> <oc-list v-if="directLinks.length" class="oc-overflow-hidden oc-my-m"> <li v-for="link in displayLinks" :key="link.key" class="oc-py-s" :data-testid="`files-link-id-${link.id}`" > <name-and-copy :link-share="link" /> <details-and-edit :can-rename="true" :expiration-rules="expirationRules" :is-folder-share="resource.isFolder" :is-modifiable="canEditLink(link)" :is-password-enforced="isPasswordEnforcedForLinkType(link.type)" :is-password-removable="canDeletePublicLinkPassword(link)" :link-share="link" @update-link="handleLinkUpdate" @remove-public-link="deleteLinkConfirmation" /> </li> </oc-list> <div v-if="directLinks.length > 3" class="oc-flex oc-flex-center"> <oc-button class="indirect-link-list-toggle" appearance="raw" @click="toggleLinkListCollapsed" > <span v-text="collapseButtonTitle" /> <oc-icon :name="collapseButtonIcon" fill-type="line" /> </oc-button> </div> <div v-if="indirectLinks.length" id="indirect-link-list"> <hr class="oc-my-m" /> <div class="oc-flex"> <h3 class="oc-text-bold oc-m-rm oc-text-medium"> <span v-text="indirectLinksHeading" /> </h3> <oc-contextual-helper v-if="helpersEnabled" class="oc-pl-xs" v-bind="indirectLinkHelp" /> </div> <oc-list v-if="!indirectLinkListCollapsed" class="oc-overflow-hidden oc-my-m"> <li v-for="link in displayIndirectLinks" :key="link.key" class="oc-py-s" :data-testid="`files-link-id-${link.id}`" > <name-and-copy :link-share="link" /> <details-and-edit :expiration-rules="expirationRules" :is-folder-share="true" :is-modifiable="false" :link-share="link" /> </li> </oc-list> <div class="oc-flex oc-flex-center"> <oc-button class="indirect-link-list-toggle" appearance="raw" @click="toggleIndirectLinkListCollapsed" > <span v-text="indirectCollapseButtonTitle" /> <oc-icon :name="indirectCollapseButtonIcon" fill-type="line" /> </oc-button> </div> </div> </div> </template> <script lang="ts"> import { computed, defineComponent, inject, ref, Ref, unref } from 'vue' import { useAbility, useExpirationRules, useFileActionsCreateLink, FileAction, useClientService, useModals, useMessages, useConfigStore, useResourcesStore, useLinkTypes, useCanShare } from '@ownclouders/web-pkg' import { shareViaLinkHelp, shareViaIndirectLinkHelp } from '../../../helpers/contextualHelpers' import { LinkShare } from '@ownclouders/web-client/src/helpers/share' import DetailsAndEdit from './Links/DetailsAndEdit.vue' import NameAndCopy from './Links/NameAndCopy.vue' import CreateQuickLink from './Links/CreateQuickLink.vue' import SetLinkPasswordModal from '../../Modals/SetLinkPasswordModal.vue' import { Resource, SpaceResource } from '@ownclouders/web-client/src/helpers' import { isLocationSharesActive, useSharesStore } from '@ownclouders/web-pkg' import { useGettext } from 'vue3-gettext' import { storeToRefs } from 'pinia' import { SharingLinkType } from '@ownclouders/web-client/src/generated' export default defineComponent({ name: 'FileLinks', components: { CreateQuickLink, DetailsAndEdit, NameAndCopy }, setup() { const { showMessage, showErrorMessage } = useMessages() const { $gettext } = useGettext() const ability = useAbility() const clientService = useClientService() const { can } = ability const { expirationRules } = useExpirationRules() const { dispatchModal } = useModals() const { removeResources } = useResourcesStore() const { isPasswordEnforcedForLinkType } = useLinkTypes() const { canShare: canCreateLinks } = useCanShare() const sharesStore = useSharesStore() const { updateLink, deleteLink } = sharesStore const { linkShares } = storeToRefs(sharesStore) const configStore = useConfigStore() const { options: configOptions } = storeToRefs(configStore) const { actions: createLinkActions } = useFileActionsCreateLink() const createLinkAction = computed<FileAction>(() => unref(createLinkActions).find(({ name }) => name === 'create-links') ) const createQuicklinkAction = computed<FileAction>(() => unref(createLinkActions).find(({ name }) => name === 'create-quick-links') ) const space = inject<Ref<SpaceResource>>('space') const resource = inject<Ref<Resource>>('resource') const initialLinkListCollapsed = !configStore.options.sidebar.shares.showAllOnLoad const linkListCollapsed = ref(initialLinkListCollapsed) const indirectLinkListCollapsed = ref(initialLinkListCollapsed) const directLinks = computed(() => unref(linkShares) .filter((l) => !l.indirect && !l.isQuickLink) .sort((a: any, b: any) => b.stime - a.stime) // FIXME: share date not yet available .map((share) => { return { ...share, key: 'direct-link-' + share.id } }) ) const indirectLinks = computed(() => unref(linkShares) .filter((l) => l.indirect) .sort((a: any, b: any) => b.stime - a.stime) // FIXME: share date not yet available .map((share) => { return { ...share, key: 'indirect-link-' + share.id } }) ) const canDeleteReadOnlyPublicLinkPassword = computed(() => can('delete-all', 'ReadOnlyPublicLinkPassword') ) const canEditLink = (linkShare: LinkShare) => { return ( canCreateLinks({ space: unref(space), resource: unref(resource) }) && (can('create-all', 'PublicLink') || linkShare.type === SharingLinkType.Internal) ) } const addNewLink = (isQuickLink: boolean) => { const handlerArgs = { space: unref(space), resources: [unref(resource)] } if (isQuickLink) { return unref(createQuicklinkAction)?.handler(handlerArgs) } return unref(createLinkAction)?.handler(handlerArgs) } const canDeletePublicLinkPassword = (linkShare: LinkShare) => { const isPasswordEnforced = isPasswordEnforcedForLinkType(linkShare.type) if (!isPasswordEnforced) { return true } return linkShare.type === SharingLinkType.View && unref(canDeleteReadOnlyPublicLinkPassword) } const handleLinkUpdate = async ({ linkShare, password = undefined }: { linkShare: LinkShare password?: string }) => { if (password !== undefined && !canDeletePublicLinkPassword(linkShare)) { showPasswordModal(linkShare) return } try { await updateLink({ clientService, space: unref(space), resource: unref(resource), linkShare, options: { displayName: linkShare.displayName, type: linkShare.type, expirationDateTime: linkShare.expirationDateTime, ...(password !== undefined && { password }) } }) showMessage({ title: $gettext('Link was updated successfully') }) } catch (e) { console.error(e) showErrorMessage({ title: $gettext('Failed to update link'), errors: [e] }) } } const showPasswordModal = (linkShare: LinkShare) => { dispatchModal({ title: $gettext('Set password'), customComponent: SetLinkPasswordModal, customComponentAttrs: () => ({ space: unref(space), resource: unref(resource), link: linkShare }) }) } return { clientService, space, resource, isPasswordEnforcedForLinkType, indirectLinkListCollapsed, linkListCollapsed, linkShares, directLinks, indirectLinks, deleteLink, configStore, configOptions, canCreateLinks, canEditLink, expirationRules, handleLinkUpdate, addNewLink, dispatchModal, showMessage, showErrorMessage, removeResources, canDeletePublicLinkPassword } }, computed: { collapseButtonTitle() { return this.linkListCollapsed ? this.$gettext('Show all') : this.$gettext('Show less') }, collapseButtonIcon() { return this.linkListCollapsed ? 'arrow-down-s' : 'arrow-up-s' }, indirectCollapseButtonTitle() { return this.indirectLinkListCollapsed ? this.$gettext('Show') : this.$gettext('Hide') }, indirectCollapseButtonIcon() { return this.indirectLinkListCollapsed ? 'arrow-down-s' : 'arrow-up-s' }, quicklink() { return this.linkShares.find(({ isQuickLink, indirect }) => isQuickLink === true && !indirect) }, helpersEnabled() { return this.configOptions.contextHelpers }, viaLinkHelp() { return shareViaLinkHelp({ configStore: this.configStore }) }, indirectLinkHelp() { return shareViaIndirectLinkHelp({ configStore: this.configStore }) }, linksHeading() { return this.$gettext('Share via link') }, indirectLinksHeading() { return this.$gettext('Indirect links (%{ count })', { count: this.indirectLinks.length.toString() }) }, displayLinks() { if (this.directLinks.length > 3 && this.linkListCollapsed) { return this.directLinks.slice(0, 3) } return this.directLinks }, displayIndirectLinks() { if (this.indirectLinkListCollapsed) { return [] } return this.indirectLinks }, resourceIsSpace() { return this.resource.type === 'space' } }, methods: { toggleLinkListCollapsed() { this.linkListCollapsed = !this.linkListCollapsed }, toggleIndirectLinkListCollapsed() { this.indirectLinkListCollapsed = !this.indirectLinkListCollapsed }, deleteLinkConfirmation({ link }: { link: LinkShare }) { this.dispatchModal({ variation: 'danger', title: this.$gettext('Delete link'), message: this.$gettext( 'Are you sure you want to delete this link? Recreating the same link again is not possible.' ), confirmText: this.$gettext('Delete'), onConfirm: async () => { let lastLinkId = this.linkShares.length === 1 ? this.linkShares[0].id : undefined const loadIndicators = this.linkShares.filter((l) => !l.indirect).length === 1 try { await this.deleteLink({ clientService: this.clientService, space: this.space, resource: this.resource, linkShare: link, loadIndicators }) this.showMessage({ title: this.$gettext('Link was deleted successfully') }) if (lastLinkId && isLocationSharesActive(this.$router, 'files-shares-via-link')) { if (this.resourceIsSpace) { // spaces need their actual id instead of their share id to be removed from the file list lastLinkId = this.resource.id.toString() } this.removeResources([{ id: lastLinkId }] as Resource[]) } } catch (e) { console.error(e) this.showErrorMessage({ title: this.$gettext('Failed to delete link'), errors: [e] }) } } }) } } }) </script> <style lang="scss"> #oc-files-file-link, #oc-files-sharing-sidebar { border-radius: 5px; } .link-name-container { background-color: var(--oc-color-input-bg); border: 1px solid var(--oc-color-input-border); border-radius: 5px; } </style>
owncloud/web/packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue/0
{ "file_path": "owncloud/web/packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue", "repo_id": "owncloud", "token_count": 5739 }
807
import FileDetails from '../../components/SideBar/Details/FileDetails.vue' import FileDetailsMultiple from '../../components/SideBar/Details/FileDetailsMultiple.vue' import FileActions from '../../components/SideBar/Actions/FileActions.vue' import FileVersions from '../../components/SideBar/Versions/FileVersions.vue' import SharesPanel from '../../components/SideBar/Shares/SharesPanel.vue' import NoSelection from '../../components/SideBar/NoSelection.vue' import TrashNoSelection from '../../components/SideBar/TrashNoSelection.vue' import SpaceActions from '../../components/SideBar/Actions/SpaceActions.vue' import { SpaceDetails, SpaceDetailsMultiple, SpaceNoSelection, isLocationTrashActive, isLocationPublicActive, isLocationSpacesActive, isLocationSharesActive, useRouter, SidebarPanelExtension, useIsFilesAppActive, useGetMatchingSpace, useUserStore, useCapabilityStore } from '@ownclouders/web-pkg' import { isProjectSpaceResource, isShareResource, isShareSpaceResource, SpaceResource } from '@ownclouders/web-client/src/helpers' import { Resource } from '@ownclouders/web-client' import { useGettext } from 'vue3-gettext' import { computed, unref } from 'vue' export const useSideBarPanels = () => { const router = useRouter() const capabilityStore = useCapabilityStore() const { $gettext } = useGettext() const isFilesAppActive = useIsFilesAppActive() const { isPersonalSpaceRoot } = useGetMatchingSpace() const userStore = useUserStore() return computed( () => [ { id: 'com.github.owncloud.web.files.sidebar-panel.no-selection', type: 'sidebarPanel', scopes: ['resource'], panel: { name: 'no-selection', icon: 'questionnaire-line', title: () => $gettext('Details'), component: NoSelection, isRoot: () => true, isVisible: ({ parent, items }) => { if (isLocationTrashActive(router, 'files-trash-overview')) { // trash overview has its own "no selection" panel return false } if (isLocationSpacesActive(router, 'files-spaces-projects')) { // project spaces overview has its own "no selection" panel return false } if (items?.length > 0) { return false } // empty selection in a project space root shows a "details" panel for the space itself return !isProjectSpaceResource(parent) } } }, { id: 'com.github.owncloud.web.files.sidebar-panel.trash-no-selection', type: 'sidebarPanel', scopes: ['resource'], panel: { name: 'no-selection', icon: 'questionnaire-line', title: () => $gettext('Details'), component: TrashNoSelection, isRoot: () => true, isVisible: () => { return isLocationTrashActive(router, 'files-trash-overview') } } }, { id: 'com.github.owncloud.web.files.sidebar-panel.details-single-selection', type: 'sidebarPanel', scopes: ['resource'], panel: { name: 'details', icon: 'questionnaire-line', title: () => $gettext('Details'), component: FileDetails, componentAttrs: ({ items }) => ({ previewEnabled: unref(isFilesAppActive), tagsEnabled: !isPersonalSpaceRoot(items[0]) && !isLocationTrashActive(router, 'files-trash-generic'), versionsEnabled: !isLocationTrashActive(router, 'files-trash-generic') }), isRoot: () => true, isVisible: ({ items }) => { if (items?.length !== 1) { return false } // project spaces have their own "details" panel return !isProjectSpaceResource(items[0]) } } }, { id: 'com.github.owncloud.web.files.sidebar-panel.details-multi-selection', type: 'sidebarPanel', scopes: ['resource'], panel: { name: 'details-multiple', icon: 'questionnaire-line', title: () => $gettext('Details'), component: FileDetailsMultiple, componentAttrs: () => ({ get showSpaceCount() { return ( !isLocationSpacesActive(router, 'files-spaces-generic') && !isLocationSharesActive(router, 'files-shares-with-me') && !isLocationTrashActive(router, 'files-trash-generic') ) } }), isRoot: () => true, isVisible: ({ items }) => { if (isLocationSpacesActive(router, 'files-spaces-projects')) { // project spaces overview has its own "no selection" panel return false } return items?.length > 1 } } }, { id: 'com.github.owncloud.web.files.sidebar-panel.actions', type: 'sidebarPanel', scopes: ['resource'], panel: { name: 'actions', icon: 'slideshow-3', title: () => $gettext('Actions'), component: FileActions, isRoot: () => false, isVisible: ({ items }) => { if (items?.length !== 1) { return false } if (isPersonalSpaceRoot(items[0])) { // actions panel is not available on the personal space root for now ;-) return false } // project spaces have their own "actions" panel return !isProjectSpaceResource(items[0]) } } }, { id: 'com.github.owncloud.web.files.sidebar-panel.sharing', type: 'sidebarPanel', scopes: ['resource'], panel: { name: 'sharing', icon: 'user-add', iconFillType: 'line', title: () => $gettext('Shares'), component: SharesPanel, componentAttrs: () => ({ showSpaceMembers: false, get showLinks() { return capabilityStore.sharingPublicEnabled } }), isVisible: ({ items, root }) => { if (items?.length !== 1) { return false } if (isProjectSpaceResource(items[0])) { // project space roots have their own "sharing" panel (= space members) return false } if (isPersonalSpaceRoot(items[0])) { // sharing panel is not available on the personal space root return false } if (isShareResource(items[0])) { return false } if (isShareSpaceResource(root)) { return false } if ( isLocationTrashActive(router, 'files-trash-generic') || isLocationPublicActive(router, 'files-public-link') ) { return false } return capabilityStore.sharingApiEnabled } } }, { id: 'com.github.owncloud.web.files.sidebar-panel.versions', type: 'sidebarPanel', scopes: ['resource'], panel: { name: 'versions', icon: 'git-branch', title: () => $gettext('Versions'), component: FileVersions, componentAttrs: () => ({ isReadOnly: !unref(isFilesAppActive) }), isVisible: ({ items }) => { if (items?.length !== 1) { return false } if (isProjectSpaceResource(items[0])) { // project space roots don't support versions return false } if ( isLocationTrashActive(router, 'files-trash-generic') || isLocationPublicActive(router, 'files-public-link') ) { return false } return items[0].type !== 'folder' } } }, { id: 'com.github.owncloud.web.files.sidebar-panel.projects.no-selection', type: 'sidebarPanel', scopes: ['resource'], panel: { name: 'no-selection', icon: 'questionnaire-line', title: () => $gettext('Details'), component: SpaceNoSelection, isRoot: () => true, isVisible: ({ items }) => { if (!isLocationSpacesActive(router, 'files-spaces-projects')) { // only for project spaces overview return false } return items?.length === 0 } } }, { id: 'com.github.owncloud.web.files.sidebar-panel.projects.details-single-selection', type: 'sidebarPanel', scopes: ['resource'], panel: { name: 'details-space', icon: 'questionnaire-line', title: () => $gettext('Details'), component: SpaceDetails, isRoot: () => true, isVisible: ({ items }) => { return items?.length === 1 && isProjectSpaceResource(items[0]) } } }, { id: 'com.github.owncloud.web.files.sidebar-panel.projects.details-multi-selection', type: 'sidebarPanel', scopes: ['resource'], panel: { name: 'details-space-multiple', icon: 'questionnaire-line', title: () => $gettext('Details'), component: SpaceDetailsMultiple, componentAttrs: ({ items }) => ({ selectedSpaces: items }), isRoot: () => true, isVisible: ({ items }) => { return items?.length > 1 && isLocationSpacesActive(router, 'files-spaces-projects') } } }, { id: 'com.github.owncloud.web.files.sidebar-panel.projects.actions', type: 'sidebarPanel', scopes: ['resource'], panel: { name: 'space-actions', icon: 'slideshow-3', title: () => $gettext('Actions'), component: SpaceActions, isVisible: ({ items }) => { if (items?.length !== 1) { return false } if (!isProjectSpaceResource(items[0])) { return false } if ( !isLocationSpacesActive(router, 'files-spaces-projects') && !isLocationSpacesActive(router, 'files-spaces-generic') ) { return false } return [...items[0].spaceRoles.manager, ...items[0].spaceRoles.editor].some( (role) => role.id === userStore.user.id ) } } }, { id: 'com.github.owncloud.web.files.sidebar-panel.projects.sharing', type: 'sidebarPanel', scopes: ['resource'], panel: { name: 'space-share', icon: 'group', title: () => $gettext('Members'), component: SharesPanel, componentAttrs: () => ({ showSpaceMembers: true, get showLinks() { return capabilityStore.sharingPublicEnabled } }), isVisible: ({ items }) => { return items?.length === 1 && isProjectSpaceResource(items[0]) } } } ] satisfies SidebarPanelExtension<SpaceResource, Resource, Resource>[] ) }
owncloud/web/packages/web-app-files/src/composables/extensions/useFileSideBars.ts/0
{ "file_path": "owncloud/web/packages/web-app-files/src/composables/extensions/useFileSideBars.ts", "repo_id": "owncloud", "token_count": 6181 }
808
export const accentuateItem = (id: string, clearTimeout = 3500): void => { const item = document.querySelectorAll(`[data-item-id='${id}']`)[0] if (!item) { return } item.classList.add('oc-table-accentuated') setTimeout(() => { item.classList.remove('oc-table-accentuated') }, clearTimeout) }
owncloud/web/packages/web-app-files/src/helpers/ui/filesList.ts/0
{ "file_path": "owncloud/web/packages/web-app-files/src/helpers/ui/filesList.ts", "repo_id": "owncloud", "token_count": 116 }
809
import { FolderLoader, FolderLoaderTask, TaskContext } from '../folder' import { Router } from 'vue-router' import { useTask } from 'vue-concurrency' import { DavProperties } from '@ownclouders/web-client/src/webdav/constants' import { isLocationTrashActive } from '@ownclouders/web-pkg' import { SpaceResource } from '@ownclouders/web-client/src/helpers' export class FolderLoaderTrashbin implements FolderLoader { public isEnabled(): boolean { return true } public isActive(router: Router): boolean { return isLocationTrashActive(router, 'files-trash-generic') } public getTask(context: TaskContext): FolderLoaderTask { const { resourcesStore, clientService: { webdav } } = context return useTask(function* (signal1, signal2, space: SpaceResource) { resourcesStore.clearResourceList() resourcesStore.setAncestorMetaData({}) const { resource, children } = yield webdav.listFiles( space, {}, { depth: 1, davProperties: DavProperties.Trashbin, isTrash: true } ) resourcesStore.initResourceList({ currentFolder: resource, resources: children }) }) } }
owncloud/web/packages/web-app-files/src/services/folder/loaderTrashbin.ts/0
{ "file_path": "owncloud/web/packages/web-app-files/src/services/folder/loaderTrashbin.ts", "repo_id": "owncloud", "token_count": 398 }
810
import { useResourcesViewDefaults } from 'web-app-files/src/composables' import { readonly, ref } from 'vue' import { mock, mockDeep } from 'vitest-mock-extended' import { Task } from 'vue-concurrency' import { SpaceResource } from '@ownclouders/web-client/src/helpers' export const useResourcesViewDefaultsMock = ( options: Partial<ReturnType<typeof useResourcesViewDefaults>> = {} ): ReturnType<typeof useResourcesViewDefaults> => { return { fileListHeaderY: ref(0), refreshFileListHeaderPosition: vi.fn(), loadResourcesTask: mockDeep<Task<any, any>>({ isRunning: false }), areResourcesLoading: ref(false), storeItems: ref([]), sortFields: ref([]), paginatedResources: ref([]), paginationPages: readonly(ref(0)), paginationPage: readonly(ref(0)), handleSort: vi.fn(), sortBy: readonly(ref('name')), sortDir: undefined, selectedResources: ref([]), selectedResourcesIds: ref([]), selectedResourceSpace: ref(mock<SpaceResource>()), isResourceInSelection: vi.fn(() => false), isSideBarOpen: ref(false), sideBarActivePanel: ref(''), scrollToResource: vi.fn(), scrollToResourceFromRoute: vi.fn(), viewMode: ref('resource-table'), viewSize: ref(1), ...options } }
owncloud/web/packages/web-app-files/tests/mocks/useResourcesViewDefaultsMock.ts/0
{ "file_path": "owncloud/web/packages/web-app-files/tests/mocks/useResourcesViewDefaultsMock.ts", "repo_id": "owncloud", "token_count": 462 }
811
import { defaultComponentMocks, defaultPlugins, mount, RouteLocation } from 'web-test-helpers' import ResourceDetails from '../../../../src/components/FilesList/ResourceDetails.vue' import { mock } from 'vitest-mock-extended' import { useFileActions } from '@ownclouders/web-pkg' import { Resource, SpaceResource } from '@ownclouders/web-client' import { useRouteQuery } from '@ownclouders/web-pkg' import { ref } from 'vue' vi.mock('@ownclouders/web-pkg', async (importOriginal) => ({ ...(await importOriginal<any>()), getIndicators: vi.fn(() => []), useRouteQuery: vi.fn(), useFileActions: vi.fn() })) describe('ResourceDetails component', () => { vi.mocked(useFileActions).mockImplementation(() => mock<ReturnType<typeof useFileActions>>({ getDefaultEditorAction: () => ({ handler: vi.fn() }) as any }) ) it('renders resource details correctly', () => { const { wrapper } = getWrapper(true) expect(wrapper.html()).toMatchSnapshot() }) describe('open with default actions', () => { it("doesn't open default action if query param 'openWithDefaultApp' isn't set true", () => { const { wrapper } = getWrapper() expect(wrapper.vm.defaultEditorAction.handler).not.toHaveBeenCalled() }) it("opens default action if query param 'openWithDefaultApp' is set true", () => { vi.mocked(useRouteQuery).mockImplementationOnce(() => ref('true')) const { wrapper } = getWrapper() expect(wrapper.vm.defaultEditorAction.handler).toHaveBeenCalled() }) }) function getWrapper(isFolder = false) { const mocks = { ...defaultComponentMocks({ currentRoute: mock<RouteLocation>({ name: 'files-public-link', query: { openWithDefaultAppQuery: 'true' } }) }) } mocks.$clientService.webdav.listFileVersions.mockResolvedValue([]) const file = { id: '0', name: 'image.jpg', path: '/', size: 24064, mdate: 'Wed, 21 Oct 2015 07:28:00 GMT', mimeType: 'image/jpg', isFolder, owner: { id: '1', displayName: 'admin' } } as Resource const space = mock<SpaceResource>() return { mocks, wrapper: mount(ResourceDetails, { props: { space, singleResource: file }, global: { mocks, plugins: [...defaultPlugins()], provide: { ...mocks, space, resource: file } } }) } } })
owncloud/web/packages/web-app-files/tests/unit/components/FilesList/ResourceDetails.spec.ts/0
{ "file_path": "owncloud/web/packages/web-app-files/tests/unit/components/FilesList/ResourceDetails.spec.ts", "repo_id": "owncloud", "token_count": 1035 }
812
import FileLinks from 'web-app-files/src/components/SideBar/Shares/FileLinks.vue' import { defaultPlugins, shallowMount, defaultComponentMocks } from 'web-test-helpers' import { mock, mockDeep } from 'vitest-mock-extended' import { Resource } from '@ownclouders/web-client' import { LinkShare, ShareTypes } from '@ownclouders/web-client/src/helpers/share' import { AbilityRule } from '@ownclouders/web-client/src/helpers/resource/types' import { CapabilityStore, FileAction, useCanShare, useFileActionsCreateLink } from '@ownclouders/web-pkg' import { computed } from 'vue' import DetailsAndEdit from '../../../../../src/components/SideBar/Shares/Links/DetailsAndEdit.vue' import { SharingLinkType } from '@ownclouders/web-client/src/generated' const defaultLinksList = [ { id: '1', indirect: false, shareType: ShareTypes.link.value, displayName: 'public link 1', webUrl: ' some-link-1' }, { id: '2', indirect: true, shareType: ShareTypes.link.value, displayName: 'public link 2', webUrl: ' some-link-2' } ] as LinkShare[] const selectors = { linkAddButton: '#files-file-link-add', noSharePermissions: '[data-testid="files-links-no-share-permissions-message"]', linkNoResults: '#oc-file-links-no-results', indirectToggle: '.indirect-link-list-toggle' } const linkListItemNameAndCopy = 'name-and-copy-stub' const linkListItemDetailsAndEdit = 'details-and-edit-stub' vi.mock('@ownclouders/web-pkg', async (importOriginal) => ({ ...(await importOriginal<any>()), useFileActionsCreateLink: vi.fn(), useCanShare: vi.fn() })) describe('FileLinks', () => { describe('links', () => { describe('when links list is not empty', () => { it('should render a list of direct and indirect links', () => { const { wrapper } = getWrapper() const linkListItems = wrapper.findAllComponents<any>(linkListItemNameAndCopy) const linkListItemsDetails = wrapper.findAll(linkListItemDetailsAndEdit) expect(linkListItems.length).toBe(2) expect(linkListItemsDetails.length).toBe(2) expect(linkListItems.at(0).props('linkShare')).toMatchObject(defaultLinksList[0]) expect(linkListItems.at(1).props('linkShare')).toMatchObject(defaultLinksList[1]) }) it('should not show the "no results" message', () => { const { wrapper } = getWrapper() expect(wrapper.find(selectors.linkNoResults).exists()).toBeFalsy() }) describe('collapsing', () => { const link = mock<LinkShare>({ indirect: false, isQuickLink: false }) it('shows all links if showAllOnLoad config is set', () => { const links = [link, link, link, link] const { wrapper } = getWrapper({ links, showAllOnLoad: true }) expect(wrapper.findAll(linkListItemNameAndCopy).length).toBe(links.length) }) it('shows only 3 links if showAllOnLoad config is not set', () => { const links = [link, link, link, link] const { wrapper } = getWrapper({ links, showAllOnLoad: false }) expect(wrapper.findAll(linkListItemNameAndCopy).length).toBe(3) }) it('button toggles to show all links', async () => { const links = [link, link, link, link] const { wrapper } = getWrapper({ links, showAllOnLoad: false }) await wrapper.find(selectors.indirectToggle).trigger('click') expect(wrapper.findAll(linkListItemNameAndCopy).length).toBe(links.length) }) }) }) it('should not render link list if no links are provided', () => { const { wrapper } = getWrapper({ links: [] }) expect(wrapper.find('oc-list-stub').exists()).toBeFalsy() }) }) describe('when canCreateLinks is set to true', () => { it('should show a button to add a link', () => { const { wrapper } = getWrapper() expect(wrapper.find(selectors.linkAddButton).exists()).toBeTruthy() }) describe('when the add-new-link button is clicked', () => { it('should call createLink', async () => { const { wrapper, mocks } = getWrapper({ abilities: [] }) await wrapper.find(selectors.linkAddButton).trigger('click') expect(mocks.createLinkMock).toHaveBeenCalledTimes(1) }) }) }) describe('when canCreateLinks is set to false', () => { it('should show the "no share permissions" message', () => { const { wrapper } = getWrapper({ canShare: false }) expect(wrapper.find(selectors.noSharePermissions).exists()).toBeTruthy() }) }) describe('user does not have the permission to create public links', () => { const resource = mockDeep<Resource>({ path: '/lorem.txt', type: 'file', isFolder: false, isReceivedShare: vi.fn(), canShare: () => true }) it('existing viewer link is not modifiable', () => { const viewerLink = defaultLinksList[0] viewerLink.type = SharingLinkType.View const { wrapper } = getWrapper({ resource, abilities: [], links: [viewerLink] }) const detailsAndEdit = wrapper.findComponent<typeof DetailsAndEdit>( linkListItemDetailsAndEdit ) const isModifiable = detailsAndEdit.props('isModifiable') expect(isModifiable).toBeFalsy() }) it('existing internal link is modifiable', () => { const internalLink = defaultLinksList[0] internalLink.type = SharingLinkType.Internal const { wrapper } = getWrapper({ resource, abilities: [], links: [internalLink] }) const detailsAndEdit = wrapper.findComponent<typeof DetailsAndEdit>( linkListItemDetailsAndEdit ) const isModifiable = detailsAndEdit.props('isModifiable') expect(isModifiable).toBeTruthy() }) }) }) function getWrapper({ resource = mockDeep<Resource>({ isFolder: false, canShare: () => true }), links = defaultLinksList, abilities = [{ action: 'create-all', subject: 'PublicLink' }], canShare = true, showAllOnLoad = true }: { resource?: Resource links?: typeof defaultLinksList abilities?: AbilityRule[] defaultLinkPermissions?: number canShare?: boolean showAllOnLoad?: boolean } = {}) { const createLinkMock = vi.fn() vi.mocked(useCanShare).mockReturnValue({ canShare: () => canShare }) vi.mocked(useFileActionsCreateLink).mockReturnValue({ actions: computed(() => [mock<FileAction>({ name: 'create-links', handler: createLinkMock })]) }) const mocks = defaultComponentMocks() const capabilities = { files_sharing: { public: { expire_date: {}, alias: true, password: { enforced_for: { read_only: false, upload_only: false, read_write: false } } } } } satisfies Partial<CapabilityStore['capabilities']> return { mocks: { ...mocks, createLinkMock }, wrapper: shallowMount(FileLinks, { global: { plugins: [ ...defaultPlugins({ abilities, piniaOptions: { capabilityState: { capabilities }, configState: { options: { sidebar: { shares: { showAllOnLoad } } } }, sharesState: { linkShares: links } } }) ], renderStubDefaultSlot: true, stubs: { OcButton: false }, mocks, provide: { resource } } }) } }
owncloud/web/packages/web-app-files/tests/unit/components/SideBar/Shares/FileLinks.spec.ts/0
{ "file_path": "owncloud/web/packages/web-app-files/tests/unit/components/SideBar/Shares/FileLinks.spec.ts", "repo_id": "owncloud", "token_count": 2780 }
813
import { textUtils } from '../../../src/helpers/textUtils' describe('textUtils', () => { // textUtils compares two strings to provide a natural sort describe('naturalSortCompare', () => { it('sorts a list naturally', () => { const actual = ['Brian Murphy', 'Alice Hansen', 'grp1', 'grp11'] actual.sort(textUtils.naturalSortCompare) expect(actual.join(',')).toBe('Alice Hansen,Brian Murphy,grp1,grp11') }) /** * variations * [ { firstString: 'b', secondString: 'a' }, { firstString: 'bb', secondString: 'ba' }, { firstString: '1', secondString: '0' } ] */ it.todo('should return negative integer if "b" comes before "a"') /** * variations * [ { firstString: 'a', secondString: 'b' }, { firstString: 'aa', secondString: 'ab' }, { firstString: '0', secondString: '1' } ] */ it.todo('should return positive integer if "a" comes before "b"') /** * variations * [ { firstString: '0', secondString: '0' }, { firstString: 'a', secondString: 'a' }, { firstString: 'aa', secondString: 'aa' }, { firstString: 'ab', secondString: 'ab' } ] */ it.todo('should return 0 if the provided strings are identical') }) })
owncloud/web/packages/web-app-files/tests/unit/helpers/textUtils.spec.ts/0
{ "file_path": "owncloud/web/packages/web-app-files/tests/unit/helpers/textUtils.spec.ts", "repo_id": "owncloud", "token_count": 543 }
814
import TrashOverview from '../../../../src/views/trash/Overview.vue' import { defaultComponentMocks, defaultPlugins, defaultStubs, mount, RouteLocation } from 'web-test-helpers' import { mock } from 'vitest-mock-extended' import { nextTick } from 'vue' import { SpaceResource } from '@ownclouders/web-client' const spaceMocks = [ { id: '1', name: 'admin', disabled: false, driveType: 'personal', getDriveAliasAndItem: () => '1', isOwner: () => true }, { id: '2', name: 'Project space 1', disabled: false, driveType: 'project', getDriveAliasAndItem: () => '2', isOwner: () => false }, { id: '3', name: 'Project space 2', disabled: false, driveType: 'project', getDriveAliasAndItem: () => '3', isOwner: () => false } ] as unknown as SpaceResource[] describe('TrashOverview', () => { it('should render no content message if no spaces exist', async () => { const { wrapper } = getWrapper({ spaces: [] }) await wrapper.vm.loadResourcesTask.last expect(wrapper.find('no-content-message-stub').exists()).toBeTruthy() }) it('should navigate to single space trash if only one space exists', () => { const { mocks } = getWrapper({ spaces: [spaceMocks[0]] }) expect(mocks.$router.push).toHaveBeenCalledWith({ name: 'files-trash-generic', params: { driveAliasAndItem: spaceMocks[0].getDriveAliasAndItem(undefined) }, query: {} }) }) describe('view states', () => { it('shows the loading spinner during loading', () => { const { wrapper } = getWrapper() expect(wrapper.find('oc-spinner-stub').exists()).toBeTruthy() }) it('should render spaces list', async () => { const { wrapper } = getWrapper() await wrapper.vm.loadResourcesTask.last expect(wrapper.html()).toMatchSnapshot() }) }) describe('sorting', () => { it('sorts by property name', async () => { const { wrapper } = getWrapper() await wrapper.vm.loadResourcesTask.last let sortedSpaces = [] wrapper.vm.sortBy = 'name' await nextTick() sortedSpaces = wrapper.findComponent<any>({ name: 'oc-table' }).props().data expect(sortedSpaces.map((s) => s.id)).toEqual([ spaceMocks[0].id, spaceMocks[1].id, spaceMocks[2].id ]) wrapper.vm.sortDir = 'desc' await nextTick() sortedSpaces = wrapper.findComponent<any>({ name: 'oc-table' }).props().data expect(sortedSpaces.map((s) => s.id)).toEqual([ spaceMocks[0].id, spaceMocks[2].id, spaceMocks[1].id ]) }) it('should set the sort parameters accordingly when calling "handleSort"', () => { const { wrapper } = getWrapper({ spaces: [spaceMocks[0]] }) const sortBy = 'members' const sortDir = 'desc' wrapper.vm.handleSort({ sortBy, sortDir }) expect(wrapper.vm.sortBy).toEqual(sortBy) expect(wrapper.vm.sortDir).toEqual(sortDir) }) }) describe('filtering', () => { it('shows only filtered spaces if filter applied', async () => { const { wrapper } = getWrapper() wrapper.vm.filterTerm = 'admin' await nextTick() expect(wrapper.vm.displaySpaces.length).toEqual(1) expect(wrapper.vm.displaySpaces[0].id).toEqual(spaceMocks[0].id) }) }) }) function getWrapper({ spaces = spaceMocks }: { spaces?: SpaceResource[] } = {}) { const mocks = { ...defaultComponentMocks({ currentRoute: mock<RouteLocation>({ name: 'trash-overview' }) }) } return { mocks, wrapper: mount(TrashOverview, { global: { stubs: { ...defaultStubs, NoContentMessage: true }, mocks, provide: mocks, plugins: [...defaultPlugins({ piniaOptions: { spacesState: { spaces } } })] } }) } }
owncloud/web/packages/web-app-files/tests/unit/views/trash/Overview.spec.ts/0
{ "file_path": "owncloud/web/packages/web-app-files/tests/unit/views/trash/Overview.spec.ts", "repo_id": "owncloud", "token_count": 1530 }
815
<template> <div class="sciencemesh-app"> <div> <div class="oc-flex oc-flex-between"> <div class="oc-flex oc-flex-middle oc-px-m oc-py-s"> <oc-icon name="contacts-book" /> <h2 class="oc-px-s" v-text="$gettext('Federated connections')" /> <oc-contextual-helper class="oc-pl-xs" v-bind="helperContent" /> </div> <div id="shares-links" class="oc-flex oc-flex-middle oc-mr-m"> <label class="oc-mr-s" v-text="$gettext('Federated shares:')" /> <oc-button :aria-current="$gettext('Federated shares with me')" appearance="raw" class="oc-p-s oc-mr-s" @click="toSharedWithMe" > <oc-icon name="share-forward" /> <span v-text="$gettext('with me')" /> </oc-button> <oc-button :aria-current="$gettext('Federated shares with me')" appearance="raw" class="oc-p-s" @click="toSharedWithOthers" > <oc-icon name="reply" /> <span v-text="$gettext('with others')" /> </oc-button> </div> </div> <app-loading-spinner v-if="loading" /> <template v-else> <no-content-message v-if="!connections?.length" id="accepted-invitations-empty" class="files-empty" icon="contacts-book" > <template #message> <span v-text="$gettext('You have no sharing connections')" /> </template> </no-content-message> <oc-table v-else :fields="fields" :data="connections" :highlighted="highlightedConnections"> <template #actions="{ item }"> <oc-button appearance="raw" class="oc-p-s action-menu-item" @click="deleteConnection(item)" > <oc-icon name="delete-bin-5" fill-type="line" size="medium" /> <span v-text="$gettext('Delete')" /></oc-button ></template> </oc-table> </template> </div> </div> </template> <script lang="ts"> import { computed, defineComponent, PropType } from 'vue' import { NoContentMessage, AppLoadingSpinner, useRouter, useClientService, FederatedConnection } from '@ownclouders/web-pkg' import { useGettext } from 'vue3-gettext' import { ShareTypes } from '@ownclouders/web-client/src/helpers' import { buildConnection } from '../functions' export default defineComponent({ components: { NoContentMessage, AppLoadingSpinner }, props: { /** * Accepted connections */ connections: { type: Array as PropType<FederatedConnection[]>, required: true }, /** * Highlighted connections */ highlightedConnections: { type: Array, required: false, default: () => [] }, /** * Loading */ loading: { type: Boolean, required: false, default: () => true } }, emits: ['update:connections'], setup(props, { emit }) { const router = useRouter() const { $gettext } = useGettext() const clientService = useClientService() const fields = computed(() => { return [ { name: 'display_name', title: $gettext('User'), alignH: 'left' }, { name: 'mail', title: $gettext('Email'), alignH: 'right' }, { name: 'idp', title: $gettext('Institution'), alignH: 'right' }, { name: 'actions', title: $gettext('Actions'), type: 'slot', alignH: 'right', wrap: 'nowrap', width: 'shrink' } ] }) const helperContent = computed(() => { return { text: $gettext( 'Federated conections for mutual sharing. To share, go to "Files" app, select the resource click "Share" in the context menu and select account type "federated".' ) } }) const toSharedWithMe = () => { router.push({ name: 'files-shares-with-me', query: { q_shareType: ShareTypes.remote.key } }) } const toSharedWithOthers = () => { router.push({ name: 'files-shares-with-others', query: { q_shareType: ShareTypes.remote.key } }) } const deleteConnection = async (user) => { try { await clientService.httpAuthenticated.delete('/sciencemesh/delete-accepted-user', null, { params: { user_id: user.user_id, idp: user.idp } }) const updatedConnections = props.connections.filter( ({ id }) => id !== buildConnection(user).id ) emit('update:connections', updatedConnections) } catch (e) { console.error(e) } } return { helperContent, toSharedWithOthers, toSharedWithMe, fields, deleteConnection } } }) </script> <style lang="scss" scoped> #accepted-invitations-empty { height: 10vh; } #shares-links { button:hover { background-color: var(--oc-color-background-hover); border-color: var(--oc-color-background-hover); } @media (max-width: 850px) { visibility: none; } } </style>
owncloud/web/packages/web-app-ocm/src/views/ConnectionsPanel.vue/0
{ "file_path": "owncloud/web/packages/web-app-ocm/src/views/ConnectionsPanel.vue", "repo_id": "owncloud", "token_count": 2496 }
816
export type CachedFile = { id: string name: string url: string ext: string mimeType: string isVideo: boolean isImage: boolean isAudio: boolean }
owncloud/web/packages/web-app-preview/src/helpers/types.ts/0
{ "file_path": "owncloud/web/packages/web-app-preview/src/helpers/types.ts", "repo_id": "owncloud", "token_count": 55 }
817
[main] host = https://www.transifex.com [o:owncloud-org:p:owncloud-web:r:text-editor] file_filter = locale/<lang>/LC_MESSAGES/app.po minimum_perc = 0 source_file = template.pot source_lang = en type = PO
owncloud/web/packages/web-app-text-editor/l10n/.tx/config/0
{ "file_path": "owncloud/web/packages/web-app-text-editor/l10n/.tx/config", "repo_id": "owncloud", "token_count": 85 }
818
export * from './call' export * from './item' export * from './publicLink' export * from './resource' export * from './share' export * from './space' export * from './user'
owncloud/web/packages/web-client/src/helpers/index.ts/0
{ "file_path": "owncloud/web/packages/web-client/src/helpers/index.ts", "repo_id": "owncloud", "token_count": 57 }
819
// These interfaces have empty (unused) __${type}SpaceResource properties which are only // there to make the types differ, in order to make TypeScript type narrowing work correctly // With empty types TypeScript does not accept this code // ``` // if(isPublicSpaceResource(resource)) { console.log(resource.id) } else { console.log(resource.id) } // ``` // because in the else block resource gets the type never. If this is changed in a later TypeScript version // or all types get different members, the underscored props can be removed. import { DriveItem } from '@ownclouders/web-client/src/generated' import { Resource } from '../resource' import { User } from '../../generated' export const SHARE_JAIL_ID = 'a0ca6a90-a365-4782-871e-d44447bbc668' export const OCM_PROVIDER_ID = '89f37a33-858b-45fa-8890-a1f2b27d90e1' export interface SpaceResource extends Resource { disabled?: boolean webDavTrashPath: string root: DriveItem getWebDavUrl({ path }: { path: string }): string getWebDavTrashUrl({ path }: { path: string }): string getDriveAliasAndItem(resource: Resource): string isViewer(user: User): boolean isEditor(user: User): boolean isManager(user: User): boolean isMember(user: User): boolean isOwner(user: User): boolean } export interface PersonalSpaceResource extends SpaceResource { __personalSpaceResource?: any } export const isPersonalSpaceResource = (resource: Resource): resource is PersonalSpaceResource => { return resource?.driveType === 'personal' } export interface ProjectSpaceResource extends SpaceResource { __projectSpaceResource?: any } export const isProjectSpaceResource = (resource: Resource): resource is ProjectSpaceResource => { return resource?.driveType === 'project' } export interface ShareSpaceResource extends SpaceResource { __shareSpaceResource?: any rename(newName: string): void } export const isShareSpaceResource = (resource: Resource): resource is ShareSpaceResource => { return resource?.driveType === 'share' } export interface MountPointSpaceResource extends SpaceResource { __mountPointSpaceResource?: any } export const isMountPointSpaceResource = ( resource: Resource ): resource is MountPointSpaceResource => { return resource?.driveType === 'mountpoint' } export interface PublicSpaceResource extends SpaceResource { publicLinkPassword?: string publicLinkItemType?: string publicLinkPermission?: number publicLinkExpiration?: string publicLinkShareDate?: string publicLinkShareOwner?: string } export const isPublicSpaceResource = (resource: Resource): resource is PublicSpaceResource => { return resource?.driveType === 'public' }
owncloud/web/packages/web-client/src/helpers/space/types.ts/0
{ "file_path": "owncloud/web/packages/web-client/src/helpers/space/types.ts", "repo_id": "owncloud", "token_count": 717 }
820
import { Audio, GeoCoordinates } from '../../generated' export abstract class DavPermission { static readonly Shared: string = 'S' static readonly Shareable: string = 'R' static readonly Mounted: string = 'M' static readonly Deletable: string = 'D' static readonly Renameable: string = 'N' static readonly Moveable: string = 'V' static readonly Updateable: string = 'NV' static readonly FileUpdateable: string = 'W' static readonly FolderCreateable: string = 'CK' static readonly Deny: string = 'Z' } export enum DavMethod { copy = 'COPY', delete = 'DELETE', lock = 'LOCK', mkcol = 'MKCOL', move = 'MOVE', propfind = 'PROPFIND', proppatch = 'PROPPATCH', put = 'PUT', report = 'REPORT', unlock = 'UNLOCK' } type M<V, T> = { value: V type: T } const def = <V, T>(v: V): M<V, T> => ({ value: v, type: null }) const defString = <V>(v: V) => def<V, string>(v) const defNumber = <V>(v: V) => def<V, number>(v) const defStringArray = <V>(v: V) => def<V, string[]>(v) const DavPropertyMapping = { Permissions: defString('permissions' as const), IsFavorite: defNumber('favorite' as const), FileId: defString('fileid' as const), FileParent: defString('file-parent' as const), Name: defString('name' as const), OwnerId: defString('owner-id' as const), OwnerDisplayName: defString('owner-display-name' as const), PrivateLink: defString('privatelink' as const), ContentLength: defNumber('getcontentlength' as const), ContentSize: defNumber('size' as const), LastModifiedDate: defString('getlastmodified' as const), Tags: defString('tags' as const), Audio: { value: 'audio', type: null as Audio }, Location: { value: 'location', type: null as GeoCoordinates }, ETag: defString('getetag' as const), MimeType: defString('getcontenttype' as const), ResourceType: defStringArray('resourcetype' as const), LockDiscovery: defString('lockdiscovery' as const), LockOwnerName: defString('ownername' as const), LockTime: defString('locktime' as const), ActiveLock: { value: 'activelock', type: null as Record<string, unknown> }, DownloadURL: defString('downloadURL' as const), Highlights: defString('highlights' as const), MetaPathForUser: defString('meta-path-for-user' as const), ShareId: defString('shareid' as const), ShareRoot: defString('shareroot' as const), ShareTypes: defStringArray('share-types' as const), SharePermissions: defString('share-permissions' as const), TrashbinOriginalFilename: defString('trashbin-original-filename' as const), TrashbinOriginalLocation: defString('trashbin-original-location' as const), TrashbinDeletedDate: defString('trashbin-delete-datetime' as const), PublicLinkItemType: defString('public-link-item-type' as const), PublicLinkPermission: defString('public-link-permission' as const), PublicLinkExpiration: defString('public-link-expiration' as const), PublicLinkShareDate: defString('public-link-share-datetime' as const), PublicLinkShareOwner: defString('public-link-share-owner' as const) } as const satisfies Record<string, M<unknown, unknown>> type DavPropertyMappingType = typeof DavPropertyMapping export const DavProperty = Object.fromEntries( Object.entries(DavPropertyMapping).map(([key, value]) => [key, value.value]) ) as { [K in keyof DavPropertyMappingType as K]: DavPropertyMappingType[K]['value'] } export type DavFileInfoResponse = { [K in keyof DavPropertyMappingType as DavPropertyMappingType[K]['value']]: DavPropertyMappingType[K]['type'] } export type DavPropertyValue = (typeof DavProperty)[keyof typeof DavProperty] export abstract class DavProperties { static readonly Default: DavPropertyValue[] = [ DavProperty.Permissions, DavProperty.IsFavorite, DavProperty.FileId, DavProperty.FileParent, DavProperty.Name, DavProperty.LockDiscovery, DavProperty.ActiveLock, DavProperty.OwnerId, DavProperty.OwnerDisplayName, DavProperty.ShareId, DavProperty.ShareRoot, DavProperty.ShareTypes, DavProperty.PrivateLink, DavProperty.ContentLength, DavProperty.ContentSize, DavProperty.LastModifiedDate, DavProperty.ETag, DavProperty.MimeType, DavProperty.ResourceType, DavProperty.DownloadURL, DavProperty.Tags, DavProperty.Audio, DavProperty.Location ] static readonly PublicLink: DavPropertyValue[] = DavProperties.Default.concat([ DavProperty.PublicLinkItemType, DavProperty.PublicLinkPermission, DavProperty.PublicLinkExpiration, DavProperty.PublicLinkShareDate, DavProperty.PublicLinkShareOwner ]) static readonly Trashbin: DavPropertyValue[] = [ DavProperty.ContentLength, DavProperty.ResourceType, DavProperty.TrashbinOriginalLocation, DavProperty.TrashbinOriginalFilename, DavProperty.TrashbinDeletedDate, DavProperty.Permissions, DavProperty.FileParent ] // these dav properties are dav standard and don't live in the oc namespace static readonly DavNamespace: DavPropertyValue[] = [ DavProperty.ContentLength, DavProperty.LastModifiedDate, DavProperty.ETag, DavProperty.MimeType, DavProperty.ResourceType, DavProperty.LockDiscovery, DavProperty.ActiveLock ] }
owncloud/web/packages/web-client/src/webdav/constants/dav.ts/0
{ "file_path": "owncloud/web/packages/web-client/src/webdav/constants/dav.ts", "repo_id": "owncloud", "token_count": 1742 }
821
import { urlJoin } from '../utils' import { SpaceResource } from '../helpers' import { GetFileInfoFactory } from './getFileInfo' import { WebDavOptions } from './types' import { DAV, buildAuthHeader } from './client' import { ProgressEventCallback } from 'webdav' import { unref } from 'vue' export const PutFileContentsFactory = ( dav: DAV, getFileInfoFactory: ReturnType<typeof GetFileInfoFactory>, { accessToken }: WebDavOptions ) => { return { async putFileContents( space: SpaceResource, { path, content = '', previousEntityTag = '', headers = {}, overwrite, onUploadProgress = null }: { path?: string content?: string | ArrayBuffer previousEntityTag?: string headers?: Record<string, string> overwrite?: boolean onUploadProgress?: ProgressEventCallback } ) { await dav.put(urlJoin(space.webDavPath, path), content, { previousEntityTag, overwrite, onUploadProgress, headers: { ...headers, ...buildAuthHeader(unref(accessToken), space) } }) return getFileInfoFactory.getFileInfo(space, { path }) } } }
owncloud/web/packages/web-client/src/webdav/putFileContents.ts/0
{ "file_path": "owncloud/web/packages/web-client/src/webdav/putFileContents.ts", "repo_id": "owncloud", "token_count": 497 }
822
<template> <div class="oc-text-center oc-flex oc-flex-center oc-flex-middle oc-height-1-1"> <oc-icon size="xxlarge" name="error-warning" fill-type="line" /> <p v-if="message" class="oc-text-xlarge">{{ message }}</p> </div> </template> <script lang="ts"> import { defineComponent } from 'vue' export default defineComponent({ name: 'ErrorScreen', props: { /** * Error message passed from external app */ message: { default: '', type: String, required: false } } }) </script>
owncloud/web/packages/web-pkg/src/components/AppTemplates/PartialViews/ErrorScreen.vue/0
{ "file_path": "owncloud/web/packages/web-pkg/src/components/AppTemplates/PartialViews/ErrorScreen.vue", "repo_id": "owncloud", "token_count": 213 }
823
<template> <div class="oc-resource oc-text-overflow"> <resource-link v-if="isIconDisplayed" :resource="resource" :is-resource-clickable="isResourceClickable" :folder-link="folderLink" class="oc-resource-link" @click="emitClick" > <oc-img v-if="hasThumbnail" :key="thumbnail" v-oc-tooltip="tooltipLabelIcon" :src="thumbnail" class="oc-resource-thumbnail" width="40" height="40" :aria-label="tooltipLabelIcon" /> <resource-icon v-else v-oc-tooltip="tooltipLabelIcon" :aria-label="tooltipLabelIcon" :resource="resource" /> </resource-link> <div class="oc-resource-details oc-text-overflow" :class="{ 'oc-pl-s': isIconDisplayed }"> <resource-link v-slot="{ opensInNewWindowDescriptionId }" :resource="resource" :is-resource-clickable="isResourceClickable" :folder-link="folderLink" class="oc-text-overflow" @click="emitClick" > <span v-if="opensInNewWindowDescriptionId" :id="opensInNewWindowDescriptionId" class="oc-invisible-sr" v-text="$gettext('Opens in a new window')" /> <resource-name :key="resource.name" :name="resource.name" :path-prefix="pathPrefix" :extension="resource.extension" :type="resource.type" :full-path="resource.path" :is-path-displayed="isPathDisplayed" :is-extension-displayed="isExtensionDisplayed" /> </resource-link> <div class="oc-resource-indicators"> <component :is="parentFolderComponentType" v-if="isPathDisplayed" v-oc-tooltip="parentFolderNameTooltip" :to="parentFolderLink" :style="parentFolderStyle" class="parent-folder oc-text-truncate" > <oc-icon v-bind="parentFolderLinkIconAttrs" /> <span class="text oc-text-truncate" v-text="parentFolderName" /> </component> </div> </div> </div> </template> <script lang="ts"> import { defineComponent, PropType } from 'vue' import { Resource } from '@ownclouders/web-client/src' import ResourceIcon from './ResourceIcon.vue' import ResourceLink from './ResourceLink.vue' import ResourceName from './ResourceName.vue' /** * Displays a resource together with the resource type icon or thumbnail */ export default defineComponent({ name: 'ResourceListItem', components: { ResourceIcon, ResourceLink, ResourceName }, props: { /** * The resource to be displayed */ resource: { type: Object as PropType<Resource>, required: true }, /** * The prefix that will be shown in the path */ pathPrefix: { type: String, required: false, default: '' }, /** * The resource folder link */ folderLink: { type: Object, required: false, default: null }, /** * Asserts whether the resource path should be displayed */ isPathDisplayed: { type: Boolean, required: false, default: false }, /** * The resource parent folder name to be displayed */ parentFolderName: { type: String, required: false, default: '' }, /** * The resource parent folder link path */ parentFolderLink: { type: Object, required: false, default: null }, /** * The resource parent folder link path icon additional attributes */ parentFolderLinkIconAdditionalAttributes: { type: Object, required: false, default: () => ({}) }, /** * Asserts whether the resource extension should be displayed */ isExtensionDisplayed: { type: Boolean, required: false, default: true }, /** * Asserts whether the resource thumbnail should be displayed */ isThumbnailDisplayed: { type: Boolean, required: false, default: true }, /** * Asserts whether the resource thumbnail should be displayed */ isIconDisplayed: { type: Boolean, required: false, default: true }, /** * Asserts whether clicking on the resource name triggers any action */ isResourceClickable: { type: Boolean, required: false, default: true } }, emits: ['click'], computed: { parentFolderNameTooltip() { return this.parentFolderName }, parentFolderComponentType() { return this.parentFolderLink !== null ? 'router-link' : 'span' }, parentFolderStyle() { const hasLinkTarget = this.parentFolderLink !== null return { cursor: hasLinkTarget ? 'pointer' : 'default' } }, parentFolderLinkIconAttrs() { return { 'fill-type': 'line', name: 'folder-2', size: 'small', ...this.parentFolderLinkIconAdditionalAttributes } }, hasThumbnail() { return ( this.isThumbnailDisplayed && Object.prototype.hasOwnProperty.call(this.resource, 'thumbnail') ) }, thumbnail() { return this.resource.thumbnail }, tooltipLabelIcon() { if (this.resource.locked) { return this.$gettext('This item is locked') } return null } }, methods: { emitClick() { /** * Triggered when the resource is a file and the name is clicked */ this.$emit('click') } } }) </script> <style lang="scss"> .oc-resource { align-items: center; display: inline-flex; justify-content: flex-start; overflow: visible !important; &-link { position: relative; } &-thumbnail { border-radius: 2px; object-fit: cover; height: $oc-size-icon-default * 1.5; max-height: $oc-size-icon-default * 1.5; width: $oc-size-icon-default * 1.5; max-width: $oc-size-icon-default * 1.5; } &-details { display: block; a { text-decoration: none; } a:hover, a:focus { outline-offset: 0; } } &-indicators { display: flex; a { &:hover { background-color: var(--oc-color-input-bg); border-radius: 2px; } .text { &:hover { color: var(--oc-color-text-default); text-decoration: underline; } } } .parent-folder { display: flex; align-items: center; padding: 0 2px 0 2px; margin: 0 8px 0 -2px; .oc-icon { padding-right: 3px; } .text { font-size: 0.8125rem; color: var(--oc-color-text-muted); } } } } </style>
owncloud/web/packages/web-pkg/src/components/FilesList/ResourceListItem.vue/0
{ "file_path": "owncloud/web/packages/web-pkg/src/components/FilesList/ResourceListItem.vue", "repo_id": "owncloud", "token_count": 2994 }
824
<template> <p class="oc-mt-rm" v-text=" $gettext( 'Moving files from one space to another is not possible. Do you want to copy instead?' ) " /> <p class="oc-mb-rm" v-text="$gettext('Note: Links and shares of the original file are not copied.')" /> </template> <script lang="ts"> import { defineComponent } from 'vue' export default defineComponent({ name: 'SpaceMoveInfoModal' }) </script>
owncloud/web/packages/web-pkg/src/components/Modals/SpaceMoveInfoModal.vue/0
{ "file_path": "owncloud/web/packages/web-pkg/src/components/Modals/SpaceMoveInfoModal.vue", "repo_id": "owncloud", "token_count": 172 }
825
<template> <div id="oc-spaces-details-multiple-sidebar"> <div class="spaces-preview oc-mb"> <div class="spaces-preview-body"> <oc-icon class="preview-icon" size="xxlarge" variation="passive" name="layout-grid" /> <p class="preview-text" v-text="selectedSpacesString" /> </div> </div> <div> <table class="details-table" :aria-label="detailsTableLabel"> <tr> <th scope="col" class="oc-pr-s oc-font-semibold" v-text="$gettext('Total quota:')" /> <td v-text="totalSelectedSpaceQuotaTotal" /> </tr> <tr> <th scope="col" class="oc-pr-s oc-font-semibold" v-text="$gettext('Remaining quota:')" /> <td v-text="totalSelectedSpaceQuotaRemaining" /> </tr> <tr> <th scope="col" class="oc-pr-s oc-font-semibold" v-text="$gettext('Used quota:')" /> <td v-text="totalSelectedSpaceQuotaUsed" /> </tr> <tr> <th scope="col" class="oc-pr-s oc-font-semibold" v-text="$gettext('Enabled:')" /> <td v-text="totalEnabledSpaces" /> </tr> <tr> <th scope="col" class="oc-pr-s oc-font-semibold" v-text="$gettext('Disabled:')" /> <td v-text="totalDisabledSpaces" /> </tr> </table> </div> </div> </template> <script lang="ts"> import { formatFileSize } from '../../../../helpers' import { computed, defineComponent, PropType } from 'vue' import { SpaceResource } from '@ownclouders/web-client/src' import { useGettext } from 'vue3-gettext' export default defineComponent({ name: 'SpaceDetailsMultiple', props: { selectedSpaces: { type: Array as PropType<Array<SpaceResource>>, required: true } }, setup(props) { const { $gettext, $ngettext, current: currentLanguage } = useGettext() const totalSelectedSpaceQuotaTotal = computed(() => { let total = 0 props.selectedSpaces.forEach((space) => { total += space.spaceQuota.total }) return formatFileSize(total, currentLanguage) }) const totalSelectedSpaceQuotaRemaining = computed(() => { let remaining = 0 props.selectedSpaces.forEach((space) => { if (space.disabled) { return } remaining += space.spaceQuota.remaining }) return formatFileSize(remaining, currentLanguage) }) const totalSelectedSpaceQuotaUsed = computed(() => { let used = 0 props.selectedSpaces.forEach((space) => { if (space.disabled) { return } used += space.spaceQuota.used }) return formatFileSize(used, currentLanguage) }) const totalEnabledSpaces = computed(() => { return props.selectedSpaces.filter((s) => !s.disabled).length }) const totalDisabledSpaces = computed(() => { return props.selectedSpaces.filter((s) => s.disabled).length }) const detailsTableLabel = computed(() => { return $gettext('Overview of the information about the selected spaces') }) const selectedSpacesString = computed(() => { return $ngettext( '%{ itemCount } space selected', '%{ itemCount } spaces selected', props.selectedSpaces.length, { itemCount: props.selectedSpaces.length.toString() } ) }) return { detailsTableLabel, selectedSpacesString, totalSelectedSpaceQuotaTotal, totalSelectedSpaceQuotaRemaining, totalSelectedSpaceQuotaUsed, totalEnabledSpaces, totalDisabledSpaces } } }) </script> <style lang="scss"> .spaces-preview { position: relative; background-color: var(--oc-color-background-muted); border: 10px solid var(--oc-color-background-muted); height: 230px; text-align: center; color: var(--oc-color-swatch-passive-muted); &-body { margin: 0; position: absolute; top: 50%; left: 50%; -ms-transform: translate(-50%, -50%); transform: translate(-50%, -50%); .preview-icon { display: inline-block; } .preview-text { display: block; } } } .details-table { text-align: left; tr { height: 1.5rem; } } </style>
owncloud/web/packages/web-pkg/src/components/SideBar/Spaces/Details/SpaceDetailsMultiple.vue/0
{ "file_path": "owncloud/web/packages/web-pkg/src/components/SideBar/Spaces/Details/SpaceDetailsMultiple.vue", "repo_id": "owncloud", "token_count": 1795 }
826
export * from './useFileActions' export * from './useFileActionsSetReadme' export * from './useFileActionsEnableSync' export * from './useFileActionsToggleHideShare' export * from './useFileActionsCopy' export * from './useFileActionsCopyQuicklink' export * from './useFileActionsDisableSync' export * from './useFileActionsDelete' export * from './useFileActionsDownloadArchive' export * from './useFileActionsDownloadFile' export * from './useFileActionsEmptyTrashBin' export * from './useFileActionsFavorite' export * from './useFileActionsMove' export * from './useFileActionsNavigate' export * from './useFileActionsPaste' export * from './useFileActionsRename' export * from './useFileActionsRestore' export * from './useFileActionsSetImage' export * from './useFileActionsShowActions' export * from './useFileActionsShowDetails' export * from './useFileActionsShowShares' export * from './useFileActionsCreateSpaceFromResource' export * from './useFileActionsCreateNewFolder' export * from './useFileActionsCreateNewFile' export * from './useFileActionsCreateNewShortcut' export * from './useFileActionsOpenShortcut' export * from './useFileActionsCreateLink'
owncloud/web/packages/web-pkg/src/composables/actions/files/index.ts/0
{ "file_path": "owncloud/web/packages/web-pkg/src/composables/actions/files/index.ts", "repo_id": "owncloud", "token_count": 361 }
827
import { canBeMoved } from '../../../helpers/permissions' import { isLocationCommonActive, isLocationPublicActive, isLocationSpacesActive } from '../../../router' import { useGettext } from 'vue3-gettext' import { ActionOptions, FileAction } from '../types' import { computed, unref } from 'vue' import { useRouter } from '../../router' import { useClipboardStore, useResourcesStore } from '../../piniaStores' import { Resource } from '@ownclouders/web-client' import { storeToRefs } from 'pinia' export const useFileActionsMove = () => { const router = useRouter() const { cutResources } = useClipboardStore() const language = useGettext() const { $gettext } = language const resourcesStore = useResourcesStore() const { currentFolder } = storeToRefs(resourcesStore) const isMacOs = computed(() => { return window.navigator.platform.match('Mac') }) const cutShortcutString = computed(() => { if (unref(isMacOs)) { return $gettext('⌘ + X') } return $gettext('Ctrl + X') }) const handler = ({ resources }: ActionOptions) => { cutResources(resources as Resource[]) } const actions = computed((): FileAction[] => [ { name: 'cut', icon: 'scissors', handler, shortcut: unref(cutShortcutString), label: () => $gettext('Cut'), isVisible: ({ resources }) => { if ( !isLocationSpacesActive(router, 'files-spaces-generic') && !isLocationPublicActive(router, 'files-public-link') && !isLocationCommonActive(router, 'files-common-favorites') ) { return false } if (resources.length === 0) { return false } if (!unref(currentFolder)) { return false } if (resources.length === 1 && resources[0].locked) { return false } const moveDisabled = resources.some((resource) => { return canBeMoved(resource, unref(currentFolder).path) === false }) return !moveDisabled }, componentType: 'button', class: 'oc-files-actions-move-trigger' } ]) return { actions } }
owncloud/web/packages/web-pkg/src/composables/actions/files/useFileActionsMove.ts/0
{ "file_path": "owncloud/web/packages/web-pkg/src/composables/actions/files/useFileActionsMove.ts", "repo_id": "owncloud", "token_count": 839 }
828
export * from './helpers' export * from './files' export * from './spaces' export * from './types' export * from './useActionsShowDetails' export * from './useOpenWithDefaultApp' export * from './useWindowOpen'
owncloud/web/packages/web-pkg/src/composables/actions/index.ts/0
{ "file_path": "owncloud/web/packages/web-pkg/src/composables/actions/index.ts", "repo_id": "owncloud", "token_count": 69 }
829
import { useGettext } from 'vue3-gettext' import { useMessages } from '../piniaStores' export const useWindowOpen = () => { const { $gettext } = useGettext() const { showMessage } = useMessages() const openUrl = (url: string, target?: string, shouldFocus?: boolean) => { const win = window.open(url, target) if (!win) { showMessage({ title: $gettext('Pop-up and redirect block detected'), timeout: 20, status: 'warning', desc: $gettext( 'Please turn on pop-ups and redirects in your browser settings to make sure everything works right.' ) }) } else if (shouldFocus) { win.focus() } } return { openUrl } }
owncloud/web/packages/web-pkg/src/composables/actions/useWindowOpen.ts/0
{ "file_path": "owncloud/web/packages/web-pkg/src/composables/actions/useWindowOpen.ts", "repo_id": "owncloud", "token_count": 269 }
830
export * from './useBreadcrumbsFromPath'
owncloud/web/packages/web-pkg/src/composables/breadcrumbs/index.ts/0
{ "file_path": "owncloud/web/packages/web-pkg/src/composables/breadcrumbs/index.ts", "repo_id": "owncloud", "token_count": 14 }
831
import { ref, nextTick, onMounted, Ref } from 'vue' export const useFileListHeaderPosition = (selector = ''): { y: Ref; refresh: () => void } => { const y = ref(0) const refresh = async (): Promise<void> => { await nextTick() const appBar = document.querySelector(selector || '#files-app-bar') const height = appBar ? appBar.getBoundingClientRect().height : 0 if (y.value === height) { return } y.value = height } window.onresize = refresh onMounted(refresh) return { y, refresh } }
owncloud/web/packages/web-pkg/src/composables/fileListHeaderPosition/useFileListHeaderPosition.ts/0
{ "file_path": "owncloud/web/packages/web-pkg/src/composables/fileListHeaderPosition/useFileListHeaderPosition.ts", "repo_id": "owncloud", "token_count": 193 }
832
export * from './usePagination' export * from './constants'
owncloud/web/packages/web-pkg/src/composables/pagination/index.ts/0
{ "file_path": "owncloud/web/packages/web-pkg/src/composables/pagination/index.ts", "repo_id": "owncloud", "token_count": 20 }
833
export * from './shares' export * from './types'
owncloud/web/packages/web-pkg/src/composables/piniaStores/shares/index.ts/0
{ "file_path": "owncloud/web/packages/web-pkg/src/composables/piniaStores/shares/index.ts", "repo_id": "owncloud", "token_count": 17 }
834
import { computed, ComputedRef, unref } from 'vue' import { useRoute } from './useRoute' import { RouteLocationNormalizedLoaded } from 'vue-router' export const activeApp = (route: RouteLocationNormalizedLoaded): string => { return route.path.split('/')[1] } export const useActiveApp = (): ComputedRef<string> => { const route = useRoute() return computed(() => { return activeApp(unref(route)) }) }
owncloud/web/packages/web-pkg/src/composables/router/useActiveApp.ts/0
{ "file_path": "owncloud/web/packages/web-pkg/src/composables/router/useActiveApp.ts", "repo_id": "owncloud", "token_count": 135 }
835
import { computed, unref, WritableComputedRef, Ref } from 'vue' import { Resource } from '@ownclouders/web-client' import { useGetMatchingSpace } from '../spaces' import { SpaceResource } from '@ownclouders/web-client/src/helpers' import { useResourcesStore } from '../piniaStores' export interface SelectedResourcesResult { selectedResources: Ref<Resource[]> selectedResourcesIds: Ref<string[]> isResourceInSelection(resource: Resource): boolean selectedResourceSpace?: Ref<SpaceResource> } export const useSelectedResources = (): SelectedResourcesResult => { const { getMatchingSpace } = useGetMatchingSpace() const resourcesStore = useResourcesStore() const selectedResources: WritableComputedRef<Resource[]> = computed({ get(): Resource[] { return resourcesStore.selectedResources }, set(resources) { resourcesStore.setSelection(resources.map(({ id }) => id)) } }) const selectedResourcesIds: WritableComputedRef<string[]> = computed({ get(): string[] { return resourcesStore.selectedIds }, set(selectedIds) { resourcesStore.setSelection(selectedIds) } }) const isResourceInSelection = (resource: Resource): boolean => { return unref(selectedResourcesIds).includes(resource.id) } const selectedResourceSpace = computed(() => { if (unref(selectedResources).length !== 1) { return null } const resource = unref(selectedResources)[0] return getMatchingSpace(resource) }) return { selectedResources, selectedResourcesIds, isResourceInSelection, selectedResourceSpace } }
owncloud/web/packages/web-pkg/src/composables/selection/useSelectedResources.ts/0
{ "file_path": "owncloud/web/packages/web-pkg/src/composables/selection/useSelectedResources.ts", "repo_id": "owncloud", "token_count": 508 }
836
import { computed, unref, watch } from 'vue' import { UppyService } from '../../services/uppy/uppyService' import { v4 as uuidV4 } from 'uuid' import { useGettext } from 'vue3-gettext' import { useAuthStore, useCapabilityStore, useConfigStore } from '../piniaStores' interface UploadOptions { uppyService: UppyService } export function useUpload(options: UploadOptions) { const configStore = useConfigStore() const capabilityStore = useCapabilityStore() const { current: currentLanguage } = useGettext() const authStore = useAuthStore() const headers = computed((): { [key: string]: string } => { const headers = { 'Accept-Language': currentLanguage } if (authStore.publicLinkContextReady) { const password = authStore.publicLinkPassword if (password) { return { ...headers, Authorization: 'Basic ' + Buffer.from('public:' + password).toString('base64') } } return headers } return { ...headers, Authorization: 'Bearer ' + authStore.accessToken } }) const uppyOptions = computed(() => { const isTusSupported = capabilityStore.tusMaxChunkSize > 0 return { isTusSupported, onBeforeRequest: (req) => { req.setHeader('Authorization', unref(headers).Authorization) req.setHeader('X-Request-ID', uuidV4()) req.setHeader('Accept-Language', unref(headers)['Accept-Language']) }, headers: (file) => !!file.xhrUpload || file?.isRemote ? { 'x-oc-mtime': file?.data?.lastModified / 1000, 'X-Request-ID': uuidV4(), ...unref(headers) } : {}, ...(isTusSupported && { tusMaxChunkSize: capabilityStore.tusMaxChunkSize, tusHttpMethodOverride: capabilityStore.tusHttpMethodOverride, tusExtension: capabilityStore.tusExtension }), ...(!isTusSupported && { xhrTimeout: configStore.options.upload?.xhr?.timeout || 60000 }) } }) watch( uppyOptions, () => { if (unref(uppyOptions).isTusSupported) { options.uppyService.useTus(unref(uppyOptions)) return } options.uppyService.useXhr(unref(uppyOptions)) }, { immediate: true } ) }
owncloud/web/packages/web-pkg/src/composables/upload/useUpload.ts/0
{ "file_path": "owncloud/web/packages/web-pkg/src/composables/upload/useUpload.ts", "repo_id": "owncloud", "token_count": 934 }
837
import { filesize } from 'filesize' import { getLocaleFromLanguage } from './locale' const mb = 1048576 /** * Returns formatted size * * @param {Number|String} size Unformatted size * @param {String} currentLanguage * @returns {String} formatted size */ export const formatFileSize = (size: number | string, currentLanguage: string) => { const parsedSize = typeof size === 'string' ? parseInt(size) : size if (parsedSize < 0) { return '' } if (isNaN(parsedSize)) { return '?' } return filesize(parsedSize, { round: parsedSize < mb ? 0 : 1, locale: getLocaleFromLanguage(currentLanguage) }) }
owncloud/web/packages/web-pkg/src/helpers/filesize.ts/0
{ "file_path": "owncloud/web/packages/web-pkg/src/helpers/filesize.ts", "repo_id": "owncloud", "token_count": 215 }
838
import { Resource } from '@ownclouders/web-client' export const isResourceTxtFileAlmostEmpty = (resource: Resource): boolean => { const mimeType = resource.mimeType || '' return mimeType.startsWith('text/') && (resource.size as number) < 30 }
owncloud/web/packages/web-pkg/src/helpers/resource/isResourceTxtFileAlmostEmpty.ts/0
{ "file_path": "owncloud/web/packages/web-pkg/src/helpers/resource/isResourceTxtFileAlmostEmpty.ts", "repo_id": "owncloud", "token_count": 76 }
839
export * from './apps' export * from './components' export * from './composables' export * from './constants' export * from './errors' export * from './helpers' export * from './http' export * from './observer' export * from './router' export * from './services' export * from './types' export * from './ui' export * from './utils' // FIXME: do we really want this? export * from './cern'
owncloud/web/packages/web-pkg/src/index.ts/0
{ "file_path": "owncloud/web/packages/web-pkg/src/index.ts", "repo_id": "owncloud", "token_count": 131 }
840
export * from './auth' export * from './client'
owncloud/web/packages/web-pkg/src/services/client/index.ts/0
{ "file_path": "owncloud/web/packages/web-pkg/src/services/client/index.ts", "repo_id": "owncloud", "token_count": 16 }
841
// re-export for easier usage in extensions export { dirname } from 'path'
owncloud/web/packages/web-pkg/src/utils/dirname.ts/0
{ "file_path": "owncloud/web/packages/web-pkg/src/utils/dirname.ts", "repo_id": "owncloud", "token_count": 20 }
842
import ContextActionMenu from '../../../../src/components/ContextActions/ContextActionMenu.vue' import { defaultPlugins, shallowMount } from 'web-test-helpers' describe('ContextActionMenu component', () => { it('renders the menu with actions', () => { const menuSections = [{ name: 'action 1' }, { name: 'action 2' }] const { wrapper } = getShallowWrapper(menuSections) expect(wrapper.html()).toMatchSnapshot() expect(wrapper.find('.oc-files-context-actions').exists()).toBeTruthy() expect(wrapper.findAll('.oc-files-context-actions').length).toEqual(menuSections.length) }) }) function getShallowWrapper(menuSections, items = []) { return { wrapper: shallowMount(ContextActionMenu, { props: { menuSections, actionOptions: { resources: items } }, global: { plugins: [...defaultPlugins()] } }) } }
owncloud/web/packages/web-pkg/tests/unit/components/ContextActions/ContextActionMenu.spec.ts/0
{ "file_path": "owncloud/web/packages/web-pkg/tests/unit/components/ContextActions/ContextActionMenu.spec.ts", "repo_id": "owncloud", "token_count": 328 }
843
import QuotaModal from '../../../../src/components/Spaces/QuotaModal.vue' import { defaultComponentMocks, defaultPlugins, defaultStubs, mount, mockAxiosResolve } from 'web-test-helpers' import { useMessages, useSpacesStore } from '../../../../src/composables/piniaStores' import { SpaceResource } from '@ownclouders/web-client' describe('QuotaModal', () => { describe('method "editQuota"', () => { it('should show message on success', async () => { const { wrapper, mocks } = getWrapper() mocks.$clientService.graphAuthenticated.drives.updateDrive.mockResolvedValue( mockAxiosResolve({ id: '1fe58d8b-aa69-4c22-baf7-97dd57479f22', name: 'any', quota: { remaining: 9999999836, state: 'normal', total: 10000000000, used: 164 } }) ) await wrapper.vm.onConfirm() const spacesStore = useSpacesStore() expect(spacesStore.updateSpaceField).toHaveBeenCalledTimes(1) const { showMessage } = useMessages() expect(showMessage).toHaveBeenCalledTimes(1) }) it('should show message on server error', async () => { vi.spyOn(console, 'error').mockImplementation(() => undefined) const { wrapper, mocks } = getWrapper() mocks.$clientService.graphAuthenticated.drives.updateDrive.mockRejectedValue(new Error()) await wrapper.vm.onConfirm() const spacesStore = useSpacesStore() expect(spacesStore.updateSpaceField).toHaveBeenCalledTimes(0) const { showErrorMessage } = useMessages() expect(showErrorMessage).toHaveBeenCalledTimes(1) }) }) }) function getWrapper() { const mocks = defaultComponentMocks() return { mocks, wrapper: mount(QuotaModal, { props: { modal: undefined, spaces: [ { id: '1fe58d8b-aa69-4c22-baf7-97dd57479f22', spaceQuota: { remaining: 9999999836, state: 'normal', total: 10000000000, used: 164 } } as SpaceResource ] }, global: { stubs: { ...defaultStubs }, mocks, provide: mocks, plugins: [...defaultPlugins()] } }) } }
owncloud/web/packages/web-pkg/tests/unit/components/Spaces/QuotaModal.spec.ts/0
{ "file_path": "owncloud/web/packages/web-pkg/tests/unit/components/Spaces/QuotaModal.spec.ts", "repo_id": "owncloud", "token_count": 1025 }
844