Create vue models without args
This commit is contained in:
@@ -5,16 +5,14 @@ import { FormGroup, Radiobutton, MultiSelect } from 'pankow';
|
||||
import UsersModel from '../models/UsersModel.js';
|
||||
import GroupsModel from '../models/GroupsModel.js';
|
||||
|
||||
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? import.meta.env.VITE_API_ORIGIN : window.location.origin;
|
||||
|
||||
const OPTIONS = Object.freeze({
|
||||
ANY: 'any',
|
||||
RESTRICTED: 'restricted',
|
||||
NOSSO: 'nosso',
|
||||
});
|
||||
|
||||
const usersModel = UsersModel.create(API_ORIGIN, localStorage.token);
|
||||
const groupsModel = GroupsModel.create(API_ORIGIN, localStorage.token);
|
||||
const usersModel = UsersModel.create();
|
||||
const groupsModel = GroupsModel.create();
|
||||
|
||||
const props = defineProps([ 'manifest', 'error' ]);
|
||||
|
||||
|
||||
@@ -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 { TOKEN_TYPES } from '../constants.js';
|
||||
import Section from './Section.vue';
|
||||
import TokensModel from '../models/TokensModel.js';
|
||||
|
||||
const tokensModel = TokensModel.create(API_ORIGIN, localStorage.token);
|
||||
const tokensModel = TokensModel.create();
|
||||
|
||||
const apiTokens = ref([]);
|
||||
const inputDialog = useTemplateRef('inputDialog');
|
||||
|
||||
@@ -11,16 +11,14 @@ import AppsModel from '../models/AppsModel.js';
|
||||
import DashboardModel from '../models/DashboardModel.js';
|
||||
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 STEP = Object.freeze({
|
||||
DETAILS: Symbol('details'),
|
||||
INSTALL: Symbol('install'),
|
||||
});
|
||||
|
||||
const domainsModel = DomainsModel.create(API_ORIGIN, localStorage.token);
|
||||
const appsModel = AppsModel.create(API_ORIGIN, localStorage.token);
|
||||
const dashboardModel = DashboardModel.create(API_ORIGIN, localStorage.token);
|
||||
const domainsModel = DomainsModel.create();
|
||||
const appsModel = AppsModel.create();
|
||||
const dashboardModel = DashboardModel.create();
|
||||
|
||||
// reactive
|
||||
const busy = ref(false);
|
||||
|
||||
@@ -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,8 +12,8 @@ import Section from './Section.vue';
|
||||
import AppPasswordsModel from '../models/AppPasswordsModel.js';
|
||||
import AppsModel from '../models/AppsModel.js';
|
||||
|
||||
const appPasswordsModel = AppPasswordsModel.create(API_ORIGIN, localStorage.token);
|
||||
const appsModel = AppsModel.create(API_ORIGIN, localStorage.token);
|
||||
const appPasswordsModel = AppPasswordsModel.create();
|
||||
const appsModel = AppsModel.create();
|
||||
|
||||
const newDialog = useTemplateRef('newDialog');
|
||||
const inputDialog = useTemplateRef('inputDialog');
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
<script>
|
||||
|
||||
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? import.meta.env.VITE_API_ORIGIN : window.location.origin;
|
||||
|
||||
import { Dialog, FormGroup, InputDialog, MultiSelect, Radiobutton, TagInput, TextInput } from 'pankow';
|
||||
|
||||
import ApplinksModel from '../models/ApplinksModel.js';
|
||||
import UsersModel from '../models/UsersModel.js';
|
||||
import GroupsModel from '../models/GroupsModel.js';
|
||||
|
||||
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? import.meta.env.VITE_API_ORIGIN : window.location.origin;
|
||||
const accessToken = localStorage.token;
|
||||
|
||||
const applinksModel = ApplinksModel.create(API_ORIGIN, accessToken);
|
||||
const usersModel = UsersModel.create(API_ORIGIN, accessToken);
|
||||
const groupsModel = GroupsModel.create(API_ORIGIN, accessToken);
|
||||
const applinksModel = ApplinksModel.create();
|
||||
const usersModel = UsersModel.create();
|
||||
const groupsModel = GroupsModel.create();
|
||||
|
||||
export default {
|
||||
name: 'ApplinkDialog',
|
||||
|
||||
@@ -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, ProgressBar } from 'pankow';
|
||||
import { prettyLongDate } from 'pankow/utils';
|
||||
@@ -10,8 +8,8 @@ import Section from '../components/Section.vue';
|
||||
import TasksModel from '../models/TasksModel.js';
|
||||
import DomainsModel from '../models/DomainsModel.js';
|
||||
|
||||
const taskModel = TasksModel.create(API_ORIGIN, localStorage.token);
|
||||
const domainsModel = DomainsModel.create(API_ORIGIN, localStorage.token);
|
||||
const taskModel = TasksModel.create();
|
||||
const domainsModel = DomainsModel.create();
|
||||
|
||||
const lastTask = ref({});
|
||||
const taskLogsMenu = ref([]);
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
<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 } from 'pankow';
|
||||
import { prettyDate } from 'pankow/utils';
|
||||
import Section from '../components/Section.vue';
|
||||
import AppstoreModel from '../models/AppstoreModel.js';
|
||||
|
||||
const appstoreModel = AppstoreModel.create(API_ORIGIN, localStorage.token);
|
||||
const appstoreModel = AppstoreModel.create();
|
||||
|
||||
// TODO maybe support dev.console.cloudron.io
|
||||
const consoleServerOrigin = 'https://console.cloudron.io';
|
||||
|
||||
@@ -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, ProgressBar, Dropdown } from 'pankow';
|
||||
import { prettyLongDate } from 'pankow/utils';
|
||||
@@ -11,9 +9,9 @@ import TasksModel from '../models/TasksModel.js';
|
||||
import DomainsModel from '../models/DomainsModel.js';
|
||||
import DashboardModel from '../models/DashboardModel.js';
|
||||
|
||||
const taskModel = TasksModel.create(API_ORIGIN, localStorage.token);
|
||||
const domainsModel = DomainsModel.create(API_ORIGIN, localStorage.token);
|
||||
const dashboardModel = DashboardModel.create(API_ORIGIN, localStorage.token);
|
||||
const taskModel = TasksModel.create();
|
||||
const domainsModel = DomainsModel.create();
|
||||
const dashboardModel = DashboardModel.create();
|
||||
|
||||
const domains = ref([]);
|
||||
const newDomain = 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 { ref, useTemplateRef } from 'vue';
|
||||
import { Dialog, TextInput, FormGroup, Checkbox } from 'pankow';
|
||||
import { ENDPOINTS_OVH } from '../constants.js';
|
||||
@@ -9,7 +7,7 @@ import DomainsModel from '../models/DomainsModel.js';
|
||||
|
||||
const emit = defineEmits([ 'success' ]);
|
||||
|
||||
const domainsModel = DomainsModel.create(API_ORIGIN, localStorage.token);
|
||||
const domainsModel = DomainsModel.create();
|
||||
|
||||
// currently, validation of wildcard with various provider is done server side
|
||||
const tlsProviders = [
|
||||
|
||||
@@ -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, computed } from 'vue';
|
||||
import { Button, FormGroup, Checkbox, PasswordInput, TextInput } from 'pankow';
|
||||
import { copyToClipboard } from 'pankow/utils';
|
||||
@@ -10,9 +8,9 @@ import DomainsModel from '../models/DomainsModel.js';
|
||||
import DashboardModel from '../models/DashboardModel.js';
|
||||
import UserDirectoryModel from '../models/UserDirectoryModel.js';
|
||||
|
||||
const domainsModel = DomainsModel.create(API_ORIGIN, localStorage.token);
|
||||
const dashboardModel = DashboardModel.create(API_ORIGIN, localStorage.token);
|
||||
const userDirectoryModel = UserDirectoryModel.create(API_ORIGIN, localStorage.token);
|
||||
const domainsModel = DomainsModel.create();
|
||||
const dashboardModel = DashboardModel.create();
|
||||
const userDirectoryModel = UserDirectoryModel.create();
|
||||
|
||||
const adminDomain = 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 { ref, useTemplateRef, onMounted, computed } from 'vue';
|
||||
import { Dialog, Button, Icon, FormGroup, Dropdown, Checkbox, TextInput, ProgressBar } from 'pankow';
|
||||
import { prettyLongDate } from 'pankow/utils';
|
||||
@@ -10,8 +8,8 @@ import UserDirectoryModel from '../models/UserDirectoryModel.js';
|
||||
import TasksModel from '../models/TasksModel.js';
|
||||
import { TASK_TYPES } from '../constants.js';
|
||||
|
||||
const userDirectoryModel = UserDirectoryModel.create(API_ORIGIN, localStorage.token);
|
||||
const tasksModel = TasksModel.create(API_ORIGIN, localStorage.token);
|
||||
const userDirectoryModel = UserDirectoryModel.create();
|
||||
const tasksModel = TasksModel.create();
|
||||
|
||||
const availableProviders = [
|
||||
{ name: 'Active Directory', value: 'ad' },
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
<script setup>
|
||||
|
||||
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? import.meta.env.VITE_API_ORIGIN : window.location.origin;
|
||||
|
||||
import { ref, onMounted, useTemplateRef, computed } from 'vue';
|
||||
import { Dialog, FormGroup } from 'pankow';
|
||||
import Section from '../components/Section.vue';
|
||||
import NetworkModel from '../models/NetworkModel.js';
|
||||
|
||||
const networkModel = NetworkModel.create(API_ORIGIN, localStorage.token);
|
||||
const networkModel = NetworkModel.create();
|
||||
|
||||
const blocklistLength = ref(0);
|
||||
const blocklist = ref('');
|
||||
|
||||
@@ -28,7 +28,6 @@ export default {
|
||||
FileUploader,
|
||||
InputDialog,
|
||||
MainLayout,
|
||||
Menu,
|
||||
Notification,
|
||||
Breadcrumb,
|
||||
PreviewPanel,
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
<script setup>
|
||||
|
||||
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? import.meta.env.VITE_API_ORIGIN : window.location.origin;
|
||||
|
||||
import { ref, onMounted, useTemplateRef, computed } from 'vue';
|
||||
import { Button, Dialog, Dropdown, FormGroup, TextInput } from 'pankow';
|
||||
import Section from '../components/Section.vue';
|
||||
import NetworkModel from '../models/NetworkModel.js';
|
||||
|
||||
const networkModel = NetworkModel.create(API_ORIGIN, localStorage.token);
|
||||
const networkModel = NetworkModel.create();
|
||||
|
||||
// keep in sync with sysinfo.js
|
||||
const providers = [
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
<script setup>
|
||||
|
||||
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? import.meta.env.VITE_API_ORIGIN : window.location.origin;
|
||||
|
||||
import { ref, onMounted, useTemplateRef, computed } from 'vue';
|
||||
import { Button, Dialog, Dropdown, FormGroup, TextInput } from 'pankow';
|
||||
import Section from '../components/Section.vue';
|
||||
import NetworkModel from '../models/NetworkModel.js';
|
||||
|
||||
const networkModel = NetworkModel.create(API_ORIGIN, localStorage.token);
|
||||
const networkModel = NetworkModel.create();
|
||||
|
||||
// keep in sync with sysinfo.js
|
||||
const providers = [
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
<script>
|
||||
|
||||
import { Button, InputDialog, TopBar, MainLayout } from 'pankow';
|
||||
|
||||
import LogsModel from '../models/LogsModel.js';
|
||||
import AppsModel from '../models/AppsModel.js';
|
||||
|
||||
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? import.meta.env.VITE_API_ORIGIN : window.location.origin;
|
||||
|
||||
export default {
|
||||
name: 'LogsViewer',
|
||||
components: {
|
||||
@@ -96,10 +93,10 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
this.logsModel = LogsModel.create(API_ORIGIN, this.accessToken, this.type, this.id);
|
||||
this.logsModel = LogsModel.create(this.type, this.id);
|
||||
|
||||
if (this.type === 'app') {
|
||||
this.appsModel = AppsModel.create(API_ORIGIN, this.accessToken, this.id);
|
||||
this.appsModel = AppsModel.create();
|
||||
|
||||
try {
|
||||
const app = await this.appsModel.get();
|
||||
|
||||
@@ -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;
|
||||
@@ -13,8 +11,8 @@ import Section from './Section.vue';
|
||||
import DashboardModel from '../models/DashboardModel.js';
|
||||
import UserDirectoryModel from '../models/UserDirectoryModel.js';
|
||||
|
||||
const dashboardModel = DashboardModel.create(API_ORIGIN, localStorage.token);
|
||||
const userDirectoryModel = UserDirectoryModel.create(API_ORIGIN, localStorage.token);
|
||||
const dashboardModel = DashboardModel.create();
|
||||
const userDirectoryModel = UserDirectoryModel.create();
|
||||
|
||||
const columns = {
|
||||
name: { label: 'Name', sort: true },
|
||||
|
||||
@@ -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,7 +10,7 @@ import { isValidDomainOrURL } from 'pankow/utils';
|
||||
import Section from '../components/Section.vue';
|
||||
import CloudronModel from '../models/CloudronModel.js';
|
||||
|
||||
const cloudronModel = CloudronModel.create(API_ORIGIN, localStorage.token);
|
||||
const cloudronModel = CloudronModel.create();
|
||||
|
||||
const providers = [
|
||||
{ name: 'AWS', value: 'aws' },
|
||||
|
||||
@@ -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, ProgressBar } from 'pankow';
|
||||
import { prettyLongDate } from 'pankow/utils';
|
||||
@@ -10,8 +8,8 @@ import Section from '../components/Section.vue';
|
||||
import TasksModel from '../models/TasksModel.js';
|
||||
import DomainsModel from '../models/DomainsModel.js';
|
||||
|
||||
const taskModel = TasksModel.create(API_ORIGIN, localStorage.token);
|
||||
const domainsModel = DomainsModel.create(API_ORIGIN, localStorage.token);
|
||||
const taskModel = TasksModel.create();
|
||||
const domainsModel = DomainsModel.create();
|
||||
|
||||
const lastTask = ref({});
|
||||
const taskLogsMenu = 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 { ref, onMounted, useTemplateRef } from 'vue';
|
||||
import { Button, Dialog, ProgressBar, Radiobutton, MultiSelect } from 'pankow';
|
||||
import { prettyLongDate } from 'pankow/utils';
|
||||
@@ -11,9 +9,9 @@ import UpdaterModel from '../models/UpdaterModel.js';
|
||||
import TasksModel from '../models/TasksModel.js';
|
||||
import DashboardModel from '../models/DashboardModel.js';
|
||||
|
||||
const tasksModel = TasksModel.create(API_ORIGIN, localStorage.token);
|
||||
const updaterModel = UpdaterModel.create(API_ORIGIN, localStorage.token);
|
||||
const dashboardModel = DashboardModel.create(API_ORIGIN, localStorage.token);
|
||||
const tasksModel = TasksModel.create();
|
||||
const updaterModel = UpdaterModel.create();
|
||||
const dashboardModel = DashboardModel.create();
|
||||
|
||||
// values correspond to cron days
|
||||
const cronDays = [
|
||||
|
||||
@@ -221,7 +221,7 @@ export default {
|
||||
this.id = id;
|
||||
this.name = id;
|
||||
|
||||
this.appsModel = AppsModel.create(API_ORIGIN, this.accessToken);
|
||||
this.appsModel = AppsModel.create();
|
||||
this.directoryModel = createDirectoryModel(API_ORIGIN, this.accessToken, `apps/${id}`);
|
||||
|
||||
const [error, app] = await this.appsModel.get(this.id);
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
<script setup>
|
||||
|
||||
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? import.meta.env.VITE_API_ORIGIN : window.location.origin;
|
||||
|
||||
import { ref, useTemplateRef } from 'vue';
|
||||
import { Dialog, TextInput, FormGroup } from 'pankow';
|
||||
import DomainsModel from '../models/DomainsModel.js';
|
||||
|
||||
const emit = defineEmits([ 'success' ]);
|
||||
|
||||
const domainsModel = DomainsModel.create(API_ORIGIN, localStorage.token);
|
||||
const domainsModel = DomainsModel.create();
|
||||
|
||||
const dialog = useTemplateRef('dialog');
|
||||
const busy = ref(false);
|
||||
|
||||
Reference in New Issue
Block a user