diff --git a/TracToGitlabPlugin.php b/TracToGitlabPlugin.php index 9be2f837fab0f0d972f37e136eca0a00c86eced8..986df538b4a25a397688701f6aa82d78fb582e65 100644 --- a/TracToGitlabPlugin.php +++ b/TracToGitlabPlugin.php @@ -90,6 +90,10 @@ final class TracToGitlabPlugin extends TracToGitlab\Plugin implements StandardPl 'merge-requests', new Navigation(_('Merge Requests'), PluginEngine::getURL($this, [], 'mergerequests')) ); + $navigation->addSubNavigation( + 'labels', + new Navigation(_('Verwendete Labels'), PluginEngine::getURL($this, [], 'labels')) + ); $navigation->addSubNavigation( 'cg-members', new Navigation(_('Übersicht Zuständigkeiten'), PluginEngine::getURL($this, [], 'cgmembers')) diff --git a/assets/apps/labels.js b/assets/apps/labels.js new file mode 100644 index 0000000000000000000000000000000000000000..06459039ebf3dea42dc9c492fef260c687b3e68f --- /dev/null +++ b/assets/apps/labels.js @@ -0,0 +1,86 @@ +export default { + data: () => ({ + sort: { + by: 'name', + asc: true, + }, + needle: '', + }), + components: { + gitlabLabel: { + template: '#label-template', + props: { + label: { + type: Object, + required: true, + }, + }, + computed: { + isScoped() { + return this.label.name.includes('::'); + }, + name() { + return this.isScoped ? this.label.name.split('::').slice(0, -1).join('::') : this.label.name; + }, + scope() { + return this.isScoped ? this.label.name.split('::').at(-1) : null; + }, + style() { + return { + '--label-background-color': this.label.color, + '--label-text-color': this.label.text_color, + }; + }, + link() { + const url = new URL('/studip/studip/-/issues', 'https://gitlab.studip.de'); + url.searchParams.append('label_name[]', this.label.name); + return url.toString(); + }, + }, + }, + }, + methods: { + sortClass(column) { + if (this.sort.by !== column) { + return ''; + } + + return { + sortasc: this.sort.asc, + sortdesc: !this.sort.asc, + }; + }, + selectSort(column) { + if (this.sort.by === column) { + this.sort.asc = !this.sort.asc; + } else { + this.sort.by = column; + this.sort.asc = true; + } + } + }, + computed: { + sortedLabels () { + const dirFactor = this.sort.asc ? 1 : -1; + return this.labels + .filter(label => { + return this.needle.trim().length === 0 + || label.name.toLowerCase().includes(this.needle.toLowerCase()) + || label.description?.toLowerCase().includes(this.needle.toLowerCase()); + }) + .sort((a, b) => { + if (this.sort.by === 'name') { + return dirFactor * a.name.localeCompare(b.name); + } + if (this.sort.by === 'description') { + return dirFactor * (a.description ?? '').localeCompare(b.description ?? ''); + } + if (this.sort.by === 'count') { + return dirFactor * (a.count - b.count); + } + + throw new Error('Invalid sorting defined'); + }); + }, + }, +}; diff --git a/assets/script.js b/assets/script.js index f4ee60d221ad1ff71ba916615c99dd58718b39e4..da3dd83a549a305e89e8e53ec214ef49d9b7bad1 100644 --- a/assets/script.js +++ b/assets/script.js @@ -1,6 +1,36 @@ (function ($, STUDIP) { 'use strict'; + const lookup = { + '#labels-list-app': () => import('./apps/labels.js'), + }; + + STUDIP.ready(() => { + Object.entries(lookup).forEach(([selector, appLoader]) => { + const node = document.querySelector(selector); + if (!node) { + return; + } + + const vueAppData = node.dataset.vueAppData ? JSON.parse(node.dataset.vueAppData) : {}; + + Promise.all([ + STUDIP.loadChunk('vue'), + appLoader() + ]).then(([{ createApp }, { default: app }]) => { + let originalData = {}; + if (app.data !== undefined) { + originalData = app.data instanceof Function ? app.data() : app.data; + } + app.data = () => ({ + ...originalData, + ...vueAppData + }); + createApp(app).$mount(node); + }) + }); + }); + var searchTimeout = null; var lastRequestController = null; diff --git a/assets/style.scss b/assets/style.scss index bd94f29c699882e1b1a1216dfec4cced7fab5b19..60b17ced47f2f1b301de685fb7140db297194e07 100644 --- a/assets/style.scss +++ b/assets/style.scss @@ -30,3 +30,42 @@ td.filter-match { #dashboard table.default td { vertical-align: top; } + +#labels-list-app { + * { + box-sizing: border-box; + } + .label { + align-items: center; + background-color: var(--label-background-color); + border-radius: 0.75rem; + border: 2px solid var(--label-background-color); + color: var(--label-text-color); + display: inline-flex; + line-height: 1; + max-width: 100%; + overflow: hidden; + position: relative; + white-space: nowrap; + } + .label-link { + color: inherit; + display: flex; + font-size: 0.75rem; + line-height: 1rem; + overflow: hidden; + } + .label-text { + padding: 0.25rem 0.5rem; + } + .label-scoped { + .label-text { + padding-right: 0.25rem; + } + .label-text-scoped { + background-color: var(--white); + color: var(--black); + padding: 0.25rem 0.5rem 0.25rem 0.25rem; + } + } +} diff --git a/composer.json b/composer.json index acae4f3f3cec0c29eea66a110be14e169d393517..9fbc2b2391c1f020df03a7ae7a4332865bbcfb54 100644 --- a/composer.json +++ b/composer.json @@ -8,12 +8,17 @@ ], "require": { "fguillot/json-rpc": "^1.2", - "m4tthumphrey/php-gitlab-api": "^11.4", + "m4tthumphrey/php-gitlab-api": "^11.12.0", "guzzlehttp/guzzle": "^7.2", "http-interop/http-factory-guzzle": "^1.0", "erusev/parsedown": "^1.7", "ext-json": "*", "pimple/pimple": "^3.4", "ext-curl": "*" + }, + "config": { + "allow-plugins": { + "php-http/discovery": true + } } } diff --git a/composer.lock b/composer.lock index 0efd7ad6f03a6dbfbfe4722c005c9ad4aa415ca1..a18a0321908e25a5ab736cac2eb44fde6645f22c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "33d70628ad93e6a887d04087b16605cf", + "content-hash": "364dc3e4d32decc645b3e2914dae455b", "packages": [ { "name": "clue/stream-filter", - "version": "v1.5.0", + "version": "v1.6.0", "source": { "type": "git", "url": "https://github.com/clue/stream-filter.git", - "reference": "aeb7d8ea49c7963d3b581378955dbf5bc49aa320" + "reference": "d6169430c7731d8509da7aecd0af756a5747b78e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/clue/stream-filter/zipball/aeb7d8ea49c7963d3b581378955dbf5bc49aa320", - "reference": "aeb7d8ea49c7963d3b581378955dbf5bc49aa320", + "url": "https://api.github.com/repos/clue/stream-filter/zipball/d6169430c7731d8509da7aecd0af756a5747b78e", + "reference": "d6169430c7731d8509da7aecd0af756a5747b78e", "shasum": "" }, "require": { @@ -28,12 +28,12 @@ }, "type": "library", "autoload": { - "psr-4": { - "Clue\\StreamFilter\\": "src/" - }, "files": [ "src/functions_include.php" - ] + ], + "psr-4": { + "Clue\\StreamFilter\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -58,7 +58,7 @@ ], "support": { "issues": "https://github.com/clue/stream-filter/issues", - "source": "https://github.com/clue/stream-filter/tree/v1.5.0" + "source": "https://github.com/clue/stream-filter/tree/v1.6.0" }, "funding": [ { @@ -70,7 +70,7 @@ "type": "github" } ], - "time": "2020-10-02T12:38:20+00:00" + "time": "2022-02-21T13:15:14+00:00" }, { "name": "erusev/parsedown", @@ -459,40 +459,46 @@ }, { "name": "m4tthumphrey/php-gitlab-api", - "version": "11.5.1", + "version": "11.12.0", "source": { "type": "git", "url": "https://github.com/GitLabPHP/Client.git", - "reference": "d3364fd373f1ec8588dbd65afb527ea4cdcad8b4" + "reference": "b0d70a6142c52407a226d940ef2d0ae96e65c7e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/GitLabPHP/Client/zipball/d3364fd373f1ec8588dbd65afb527ea4cdcad8b4", - "reference": "d3364fd373f1ec8588dbd65afb527ea4cdcad8b4", + "url": "https://api.github.com/repos/GitLabPHP/Client/zipball/b0d70a6142c52407a226d940ef2d0ae96e65c7e7", + "reference": "b0d70a6142c52407a226d940ef2d0ae96e65c7e7", "shasum": "" }, "require": { "ext-json": "*", "ext-xml": "*", - "php": "^7.2.5 || ^8.0", - "php-http/cache-plugin": "^1.7.2", - "php-http/client-common": "^2.3", - "php-http/discovery": "^1.12", - "php-http/httplug": "^2.2", - "php-http/multipart-stream-builder": "^1.1.2", - "psr/cache": "^1.0 || ^2.0", + "php": "^7.4.15 || ^8.0.2", + "php-http/cache-plugin": "^1.8", + "php-http/client-common": "^2.7", + "php-http/discovery": "^1.19", + "php-http/httplug": "^2.4", + "php-http/multipart-stream-builder": "^1.3", + "psr/cache": "^1.0 || ^2.0 || ^3.0", "psr/http-client-implementation": "^1.0", "psr/http-factory-implementation": "^1.0", - "psr/http-message": "^1.0", - "symfony/options-resolver": "^3.4 || ^4.0 || ^5.0 || ^6.0", - "symfony/polyfill-php80": "^1.17" + "psr/http-message": "^1.1 || ^2.0", + "symfony/options-resolver": "^4.4 || ^5.0 || ^6.0", + "symfony/polyfill-php80": "^1.26" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.4.1", - "guzzlehttp/guzzle": "^7.2", - "http-interop/http-factory-guzzle": "^1.0" + "bamarni/composer-bin-plugin": "^1.8.2", + "guzzlehttp/guzzle": "^7.8", + "http-interop/http-factory-guzzle": "^1.2" }, "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, "autoload": { "psr-4": { "Gitlab\\": "src/" @@ -531,7 +537,7 @@ ], "support": { "issues": "https://github.com/GitLabPHP/Client/issues", - "source": "https://github.com/GitLabPHP/Client/tree/11.5.1" + "source": "https://github.com/GitLabPHP/Client/tree/11.12.0" }, "funding": [ { @@ -539,38 +545,33 @@ "type": "github" } ], - "time": "2022-01-23T18:43:46+00:00" + "time": "2023-10-08T14:28:30+00:00" }, { "name": "php-http/cache-plugin", - "version": "1.7.2", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/php-http/cache-plugin.git", - "reference": "922409f10541b0d581b8ffe5cd810f4efc9e9e32" + "reference": "6bf9fbf66193f61d90c2381b75eb1fa0202fd314" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/cache-plugin/zipball/922409f10541b0d581b8ffe5cd810f4efc9e9e32", - "reference": "922409f10541b0d581b8ffe5cd810f4efc9e9e32", + "url": "https://api.github.com/repos/php-http/cache-plugin/zipball/6bf9fbf66193f61d90c2381b75eb1fa0202fd314", + "reference": "6bf9fbf66193f61d90c2381b75eb1fa0202fd314", "shasum": "" }, "require": { "php": "^7.1 || ^8.0", "php-http/client-common": "^1.9 || ^2.0", "php-http/message-factory": "^1.0", - "psr/cache": "^1.0 || ^2.0", - "symfony/options-resolver": "^2.6 || ^3.0 || ^4.0 || ^5.0" + "psr/cache": "^1.0 || ^2.0 || ^3.0", + "symfony/options-resolver": "^2.6 || ^3.0 || ^4.0 || ^5.0 || ^6.0" }, "require-dev": { - "phpspec/phpspec": "^5.1 || ^6.0" + "phpspec/phpspec": "^5.1 || ^6.0 || ^7.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6-dev" - } - }, "autoload": { "psr-4": { "Http\\Client\\Common\\Plugin\\": "src/" @@ -596,42 +597,41 @@ ], "support": { "issues": "https://github.com/php-http/cache-plugin/issues", - "source": "https://github.com/php-http/cache-plugin/tree/1.7.2" + "source": "https://github.com/php-http/cache-plugin/tree/1.8.0" }, - "time": "2021-04-14T06:06:08+00:00" + "time": "2023-04-28T10:56:55+00:00" }, { "name": "php-http/client-common", - "version": "2.4.0", + "version": "2.7.0", "source": { "type": "git", "url": "https://github.com/php-http/client-common.git", - "reference": "29e0c60d982f04017069483e832b92074d0a90b2" + "reference": "880509727a447474d2a71b7d7fa5d268ddd3db4b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/client-common/zipball/29e0c60d982f04017069483e832b92074d0a90b2", - "reference": "29e0c60d982f04017069483e832b92074d0a90b2", + "url": "https://api.github.com/repos/php-http/client-common/zipball/880509727a447474d2a71b7d7fa5d268ddd3db4b", + "reference": "880509727a447474d2a71b7d7fa5d268ddd3db4b", "shasum": "" }, "require": { "php": "^7.1 || ^8.0", "php-http/httplug": "^2.0", "php-http/message": "^1.6", - "php-http/message-factory": "^1.0", "psr/http-client": "^1.0", "psr/http-factory": "^1.0", - "psr/http-message": "^1.0", - "symfony/options-resolver": "^2.6 || ^3.4.20 || ~4.0.15 || ~4.1.9 || ^4.2.1 || ^5.0", + "psr/http-message": "^1.0 || ^2.0", + "symfony/options-resolver": "~4.0.15 || ~4.1.9 || ^4.2.1 || ^5.0 || ^6.0", "symfony/polyfill-php80": "^1.17" }, "require-dev": { "doctrine/instantiator": "^1.1", "guzzlehttp/psr7": "^1.4", "nyholm/psr7": "^1.2", - "phpspec/phpspec": "^5.1 || ^6.0", + "phpspec/phpspec": "^5.1 || ^6.3 || ^7.1", "phpspec/prophecy": "^1.10.2", - "phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.3" + "phpunit/phpunit": "^7.5.20 || ^8.5.33 || ^9.6.7" }, "suggest": { "ext-json": "To detect JSON responses with the ContentTypePlugin", @@ -641,11 +641,6 @@ "php-http/stopwatch-plugin": "Symfony Stopwatch plugin" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.3.x-dev" - } - }, "autoload": { "psr-4": { "Http\\Client\\Common\\": "src/" @@ -671,50 +666,59 @@ ], "support": { "issues": "https://github.com/php-http/client-common/issues", - "source": "https://github.com/php-http/client-common/tree/2.4.0" + "source": "https://github.com/php-http/client-common/tree/2.7.0" }, - "time": "2021-07-05T08:19:25+00:00" + "time": "2023-05-17T06:46:59+00:00" }, { "name": "php-http/discovery", - "version": "1.14.0", + "version": "1.19.1", "source": { "type": "git", "url": "https://github.com/php-http/discovery.git", - "reference": "778f722e29250c1fac0bbdef2c122fa5d038c9eb" + "reference": "57f3de01d32085fea20865f9b16fb0e69347c39e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/discovery/zipball/778f722e29250c1fac0bbdef2c122fa5d038c9eb", - "reference": "778f722e29250c1fac0bbdef2c122fa5d038c9eb", + "url": "https://api.github.com/repos/php-http/discovery/zipball/57f3de01d32085fea20865f9b16fb0e69347c39e", + "reference": "57f3de01d32085fea20865f9b16fb0e69347c39e", "shasum": "" }, "require": { + "composer-plugin-api": "^1.0|^2.0", "php": "^7.1 || ^8.0" }, "conflict": { - "nyholm/psr7": "<1.0" + "nyholm/psr7": "<1.0", + "zendframework/zend-diactoros": "*" + }, + "provide": { + "php-http/async-client-implementation": "*", + "php-http/client-implementation": "*", + "psr/http-client-implementation": "*", + "psr/http-factory-implementation": "*", + "psr/http-message-implementation": "*" }, "require-dev": { + "composer/composer": "^1.0.2|^2.0", "graham-campbell/phpspec-skip-example-extension": "^5.0", "php-http/httplug": "^1.0 || ^2.0", "php-http/message-factory": "^1.0", - "phpspec/phpspec": "^5.1 || ^6.1", - "puli/composer-plugin": "1.0.0-beta10" - }, - "suggest": { - "php-http/message": "Allow to use Guzzle, Diactoros or Slim Framework factories" + "phpspec/phpspec": "^5.1 || ^6.1 || ^7.3", + "symfony/phpunit-bridge": "^6.2" }, - "type": "library", + "type": "composer-plugin", "extra": { - "branch-alias": { - "dev-master": "1.9-dev" - } + "class": "Http\\Discovery\\Composer\\Plugin", + "plugin-optional": true }, "autoload": { "psr-4": { "Http\\Discovery\\": "src/" - } + }, + "exclude-from-classmap": [ + "src/Composer/Plugin.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -726,7 +730,7 @@ "email": "mark.sagikazar@gmail.com" } ], - "description": "Finds installed HTTPlug implementations and PSR-7 message factories", + "description": "Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations", "homepage": "http://php-http.org", "keywords": [ "adapter", @@ -735,44 +739,40 @@ "factory", "http", "message", + "psr17", "psr7" ], "support": { "issues": "https://github.com/php-http/discovery/issues", - "source": "https://github.com/php-http/discovery/tree/1.14.0" + "source": "https://github.com/php-http/discovery/tree/1.19.1" }, - "time": "2021-06-01T14:30:21+00:00" + "time": "2023-07-11T07:02:26+00:00" }, { "name": "php-http/httplug", - "version": "2.2.0", + "version": "2.4.0", "source": { "type": "git", "url": "https://github.com/php-http/httplug.git", - "reference": "191a0a1b41ed026b717421931f8d3bd2514ffbf9" + "reference": "625ad742c360c8ac580fcc647a1541d29e257f67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/httplug/zipball/191a0a1b41ed026b717421931f8d3bd2514ffbf9", - "reference": "191a0a1b41ed026b717421931f8d3bd2514ffbf9", + "url": "https://api.github.com/repos/php-http/httplug/zipball/625ad742c360c8ac580fcc647a1541d29e257f67", + "reference": "625ad742c360c8ac580fcc647a1541d29e257f67", "shasum": "" }, "require": { "php": "^7.1 || ^8.0", "php-http/promise": "^1.1", "psr/http-client": "^1.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.0 || ^2.0" }, "require-dev": { - "friends-of-phpspec/phpspec-code-coverage": "^4.1", - "phpspec/phpspec": "^5.1 || ^6.0" + "friends-of-phpspec/phpspec-code-coverage": "^4.1 || ^5.0 || ^6.0", + "phpspec/phpspec": "^5.1 || ^6.0 || ^7.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - } - }, "autoload": { "psr-4": { "Http\\Client\\": "src/" @@ -801,29 +801,28 @@ ], "support": { "issues": "https://github.com/php-http/httplug/issues", - "source": "https://github.com/php-http/httplug/tree/master" + "source": "https://github.com/php-http/httplug/tree/2.4.0" }, - "time": "2020-07-13T15:43:23+00:00" + "time": "2023-04-14T15:10:03+00:00" }, { "name": "php-http/message", - "version": "1.11.1", + "version": "1.16.0", "source": { "type": "git", "url": "https://github.com/php-http/message.git", - "reference": "887734d9c515ad9a564f6581a682fff87a6253cc" + "reference": "47a14338bf4ebd67d317bf1144253d7db4ab55fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/message/zipball/887734d9c515ad9a564f6581a682fff87a6253cc", - "reference": "887734d9c515ad9a564f6581a682fff87a6253cc", + "url": "https://api.github.com/repos/php-http/message/zipball/47a14338bf4ebd67d317bf1144253d7db4ab55fd", + "reference": "47a14338bf4ebd67d317bf1144253d7db4ab55fd", "shasum": "" }, "require": { "clue/stream-filter": "^1.5", - "php": "^7.1 || ^8.0", - "php-http/message-factory": "^1.0.2", - "psr/http-message": "^1.0" + "php": "^7.2 || ^8.0", + "psr/http-message": "^1.1 || ^2.0" }, "provide": { "php-http/message-factory-implementation": "1.0" @@ -831,9 +830,10 @@ "require-dev": { "ergebnis/composer-normalize": "^2.6", "ext-zlib": "*", - "guzzlehttp/psr7": "^1.0", - "laminas/laminas-diactoros": "^2.0", - "phpspec/phpspec": "^5.1 || ^6.3", + "guzzlehttp/psr7": "^1.0 || ^2.0", + "laminas/laminas-diactoros": "^2.0 || ^3.0", + "php-http/message-factory": "^1.0.2", + "phpspec/phpspec": "^5.1 || ^6.3 || ^7.1", "slim/slim": "^3.0" }, "suggest": { @@ -843,18 +843,13 @@ "slim/slim": "Used with Slim Framework PSR-7 implementation" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10-dev" - } - }, "autoload": { - "psr-4": { - "Http\\Message\\": "src/" - }, "files": [ "src/filters.php" - ] + ], + "psr-4": { + "Http\\Message\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -875,32 +870,32 @@ ], "support": { "issues": "https://github.com/php-http/message/issues", - "source": "https://github.com/php-http/message/tree/1.11.1" + "source": "https://github.com/php-http/message/tree/1.16.0" }, - "time": "2021-05-24T18:11:08+00:00" + "time": "2023-05-17T06:43:38+00:00" }, { "name": "php-http/message-factory", - "version": "v1.0.2", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/php-http/message-factory.git", - "reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1" + "reference": "4d8778e1c7d405cbb471574821c1ff5b68cc8f57" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/message-factory/zipball/a478cb11f66a6ac48d8954216cfed9aa06a501a1", - "reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1", + "url": "https://api.github.com/repos/php-http/message-factory/zipball/4d8778e1c7d405cbb471574821c1ff5b68cc8f57", + "reference": "4d8778e1c7d405cbb471574821c1ff5b68cc8f57", "shasum": "" }, "require": { "php": ">=5.4", - "psr/http-message": "^1.0" + "psr/http-message": "^1.0 || ^2.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "1.x-dev" } }, "autoload": { @@ -929,42 +924,37 @@ ], "support": { "issues": "https://github.com/php-http/message-factory/issues", - "source": "https://github.com/php-http/message-factory/tree/master" + "source": "https://github.com/php-http/message-factory/tree/1.1.0" }, - "time": "2015-12-19T14:08:53+00:00" + "abandoned": "psr/http-factory", + "time": "2023-04-14T14:16:17+00:00" }, { "name": "php-http/multipart-stream-builder", - "version": "1.2.0", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/php-http/multipart-stream-builder.git", - "reference": "11c1d31f72e01c738bbce9e27649a7cca829c30e" + "reference": "f5938fd135d9fa442cc297dc98481805acfe2b6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/multipart-stream-builder/zipball/11c1d31f72e01c738bbce9e27649a7cca829c30e", - "reference": "11c1d31f72e01c738bbce9e27649a7cca829c30e", + "url": "https://api.github.com/repos/php-http/multipart-stream-builder/zipball/f5938fd135d9fa442cc297dc98481805acfe2b6a", + "reference": "f5938fd135d9fa442cc297dc98481805acfe2b6a", "shasum": "" }, "require": { "php": "^7.1 || ^8.0", - "php-http/discovery": "^1.7", - "php-http/message-factory": "^1.0.2", - "psr/http-factory": "^1.0", - "psr/http-message": "^1.0" + "php-http/discovery": "^1.15", + "psr/http-factory-implementation": "^1.0" }, "require-dev": { "nyholm/psr7": "^1.0", "php-http/message": "^1.5", + "php-http/message-factory": "^1.0.2", "phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.3" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, "autoload": { "psr-4": { "Http\\Message\\MultipartStream\\": "src/" @@ -991,37 +981,32 @@ ], "support": { "issues": "https://github.com/php-http/multipart-stream-builder/issues", - "source": "https://github.com/php-http/multipart-stream-builder/tree/1.2.0" + "source": "https://github.com/php-http/multipart-stream-builder/tree/1.3.0" }, - "time": "2021-05-21T08:32:01+00:00" + "time": "2023-04-28T14:10:22+00:00" }, { "name": "php-http/promise", - "version": "1.1.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/php-http/promise.git", - "reference": "4c4c1f9b7289a2ec57cde7f1e9762a5789506f88" + "reference": "44a67cb59f708f826f3bec35f22030b3edb90119" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/promise/zipball/4c4c1f9b7289a2ec57cde7f1e9762a5789506f88", - "reference": "4c4c1f9b7289a2ec57cde7f1e9762a5789506f88", + "url": "https://api.github.com/repos/php-http/promise/zipball/44a67cb59f708f826f3bec35f22030b3edb90119", + "reference": "44a67cb59f708f826f3bec35f22030b3edb90119", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "friends-of-phpspec/phpspec-code-coverage": "^4.3.2", - "phpspec/phpspec": "^5.1.2 || ^6.2" + "friends-of-phpspec/phpspec-code-coverage": "^4.3.2 || ^6.3", + "phpspec/phpspec": "^5.1.2 || ^6.2 || ^7.4" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, "autoload": { "psr-4": { "Http\\Promise\\": "src/" @@ -1048,9 +1033,9 @@ ], "support": { "issues": "https://github.com/php-http/promise/issues", - "source": "https://github.com/php-http/promise/tree/1.1.0" + "source": "https://github.com/php-http/promise/tree/1.2.1" }, - "time": "2020-07-07T09:29:14+00:00" + "time": "2023-11-08T12:57:08+00:00" }, { "name": "pimple/pimple", @@ -1204,21 +1189,21 @@ }, { "name": "psr/http-client", - "version": "1.0.1", + "version": "1.0.3", "source": { "type": "git", "url": "https://github.com/php-fig/http-client.git", - "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621" + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", - "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90", "shasum": "" }, "require": { "php": "^7.0 || ^8.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.0 || ^2.0" }, "type": "library", "extra": { @@ -1238,7 +1223,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for HTTP clients", @@ -1250,27 +1235,27 @@ "psr-18" ], "support": { - "source": "https://github.com/php-fig/http-client/tree/master" + "source": "https://github.com/php-fig/http-client" }, - "time": "2020-06-29T06:28:15+00:00" + "time": "2023-09-23T14:17:50+00:00" }, { "name": "psr/http-factory", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/http-factory.git", - "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be" + "reference": "e616d01114759c4c489f93b099585439f795fe35" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be", - "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35", + "reference": "e616d01114759c4c489f93b099585439f795fe35", "shasum": "" }, "require": { "php": ">=7.0.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.0 || ^2.0" }, "type": "library", "extra": { @@ -1290,7 +1275,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interfaces for PSR-7 HTTP message factories", @@ -1305,31 +1290,31 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-factory/tree/master" + "source": "https://github.com/php-fig/http-factory/tree/1.0.2" }, - "time": "2019-04-30T12:38:16+00:00" + "time": "2023-04-10T20:10:41+00:00" }, { "name": "psr/http-message", - "version": "1.0.1", + "version": "1.1", "source": { "type": "git", "url": "https://github.com/php-fig/http-message.git", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba", + "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { @@ -1358,9 +1343,9 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-message/tree/master" + "source": "https://github.com/php-fig/http-message/tree/1.1" }, - "time": "2016-08-06T14:39:51+00:00" + "time": "2023-04-04T09:50:52+00:00" }, { "name": "ralouphie/getallheaders", @@ -1408,16 +1393,16 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v2.4.0", + "version": "v2.5.2", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627" + "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5f38c8804a9e97d23e0c8d63341088cd8a22d627", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", "shasum": "" }, "require": { @@ -1426,7 +1411,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -1455,7 +1440,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.4.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2" }, "funding": [ { @@ -1471,27 +1456,27 @@ "type": "tidelift" } ], - "time": "2021-03-23T23:28:01+00:00" + "time": "2022-01-02T09:53:40+00:00" }, { "name": "symfony/options-resolver", - "version": "v5.3.0", + "version": "v5.4.21", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "162e886ca035869866d233a2bfef70cc28f9bbe5" + "reference": "4fe5cf6ede71096839f0e4b4444d65dd3a7c1eb9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/162e886ca035869866d233a2bfef70cc28f9bbe5", - "reference": "162e886ca035869866d233a2bfef70cc28f9bbe5", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/4fe5cf6ede71096839f0e4b4444d65dd3a7c1eb9", + "reference": "4fe5cf6ede71096839f0e4b4444d65dd3a7c1eb9", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-php73": "~1.0", - "symfony/polyfill-php80": "^1.15" + "symfony/polyfill-php80": "^1.16" }, "type": "library", "autoload": { @@ -1524,7 +1509,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v5.3.0" + "source": "https://github.com/symfony/options-resolver/tree/v5.4.21" }, "funding": [ { @@ -1540,20 +1525,20 @@ "type": "tidelift" } ], - "time": "2021-05-26T17:43:10+00:00" + "time": "2023-02-14T08:03:56+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.23.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010" + "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fba8933c384d6476ab14fb7b8526e5287ca7e010", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fe2f306d1d9d346a7fee353d0d5012e401e984b5", + "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5", "shasum": "" }, "require": { @@ -1562,7 +1547,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1570,12 +1555,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -1603,7 +1588,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.28.0" }, "funding": [ { @@ -1619,20 +1604,20 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.23.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "eca0bf41ed421bed1b57c4958bab16aa86b757d0" + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/eca0bf41ed421bed1b57c4958bab16aa86b757d0", - "reference": "eca0bf41ed421bed1b57c4958bab16aa86b757d0", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", "shasum": "" }, "require": { @@ -1641,7 +1626,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1649,12 +1634,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -1686,7 +1671,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" }, "funding": [ { @@ -1702,7 +1687,7 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2023-01-26T09:26:14+00:00" } ], "packages-dev": [], @@ -1712,7 +1697,8 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "ext-json": "*" + "ext-json": "*", + "ext-curl": "*" }, "platform-dev": [], "plugin-api-version": "2.3.0" diff --git a/controllers/labels.php b/controllers/labels.php new file mode 100644 index 0000000000000000000000000000000000000000..36827e3d8a3bfb3977fca1d19655273db96a94c2 --- /dev/null +++ b/controllers/labels.php @@ -0,0 +1,40 @@ +<?php +final class LabelsController extends \TracToGitlab\GitlabController +{ + public function before_filter(&$action, &$args) + { + parent::before_filter($action, $args); + + PageLayout::setTitle(_('Verwendete Labels')); + $this->activateNavigation('labels'); + } + + public function index_action() + { + $data = $this->readFromCache('labels', true); + if ($data === false) { + $this->labels = $this->fetchLabels(); + $this->writeToCache('labels', $this->labels); + } else { + $this->labels = $data['data']; + } + } + + private function fetchLabels(): array + { + $labels = $this->gitlabPager->fetchAll( + $this->gitlab->projects(), + 'labels', + [ + $this->gitlabProjectId, + ['with_counts' => true] + ] + ); + + usort($labels, function ($a, $b) { + return strnatcasecmp($a['name'], $b['name']); + }); + + return $labels; + } +} diff --git a/plugin.manifest b/plugin.manifest index 1df419d6e950d80b9f2313efee9f568381a59120..0838624d20bbadee345241abd9130bd7b9507656 100644 --- a/plugin.manifest +++ b/plugin.manifest @@ -4,3 +4,4 @@ pluginclassname=StudipReleasesPlugin origin=UOL version=1.4.4 studipMinVersion=5.0 +localedomain=trac2gitlab diff --git a/views/labels/index.php b/views/labels/index.php new file mode 100644 index 0000000000000000000000000000000000000000..e944520d4f4f6f08a254562b3f1f5b8b48854e4e --- /dev/null +++ b/views/labels/index.php @@ -0,0 +1,104 @@ +<?php +/** + * @var array $labels + * @var callable $_ + */ +?> +<?php +$vueData = [ + 'labels' => array_map( + function (array $label): array { + return [ + 'id' => $label['id'], + 'name' => $label['name'], + 'description' => $label['description'], + 'description_html' => $label['description_html'], + 'color' => $label['color'], + 'text_color' => $label['text_color'], + 'count' => $label['open_issues_count'] + $label['closed_issues_count'], + ]; + }, + $labels + ), +]; +?> +<script type="text/x-template" id="label-template"> + <span class="label" :class="{'label-scoped': isScoped}" :style="style"> + <a :href="link" target="_blank" class="label-link"> + <span class="label-text"> + {{ name }} + </span> + <span v-if="scope" class="label-text-scoped"> + {{ scope }} + </span> + </a> + </span> +</script> +<div id="labels-list-app" data-vue-app-data="<?= htmlReady(json_encode($vueData)) ?>"> + <table class="default"> + <thead> + <tr class="sortable"> + <th :class="sortClass('name')"> + <button class="as-link" @click="selectSort('name')"> + <?= $_('Label') ?> + </button> + </th> + <th :class="sortClass('description')"> + <button class="as-link" @click="selectSort('description')"> + <?= $_('Beschreibung') ?> + </button> + </th> + <th :class="sortClass('count')"> + <button class="as-link" @click="selectSort('count')"> + # + </button> + </th> + </tr> + </thead> + <tbody> + <tr v-if="sortedLabels.length === 0"> + <td colspan="3" style="text-align: center"> + <?= $_('Keine Labels passen zum Suchbegriff.') ?> + </td> + </tr> + <tr v-for="label in sortedLabels" :key="`label-${label.id}`"> + <td> + <gitlab-label :label="label"></gitlab-label> + </td> + <td v-html="label.description_html">{{ label.description }}</td> + <td>{{ label.count }}</td> + </tr> + </tbody> + </table> + + <mounting-portal mount-to="#sidebar" append> + <div class="sidebar-widget sidebar-search"> + <div class="sidebar-widget-header"> + <?= $_('Suche') ?> + <span v-if="sortedLabels.length < labels.length"> + ({{ $gettextInterpolate( + $gettext('%{ matching } von %{ total }'), + { + matching: sortedLabels.length, + total: labels.length, + } + ) }}) + </span> + </div> + <div class="sidebar-widget-content"> + <form action="#" @submit.prevent> + <ul class="needles"> + <li> + <div class="input-group files-search"> + <input type="text" v-model.trim="needle" placeholder="<?= _('Suchbegriff') ?>"> + <button class="submit-search" type="submit" title="<?= _('Suche auführen') ?>"> + <?= Icon::create('search')->asImg(20) ?> + </button> + </div> + </li> + </ul> + </form> + </div> + </div> + </mounting-portal> +</div>