VersionEntry Tooltip added

This commit is contained in:
Terry 2021-05-12 13:45:48 +02:00
parent cda48ad3f8
commit b075dec86d
3 changed files with 48 additions and 23 deletions

View File

@ -41781,6 +41781,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
//
//
//
//
@ -41852,34 +41853,31 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
var _this = this;
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
var revert;
var revertVersion;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.prev = 0;
_context.next = 3;
return Object(_services_DavClient__WEBPACK_IMPORTED_MODULE_8__["move"])(Object(_nextcloud_router__WEBPACK_IMPORTED_MODULE_6__["generateRemoteUrl"])("dav/versions/".concat(Object(_nextcloud_auth__WEBPACK_IMPORTED_MODULE_7__["getCurrentUser"])().uid) + _this.version.filename, '/restore/target', true));
return _services_DavClient__WEBPACK_IMPORTED_MODULE_8__["client"].move("dav/versions/".concat(Object(_nextcloud_auth__WEBPACK_IMPORTED_MODULE_7__["getCurrentUser"])().uid) + _this.version.filename, '/restore/target', true);
case 3:
revert = _context.sent;
_this.revert = revert;
return _context.abrupt("return", _this.revert);
revertVersion = _context.sent;
return _context.abrupt("return", revertVersion);
case 8:
_context.prev = 8;
case 7:
_context.prev = 7;
_context.t0 = _context["catch"](0);
_this.error = t('files_versions', 'There was an error reverting the version {file}', {
file: _this.fileInfo.basename
});
_this.error = t('files_versions', 'There was an error reverting the version {this.fileInfo.filename}');
Object(_nextcloud_dialogs__WEBPACK_IMPORTED_MODULE_9__["showError"])(_this.error);
case 12:
case 11:
case "end":
return _context.stop();
}
}
}, _callee, null, [[0, 8]]);
}, _callee, null, [[0, 7]]);
}))();
}
}
@ -63746,7 +63744,7 @@ __webpack_require__.r(__webpack_exports__);
var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});
// Module
___CSS_LOADER_EXPORT___.push([module.i, ".version-entry[data-v-29c8cb3b] .avatardiv img {\n border-radius: 0;\n}\n", ""]);
___CSS_LOADER_EXPORT___.push([module.i, ".version-entry[data-v-29c8cb3b] {\n display: flex;\n align-items: center;\n height: 44px;\n}\n.version-entry[data-v-29c8cb3b] .avatardiv img {\n border-radius: 0;\n}\n.version-entry__desc[data-v-29c8cb3b] {\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n padding: 8px;\n line-height: 1.2em;\n}\n.version-entry__desc p[data-v-29c8cb3b] {\n color: var(--color-text-maxcontrast);\n}\n.version-entry__desc-unique[data-v-29c8cb3b] {\n color: var(--color-text-maxcontrast);\n}\n.version-entry__actions[data-v-29c8cb3b] {\n margin-left: auto;\n}\n", ""]);
// Exports
/* harmony default export */ __webpack_exports__["default"] = (___CSS_LOADER_EXPORT___);
@ -117083,6 +117081,14 @@ var render = function() {
? _c(
"ListItemIcon",
{
directives: [
{
name: "tooltip",
rawName: "v-tooltip",
value: _vm.version.lastmod,
expression: "version.lastmod"
}
],
staticClass: "version-entry",
attrs: {
title: _vm.relativeDate,

File diff suppressed because one or more lines are too long

View File

@ -22,6 +22,7 @@
<li>
<ListItemIcon
v-if="!isLatestChange"
v-tooltip="version.lastmod"
:title="relativeDate"
:subtitle="formattedSize"
:url="iconUrl"
@ -49,7 +50,8 @@ import ListItemIcon from '@nextcloud/vue/dist/Components/ListItemIcon'
import { generateRemoteUrl } from '@nextcloud/router'
import { getCurrentUser } from '@nextcloud/auth'
import { move } from '../services/DavClient'
import { client } from '../services/DavClient'
import { showError } from '@nextcloud/dialogs'
export default {
@ -85,6 +87,7 @@ export default {
},
computed: {
// Does the current user have permissions to revert this file
canRevert() {
// TODO: implement permission check
@ -119,14 +122,11 @@ export default {
methods: {
async restoreVersion() {
// TODO: implement restore request and loading
try {
const revert = await move(generateRemoteUrl(`dav/versions/${getCurrentUser().uid}` + this.version.filename, '/restore/target', true))
this.revert = revert
return this.revert
} catch (error) {
this.error = t('files_versions', 'There was an error reverting the version {file}', {
file: this.fileInfo.basename,
})
try {
const revertVersion = await client.move(`dav/versions/${getCurrentUser().uid}` + this.version.filename, '/restore/target', true)
return revertVersion
} catch (error) {
this.error = t('files_versions', 'There was an error reverting the version {this.fileInfo.filename}')
showError(this.error)
}
},
@ -141,5 +141,24 @@ export default {
::v-deep .avatardiv img {
border-radius: 0;
}
display: flex;
align-items: center;
height: 44px;
&__desc {
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 8px;
line-height: 1.2em;
p {
color: var(--color-text-maxcontrast);
}
&-unique {
color: var(--color-text-maxcontrast);
}
}
&__actions {
margin-left: auto;
}
}
</style>