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; var _this = this;
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() { return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
var revert; var revertVersion;
return regeneratorRuntime.wrap(function _callee$(_context) { return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) { while (1) {
switch (_context.prev = _context.next) { switch (_context.prev = _context.next) {
case 0: case 0:
_context.prev = 0; _context.prev = 0;
_context.next = 3; _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: case 3:
revert = _context.sent; revertVersion = _context.sent;
_this.revert = revert; return _context.abrupt("return", revertVersion);
return _context.abrupt("return", _this.revert);
case 8: case 7:
_context.prev = 8; _context.prev = 7;
_context.t0 = _context["catch"](0); _context.t0 = _context["catch"](0);
_this.error = t('files_versions', 'There was an error reverting the version {file}', { _this.error = t('files_versions', 'There was an error reverting the version {this.fileInfo.filename}');
file: _this.fileInfo.basename
});
Object(_nextcloud_dialogs__WEBPACK_IMPORTED_MODULE_9__["showError"])(_this.error); Object(_nextcloud_dialogs__WEBPACK_IMPORTED_MODULE_9__["showError"])(_this.error);
case 12: case 11:
case "end": case "end":
return _context.stop(); 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]}); var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});
// Module // 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 // Exports
/* harmony default export */ __webpack_exports__["default"] = (___CSS_LOADER_EXPORT___); /* harmony default export */ __webpack_exports__["default"] = (___CSS_LOADER_EXPORT___);
@ -117083,6 +117081,14 @@ var render = function() {
? _c( ? _c(
"ListItemIcon", "ListItemIcon",
{ {
directives: [
{
name: "tooltip",
rawName: "v-tooltip",
value: _vm.version.lastmod,
expression: "version.lastmod"
}
],
staticClass: "version-entry", staticClass: "version-entry",
attrs: { attrs: {
title: _vm.relativeDate, title: _vm.relativeDate,

File diff suppressed because one or more lines are too long

View File

@ -22,6 +22,7 @@
<li> <li>
<ListItemIcon <ListItemIcon
v-if="!isLatestChange" v-if="!isLatestChange"
v-tooltip="version.lastmod"
:title="relativeDate" :title="relativeDate"
:subtitle="formattedSize" :subtitle="formattedSize"
:url="iconUrl" :url="iconUrl"
@ -49,7 +50,8 @@ import ListItemIcon from '@nextcloud/vue/dist/Components/ListItemIcon'
import { generateRemoteUrl } from '@nextcloud/router' import { generateRemoteUrl } from '@nextcloud/router'
import { getCurrentUser } from '@nextcloud/auth' import { getCurrentUser } from '@nextcloud/auth'
import { move } from '../services/DavClient' import { client } from '../services/DavClient'
import { showError } from '@nextcloud/dialogs' import { showError } from '@nextcloud/dialogs'
export default { export default {
@ -85,6 +87,7 @@ export default {
}, },
computed: { computed: {
// Does the current user have permissions to revert this file // Does the current user have permissions to revert this file
canRevert() { canRevert() {
// TODO: implement permission check // TODO: implement permission check
@ -120,13 +123,10 @@ export default {
async restoreVersion() { async restoreVersion() {
// TODO: implement restore request and loading // TODO: implement restore request and loading
try { try {
const revert = await move(generateRemoteUrl(`dav/versions/${getCurrentUser().uid}` + this.version.filename, '/restore/target', true)) const revertVersion = await client.move(`dav/versions/${getCurrentUser().uid}` + this.version.filename, '/restore/target', true)
this.revert = revert return revertVersion
return this.revert
} catch (error) { } catch (error) {
this.error = t('files_versions', 'There was an error reverting the version {file}', { this.error = t('files_versions', 'There was an error reverting the version {this.fileInfo.filename}')
file: this.fileInfo.basename,
})
showError(this.error) showError(this.error)
} }
}, },
@ -141,5 +141,24 @@ export default {
::v-deep .avatardiv img { ::v-deep .avatardiv img {
border-radius: 0; 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> </style>