Presets all work now with computed values
This commit is contained in:
parent
6decf98b1d
commit
27ad3cbea2
|
@ -16,3 +16,51 @@ limitations under the License.
|
||||||
|
|
||||||
$header: #0071fe;
|
$header: #0071fe;
|
||||||
@import "~do-bulma/src/style";
|
@import "~do-bulma/src/style";
|
||||||
|
|
||||||
|
.do-bulma {
|
||||||
|
.tabs {
|
||||||
|
ul {
|
||||||
|
li {
|
||||||
|
&.is-before {
|
||||||
|
a {
|
||||||
|
color: mix($dark-grey, $primary);
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
background: rgba($primary, .5);
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: $dark-blue;
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
background: $dark-blue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel {
|
||||||
|
margin-top: 0;
|
||||||
|
padding: 2rem 0;
|
||||||
|
|
||||||
|
.container {
|
||||||
|
padding: 0 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tabs {
|
||||||
|
ul {
|
||||||
|
padding: 0 1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.buttons-group {
|
||||||
|
align-items: center;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -15,10 +15,10 @@ limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div class="panel">
|
||||||
<div class="tabs">
|
<div class="tabs">
|
||||||
<ul>
|
<ul>
|
||||||
<li v-for="tab in tabs" :class="active === tab.key ? 'is-active' : undefined">
|
<li v-for="tab in tabs" :class="tabClass(tab.key)">
|
||||||
<a @click="active = tab.key">{{ tab.display }}{{ changes(tab.key) }}</a>
|
<a @click="active = tab.key">{{ tab.display }}{{ changes(tab.key) }}</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -29,6 +29,7 @@ limitations under the License.
|
||||||
:key="tab.key"
|
:key="tab.key"
|
||||||
:data="$props.data[tab.key]"
|
:data="$props.data[tab.key]"
|
||||||
:style="{ display: active === tab.key ? 'block' : 'none' }"
|
:style="{ display: active === tab.key ? 'block' : 'none' }"
|
||||||
|
class="container"
|
||||||
></component>
|
></component>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -67,6 +68,12 @@ limitations under the License.
|
||||||
resetValue(tab, key) {
|
resetValue(tab, key) {
|
||||||
this.setValue(tab, key, this.$props.data[tab][key].default);
|
this.setValue(tab, key, this.$props.data[tab][key].default);
|
||||||
},
|
},
|
||||||
|
tabClass(tab) {
|
||||||
|
if (tab === this.$data.active) return 'is-active';
|
||||||
|
const tabs = this.$data.tabs.map(t => t.key);
|
||||||
|
if (tabs.indexOf(tab) < tabs.indexOf(this.$data.active)) return 'is-before';
|
||||||
|
return undefined;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -40,5 +40,22 @@
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: computedFromDefaults(defaults), // Getters & setters for the delegated data
|
computed: computedFromDefaults(defaults), // Getters & setters for the delegated data
|
||||||
|
watch: {
|
||||||
|
// If the Reverse proxy is enabled, PHP will be forced off
|
||||||
|
'$parent.$props.data.reverseProxy.reverseProxy.computed'() { this.checkPhpEnabled(); },
|
||||||
|
php() { this.checkPhpEnabled(); },
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
checkPhpEnabled() {
|
||||||
|
const state = this.$parent.$props.data.reverseProxy.reverseProxy.computed;
|
||||||
|
if (state) {
|
||||||
|
this.$props.data.php.enabled = false;
|
||||||
|
this.$props.data.php.computed = false;
|
||||||
|
} else {
|
||||||
|
this.$props.data.php.enabled = true;
|
||||||
|
this.$props.data.php.computed = this.$props.data.php.value;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<a v-for="(preset, key) in $props.data"
|
<div class="buttons-group">
|
||||||
:class="`button${preset.computed ? ' is-primary' : ''}`"
|
<a v-for="(preset, key) in $props.data"
|
||||||
@click="setPreset(key)"
|
:class="`button${preset.computed ? ' is-primary' : ''}`"
|
||||||
>
|
@click="setPreset(key)"
|
||||||
{{ preset.display }}
|
>
|
||||||
</a>
|
{{ preset.display }}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -19,41 +21,95 @@
|
||||||
default: false,
|
default: false,
|
||||||
display: 'Frontend',
|
display: 'Frontend',
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
computedCheck (data) {
|
||||||
|
return !data.php.php.computed
|
||||||
|
&& !data.python.python.computed
|
||||||
|
&& !data.reverseProxy.reverseProxy.computed
|
||||||
|
&& data.routing.index.computed === 'index.html'
|
||||||
|
&& data.routing.fallbackHtml.computed;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
php: {
|
php: {
|
||||||
default: true,
|
default: true,
|
||||||
display: 'PHP',
|
display: 'PHP',
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
computedCheck (data) {
|
||||||
|
return data.php.php.computed
|
||||||
|
&& data.routing.index.computed === 'index.php'
|
||||||
|
&& data.routing.fallbackPhp.computed
|
||||||
|
&& !data.routing.fallbackHtml.computed
|
||||||
|
&& !data.php.wordPressRules.computed
|
||||||
|
&& !data.php.drupalRules.computed
|
||||||
|
&& !data.php.magentoRules.computed;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
django: {
|
django: {
|
||||||
default: false,
|
default: false,
|
||||||
display: 'Django',
|
display: 'Django',
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
computedCheck (data) {
|
||||||
|
return data.python.python.computed
|
||||||
|
&& data.python.djangoRules.computed
|
||||||
|
&& !data.routing.root.computed;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
nodejs: {
|
nodejs: {
|
||||||
default: false,
|
default: false,
|
||||||
display: 'Node.js',
|
display: 'Node.js',
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
computedCheck (data) {
|
||||||
|
return data.reverseProxy.reverseProxy.computed
|
||||||
|
&& !data.routing.root.computed;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
singlePageApplication: {
|
singlePageApplication: {
|
||||||
default: false,
|
default: false,
|
||||||
display: 'Single-page application',
|
display: 'Single-page application',
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
computedCheck (data) {
|
||||||
|
return data.php.php.computed
|
||||||
|
&& data.routing.index.computed === 'index.html'
|
||||||
|
&& data.routing.fallbackHtml.computed;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
wordPress: {
|
wordPress: {
|
||||||
default: false,
|
default: false,
|
||||||
display: 'WordPress',
|
display: 'WordPress',
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
computedCheck (data) {
|
||||||
|
return data.routing.index.computed === 'index.php'
|
||||||
|
&& data.routing.fallbackPhp.computed
|
||||||
|
&& !data.routing.fallbackHtml.computed
|
||||||
|
&& data.php.wordPressRules.computed
|
||||||
|
&& !data.php.drupalRules.computed
|
||||||
|
&& !data.php.magentoRules.computed;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
drupal: {
|
drupal: {
|
||||||
default: false,
|
default: false,
|
||||||
display: 'Drupal',
|
display: 'Drupal',
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
computedCheck (data) {
|
||||||
|
return data.routing.index.computed === 'index.php'
|
||||||
|
&& data.routing.fallbackPhp.computed
|
||||||
|
&& !data.routing.fallbackHtml.computed
|
||||||
|
&& !data.php.wordPressRules.computed
|
||||||
|
&& data.php.drupalRules.computed
|
||||||
|
&& !data.php.magentoRules.computed;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
magento: {
|
magento: {
|
||||||
default: false,
|
default: false,
|
||||||
display: 'Magento',
|
display: 'Magento',
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
computedCheck (data) {
|
||||||
|
return data.routing.index.computed === 'index.php'
|
||||||
|
&& data.routing.fallbackPhp.computed
|
||||||
|
&& !data.routing.fallbackHtml.computed
|
||||||
|
&& !data.php.wordPressRules.computed
|
||||||
|
&& !data.php.drupalRules.computed
|
||||||
|
&& data.php.magentoRules.computed;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -71,6 +127,18 @@
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: computedFromDefaults(defaults), // Getters & setters for the delegated data
|
computed: computedFromDefaults(defaults), // Getters & setters for the delegated data
|
||||||
|
watch: {
|
||||||
|
// When any data changes, check if it still matches a preset
|
||||||
|
'$parent.$props.data': {
|
||||||
|
handler(data) {
|
||||||
|
// This might cause recursion, but seems not to
|
||||||
|
Object.keys(this.$props.data).forEach(preset => {
|
||||||
|
this.$props.data[preset].computed = this.$props.data[preset].computedCheck(data);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
setPreset(key) {
|
setPreset(key) {
|
||||||
// Set that we're using this preset
|
// Set that we're using this preset
|
||||||
|
@ -88,6 +156,7 @@
|
||||||
this.$parent.resetValue('routing', 'root');
|
this.$parent.resetValue('routing', 'root');
|
||||||
this.$parent.resetValue('routing', 'index');
|
this.$parent.resetValue('routing', 'index');
|
||||||
this.$parent.resetValue('routing', 'fallbackHtml');
|
this.$parent.resetValue('routing', 'fallbackHtml');
|
||||||
|
this.$parent.resetValue('routing', 'fallbackPhp');
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case 'frontend':
|
case 'frontend':
|
||||||
|
@ -97,7 +166,7 @@
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'php':
|
case 'php':
|
||||||
this.$parent.setValue('routing', 'index', 'index.php');
|
// Defaults should be PHP
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'django':
|
case 'django':
|
||||||
|
|
Loading…
Reference in New Issue