diff --git a/assets/src/App.vue b/assets/src/App.vue index 43e89b0c..8baf0567 100644 --- a/assets/src/App.vue +++ b/assets/src/App.vue @@ -6,6 +6,7 @@ export default { name: 'app', mounted: function () { + // Remove loading animation. let loading = document.getElementById('loading') loading.classList.add('done') diff --git a/assets/src/components/Files.vue b/assets/src/components/Files.vue new file mode 100644 index 00000000..317b0a8b --- /dev/null +++ b/assets/src/components/Files.vue @@ -0,0 +1,171 @@ + + + diff --git a/assets/src/components/Header.vue b/assets/src/components/Header.vue new file mode 100644 index 00000000..efd8f3a0 --- /dev/null +++ b/assets/src/components/Header.vue @@ -0,0 +1,135 @@ + + + diff --git a/assets/src/components/Main.vue b/assets/src/components/Main.vue index fda49a1c..de9b0f87 100644 --- a/assets/src/components/Main.vue +++ b/assets/src/components/Main.vue @@ -1,273 +1,34 @@ diff --git a/assets/src/components/Sidebar.vue b/assets/src/components/Sidebar.vue index fc5457a9..8f2d8adb 100644 --- a/assets/src/components/Sidebar.vue +++ b/assets/src/components/Sidebar.vue @@ -25,7 +25,7 @@
- + settings_applications Settings diff --git a/assets/src/components/User.vue b/assets/src/components/User.vue new file mode 100644 index 00000000..43b971e6 --- /dev/null +++ b/assets/src/components/User.vue @@ -0,0 +1,177 @@ + + + + + diff --git a/assets/src/components/Users.vue b/assets/src/components/Users.vue new file mode 100644 index 00000000..b6c01803 --- /dev/null +++ b/assets/src/components/Users.vue @@ -0,0 +1,11 @@ + + + diff --git a/assets/src/css/base.css b/assets/src/css/base.css index 3d9e6624..898ece28 100644 --- a/assets/src/css/base.css +++ b/assets/src/css/base.css @@ -3,6 +3,7 @@ body { padding-top: 4em; background-color: #f8f8f8; user-select: none; + color: #333; } * { diff --git a/assets/src/router/index.js b/assets/src/router/index.js index 5695a74e..16a6b01d 100644 --- a/assets/src/router/index.js +++ b/assets/src/router/index.js @@ -2,6 +2,10 @@ import Vue from 'vue' import Router from 'vue-router' import Login from '@/components/Login' import Main from '@/components/Main' +import Files from '@/components/Files' +import Users from '@/components/Users' +import User from '@/components/User' +import Settings from '@/components/Settings' import auth from '@/utils/auth.js' Vue.use(Router) @@ -40,11 +44,29 @@ const router = new Router({ children: [ { path: '/files/*', - name: 'Files' + name: 'Files', + component: Files }, { - path: '/dashboard', - name: 'Dashboard' + path: '/settings', + name: 'Settings', + component: Settings + }, + { + path: '/users', + name: 'Users', + component: Users + }, + { + path: '/users/', + redirect: { + path: '/users' + } + }, + { + path: '/users/*', + name: 'User', + component: User }, { path: '/*', diff --git a/assets/src/store/index.js b/assets/src/store/index.js index 43a79789..825237d8 100644 --- a/assets/src/store/index.js +++ b/assets/src/store/index.js @@ -10,6 +10,7 @@ const state = { req: {}, baseURL: document.querySelector('meta[name="base"]').getAttribute('content'), jwt: '', + loading: false, reload: false, selected: [], multiple: false, diff --git a/assets/src/store/mutations.js b/assets/src/store/mutations.js index 42581bf7..4035439a 100644 --- a/assets/src/store/mutations.js +++ b/assets/src/store/mutations.js @@ -16,6 +16,7 @@ const mutations = { state.show = 'error' state.showMessage = value }, + setLoading: (state, value) => { state.loading = value }, setReload: (state, value) => { state.reload = value }, setUser: (state, value) => (state.user = value), setJWT: (state, value) => (state.jwt = value), diff --git a/assets/src/utils/api.js b/assets/src/utils/api.js index b20c67b5..d76f1397 100644 --- a/assets/src/utils/api.js +++ b/assets/src/utils/api.js @@ -105,7 +105,7 @@ function move (oldLink, newLink) { return new Promise((resolve, reject) => { let request = new window.XMLHttpRequest() - request.open('POST', `${store.state.baseURL}/api/resource${oldLink}`, true) + request.open('PATCH', `${store.state.baseURL}/api/resource${oldLink}`, true) request.setRequestHeader('Authorization', `Bearer ${store.state.jwt}`) request.setRequestHeader('Destination', newLink) @@ -190,6 +190,27 @@ function download (format, ...files) { window.open(url) } +function getUser (id) { + return new Promise((resolve, reject) => { + let request = new window.XMLHttpRequest() + request.open('GET', `${store.state.baseURL}/api/users/${id}`, true) + request.setRequestHeader('Authorization', `Bearer ${store.state.jwt}`) + + request.onload = () => { + switch (request.status) { + case 200: + resolve(JSON.parse(request.responseText)) + break + default: + reject(request.responseText) + break + } + } + request.onerror = (error) => reject(error) + request.send() + }) +} + export default { delete: rm, fetch, @@ -199,5 +220,6 @@ export default { post, command, search, - download + download, + getUser } diff --git a/filemanager.go b/filemanager.go index b4f75ace..1aee0f76 100644 --- a/filemanager.go +++ b/filemanager.go @@ -85,21 +85,21 @@ type User struct { // Rule is a dissalow/allow rule. type Rule struct { // Regex indicates if this rule uses Regular Expressions or not. - Regex bool + Regex bool `json:"regex"` // Allow indicates if this is an allow rule. Set 'false' to be a disallow rule. - Allow bool + Allow bool `json:"allow"` // Path is the corresponding URL path for this rule. - Path string + Path string `json:"path"` // Regexp is the regular expression. Only use this when 'Regex' was set to true. - Regexp *Regexp + Regexp *Regexp `json:"regexp"` } // Regexp is a regular expression wrapper around native regexp. type Regexp struct { - Raw string + Raw string `json:"raw"` regexp *regexp.Regexp }