This commit is contained in:
rijkvanzanten
2023-04-14 17:30:56 -04:00
parent bdb1a919e2
commit 37658802b7
119 changed files with 224 additions and 0 deletions

View File

@@ -99,6 +99,7 @@ export default defineModule({
);
const { data } = useLocalStorage('last-accessed-collection');
if (
data.value &&
collectionsStore.visibleCollections.find((visibleCollection) => visibleCollection.collection === data.value)

View File

@@ -367,6 +367,7 @@ const disabledOptions = computed(() => {
function navigateBack() {
const backState = router.options.history.state.back;
if (typeof backState !== 'string' || !backState.startsWith('/login')) {
router.back();
return;

View File

@@ -290,6 +290,7 @@ const fieldsFiltered = computed(() => {
function navigateBack() {
const backState = router.options.history.state.back;
if (typeof backState !== 'string' || !backState.startsWith('/login')) {
router.back();
return;

View File

@@ -337,6 +337,7 @@ const cancelChanges = (force = false) => {
const copyPanelTo = ref(insightsStore.dashboards.find((dashboard) => dashboard.id !== props.primaryKey)?.id);
const copyPanelID = ref<string | null>();
const copyPanel = () => {
insightsStore.stagePanelDuplicate(unref(copyPanelID)!, { dashboard: unref(copyPanelTo) });
copyPanelID.value = null;

View File

@@ -199,6 +199,7 @@ export default defineModule({
async beforeEnter(to) {
const { flows } = useFlowsStore();
const existingFlow = flows.find((flow) => flow.id === to.params.primaryKey);
if (!existingFlow) {
return {
name: 'settings-not-found',

View File

@@ -70,6 +70,7 @@ export default defineComponent({
const recommendedItems: (FancySelectItem | { divider: boolean } | undefined)[] = [];
const recommendedList = recommended.map((key: any) => displayItems.find((item) => item.value === key));
if (recommendedList !== undefined) {
recommendedItems.push(...recommendedList.filter((i: any) => i));
}
@@ -79,6 +80,7 @@ export default defineComponent({
}
const displayList = displayItems.filter((item) => recommended.includes(item.value as string) === false);
if (displayList !== undefined) {
recommendedItems.push(...displayList.filter((i) => i));
}

View File

@@ -81,6 +81,7 @@ export default defineComponent({
const recommendedItems: (FancySelectItem | { divider: boolean } | undefined)[] = [];
const recommendedList = recommended.map((key) => interfaceItems.find((item) => item.value === key));
if (recommendedList !== undefined) {
recommendedItems.push(...recommendedList.filter((i) => i));
}
@@ -90,6 +91,7 @@ export default defineComponent({
}
const interfaceList = interfaceItems.filter((item) => recommended.includes(item.value as string) === false);
if (interfaceList !== undefined) {
recommendedItems.push(...interfaceList.filter((i) => i));
}

View File

@@ -210,6 +210,7 @@ export default defineComponent({
const unsortableJunctionFields = computed(() => {
let fields = ['item', 'collection'];
if (junctionCollection.value) {
const relations = relationsStore.getRelationsForCollection(junctionCollection.value);
fields.push(...relations.map((field) => field.field));

View File

@@ -270,6 +270,7 @@ export default defineComponent({
const unsortableJunctionFields = computed(() => {
let fields = [];
if (junctionCollection.value) {
const relations = relationsStore.getRelationsForCollection(junctionCollection.value);
fields.push(...relations.map((field) => field.field));

View File

@@ -144,6 +144,7 @@ export default defineComponent({
const unsortableJunctionFields = computed(() => {
let fields = [];
if (relatedCollection.value) {
const relations = relationsStore.getRelationsForCollection(relatedCollection.value);
fields.push(...relations.map((field) => field.field));

View File

@@ -52,6 +52,7 @@ export function setTypeForInterface(updates: StateUpdates, state: State) {
*/
export function setSpecialForLocalType(updates: StateUpdates) {
const localType = updates?.localType;
switch (localType) {
case 'o2m':
case 'm2m':

View File

@@ -23,6 +23,7 @@ function updateInterface(updates: StateUpdates, fn: HelperFunctions) {
const inter = useExtension('interface', fn.getCurrent('field.meta.interface'));
const type = updates.field?.type;
if (type && !inter.value?.types.includes(type)) {
set(updates, 'field.meta.interface', undefined);
}

View File

@@ -226,6 +226,7 @@ export function generateCollections(updates: StateUpdates, state: State, { getCu
});
const previousName = get(state, 'relations.m2o.related_collection');
if (state.items && state.items[previousName]) {
delete state.items[previousName];
}

View File

@@ -154,6 +154,7 @@ export const useFieldDetailStore = defineStore({
}
const localType = getCurrent('localType') as (typeof LOCAL_TYPES)[number] | undefined;
if (localType) {
alterations[localType].applyChanges(updates, this, helperFn);
}
@@ -165,6 +166,7 @@ export const useFieldDetailStore = defineStore({
// Validation to prevent cyclic relation
const aliasesFromRelation: string[] = [];
for (const relation of Object.values(this.relations)) {
if (!relation || !relation.collection || !relation.field) continue;
if (
@@ -189,6 +191,7 @@ export const useFieldDetailStore = defineStore({
const addedFields = Object.values(this.fields)
.map((field) => (field && field.collection && field.field ? `${field.collection}:${field.field}` : null))
.filter((field) => field);
if (addedFields.some((field) => addedFields.indexOf(field) !== addedFields.lastIndexOf(field))) {
throw new Error('Duplicate fields cannot be created');
}

View File

@@ -44,6 +44,7 @@ const endOffset = 13;
const size = computed(() => {
let width = 0,
height = 0;
for (const panel of props.panels) {
width = Math.max(width, (panel.x + PANEL_WIDTH) * 20);
height = Math.max(height, (panel.y + PANEL_HEIGHT) * 20);
@@ -130,6 +131,7 @@ const arrows = computed(() => {
function getPoints(panel: Record<string, any>, offset: Vector2, to?: Record<string, any>) {
const x = (panel.x - 1) * 20 + offset.x;
const y = (panel.y - 1) * 20 + offset.y;
if (to) {
const toX = (to.x - 1) * 20 + ATTACHMENT_OFFSET.x;
const toY = (to.y - 1) * 20 + ATTACHMENT_OFFSET.y;
@@ -213,6 +215,7 @@ const arrows = computed(() => {
}
let pointer = Math.floor(possiblePlaces.length / 2);
for (let i = 0; i < possiblePlaces.length; i++) {
pointer += i * (i % 2 == 0 ? -1 : 1);
if (possiblePlaces[pointer]) return min[axis] + pointer * 20;
@@ -223,6 +226,7 @@ const arrows = computed(() => {
function range(min: number, max: number, step: number) {
const points: number[] = [];
for (let i = min; i < max; i += step) {
points.push(i);
}

View File

@@ -223,6 +223,7 @@ function pointerdown(target: Target | 'parent') {
down = target;
const rect = document.getElementsByClassName('workspace').item(0)?.getBoundingClientRect();
if (rect) {
workspaceOffset = new Vector2(rect.left, rect.top);
}

View File

@@ -5,4 +5,5 @@ const PANEL_HEIGHT = 14;
const ATTACHMENT_OFFSET = new Vector2(0, 3 * 20);
const RESOLVE_OFFSET = new Vector2(PANEL_WIDTH * 20, 10 * 20);
const REJECT_OFFSET = new Vector2(PANEL_WIDTH * 20, 12 * 20);
export { PANEL_HEIGHT, PANEL_WIDTH, ATTACHMENT_OFFSET, RESOLVE_OFFSET, REJECT_OFFSET };

View File

@@ -385,6 +385,7 @@ const parentPanels = computed(() => {
function connectedToTrigger(id: string) {
let parent = parents[id];
while (parent?.id !== '$trigger') {
if (parent === undefined) return false;
parent = parents[parent.id];
@@ -672,6 +673,7 @@ function arrowStop() {
function isLoop(currentId: string, attachTo: string) {
let parent = currentId;
while (parent !== undefined) {
if (parent === attachTo) return true;
parent = parentPanels.value[parent]?.id ?? undefined;

View File

@@ -110,6 +110,7 @@ export default function useUpdatePermissions(
await Promise.all(
ACTIONS.map(async (action) => {
const permission = getPermission(action);
if (permission) {
try {
await api.patch(`/permissions/${permission.id}`, {

View File

@@ -184,6 +184,7 @@ function closeDialog() {
async function saveNewTranslationString() {
const newTranslationStrings = translationStrings.value ? [...translationStrings.value, values.value] : [values.value];
try {
await update(newTranslationStrings);
emit('savedKey', values.value.key);
@@ -197,6 +198,7 @@ async function deleteCurrentTranslationString() {
const newTranslationStrings = translationStrings.value
? translationStrings.value.filter((val) => val.key !== values.value.key)
: [];
try {
await update(newTranslationStrings);
confirmDelete.value = false;

View File

@@ -364,6 +364,7 @@ export default defineComponent({
function navigateBack() {
const backState = router.options.history.state.back;
if (typeof backState !== 'string' || !backState.startsWith('/login')) {
router.back();
return;