mirror of
https://github.com/EvolutionAPI/evolution-manager.git
synced 2025-12-23 13:02:13 -06:00
first commit
This commit is contained in:
75
src/components/HelloWorld.vue
Normal file
75
src/components/HelloWorld.vue
Normal file
@@ -0,0 +1,75 @@
|
||||
<template>
|
||||
<v-container class="fill-height">
|
||||
<v-responsive class="align-center text-center fill-height">
|
||||
<v-img height="300" src="@/assets/logo.svg" />
|
||||
|
||||
<div class="text-body-2 font-weight-light mb-n1">Welcome to</div>
|
||||
|
||||
<h1 class="text-h2 font-weight-bold">Vuetify</h1>
|
||||
|
||||
<div class="py-14" />
|
||||
|
||||
<v-row class="d-flex align-center justify-center">
|
||||
<v-col cols="auto">
|
||||
<v-btn
|
||||
href="https://vuetifyjs.com/components/all/"
|
||||
min-width="164"
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
variant="text"
|
||||
>
|
||||
<v-icon
|
||||
icon="mdi-view-dashboard"
|
||||
size="large"
|
||||
start
|
||||
/>
|
||||
|
||||
Components
|
||||
</v-btn>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="auto">
|
||||
<v-btn
|
||||
color="primary"
|
||||
href="https://vuetifyjs.com/introduction/why-vuetify/#feature-guides"
|
||||
min-width="228"
|
||||
rel="noopener noreferrer"
|
||||
size="x-large"
|
||||
target="_blank"
|
||||
variant="flat"
|
||||
>
|
||||
<v-icon
|
||||
icon="mdi-speedometer"
|
||||
size="large"
|
||||
start
|
||||
/>
|
||||
|
||||
Get Started
|
||||
</v-btn>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="auto">
|
||||
<v-btn
|
||||
href="https://community.vuetifyjs.com/"
|
||||
min-width="164"
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
variant="text"
|
||||
>
|
||||
<v-icon
|
||||
icon="mdi-account-group"
|
||||
size="large"
|
||||
start
|
||||
/>
|
||||
|
||||
Community
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-responsive>
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
//
|
||||
</script>
|
||||
116
src/components/modal/CreateInstance.vue
Normal file
116
src/components/modal/CreateInstance.vue
Normal file
@@ -0,0 +1,116 @@
|
||||
<template>
|
||||
<v-dialog
|
||||
v-model="dialog"
|
||||
max-width="500px"
|
||||
:persistent="!AppStore.validConnection"
|
||||
>
|
||||
<v-card>
|
||||
<v-card-text>
|
||||
<v-form v-model="valid">
|
||||
<h3 class="mb-4">Criar instancia</h3>
|
||||
<v-text-field
|
||||
v-model="instance.instanceName"
|
||||
label="Nome"
|
||||
required
|
||||
outlined
|
||||
:rules="[
|
||||
// Verify is not have any caracter except letters, numbers, _ and -
|
||||
(v) =>
|
||||
new RegExp('^[a-zA-Z0-9_-]*$', 'i').test(v) ||
|
||||
'Nome inválido (apenas letras, números, _ e -)',
|
||||
]"
|
||||
/>
|
||||
<v-text-field
|
||||
v-model="instance.apiKey"
|
||||
label="API Key"
|
||||
required
|
||||
outlined
|
||||
@click:prepend-inner="generateApiKey"
|
||||
prepend-inner-icon="mdi-lock-reset"
|
||||
:rules="[
|
||||
// Verify is not have any caracter except letters, numbers, _ and -
|
||||
(v) =>
|
||||
new RegExp('^[a-zA-Z0-9_-]*$', 'i').test(v) ||
|
||||
'Nome inválido (apenas letras, números, _ e -)',
|
||||
]"
|
||||
/>
|
||||
</v-form>
|
||||
|
||||
<v-alert type="error" v-if="error">
|
||||
{{ Array.isArray(error) ? error.join(", ") : error }}
|
||||
</v-alert>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn
|
||||
v-if="AppStore.validConnection"
|
||||
text
|
||||
@click="dialog = false"
|
||||
:disabled="loading"
|
||||
>
|
||||
Cancel
|
||||
</v-btn>
|
||||
<v-btn
|
||||
color="success"
|
||||
variant="tonal"
|
||||
@click="save"
|
||||
:disabled="!valid"
|
||||
:loading="loading"
|
||||
>
|
||||
Conectar
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import instanceController from "@/services/instanceController";
|
||||
import { useAppStore } from "@/store/app";
|
||||
|
||||
export default {
|
||||
name: "SettingsModal",
|
||||
data: () => ({
|
||||
dialog: false,
|
||||
valid: false,
|
||||
instance: {
|
||||
instanceName: "",
|
||||
apiKey: "",
|
||||
},
|
||||
loading: false,
|
||||
error: false,
|
||||
AppStore: useAppStore(),
|
||||
}),
|
||||
methods: {
|
||||
generateApiKey() {
|
||||
this.instance.apiKey =
|
||||
Math.random().toString(36).substring(2, 15) +
|
||||
Math.random().toString(36).substring(2, 15);
|
||||
},
|
||||
async save() {
|
||||
try {
|
||||
this.loading = true;
|
||||
this.error = false;
|
||||
|
||||
const instance = await instanceController.create(this.instance);
|
||||
|
||||
this.$router.push({
|
||||
name: "instance",
|
||||
params: { id: instance.instance.instanceName },
|
||||
});
|
||||
|
||||
} catch (e) {
|
||||
this.error = e.message?.message || e.message || e;
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
open() {
|
||||
this.dialog = true;
|
||||
this.generateApiKey();
|
||||
},
|
||||
},
|
||||
|
||||
emits: ["close"],
|
||||
};
|
||||
</script>
|
||||
89
src/components/modal/Settings.vue
Normal file
89
src/components/modal/Settings.vue
Normal file
@@ -0,0 +1,89 @@
|
||||
<template>
|
||||
<v-dialog v-model="dialog" max-width="500px" :persistent="!AppStore.validConnection">
|
||||
<v-card>
|
||||
<v-card-text>
|
||||
<v-form v-model="valid">
|
||||
<h3 class="mb-4">Configurar conexão</h3>
|
||||
<v-text-field
|
||||
v-model="connection.host"
|
||||
label="URL"
|
||||
required
|
||||
outlined
|
||||
:rules="[
|
||||
// regex to verify is has http or https
|
||||
(v) =>
|
||||
new RegExp('^(http|https)://', 'i').test(v) || 'URL inválida',
|
||||
]"
|
||||
/>
|
||||
<v-text-field
|
||||
v-model="connection.globalApiKey"
|
||||
label="Global API Key"
|
||||
required
|
||||
outlined
|
||||
:type="revelPassword ? 'text' : 'password'"
|
||||
:append-inner-icon="revelPassword ? 'mdi-eye' : 'mdi-eye-off'"
|
||||
@click:append-inner="revelPassword = !revelPassword"
|
||||
/>
|
||||
</v-form>
|
||||
|
||||
<v-alert type="error" v-if="error">
|
||||
{{ Array.isArray(error) ? error.join(", ") : error }}
|
||||
</v-alert>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn v-if="AppStore.validConnection" text @click="dialog = false" :disabled="loading">Cancel</v-btn>
|
||||
<v-btn
|
||||
color="success"
|
||||
variant="tonal"
|
||||
@click="save"
|
||||
:disabled="!valid"
|
||||
:loading="loading"
|
||||
>
|
||||
Conectar
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { useAppStore } from "@/store/app";
|
||||
|
||||
export default {
|
||||
name: "SettingsModal",
|
||||
data: () => ({
|
||||
dialog: false,
|
||||
valid: false,
|
||||
revelPassword: false,
|
||||
connection: {
|
||||
host: "",
|
||||
globalApiKey: "",
|
||||
},
|
||||
loading: false,
|
||||
error: false,
|
||||
AppStore: useAppStore(),
|
||||
}),
|
||||
methods: {
|
||||
async save() {
|
||||
try {
|
||||
this.loading = true;
|
||||
this.error = false;
|
||||
|
||||
await this.AppStore.setConnection(this.connection);
|
||||
this.dialog = false;
|
||||
} catch (e) {
|
||||
this.error = e.message?.message || e.message || e;
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
open() {
|
||||
this.dialog = true;
|
||||
this.connection = this.AppStore.connection;
|
||||
},
|
||||
},
|
||||
|
||||
emits: ["close"],
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user