Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
} else if (!image.data || typeof image.data.tags === 'undefined' || image.data.tags === null || !image.data.tags.length) {
view.push(BigError(404, image_id + ' does not exist in this Registry',
a({
class: 'btn btn-link', onclick: function () {
actions.fetchImage(image_id);
}
}, 'Refresh')
));
} else {
// Show it
// This is where shit gets weird. Digest is the same for all tags, but only stored with a tag.
digest = image.data.tags[0].digest;
append_delete_model = delete_enabled && state.confirmDeleteImage === image_id;
view.push(h1({class: 'page-title mb-5'}, [
delete_enabled ? a({
class: 'btn btn-secondary btn-sm ml-2 pull-right', onclick: function () {
actions.updateState({confirmDeleteImage: image_id});
}
}, 'Delete') : null,
image_id
]));
view.push(div(image.data.tags.map(tag => ImageTag(tag, state.status.config))));
}
}
if (refresh) {
view.push(span({class: 'loader'}));
actions.fetchImage(image_id);
}
return div(
}
// if image doesn't exist in state: refresh
if (typeof state.images[image_id] === 'undefined' || !state.images[image_id]) {
refresh = true;
} else {
image = state.images[image_id];
// if image does exist, but hasn't been refreshed in < 30 seconds, refresh
if (image.timestamp < (now - 30)) {
refresh = true;
// if image does exist, but has error, show error
} else if (image.err) {
view.push(BigError(image.err.code, image.err.message,
a({
class: 'btn btn-link', onclick: function () {
actions.fetchImage(image_id);
}
}, 'Refresh')
));
// if image does exist, but has no error and no data, 404
} else if (!image.data || typeof image.data.tags === 'undefined' || image.data.tags === null || !image.data.tags.length) {
view.push(BigError(404, image_id + ' does not exist in this Registry',
a({
class: 'btn btn-link', onclick: function () {
actions.fetchImage(image_id);
}
}, 'Refresh')
));
} else {
export default (state, actions) => {
if (state.isLoading) {
return span({class: 'loader'});
} else {
if (state.globalError !== null && state.globalError) {
return BigError(state.globalError.code || '500', state.globalError.message,
[
p('There may be a problem communicating with the Registry'),
a({
class: 'btn btn-link', onclick: function () {
actions.bootstrap();
}
}, 'Refresh')
],
true
);
} else {
return div(
Route({path: '/', render: ImagesRoute(state, actions)}),
Route({path: '/image/:imageId', render: ImageRoute(state, actions)}),
Route({path: '/image/:imageDomain/:imageId', render: ImageRoute(state, actions)}),
Route({path: '/instructions/pushing', render: PushingRoute(state, actions)}),
Route({path: '/instructions/pulling', render: PullingRoute(state, actions)}),
Route({path: '/instructions/deleting', render: DeletingRoute(state, actions)})
);