-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip: Upgrade to Quasar 2 / Vue 3 : stop using toast/KPopupAction #393
- Loading branch information
cnouguier
committed
Aug 24, 2022
1 parent
652c40a
commit 29f7248
Showing
11 changed files
with
149 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<template> | ||
<KModal | ||
:title="$t('CatalogActivity.CREATE_ALERT_TITLE')" | ||
:buttons="buttons" | ||
> | ||
<AlertForm | ||
:ref="onFormReferenceCreated" | ||
:layer="layer" | ||
:feature="feature" | ||
:forecastModel="forecastModel" | ||
@form-ready="onFormReady" | ||
/> | ||
</KModal> | ||
</template> | ||
|
||
<script> | ||
import logger from 'loglevel' | ||
import { mixins as kdkCoreMixins } from '@kalisio/kdk/core.client' | ||
import AlertForm from './AlertForm.vue' | ||
export default { | ||
components: { | ||
AlertForm | ||
}, | ||
mixins: [ | ||
kdkCoreMixins.baseModal | ||
], | ||
props: { | ||
layer: { | ||
type: Object, | ||
default: () => null | ||
}, | ||
feature: { | ||
type: Object, | ||
default: () => null | ||
}, | ||
forecastModel: { | ||
type: Object, | ||
default: () => null | ||
} | ||
}, | ||
computed: { | ||
buttons () { | ||
return [ | ||
{ id: 'cancel-button', label: 'CANCEL', renderer: 'form-button', outline: true, handler: () => this.closeModal() }, | ||
{ id: 'apply-button', label: 'DONE', renderer: 'form-button', handler: () => this.apply() } | ||
] | ||
} | ||
}, | ||
data () { | ||
return { | ||
applyInProgress: false | ||
} | ||
}, | ||
methods: { | ||
async apply () { | ||
const result = this.form.validate() | ||
if (!result.isValid) return | ||
this.applyInProgress = true | ||
try { | ||
// Add notification prefix to be used at creation, | ||
// Indeed, as alerting is a background process it will not be able to easily guess the user locale | ||
const alert = Object.assign(result.values, { | ||
notification: { | ||
create: this.$t('EventNotifications.CREATE'), | ||
remove: this.$t('EventNotifications.REMOVE') | ||
} | ||
}) | ||
await this.$api.getService('alerts').create(alert) | ||
} catch (error) { | ||
logger.error(error) | ||
} | ||
this.applyInProgress = false | ||
this.closeModal() | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.