From 03939584a0376a33c58db1a7751e2312de11118c Mon Sep 17 00:00:00 2001 From: Jannik Stehle Date: Tue, 3 Jan 2023 15:48:36 +0100 Subject: [PATCH 01/11] Implement the spaces list in the admin settings --- packages/web-app-admin-settings/package.json | 3 +- .../src/components/Spaces/SpacesList.vue | 303 ++++++++++++++++++ packages/web-app-admin-settings/src/index.js | 21 ++ .../src/views/Spaces.vue | 160 +++++++++ packages/web-client/src/graph.ts | 7 +- pnpm-lock.yaml | 2 + 6 files changed, 494 insertions(+), 2 deletions(-) create mode 100644 packages/web-app-admin-settings/src/components/Spaces/SpacesList.vue create mode 100644 packages/web-app-admin-settings/src/views/Spaces.vue diff --git a/packages/web-app-admin-settings/package.json b/packages/web-app-admin-settings/package.json index b20cb5e9e44..0f863ffc24e 100644 --- a/packages/web-app-admin-settings/package.json +++ b/packages/web-app-admin-settings/package.json @@ -15,6 +15,7 @@ "uuid": "^9.0.0", "vue-concurrency": "4.0.0", "vuex": "^3.6.2", - "web-pkg": "npm:@ownclouders/web-pkg" + "web-pkg": "npm:@ownclouders/web-pkg", + "web-client": "npm:@ownclouders/web-client" } } diff --git a/packages/web-app-admin-settings/src/components/Spaces/SpacesList.vue b/packages/web-app-admin-settings/src/components/Spaces/SpacesList.vue new file mode 100644 index 00000000000..9889e4e7fcf --- /dev/null +++ b/packages/web-app-admin-settings/src/components/Spaces/SpacesList.vue @@ -0,0 +1,303 @@ + + + + + diff --git a/packages/web-app-admin-settings/src/index.js b/packages/web-app-admin-settings/src/index.js index 884f7281af9..f5bad7778ef 100644 --- a/packages/web-app-admin-settings/src/index.js +++ b/packages/web-app-admin-settings/src/index.js @@ -1,6 +1,7 @@ import translations from '../l10n/translations' import Users from './views/Users.vue' import Groups from './views/Groups.vue' +import Spaces from './views/Spaces.vue' // just a dummy function to trick gettext tools function $gettext(msg) { return msg @@ -37,6 +38,15 @@ const routes = [ authContext: 'user', title: $gettext('Groups') } + }, + { + path: '/spaces', + name: 'admin-settings-spaces', + component: Spaces, + meta: { + authContext: 'user', + title: $gettext('Spaces') + } } ] @@ -62,6 +72,17 @@ const navItems = [ const permissionManager = window.Vue.$permissionManager return permissionManager.hasUserManagement() } + }, + { + name: $gettext('Spaces'), + icon: 'layout-grid', + route: { + path: `/${appInfo.id}/spaces?` + }, + enabled: () => { + const permissionManager = window.Vue.$permissionManager + return permissionManager.hasSpaceManagement() + } } ] diff --git a/packages/web-app-admin-settings/src/views/Spaces.vue b/packages/web-app-admin-settings/src/views/Spaces.vue new file mode 100644 index 00000000000..ad1c473165e --- /dev/null +++ b/packages/web-app-admin-settings/src/views/Spaces.vue @@ -0,0 +1,160 @@ + + + diff --git a/packages/web-client/src/graph.ts b/packages/web-client/src/graph.ts index 71b47f2b4b6..22469e056a4 100644 --- a/packages/web-client/src/graph.ts +++ b/packages/web-client/src/graph.ts @@ -18,7 +18,8 @@ import { TagsApiFactory, CollectionOfTags, TagAssignment, - TagUnassignment + TagUnassignment, + DrivesGetDrivesApi } from './generated' export interface Graph { @@ -29,6 +30,7 @@ export interface Graph { } drives: { listMyDrives: (orderBy?: string, filter?: string) => Promise> + listAllDrives: (orderBy?: string, filter?: string) => Promise> getDrive: (id: string) => AxiosPromise createDrive: (drive: Drive, options: any) => AxiosPromise updateDrive: (id: string, drive: Drive, options: any) => AxiosPromise @@ -62,6 +64,7 @@ export const graph = (baseURI: string, axiosClient: AxiosInstance): Graph => { }) const meDrivesApi = new MeDrivesApi(config, config.basePath, axiosClient) + const allDrivesApi = new DrivesGetDrivesApi(config, config.basePath, axiosClient) const meUserApiFactory = MeUserApiFactory(config, config.basePath, axiosClient) const meChangepasswordApiFactory = MeChangepasswordApiFactory( config, @@ -85,6 +88,8 @@ export const graph = (baseURI: string, axiosClient: AxiosInstance): Graph => { drives: { listMyDrives: (orderBy?: string, filter?: string) => meDrivesApi.listMyDrives(orderBy, filter), + listAllDrives: (orderBy?: string, filter?: string) => + allDrivesApi.listAllDrives(orderBy, filter), getDrive: (id: string) => drivesApiFactory.getDrive(id), createDrive: (drive: Drive, options: any): AxiosPromise => drivesApiFactory.createDrive(drive, options), diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 37a9fdf3bb2..1d48846629e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -404,6 +404,7 @@ importers: uuid: ^9.0.0 vue-concurrency: 4.0.0 vuex: ^3.6.2 + web-client: npm:@ownclouders/web-client web-pkg: npm:@ownclouders/web-pkg dependencies: axios: 0.27.2 @@ -414,6 +415,7 @@ importers: uuid: 9.0.0 vue-concurrency: 4.0.0_vue@2.7.14 vuex: 3.6.2_vue@2.7.14 + web-client: link:../web-client web-pkg: link:../web-pkg packages/web-app-draw-io: From 94759c41bc1f463d9990705d24bd04dec1b0327f Mon Sep 17 00:00:00 2001 From: Jannik Stehle Date: Tue, 3 Jan 2023 16:14:37 +0100 Subject: [PATCH 02/11] Use nice date formatting --- .../src/components/Spaces/SpacesList.vue | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/packages/web-app-admin-settings/src/components/Spaces/SpacesList.vue b/packages/web-app-admin-settings/src/components/Spaces/SpacesList.vue index 9889e4e7fcf..a8a8af54f28 100644 --- a/packages/web-app-admin-settings/src/components/Spaces/SpacesList.vue +++ b/packages/web-app-admin-settings/src/components/Spaces/SpacesList.vue @@ -49,7 +49,11 @@