Use showError for errors
parent
69fb546cf2
commit
9aa4dd7a20
|
@ -10,6 +10,7 @@
|
||||||
"license": "agpl",
|
"license": "agpl",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nextcloud/l10n": "^1.6.0",
|
"@nextcloud/l10n": "^1.6.0",
|
||||||
|
"@nextcloud/paths": "^2.1.0",
|
||||||
"@nextcloud/vue": "^6.0.0-beta.6",
|
"@nextcloud/vue": "^6.0.0-beta.6",
|
||||||
"path-posix": "^1.0.0",
|
"path-posix": "^1.0.0",
|
||||||
"reflect-metadata": "^0.1.13",
|
"reflect-metadata": "^0.1.13",
|
||||||
|
@ -2217,6 +2218,14 @@
|
||||||
"core-js": "^3.6.4"
|
"core-js": "^3.6.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@nextcloud/paths": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@nextcloud/paths/-/paths-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-8wX0gqwez0bTuAS8A0OEiqbbp0ZsqLr07zSErmS6OYhh9KZcSt/kO6lQV5tnrFqIqJVsxwz4kHUjtZXh6DSf9Q==",
|
||||||
|
"dependencies": {
|
||||||
|
"core-js": "^3.6.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@nextcloud/router": {
|
"node_modules/@nextcloud/router": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@nextcloud/router/-/router-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/@nextcloud/router/-/router-2.0.0.tgz",
|
||||||
|
@ -13596,6 +13605,14 @@
|
||||||
"core-js": "^3.6.4"
|
"core-js": "^3.6.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@nextcloud/paths": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@nextcloud/paths/-/paths-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-8wX0gqwez0bTuAS8A0OEiqbbp0ZsqLr07zSErmS6OYhh9KZcSt/kO6lQV5tnrFqIqJVsxwz4kHUjtZXh6DSf9Q==",
|
||||||
|
"requires": {
|
||||||
|
"core-js": "^3.6.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@nextcloud/router": {
|
"@nextcloud/router": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@nextcloud/router/-/router-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/@nextcloud/router/-/router-2.0.0.tgz",
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nextcloud/l10n": "^1.6.0",
|
"@nextcloud/l10n": "^1.6.0",
|
||||||
|
"@nextcloud/paths": "^2.1.0",
|
||||||
"@nextcloud/vue": "^6.0.0-beta.6",
|
"@nextcloud/vue": "^6.0.0-beta.6",
|
||||||
"path-posix": "^1.0.0",
|
"path-posix": "^1.0.0",
|
||||||
"reflect-metadata": "^0.1.13",
|
"reflect-metadata": "^0.1.13",
|
||||||
|
|
|
@ -39,9 +39,10 @@
|
||||||
import { Component, Prop, Emit, Mixins } from 'vue-property-decorator';
|
import { Component, Prop, Emit, Mixins } from 'vue-property-decorator';
|
||||||
import { IDay, IPhoto } from "../types";
|
import { IDay, IPhoto } from "../types";
|
||||||
|
|
||||||
|
import { showError } from '@nextcloud/dialogs'
|
||||||
|
import { getPreviewUrl } from "../services/FileUtils";
|
||||||
import * as dav from "../services/DavRequests";
|
import * as dav from "../services/DavRequests";
|
||||||
import errorsvg from "../assets/error.svg";
|
import errorsvg from "../assets/error.svg";
|
||||||
import { getPreviewUrl } from "../services/FileUtils";
|
|
||||||
import GlobalMixin from '../mixins/GlobalMixin';
|
import GlobalMixin from '../mixins/GlobalMixin';
|
||||||
|
|
||||||
@Component({})
|
@Component({})
|
||||||
|
@ -132,7 +133,7 @@ export default class Photo extends Mixins(GlobalMixin) {
|
||||||
// Get this photo in the fileInfos
|
// Get this photo in the fileInfos
|
||||||
const photo = fileInfos.find(d => Number(d.fileid) === Number(this.data.fileid));
|
const photo = fileInfos.find(d => Number(d.fileid) === Number(this.data.fileid));
|
||||||
if (!photo) {
|
if (!photo) {
|
||||||
alert('Cannot find this photo anymore!');
|
showError('Cannot find this photo anymore!');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,8 @@ input[type=text] {
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Mixins } from 'vue-property-decorator';
|
import { Component, Mixins } from 'vue-property-decorator';
|
||||||
import GlobalMixin from '../mixins/GlobalMixin';
|
import GlobalMixin from '../mixins/GlobalMixin';
|
||||||
|
|
||||||
|
import { showError } from '@nextcloud/dialogs'
|
||||||
import UserConfig from '../mixins/UserConfig'
|
import UserConfig from '../mixins/UserConfig'
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
|
@ -51,7 +53,7 @@ export default class Settings extends Mixins(UserConfig, GlobalMixin) {
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
} else {
|
} else {
|
||||||
alert('Error updating settings');
|
showError('Error updating settings');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
import { getCurrentUser } from '@nextcloud/auth'
|
import { getCurrentUser } from '@nextcloud/auth'
|
||||||
import { generateUrl } from '@nextcloud/router'
|
import { generateUrl } from '@nextcloud/router'
|
||||||
|
import { encodePath } from '@nextcloud/paths'
|
||||||
|
import { showError } from '@nextcloud/dialogs'
|
||||||
|
import { translate as t, translatePlural as n } from '@nextcloud/l10n'
|
||||||
import { genFileInfo } from './FileUtils'
|
import { genFileInfo } from './FileUtils'
|
||||||
import client from './DavClient';
|
|
||||||
import { IFileInfo } from '../types';
|
import { IFileInfo } from '../types';
|
||||||
|
import axios from '@nextcloud/axios'
|
||||||
|
import client from './DavClient';
|
||||||
|
|
||||||
const props = `
|
const props = `
|
||||||
<oc:fileid />
|
<oc:fileid />
|
||||||
|
@ -192,6 +196,7 @@ export async function* deleteFilesByIds(fileIds: number[]) {
|
||||||
try {
|
try {
|
||||||
fileInfos = await getFiles(fileIds.filter(f => f));
|
fileInfos = await getFiles(fileIds.filter(f => f));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
showError(t('photos', 'Failed to delete files.'));
|
||||||
console.error('Failed to get file info for files to delete', fileIds, e);
|
console.error('Failed to get file info for files to delete', fileIds, e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -202,8 +207,9 @@ export async function* deleteFilesByIds(fileIds: number[]) {
|
||||||
try {
|
try {
|
||||||
await deleteFile(fileInfo.filename);
|
await deleteFile(fileInfo.filename);
|
||||||
return fileInfo.fileid as number;
|
return fileInfo.fileid as number;
|
||||||
} catch {
|
} catch (error) {
|
||||||
console.error('Failed to delete', fileInfo.filename)
|
console.error(t('photos', 'Failed to delete {fileName}.', fileInfo), error);
|
||||||
|
showError(t('photos', 'Failed to delete {fileName}.', fileInfo));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue