mirror of
https://github.com/directus/directus.git
synced 2026-02-10 20:35:04 -05:00
Squashed commit of the following:
commit aabfcdb9fc75789e8b68a026297651dc3b9a432d Author: rijkvanzanten <rijkvanzanten@me.com> Date: Fri Jul 3 11:40:44 2020 -0400 Fix more projects stuff commit 5df3364e0887627fca8361297b92a9ff5b36c98f Author: rijkvanzanten <rijkvanzanten@me.com> Date: Fri Jul 3 11:36:28 2020 -0400 More project deletions commit 75d49100adffee5ad94736e62470cffa89a44aa3 Author: rijkvanzanten <rijkvanzanten@me.com> Date: Fri Jul 3 11:32:04 2020 -0400 Batch get rid of projects commit 02a64a5d4c6ae02ece42878dc10560b662b1dfca Author: rijkvanzanten <rijkvanzanten@me.com> Date: Fri Jul 3 11:06:20 2020 -0400 Some more things commit 617e22e0abd5d6bf57e1eac95b9a68287cd0044b Author: rijkvanzanten <rijkvanzanten@me.com> Date: Fri Jul 3 10:35:43 2020 -0400 Fix module bar logo projects check commit a8fbf0be75055c31075f2352b150309fea424e8a Author: rijkvanzanten <rijkvanzanten@me.com> Date: Fri Jul 3 10:35:24 2020 -0400 Set auth token in auth handler commit c0c1c1bb164bd49d252c6dd1d944d7bc4b6aede5 Author: rijkvanzanten <rijkvanzanten@me.com> Date: Fri Jul 3 10:18:30 2020 -0400 public login
This commit is contained in:
@@ -34,7 +34,6 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent, computed, ref } from '@vue/composition-api';
|
||||
import ActivityNavigation from '../../components/navigation/';
|
||||
import useProjectsStore from '@/stores/projects';
|
||||
import { i18n } from '@/lang';
|
||||
import { LayoutComponent } from '@/layouts/types';
|
||||
import useCollectionPreset from '@/composables/use-collection-preset';
|
||||
@@ -50,7 +49,6 @@ export default defineComponent({
|
||||
props: {},
|
||||
setup() {
|
||||
const layout = ref<LayoutComponent | null>(null);
|
||||
const projectsStore = useProjectsStore();
|
||||
|
||||
const { viewOptions, viewQuery } = useCollectionPreset(ref('directus_activity'));
|
||||
const { breadcrumb } = useBreadcrumb();
|
||||
@@ -65,12 +63,10 @@ export default defineComponent({
|
||||
|
||||
function useBreadcrumb() {
|
||||
const breadcrumb = computed(() => {
|
||||
const currentProjectKey = projectsStore.state.currentProjectKey;
|
||||
|
||||
return [
|
||||
{
|
||||
name: i18n.tc('collection', 2),
|
||||
to: `/${currentProjectKey}/collections`,
|
||||
to: `/collections`,
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, computed, toRefs, ref } from '@vue/composition-api';
|
||||
import useProjectsStore from '@/stores/projects';
|
||||
|
||||
import ActivityNavigation from '../../components/navigation/';
|
||||
import { i18n } from '@/lang';
|
||||
import useItem from '@/composables/use-item';
|
||||
@@ -50,8 +50,6 @@ export default defineComponent({
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
const projectsStore = useProjectsStore();
|
||||
const { currentProjectKey } = toRefs(projectsStore.state);
|
||||
const { primaryKey } = toRefs(props);
|
||||
const { breadcrumb } = useBreadcrumb();
|
||||
|
||||
@@ -69,7 +67,7 @@ export default defineComponent({
|
||||
const breadcrumb = computed(() => [
|
||||
{
|
||||
name: i18n.t('activity_log'),
|
||||
to: `/${currentProjectKey.value}/activity/`,
|
||||
to: `/activity/`,
|
||||
},
|
||||
]);
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
import { defineComponent, computed } from '@vue/composition-api';
|
||||
import useNavigation from '../../composables/use-navigation';
|
||||
import useCollectionPresetsStore from '@/stores/collection-presets';
|
||||
import useProjectsStore from '@/stores/projects';
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
@@ -42,12 +41,9 @@ export default defineComponent({
|
||||
},
|
||||
setup() {
|
||||
const collectionPresetsStore = useCollectionPresetsStore();
|
||||
const projectsStore = useProjectsStore();
|
||||
const { customNavItems, navItems } = useNavigation();
|
||||
|
||||
const bookmarks = computed(() => {
|
||||
const { currentProjectKey } = projectsStore.state;
|
||||
|
||||
return collectionPresetsStore.state.collectionPresets
|
||||
.filter((preset) => {
|
||||
return preset.title !== null && preset.collection.startsWith('directus_') === false;
|
||||
@@ -55,7 +51,7 @@ export default defineComponent({
|
||||
.map((preset) => {
|
||||
return {
|
||||
...preset,
|
||||
to: `/${currentProjectKey}/collections/${preset.collection}?bookmark=${preset.id}`,
|
||||
to: `/collections/${preset.collection}?bookmark=${preset.id}`,
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { computed } from '@vue/composition-api';
|
||||
import { useProjectsStore } from '@/stores/projects/';
|
||||
|
||||
import { useCollectionsStore } from '@/stores/collections/';
|
||||
import { Collection } from '@/stores/collections/types';
|
||||
import VueI18n from 'vue-i18n';
|
||||
@@ -19,7 +19,7 @@ export type NavItemGroup = {
|
||||
|
||||
export default function useNavigation() {
|
||||
const collectionsStore = useCollectionsStore();
|
||||
const projectsStore = useProjectsStore();
|
||||
|
||||
const userStore = useUserStore();
|
||||
|
||||
const customNavItems = computed<NavItemGroup[] | null>(() => {
|
||||
@@ -39,7 +39,7 @@ export default function useNavigation() {
|
||||
collection: collection,
|
||||
name: collectionInfo.name,
|
||||
icon: collectionInfo.icon,
|
||||
to: `/${projectsStore.state.currentProjectKey}/collections/${collection}`,
|
||||
to: `/collections/${collection}`,
|
||||
};
|
||||
|
||||
return navItem;
|
||||
@@ -58,7 +58,7 @@ export default function useNavigation() {
|
||||
collection: collection.collection,
|
||||
name: collection.name,
|
||||
icon: collection.icon,
|
||||
to: `/${projectsStore.state.currentProjectKey}/collections/${collection.collection}`,
|
||||
to: `/collections/${collection.collection}`,
|
||||
};
|
||||
|
||||
return navItem;
|
||||
|
||||
@@ -137,7 +137,6 @@ import { NavigationGuard } from 'vue-router';
|
||||
import CollectionsNavigation from '../../components/navigation/';
|
||||
import useCollectionsStore from '@/stores/collections';
|
||||
import useFieldsStore from '@/stores/fields';
|
||||
import useProjectsStore from '@/stores/projects';
|
||||
import api from '@/api';
|
||||
import { LayoutComponent } from '@/layouts/types';
|
||||
import CollectionsNotFound from '../not-found/';
|
||||
@@ -209,8 +208,6 @@ export default defineComponent({
|
||||
const { collection } = toRefs(props);
|
||||
const bookmarkID = computed(() => (props.bookmark ? +props.bookmark : null));
|
||||
|
||||
const projectsStore = useProjectsStore();
|
||||
|
||||
const { selection } = useSelection();
|
||||
const { info: currentCollection } = useCollection(collection);
|
||||
const { addNewLink, batchLink, collectionsLink, currentCollectionLink } = useLinks();
|
||||
@@ -274,7 +271,7 @@ export default defineComponent({
|
||||
const breadcrumb = computed(() => [
|
||||
{
|
||||
name: currentCollection.value?.name,
|
||||
to: `/${projectsStore.state.currentProjectKey}/collections/${props.collection}`,
|
||||
to: `/collections/${props.collection}`,
|
||||
},
|
||||
]);
|
||||
|
||||
@@ -300,8 +297,6 @@ export default defineComponent({
|
||||
return { confirmDelete, deleting, batchDelete };
|
||||
|
||||
async function batchDelete() {
|
||||
const currentProjectKey = projectsStore.state.currentProjectKey;
|
||||
|
||||
deleting.value = true;
|
||||
|
||||
confirmDelete.value = false;
|
||||
@@ -309,7 +304,7 @@ export default defineComponent({
|
||||
const batchPrimaryKeys = selection.value;
|
||||
|
||||
try {
|
||||
await api.delete(`/${currentProjectKey}/items/${props.collection}/${batchPrimaryKeys}`);
|
||||
await api.delete(`/items/${props.collection}/${batchPrimaryKeys}`);
|
||||
|
||||
await layout.value?.refresh?.();
|
||||
|
||||
@@ -325,26 +320,20 @@ export default defineComponent({
|
||||
|
||||
function useLinks() {
|
||||
const addNewLink = computed<string>(() => {
|
||||
const currentProjectKey = projectsStore.state.currentProjectKey;
|
||||
return `/${currentProjectKey}/collections/${props.collection}/+`;
|
||||
return `/collections/${props.collection}/+`;
|
||||
});
|
||||
|
||||
const batchLink = computed<string>(() => {
|
||||
const currentProjectKey = projectsStore.state.currentProjectKey;
|
||||
const batchPrimaryKeys = selection.value.join();
|
||||
return `/${currentProjectKey}/collections/${props.collection}/${batchPrimaryKeys}`;
|
||||
return `/collections/${props.collection}/${batchPrimaryKeys}`;
|
||||
});
|
||||
|
||||
const collectionsLink = computed<string>(() => {
|
||||
const currentProjectKey = projectsStore.state.currentProjectKey;
|
||||
|
||||
return `/${currentProjectKey}/collections`;
|
||||
return `/collections`;
|
||||
});
|
||||
|
||||
const currentCollectionLink = computed<string>(() => {
|
||||
const currentProjectKey = projectsStore.state.currentProjectKey;
|
||||
|
||||
return `/${currentProjectKey}/collections/${props.collection}`;
|
||||
return `/collections/${props.collection}`;
|
||||
});
|
||||
|
||||
return { addNewLink, batchLink, collectionsLink, currentCollectionLink };
|
||||
@@ -364,15 +353,11 @@ export default defineComponent({
|
||||
};
|
||||
|
||||
async function createBookmark(name: string) {
|
||||
const { currentProjectKey } = projectsStore.state;
|
||||
|
||||
creatingBookmark.value = true;
|
||||
|
||||
try {
|
||||
const newBookmark = await saveCurrentAsBookmark({ title: name });
|
||||
router.push(
|
||||
`/${currentProjectKey}/collections/${newBookmark.collection}?bookmark=${newBookmark.id}`
|
||||
);
|
||||
router.push(`/collections/${newBookmark.collection}?bookmark=${newBookmark.id}`);
|
||||
|
||||
bookmarkDialogActive.value = false;
|
||||
} catch (error) {
|
||||
|
||||
@@ -166,7 +166,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, computed, toRefs, ref } from '@vue/composition-api';
|
||||
import useProjectsStore from '@/stores/projects';
|
||||
|
||||
import CollectionsNavigation from '../../components/navigation/';
|
||||
import router from '@/router';
|
||||
import CollectionsNotFound from '../not-found/';
|
||||
@@ -215,8 +215,6 @@ export default defineComponent({
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
const projectsStore = useProjectsStore();
|
||||
const { currentProjectKey } = toRefs(projectsStore.state);
|
||||
const { collection, primaryKey } = toRefs(props);
|
||||
const { breadcrumb } = useBreadcrumb();
|
||||
|
||||
@@ -248,7 +246,7 @@ export default defineComponent({
|
||||
const confirmLeave = ref(false);
|
||||
const leaveTo = ref<string | null>(null);
|
||||
|
||||
const backLink = computed(() => `/${currentProjectKey.value}/collections/${collection.value}/`);
|
||||
const backLink = computed(() => `/collections/${collection.value}/`);
|
||||
|
||||
const templateValues = computed(() => {
|
||||
return {
|
||||
@@ -307,7 +305,7 @@ export default defineComponent({
|
||||
const breadcrumb = computed(() => [
|
||||
{
|
||||
name: collectionInfo.value?.name,
|
||||
to: `/${currentProjectKey.value}/collections/${props.collection}`,
|
||||
to: `/collections/${props.collection}`,
|
||||
},
|
||||
]);
|
||||
|
||||
@@ -316,7 +314,7 @@ export default defineComponent({
|
||||
|
||||
async function saveAndQuit() {
|
||||
await save();
|
||||
router.push(`/${currentProjectKey.value}/collections/${props.collection}`);
|
||||
router.push(`/collections/${props.collection}`);
|
||||
}
|
||||
|
||||
async function saveAndStay() {
|
||||
@@ -327,23 +325,23 @@ export default defineComponent({
|
||||
if (props.primaryKey === '+') {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const newPrimaryKey = savedItem[primaryKeyField.value!.field];
|
||||
router.replace(`/${currentProjectKey.value}/collections/${props.collection}/${newPrimaryKey}`);
|
||||
router.replace(`/collections/${props.collection}/${newPrimaryKey}`);
|
||||
}
|
||||
}
|
||||
|
||||
async function saveAndAddNew() {
|
||||
await save();
|
||||
router.push(`/${currentProjectKey.value}/collections/${props.collection}/+`);
|
||||
router.push(`/collections/${props.collection}/+`);
|
||||
}
|
||||
|
||||
async function saveAsCopyAndNavigate() {
|
||||
const newPrimaryKey = await saveAsCopy();
|
||||
router.push(`/${currentProjectKey.value}/collections/${props.collection}/${newPrimaryKey}`);
|
||||
router.push(`/collections/${props.collection}/${newPrimaryKey}`);
|
||||
}
|
||||
|
||||
async function deleteAndQuit(soft = false) {
|
||||
await remove(soft);
|
||||
router.push(`/${currentProjectKey.value}/collections/${props.collection}`);
|
||||
router.push(`/collections/${props.collection}`);
|
||||
}
|
||||
|
||||
function discardAndLeave() {
|
||||
|
||||
@@ -46,7 +46,7 @@ import { i18n } from '@/lang';
|
||||
import useNavigation, { NavItem } from '../../composables/use-navigation';
|
||||
import router from '@/router';
|
||||
import useUserStore from '@/stores/user';
|
||||
import useProjectsStore from '@/stores/projects';
|
||||
|
||||
import marked from 'marked';
|
||||
|
||||
export default defineComponent({
|
||||
@@ -57,7 +57,6 @@ export default defineComponent({
|
||||
props: {},
|
||||
setup() {
|
||||
const userStore = useUserStore();
|
||||
const projectsStore = useProjectsStore();
|
||||
|
||||
const tableHeaders = [
|
||||
{
|
||||
@@ -82,7 +81,7 @@ export default defineComponent({
|
||||
const isAdmin = computed(() => userStore.state.currentUser?.role.id === 1);
|
||||
|
||||
const dataModelLink = computed(() => {
|
||||
return `/${projectsStore.state.currentProjectKey}/settings/data-model`;
|
||||
return `/settings/data-model`;
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
import { defineComponent, ref } from '@vue/composition-api';
|
||||
import useFolders from '../../composables/use-folders';
|
||||
import api from '@/api';
|
||||
import useProjectsStore from '@/stores/projects';
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
@@ -35,7 +34,6 @@ export default defineComponent({
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
const projectsStore = useProjectsStore();
|
||||
const dialogActive = ref(false);
|
||||
const saving = ref(false);
|
||||
const newFolderName = ref(null);
|
||||
@@ -46,12 +44,10 @@ export default defineComponent({
|
||||
return { addFolder, dialogActive, newFolderName, saving, savingError };
|
||||
|
||||
async function addFolder() {
|
||||
const { currentProjectKey } = projectsStore.state;
|
||||
|
||||
saving.value = true;
|
||||
|
||||
try {
|
||||
await api.post(`/${currentProjectKey}/folders`, {
|
||||
await api.post(`/folders`, {
|
||||
name: newFolderName.value,
|
||||
parent_folder: props.parent,
|
||||
});
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref, computed } from '@vue/composition-api';
|
||||
import useProjectsStore from '@/stores/projects';
|
||||
import api from '@/api';
|
||||
import FolderPickerListItem from './folder-picker-list-item.vue';
|
||||
|
||||
@@ -49,8 +48,6 @@ export default defineComponent({
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
const projectsStore = useProjectsStore();
|
||||
|
||||
const loading = ref(false);
|
||||
const folders = ref<FolderRaw[]>([]);
|
||||
const error = ref<any>(null);
|
||||
@@ -88,12 +85,10 @@ export default defineComponent({
|
||||
|
||||
async function fetchFolders() {
|
||||
if (folders.value.length > 0) return;
|
||||
const { currentProjectKey } = projectsStore.state;
|
||||
|
||||
loading.value = true;
|
||||
|
||||
try {
|
||||
const response = await api.get(`/${currentProjectKey}/folders`, {
|
||||
const response = await api.get(`/folders`, {
|
||||
params: {
|
||||
limit: -1,
|
||||
},
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import api from '@/api';
|
||||
import { ref, Ref } from '@vue/composition-api';
|
||||
import useProjectsStore from '@/stores/projects';
|
||||
|
||||
type FolderRaw = {
|
||||
id: number;
|
||||
@@ -20,8 +19,6 @@ let folders: Ref<Folder[] | null> | null = null;
|
||||
let error: Ref<any> | null = null;
|
||||
|
||||
export default function useFolders() {
|
||||
const projectsStore = useProjectsStore();
|
||||
|
||||
if (loading === null) loading = ref(false);
|
||||
if (folders === null) folders = ref<Folder[] | null>(null);
|
||||
if (error === null) error = ref(null);
|
||||
@@ -40,7 +37,7 @@ export default function useFolders() {
|
||||
loading.value = true;
|
||||
|
||||
try {
|
||||
const response = await api.get(`/${projectsStore.state.currentProjectKey}/folders`, {
|
||||
const response = await api.get(`/folders`, {
|
||||
params: {
|
||||
limit: -1,
|
||||
sort: 'name',
|
||||
|
||||
@@ -104,7 +104,6 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent, computed, ref } from '@vue/composition-api';
|
||||
import FilesNavigation from '../../components/navigation/';
|
||||
import useProjectsStore from '@/stores/projects';
|
||||
import { i18n } from '@/lang';
|
||||
import api from '@/api';
|
||||
import { LayoutComponent } from '@/layouts/types';
|
||||
@@ -126,8 +125,6 @@ export default defineComponent({
|
||||
props: {},
|
||||
setup() {
|
||||
const layout = ref<LayoutComponent | null>(null);
|
||||
const projectsStore = useProjectsStore();
|
||||
|
||||
const selection = ref<Item[]>([]);
|
||||
|
||||
const { viewType, viewOptions, viewQuery, filters, searchQuery } = useCollectionPreset(ref('directus_files'));
|
||||
@@ -211,15 +208,13 @@ export default defineComponent({
|
||||
return { confirmDelete, deleting, batchDelete };
|
||||
|
||||
async function batchDelete() {
|
||||
const currentProjectKey = projectsStore.state.currentProjectKey;
|
||||
|
||||
deleting.value = true;
|
||||
|
||||
confirmDelete.value = false;
|
||||
|
||||
const batchPrimaryKeys = selection.value;
|
||||
|
||||
await api.delete(`/${currentProjectKey}/files/${batchPrimaryKeys}`);
|
||||
await api.delete(`/files/${batchPrimaryKeys}`);
|
||||
|
||||
await layout.value?.refresh();
|
||||
|
||||
@@ -231,14 +226,12 @@ export default defineComponent({
|
||||
|
||||
function useLinks() {
|
||||
const addNewLink = computed<string>(() => {
|
||||
const currentProjectKey = projectsStore.state.currentProjectKey;
|
||||
return `/${currentProjectKey}/files/+`;
|
||||
return `/files/+`;
|
||||
});
|
||||
|
||||
const batchLink = computed<string>(() => {
|
||||
const currentProjectKey = projectsStore.state.currentProjectKey;
|
||||
const batchPrimaryKeys = selection.value;
|
||||
return `/${currentProjectKey}/files/${batchPrimaryKeys}`;
|
||||
return `/files/${batchPrimaryKeys}`;
|
||||
});
|
||||
|
||||
return { addNewLink, batchLink };
|
||||
@@ -246,12 +239,10 @@ export default defineComponent({
|
||||
|
||||
function useBreadcrumb() {
|
||||
const breadcrumb = computed(() => {
|
||||
const currentProjectKey = projectsStore.state.currentProjectKey;
|
||||
|
||||
return [
|
||||
{
|
||||
name: i18n.tc('collection', 2),
|
||||
to: `/${currentProjectKey}/collections`,
|
||||
to: `/collections`,
|
||||
},
|
||||
];
|
||||
});
|
||||
@@ -268,10 +259,8 @@ export default defineComponent({
|
||||
|
||||
async function moveToFolder() {
|
||||
moving.value = true;
|
||||
const { currentProjectKey } = projectsStore.state;
|
||||
|
||||
try {
|
||||
await api.patch(`/${currentProjectKey}/files/${selection.value}`, {
|
||||
await api.patch(`/files/${selection.value}`, {
|
||||
folder: selectedFolder.value,
|
||||
});
|
||||
|
||||
|
||||
@@ -54,7 +54,6 @@ import readableMimeType from '@/utils/readable-mime-type';
|
||||
import bytes from 'bytes';
|
||||
import i18n from '@/lang';
|
||||
import localizedFormat from '@/utils/localized-format';
|
||||
import useProjectsStore from '@/stores/projects';
|
||||
import api from '@/api';
|
||||
|
||||
export default defineComponent({
|
||||
@@ -70,8 +69,6 @@ export default defineComponent({
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
const projectsStore = useProjectsStore();
|
||||
|
||||
const size = computed(() => {
|
||||
if (props.isNew) return null;
|
||||
if (!props.file) return null;
|
||||
@@ -123,10 +120,9 @@ export default defineComponent({
|
||||
if (!props.file) return null;
|
||||
|
||||
loading.value = true;
|
||||
const { currentProjectKey } = projectsStore.state;
|
||||
|
||||
try {
|
||||
const response = await api.get(`/${currentProjectKey}/users/${props.file.uploaded_by}`, {
|
||||
const response = await api.get(`/users/${props.file.uploaded_by}`, {
|
||||
params: {
|
||||
fields: ['id', 'first_name', 'last_name', 'role'],
|
||||
},
|
||||
@@ -137,7 +133,7 @@ export default defineComponent({
|
||||
user.value = {
|
||||
id: props.file.uploaded_by,
|
||||
name: first_name + ' ' + last_name,
|
||||
link: `/${currentProjectKey}/users/${role}/${id}`,
|
||||
link: `/users/${role}/${id}`,
|
||||
};
|
||||
} finally {
|
||||
loading.value = false;
|
||||
@@ -162,10 +158,8 @@ export default defineComponent({
|
||||
if (!props.file) return null;
|
||||
if (!props.file.folder) return;
|
||||
loading.value = true;
|
||||
const { currentProjectKey } = projectsStore.state;
|
||||
|
||||
try {
|
||||
const response = await api.get(`/${currentProjectKey}/folders/${props.file.folder}`, {
|
||||
const response = await api.get(`/folders/${props.file.folder}`, {
|
||||
params: {
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
|
||||
@@ -144,7 +144,6 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, computed, toRefs, ref } from '@vue/composition-api';
|
||||
import useProjectsStore from '@/stores/projects';
|
||||
import FilesNavigation from '../../components/navigation/';
|
||||
import { i18n } from '@/lang';
|
||||
import router from '@/router';
|
||||
@@ -200,8 +199,6 @@ export default defineComponent({
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
const projectsStore = useProjectsStore();
|
||||
const { currentProjectKey } = toRefs(projectsStore.state);
|
||||
const { primaryKey } = toRefs(props);
|
||||
const { breadcrumb } = useBreadcrumb();
|
||||
const fieldsStore = useFieldsStore();
|
||||
@@ -295,7 +292,7 @@ export default defineComponent({
|
||||
const breadcrumb = computed(() => [
|
||||
{
|
||||
name: i18n.t('file_library'),
|
||||
to: `/${currentProjectKey.value}/files/`,
|
||||
to: `/files/`,
|
||||
},
|
||||
]);
|
||||
|
||||
@@ -304,7 +301,7 @@ export default defineComponent({
|
||||
|
||||
async function saveAndQuit() {
|
||||
await save();
|
||||
router.push(`/${currentProjectKey.value}/files`);
|
||||
router.push(`/files`);
|
||||
}
|
||||
|
||||
async function saveAndStay() {
|
||||
@@ -315,23 +312,23 @@ export default defineComponent({
|
||||
if (props.primaryKey === '+') {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const newPrimaryKey = savedItem.id;
|
||||
router.replace(`/${currentProjectKey.value}/collections/files/${newPrimaryKey}`);
|
||||
router.replace(`/collections/files/${newPrimaryKey}`);
|
||||
}
|
||||
}
|
||||
|
||||
async function saveAndAddNew() {
|
||||
await save();
|
||||
router.push(`/${currentProjectKey.value}/files/+`);
|
||||
router.push(`/files/+`);
|
||||
}
|
||||
|
||||
async function saveAsCopyAndNavigate() {
|
||||
const newPrimaryKey = await saveAsCopy();
|
||||
router.push(`/${currentProjectKey.value}/files/${newPrimaryKey}`);
|
||||
router.push(`/files/${newPrimaryKey}`);
|
||||
}
|
||||
|
||||
async function deleteAndQuit() {
|
||||
await remove();
|
||||
router.push(`/${currentProjectKey.value}/files`);
|
||||
router.push(`/files`);
|
||||
}
|
||||
|
||||
function discardAndLeave() {
|
||||
@@ -349,10 +346,8 @@ export default defineComponent({
|
||||
|
||||
async function moveToFolder() {
|
||||
moving.value = true;
|
||||
const { currentProjectKey } = projectsStore.state;
|
||||
|
||||
try {
|
||||
await api.patch(`/${currentProjectKey}/files/${props.primaryKey}`, {
|
||||
await api.patch(`/files/${props.primaryKey}`, {
|
||||
folder: selectedFolder.value,
|
||||
});
|
||||
await refresh();
|
||||
|
||||
@@ -21,38 +21,34 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent, toRefs } from '@vue/composition-api';
|
||||
import { i18n } from '@/lang';
|
||||
import { useProjectsStore } from '@/stores/projects';
|
||||
|
||||
export default defineComponent({
|
||||
setup() {
|
||||
const projectsStore = useProjectsStore();
|
||||
const { currentProjectKey } = toRefs(projectsStore.state);
|
||||
|
||||
const navItems = [
|
||||
{
|
||||
icon: 'public',
|
||||
name: i18n.t('settings_project'),
|
||||
to: `/${currentProjectKey.value}/settings/project`,
|
||||
to: `/settings/project`,
|
||||
},
|
||||
{
|
||||
icon: 'list_alt',
|
||||
name: i18n.t('settings_data_model'),
|
||||
to: `/${currentProjectKey.value}/settings/data-model`,
|
||||
to: `/settings/data-model`,
|
||||
},
|
||||
{
|
||||
icon: 'people',
|
||||
name: i18n.t('settings_permissions'),
|
||||
to: `/${currentProjectKey.value}/settings/roles`,
|
||||
to: `/settings/roles`,
|
||||
},
|
||||
{
|
||||
icon: 'bookmark',
|
||||
name: i18n.t('settings_presets'),
|
||||
to: `/${currentProjectKey.value}/settings/presets`,
|
||||
to: `/settings/presets`,
|
||||
},
|
||||
{
|
||||
icon: 'send',
|
||||
name: i18n.t('settings_webhooks'),
|
||||
to: `/${currentProjectKey.value}/settings/webhooks`,
|
||||
to: `/settings/webhooks`,
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
@@ -95,7 +95,6 @@ import { HeaderRaw } from '../../../../../components/v-table/types';
|
||||
import { i18n } from '@/lang/';
|
||||
import useCollectionsStore from '@/stores/collections';
|
||||
import { Collection } from '@/stores/collections/types';
|
||||
import useProjectsStore from '@/stores/projects';
|
||||
import router from '@/router';
|
||||
import { sortBy } from 'lodash';
|
||||
import CollectionOptions from './components/collection-options';
|
||||
@@ -129,8 +128,7 @@ export default defineComponent({
|
||||
]);
|
||||
|
||||
function openCollection({ collection }: Collection) {
|
||||
const { currentProjectKey } = useProjectsStore().state;
|
||||
router.push(`/${currentProjectKey}/settings/data-model/${collection}`);
|
||||
router.push(`/settings/data-model/${collection}`);
|
||||
}
|
||||
|
||||
const { items } = useItems();
|
||||
|
||||
@@ -106,7 +106,6 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref, reactive } from '@vue/composition-api';
|
||||
import api from '@/api';
|
||||
import useProjectsStore from '@/stores/projects';
|
||||
import { Field } from '@/stores/fields/types';
|
||||
import useCollectionsStore from '@/stores/collections';
|
||||
import useFieldsStore from '@/stores/fields';
|
||||
@@ -124,7 +123,6 @@ export default defineComponent({
|
||||
},
|
||||
},
|
||||
setup(props, { emit }) {
|
||||
const projectsStore = useProjectsStore();
|
||||
const collectionsStore = useCollectionsStore();
|
||||
const fieldsStore = useFieldsStore();
|
||||
|
||||
@@ -194,11 +192,10 @@ export default defineComponent({
|
||||
};
|
||||
|
||||
async function save() {
|
||||
const { currentProjectKey } = projectsStore.state;
|
||||
saving.value = true;
|
||||
|
||||
try {
|
||||
await api.post(`/${currentProjectKey}/collections`, {
|
||||
await api.post(`/collections`, {
|
||||
collection: collectionName.value,
|
||||
fields: [getPrimaryKeyField(), ...getSystemFields()],
|
||||
});
|
||||
|
||||
@@ -78,7 +78,7 @@ import SetupActions from './setup-actions.vue';
|
||||
import useFieldsStore from '@/stores/fields/';
|
||||
import { Relation } from '@/stores/relations/types';
|
||||
import api from '@/api';
|
||||
import useProjectsStore from '@/stores/projects';
|
||||
|
||||
import { LocalType } from './types';
|
||||
import { localTypeGroups } from './index';
|
||||
import { Type } from '@/stores/fields/types';
|
||||
@@ -114,7 +114,6 @@ export default defineComponent({
|
||||
},
|
||||
setup(props, { emit }) {
|
||||
const fieldsStore = useFieldsStore();
|
||||
const projectsStore = useProjectsStore();
|
||||
|
||||
const { collection } = toRefs(props);
|
||||
|
||||
@@ -280,8 +279,7 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
async function createRelation(relation: Partial<Relation>) {
|
||||
const { currentProjectKey } = projectsStore.state;
|
||||
await api.post(`/${currentProjectKey}/relations`, relation);
|
||||
await api.post(`/relations`, relation);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -73,7 +73,7 @@ import { defineComponent, computed, toRefs, ref } from '@vue/composition-api';
|
||||
import SettingsNavigation from '../../../components/navigation/';
|
||||
import useCollection from '@/composables/use-collection/';
|
||||
import FieldsManagement from './components/fields-management';
|
||||
import useProjectsStore from '@/stores/projects';
|
||||
|
||||
import useItem from '@/composables/use-item';
|
||||
import router from '@/router';
|
||||
import useCollectionsStore from '@/stores/collections';
|
||||
@@ -88,10 +88,8 @@ export default defineComponent({
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
const projectsStore = useProjectsStore();
|
||||
const { collection } = toRefs(props);
|
||||
const { info: collectionInfo, fields } = useCollection(collection);
|
||||
const { currentProjectKey } = toRefs(projectsStore.state);
|
||||
const collectionsStore = useCollectionsStore();
|
||||
|
||||
const { isNew, edits, item, saving, loading, error, save, remove, deleting, saveAsCopy, isBatch } = useItem(
|
||||
@@ -126,13 +124,13 @@ export default defineComponent({
|
||||
|
||||
async function deleteAndQuit() {
|
||||
await remove();
|
||||
router.push(`/${currentProjectKey.value}/settings/data-model`);
|
||||
router.push(`/settings/data-model`);
|
||||
}
|
||||
|
||||
async function saveAndQuit() {
|
||||
await save();
|
||||
await collectionsStore.hydrate();
|
||||
router.push(`/${currentProjectKey.value}/settings/data-model`);
|
||||
router.push(`/settings/data-model`);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent, computed, ref } from '@vue/composition-api';
|
||||
import SettingsNavigation from '../../../components/navigation';
|
||||
import useProjectsStore from '@/stores/projects';
|
||||
|
||||
import api from '@/api';
|
||||
import { Header } from '@/components/v-table/types';
|
||||
import i18n from '@/lang';
|
||||
@@ -128,7 +128,6 @@ type Preset = {
|
||||
export default defineComponent({
|
||||
components: { SettingsNavigation, ValueNull, PresetsInfoDrawerDetail },
|
||||
setup() {
|
||||
const projectsStore = useProjectsStore();
|
||||
const collectionsStore = useCollectionsStore();
|
||||
|
||||
const selection = ref<Preset[]>([]);
|
||||
@@ -158,8 +157,7 @@ export default defineComponent({
|
||||
|
||||
function useLinks() {
|
||||
const addNewLink = computed(() => {
|
||||
const { currentProjectKey } = projectsStore.state;
|
||||
return `/${currentProjectKey}/settings/presets/+`;
|
||||
return `/settings/presets/+`;
|
||||
});
|
||||
|
||||
return { addNewLink };
|
||||
@@ -198,12 +196,10 @@ export default defineComponent({
|
||||
return { loading, presetsRaw, error, getPresets, presets };
|
||||
|
||||
async function getPresets() {
|
||||
const { currentProjectKey } = projectsStore.state;
|
||||
|
||||
loading.value = true;
|
||||
|
||||
try {
|
||||
const response = await api.get(`/${currentProjectKey}/collection_presets`, {
|
||||
const response = await api.get(`/collection_presets`, {
|
||||
params: {
|
||||
fields: [
|
||||
'id',
|
||||
@@ -262,9 +258,8 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
function onRowClick(item: Preset) {
|
||||
const { currentProjectKey } = projectsStore.state;
|
||||
if (selection.value.length === 0) {
|
||||
router.push(`/${currentProjectKey}/settings/presets/${item.id}`);
|
||||
router.push(`/settings/presets/${item.id}`);
|
||||
} else {
|
||||
if (selection.value.includes(item)) {
|
||||
selection.value = selection.value.filter((i) => i !== item);
|
||||
@@ -281,12 +276,11 @@ export default defineComponent({
|
||||
return { confirmDelete, deleting, deleteSelection };
|
||||
|
||||
async function deleteSelection() {
|
||||
const { currentProjectKey } = projectsStore.state;
|
||||
deleting.value = true;
|
||||
|
||||
try {
|
||||
const IDs = selection.value.map((item) => item.id).join(',');
|
||||
await api.delete(`/${currentProjectKey}/collection_presets/${IDs}`);
|
||||
await api.delete(`/collection_presets/${IDs}`);
|
||||
selection.value = [];
|
||||
await getPresets();
|
||||
confirmDelete.value = false;
|
||||
|
||||
@@ -16,12 +16,9 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref } from '@vue/composition-api';
|
||||
import api from '@/api';
|
||||
import useProjectsStore from '@/stores/projects';
|
||||
|
||||
export default defineComponent({
|
||||
setup() {
|
||||
const projectsStore = useProjectsStore();
|
||||
|
||||
const loading = ref(false);
|
||||
const error = ref<any>(null);
|
||||
const bookmarksCount = ref<number | null>(null);
|
||||
@@ -32,12 +29,10 @@ export default defineComponent({
|
||||
return { bookmarksCount, presetsCount };
|
||||
|
||||
async function fetchCounts() {
|
||||
const { currentProjectKey } = projectsStore.state;
|
||||
|
||||
loading.value = true;
|
||||
|
||||
try {
|
||||
const response = await api.get(`/${currentProjectKey}/collection_presets`, {
|
||||
const response = await api.get(`/collection_presets`, {
|
||||
params: {
|
||||
[`filter[title][nnull]`]: 1,
|
||||
fields: ['id'],
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, computed, ref } from '@vue/composition-api';
|
||||
import useProjectsStore from '@/stores/projects';
|
||||
|
||||
import SettingsNavigation from '../../../components/navigation';
|
||||
import { CollectionPreset, Filter } from '@/stores/collection-presets/types';
|
||||
import api from '@/api';
|
||||
@@ -122,7 +122,6 @@ export default defineComponent({
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
const projectsStore = useProjectsStore();
|
||||
const collectionsStore = useCollectionsStore();
|
||||
const collectionPresetsStore = useCollectionPresetsStore();
|
||||
const { backLink } = useLinks();
|
||||
@@ -165,8 +164,6 @@ export default defineComponent({
|
||||
return { saving, save };
|
||||
|
||||
async function save() {
|
||||
const { currentProjectKey } = projectsStore.state;
|
||||
|
||||
saving.value = true;
|
||||
|
||||
const editsParsed: Partial<CollectionPreset> = {};
|
||||
@@ -189,9 +186,9 @@ export default defineComponent({
|
||||
|
||||
try {
|
||||
if (isNew.value === true) {
|
||||
await api.post(`/${currentProjectKey}/collection_presets`, editsParsed);
|
||||
await api.post(`/collection_presets`, editsParsed);
|
||||
} else {
|
||||
await api.patch(`/${currentProjectKey}/collection_presets/${props.id}`, editsParsed);
|
||||
await api.patch(`/collection_presets/${props.id}`, editsParsed);
|
||||
}
|
||||
|
||||
await collectionPresetsStore.hydrate();
|
||||
@@ -201,7 +198,7 @@ export default defineComponent({
|
||||
console.error(err);
|
||||
} finally {
|
||||
saving.value = false;
|
||||
router.push(`/${currentProjectKey}/settings/presets`);
|
||||
router.push(`/settings/presets`);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -213,13 +210,11 @@ export default defineComponent({
|
||||
return { deleting, confirmDelete, deleteAndQuit };
|
||||
|
||||
async function deleteAndQuit() {
|
||||
const { currentProjectKey } = projectsStore.state;
|
||||
|
||||
deleting.value = true;
|
||||
|
||||
try {
|
||||
await api.delete(`/${currentProjectKey}/collection_presets/${props.id}`);
|
||||
router.push(`/${currentProjectKey}/settings/presets`);
|
||||
await api.delete(`/collection_presets/${props.id}`);
|
||||
router.push(`/settings/presets`);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
@@ -316,11 +311,10 @@ export default defineComponent({
|
||||
return { loading, error, preset, fetchPreset };
|
||||
|
||||
async function fetchPreset() {
|
||||
const { currentProjectKey } = projectsStore.state;
|
||||
loading.value = true;
|
||||
|
||||
try {
|
||||
const response = await api.get(`/${currentProjectKey}/collection_presets/${props.id}`);
|
||||
const response = await api.get(`/collection_presets/${props.id}`);
|
||||
|
||||
preset.value = response.data.data;
|
||||
} catch (err) {
|
||||
@@ -333,9 +327,7 @@ export default defineComponent({
|
||||
|
||||
function useLinks() {
|
||||
const backLink = computed(() => {
|
||||
const { currentProjectKey } = projectsStore.state;
|
||||
|
||||
return `/${currentProjectKey}/settings/presets`;
|
||||
return `/settings/presets`;
|
||||
});
|
||||
|
||||
return { backLink };
|
||||
@@ -351,11 +343,10 @@ export default defineComponent({
|
||||
return { loading, error, users };
|
||||
|
||||
async function fetchUsers() {
|
||||
const { currentProjectKey } = projectsStore.state;
|
||||
loading.value = true;
|
||||
|
||||
try {
|
||||
const response = await api.get(`/${currentProjectKey}/users`, {
|
||||
const response = await api.get(`/users`, {
|
||||
params: {
|
||||
fields: ['first_name', 'last_name', 'id'],
|
||||
},
|
||||
@@ -383,11 +374,10 @@ export default defineComponent({
|
||||
return { loading, error, roles };
|
||||
|
||||
async function fetchRoles() {
|
||||
const { currentProjectKey } = projectsStore.state;
|
||||
loading.value = true;
|
||||
|
||||
try {
|
||||
const response = await api.get(`/${currentProjectKey}/roles`, {
|
||||
const response = await api.get(`/roles`, {
|
||||
params: {
|
||||
fields: ['name', 'id'],
|
||||
},
|
||||
|
||||
@@ -19,14 +19,17 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from '@vue/composition-api';
|
||||
import useProjectsStore from '@/stores/projects';
|
||||
|
||||
import bytes from 'bytes';
|
||||
|
||||
/**
|
||||
* @TODO
|
||||
* retrieve server info somewhere separate
|
||||
*/
|
||||
|
||||
export default defineComponent({
|
||||
setup() {
|
||||
const projectsStore = useProjectsStore();
|
||||
|
||||
return { project: projectsStore.currentProject, bytes };
|
||||
return { project: {}, bytes };
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent, computed, ref } from '@vue/composition-api';
|
||||
import SettingsNavigation from '../../../components/navigation/';
|
||||
import useProjectsStore from '@/stores/projects';
|
||||
|
||||
import { i18n } from '@/lang';
|
||||
import api from '@/api';
|
||||
import marked from 'marked';
|
||||
@@ -82,7 +82,6 @@ export default defineComponent({
|
||||
components: { SettingsNavigation, ValueNull },
|
||||
props: {},
|
||||
setup() {
|
||||
const projectsStore = useProjectsStore();
|
||||
const roles = ref<Role[]>([]);
|
||||
const loading = ref(false);
|
||||
const error = ref<any>(null);
|
||||
@@ -121,19 +120,16 @@ export default defineComponent({
|
||||
fetchRoles();
|
||||
|
||||
const addNewLink = computed(() => {
|
||||
const { currentProjectKey } = projectsStore.state;
|
||||
|
||||
return `/${currentProjectKey}/settings/roles/+`;
|
||||
return `/settings/roles/+`;
|
||||
});
|
||||
|
||||
return { marked, loading, roles, error, tableHeaders, addNewLink, navigateToRole };
|
||||
|
||||
async function fetchRoles() {
|
||||
const { currentProjectKey } = projectsStore.state;
|
||||
loading.value = true;
|
||||
|
||||
try {
|
||||
const response = await api.get(`/${currentProjectKey}/roles`, {
|
||||
const response = await api.get(`/roles`, {
|
||||
params: { limit: -1, fields: 'id,name,description,icon,users.id' },
|
||||
});
|
||||
|
||||
@@ -151,8 +147,7 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
function navigateToRole(item: Role) {
|
||||
const { currentProjectKey } = projectsStore.state;
|
||||
router.push(`/${currentProjectKey}/settings/roles/${item.id}`);
|
||||
router.push(`/settings/roles/${item.id}`);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { ref, Ref, watch } from '@vue/composition-api';
|
||||
import api from '@/api';
|
||||
import useProjectsStore from '@/stores/projects';
|
||||
|
||||
export type Permission = {
|
||||
id?: number;
|
||||
@@ -22,8 +21,6 @@ export default function usePermissions(role: Ref<number>) {
|
||||
const error = ref(null);
|
||||
const permissions = ref<Permission[] | null>(null);
|
||||
|
||||
const projectsStore = useProjectsStore();
|
||||
|
||||
watch(role, (newRole, oldRole) => {
|
||||
if (newRole !== oldRole) {
|
||||
reset();
|
||||
@@ -40,12 +37,10 @@ export default function usePermissions(role: Ref<number>) {
|
||||
}
|
||||
|
||||
async function fetchPermissions() {
|
||||
const { currentProjectKey } = projectsStore.state;
|
||||
|
||||
loading.value = true;
|
||||
|
||||
try {
|
||||
const response = await api.get(`/${currentProjectKey}/permissions`, {
|
||||
const response = await api.get(`/permissions`, {
|
||||
params: {
|
||||
'filter[role][eq]': role.value,
|
||||
},
|
||||
@@ -60,14 +55,13 @@ export default function usePermissions(role: Ref<number>) {
|
||||
}
|
||||
|
||||
async function savePermission(updates: Partial<Permission>) {
|
||||
const { currentProjectKey } = projectsStore.state;
|
||||
try {
|
||||
if (updates.id !== undefined) {
|
||||
await api.patch(`/${currentProjectKey}/permissions/${updates.id}`, {
|
||||
await api.patch(`/permissions/${updates.id}`, {
|
||||
...updates,
|
||||
});
|
||||
} else {
|
||||
await api.post(`/${currentProjectKey}/permissions`, updates);
|
||||
await api.post(`/permissions`, updates);
|
||||
}
|
||||
|
||||
await fetchPermissions();
|
||||
@@ -78,14 +72,13 @@ export default function usePermissions(role: Ref<number>) {
|
||||
}
|
||||
|
||||
async function saveAll(create: Partial<Permission>[], update: Partial<Permission>[]) {
|
||||
const { currentProjectKey } = projectsStore.state;
|
||||
try {
|
||||
if (create.length > 0) {
|
||||
await api.post(`/${currentProjectKey}/permissions`, create);
|
||||
await api.post(`/permissions`, create);
|
||||
}
|
||||
|
||||
if (update.length > 0) {
|
||||
await api.patch(`/${currentProjectKey}/permissions`, update);
|
||||
await api.patch(`/permissions`, update);
|
||||
}
|
||||
|
||||
await fetchPermissions();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<private-view :title="loading ? $t('loading') : $t('editing_role', { role: item && item.name })">
|
||||
<template #headline>{{ $t('settings_permissions') }}</template>
|
||||
<template #title-outer:prepend>
|
||||
<v-button class="header-icon" rounded icon exact :to="`/${currentProjectKey}/settings/roles/`">
|
||||
<v-button class="header-icon" rounded icon exact :to="`/settings/roles/`">
|
||||
<v-icon name="arrow_back" />
|
||||
</v-button>
|
||||
</template>
|
||||
@@ -76,7 +76,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, computed, toRefs, ref } from '@vue/composition-api';
|
||||
import useProjectsStore from '@/stores/projects';
|
||||
|
||||
import SettingsNavigation from '../../../components/navigation/';
|
||||
import router from '@/router';
|
||||
import RevisionsDrawerDetail from '@/views/private/components/revisions-drawer-detail';
|
||||
@@ -101,10 +101,8 @@ export default defineComponent({
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
const projectsStore = useProjectsStore();
|
||||
const userStore = useUserStore();
|
||||
|
||||
const { currentProjectKey } = toRefs(projectsStore.state);
|
||||
const { primaryKey } = toRefs(props);
|
||||
|
||||
const { isNew, edits, item, saving, loading, error, save, remove, deleting, saveAsCopy, isBatch } = useItem(
|
||||
@@ -132,7 +130,6 @@ export default defineComponent({
|
||||
saveAndAddNew,
|
||||
saveAsCopyAndNavigate,
|
||||
isBatch,
|
||||
currentProjectKey,
|
||||
marked,
|
||||
};
|
||||
|
||||
@@ -146,7 +143,7 @@ export default defineComponent({
|
||||
async function saveAndQuit() {
|
||||
await save();
|
||||
await userStore.hydrate();
|
||||
router.push(`/${currentProjectKey.value}/settings/roles`);
|
||||
router.push(`/settings/roles`);
|
||||
}
|
||||
|
||||
async function saveAndStay() {
|
||||
@@ -157,17 +154,17 @@ export default defineComponent({
|
||||
async function saveAndAddNew() {
|
||||
await save();
|
||||
await userStore.hydrate();
|
||||
router.push(`/${currentProjectKey.value}/settings/roles/+`);
|
||||
router.push(`/settings/roles/+`);
|
||||
}
|
||||
|
||||
async function saveAsCopyAndNavigate() {
|
||||
const newPrimaryKey = await saveAsCopy();
|
||||
router.push(`/${currentProjectKey.value}/settings/roles/${newPrimaryKey}`);
|
||||
router.push(`/settings/roles/${newPrimaryKey}`);
|
||||
}
|
||||
|
||||
async function deleteAndQuit() {
|
||||
await remove();
|
||||
router.push(`/${currentProjectKey.value}/settings/roles`);
|
||||
router.push(`/settings/roles`);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent, computed, ref } from '@vue/composition-api';
|
||||
import SettingsNavigation from '../../../components/navigation/';
|
||||
import useProjectsStore from '@/stores/projects';
|
||||
|
||||
import { i18n } from '@/lang';
|
||||
import api from '@/api';
|
||||
import { LayoutComponent } from '@/layouts/types';
|
||||
@@ -87,7 +87,6 @@ export default defineComponent({
|
||||
props: {},
|
||||
setup() {
|
||||
const layout = ref<LayoutComponent | null>(null);
|
||||
const projectsStore = useProjectsStore();
|
||||
|
||||
const selection = ref<Item[]>([]);
|
||||
|
||||
@@ -138,15 +137,13 @@ export default defineComponent({
|
||||
return { confirmDelete, deleting, batchDelete };
|
||||
|
||||
async function batchDelete() {
|
||||
const currentProjectKey = projectsStore.state.currentProjectKey;
|
||||
|
||||
deleting.value = true;
|
||||
|
||||
confirmDelete.value = false;
|
||||
|
||||
const batchPrimaryKeys = selection.value.map((item) => item.id).join();
|
||||
|
||||
await api.delete(`/${currentProjectKey}/settings/webhooks/${batchPrimaryKeys}`);
|
||||
await api.delete(`/settings/webhooks/${batchPrimaryKeys}`);
|
||||
|
||||
await layout.value?.refresh();
|
||||
|
||||
@@ -158,14 +155,12 @@ export default defineComponent({
|
||||
|
||||
function useLinks() {
|
||||
const addNewLink = computed<string>(() => {
|
||||
const currentProjectKey = projectsStore.state.currentProjectKey;
|
||||
return `/${currentProjectKey}/settings/webhooks/+`;
|
||||
return `/settings/webhooks/+`;
|
||||
});
|
||||
|
||||
const batchLink = computed<string>(() => {
|
||||
const currentProjectKey = projectsStore.state.currentProjectKey;
|
||||
const batchPrimaryKeys = selection.value.map((item) => item.id).join();
|
||||
return `/${currentProjectKey}/settings/webhooks/${batchPrimaryKeys}`;
|
||||
return `/settings/webhooks/${batchPrimaryKeys}`;
|
||||
});
|
||||
|
||||
return { addNewLink, batchLink };
|
||||
@@ -173,12 +168,10 @@ export default defineComponent({
|
||||
|
||||
function useBreadcrumb() {
|
||||
const breadcrumb = computed(() => {
|
||||
const currentProjectKey = projectsStore.state.currentProjectKey;
|
||||
|
||||
return [
|
||||
{
|
||||
name: i18n.tc('collection', 2),
|
||||
to: `/${currentProjectKey}/collections`,
|
||||
to: `/collections`,
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<template #headline>{{ $t('settings_webhooks') }}</template>
|
||||
|
||||
<template #title-outer:prepend>
|
||||
<v-button class="header-icon" rounded icon exact :to="`/${currentProjectKey}/settings/webhooks/`">
|
||||
<v-button class="header-icon" rounded icon exact :to="`/settings/webhooks/`">
|
||||
<v-icon name="arrow_back" />
|
||||
</v-button>
|
||||
</template>
|
||||
@@ -71,7 +71,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, computed, toRefs, ref } from '@vue/composition-api';
|
||||
import useProjectsStore from '@/stores/projects';
|
||||
|
||||
import SettingsNavigation from '../../../components/navigation/';
|
||||
import router from '@/router';
|
||||
import RevisionsDrawerDetail from '@/views/private/components/revisions-drawer-detail';
|
||||
@@ -94,8 +94,6 @@ export default defineComponent({
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
const projectsStore = useProjectsStore();
|
||||
const { currentProjectKey } = toRefs(projectsStore.state);
|
||||
const { primaryKey } = toRefs(props);
|
||||
|
||||
const { isNew, edits, item, saving, loading, error, save, remove, deleting, saveAsCopy, isBatch } = useItem(
|
||||
@@ -128,14 +126,13 @@ export default defineComponent({
|
||||
saveAndAddNew,
|
||||
saveAsCopyAndNavigate,
|
||||
isBatch,
|
||||
currentProjectKey,
|
||||
marked,
|
||||
title,
|
||||
};
|
||||
|
||||
async function saveAndQuit() {
|
||||
await save();
|
||||
router.push(`/${currentProjectKey.value}/settings/webhooks`);
|
||||
router.push(`/settings/webhooks`);
|
||||
}
|
||||
|
||||
async function saveAndStay() {
|
||||
@@ -144,17 +141,17 @@ export default defineComponent({
|
||||
|
||||
async function saveAndAddNew() {
|
||||
await save();
|
||||
router.push(`/${currentProjectKey.value}/settings/webhooks/+`);
|
||||
router.push(`/settings/webhooks/+`);
|
||||
}
|
||||
|
||||
async function saveAsCopyAndNavigate() {
|
||||
const newPrimaryKey = await saveAsCopy();
|
||||
router.push(`/${currentProjectKey.value}/settings/webhooks/${newPrimaryKey}`);
|
||||
router.push(`/settings/webhooks/${newPrimaryKey}`);
|
||||
}
|
||||
|
||||
async function deleteAndQuit() {
|
||||
await remove();
|
||||
router.push(`/${currentProjectKey.value}/settings/webhooks`);
|
||||
router.push(`/settings/webhooks`);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -22,15 +22,14 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from '@vue/composition-api';
|
||||
import useProjectsStore from '@/stores/projects';
|
||||
|
||||
import useNavigation from '../../composables/use-navigation';
|
||||
|
||||
export default defineComponent({
|
||||
setup() {
|
||||
const projectsStore = useProjectsStore();
|
||||
const { roles, loading } = useNavigation();
|
||||
|
||||
return { roles, loading, project: projectsStore.state.currentProjectKey };
|
||||
return { roles, loading };
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ref, Ref } from '@vue/composition-api';
|
||||
import useProjectsStore from '@/stores/projects';
|
||||
|
||||
import api from '@/api';
|
||||
import { Role } from '@/stores/user/types';
|
||||
|
||||
@@ -24,10 +24,8 @@ export default function useNavigation() {
|
||||
async function fetchRoles() {
|
||||
if (!loading || !roles) return;
|
||||
loading.value = true;
|
||||
const projectsStore = useProjectsStore();
|
||||
const currentProjectKey = projectsStore.state.currentProjectKey;
|
||||
|
||||
const rolesResponse = await api.get(`/${currentProjectKey}/roles`);
|
||||
const rolesResponse = await api.get(`/roles`);
|
||||
roles.value = rolesResponse.data.data;
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent, computed, ref } from '@vue/composition-api';
|
||||
import UsersNavigation from '../../components/navigation/';
|
||||
import useProjectsStore from '@/stores/projects';
|
||||
|
||||
import { i18n } from '@/lang';
|
||||
import api from '@/api';
|
||||
import { LayoutComponent } from '@/layouts/types';
|
||||
@@ -102,7 +102,6 @@ export default defineComponent({
|
||||
},
|
||||
setup(props) {
|
||||
const layout = ref<LayoutComponent | null>(null);
|
||||
const projectsStore = useProjectsStore();
|
||||
|
||||
const selection = ref<Item[]>([]);
|
||||
|
||||
@@ -177,15 +176,13 @@ export default defineComponent({
|
||||
return { confirmDelete, deleting, batchDelete };
|
||||
|
||||
async function batchDelete() {
|
||||
const currentProjectKey = projectsStore.state.currentProjectKey;
|
||||
|
||||
deleting.value = true;
|
||||
|
||||
confirmDelete.value = false;
|
||||
|
||||
const batchPrimaryKeys = selection.value;
|
||||
|
||||
await api.delete(`/${currentProjectKey}/users/${batchPrimaryKeys}`);
|
||||
await api.delete(`/users/${batchPrimaryKeys}`);
|
||||
|
||||
await layout.value?.refresh();
|
||||
|
||||
@@ -197,14 +194,12 @@ export default defineComponent({
|
||||
|
||||
function useLinks() {
|
||||
const addNewLink = computed<string>(() => {
|
||||
const currentProjectKey = projectsStore.state.currentProjectKey;
|
||||
return `/${currentProjectKey}/users/+`;
|
||||
return `/users/+`;
|
||||
});
|
||||
|
||||
const batchLink = computed<string>(() => {
|
||||
const currentProjectKey = projectsStore.state.currentProjectKey;
|
||||
const batchPrimaryKeys = selection.value;
|
||||
return `/${currentProjectKey}/users/${batchPrimaryKeys}`;
|
||||
return `/users/${batchPrimaryKeys}`;
|
||||
});
|
||||
|
||||
return { addNewLink, batchLink };
|
||||
@@ -212,12 +207,10 @@ export default defineComponent({
|
||||
|
||||
function useBreadcrumb() {
|
||||
const breadcrumb = computed(() => {
|
||||
const currentProjectKey = projectsStore.state.currentProjectKey;
|
||||
|
||||
return [
|
||||
{
|
||||
name: i18n.tc('collection', 2),
|
||||
to: `/${currentProjectKey}/collections`,
|
||||
to: `/collections`,
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, computed, toRefs, ref, watch } from '@vue/composition-api';
|
||||
import useProjectsStore from '@/stores/projects';
|
||||
|
||||
import UsersNavigation from '../../components/navigation/';
|
||||
import { i18n } from '@/lang';
|
||||
import router from '@/router';
|
||||
@@ -157,9 +157,8 @@ export default defineComponent({
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
const projectsStore = useProjectsStore();
|
||||
const fieldsStore = useFieldsStore();
|
||||
const { currentProjectKey } = toRefs(projectsStore.state);
|
||||
|
||||
const { primaryKey } = toRefs(props);
|
||||
const { breadcrumb } = useBreadcrumb();
|
||||
|
||||
@@ -243,7 +242,7 @@ export default defineComponent({
|
||||
const breadcrumb = computed(() => [
|
||||
{
|
||||
name: i18n.t('user_directory'),
|
||||
to: `/${currentProjectKey.value}/users/`,
|
||||
to: `/users/`,
|
||||
},
|
||||
]);
|
||||
|
||||
@@ -252,7 +251,7 @@ export default defineComponent({
|
||||
|
||||
async function saveAndQuit() {
|
||||
await save();
|
||||
router.push(`/${currentProjectKey.value}/users`);
|
||||
router.push(`/users`);
|
||||
}
|
||||
|
||||
async function saveAndStay() {
|
||||
@@ -263,23 +262,23 @@ export default defineComponent({
|
||||
if (props.primaryKey === '+') {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const newPrimaryKey = savedItem.id;
|
||||
router.replace(`/${currentProjectKey.value}/collections/users/${newPrimaryKey}`);
|
||||
router.replace(`/collections/users/${newPrimaryKey}`);
|
||||
}
|
||||
}
|
||||
|
||||
async function saveAndAddNew() {
|
||||
await save();
|
||||
router.push(`/${currentProjectKey.value}/users/+`);
|
||||
router.push(`/users/+`);
|
||||
}
|
||||
|
||||
async function saveAsCopyAndNavigate() {
|
||||
const newPrimaryKey = await saveAsCopy();
|
||||
router.push(`/${currentProjectKey.value}/users/${newPrimaryKey}`);
|
||||
router.push(`/users/${newPrimaryKey}`);
|
||||
}
|
||||
|
||||
async function deleteAndQuit() {
|
||||
await remove();
|
||||
router.push(`/${currentProjectKey.value}/users`);
|
||||
router.push(`/users`);
|
||||
}
|
||||
|
||||
function useUserPreview() {
|
||||
@@ -298,7 +297,7 @@ export default defineComponent({
|
||||
loading.value = true;
|
||||
|
||||
try {
|
||||
const response = await api.get(`/${currentProjectKey.value}/users/${props.primaryKey}`, {
|
||||
const response = await api.get(`/users/${props.primaryKey}`, {
|
||||
params: {
|
||||
fields: ['role.name', 'avatar.data'],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user