Redo UI of the tag history timeline and add restoration

This commit is contained in:
Joseph Schorr 2017-03-03 18:41:26 -05:00
parent e90cab4d77
commit 25db46c341
8 changed files with 256 additions and 90 deletions

View file

@ -11,54 +11,115 @@
<div class="empty-secondary-msg">There has not been any recent tag activity on this repository.</div>
</div>
<div class="history-entry" ng-repeat="entry in historyEntries"
ng-class="getEntryClasses(entry, filter)">
<div class="history-date-break" ng-if="entry.date_break">
{{ entry.date | amDateFormat:'dddd, MMMM Do YYYY' }}
</div>
<div ng-if="!entry.date_break">
<div class="history-icon-container">
<div class="history-icon" data-title="{{ isCurrent(entry) ? 'Current view of this tag' : 'The value of this tag has changed since this action' }}" data-container="body" bs-tooltip></div>
</div>
<div class="history-text">
<div class="history-description">
<span class="tag-span"
ng-click="showHistory(true, entry.tag_name)">{{ entry.tag_name }}</span>
<span ng-switch on="entry.action">
<span ng-switch-when="create">
was created pointing to
<span class="image-link" repository="repository"
image-id="entry.docker_image_id"
manifest-digest="entry.manifest_digest"></span>
<table class="co-table" ng-if="historyEntries.length">
<thead>
<td class="icon-col"></td>
<td class="history-col">Tag Change</td>
<td class="datetime-col">Date/Time</td>
<td class="revert-col"><span ng-if="repository.can_write">Restore</span></td>
</thead>
<tbody>
<tr style="height: 20px;"><td colspan="4"></td></tr>
<tr ng-repeat="entry in historyEntries" class="history-entry" ng-class="getEntryClasses(entry, filter)">
<td ng-if="entry.date_break" class="icon-col">
<i class="fa fa-calendar datetime-icon"></i>
</td>
<td class="history-row" ng-if="entry.date_break" colspan="2">
{{ entry.date | amDateFormat:'dddd, MMMM Do YYYY' }}
</td>
<td ng-if="!entry.date_break" class="icon-col">
<div class="history-icon" data-title="{{ isCurrent(entry) ? 'Current view of this tag' : 'The value of this tag has changed since this action' }}" data-container="body" bs-tooltip></div>
</td>
<td ng-if="!entry.date_break" class="history-col">
<div class="history-description">
<span class="tag-span" data-title="{{ entry.tag_name }}" bs-tooltip><span>{{ entry.tag_name }}</span></span>
<span ng-switch on="entry.action">
<span ng-switch-when="recreate">
was recreated pointing to
<span class="image-link" repository="repository"
image-id="entry.docker_image_id"
manifest-digest="entry.manifest_digest"></span>
</span>
<span ng-switch-when="create">
was created pointing to
<span class="image-link" repository="repository"
image-id="entry.docker_image_id"
manifest-digest="entry.manifest_digest"></span>
</span>
<span ng-switch-when="delete">
was deleted
</span>
<span ng-switch-when="move">
was moved to
<span class="image-link" repository="repository"
image-id="entry.docker_image_id"
manifest-digest="entry.manifest_digest"></span>
from
<span class="image-link" repository="repository"
image-id="entry.old_docker_image_id"
manifest-digest="entry.old_manifest_digest"></span>
</span>
<span ng-switch-when="revert">
was reverted to
<span class="image-link" repository="repository"
image-id="entry.docker_image_id"
manifest-digest="entry.manifest_digest"></span>
from
<span class="image-link" repository="repository"
image-id="entry.old_docker_image_id"
manifest-digest="entry.old_manifest_digest"></span>
</span>
</span>
<span ng-switch-when="delete">
was deleted
</div>
</td>
<td ng-if="!entry.date_break" class="datetime-col">
<div class="history-datetime">{{ entry.time | amDateFormat:'dddd, MMMM Do YYYY, h:mm:ss a' }}</div>
</td>
<td class="revert-col">
<div ng-if="!entry.date_break && repository.can_write" class="history-revert">
<span ng-switch on="entry.action">
<a ng-switch-when="create" ng-click="askRestoreTag(entry, true)" ng-if="!isCurrent(entry)">
Restore <span class="tag-span"><span>{{ entry.tag_name }}</span></span> to
<span class="image-link" repository="repository"
image-id="entry.docker_image_id"
manifest-digest="entry.manifest_digest"></span>
</a>
<a ng-switch-when="recreate" ng-click="askRestoreTag(entry, true)" ng-if="!isCurrent(entry)">
Restore <span class="tag-span"><span>{{ entry.tag_name }}</span></span> to
<span class="image-link" repository="repository"
image-id="entry.docker_image_id"
manifest-digest="entry.manifest_digest"></span>
</a>
<a ng-switch-when="delete" ng-click="askRestoreTag(entry, true)">
Restore <span class="tag-span"><span>{{ entry.tag_name }}</span></span> to
<span class="image-link" repository="repository"
image-id="entry.docker_image_id"
manifest-digest="entry.manifest_digest"></span>
</a>
<a ng-switch-when="move" ng-click="askRestoreTag(entry, false)" ng-if="!isCurrent(entry)">
Restore <span class="tag-span" data-title="{{ entry.tag_name }}" bs-tooltip><span>{{ entry.tag_name }}</span></span> to
<span class="image-link" repository="repository"
image-id="entry.old_docker_image_id"
manifest-digest="entry.old_manifest_digest"></span>
</a>
<a ng-switch-when="revert" ng-click="askRestoreTag(entry, false)" ng-if="!isCurrent(entry)">
Restore <span class="tag-span" data-title="{{ entry.tag_name }}" bs-tooltip><span>{{ entry.tag_name }}</span></span> to
<span class="image-link" repository="repository"
image-id="entry.old_docker_image_id"
manifest-digest="entry.old_manifest_digest"></span>
</a>
</span>
<span ng-switch-when="move">
was moved to
<span class="image-link" repository="repository"
image-id="entry.docker_image_id"
manifest-digest="entry.manifest_digest"></span>
from
<span class="image-link" repository="repository"
image-id="entry.old_docker_image_id"
manifest-digest="entry.old_manifest_digest"></span>
</span>
<span ng-switch-when="revert">
was reverted to
<span class="image-link" repository="repository"
image-id="entry.docker_image_id"
manifest-digest="entry.manifest_digest"></span>
from
<span class="image-link" repository="repository"
image-id="entry.old_docker_image_id"
manifest-digest="entry.old_manifest_digest"></span>
</span>
</span>
</div>
<div class="history-datetime">{{ entry.time | amDateFormat:'dddd, MMMM Do YYYY, h:mm:ss a' }}</div>
</div>
</div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tag-operations-dialog" repository="repository"
image-loader="imageLoader"
action-handler="tagActionHandler"></div>
</div>

View file

@ -106,19 +106,21 @@
</div>
</div>
<!-- Recert Tag Confirm -->
<!-- Restore Tag Confirm -->
<div class="cor-confirm-dialog"
dialog-context="revertTagInfo"
dialog-action="revertTag(info.tag, info.image_id, callback)"
dialog-title="Revert Tag"
dialog-action-title="Revert Tag">
dialog-context="restoreTagInfo"
dialog-action="restoreTag(info.tag, info.image_id, info.manifest_digest, callback)"
dialog-title="Restore Tag"
dialog-action-title="Restore Tag">
<div class="co-alert co-alert-warning">
This will change the image to which the tag points.
</div>
Are you sure you want to revert tag
<span class="label label-default tag">{{ revertTagInfo.tag.name }}</span> to image
<span class="image-id">{{ revertTagInfo.image_id.substr(0, 12) }}?</span>
Are you sure you want to restore tag
<span class="label label-default tag">{{ restoreTagInfo.tag.name }}</span> to image
<span class="image-link" repository="repository"
image-id="restoreTagInfo.image_id"
manifest-digest="restoreTagInfo.manifest_digest"></span>?
</div>
</div>