@@ -36,6 +36,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
36
36
waves-center =" true"
37
37
rounded =" true"
38
38
outlined
39
+ onClick =" { showDockerfile }"
39
40
>
40
41
Dockerfile
41
42
</material-button >
@@ -44,6 +45,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
44
45
<div if =" { ! state .loadend }" class =" spinner-wrapper" >
45
46
<material-spinner ></material-spinner >
46
47
</div >
48
+ <dockerfile
49
+ opened =" { state .showDockerfile }"
50
+ on-close =" { onDockerfileClose }"
51
+ elements =" { state .elements }"
52
+ ></dockerfile >
47
53
48
54
<material-tabs
49
55
if =" { state .archs && state .loadend }"
@@ -67,11 +73,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
67
73
<script >
68
74
import { DockerImage } from ' ../../scripts/docker-image' ;
69
75
import { bytesToSize } from ' ../../scripts/utils' ;
76
+ import Dockerfile from ' ../dialogs/dockerfile.riot' ;
70
77
import router from ' ../../scripts/router' ;
71
78
import TagHistoryElement from ' ./tag-history-element.riot' ;
72
79
export default {
73
80
components: {
74
81
TagHistoryElement,
82
+ Dockerfile,
75
83
},
76
84
onBeforeMount (props , state ) {
77
85
state .elements = [];
@@ -115,10 +123,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
115
123
for (var attribute in elt) {
116
124
if (elt .hasOwnProperty (attribute) && attribute != ' empty_layer' ) {
117
125
const value = elt[attribute];
118
- const guiElement = {
119
- ' key' : attribute,
120
- ' value' : modifySpecificAttributeTypes (attribute, value),
121
- };
126
+ const guiElement = modifySpecificAttributeTypes (attribute, value);
122
127
guiElements .push (guiElement);
123
128
}
124
129
}
@@ -153,6 +158,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
153
158
toTaglist () {
154
159
return router .taglist (this .props .image );
155
160
},
161
+ showDockerfile () {
162
+ console .log (this );
163
+ this .update ({ showDockerfile: true });
164
+ },
165
+ onDockerfileClose () {
166
+ this .update ({ showDockerfile: false });
167
+ },
156
168
};
157
169
const eltIdx = function (e ) {
158
170
switch (e) {
@@ -181,27 +193,47 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
181
193
return eltIdx (e1 .key ) - eltIdx (e2 .key );
182
194
};
183
195
184
- const modifySpecificAttributeTypes = function (attribute , value ) {
185
- switch (attribute) {
196
+ const parseCreatedBy = (value ) => {
197
+ if (value .startsWith (' COPY' )) {
198
+ return {
199
+ value: ' COPY' ,
200
+ content: value .replace (/ ^ COPY / , ' ' ),
201
+ };
202
+ }
203
+ let cmd = value .match (/ \/ bin\/ sh * -c * #\( nop\) * ([A-Z ] + ) (. * )/ );
204
+ return {
205
+ value: (cmd && cmd[1 ]) || ' RUN' ,
206
+ content: (cmd && cmd[2 ]) || value .replace (/ ^ \/ bin\/ sh * -c * (#\( nop\) )? / , ' ' ),
207
+ };
208
+ };
209
+
210
+ const modifySpecificAttributeTypes = function (key , value ) {
211
+ switch (key) {
186
212
case ' created' :
187
- return new Date (value).toLocaleString ();
213
+ return { key, value : new Date (value).toLocaleString () } ;
188
214
case ' created_by' :
189
- const cmd = value .match (/ \/ bin\/ sh * -c * #\( nop\) * ([A-Z ] + )/ );
190
- return (cmd && cmd[1 ]) || ' RUN' ;
215
+ const cmd = value .match (/ \/ bin\/ sh * -c * #\( nop\) * ([A-Z ] + ) (. * )/ );
216
+ return {
217
+ key,
218
+ ... parseCreatedBy (value),
219
+ };
191
220
case ' size' :
192
- return bytesToSize (value);
221
+ return { key, value : bytesToSize (value) } ;
193
222
case ' Entrypoint' :
194
223
case ' Cmd' :
195
- return (value || []).join (' ' );
224
+ return { key, value : (value || []).join (' ' ) } ;
196
225
case ' Labels' :
197
- return Object .keys (value || {}).map (function (elt ) {
198
- return value[elt] ? elt + ' =' + value[elt] : ' ' ;
199
- });
226
+ return {
227
+ key,
228
+ value: Object .keys (value || {}).map (function (elt ) {
229
+ return value[elt] ? elt + ' =' + value[elt] : ' ' ;
230
+ }),
231
+ };
200
232
case ' Volumes' :
201
233
case ' ExposedPorts' :
202
- return Object .keys (value);
234
+ return { key, value : Object .keys (value) } ;
203
235
}
204
- return value || ' ' ;
236
+ return { key, value: value || ' ' } ;
205
237
};
206
238
207
239
const getConfig = function (blobs , { historyCustomLabels }) {
0 commit comments