<commit_before>import { module } from 'angular';
import { StateParams } from '@uirouter/angularjs';
import { APPLICATION_STATE_PROVIDER, ApplicationStateProvider } from 'core/application/application.state.provider';
import { INestedState, STATE_CONFIG_PROVIDER, StateConfigProvider } from 'core/navigation/state.provider';
import { IProject } from '../domain/IProject';
import { ProjectReader } from './service/ProjectReader';

export interface IProjectStateParms extends StateParams {
  project: string;
}

export const PROJECTS_STATES_CONFIG = 'spinnaker.core.projects.state.config';
module(PROJECTS_STATES_CONFIG, [
  require('./project.controller').name,
  require('./projects.controller').name,
  require('./dashboard/dashboard.controller').name,
  APPLICATION_STATE_PROVIDER,
  STATE_CONFIG_PROVIDER,
]).config((stateConfigProvider: StateConfigProvider, applicationStateProvider: ApplicationStateProvider) => {
  const dashboard: INestedState = {
    name: 'dashboard',
    url: '/dashboard',
    views: {
      detail: {
        templateUrl: require('../projects/dashboard/dashboard.html'),
        controller: 'ProjectDashboardCtrl',
        controllerAs: 'vm',
      },
    },
    data: {
      pageTitleSection: {
        title: 'Dashboard',
      },
    },
  };

  const project: INestedState = {
    name: 'project',
    url: '/projects/{project}',
    resolve: {
      projectConfiguration: [
        '$stateParams',
        ($stateParams: IProjectStateParms) => {
          return ProjectReader.getProjectConfig($stateParams.project).then(
            (projectConfig: IProject) => projectConfig,
            (): IProject => {
              return {
                id: null,
                name: $stateParams.project,
                email: null,
                config: null,
                notFound: true,
              };
            },
          );
        },
      ],
    },
    views: {
      'main@': {
        templateUrl: require('../projects/project.html'),
        controller: 'ProjectCtrl',
        controllerAs: 'vm',
      },
    },
    data: {
      pageTitleMain: {
        field: 'project',
      },
      history: {
        type: 'projects',
      },
    },
    children: [dashboard],
  };

  const allProjects: INestedState = {
    name: 'projects',
    url: '/projects',
    views: {
      'main@': {
        templateUrl: require('../projects/projects.html'),
        controller: 'ProjectsCtrl',
        controllerAs: 'ctrl',
      },
    },
    data: {
      pageTitleMain: {
        label: 'Projects',
      },
    },
    children: [project],
  };

  stateConfigProvider.addToRootState(allProjects);<commit_msg>fix(core/projects): remove duplicative home.projects.project.** substates (#5682)<commit_after>import { module } from 'angular';
import { StateParams } from '@uirouter/angularjs';
import { APPLICATION_STATE_PROVIDER, ApplicationStateProvider } from 'core/application/application.state.provider';
import { INestedState, STATE_CONFIG_PROVIDER, StateConfigProvider } from 'core/navigation/state.provider';
import { IProject } from '../domain/IProject';
import { ProjectReader } from './service/ProjectReader';

export interface IProjectStateParms extends StateParams {
  project: string;
}

export const PROJECTS_STATES_CONFIG = 'spinnaker.core.projects.state.config';
module(PROJECTS_STATES_CONFIG, [
  require('./project.controller').name,
  require('./projects.controller').name,
  require('./dashboard/dashboard.controller').name,
  APPLICATION_STATE_PROVIDER,
  STATE_CONFIG_PROVIDER,
]).config((stateConfigProvider: StateConfigProvider, applicationStateProvider: ApplicationStateProvider) => {
  const dashboard: INestedState = {
    name: 'dashboard',
    url: '/dashboard',
    views: {
      detail: {
        templateUrl: require('../projects/dashboard/dashboard.html'),
        controller: 'ProjectDashboardCtrl',
        controllerAs: 'vm',
      },
    },
    data: {
      pageTitleSection: {
        title: 'Dashboard',
      },
    },
  };

  const project: INestedState = {
    name: 'project',
    url: '/projects/{project}',
    resolve: {
      projectConfiguration: [
        '$stateParams',
        ($stateParams: IProjectStateParms) => {
          return ProjectReader.getProjectConfig($stateParams.project).then(
            (projectConfig: IProject) => projectConfig,
            (): IProject => {
              return {
                id: null,
                name: $stateParams.project,
                email: null,
                config: null,
                notFound: true,
              };
            },
          );
        },
      ],
    },
    views: {
      'main@': {
        templateUrl: require('../projects/project.html'),
        controller: 'ProjectCtrl',
        controllerAs: 'vm',
      },
    },
    data: {
      pageTitleMain: {
        field: 'project',
      },
      history: {
        type: 'projects',
      },
    },
    children: [dashboard],
  };

  const allProjects: INestedState = {
    name: 'projects',
    url: '/projects',
    views: {
      'main@': {
        templateUrl: require('../projects/projects.html'),
        controller: 'ProjectsCtrl',
        controllerAs: 'ctrl',
      },
    },
    data: {
      pageTitleMain: {
        label: 'Projects',
      },
    },
  };

  stateConfigProvider.addToRootState(allProjects);
{'fraction_non_alphanumeric': 0.13518067777569742, 'fraction_numerical': 0.0007489234225800412, 'mean_word_length': 2.47334200260078, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '413152', 'n_tokens_mistral': 1500, 'n_tokens_neox': 1486, 'n_words': 272}