Skip to content
This repository was archived by the owner on Feb 1, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ node_modules
/dist

# local env files
.editorconfig
.env
.env.local
.env.*.local

Expand Down
131 changes: 131 additions & 0 deletions docs/swagger_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
---
swagger: "2.0"
info:
description: APIs for testing
title: Test APIs
version: 1.0.0
consumes:
- application/json
produces:
- application/json
schemes:
- http
- https
basePath: /v2
definitions:
role:
type: string
enum:
- admin
- staff
- visitor
user:
type: object
required:
- name
properties:
id:
type: integer
format: int64
readOnly: true
name:
type: string
age:
type: integer
format: int32
paths:
/users:
get:
summary: Find users
tags:
- users
operationId: findUsers
parameters:
- name: keyword
in: query
type: string
- name: sort
in: query
type: string
enum: ["+id", "-id"]
- name: perpage
in: query
type: integer
format: int32
responses:
200:
description: OK
schema:
type: object
properties:
data:
type: array
items:
$ref: "#/definitions/user"
total:
type: integer
format: int64
x-vuex-key:
data: users
post:
summary: Add a user
tags:
- users
operationId: addUser
parameters:
- name: body
in: body
schema:
$ref: "#/definitions/user"
responses:
201:
description: Created
schema:
$ref: "#/definitions/user"
/user/{id}:
parameters:
- type: integer
format: int64
name: id
in: path
required: true
get:
summary: Get a user by user ID
tags:
- users
operationId: getUser
responses:
200:
description: OK
schema:
type: object
properties:
data:
$ref: "#/definitions/user"
x-vuex-key:
data: user
put:
summary: Update a user by user ID
tags:
- users
operationId: updateUser
parameters:
- name: body
in: body
schema:
$ref: "#/definitions/user"
responses:
200:
description: OK
schema:
$ref: "#/definitions/user"
x-vuex-key:
data: user
delete:
summary: Delete a user by user ID
tags:
- users
operationId: deleteUser
responses:
204:
description: Deleted
12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "hello-world",
"name": "erp-os-frontend",
"version": "0.1.0",
"private": true,
"scripts": {
Expand All @@ -10,11 +10,19 @@
"test:unit": "vue-cli-service test:unit"
},
"dependencies": {
"@vuikit/icons": "^0.8.1",
"@vuikit/theme": "^0.8.1",
"axios": "^0.19.0",
"core-js": "^2.6.5",
"label-edit": "^0.0.9",
"vue": "^2.6.10",
"vue-i18n": "^8.0.0",
"vue-router": "^3.0.3",
"vuex": "^3.0.1"
"vue-search-select": "^2.8.3",
"vue2-timepicker": "^0.1.4",
"vuejs-datepicker": "^1.5.4",
"vuex": "^3.1.1",
"vuikit": "^0.8.10"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.8.0",
Expand Down
4 changes: 2 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>hello-world</title>
<title>erp-os-frontend</title>
</head>
<body>
<noscript>
<strong>We're sorry but hello-world doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
<strong>We're sorry but erp-os-frontend doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
Expand Down
58 changes: 58 additions & 0 deletions src/APIActions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
export const types = [
'GET_V2_USERS',
'POST_V2_USERS',
'GET_V2_USER_BY_ID',
'PUT_V2_USER_BY_ID',
'DELETE_V2_USER_BY_ID',
].reduce((obj, val) => Object.assign(obj, { [val]: val }), {});

export let ajax = {};
export function init(a) { ajax = a; }

export function getV2Users(context, query) {
return ajax.get('/v2/users', { params: query })
.then((res) => {
context.commit(types.GET_V2_USERS, res.data);
return res.data;
});
}
export function postV2Users(context, body) {
return ajax.post('/v2/users', body)
.then((res) => {
context.commit(types.POST_V2_USERS, res.data);
return res.data;
});
}
export function getV2UserById(context, id) {
return ajax.get(`/v2/user/${id}`)
.then((res) => {
context.commit(types.GET_V2_USER_BY_ID, res.data);
return res.data;
});
}
export function putV2UserById(context, id, body) {
return ajax.put(`/v2/user/${id}`, body)
.then((res) => {
context.commit(types.PUT_V2_USER_BY_ID, res.data);
return res.data;
});
}
export function deleteV2UserById(context, id) {
return ajax.delete(`/v2/user/${id}`)
.then((res) => {
context.commit(types.DELETE_V2_USER_BY_ID, res.data);
return res.data;
});
}

export const mutations = {
[types.GET_V2_USERS](state, payload) {
state.users = payload.data;
},
[types.GET_V2_USER_BY_ID](state, payload) {
state.user = payload.data;
},
[types.PUT_V2_USER_BY_ID](state, payload) {
state.user = payload.data;
},
};
5 changes: 3 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<template>
<div id="app">
<div id="nav">
<router-link to="/">Home</router-link> |
<router-link to="/about">About</router-link>
<router-link to="/">Overview</router-link> |
<router-link to="/apiview">API</router-link> |
<router-link to="/table">Table</router-link>
</div>
<router-view/>
</div>
Expand Down
44 changes: 44 additions & 0 deletions src/components/API.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<template>
<div class="api">
<h1>{{ msg }}</h1>
<h3>Project</h3>
<ul>
<li><a href="" target="_blank" rel="noopener">Project Add</a></li>
</ul>
<h3>TimeTrackingEntry</h3>
<ul>
<li><a href="" target="_blank" rel="noopener">Task Add</a></li>
</ul>
<h3>Task</h3>
<ul>
<li><a href="" target="_blank" rel="noopener">Time Entry Add</a></li>
</ul>
</div>
</template>

<script>
export default {
name: 'API',
props: {
msg: String,
},
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="scss">
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
59 changes: 0 additions & 59 deletions src/components/HelloWorld.vue

This file was deleted.

33 changes: 33 additions & 0 deletions src/components/callback.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<template>

</template>

<script>
import Route from '../router';

export default {
name: 'callback.vue',
methods: {
handleCallback() {
// eslint-disable-next-line camelcase
const access_hash = this.$route.hash;
// eslint-disable-next-line camelcase
const token_expires = access_hash.substring(access_hash.indexOf('expires_in=') + 11);
// eslint-disable-next-line camelcase
const access_token = access_hash.match(/\#(?:access_token)\=([\S\s]*?)\&/)[1];
// eslint-disable-next-line camelcase
localStorage.token = access_token;
// eslint-disable-next-line camelcase
localStorage.token_expires = token_expires;
Route.push({name: 'table' });
},
},
beforeMount() {
this.handleCallback();
},
};
</script>

<style scoped>

</style>
Loading