Create vue models without args
This commit is contained in:
@@ -1,19 +1,17 @@
|
||||
<script>
|
||||
|
||||
import { Button, ButtonGroup, Dropdown, Icon, TableView, TextInput } from 'pankow';
|
||||
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? import.meta.env.VITE_API_ORIGIN : window.location.origin;
|
||||
|
||||
import { Button, ButtonGroup, Dropdown, Icon, TableView, TextInput } from 'pankow';
|
||||
import { APP_TYPES, HSTATES, ISTATES, RSTATES } from '../constants.js';
|
||||
import AppsModel from '../models/AppsModel.js';
|
||||
import ApplinksModel from '../models/ApplinksModel.js';
|
||||
import DomainsModel from '../models/DomainsModel.js';
|
||||
import ApplinkDialog from '../components/ApplinkDialog.vue';
|
||||
|
||||
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? import.meta.env.VITE_API_ORIGIN : window.location.origin;
|
||||
const accessToken = localStorage.token;
|
||||
|
||||
const appsModel = AppsModel.create(API_ORIGIN, accessToken);
|
||||
const domainsModel = DomainsModel.create(API_ORIGIN, accessToken);
|
||||
const applinksModel = ApplinksModel.create(API_ORIGIN, accessToken);
|
||||
const appsModel = AppsModel.create();
|
||||
const domainsModel = DomainsModel.create();
|
||||
const applinksModel = ApplinksModel.create();
|
||||
|
||||
const VIEW_TYPE = {
|
||||
LIST: 'list',
|
||||
@@ -161,7 +159,7 @@ export default {
|
||||
applink.installationState = ISTATES.INSTALLED;
|
||||
applink.runState = RSTATES.RUNNING;
|
||||
applink.health = HSTATES.HEALTHY;
|
||||
applink.iconUrl = `/api/v1/applinks/${applink.id}/icon?access_token=${accessToken}&ts=${applink.ts}`;
|
||||
applink.iconUrl = `/api/v1/applinks/${applink.id}/icon?access_token=${localStorage.token}&ts=${applink.ts}`;
|
||||
applink.accessLevel = this.$root.profile.isAtLeastAdmin ? 'admin' : 'user';
|
||||
|
||||
apps.push(applink);
|
||||
|
||||
@@ -7,9 +7,7 @@ import AppInstallDialog from '../components/AppInstallDialog.vue';
|
||||
import ApplinkDialog from '../components/ApplinkDialog.vue';
|
||||
import { PROXY_APP_ID } from '../constants.js';
|
||||
|
||||
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? import.meta.env.VITE_API_ORIGIN : window.location.origin;
|
||||
|
||||
const appstoreModel = AppstoreModel.create(API_ORIGIN, localStorage.token);
|
||||
const appstoreModel = AppstoreModel.create();
|
||||
|
||||
const ready = ref(false);
|
||||
const proxyApp = ref();
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<script setup>
|
||||
|
||||
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? import.meta.env.VITE_API_ORIGIN : window.location.origin;
|
||||
|
||||
import { useI18n } from 'vue-i18n';
|
||||
const i18n = useI18n();
|
||||
const t = i18n.t;
|
||||
@@ -17,9 +15,10 @@ import Section from '../components/Section.vue';
|
||||
import DashboardModel from '../models/DashboardModel.js';
|
||||
import DomainsModel from '../models/DomainsModel.js';
|
||||
|
||||
const dashboardModel = DashboardModel.create(API_ORIGIN, localStorage.token);
|
||||
const domainsModel = DomainsModel.create(API_ORIGIN, localStorage.token);
|
||||
const dashboardModel = DashboardModel.create();
|
||||
const domainsModel = DomainsModel.create();
|
||||
|
||||
const busy = ref(false);
|
||||
const domains = ref([]);
|
||||
const search = ref('');
|
||||
const dashboardDomain = ref('');
|
||||
@@ -113,12 +112,14 @@ async function refreshDomains() {
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
busy.value = true;
|
||||
await refreshDomains();
|
||||
|
||||
const [error, result] = await dashboardModel.getConfig();
|
||||
if (error) return console.error(error);
|
||||
|
||||
dashboardDomain.value = result.adminDomain;
|
||||
busy.value = false;
|
||||
});
|
||||
|
||||
</script>
|
||||
@@ -137,17 +138,17 @@ onMounted(async () => {
|
||||
|
||||
<p>{{ $t('domains.domainDialog.addDescription') }}</p>
|
||||
|
||||
<TableView :model="filteredDomains" :columns="columns" style="max-height: 200px;" @row-click="onEdit" :hover="false">
|
||||
<TableView :model="filteredDomains" :columns="columns" :busy="busy" style="max-height: 200px;" @row-click="onEdit">
|
||||
<template #provider="domain">
|
||||
{{ prettyProviderName(domain) }}
|
||||
</template>
|
||||
<template #actions="domain">
|
||||
<div class="table-actions">
|
||||
<ButtonGroup>
|
||||
<Button tool outline small secondary @click.stop="wellKnownDialog.open(domain)" v-tooltip="$t('domains.tooltipWellKnown')" icon="fa-solid fa-atlas" />
|
||||
<Button tool outline small secondary @click.stop="onEdit(domain)" v-tooltip="$t('domains.tooltipEdit')" icon="fa-solid fa-pencil-alt" />
|
||||
<Button tool small secondary @click.stop="wellKnownDialog.open(domain)" v-tooltip="$t('domains.tooltipWellKnown')" icon="fa-solid fa-atlas" />
|
||||
<Button tool small secondary @click.stop="onEdit(domain)" v-tooltip="$t('domains.tooltipEdit')" icon="fa-solid fa-pencil-alt" />
|
||||
</ButtonGroup>
|
||||
<Button tool outline small danger @click.stop="onRemove(domain)" v-tooltip="$t('domains.tooltipRemove')" :disabled="domain.domain === dashboardDomain" icon="fa-solid fa-trash-alt" />
|
||||
<Button tool small danger @click.stop="onRemove(domain)" v-tooltip="$t('domains.tooltipRemove')" :disabled="domain.domain === dashboardDomain" icon="fa-solid fa-trash-alt" />
|
||||
</div>
|
||||
</template>
|
||||
</TableView>
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<script setup>
|
||||
|
||||
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? import.meta.env.VITE_API_ORIGIN : window.location.origin;
|
||||
|
||||
import { useI18n } from 'vue-i18n';
|
||||
const i18n = useI18n();
|
||||
const t = i18n.t;
|
||||
@@ -12,8 +10,8 @@ import { useDebouncedRef, prettyDate, prettyLongDate, prettyBinarySize } from 'p
|
||||
import AppsModel from '../models/AppsModel.js';
|
||||
import EventlogsModel from '../models/EventlogsModel.js';
|
||||
|
||||
const appsModel = AppsModel.create(API_ORIGIN, localStorage.token);
|
||||
const eventlogsModel = EventlogsModel.create(API_ORIGIN, localStorage.token);
|
||||
const appsModel = AppsModel.create();
|
||||
const eventlogsModel = EventlogsModel.create();
|
||||
|
||||
function getApp(id) {
|
||||
return apps.value.find(a => a.id === id);
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<script setup>
|
||||
|
||||
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? import.meta.env.VITE_API_ORIGIN : window.location.origin;
|
||||
|
||||
import { ref, onMounted, watch } from 'vue';
|
||||
import { Switch } from 'pankow';
|
||||
import Section from '../components/Section.vue';
|
||||
@@ -10,7 +8,7 @@ import Ipv6Config from '../components/Ipv6Config.vue';
|
||||
import Firewall from '../components/Firewall.vue';
|
||||
import NetworkModel from '../models/NetworkModel.js';
|
||||
|
||||
const networkModel = NetworkModel.create(API_ORIGIN, localStorage.token);
|
||||
const networkModel = NetworkModel.create();
|
||||
|
||||
const dynDnsIsEnabled = ref(false);
|
||||
watch(dynDnsIsEnabled, async (newValue) => {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<script setup>
|
||||
|
||||
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? import.meta.env.VITE_API_ORIGIN : window.location.origin;
|
||||
|
||||
import { useI18n } from 'vue-i18n';
|
||||
const i18n = useI18n();
|
||||
const t = i18n.t;
|
||||
@@ -17,9 +15,9 @@ import ProfileModel from '../models/ProfileModel.js';
|
||||
import CloudronModel from '../models/CloudronModel.js';
|
||||
import TokensModel from '../models/TokensModel.js';
|
||||
|
||||
const profileModel = ProfileModel.create(API_ORIGIN, localStorage.token);
|
||||
const cloudronModel = CloudronModel.create(API_ORIGIN, localStorage.token);
|
||||
const tokensModel = TokensModel.create(API_ORIGIN, localStorage.token);
|
||||
const profileModel = ProfileModel.create();
|
||||
const cloudronModel = CloudronModel.create();
|
||||
const tokensModel = TokensModel.create();
|
||||
|
||||
const config = ref({}); // TODO what is this?
|
||||
const user = ref({});
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<script setup>
|
||||
|
||||
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? import.meta.env.VITE_API_ORIGIN : window.location.origin;
|
||||
|
||||
import { useI18n } from 'vue-i18n';
|
||||
const i18n = useI18n();
|
||||
const t = i18n.t;
|
||||
@@ -15,9 +13,9 @@ import ServicesModel from '../models/ServicesModel.js';
|
||||
import SystemModel from '../models/SystemModel.js';
|
||||
import AppsModel from '../models/AppsModel.js';
|
||||
|
||||
const appsModel = AppsModel.create(API_ORIGIN, localStorage.token);
|
||||
const servicesModel = ServicesModel.create(API_ORIGIN, localStorage.token);
|
||||
const systemModel = SystemModel.create(API_ORIGIN, localStorage.token);
|
||||
const appsModel = AppsModel.create();
|
||||
const servicesModel = ServicesModel.create();
|
||||
const systemModel = SystemModel.create();
|
||||
|
||||
const columns = {
|
||||
status: {},
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<script setup>
|
||||
|
||||
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? import.meta.env.VITE_API_ORIGIN : window.location.origin;
|
||||
|
||||
import { useI18n } from 'vue-i18n';
|
||||
const i18n = useI18n();
|
||||
const t = i18n.t;
|
||||
@@ -14,7 +12,7 @@ import SystemUpdate from '../components/SystemUpdate.vue';
|
||||
import PrivateRegistry from '../components/PrivateRegistry.vue';
|
||||
import CloudronModel from '../models/CloudronModel.js';
|
||||
|
||||
const cloudronModel = CloudronModel.create(API_ORIGIN, localStorage.token);
|
||||
const cloudronModel = CloudronModel.create();
|
||||
|
||||
// Timezone
|
||||
const allTimezones = window.timezones;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<script setup>
|
||||
|
||||
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? import.meta.env.VITE_API_ORIGIN : window.location.origin;
|
||||
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { Button, Checkbox } from 'pankow';
|
||||
import Section from '../components/Section.vue';
|
||||
@@ -10,7 +8,7 @@ import ExposedLdap from '../components/ExposedLdap.vue';
|
||||
import OpenIdClients from '../components/OpenIdClients.vue';
|
||||
import UserDirectoryModel from '../models/UserDirectoryModel.js';
|
||||
|
||||
const userDirectoryModel = UserDirectoryModel.create(API_ORIGIN, localStorage.token);
|
||||
const userDirectoryModel = UserDirectoryModel.create();
|
||||
|
||||
const editableUserProfiles = ref(false);
|
||||
const mandatory2FA = ref(false);
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
<script>
|
||||
|
||||
import { Button, ButtonGroup, Checkbox, Dialog, Dropdown, FormGroup, InputDialog, NumberInput, PasswordInput, TableView, TextInput } from 'pankow';
|
||||
|
||||
import Section from '../components/Section.vue';
|
||||
import VolumesModel from '../models/VolumesModel.js';
|
||||
|
||||
import { createVolumesModel } from '../models/VolumesModel.js';
|
||||
|
||||
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? import.meta.env.VITE_API_ORIGIN : window.location.origin;
|
||||
const accessToken = localStorage.token;
|
||||
|
||||
const volumesModel = createVolumesModel(API_ORIGIN, accessToken);
|
||||
const volumesModel = VolumesModel.create();
|
||||
|
||||
export default {
|
||||
name: 'VolumesView',
|
||||
|
||||
Reference in New Issue
Block a user