3737 <n-input v-model:value =" model.background_image_url" clearable />
3838 </n-form-item >
3939
40- <div class =" flex space-x-4" >
41- <n-form-item label =" Show weekends" path =" show_weekend" >
40+
41+ <!-- START | Feature toggles -->
42+ <div class =" relative p-4 bg-white border rounded-lg shadow-sm" >
43+
44+ <label class =" absolute px-1.5 bg-white -left-0.5 -top-3" >Optional features</label >
45+
46+ <n-form-item path =" show_weekend" :show-label =" false" :show-feedback =" false" >
4247 <n-switch v-model:value =" model.show_weekend" :default-value =" true" />
48+ <label class =" ml-3 text-gray-800" >Show weekends</label >
4349 </n-form-item >
4450
45- <n-form-item label = " Require description " path = " require_description " >
51+ <n-form-item path = " require_description " :show-label = " false " :show-feedback = " false " >
4652 <n-switch v-model:value =" model.require_description" :default-value =" false" />
53+ <label class =" ml-3 text-gray-800" >Require descriptions</label >
4754 </n-form-item >
4855
49- <n-form-item label = " Enable admin features " path = " admin_features_enabled " >
56+ <n-form-item path = " admin_features_enabled " :show-label = " false " :show-feedback = " false " >
5057 <n-switch v-model:value =" model.admin_features_enabled" :default-value =" false" />
58+ <label class =" ml-3 text-gray-800" >
59+ Enable admin features
60+ <div class =" text-sm text-gray-500" >You must be a CU admin to use this</div >
61+ </label >
5162 </n-form-item >
63+
64+ <hr class =" my-6" />
65+ <label class =" absolute px-1.5 bg-white -ml-4 -mt-9" >Danger zone</label >
66+
67+ <n-popconfirm @positive-click =" flushCaches" :show-icon =" false" >
68+ <template #activator >
69+ <n-button size =" small" type =" warning" secondary >
70+ Flush caches
71+ </n-button >
72+ </template >
73+
74+ This will clear all locally cached<br />
75+ ClickUp tasks & team members
76+
77+ </n-popconfirm >
78+
5279 </div >
80+ <!-- END | Feature toggles -->
81+
5382
54- <div class =" flex justify-end" >
83+ <div class =" flex justify-end mt-4 space-x-2" >
84+ <n-button @click =" cancel" round >Cancel</n-button >
5585 <n-button @click =" persist" type =" primary" round >Save</n-button >
5686 </div >
87+
5788 </n-form >
5889
59- <div class =" p-3 space-y-4 shadow-inner bg-gray-50" >
90+ <div class =" flex flex-col p-3 space-y-4 shadow-inner bg-gray-50" >
6091 <h2 class =" text-lg font-bold text-gray-700" >Instructions</h2 >
6192 <p >Click & drag in order to create a new tracking entry</p >
6293
99130 ⌘ + D
100131 </kbd >
101132 </div >
133+
102134 </div >
103135 </div >
104136</template >
105137
106138<script >
107139import { ref } from " vue" ;
108140import { useRouter } from " vue-router" ;
109- import { NForm , NFormItem , NInput , NTimePicker , NSwitch , NButton , useNotification } from " naive-ui" ;
141+ import { NForm , NFormItem , NInput , NTimePicker , NSwitch , NButton , NPopconfirm , useNotification } from " naive-ui" ;
110142import { BackspaceIcon } from " @heroicons/vue/24/outline" ;
111143import clickupService from ' @/clickup-service' ;
112144import store from " @/store" ;
145+ import cache from " @/cache" ;
113146
114147export default {
115- components: { NForm, NFormItem, NInput, NTimePicker, NSwitch, NButton, BackspaceIcon },
148+ components: { NForm, NFormItem, NInput, NTimePicker, NSwitch, NButton, NPopconfirm, BackspaceIcon },
116149
117150 setup () {
118151 const form = ref (null );
119152 const router = useRouter ();
120153 const notification = useNotification ();
121154 const model = ref (store .get (" settings" ) || {});
122155
156+ function mustFlushCachesAfterPersist () {
157+ // Either the CU acces token or team id has changed
158+ return model .value .clickup_access_token !== store .get (' settings.clickup_access_token' )
159+ || model .value .clickup_team_id !== store .get (' settings.clickup_team_id' )
160+ }
161+
123162 return {
124163 form,
125164
@@ -129,6 +168,11 @@ export default {
129168 form .value
130169 .validate ()
131170 .then (() => {
171+
172+ if (mustFlushCachesAfterPersist ()) {
173+ cache .flush ();
174+ }
175+
132176 store .set ({ settings: model .value });
133177
134178 router .replace ({ name: " time-tracker" });
@@ -138,6 +182,16 @@ export default {
138182 .catch ((errors ) => console .error (errors));
139183 },
140184
185+ cancel () {
186+ router .replace ({ name: " time-tracker" });
187+ },
188+
189+ flushCaches () {
190+ cache .flush ()
191+
192+ notification .success ({ title: " All caches flushed!" , duration: 1500 });
193+ },
194+
141195 rules: {
142196 clickup_access_token: [
143197 {
0 commit comments