1 <input type=
"text" class=
"cbi-input-text" name=
"isrc" placeholder=
"http://host/image.tar" id=
"isrc" />
2 <input type=
"text" class=
"cbi-input-text" name=
"itag" placeholder=
"repository:tag" id=
"itag" />
3 <div style=
"display: inline-block;">
4 <input type=
"button"" class=" cbi-button cbi-button-add
" id="btnimport
" name="import
" value="<%:Import%
>" />
5 <input type="file
" id="file_import
" style="visibility:hidden; position: absolute;top:
0px; left:
0px;
" />
8 <script type="text/javascript
">
9 let btnImport = document.getElementById('btnimport')
10 let valISrc = document.getElementById('isrc')
11 let valITag = document.getElementById('itag')
12 btnImport.onclick = function (e) {
13 if (valISrc.value == "") {
14 document.getElementById("file_import
").click()
17 let formData = new FormData()
18 formData.append('src', valISrc.value)
19 formData.append('tag', valITag.value)
20 let xhr = new XMLHttpRequest()
22 xhr.open("POST
", "<%=luci.dispatcher.build_url('admin/docker/images_import')%
>", true)
23 xhr.onload = function () {
29 let fileimport = document.getElementById('file_import')
30 fileimport.onchange = function (e) {
31 let fileimport = document.getElementById('file_import')
32 if (!fileimport.value) {
35 let valITag = document.getElementById('itag')
36 let fileName = fileimport.files[0].name
37 let formData = new FormData()
38 formData.append('upload-filename', fileName)
39 formData.append('tag', valITag.value)
40 formData.append('upload-archive', fileimport.files[0])
41 let xhr = new XMLHttpRequest()
43 xhr.open("POST
", "<%=luci.dispatcher.build_url('admin/docker/images_import')%
>", true)
44 xhr.onload = function () {
51 let new_tag = function (image_id) {
52 let new_tag = prompt("<%:New tag%
>\n<%:Image%
>" + "ID:
" + image_id + "\n<%:Please input new tag%
>:
", "")
54 (new XHR()).post("<%=luci.dispatcher.build_url('admin/docker/images_tag')%
>",
55 { id: image_id, tag: new_tag },
57 if (r.status == 201) {
61 docker_status_message('warning', 'Image: untagging ' + tag + '...fail code:' + r.status + r.statusText);
62 document.getElementById('docker_apply_overlay').addEventListener("click
", (e)=>{
63 docker_status_message()
70 let un_tag = function (tag) {
71 if (tag.match("<none>")) return
72 if (confirm("<%:Remove tag%
>:
" + tag + " ?
")) {
73 (new XHR()).post("<%=luci.dispatcher.build_url('admin/docker/images_untag')%
>",
76 if (r.status == 200) {
80 docker_status_message('warning', 'Image: untagging ' + tag + '...fail code:' + r.status + r.statusText);
81 document.getElementById('docker_apply_overlay').addEventListener("click
", (e)=>{
82 docker_status_message()