Skip to content

Commit

Permalink
Remove application entity
Browse files Browse the repository at this point in the history
  • Loading branch information
awelless committed Oct 2, 2023
1 parent 9ed4b24 commit affd0d9
Show file tree
Hide file tree
Showing 72 changed files with 214 additions and 1,497 deletions.
2 changes: 1 addition & 1 deletion admin-console-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "admin-client-ui",
"version": "0.0.1",
"version": "0.2.0",
"description": "A web ui for mail-it admin console",
"productName": "MailIt client",
"author": "Alaksiej Ščarbaty <hahaha.funny.yellow.dog@gmail.com>",
Expand Down
4 changes: 2 additions & 2 deletions admin-console-ui/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
<q-item clickable to="/types">
<q-item-section> Mail Types </q-item-section>
</q-item>
<q-item clickable to="/applications">
<q-item-section> Applications </q-item-section>
<q-item clickable to="/api-keys">
<q-item-section> Api Keys </q-item-section>
</q-item>
</q-list>
</q-drawer>
Expand Down
4 changes: 2 additions & 2 deletions admin-console-ui/src/boot/axios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ declare module '@vue/runtime-core' {
// good idea to move this instance creation inside of the
// "export default () => {}" function below (which runs individually
// for each client)
// const url = 'http://localhost:8080/api/admin'
const url = '/api/admin'
const url = 'http://localhost:8080/api/admin'
// const url = '/api/admin'
const api = axios.create({
baseURL: url,
withCredentials: true,
Expand Down
14 changes: 7 additions & 7 deletions admin-console-ui/src/client/apiKeyClient.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { api } from 'boot/axios'
import { ApiKey } from 'src/models/ApiKey'

async function getAll(applicationId: string): Promise<ApiKey[]> {
const { data } = await api.get<ApiKey[]>(`/applications/${applicationId}/api-keys`)
async function getAll(): Promise<ApiKey[]> {
const { data } = await api.get<ApiKey[]>('/api-keys')
return data
}

async function create(applicationId: string, name: string, expirationDays: number): Promise<string> {
const { data, status } = await api.post(`/applications/${applicationId}/api-keys`, { name, expirationDays })
async function create(name: string, expirationDays: number): Promise<string> {
const { data, status } = await api.post('/api-keys', { name, expirationDays })

if (status != 201) {
throw Error(`Failed to create Api Key: ${JSON.stringify(data)}`)
Expand All @@ -16,11 +16,11 @@ async function create(applicationId: string, name: string, expirationDays: numbe
return data.token
}

async function deleteApiKey(applicationId: string, apiKeyId: string): Promise<void> {
const { data, status } = await api.delete(`/applications/${applicationId}/api-keys/${apiKeyId}`)
async function deleteApiKey(apiKeyId: string): Promise<void> {
const { data, status } = await api.delete(`/api-keys/${apiKeyId}`)

if (status != 204) {
throw Error(`Failed to delete Application: ${JSON.stringify(data)}`)
throw Error(`Failed to delete ApiKey: ${JSON.stringify(data)}`)
}
}

Expand Down
48 changes: 0 additions & 48 deletions admin-console-ui/src/client/applicationClient.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import { defineProps, ref } from 'vue'
import apiKeyClient from 'src/client/apiKeyClient'
const props = defineProps<{
applicationId: string,
onCreate: () => void,
}>()
Expand All @@ -50,7 +49,7 @@ async function create() {
return
}
token.value = await apiKeyClient.create(props.applicationId, keyName, expirationDays.value)
token.value = await apiKeyClient.create(keyName, expirationDays.value)
props.onCreate()
}
Expand Down
22 changes: 0 additions & 22 deletions admin-console-ui/src/components/application/ApplicationCard.vue

This file was deleted.

10 changes: 0 additions & 10 deletions admin-console-ui/src/models/Application.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,14 @@
</q-card>
</q-dialog>

<CreateApiKey v-model="showCreate" :application-id="applicationId" :on-create="load"/>
<CreateApiKey v-model="showCreate" :on-create="load"/>
</template>

<script setup lang="ts">
import { defineProps, ref } from 'vue'
import { ref } from 'vue'
import { ApiKey } from 'src/models/ApiKey'
import apiKeyClient from 'src/client/apiKeyClient'
import CreateApiKey from 'components/application/CreateApiKey.vue'
const props = defineProps<{
applicationId: string,
}>()
import CreateApiKey from 'components/CreateApiKey.vue'
const columns = [
{ name: 'name', label: 'Name', field: 'name' },
Expand All @@ -66,7 +62,7 @@ const deletedApiKey = ref<ApiKey | null>(null)
load()
async function load() {
apiKeys.value = await apiKeyClient.getAll(props.applicationId)
apiKeys.value = await apiKeyClient.getAll()
}
function initiateDeletion(apiKey: ApiKey) {
Expand All @@ -81,7 +77,7 @@ async function deleteKey() {
return
}
await apiKeyClient.deleteApiKey(props.applicationId, apiKey.id)
await apiKeyClient.deleteApiKey(apiKey.id)
await load()
showDelete.value = false
Expand Down
2 changes: 0 additions & 2 deletions admin-console-ui/src/pages/LoginPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@
import { ref } from 'vue'
import authClient from 'src/client/authClient'
import { userStore } from 'stores/userStore'
import { useRouter } from 'vue-router'
import { useQuasar } from 'quasar'
const router = useRouter()
const quasar = useQuasar()
const user = userStore()
Expand Down
64 changes: 0 additions & 64 deletions admin-console-ui/src/pages/application/ApplicationPage.vue

This file was deleted.

33 changes: 0 additions & 33 deletions admin-console-ui/src/pages/application/ApplicationsPage.vue

This file was deleted.

30 changes: 0 additions & 30 deletions admin-console-ui/src/pages/application/CreateApplicationPage.vue

This file was deleted.

13 changes: 2 additions & 11 deletions admin-console-ui/src/router/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,8 @@ const routes: RouteRecordRaw[] = [
props: true,
},
{
path: '/applications',
component: () => import('pages/application/ApplicationsPage.vue'),
},
{
path: '/applications/create',
component: () => import('pages/application/CreateApplicationPage.vue'),
},
{
path: '/applications/:id',
component: () => import('pages/application/ApplicationPage.vue'),
props: true,
path: '/api-keys',
component: () => import('pages/ApiKeysPage.vue'),
},
{
path: '/:catchAll(.*)*',
Expand Down
Loading

0 comments on commit affd0d9

Please sign in to comment.