chore: code cleanup

This commit is contained in:
Joxit 2020-12-05 22:11:59 +01:00
parent 1bad64443d
commit 8c613701d3
No known key found for this signature in database
GPG Key ID: F526592B8E012263
7 changed files with 15 additions and 16 deletions

View File

@ -45,7 +45,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</material-footer>
</footer>
<script>
<script type="text/javascript">
registryUI.appTag = this;
route.base('#!');
route('', function() {

View File

@ -30,7 +30,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</material-card>
<catalog-element if="{typeof opts.item !== "string"}" class="animated {hide: !expanded, expanding: expanding}" each="{item in item.images}" />
</div>
<script>
<script type="text/javascript">
this.on('mount', function() {
const self = this;
const card = this.tags['material-card'];

View File

@ -28,7 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<material-spinner></material-spinner>
</div>
<catalog-element each="{ item in registryUI.catalog.repositories }" />
<script>
<script type="text/javascript">
registryUI.catalog.instance = this;
registryUI.catalog.display = function() {
registryUI.catalog.repositories = [];
@ -41,7 +41,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
}
registryUI.catalog.repositories = JSON.parse(this.responseText).repositories || [];
registryUI.catalog.repositories.sort();
registryUI.catalog.length = registryUI.catalog.repositories.length; registryUI.catalog.repositories = registryUI.catalog.repositories.reduce(function(acc, e) {
registryUI.catalog.length = registryUI.catalog.repositories.length;
registryUI.catalog.repositories = registryUI.catalog.repositories.reduce(function(acc, e) {
const slash = e.indexOf('/');
if (slash > 0) {
const repoName = e.substring(0, slash) + '/';

View File

@ -18,18 +18,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<!-- Begin of tag -->
<div class="conatianer">
<div class="pagination-centered">
<material-button waves-color="rgba(158,158,158,.4)" each="{p in this.opts.pages}" class="{ current: p.current, space-left: p['space-left'], space-right: p['space-right']}">
<material-button waves-color="rgba(158,158,158,.4)" each="{p in this.opts.pages}"
class="{ current: p.current, space-left: p['space-left'], space-right: p['space-right']}">
<i show="{ p.icon }" class="material-icons">{ p.icon }</i>
<div hide="{ p.icon }">{ p.page }</div>
</material-button>
</div>
<div>
<script>
this.on('updated', function() {
</div>
<script type="text/javascript">
this.on('updated', function () {
if (!this.tags['material-button']) { return; }
var buttons = Array.isArray(this.tags['material-button']) ? this.tags['material-button'] : [this.tags['material-button']];
buttons.forEach(function(button) {
button.root.onclick = function() {
buttons.forEach(function (button) {
button.root.onclick = function () {
registryUI.taglist.instance.trigger('page-update', button.p.page)
}
});

View File

@ -22,9 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<script type="text/javascript">
const self = this;
this.on('updated', function() {
});
this.on('updated', function() {
if (self.multiDelete == self.opts.multiDelete) {
return;

View File

@ -18,8 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<material-button ref="button" title="This will show the history of given tag" waves-center="true" rounded="true" waves-color="#ddd">
<i class="material-icons">history</i>
</material-button>
<script>
this.on('mount', function() {
<script type="text/javascript">
this.on('mount', function() {
const self = this;
this.refs.button.root.onclick = function() {
registryUI.taghistory.go(self.opts.image.name, self.opts.image.tag);

View File

@ -85,7 +85,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</table>
</material-card>
<pagination pages="{ registryUI.getPageLabels(this.page, registryUI.getNumPages(registryUI.taglist.tags)) }"></pagination>
<script>
<script type="text/javascript">
var self = registryUI.taglist.instance = this;
self.page = registryUI.getPageQueryParam();
registryUI.taglist.tags = [];