Explorar o código

build: add configs de build

Gustavo Mantovani hai 11 horas
pai
achega
2a0f2fc218

+ 2 - 1
package.json

@@ -13,7 +13,8 @@
     "test": "echo \"No test specified\" && exit 0",
     "dev": "quasar dev",
     "build": "quasar build",
-    "deploy": "aws --profile michel-softpar --region sa-east-1 s3 sync ./dist/spa s3://alugap-owner-office-test --delete"
+    "deploy:staging": "APP_ENV=staging quasar build && aws --profile michel-softpar --region sa-east-1 s3 sync ./dist/spa s3://alugap-owner-office-test --delete",
+    "deploy:prod": "APP_ENV=production quasar build && aws --profile softpar --region us-east-2 s3 sync ./dist/spa s3://kizzo-frontend-prod-790117923086-sa-east-1-an/owner.kizzo.com.br/ --delete"
   },
   "dependencies": {
     "@quasar/extras": "^1.16.17",

+ 46 - 9
quasar.config.js

@@ -14,25 +14,33 @@ export default configure((ctx) => {
     // app boot file (/src/boot)
     // --> boot files are part of "main.js"
     // https://v2.quasar.dev/quasar-cli-vite/boot-files
+
     boot: [
       "i18n",
       "axios",
       "setPermissions",
       "defaultPropsComponents",
+
       // "socket.io",
     ],
 
     // https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#css
+
     css: ["app.scss"],
 
     // https://github.com/quasarframework/quasar/tree/dev/extras
+
     extras: [
       // 'ionicons-v4',
+
       "mdi-v7",
+
       // 'fontawesome-v6',
       // 'eva-icons',
       // 'themify',
+
       "line-awesome",
+
       // 'roboto-font-latin-ext', // this or either 'roboto-font', NEVER both!
 
       "roboto-font", // optional, you are not bound to it
@@ -40,6 +48,7 @@ export default configure((ctx) => {
     ],
 
     // Full list of options: https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#build
+
     build: {
       target: {
         browser: ["es2022", "firefox115", "chrome115", "safari14"],
@@ -47,6 +56,7 @@ export default configure((ctx) => {
       },
 
       vueRouterMode: "history", // available values: 'hash', 'history'
+
       // vueRouterBase,
       // vueDevtools,
       // vueOptionsAPI: false,
@@ -55,19 +65,29 @@ export default configure((ctx) => {
 
       // publicPath: '/',
       // analyze: true,
-      env: {
-        API_URL: ctx.dev
+
+      env: ((isDev, isProd) => ({
+        API_URL: isDev
           ? "http://localhost:8000"
-          : "https://api.test.softpar.inf.br/alugap",
-        PASSWORD: ctx.dev ? "KizzoOwner@123" : "",
-        WEBSOCKET_API: ctx.dev
+          : isProd
+            ? "https://api.kizzo.com.br"
+            : "https://api.test.softpar.inf.br/alugap",
+
+        PASSWORD: isDev ? "KizzoOwner@123" : "",
+
+        WEBSOCKET_API: isDev
           ? "http://localhost:4321/"
-          : "https://test-ws.softpar.inf.br/",
-        WEBSOCKET_PATH: ctx.dev ? "/socket.io" : "/socket.io",
-        WEBSOCKET_ROOM: ctx.dev ? "LARAVEL" : "LARAVEL",
+          : isProd
+            ? "https://ws.softpar.inf.br/"
+            : "https://test-ws.softpar.inf.br/",
+
+        WEBSOCKET_PATH: isDev ? "/socket.io" : "/socket.io",
+        WEBSOCKET_ROOM: isDev ? "LARAVEL" : "LARAVEL",
+
         WEBSOCKET_API_KEY:
           "7wArC/kl0nTbt4zBu0agw.NXLyjA96I6x1XmBcuokwPqfo3/CIxzqYw.PTthh5eqa08Uf4ubFlOqatpShoz1CRRID9pZReEFvBk3il6E9u",
-      },
+      }))(ctx.dev, process.env.APP_ENV === "production"),
+
       // rawDefine: {}
       // ignorePublicFolder: true,
       // minify: false,
@@ -86,11 +106,13 @@ export default configure((ctx) => {
 
             // if you want to use named tokens in your Vue I18n messages, such as 'Hello {name}',
             // you need to set `runtimeOnly: false`
+
             runtimeOnly: false,
 
             ssr: ctx.modeName === "ssr",
 
             // you need to set i18n resource including paths !
+
             include: [fileURLToPath(new URL("./src/i18n", import.meta.url))],
           },
         ],
@@ -107,12 +129,15 @@ export default configure((ctx) => {
     },
 
     // Full list of options: https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#devServer
+
     devServer: {
       // https: true
+
       open: true, // opens browser window automatically
     },
 
     // https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#framework
+
     framework: {
       lang: "pt-BR",
       config: {
@@ -133,11 +158,13 @@ export default configure((ctx) => {
       // directives: [],
 
       // Quasar plugins
+
       plugins: ["Dialog", "Notify", "Loading", "Cookies", "Dark"],
     },
 
     // animations: 'all', // --- includes all animations
     // https://v2.quasar.dev/options/animations
+
     animations: [],
 
     // https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#property-sourcefiles
@@ -154,8 +181,10 @@ export default configure((ctx) => {
     // },
 
     // https://v2.quasar.dev/quasar-cli-vite/developing-ssr/configuring-ssr
+
     ssr: {
       prodPort: 3000, // The default port that the production server should use
+
       // (gets superseded if process.env.PORT is specified at runtime)
 
       middlewares: [
@@ -180,8 +209,10 @@ export default configure((ctx) => {
     },
 
     // https://v2.quasar.dev/quasar-cli-vite/developing-pwa/configuring-pwa
+
     pwa: {
       workboxMode: "GenerateSW", // 'GenerateSW' or 'InjectManifest'
+
       // swFilename: 'sw.js',
       // manifestFilename: 'manifest.json'
       // extendManifestJson (json) {},
@@ -193,16 +224,19 @@ export default configure((ctx) => {
     },
 
     // Full list of options: https://v2.quasar.dev/quasar-cli-vite/developing-cordova-apps/configuring-cordova
+
     cordova: {
       // noIosLegacyBuildFlag: true, // uncomment only if you know what you are doing
     },
 
     // Full list of options: https://v2.quasar.dev/quasar-cli-vite/developing-capacitor-apps/configuring-capacitor
+
     capacitor: {
       hideSplashscreen: true,
     },
 
     // Full list of options: https://v2.quasar.dev/quasar-cli-vite/developing-electron-apps/configuring-electron
+
     electron: {
       // extendElectronMainConf (esbuildConf) {},
       // extendElectronPreloadConf (esbuildConf) {},
@@ -210,9 +244,11 @@ export default configure((ctx) => {
       // extendPackageJson (json) {},
 
       // Electron preload scripts (if any) from /src-electron, WITHOUT file extension
+
       preloadScripts: ["electron-preload"],
 
       // specify the debugging port to use for the Electron app when running in development mode
+
       inspectPort: 5858,
 
       bundler: "packager", // 'packager' or 'builder'
@@ -236,6 +272,7 @@ export default configure((ctx) => {
     },
 
     // Full list of options: https://v2.quasar.dev/quasar-cli-vite/developing-browser-extensions/configuring-bex
+
     bex: {
       // extendBexScriptsConf (esbuildConf) {},
       // extendBexManifestJson (json) {},

+ 2 - 2
src/helpers/buildMetricCards.js

@@ -12,7 +12,7 @@ const capitalize = (text) => {
 };
 
 export function buildMetricCards(summary, options = {}) {
-  const { isAllPropertiesSelected = false, referenceLabel = "" } = options;
+  const { isAllPropertiesSelected = false } = options;
 
   const manualExpenses =
     summary.expenses_breakdown?.items?.filter(
@@ -85,7 +85,7 @@ export function buildMetricCards(summary, options = {}) {
     {
       label: "faturamento bruto",
       value: formatCurrency(summary.gross_revenue),
-      caption: referenceLabel || "Mês selecionado",
+      caption: "pago pelo hóspede",
     },
 
     {

+ 7 - 1
src/pages/dashboard/components/DashboardMetricCard.vue

@@ -29,11 +29,12 @@ defineProps({
 <style scoped lang="scss">
 .metric-card {
   display: grid;
-  grid-template-rows: 56px 34px 22px;
+  grid-template-rows: auto auto auto;
   align-items: start;
   gap: 6px;
   min-height: 106px;
   min-width: 0;
+  overflow: hidden;
   padding: 12px 16px;
   border: 1px solid #d9e3e7;
   border-radius: 12px;
@@ -77,6 +78,8 @@ defineProps({
 .metric-caption--nowrap {
   font-size: 13px;
   white-space: nowrap;
+  overflow: hidden;
+  text-overflow: ellipsis;
 }
 
 @media (max-width: 640px) {
@@ -100,6 +103,9 @@ defineProps({
 
   .metric-caption--nowrap {
     font-size: 12px;
+    white-space: normal;
+    overflow: visible;
+    text-overflow: clip;
   }
 }
 </style>

+ 3 - 3
src/stores/syncExecution.js

@@ -10,9 +10,9 @@ export const syncExecutionStore = defineStore("syncExecution", () => {
       const executions = await getSyncExecutions();
 
       if (executions && executions.length > 0) {
-        const lastSuccess = [...executions]
-          .reverse()
-          .find((e) => e.status === "success");
+        const lastSuccess = executions.find(
+          (execution) => execution.status === "success",
+        );
 
         lastSyncExecution.value = lastSuccess || null;
       }