parent
711c4e1da4
commit
2e87d37301
@ -0,0 +1,47 @@
|
||||
<template>
|
||||
<section class="BackgroundPolling" ref="injectionHTMLElement">
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BackgroundPollingView from 'dashboard/views/dashboard/background-polling/background-polling-view';
|
||||
|
||||
export default {
|
||||
name: 'BackgroundPollingView',
|
||||
props: {
|
||||
routeType: {
|
||||
type: String,
|
||||
default: 'maps'
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
this.backgroundPollingView = this.renderView();
|
||||
},
|
||||
beforeDestroy () {
|
||||
this.backgroundPollingView.clean();
|
||||
},
|
||||
methods: {
|
||||
getBackgroundPollingView () {
|
||||
return this.backgroundPollingView;
|
||||
},
|
||||
renderView () {
|
||||
const backgroundPollingModel = this.$cartoModels.backgroundPolling;
|
||||
const configModel = this.$cartoModels.config;
|
||||
const userModel = this.$cartoModels.user;
|
||||
|
||||
// Tener cuidado porque la ruta puede cambiar e isMaps no se actualizará
|
||||
const backgroundPollingView = new BackgroundPollingView({
|
||||
model: backgroundPollingModel,
|
||||
createVis: this.$props.routeType === 'maps',
|
||||
userModel,
|
||||
configModel,
|
||||
el: this.$refs.injectionHTMLElement
|
||||
});
|
||||
|
||||
backgroundPollingView.render();
|
||||
|
||||
return backgroundPollingView;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -0,0 +1,34 @@
|
||||
<template>
|
||||
<button @click="openCreateModal">Create Map</button>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CreateDialog from 'new-dashboard/components/Dialogs/CreateDialog.vue';
|
||||
|
||||
export default {
|
||||
name: 'CreateButton',
|
||||
props: {
|
||||
visualizationType: {
|
||||
type: String,
|
||||
default: 'maps'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
openCreateModal () {
|
||||
this.$modal.show({
|
||||
template: `<CreateDialog :dialogType="dialogType" :backgroundPollingView="backgroundPollingView" v-on:close="$emit('close')"/>`,
|
||||
props: ['dialogType', 'backgroundPollingView'],
|
||||
components: { CreateDialog }
|
||||
},
|
||||
{
|
||||
dialogType: this.$props.visualizationType,
|
||||
backgroundPollingView: this.$parent.$parent.$refs.backgroundPollingView.getBackgroundPollingView()
|
||||
},
|
||||
{
|
||||
width: '100%',
|
||||
height: '100%'
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -0,0 +1,80 @@
|
||||
<template>
|
||||
<section class="Dialog is-white">
|
||||
<div class="Dialog-contentWrapper Dialog-contentWrapper--withHeaderWrapper js-content">
|
||||
<div class="Dialog-content Dialog-content--expanded" ref="injectionHTMLElement"></div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import DialogView from 'dashboard/views/dashboard/dialogs/create-dialog/dialog-view';
|
||||
import Factories from 'new-dashboard/plugins/backbone/factories';
|
||||
|
||||
export default {
|
||||
name: 'CreateDialog',
|
||||
props: {
|
||||
dialogType: String,
|
||||
backgroundPollingView: Object
|
||||
},
|
||||
mounted () {
|
||||
this.createDialog = this.renderDialog();
|
||||
},
|
||||
beforeDestroy () {
|
||||
this.createDialog.clean();
|
||||
},
|
||||
methods: {
|
||||
renderDialog () {
|
||||
const configModel = this.$cartoModels.config;
|
||||
const userModel = this.$cartoModels.user;
|
||||
const backgroundPollingModel = this.$cartoModels.backgroundPolling;
|
||||
|
||||
const modalModel = Factories.ModalModel({
|
||||
destroy: function () { this.$emit('close'); }.bind(this)
|
||||
});
|
||||
|
||||
const routerModel = {
|
||||
isDatasets: () => this.$props.dialogType === 'datasets',
|
||||
isMaps: () => this.$props.dialogType === 'maps'
|
||||
};
|
||||
|
||||
DialogView.setViewProperties({
|
||||
userModel,
|
||||
configModel,
|
||||
pollingModel: backgroundPollingModel,
|
||||
pollingView: this.$props.backgroundPollingView,
|
||||
routerModel: {
|
||||
model: routerModel
|
||||
}
|
||||
});
|
||||
|
||||
DialogView.addProperties({
|
||||
mamufasView: {
|
||||
enable: () => {},
|
||||
disable: () => {}
|
||||
}
|
||||
});
|
||||
|
||||
const DialogViewInstance = DialogView.openDialog(
|
||||
{ modalModel },
|
||||
{
|
||||
selectedItems: [],
|
||||
modalModel,
|
||||
viewElement: this.$refs.injectionHTMLElement
|
||||
}
|
||||
);
|
||||
|
||||
DialogViewInstance.render();
|
||||
|
||||
return DialogViewInstance;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.Dialog {
|
||||
* {
|
||||
box-sizing: content-box;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -0,0 +1,6 @@
|
||||
|
||||
import ModalModel from './modal-model';
|
||||
|
||||
export default {
|
||||
ModalModel
|
||||
};
|
@ -0,0 +1,5 @@
|
||||
export default function createModalModel (handlers) {
|
||||
return {
|
||||
destroy: handlers.destroy
|
||||
};
|
||||
}
|
Loading…
Reference in new issue