<commit_before>import 'package:angular/angular.dart';
import 'package:angular_router/angular_router.dart';
import 'package:gitpods/routes.dart' as global;
import 'package:gitpods/src/gravatar_component.dart';
import 'package:gitpods/src/loading_component.dart';
import 'package:gitpods/src/repository/repository.dart';
import 'package:gitpods/src/repository/repository_service.dart';
import 'package:gitpods/src/repository/repository_tree.dart';
import 'package:gitpods/src/repository/routes.dart';

@Component(
    selector: 'gitpods-repository',
    templateUrl: 'repository_component.html',
    styleUrls: const [
      'repository_component.css'
    ],
    directives: const [
      coreDirectives,
      routerDirectives,
      LoadingComponent,
      GravatarComponent,
    ],
    providers: const [
      ClassProvider(RepositoryService),
      ClassProvider(Routes),
    ],
    exports: [
      Routes,
      RoutePaths,
    ])
class RepositoryComponent implements OnActivate {
  RepositoryComponent(this._repositoryService);

  final RepositoryService _repositoryService;

  String ownerName;
  Repository repository;
  List<RepositoryTree> tree;

  @override
  void onActivate(RouterState previous, RouterState current) {
    ownerName = current.parameters['owner'];
    String name = current.parameters['name'];

    this._repositoryService.get(ownerName, name).then((RepositoryPage page) {
      this.repository = page.repository;
    });
  }

  String userProfileUrl() =>
      global.RoutePaths.userProfile.toUrl(parameters: {'username': ownerName});

// TODO: Create method to get repository parameters for the following

  String repositoryUrl() => global.RoutePaths.repository.toUrl(parameters: {
        'owner': ownerName,
        'name': repository.name,
      });

  String filesUrl() => RoutePaths.files.toUrl(parameters: {
        'owner': ownerName,
        'name': repository.name,
      });

  String commitsUrl() => RoutePaths.commits.toUrl(parameters: {
        'owner': ownerName,
        'name': repository.name,
      });

  String settingsUrl() => RoutePaths.settings.toUrl(parameters: {
        'owner': ownerName,
        'name': repository.name,
      });
}

class RepositoryPage {
  RepositoryPage(this.repository);

  Repository repository;
}<commit_msg>Create _parameters helper method for repository urls<commit_after>import 'package:angular/angular.dart';
import 'package:angular_router/angular_router.dart';
import 'package:gitpods/routes.dart' as global;
import 'package:gitpods/src/gravatar_component.dart';
import 'package:gitpods/src/loading_component.dart';
import 'package:gitpods/src/repository/repository.dart';
import 'package:gitpods/src/repository/repository_service.dart';
import 'package:gitpods/src/repository/repository_tree.dart';
import 'package:gitpods/src/repository/routes.dart';

@Component(
    selector: 'gitpods-repository',
    templateUrl: 'repository_component.html',
    styleUrls: const [
      'repository_component.css'
    ],
    directives: const [
      coreDirectives,
      routerDirectives,
      LoadingComponent,
      GravatarComponent,
    ],
    providers: const [
      ClassProvider(RepositoryService),
      ClassProvider(Routes),
    ],
    exports: [
      Routes,
      RoutePaths,
    ])
class RepositoryComponent implements OnActivate {
  RepositoryComponent(this._repositoryService);

  final RepositoryService _repositoryService;

  String ownerName;
  Repository repository;
  List<RepositoryTree> tree;

  @override
  void onActivate(RouterState previous, RouterState current) {
    ownerName = current.parameters['owner'];
    String name = current.parameters['name'];

    this._repositoryService.get(ownerName, name).then((RepositoryPage page) {
      this.repository = page.repository;
    });
  }

  String userProfileUrl() =>
      global.RoutePaths.userProfile.toUrl(parameters: {'username': ownerName});

  Map<String, String> _parameters() => {
        'owner': this.ownerName,
        'name': this.repository.name,
      };

  String repositoryUrl() =>
      global.RoutePaths.repository.toUrl(parameters: _parameters());

  String filesUrl() => RoutePaths.files.toUrl(parameters: _parameters());

  String commitsUrl() => RoutePaths.commits.toUrl(parameters: _parameters());

  String settingsUrl() => RoutePaths.settings.toUrl(parameters: _parameters());
}

class RepositoryPage {
  RepositoryPage(this.repository);

  Repository repository;
}
{'fraction_non_alphanumeric': 0.11730337078651686, 'fraction_numerical': 0.0, 'mean_word_length': 4.24263839811543, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 17, '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': '2551648', 'n_tokens_mistral': 1281, 'n_tokens_neox': 1252, 'n_words': 229}