Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// 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 {
// 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);
}
const view = (state, actions) =>
main([
h1(state.count),
div([
button({ onclick: e => actions.sum(-1) }, 'Sub'),
button({ onclick: e => actions.reset() }, 'Reset'),
button({ onclick: e => actions.sum(1) }, 'Add'),
]),
])
export default (code, message, detail, hide_back_button) =>
div({class: 'container text-center'}, [
div({class: 'display-1 text-muted mb-5'}, [
i({class: 'si si-exclamation'}),
code
]),
h1({class: 'h2 mb-3'}, message),
p({class: 'h4 text-muted font-weight-normal mb-7'}, detail),
hide_back_button ? null : a({class: 'btn btn-primary', href: 'javascript:history.back();'}, [
i({class: 'fe fe-arrow-left mr-2'}),
'Go back'
])
]);