diff --git a/src/nginxconfig/scss/style.scss b/src/nginxconfig/scss/style.scss index f1be658..9acb84c 100644 --- a/src/nginxconfig/scss/style.scss +++ b/src/nginxconfig/scss/style.scss @@ -90,18 +90,9 @@ $highlight: #f2c94c; .field { &.is-horizontal { align-items: center; - } - - &.is-changed { - input { - &, - &:focus { - background: rgba($highlight, .35); - } - } - .checkbox { - background: rgba($highlight, .35); + &.is-aligned-top { + align-items: flex-start; } } @@ -122,9 +113,32 @@ $highlight: #f2c94c; padding: 0 ($margin * 1.5); } } + + .control { + + .control { + &:not(.is-expanded) { + margin-top: .25rem; + } + } + } + } + + .is-changed { + input { + &, + &:focus { + background: rgba($highlight, .35); + } + } + + .checkbox, + .radio { + background: rgba($highlight, .35); + } } - .checkbox { + .checkbox, + .radio { border-radius: $border-radius; padding: .25rem .5rem; diff --git a/src/nginxconfig/templates/app.vue b/src/nginxconfig/templates/app.vue index c56d4a3..1f6088f 100644 --- a/src/nginxconfig/templates/app.vue +++ b/src/nginxconfig/templates/app.vue @@ -49,9 +49,10 @@ limitations under the License. diff --git a/src/nginxconfig/templates/domain_sections/php.vue b/src/nginxconfig/templates/domain_sections/php.vue index a0234d6..67d4baa 100644 --- a/src/nginxconfig/templates/domain_sections/php.vue +++ b/src/nginxconfig/templates/domain_sections/php.vue @@ -27,19 +27,19 @@ }; export default { - name: 'DomainPHP', // Component name - display: 'PHP', // Display name for tab - key: 'php', // Key for data in parent - delegated: delegatedFromDefaults(defaults), // Data the parent will present here + name: 'DomainPHP', // Component name + display: 'PHP', // Display name for tab + key: 'php', // Key for data in parent + delegated: delegatedFromDefaults(defaults), // Data the parent will present here props: { - data: Object, // Data delegated back to us from parent + data: Object, // Data delegated back to us from parent }, data () { return { i18n, }; }, - computed: computedFromDefaults(defaults), // Getters & setters for the delegated data + computed: computedFromDefaults(defaults, 'php'), // Getters & setters for the delegated data watch: { // If the Reverse proxy is enabled, PHP will be forced off '$parent.$props.data': { diff --git a/src/nginxconfig/templates/domain_sections/server.vue b/src/nginxconfig/templates/domain_sections/server.vue index dd098e3..3be22b8 100644 --- a/src/nginxconfig/templates/domain_sections/server.vue +++ b/src/nginxconfig/templates/domain_sections/server.vue @@ -151,22 +151,22 @@ }; export default { - name: 'DomainServer', // Component name - display: 'Server', // Display name for tab - key: 'server', // Key for data in parent - delegated: delegatedFromDefaults(defaults), // Data the parent will present here + name: 'DomainServer', // Component name + display: 'Server', // Display name for tab + key: 'server', // Key for data in parent + delegated: delegatedFromDefaults(defaults), // Data the parent will present here components: { PrettyCheck, }, props: { - data: Object, // Data delegated back to us from parent + data: Object, // Data delegated back to us from parent }, data () { return { i18n, }; }, - computed: computedFromDefaults(defaults), // Getters & setters for the delegated data + computed: computedFromDefaults(defaults, 'server'), // Getters & setters for the delegated data watch: { // Only allow CDN when WWW is enabled first '$props.data.wwwSubdomain': { diff --git a/src/nginxconfig/util/computed_from_defaults.js b/src/nginxconfig/util/computed_from_defaults.js index 2a73c5d..5b57711 100644 --- a/src/nginxconfig/util/computed_from_defaults.js +++ b/src/nginxconfig/util/computed_from_defaults.js @@ -1,4 +1,6 @@ -export default (defaults) => { +import isChanged from './is_changed'; + +export default (defaults, cat) => { return Object.keys(defaults).reduce((prev, key) => { prev[key] = { get() { @@ -21,7 +23,7 @@ export default (defaults) => { }; prev[key + 'Changed'] = { get() { - return this.$props.data[key].enabled && this.$props.data[key].value !== this.$props.data[key].default; + return isChanged(this.$props.data[key], cat, key); }, }; return prev; diff --git a/src/nginxconfig/util/is_changed.js b/src/nginxconfig/util/is_changed.js new file mode 100644 index 0000000..2346c9e --- /dev/null +++ b/src/nginxconfig/util/is_changed.js @@ -0,0 +1,8 @@ +export default (prop, cat, key) => { + // Show as changed when enabled & not default + // Show php as changed when completely disabled (by reverse proxy) + // Show reverse proxy as changed when completely disabled (by php) + return (prop.enabled && prop.value !== prop.default) + || (cat === 'php' && key === 'php' && prop.computed !== prop.default) + || (cat === 'reverseProxy' && key === 'reverseProxy' && prop.computed !== prop.default); +};