[material-button] Add material-button for all effective buttons

This commit is contained in:
Joxit 2018-12-24 19:07:29 +01:00
parent 7366e709a4
commit d0b7e7ddeb
9 changed files with 96 additions and 67 deletions

View file

@ -11,7 +11,9 @@
url(fonts/MaterialIcons-Regular.ttf) format('truetype'); url(fonts/MaterialIcons-Regular.ttf) format('truetype');
} }
.material-icons { material-button .content i.material-icons,
material-button[rounded=true] .content i.material-icons,
i.material-icons {
font-family: 'Material Icons'; font-family: 'Material Icons';
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
@ -37,3 +39,8 @@
/* Support for IE. */ /* Support for IE. */
font-feature-settings: 'liga'; font-feature-settings: 'liga';
} }
material-button .content i.material-icons,
material-button[rounded=true] .content i.material-icons {
margin: auto;
}

View file

@ -175,16 +175,21 @@ material-card table th {
text-align: left; text-align: left;
} }
material-card material-button:hover,
material-card table tbody tr:hover { material-card table tbody tr:hover {
background-color: #eee; background-color: #eee;
} }
material-card material-button,
material-card table tbody tr {
transition-duration: .28s;
transition-timing-function: cubic-bezier(.4, 0, .2, 1);
transition-property: background-color;
}
material-card table tbody tr { material-card table tbody tr {
position: relative; position: relative;
height: 48px; height: 48px;
transition-duration: .28s;
transition-timing-function: cubic-bezier(.4, 0, .2, 1);
transition-property: background-color;
} }
material-card table td { material-card table td {
@ -223,6 +228,7 @@ material-card table th.material-card-th-sorted-descending:before {
content: "\e5db"; content: "\e5db";
} }
material-button .content i.material-icons,
.material-icons { .material-icons {
color: #777; color: #777;
} }
@ -339,10 +345,6 @@ select {
text-align: center; text-align: center;
} }
.copy-to-clipboard a:hover {
cursor: pointer;
}
tag-history material-card { tag-history material-card {
min-height: auto; min-height: auto;
} }
@ -383,3 +385,16 @@ tag-history-button button {
background: none; background: none;
border: none; border: none;
} }
material-button {
max-height: 30px;
max-width: 30px;
}
material-button:hover material-waves {
background: none;
}
material-card material-button {
background-color: inherit;
}

View file

@ -231,6 +231,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
return Math.ceil(bytes / Math.pow(1024, i)) + ' ' + sizes[i]; return Math.ceil(bytes / Math.pow(1024, i)) + ' ' + sizes[i];
}; };
registryUI.taglist.go = function(image) {
route('taglist/' + image);
};
route.start(true); route.start(true);
</script> </script>
</app> </app>

View file

@ -27,7 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<material-spinner></material-spinner> <material-spinner></material-spinner>
</div> </div>
<ul class="list highlight" show="{ registryUI.catalog.loadend }"> <ul class="list highlight" show="{ registryUI.catalog.loadend }">
<li each="{ item in registryUI.catalog.repositories }" onclick="registryUI.catalog.go('{item}');"> <li each="{ item in registryUI.catalog.repositories }" onclick="registryUI.taglist.go('{item}');">
<span> <span>
<i class="material-icons">send</i> <i class="material-icons">send</i>
{ item } { item }
@ -63,9 +63,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
oReq.open('GET', registryUI.url() + '/v2/_catalog?n=100000'); oReq.open('GET', registryUI.url() + '/v2/_catalog?n=100000');
oReq.send(); oReq.send();
}; };
registryUI.catalog.go = function(image) {
route('taglist/' + image);
};
registryUI.catalog.display(); registryUI.catalog.display();
</script> </script>
<!-- End of tag --> <!-- End of tag -->

View file

@ -16,9 +16,9 @@
--> -->
<copy-to-clipboard> <copy-to-clipboard>
<input ref="input" style="display: none; width: 1px; height: 1px;" value="{ this.dockerCmd }"> <input ref="input" style="display: none; width: 1px; height: 1px;" value="{ this.dockerCmd }">
<a onclick="{ this.copy }" title="Copy pull command."> <material-button waves-center="true" rounded="true" waves-color="#ddd" onclick="{ this.copy }" title="Copy pull command.">
<i class="material-icons">content_copy</i> <i class="material-icons">content_copy</i>
</a> </material-button>
<script type="text/javascript"> <script type="text/javascript">
this.dockerCmd = 'docker pull ' + registryUI.cleanName() + '/' + opts.image.name + ':' + opts.image.tag; this.dockerCmd = 'docker pull ' + registryUI.cleanName() + '/' + opts.image.name + ':' + opts.image.tag;
this.copy = function () { this.copy = function () {

View file

@ -15,17 +15,18 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<remove-image> <remove-image>
<a href="#" title="This will delete the image." <material-button waves-center="true" rounded="true" waves-color="#ddd" title="This will delete the image.">
onclick="registryUI.removeImage.remove('{ opts.image.name }', '{ opts.image.tag }')">
<i class="material-icons">delete</i> <i class="material-icons">delete</i>
</a> </material-button>
<script type="text/javascript"> <script type="text/javascript">
registryUI.removeImage = registryUI.removeImage || {}; const self = this;
this.on('mount', function() {
registryUI.removeImage.remove = function(name, tag) { this.tags['material-button'].root.onclick = function() {
const name = self.opts.image.name;
const tag = self.opts.image.tag;
const oReq = new Http(); const oReq = new Http();
oReq.addEventListener('loadend', function() { oReq.addEventListener('loadend', function() {
registryUI.taglist.refresh(); registryUI.taglist.go(name);
if (this.status == 200) { if (this.status == 200) {
if (!this.hasHeader('Docker-Content-Digest')) { if (!this.hasHeader('Docker-Content-Digest')) {
registryUI.errorSnackbar('You need to add Access-Control-Expose-Headers: [\'Docker-Content-Digest\'] in your server configuration.'); registryUI.errorSnackbar('You need to add Access-Control-Expose-Headers: [\'Docker-Content-Digest\'] in your server configuration.');
@ -35,7 +36,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
const oReq = new Http(); const oReq = new Http();
oReq.addEventListener('loadend', function() { oReq.addEventListener('loadend', function() {
if (this.status == 200 || this.status == 202) { if (this.status == 200 || this.status == 202) {
registryUI.taglist.refresh(); registryUI.taglist.display()
registryUI.snackbar('Deleting ' + name + ':' + tag + ' image. Run `registry garbage-collect config.yml` on your registry'); registryUI.snackbar('Deleting ' + name + ':' + tag + ' image. Run `registry garbage-collect config.yml` on your registry');
} else if (this.status == 404) { } else if (this.status == 404) {
registryUI.errorSnackbar('Digest not found'); registryUI.errorSnackbar('Digest not found');
@ -59,5 +60,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
oReq.setRequestHeader('Accept', 'application/vnd.docker.distribution.manifest.v2+json'); oReq.setRequestHeader('Accept', 'application/vnd.docker.distribution.manifest.v2+json');
oReq.send(); oReq.send();
}; };
});
</script> </script>
</remove-image> </remove-image>

View file

@ -15,13 +15,13 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<tag-history-button> <tag-history-button>
<button ref="button" title="This will show the history of given tag"> <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> <i class="material-icons">history</i>
</button> </material-button>
<script> <script>
this.on('mount', function() { this.on('mount', function() {
const self = this; const self = this;
this.refs.button.onclick = function() { this.refs.button.root.onclick = function() {
registryUI.taghistory._image = self.opts.image; registryUI.taghistory._image = self.opts.image;
registryUI.taghistory.go(self.opts.image.name, self.opts.image.tag); registryUI.taghistory.go(self.opts.image.name, self.opts.image.tag);
}; };

View file

@ -17,9 +17,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<tag-history> <tag-history>
<material-card ref="tag-history-tag" class="tag-history"> <material-card ref="tag-history-tag" class="tag-history">
<div class="material-card-title-action"> <div class="material-card-title-action">
<a href="#!taglist/{registryUI.taghistory.image}"> <material-button waves-center="true" rounded="true" waves-color="#ddd">
<i class="material-icons">arrow_back</i> <i class="material-icons">arrow_back</i>
</a> </material-button>
<h2> <h2>
History of { registryUI.taghistory.image }:{ registryUI.taghistory.tag } <i class="material-icons">history</i> History of { registryUI.taghistory.image }:{ registryUI.taghistory.tag } <i class="material-icons">history</i>
</h2> </h2>
@ -125,6 +125,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
image.on('blobs', processBlobs); image.on('blobs', processBlobs);
}; };
this.on('mount', function() {
self.refs['tag-history-tag'].tags['material-button'].root.onclick = function() {
registryUI.taglist.go(registryUI.taghistory.image);
};
});
registryUI.taghistory.display(); registryUI.taghistory.display();
self.update(); self.update();
</script> </script>

View file

@ -18,9 +18,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<!-- Begin of tag --> <!-- Begin of tag -->
<material-card ref="taglist-tag" class="taglist"> <material-card ref="taglist-tag" class="taglist">
<div class="material-card-title-action"> <div class="material-card-title-action">
<a href="#!" onclick="registryUI.home();"> <material-button waves-center="true" rounded="true" waves-color="#ddd" onclick="registryUI.home();">
<i class="material-icons">arrow_back</i> <i class="material-icons">arrow_back</i>
</a> </material-button>
<h2> <h2>
Tags of { registryUI.name() + '/' + registryUI.taglist.name } Tags of { registryUI.name() + '/' + registryUI.taglist.name }
<div class="item-count">{ registryUI.taglist.tags.length } tags</div> <div class="item-count">{ registryUI.taglist.tags.length } tags</div>
@ -116,9 +116,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
} }
registryUI.taglist.instance.update(); registryUI.taglist.instance.update();
}; };
registryUI.taglist.refresh = function() {
route(registryUI.taglist.name);
};
</script> </script>
<!-- End of tag --> <!-- End of tag -->
</taglist> </taglist>