Skip to content

Commit

Permalink
Use nc/dialogs instead of OCP.Toast
Browse files Browse the repository at this point in the history
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
  • Loading branch information
georgehrke committed Apr 17, 2020
1 parent c0615e3 commit 3745be4
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 7 deletions.
21 changes: 21 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@babel/polyfill": "^7.8.7",
"@nextcloud/auth": "^1.2.3",
"@nextcloud/axios": "^1.3.2",
"@nextcloud/dialogs": "^1.2.2",
"@nextcloud/initial-state": "^1.1.2",
"@nextcloud/l10n": "^1.2.3",
"@nextcloud/router": "^1.0.2",
Expand Down
7 changes: 4 additions & 3 deletions src/components/Admins.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import Vue from 'vue'
import ClickOutside from 'vue-click-outside'
import HttpClient from '@nextcloud/axios'
import { generateUrl } from '@nextcloud/router'
import { showError } from '@nextcloud/dialogs'
import Actions from '@nextcloud/vue/dist/Components/Actions'
import ActionButton from '@nextcloud/vue/dist/Components/ActionButton'
import Avatar from '@nextcloud/vue/dist/Components/Avatar'
Expand Down Expand Up @@ -99,7 +100,7 @@ export default {
Vue.set(this, 'admins', resp.data)
} catch (error) {
console.error(error)
this.$toast('Error loading additional administrator.')
showError('Error loading additional administrator.')
} finally {
this.isLoading = false
}
Expand Down Expand Up @@ -132,7 +133,7 @@ export default {
this.admins.push(response.data)
} catch (error) {
console.error(error)
this.$toast('Error adding new administrator.')
showError('Error adding new administrator.')
} finally {
this.isSavingChanges = false
this.isAdding = false
Expand All @@ -157,7 +158,7 @@ export default {
}
} catch (error) {
console.error(error)
this.$toast('Error deleting new administrator.')
showError('Error deleting new administrator.')
}
},
},
Expand Down
3 changes: 2 additions & 1 deletion src/components/Encryption.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import { generateUrl } from '@nextcloud/router'
import Actions from '@nextcloud/vue/dist/Components/Actions'
import ActionButton from '@nextcloud/vue/dist/Components/ActionButton'
import { loadState } from '@nextcloud/initial-state'
import { showError } from '@nextcloud/dialogs'
export default {
name: 'Encryption',
Expand Down Expand Up @@ -123,7 +124,7 @@ export default {
await HttpClient.post(url, { enabled: this.fullDiskEncryptionEnabled ? '1' : '0' })
} catch (error) {
console.error(error)
this.$toast('Error saving new state of full-disk-encryption')
showError('Error saving new state of full-disk-encryption')
// Reset state
this.fullDiskEncryptionEnabled = !this.fullDiskEncryptionEnabled
Expand Down
3 changes: 2 additions & 1 deletion src/components/Location.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import Multiselect from '@nextcloud/vue/dist/Components/Multiselect'
import Actions from '@nextcloud/vue/dist/Components/Actions'
import ActionButton from '@nextcloud/vue/dist/Components/ActionButton'
import { loadState } from '@nextcloud/initial-state'
import { showError } from '@nextcloud/dialogs'
import {
getCountryList,
Expand Down Expand Up @@ -136,7 +137,7 @@ export default {
this.selectedCountry = value.code
} catch (error) {
console.error(error)
this.$toast('Error saving new location of the server')
showError('Error saving new location of the server')
} finally {
this.isEditingLocation = false
this.isSavingChanges = false
Expand Down
3 changes: 2 additions & 1 deletion src/components/Shares.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import Vue from 'vue'
import HttpClient from '@nextcloud/axios'
import { generateOcsUrl } from '@nextcloud/router'
import { getCurrentUser } from '@nextcloud/auth'
import { showError } from '@nextcloud/dialogs'
import Avatar from '@nextcloud/vue/dist/Components/Avatar'
export default {
Expand Down Expand Up @@ -92,7 +93,7 @@ export default {
})
} catch (error) {
console.error(error)
this.$toast('Error loading information about shares.')
showError('Error loading information about shares.')
} finally {
this.isLoading = false
}
Expand Down
3 changes: 2 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import 'core-js/stable'
import Vue from 'vue'
import { linkTo } from '@nextcloud/router'
import { translate, translatePlural } from '@nextcloud/l10n'
import { getRequestToken } from '@nextcloud/auth'

const Admins = () => import('./components/Admins.vue')
const Location = () => import('./components/Location.vue')
Expand All @@ -30,7 +31,7 @@ const Shares = () => import('./components/Shares.vue')

// CSP config for webpack dynamic chunk loading
// eslint-disable-next-line
__webpack_nonce__ = btoa(OC.requestToken)
__webpack_nonce__ = btoa(getRequestToken())

// Correct the root of the app for chunk loading
// OC.linkTo matches the apps folders
Expand Down

0 comments on commit 3745be4

Please sign in to comment.