Sharkey/packages/frontend/src/pages/admin/overview.instances.vue

52 lines
1.3 KiB
Vue
Raw Normal View History

<template>
<div class="wbrkwale">
2023-04-01 07:42:40 +03:00
<Transition :name="defaultStore.state.animation ? '_transition_zoom' : ''" mode="out-in">
2022-12-26 07:34:46 +02:00
<MkLoading v-if="fetching"/>
<div v-else class="instances">
<MkA v-for="(instance, i) in instances" :key="instance.id" v-tooltip.mfm.noDelay="`${instance.name}\n${instance.host}\n${instance.softwareName} ${instance.softwareVersion}`" :to="`/instance-info/${instance.host}`" class="instance">
<MkInstanceCardMini :instance="instance"/>
</MkA>
</div>
2022-12-30 06:37:14 +02:00
</Transition>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import * as os from '@/os';
import { useInterval } from '@/scripts/use-interval';
import MkInstanceCardMini from '@/components/MkInstanceCardMini.vue';
2023-04-01 07:42:40 +03:00
import { defaultStore } from '@/store';
const instances = ref([]);
const fetching = ref(true);
const fetch = async () => {
const fetchedInstances = await os.api('federation/instances', {
2023-01-03 02:00:42 +02:00
sort: '+latestRequestReceivedAt',
limit: 6,
});
instances.value = fetchedInstances;
fetching.value = false;
};
useInterval(fetch, 1000 * 60, {
immediate: true,
afterMounted: true,
});
</script>
<style lang="scss" scoped>
.wbrkwale {
> .instances {
display: grid;
2022-12-26 06:40:20 +02:00
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
grid-gap: 12px;
> .instance:hover {
text-decoration: none;
}
}
}
</style>