2020-02-23 16:38:15 +00:00
|
|
|
<template>
|
2021-08-16 16:32:18 +00:00
|
|
|
<SmartModal v-if="show" :title="$t('environment.new')" @close="hideModal">
|
2021-06-30 08:46:02 +00:00
|
|
|
<template #body>
|
2021-07-17 17:40:28 +00:00
|
|
|
<div class="flex flex-col px-2">
|
2021-07-09 17:19:45 +00:00
|
|
|
<input
|
|
|
|
|
id="selectLabelEnvAdd"
|
|
|
|
|
v-model="name"
|
2021-08-08 17:14:05 +00:00
|
|
|
v-focus
|
2021-08-07 09:21:13 +00:00
|
|
|
class="input floating-input"
|
|
|
|
|
placeholder=" "
|
2021-07-09 17:19:45 +00:00
|
|
|
type="text"
|
2021-08-29 11:14:18 +00:00
|
|
|
autocomplete="off"
|
2021-07-09 17:19:45 +00:00
|
|
|
@keyup.enter="addNewEnvironment"
|
|
|
|
|
/>
|
2021-08-07 09:21:13 +00:00
|
|
|
<label for="selectLabelEnvAdd">
|
2021-08-18 16:47:31 +00:00
|
|
|
{{ $t("action.label") }}
|
2021-08-07 09:21:13 +00:00
|
|
|
</label>
|
2021-07-09 17:19:45 +00:00
|
|
|
</div>
|
2021-06-30 08:46:02 +00:00
|
|
|
</template>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<span>
|
2021-08-18 18:40:57 +00:00
|
|
|
<ButtonPrimary
|
|
|
|
|
:label="$t('action.save')"
|
|
|
|
|
@click.native="addNewEnvironment"
|
|
|
|
|
/>
|
|
|
|
|
<ButtonSecondary
|
|
|
|
|
:label="$t('action.cancel')"
|
|
|
|
|
@click.native="hideModal"
|
|
|
|
|
/>
|
2021-06-30 08:46:02 +00:00
|
|
|
</span>
|
|
|
|
|
</template>
|
2021-03-01 03:58:14 +00:00
|
|
|
</SmartModal>
|
2020-02-23 16:38:15 +00:00
|
|
|
</template>
|
|
|
|
|
|
2021-06-05 02:41:07 +00:00
|
|
|
<script lang="ts">
|
2021-08-24 03:44:46 +00:00
|
|
|
import { defineComponent } from "@nuxtjs/composition-api"
|
2021-06-05 02:41:07 +00:00
|
|
|
import { createEnvironment } from "~/newstore/environments"
|
2020-02-23 19:00:22 +00:00
|
|
|
|
2021-08-24 03:44:46 +00:00
|
|
|
export default defineComponent({
|
2020-02-23 16:38:15 +00:00
|
|
|
props: {
|
2020-02-24 18:44:50 +00:00
|
|
|
show: Boolean,
|
2020-02-23 16:38:15 +00:00
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2021-06-05 02:41:07 +00:00
|
|
|
name: null as string | null,
|
2021-03-23 15:18:14 +00:00
|
|
|
}
|
|
|
|
|
},
|
2020-02-23 16:38:15 +00:00
|
|
|
methods: {
|
|
|
|
|
addNewEnvironment() {
|
2021-06-05 02:41:07 +00:00
|
|
|
if (!this.name) {
|
2021-08-20 09:38:54 +00:00
|
|
|
this.$toast.error(this.$t("environment.invalid_name").toString(), {
|
|
|
|
|
icon: "error_outline",
|
2021-08-11 11:27:40 +00:00
|
|
|
})
|
2020-02-24 18:44:50 +00:00
|
|
|
return
|
2020-02-23 16:38:15 +00:00
|
|
|
}
|
2021-06-05 02:41:07 +00:00
|
|
|
createEnvironment(this.name)
|
2021-05-20 08:54:14 +00:00
|
|
|
this.hideModal()
|
2020-02-23 16:38:15 +00:00
|
|
|
},
|
|
|
|
|
hideModal() {
|
2021-05-20 08:54:14 +00:00
|
|
|
this.name = null
|
2020-02-25 02:06:23 +00:00
|
|
|
this.$emit("hide-modal")
|
2020-02-24 18:44:50 +00:00
|
|
|
},
|
|
|
|
|
},
|
2021-06-05 02:41:07 +00:00
|
|
|
})
|
2020-02-23 16:38:15 +00:00
|
|
|
</script>
|