Skip to content

Commit e9fd34c

Browse files
committed
feat: show syncedAt in options view
1 parent dba664f commit e9fd34c

File tree

1 file changed

+40
-20
lines changed

1 file changed

+40
-20
lines changed

src/options/index.vue

+40-20
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
22
import "bulma/css/bulma.css";
33
4-
import { defineComponent, onMounted, ref, watchEffect } from "vue";
4+
import { defineComponent, onMounted, ref, watch } from "vue";
55
66
import { Scanners } from "../scanner";
77
import type { SearchableType } from "../schemas";
@@ -32,6 +32,8 @@ export default defineComponent({
3232
const searchableType = ref<SearchableType | undefined>(undefined);
3333
const scannableType = ref<ScannableType | undefined>(undefined);
3434
35+
const synchedAt = ref<string>();
36+
3537
onMounted(async () => {
3638
const options = await getOptions();
3739
@@ -109,24 +111,36 @@ export default defineComponent({
109111
return true;
110112
};
111113
112-
watchEffect(async () => {
113-
if (!isInitialized.value) {
114-
// do nothing if it is not initialized
115-
return;
116-
}
117-
await setOptions({
118-
debug: debug.value,
119-
strict: strict.value,
120-
punycode: punycode.value,
121-
refang: refang.value,
122-
href: href.value,
123-
disabledSearcherNames: disabledSearcherNames.value.map((n) => n),
124-
disabledScannerNames: disabledScannerNames.value.map((n) => n),
125-
hybridAnalysisAPIKey: hybridAnalysisAPIKey.value,
126-
urlscanAPIKey: urlscanAPIKey.value,
127-
virusTotalAPIKey: virusTotalAPIKey.value,
128-
});
129-
});
114+
watch(
115+
[
116+
debug,
117+
strict,
118+
punycode,
119+
refang,
120+
href,
121+
disabledScannerNames,
122+
disabledSearcherNames,
123+
hybridAnalysisAPIKey,
124+
urlscanAPIKey,
125+
virusTotalAPIKey,
126+
],
127+
async () => {
128+
await setOptions({
129+
debug: debug.value,
130+
strict: strict.value,
131+
punycode: punycode.value,
132+
refang: refang.value,
133+
href: href.value,
134+
disabledSearcherNames: disabledSearcherNames.value.map((n) => n),
135+
disabledScannerNames: disabledScannerNames.value.map((n) => n),
136+
hybridAnalysisAPIKey: hybridAnalysisAPIKey.value,
137+
urlscanAPIKey: urlscanAPIKey.value,
138+
virusTotalAPIKey: virusTotalAPIKey.value,
139+
});
140+
141+
synchedAt.value = new Date().toISOString();
142+
},
143+
);
130144
131145
return {
132146
debug,
@@ -153,6 +167,7 @@ export default defineComponent({
153167
isSelectedSearcher,
154168
selectScannableType,
155169
selectSearchableType,
170+
synchedAt,
156171
};
157172
},
158173
});
@@ -166,11 +181,16 @@ export default defineComponent({
166181
<span class="navbar-item title">Mitaka</span>
167182
</div>
168183
<div class="navbar-menu">
169-
<div class="navbar-end">
184+
<div class="navbar-start">
170185
<a class="navbar-item" href="#general"> General </a>
171186
<a class="navbar-item" href="#scanners"> Scanners </a>
172187
<a class="navbar-item" href="#searchers"> Searchers </a>
173188
</div>
189+
<div class="navbar-end">
190+
<span class="navbar-item help" v-if="synchedAt">
191+
(Synced at: {{ synchedAt }})
192+
</span>
193+
</div>
174194
</div>
175195
</nav>
176196
<div class="columns mt-4 is-centered" v-if="isInitialized">

0 commit comments

Comments
 (0)