nowy atrybut scenerii

This commit is contained in:
2023-12-06 17:43:41 +01:00
parent 0f54963065
commit 5161f903eb
6 changed files with 16 additions and 23 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
VITE_API_URL="https://stacjownik.spythere.eu" VITE_API_URL="https://stacjownik.spythere.eu"
VITE_API_URL_DEV="http://localhost:3001" VITE_API_URL_DEV="http://localhost:3001"
VITE_API_DEV=0 VITE_API_MODE="DEV"
+3 -1
View File
@@ -1,7 +1,9 @@
import axios from 'axios'; import axios from 'axios';
const baseURL = import.meta.env['VITE_API_MODE'] == 'DEV' ? import.meta.env['VITE_API_URL_DEV'] : import.meta.env['VITE_API_URL'];
const client = axios.create({ const client = axios.create({
baseURL: import.meta.env['VITE_API_URL'], baseURL: baseURL,
withCredentials: true, withCredentials: true,
}); });
+6 -1
View File
@@ -100,6 +100,8 @@ export default defineComponent({
computed: { computed: {
changelog() { changelog() {
console.log(this.store.changeList);
return this.store.changeList return this.store.changeList
.map((changeItem) => { .map((changeItem) => {
let itemChanges = []; let itemChanges = [];
@@ -109,7 +111,7 @@ export default defineComponent({
for (let change in changeItem) { for (let change in changeItem) {
let propChange = change as ChangeProp; let propChange = change as ChangeProp;
if (/id|name/.test(propChange)) continue; if (/^(id|name)$/.test(propChange)) continue;
let value = typeof changeItem[propChange] === 'boolean' ? (changeItem[propChange] ? 'TAK' : 'NIE') : changeItem[propChange]; let value = typeof changeItem[propChange] === 'boolean' ? (changeItem[propChange] ? 'TAK' : 'NIE') : changeItem[propChange];
@@ -119,6 +121,8 @@ export default defineComponent({
itemChanges.push(`<i style='color: white'>${(HeaderTypes as any)[propChange]}:</i> ${value ?? '-'}`); itemChanges.push(`<i style='color: white'>${(HeaderTypes as any)[propChange]}:</i> ${value ?? '-'}`);
} }
console.log(itemChanges);
return `<b class='text--accent'>${changeItem.name} -></b> ` + itemChanges.join('; '); return `<b class='text--accent'>${changeItem.name} -></b> ` + itemChanges.join('; ');
}) })
.join(' <br /> '); .join(' <br /> ');
@@ -199,6 +203,7 @@ export default defineComponent({
controlType: 'SCS', controlType: 'SCS',
SUP: false, SUP: false,
routes: 'Test_1EPB:0:0', routes: 'Test_1EPB:0:0',
hidden: false,
routesInfo: [ routesInfo: [
{ {
isElectric: true, isElectric: true,
+1 -19
View File
@@ -29,29 +29,11 @@ export default defineComponent({
const sceneryBackup = this.store.backupList.find((scenery) => scenery.id == sceneryId); const sceneryBackup = this.store.backupList.find((scenery) => scenery.id == sceneryId);
if (!sceneryBackup) return; if (!sceneryBackup) return;
if (sceneryBackup && sceneryBackup[changePropName] == changeItem[changePropName]) if (sceneryBackup && sceneryBackup[changePropName] == changeItem[changePropName]) delete changeItem[changePropName];
delete changeItem[changePropName];
if (Object.keys(changeItem).length == 2 && changeItem.id) if (Object.keys(changeItem).length == 2 && changeItem.id)
this.store.changeList = this.store.changeList.filter((item) => changeItem?.id != item.id); this.store.changeList = this.store.changeList.filter((item) => changeItem?.id != item.id);
// if (
// changeItem[changePropName] !== undefined &&
// backupChangeItem[changePropName] !== undefined &&
// changeItem[changePropName] == backupChangeItem[changePropName]
// ) {
// console.log('delete');
// delete changeItem[changePropName];
// delete backupChangeItem[changePropName];
// if (Object.keys(changeItem).length == 1 && changeItem.id)
// this.store.changeList = this.store.changeList.filter((item) => changeItem?.id != item.id);
// if (Object.keys(backupChangeItem).length == 1 && backupChangeItem.id)
// this.store.changeBackupList = this.store.changeList.filter((item) => backupChangeItem?.id != item.id);
// }
this.store.unsavedChanges = this.store.changeList.length != 0; this.store.unsavedChanges = this.store.changeList.length != 0;
}, },
+4 -1
View File
@@ -13,7 +13,8 @@ export type ChangeProp =
| 'routesInfo' | 'routesInfo'
| 'checkpoints' | 'checkpoints'
| 'authors' | 'authors'
| 'availability'; | 'availability'
| 'hidden';
export enum HeaderTypes { export enum HeaderTypes {
name = 'Nazwa', name = 'Nazwa',
@@ -31,6 +32,7 @@ export enum HeaderTypes {
routesInfo = 'Szlaki', routesInfo = 'Szlaki',
checkpoints = 'Posterunki', checkpoints = 'Posterunki',
availability = 'Dostępność', availability = 'Dostępność',
hidden = 'Ukryty',
toRemove = 'Usuń', toRemove = 'Usuń',
} }
@@ -65,6 +67,7 @@ export interface SceneryRowItem {
signalType: string; signalType: string;
controlType: string; controlType: string;
SUP: boolean; SUP: boolean;
hidden: boolean;
routes: string; routes: string;
routesInfo: SceneryRoutesInfo[]; routesInfo: SceneryRoutesInfo[];
checkpoints: string; checkpoints: string;
+1
View File
@@ -87,6 +87,7 @@ export default defineComponent({
authors: 'Autorzy', authors: 'Autorzy',
routes: 'Szlaki', routes: 'Szlaki',
checkpoints: 'Posterunki', checkpoints: 'Posterunki',
hidden: 'Ukryty',
} as { } as {
[key: string]: string; [key: string]: string;
}, },