Merge remote-tracking branch 'origin/dev'
This commit is contained in:
@@ -16,6 +16,11 @@ rmrestart:
|
||||
docker stop proxy-ui-vue
|
||||
docker run -d --name proxy-ui-vue --rm -p 5000:80 proxy-ui-vue
|
||||
|
||||
clearhook:
|
||||
@echo "clear hooks"
|
||||
@rm -f $(HOOK_PATH)
|
||||
@echo "hooks cleared"
|
||||
|
||||
prehook:
|
||||
@echo "Setting up pre-push hook..."
|
||||
@rm -f $(HOOK_PATH)
|
||||
@@ -37,11 +42,9 @@ prehook:
|
||||
@chmod +x $(HOOK_PATH)
|
||||
@echo "Pre-push hook set successfully."
|
||||
|
||||
|
||||
|
||||
push:
|
||||
ifeq ($(commit),)
|
||||
$(error mn is not set)
|
||||
endif
|
||||
make prehook
|
||||
git add . && git commit -m "feat($(commit)):" && GIT_SSL_NO_VERIFY=true git push
|
||||
git add . && git commit -m "feat($(commit)):" && git push
|
||||
|
||||
@@ -16,21 +16,26 @@ export default {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex">
|
||||
<a
|
||||
href="/#"
|
||||
class="text-white block w-fit bg-slate-700 hover:bg-blue-600 focus:outline-none focus:ring-4 focus:ring-blue-300 font-medium rounded-full text-sm text-center px-5 py-2.5 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"
|
||||
>
|
||||
<i class="ri-reply-line" />
|
||||
На главную
|
||||
</a>
|
||||
<button
|
||||
:class="`w-fit text-white font-medium rounded-full text-sm px-5 py-2.5 text-center me-2 mx-2 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800 ${!selectedSite ? 'bg-blue-200' : 'bg-blue-700 hover:bg-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300'}`"
|
||||
:disabled="!selectedSite"
|
||||
@click="saveData"
|
||||
>
|
||||
<i class="ri-save-line cursor-pointer" />
|
||||
Сохранить изменения
|
||||
</button>
|
||||
<div class="flex justify-between">
|
||||
<div class="flex">
|
||||
<a
|
||||
href="/#"
|
||||
class="text-white block w-fit bg-slate-700 hover:bg-blue-600 focus:outline-none focus:ring-4 focus:ring-blue-300 font-medium rounded-full text-sm text-center px-5 py-2.5 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"
|
||||
>
|
||||
<i class="ri-reply-line" />
|
||||
На главную
|
||||
</a>
|
||||
<button
|
||||
:class="`w-fit text-white font-medium rounded-full text-sm px-5 py-2.5 text-center me-2 mx-2 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800 ${!selectedSite ? 'bg-blue-200' : 'bg-blue-700 hover:bg-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300'}`"
|
||||
:disabled="!selectedSite"
|
||||
@click="saveData"
|
||||
>
|
||||
<i class="ri-save-line cursor-pointer" />
|
||||
Сохранить изменения
|
||||
</button>
|
||||
</div>
|
||||
<div class="flex test-slate-300 text-xs">
|
||||
Версия 1.0.1
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -15,7 +15,6 @@ export default {
|
||||
default: "",
|
||||
type: String
|
||||
},
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -37,6 +36,7 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {describe, expect, beforeEach} from 'vitest'
|
||||
import {describe, expect, beforeEach, it} from 'vitest'
|
||||
import {createStore} from 'vuex'
|
||||
import {store} from '@store/modules/proxy/index.js'
|
||||
// import {store as services} from '@store/modules/proxy/index.js'
|
||||
import {addedSite, updatedSite, removedNewSite, deletedSite} from '@store/modules/proxy/helpers.js'
|
||||
|
||||
const sites = store.state.sites
|
||||
@@ -24,6 +25,13 @@ const breakSavingSite = store.actions.breakSavingSite
|
||||
const removeSite = store.actions.removeSite
|
||||
const resetStore = store.actions.resetStore
|
||||
|
||||
// const store = createStore({
|
||||
// plugins: [],
|
||||
// modules: {
|
||||
// services
|
||||
// },
|
||||
// })
|
||||
|
||||
const defaultSites = [ {
|
||||
"id": 1,
|
||||
"created_at": "2024-02-22T17:08:37.715772388+03:00",
|
||||
@@ -33,6 +41,7 @@ const defaultSites = [ {
|
||||
"port": 9965,
|
||||
"proxy_ip": "172.25.78.153",
|
||||
"site_ip": "172.25.78.153",
|
||||
"device_ip": "172.25.78.153",
|
||||
"internet_uri": "localhost",
|
||||
"description": "localhost",
|
||||
"is_online": true
|
||||
@@ -46,6 +55,7 @@ const defaultSites = [ {
|
||||
"port": 3645,
|
||||
"proxy_ip": "172.25.78.151",
|
||||
"site_ip": "172.25.78.151",
|
||||
"device_ip": "172.25.78.151",
|
||||
"internet_uri": "",
|
||||
"description": "create... upd...",
|
||||
"is_online": true
|
||||
@@ -59,6 +69,7 @@ const defaultSites = [ {
|
||||
"port": 3645,
|
||||
"proxy_ip": "172.25.78.151",
|
||||
"site_ip": "172.25.78.151",
|
||||
"device_ip": "172.25.78.151",
|
||||
"internet_uri": "",
|
||||
"description": "new updated...",
|
||||
"is_online": false
|
||||
@@ -96,13 +107,13 @@ const mockStore = createStore({
|
||||
})
|
||||
|
||||
describe('mutations', () => {
|
||||
//eslint-disable-next-line no-undef
|
||||
|
||||
it('Set to empty Services', () => {
|
||||
const state = { sites: sites }
|
||||
setSites(state, null)
|
||||
expect(state.sites).to.equal(null)
|
||||
})
|
||||
//eslint-disable-next-line no-undef
|
||||
|
||||
it('Add new Service', () => {
|
||||
const newSite = {
|
||||
"id": 34,
|
||||
@@ -125,12 +136,12 @@ describe('mutations', () => {
|
||||
})
|
||||
|
||||
describe('actions', () => {
|
||||
//eslint-disable-next-line no-undef
|
||||
|
||||
it('action addNewSiteLayout - added fields for new Service', async () => {
|
||||
mockStore.dispatch('addNewSiteLayout')
|
||||
expect(mockStore.state.sites[0]).toMatchObject({id: -1})
|
||||
})
|
||||
//eslint-disable-next-line no-undef
|
||||
|
||||
it('action editSelectedSite - edited fields values in selected site', async () => {
|
||||
beforeEach(() => {
|
||||
mockStore.dispatch('resetStore')
|
||||
@@ -141,7 +152,7 @@ describe('actions', () => {
|
||||
mockStore.dispatch('editSelectedSite', {key: 'description', value: 'updated'})
|
||||
expect(mockStore.state.selectedSite).toMatchObject({name: 'edited test name', port: 5555, description: 'updated'})
|
||||
})
|
||||
//eslint-disable-next-line no-undef
|
||||
|
||||
it('action editSelectedSite - edited fields empty values in selected site', async () => {
|
||||
beforeEach(() => {
|
||||
mockStore.dispatch('resetStore')
|
||||
@@ -152,7 +163,7 @@ describe('actions', () => {
|
||||
mockStore.dispatch('editSelectedSite', {key: 'description', value: ''})
|
||||
expect(mockStore.state.selectedSite).toMatchObject({name: '', port: '', description: ''})
|
||||
})
|
||||
//eslint-disable-next-line no-undef
|
||||
|
||||
it('action breakSavingSite - cleared selected site, replaced to default status routesState', async () => {
|
||||
beforeEach(() => {
|
||||
mockStore.dispatch('resetStore')
|
||||
@@ -166,7 +177,7 @@ describe('actions', () => {
|
||||
expect(mockStore.state.selectedSite).toBeNull()
|
||||
expect(mockStore.state.routesState).toBe('await')
|
||||
})
|
||||
//eslint-disable-next-line no-undef
|
||||
|
||||
it('action resetStore - cleared all values in store', async () => {
|
||||
beforeEach(() => {
|
||||
mockStore.dispatch('resetStore')
|
||||
@@ -193,7 +204,7 @@ describe('actions', () => {
|
||||
})
|
||||
|
||||
describe('helpers', () => {
|
||||
//eslint-disable-next-line no-undef
|
||||
|
||||
it('added new site', async () => {
|
||||
beforeEach(() => {
|
||||
mockStore.dispatch('resetStore')
|
||||
@@ -220,7 +231,7 @@ describe('helpers', () => {
|
||||
expect(addedNewSite).toMatchObject(newSite)
|
||||
|
||||
})
|
||||
//eslint-disable-next-line no-undef
|
||||
|
||||
it('updated site', async () => {
|
||||
beforeEach(() => {
|
||||
mockStore.dispatch('resetStore')
|
||||
@@ -249,7 +260,7 @@ describe('helpers', () => {
|
||||
expect(updatedSiteToStore).not.toBe(undefined)
|
||||
expect(updatedSiteToStore).toMatchObject(editedSite)
|
||||
})
|
||||
//eslint-disable-next-line no-undef
|
||||
|
||||
it('updated site - empty params', async () => {
|
||||
beforeEach(() => {
|
||||
mockStore.dispatch('resetStore')
|
||||
@@ -278,7 +289,7 @@ describe('helpers', () => {
|
||||
expect(updatedSiteToStore).not.toBe(undefined)
|
||||
expect(updatedSiteToStore).toMatchObject(editedSite)
|
||||
})
|
||||
//eslint-disable-next-line no-undef
|
||||
|
||||
it('removed new site before saving to server', async () => {
|
||||
beforeEach(() => {
|
||||
mockStore.dispatch('resetStore')
|
||||
@@ -296,7 +307,7 @@ describe('helpers', () => {
|
||||
const removedSiteToStore = mockStore.state.sites.find(site => site.id === -1)
|
||||
expect(removedSiteToStore).toBe(undefined) // removed site to be undefined in array sites to store
|
||||
})
|
||||
//eslint-disable-next-line no-undef
|
||||
|
||||
it('deleted selected site before saving to server', async () => {
|
||||
beforeEach(() => {
|
||||
mockStore.dispatch('resetStore')
|
||||
|
||||
Reference in New Issue
Block a user