mirror of
https://github.com/Joxit/docker-registry-ui.git
synced 2025-04-28 07:59:55 +03:00
feat(search-bar): add search bar to tag-list, this will filter tag names
This commit is contained in:
parent
a2b3c592df
commit
b643a44113
3 changed files with 17 additions and 11 deletions
|
@ -33,7 +33,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
<route path="{baseRoute}taglist/(.*)">
|
<route path="{baseRoute}taglist/(.*)">
|
||||||
<tag-list registry-url="{ state.registryUrl }" registry-name="{ state.name }" pull-url="{ state.pullUrl }"
|
<tag-list registry-url="{ state.registryUrl }" registry-name="{ state.name }" pull-url="{ state.pullUrl }"
|
||||||
image="{ router.getTagListImage() }" show-content-digest="{props.showContentDigest}"
|
image="{ router.getTagListImage() }" show-content-digest="{props.showContentDigest}"
|
||||||
is-image-remove-activated="{props.isImageRemoveActivated}" on-notify="{ notifySnackbar }"></tag-list>
|
is-image-remove-activated="{props.isImageRemoveActivated}" on-notify="{ notifySnackbar }"
|
||||||
|
filter-results="{ state.filter }"></tag-list>
|
||||||
</route>
|
</route>
|
||||||
<route path="{baseRoute}taghistory/(.*)">
|
<route path="{baseRoute}taghistory/(.*)">
|
||||||
<tag-history registry-url="{ state.registryUrl }" registry-name="{ state.name }" pull-url="{ state.pullUrl }"
|
<tag-history registry-url="{ state.registryUrl }" registry-name="{ state.name }" pull-url="{ state.pullUrl }"
|
||||||
|
@ -126,7 +127,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onSearch(value) {
|
onSearch(value) {
|
||||||
this.update({ filter: value })
|
this.update({
|
||||||
|
filter: value
|
||||||
|
})
|
||||||
},
|
},
|
||||||
baseRoute: '([^#]*?)/(\\?[^#]*?)?(#!)?(/?)',
|
baseRoute: '([^#]*?)/(\\?[^#]*?)?(#!)?(/?)',
|
||||||
router,
|
router,
|
||||||
|
|
|
@ -39,7 +39,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
<tag-table if="{ state.loadend }" tags="{state.tags}" asc="{state.asc}" page="{ state.page }"
|
<tag-table if="{ state.loadend }" tags="{state.tags}" asc="{state.asc}" page="{ state.page }"
|
||||||
show-content-digest="{props.showContentDigest}" is-image-remove-activated="{props.isImageRemoveActivated}"
|
show-content-digest="{props.showContentDigest}" is-image-remove-activated="{props.isImageRemoveActivated}"
|
||||||
onReverseOrder="{ onReverseOrder }" registry-url="{ props.registryUrl }" pull-url="{ props.pullUrl }"
|
onReverseOrder="{ onReverseOrder }" registry-url="{ props.registryUrl }" pull-url="{ props.pullUrl }"
|
||||||
on-notify="{ props.onNotify }"></tag-table>
|
on-notify="{ props.onNotify }" filter-results="{ props.filterResults }"></tag-table>
|
||||||
|
|
||||||
<pagination pages="{ getPageLabels(state.page, getNumPages(state.tags)) }" onPageUpdate="{onPageUpdate}"></pagination>
|
<pagination pages="{ getPageLabels(state.page, getNumPages(state.tags)) }" onPageUpdate="{onPageUpdate}"></pagination>
|
||||||
|
|
||||||
|
@ -84,15 +84,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
const self = this;
|
const self = this;
|
||||||
const oReq = new Http();
|
const oReq = new Http();
|
||||||
oReq.addEventListener('load', function () {
|
oReq.addEventListener('load', function () {
|
||||||
state.tags = [];
|
|
||||||
if (this.status == 200) {
|
if (this.status == 200) {
|
||||||
const tags = JSON.parse(this.responseText).tags || [];
|
const tags = (JSON.parse(this.responseText).tags || [])
|
||||||
state.tags = tags.map(function (tag) {
|
.map(tag => new DockerImage(props.image, tag, null, props.registryUrl, props.onNotify))
|
||||||
return new DockerImage(props.image, tag, null, props.registryUrl, props.onNotify);
|
.sort(compare);
|
||||||
}).sort(compare);
|
|
||||||
window.requestAnimationFrame(self.onResize);
|
window.requestAnimationFrame(self.onResize);
|
||||||
self.update({
|
self.update({
|
||||||
page: Math.min(state.page, getNumPages(state.tags))
|
page: Math.min(state.page, getNumPages(tags)),
|
||||||
|
tags
|
||||||
})
|
})
|
||||||
} else if (this.status == 404) {
|
} else if (this.status == 404) {
|
||||||
self.props.onNotify('Server not found', true);
|
self.props.onNotify('Server not found', true);
|
||||||
|
|
|
@ -40,7 +40,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr each="{ image in getPage(props.tags, props.page) }">
|
<tr each="{ image in getPage(props.tags, props.page) }" if="{ matchSearch(props.filterResults, image.tag) }">
|
||||||
<td class="creation-date">
|
<td class="creation-date">
|
||||||
<image-date image="{ image }" />
|
<image-date image="{ image }" />
|
||||||
</td>
|
</td>
|
||||||
|
@ -85,6 +85,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
import RemoveImage, {
|
import RemoveImage, {
|
||||||
deleteImage
|
deleteImage
|
||||||
} from './remove-image.riot';
|
} from './remove-image.riot';
|
||||||
|
import {
|
||||||
|
matchSearch
|
||||||
|
} from '../search-bar.riot';
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
ImageDate,
|
ImageDate,
|
||||||
|
@ -135,7 +138,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
toDelete: this.state.toDelete
|
toDelete: this.state.toDelete
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getPage
|
getPage,
|
||||||
|
matchSearch
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</tag-table>
|
</tag-table>
|
Loading…
Add table
Add a link
Reference in a new issue