Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Control saveDashboardModal display from parent #196

Merged
merged 11 commits into from
Jun 19, 2024
Prev Previous commit
Next Next commit
Merge branch 'main' into feat/dashboard-modal-close-on-confirm-save
# Conflicts:
#	packages/gridstack/src/components/ConfigurableDashboard/ConfigurableDashboard.vue
#	packages/gridstack/src/components/SaveDashboardModal/SaveDashboardModal.vue
  • Loading branch information
sk-saha committed Jun 18, 2024
commit 78a23eb01e1d40cc92e9cd76215e32f7cdc2f933
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@
@confirm-save="onConfirmSave"
/>
</DismissibleModal>
<DismissibleModal
v-model:modal-displayed="showDeleteModal"
class="basic-modal"
>
<DeleteDashboardModal
v-if="showDeleteModal"
:dashboard-name="selectedDashboardConfigurationName"
@confirm-delete="onDeleteDashboardConfiguration"
/>
</DismissibleModal>
</div>
</template>

Expand Down Expand Up @@ -82,6 +92,14 @@ const dashboardConfig = defineModel<WidgetConfiguration[]>('dashboardConfig', {
*/
const currentConfig = ref(dashboardConfig.value)
const editMode = ref<boolean>(false)
const showSaveModal = ref(false)
const showDeleteModal = ref<boolean>(false)
const selectedDashboardConfigurationName = computed(() => {
const config = props.dashboardConfigurationOptions.find(
(option) => option.id === selectedDashboardConfiguration.value
)
return config ? config.name : undefined
})

const prepareSave = () => {
showSaveModal.value = true
Expand All @@ -91,6 +109,7 @@ const onConfirmSave = (name: string) => {
editMode.value = false
currentConfig.value = dashboardConfig.value
emit('save', dashboardConfig.value, name)
showSaveModal.value = false
}

const onCancelEdit = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/>
<ErrorBox v-if="showError" class="error-message" :error="nameError" />
michigg marked this conversation as resolved.
Show resolved Hide resolved

<BaseButton :disabled="!name" @click="submitAndClose" class="save-button">
<BaseButton :disabled="!name" @click="submit" class="save-button">
Speichern
</BaseButton>
</div>
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.