translations and modal styles

This commit is contained in:
Westly Wright 2020-08-02 09:36:24 -07:00
parent d43806e762
commit 1b2430daa5
No known key found for this signature in database
GPG Key ID: 4FAB3D8673DC54A3
2 changed files with 162 additions and 126 deletions

View File

@ -174,6 +174,15 @@ containerResourceLimit:
requestsCpu: CPU Reservation requestsCpu: CPU Reservation
requestsMemory: Memory Reservation requestsMemory: Memory Reservation
cruResource:
previewYaml: Preview Yaml
cancel: Cancelling will destroy your changes.
back: Going back will destroy your changes.
confirmYaml: "No, Review Yaml"
backToForm: Go Back To Form
confirmCancel: "Yes, Cancel"
confirmBack: "Yes, Go Back"
footer: footer:
docs: Docs docs: Docs
download: Download CLI download: Download CLI

View File

@ -40,7 +40,7 @@ export default {
return { return {
isCancelModal: false, isCancelModal: false,
showAsForm: true, showAsForm: true,
resourceYaml: '', resourceYaml: ''
}; };
}, },
methods: { methods: {
@ -48,12 +48,17 @@ export default {
if (isCancel) { if (isCancel) {
// this.$modal.show('cancel') pass translation options // this.$modal.show('cancel') pass translation options
this.isCancelModal = true; this.isCancelModal = true;
} else {
this.isCancelModal = false;
} }
this.$modal.show('cancel-modal'); this.$modal.show('cancel-modal');
}, },
confirmCancel(isCancel) { confirmCancel(isCancel) {
this.$modal.hide('cancel-modal');
if (isCancel) { if (isCancel) {
this.isCancelModal = false;
this.$router.replace({ this.$router.replace({
name: this.doneRoute, name: this.doneRoute,
params: { resource: this.resource.type } params: { resource: this.resource.type }
@ -78,10 +83,8 @@ export default {
</script> </script>
<template> <template>
<form <section>
v-if="showAsForm" <form v-if="showAsForm" class="create-resource-container">
class="create-resource-container"
>
<div v-if="subtypes.length && !selectedSubtype" class="subtypes-container"> <div v-if="subtypes.length && !selectedSubtype" class="subtypes-container">
<slot name="subtypes"> <slot name="subtypes">
<div <div
@ -144,8 +147,13 @@ export default {
</button> </button>
<div> <div>
<button v-if="selectedSubtype || !subtypes.length" type="button" class="btn role-secondary" @click="showPreviewYaml"> <button
Preview Yaml v-if="selectedSubtype || !subtypes.length"
type="button"
class="btn role-secondary"
@click="showPreviewYaml"
>
<t k="cruResource.previewYaml" />
</button> </button>
<button <button
:disabled="!canCreate" :disabled="!canCreate"
@ -181,11 +189,7 @@ export default {
<button type="button" class="btn role-secondary" @click="checkCancel(false)"> <button type="button" class="btn role-secondary" @click="checkCancel(false)">
<t k="generic.back" /> <t k="generic.back" />
</button> </button>
<button <button type="button" class="btn role-primary" @click="yamlSave">
type="button"
class="btn role-primary"
@click="yamlSave"
>
<t k="generic.create" /> <t k="generic.create" />
</button> </button>
</div> </div>
@ -193,42 +197,38 @@ export default {
</div> </div>
</template> </template>
</ResourceYaml> </ResourceYaml>
</section>
<modal <modal
class="confirm-modal" class="confirm-modal"
name="cancel-modal" name="cancel-modal"
:width="350" :width="400"
height="auto" height="auto"
styles="background-color: var(--nav-bg); border-radius: var(--border-radius); overflow: scroll; max-height: 100vh;"
> >
<div class="header"> <div class="header">
<h4 class="text-default-text"> <h4 class="text-default-text">
Go Back To Form <t k="cruResource.backToForm" />
</h4> </h4>
</div> </div>
<div class="body"> <div class="body">
<p v-if="isCancelModal"> <p v-if="isCancelModal">
Cancelling will destroy your changes. <t k="cruResource.cancel" />
</p> </p>
<p v-else> <p v-else>
Going back will destroy your changes. <t k="cruResource.back" />
</p> </p>
</div> </div>
<div class="footer"> <div class="footer">
<button type="button" class="btn role-secondary" @click="$modal.hide('cancel-modal')">
No, Review Yaml
</button>
<button <button
type="button" type="button"
class="btn role-primary" class="btn role-secondary"
@click="confirmCancel(isCancelModal)" @click="$modal.hide('cancel-modal')"
> >
<span v-if="isCancelModal"> <t k="cruResource.confirmYaml" />
Yes, Cancel. </button>
</span> <button type="button" class="btn role-primary" @click="confirmCancel(isCancelModal)">
<span v-else> <span v-if="isCancelModal"><t k="cruResource.confirmCancel" /></span>
Yes, go back. <span v-else><t k="cruResource.confirmBack" /></span>
</span>
</button> </button>
</div> </div>
</modal> </modal>
@ -236,6 +236,33 @@ export default {
</template> </template>
<style lang='scss'> <style lang='scss'>
.confirm-modal {
.v--modal-box {
background-color: var(--default);
box-shadow: none;
min-height: 200px;
.body {
min-height: 75px;
padding: 10px 0 0 15px;
p {
margin-top: 10px;
}
}
.header {
background-color: #4F3335;
padding: 15px 0 0 15px;
}
.header,
.footer {
height: 50px;
}
.footer {
border-top: 1px solid var(--border);
text-align: center;
padding: 10px 0 0 15px;
}
}
}
.subtypes-container { .subtypes-container {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;