@hostlink/nuxt-light 1.17.2 → 1.18.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "light",
3
3
  "configKey": "light",
4
- "version": "1.17.2",
4
+ "version": "1.18.2",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.4",
7
7
  "unbuild": "2.0.0"
package/dist/module.mjs CHANGED
@@ -5,11 +5,6 @@ import { quasar } from '@quasar/vite-plugin';
5
5
 
6
6
  const resolver = createResolver(import.meta.url);
7
7
  const routes = [
8
- {
9
- name: "logout",
10
- path: "/logout",
11
- file: resolver.resolve("./runtime/pages/logout.vue")
12
- },
13
8
  {
14
9
  name: "EventLog",
15
10
  path: "/EventLog",
@@ -249,6 +244,11 @@ const module = defineNuxtModule({
249
244
  nuxt.options.imports = nuxt.options.imports || {};
250
245
  nuxt.options.imports.presets = nuxt.options.imports.presets || [];
251
246
  nuxt.options.imports.presets.push({ from: "quasar", imports: ["useQuasar"] });
247
+ nuxt.options.vite = nuxt.options.vite || {};
248
+ nuxt.options.vite.optimizeDeps = nuxt.options.vite.optimizeDeps || {};
249
+ nuxt.options.vite.optimizeDeps.include = nuxt.options.vite.optimizeDeps.include || [];
250
+ nuxt.options.vite.optimizeDeps.include.push("axios");
251
+ nuxt.options.vite.optimizeDeps.include.push("json-to-graphql-query");
252
252
  const resolver = createResolver(import.meta.url);
253
253
  const { resolve: resolveQuasar } = createResolver(dirname(await resolvePath("quasar/package.json")));
254
254
  const importMap = JSON.parse(await await readFile(resolveQuasar("dist/transforms/import-map.json"), "utf-8"));
@@ -5,12 +5,15 @@ import { useQuasar } from 'quasar';
5
5
  import { useI18n } from 'vue-i18n';
6
6
  import { ref, computed, reactive, provide, watch, toRaw } from 'vue';
7
7
  import { useRuntimeConfig } from 'nuxt/app';
8
+ import { api } from '#imports';
8
9
 
10
+ const emits = defineEmits(["logout"]);
9
11
  const $q = useQuasar();
10
12
  $q.loading.show()
11
13
 
12
14
  const config = useRuntimeConfig();
13
15
 
16
+
14
17
  const appVersion = config.public.appVersion ?? '0.0.1';
15
18
 
16
19
  const tt = await q({
@@ -274,6 +277,11 @@ if (route.fullPath == "/" && my.default_page) {
274
277
 
275
278
  }
276
279
 
280
+ const onLogout = async () => {
281
+ await api.auth.logout();
282
+ emits('logout');
283
+ }
284
+
277
285
  </script>
278
286
 
279
287
  <style scoped>
@@ -287,7 +295,7 @@ if (route.fullPath == "/" && my.default_page) {
287
295
  <q-btn dense flat round icon="menu" class="q-mr-sm" @click="toggleLeftDrawer" />
288
296
 
289
297
  <q-toolbar-title>
290
- {{ light.getCompany() }}
298
+ {{ light.company }}
291
299
  <template v-if="tt.system.devMode">
292
300
  - Development mode
293
301
  </template>
@@ -344,7 +352,7 @@ if (route.fullPath == "/" && my.default_page) {
344
352
 
345
353
  <q-btn flat round dense icon="sym_o_person" class="q-mr-sm">
346
354
  <q-menu max-width="250px">
347
- <q-list >
355
+ <q-list>
348
356
  <q-item v-close-popup to="/User/profile">
349
357
  <q-item-section avatar>
350
358
  <q-icon name="sym_o_person" />
@@ -375,7 +383,7 @@ if (route.fullPath == "/" && my.default_page) {
375
383
 
376
384
  <q-separator />
377
385
 
378
- <q-item v-close-popup to="/logout">
386
+ <q-item @click="onLogout" clickable>
379
387
  <q-item-section avatar>
380
388
  <q-icon name="logout" />
381
389
  </q-item-section>
@@ -451,7 +459,7 @@ if (route.fullPath == "/" && my.default_page) {
451
459
  <q-footer bordered v-if="style.footer">
452
460
  <q-item>
453
461
  <q-item-section>
454
- {{ light.getCompany() }} {{ appVersion }} - Copyright {{ app.copyrightYear }} {{ app.copyrightName
462
+ {{ light.company }} {{ appVersion }} - Copyright {{ app.copyrightYear }} {{ app.copyrightName
455
463
  }}. Build
456
464
  {{ light.getVersion() }}
457
465
  </q-item-section>
@@ -15,10 +15,10 @@ watch(route, (to, from) => {
15
15
  light.setCurrentRoute(to);
16
16
  });
17
17
 
18
+ const app = ref(null)
18
19
 
19
- let app = null
20
20
  try {
21
- app = (await q({
21
+ app.value = (await q({
22
22
  app: {
23
23
  company: true,
24
24
  companyLogo: true,
@@ -28,8 +28,8 @@ try {
28
28
  forgetPasswordEnabled: true
29
29
  }
30
30
  })).app;
31
- light.setCompany(app.company);
32
- light.setCompanyLogo(app.companyLogo);
31
+ light.company = app.value.company;
32
+ light.companyLogo = app.value.companyLogo;
33
33
  } catch (e) {
34
34
 
35
35
  quasar.dialog({
@@ -50,20 +50,15 @@ provide('color', color)
50
50
  <q-layout v-if="!app.logged">
51
51
  <q-page-container class="bg-grey-2" style="color:#1f1f1f">
52
52
  <q-page padding>
53
- <l-login v-bind="app"></l-login>
53
+ <l-login v-bind="app" @login="app.logged = true"></l-login>
54
54
  </q-page>
55
55
  </q-page-container>
56
56
  </q-layout>
57
57
 
58
- <l-app-main v-else>
59
-
58
+ <l-app-main v-else @logout="app.logged = false">
60
59
  <template #header>
61
60
  <slot name="header"></slot>
62
61
  </template>
63
62
 
64
-
65
-
66
-
67
-
68
63
  </l-app-main>
69
64
  </template>
@@ -1,27 +1,27 @@
1
1
  <script setup>
2
- import { useLight } from "#imports";
3
2
  import { ref, reactive, onMounted } from 'vue'
4
3
  import { useQuasar } from 'quasar';
5
- import { useI18n } from 'vue-i18n';
6
- import { m, api } from '#imports';
4
+ import { api, useHead } from '#imports';
7
5
 
8
-
9
- const light = useLight();
6
+ const emits = defineEmits(["login"]);
10
7
 
11
8
  const props = defineProps({
12
9
  twoFactorAuthentication: Boolean,
13
10
  googleClientId: String,
14
- forgetPasswordEnabled: Boolean
11
+ forgetPasswordEnabled: Boolean,
12
+ company: String,
13
+ companyLogo: String
15
14
  })
16
15
 
17
- const { t } = useI18n();
16
+ useHead({
17
+ title: props.company
18
+ })
18
19
 
19
20
  const form1 = ref(null);
20
21
  const data = reactive({
21
22
  username: "", password: "", code: ""
22
23
  });
23
24
 
24
-
25
25
  const $q = useQuasar()
26
26
 
27
27
  const loginWithCode = (username, password) => {
@@ -48,7 +48,9 @@ const submit = async () => {
48
48
 
49
49
  try {
50
50
  await api.auth.login(data.username, data.password, data.code)
51
- window.self.location.reload();
51
+ //window.self.location.reload();
52
+ //
53
+ emits("login");
52
54
  } catch (e) {
53
55
  data.code = "";
54
56
 
@@ -191,13 +193,13 @@ onMounted(() => {
191
193
  <template>
192
194
  <q-card bordered flat style="min-width:360px" class="fixed-center">
193
195
  <q-card-section>
194
- <q-img :src="light.getCompanyLogo()" class="full-width">
196
+ <q-img :src="companyLogo" class="full-width">
195
197
  <template v-slot:error>
196
198
  <q-img src="https://raw.githubusercontent.com/HostLink/.github/master/profile/logo.webp" class="full-width" />
197
199
  </template>
198
200
  </q-img>
199
201
  <div class="text-h6">
200
- {{ light.getCompany() }}
202
+ {{ company }}
201
203
  </div>
202
204
  <q-form ref="form1">
203
205
  <div class="q-gutter-sm">
@@ -50,8 +50,9 @@ const onDelete = async () => {
50
50
 
51
51
  }
52
52
 
53
+ console.log(light)
53
54
  useHead({
54
- title: light.getCompany() + " - " + title,
55
+ title: light.company + " - " + title,
55
56
  })
56
57
 
57
58
  const localClass = computed(() => {
@@ -30,10 +30,6 @@ declare const app: {
30
30
  reloadMyFavorites: () => Promise<void>;
31
31
  getMyFavorites: () => any[];
32
32
  isDarkMode: () => boolean;
33
- setCompany: (company: string) => void;
34
- getCompany: () => string;
35
- setCompanyLogo: (logo: string) => void;
36
- getCompanyLogo: () => string;
37
33
  getVersion: () => string;
38
34
  addError: (err: Error) => void;
39
35
  getErrors: () => Error[];
@@ -114,10 +110,6 @@ export declare const useLight: (options?: {
114
110
  reloadMyFavorites: () => Promise<void>;
115
111
  getMyFavorites: () => any[];
116
112
  isDarkMode: () => boolean;
117
- setCompany: (company: string) => void;
118
- getCompany: () => string;
119
- setCompanyLogo: (logo: string) => void;
120
- getCompanyLogo: () => string;
121
113
  getVersion: () => string;
122
114
  addError: (err: Error) => void;
123
115
  getErrors: () => Error[];
@@ -110,18 +110,6 @@ const app = reactive({
110
110
  isDarkMode: () => {
111
111
  return app.theme == "dark";
112
112
  },
113
- setCompany: (company) => {
114
- app.company = company;
115
- },
116
- getCompany: () => {
117
- return app.company;
118
- },
119
- setCompanyLogo: (logo) => {
120
- app.companyLogo = logo;
121
- },
122
- getCompanyLogo: () => {
123
- return app.companyLogo;
124
- },
125
113
  getVersion: () => {
126
114
  return packageJson.version;
127
115
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "1.17.2",
3
+ "version": "1.18.2",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,17 +0,0 @@
1
- <script setup>
2
-
3
- import { api } from '#imports';
4
-
5
- await api.auth.logout();
6
- const href = window.self.location.href;
7
-
8
- const url = new URL(href);
9
- //move up one level
10
- const newUrl = url.origin + url.pathname.substring(0, url.pathname.lastIndexOf("/"));
11
- window.self.location = newUrl;
12
-
13
-
14
-
15
-
16
- </script>
17
- <template></template>