Commit e0187018 authored by Kostis Trantzas's avatar Kostis Trantzas
Browse files

removing success toastr

parent 6ebd6c8b
Loading
Loading
Loading
Loading
Loading
+6 −30
Original line number Diff line number Diff line
@@ -36,7 +36,6 @@ export class MetricsComponent implements OnInit {
    private toast: ToastrService
  ) { }

  apiError: boolean = false;
  isLoading: boolean = true;
  config: IAppConfig
  loggedIn: boolean
@@ -122,8 +121,8 @@ export class MetricsComponent implements OnInit {
    datasets: [
      { 
        data: [],
        backgroundColor: ['#428bca', '#42ca74', '#c5ca42' ],
        hoverBackgroundColor: ['#235e91', '#24a34a', '#8d911f'],
        backgroundColor: ['#fd8f00', '#28a745', '#dc3545' ],
        hoverBackgroundColor: ['#d27700', '#1e873d', '#941822'],
        hoverBorderColor: 'white'
      }
    ],
@@ -135,8 +134,8 @@ export class MetricsComponent implements OnInit {
    datasets: [
      { 
        data: [],
        backgroundColor: ['#428bca', '#42ca74', '#c5ca42', '#ca42c1', '#d91424'],
        hoverBackgroundColor: ['#235e91', '#24a34a', '#8d911f', '#871880', '#941822'],
        backgroundColor: ['#428bca', '#cab642ff', '#fd8f00', '#28a745', '#dc3545'],
        hoverBackgroundColor: ['#235e91', '#8d911f', '#d27700', '#1e873d', '#941822'],
        hoverBorderColor: 'white',
      }
    ],
@@ -149,8 +148,8 @@ export class MetricsComponent implements OnInit {
    datasets: [
      {
        data: [],
        backgroundColor: ['#428bca', '#c5ca42', '#42ca74', '#d91424'],
        hoverBackgroundColor:  ['#235e91', '#8d911f', '#24a34a', '#941822'],
        backgroundColor: ['#fd8f00', '#a2a3a4', '#28a745',  '#d91424'],
        hoverBackgroundColor:  ['#d27700', '#818181', '#1e873d', '#941822'],
        hoverBorderColor: 'white'
      }
    ]
@@ -172,98 +171,84 @@ export class MetricsComponent implements OnInit {
    forkJoin({
      registeredMANO: this.nfvMetricsService.getRegisteredManoProviders().pipe(
        catchError(error => {
          this.apiError = true;
          this.toast.error('API services are not responding. Please verify service health.');
          return scheduled([{ registeredManoProviders: NaN }], asyncScheduler);
        })
      ),
      registeredNSDs: this.nfvMetricsService.getRegisteredNsds().pipe(
        catchError(error => {
          this.apiError = true;
          this.toast.error('API services are not responding. Please verify service health.');
          return scheduled([{ registeredNSDs: NaN }], asyncScheduler);
        })
      ),
      registeredVNFs: this.nfvMetricsService.getRegisteredVnfs().pipe(
        catchError(error => {
          this.apiError = true;
          this.toast.error('API services are not responding. Please verify service health.');
          return scheduled([{ registeredVNFs: NaN }], asyncScheduler);
        })
      ),
      registeredUsers: this.generalMetricsService.getRegisteredIndividuals().pipe(
        catchError(error => {
          this.apiError = true;
          this.toast.error('API services are not responding. Please verify service health.');
          return scheduled([{ registeredIndividuals: NaN }], asyncScheduler);
        })
      ),
      publishedServiceSpecs: this.generalMetricsService.getPublishedServiceSpecifications().pipe(
        catchError(error => {
          this.apiError = true;
          this.toast.error('API services are not responding. Please verify service health.');
          return scheduled([{ publishedServiceSpecifications: NaN }], asyncScheduler);
        })
      ),
      registeredResourceSpecs: this.generalMetricsService.getRegisteredResourceSpecifications().pipe(
        catchError(error => {
          this.apiError = true;
          this.toast.error('API services are not responding. Please verify service health.');
          return scheduled([{ registeredResourceSpecifications: NaN }], asyncScheduler);
        })
      ),
      totalCreatedServices: this.serviceMetricsService.getTotalServices().pipe(
        catchError(error => {
          this.apiError = true;
          this.toast.error('API services are not responding. Please verify service health.');
          return scheduled([{ totalServices: NaN }], asyncScheduler);
        })
      ),
      activeServices: this.serviceMetricsService.getTotalServices({ state: 'ACTIVE' }).pipe(
        catchError(error => {
          this.apiError = true;
          this.toast.error('API services are not responding. Please verify service health.');
          return scheduled([{ totalServices: NaN }], asyncScheduler);
        })
      ),
      totalResources: this.resourceMetricsService.getTotalResources().pipe(
        catchError(error => {
          this.apiError = true;
          this.toast.error('API services are not responding. Please verify service health.');
          return scheduled([{ totalResources: NaN }], asyncScheduler);
        })
      ),
      availableResources: this.resourceMetricsService.getTotalResources({ state: 'AVAILABLE' }).pipe(
        catchError(error => {
          this.apiError = true;
          this.toast.error('API services are not responding. Please verify service health.');
          return scheduled([{ totalResources: NaN }], asyncScheduler);
        })
      ),
      activeServiceOrders: this.serviceOrderMetricsService.getTotalActiveServiceOrders().pipe(
        catchError(error => {
          this.apiError = true;
          this.toast.error('API services are not responding. Please verify service health.');
          return scheduled([{ activeServiceOrders: NaN }], asyncScheduler);
        })
      ),
      totalCompletedOrders: this.serviceOrderMetricsService.getTotalServiceOrders({ state: 'COMPLETED' }).pipe(
        catchError(error => {
          this.apiError = true;
          this.toast.error('API services are not responding. Please verify service health.');
          return scheduled([{ totalServiceOrders: NaN }], asyncScheduler);
        })
      ),
      serviceOrdersTotal15days: this.serviceOrderMetricsService.getServiceOrdersGroupedByDay({ starttime, endtime }).pipe(
        catchError(error => {
          this.apiError = true;
          this.toast.error('API services are not responding. Please verify service health.');
          return scheduled([{ serviceOrders:{ total: this.serviceOrdersTotal15days } }], asyncScheduler);
        })
      ),
      serviceOrdersGroupedByDay: this.serviceOrderMetricsService.getServiceOrdersGroupedByDay({ starttime, endtime }).pipe(
        catchError(error => {
          this.apiError = true;
          this.toast.error('API services are not responding. Please verify service health.');
          const mockGroupByDay = this.barChartLabels.map(label => {
            const [day, month] = label.split('/').map(Number);
@@ -284,14 +269,12 @@ export class MetricsComponent implements OnInit {
      ),
      serviceOrdersTotalMonth: this.serviceOrderMetricsService.getServiceOrdersGroupedByState({ starttime: starttimeMonth, endtime }).pipe(
        catchError(error => {
          this.apiError = true;
          this.toast.error('API services are not responding. Please verify service health.');
          return scheduled([{ serviceOrders:{ total: this.serviceOrdersTotalMonth } }], asyncScheduler);
        })
      ),
      serviceOrdersGroupedByState: this.serviceOrderMetricsService.getServiceOrdersGroupedByState({ starttime: starttimeMonth, endtime }).pipe(
        catchError(error => {
          this.apiError = true;
          this.toast.error('API services are not responding. Please verify service health.');
          return scheduled([{ 
            serviceOrders: { 
@@ -307,14 +290,12 @@ export class MetricsComponent implements OnInit {
      ),
      resourcesTotalMonth: this.resourceMetricsService.getResourcesGroupedByState({ starttime: starttimeMonth, endtime }).pipe(
        catchError(error => {
          this.apiError = true;
          this.toast.error('API services are not responding. Please verify service health.');
          return scheduled([{ resources:{ total: this.resourcesTotalMonth } }], asyncScheduler);
        })
      ),
      resourcesGroupedByState: this.resourceMetricsService.getResourcesGroupedByState({ starttime: starttimeMonth, endtime }).pipe(
        catchError(error => {
          this.apiError = true;
          this.toast.error('API services are not responding. Please verify service health.');
          return scheduled([{ 
            resources: { 
@@ -330,14 +311,12 @@ export class MetricsComponent implements OnInit {
      ),
      servicesTotalMonth: this.serviceMetricsService.getServicesGroupedByState({ starttime: starttimeMonth, endtime }).pipe(
        catchError(error => {
          this.apiError = true;
          this.toast.error('API services are not responding. Please verify service health.');
          return scheduled([{ services:{ total: this.servicesTotalMonth } }], asyncScheduler);
        })
      ),
      servicesGroupedByState: this.serviceMetricsService.getServicesGroupedByState({ starttime: starttimeMonth, endtime }).pipe(
        catchError(error => {
          this.apiError = true;
          this.toast.error('API services are not responding. Please verify service health.');
          return scheduled([{ 
            services: { 
@@ -390,9 +369,6 @@ export class MetricsComponent implements OnInit {
      this.servicesData.datasets[0].data = this.servicesByState.map(data => data.count);
      this.isLoading = false;

      if(!this.apiError) {
        this.toast.success("All data loaded successfully");
      }
    });
  }