Skip to content

Commit 85eeb01

Browse files
committed
Allow switching between MultiSites layout in UI
1 parent 14be06f commit 85eeb01

10 files changed

Lines changed: 440 additions & 60 deletions

File tree

plugins/FeatureFlags/vue/dist/FeatureFlags.umd.js

Lines changed: 252 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/FeatureFlags/vue/dist/FeatureFlags.umd.min.js

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/FeatureFlags/vue/dist/umd.metadata.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<!--
2+
Matomo - free/libre analytics platform
3+
4+
@link https://matomo.org
5+
@license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
6+
-->
7+
8+
<template>
9+
<div style="
10+
font-size: 15px;
11+
position: absolute;
12+
top: 5px;
13+
right: 0;
14+
padding: 5px;
15+
text-align: center;">
16+
<span v-html="$sanitize(description)"></span>
17+
<div class="switch" style="zoom: 75%">
18+
<label>
19+
<input type="checkbox" :checked="isActive" @change="toggle()">
20+
<span class="lever"></span>
21+
</label>
22+
</div>
23+
</div>
24+
</template>
25+
26+
<script lang="ts">
27+
import { defineComponent } from 'vue';
28+
import { setCookie, getCookie } from 'CoreHome';
29+
30+
export default defineComponent({
31+
props: {
32+
featureName: {
33+
type: String,
34+
required: true,
35+
},
36+
description: {
37+
type: String,
38+
required: true,
39+
},
40+
defaultValue: {
41+
type: Boolean,
42+
required: false,
43+
default: false,
44+
},
45+
},
46+
methods: {
47+
toggle() {
48+
if (this.isActive) {
49+
this.deactivate();
50+
} else {
51+
this.activate();
52+
}
53+
},
54+
activate() {
55+
setCookie(`feature_${this.featureName}`, '1', 14 * 24 * 60 * 1000);
56+
window.location.reload();
57+
},
58+
deactivate() {
59+
setCookie(`feature_${this.featureName}`, '0', 14 * 24 * 60 * 1000);
60+
window.location.reload();
61+
},
62+
},
63+
computed: {
64+
isActive() {
65+
const cookieValue = getCookie(`feature_${this.featureName}`);
66+
return (cookieValue === null && this.defaultValue) || cookieValue === '1';
67+
},
68+
},
69+
});
70+
</script>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*!
2+
* Matomo - free/libre analytics platform
3+
*
4+
* @link https://matomo.org
5+
* @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
6+
*/
7+
8+
export { default as FeatureFlagToggle } from './FeatureFlagToggle/FeatureFlagToggle.vue';

0 commit comments

Comments
 (0)