updated new dashboard

This commit is contained in:
Luca Haid
2025-05-13 18:41:03 +02:00
parent 15a2d11f2d
commit f08178ada2

View File

@@ -7,20 +7,18 @@ Vue.component('dashboard-location-selector-adb', {
props: {
selectedNetwork: {type: String, required: true}
},
data() {
return {
filterOptions: {
netOwners: []
}
};
},
async mounted() {
await this.fetchNetworkFilterOptions();
data: () => ({
filterOptions: {
netOwners: []
}
}),
mounted() {
this.fetchNetworkFilterOptions();
},
methods: {
async fetchNetworkFilterOptions() {
const response = await axios.get(`${window.TT_CONFIG['BASE_PATH']}/DashboardNew/getNetworkFilterOptions`);
this.filterOptions.netOwners = [{value: 'all', text: 'Alle'}, ...response.data];
const { data } = await axios.get(`${window.TT_CONFIG['BASE_PATH']}/DashboardNew/getNetworkFilterOptions`);
this.filterOptions.netOwners = [{value: 'all', text: 'Alle'}, ...data];
}
}
});
@@ -94,7 +92,7 @@ Vue.component('dashboard-adb-content', {
<tt-dashboard-display-card
header="Andere"
icon="fas fa-city"
icon="fas fa-building"
:text="(parseInt(addressDbData.other_types.type_greenfield) + parseInt(addressDbData.other_types.type_transformer_station) + parseInt(addressDbData.other_types.type_others)) + ' (' +
(parseInt(addressDbData.other_types.type_greenfield_homes) + parseInt(addressDbData.other_types.type_transformer_station_homes) + parseInt(addressDbData.other_types.type_others_homes)) + ')'"
:subHeaders="[
@@ -128,32 +126,22 @@ Vue.component('dashboard-adb', {
</div>
</tt-card>
`,
data() {
return {
addressDbData: null,
selectedNetwork: 'all',
isLoading: false
};
},
async mounted() {
await this.fetchAddressDbData();
data: () => ({
addressDbData: null,
selectedNetwork: 'all',
isLoading: false
}),
mounted() {
this.fetchAddressDbData();
},
methods: {
async fetchAddressDbData() {
this.isLoading = true;
try {
// Use the correct API endpoint as specified
const netzgebietId = this.selectedNetwork === 'all' ? '' : this.selectedNetwork;
const url = `${window.TT_CONFIG['BASE_PATH']}/DashboardNew/getDashboardAddressDBData${netzgebietId ? '?netzgebiet_id=' + netzgebietId : ''}`;
const response = await axios.get(url);
this.addressDbData = response.data;
console.log('Address DB data:', this.addressDbData);
} catch (error) {
console.error('Error fetching address DB data:', error);
} finally {
this.isLoading = false;
}
const netzParam = this.selectedNetwork !== 'all' ? `?netzgebiet_id=${this.selectedNetwork}` : '';
const url = `${window.TT_CONFIG['BASE_PATH']}/DashboardNew/getDashboardAddressDBData${netzParam}`;
const { data } = await axios.get(url);
this.addressDbData = data;
this.isLoading = false;
}
},
watch: {