Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions config/local_settings_pretenders.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Settings for pretenders projects
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using our personal ones, I believe this should be the reference settings file that we use when working on code improvements for everything github/git related, which I believe is going to be most of our next body of work.


GITHUB_CONFIG = {
'organization': 'pretenders',
}

# GIT_CONFIG = {
# 'feature_breakup_regex': "(?P<project>[a-zA-Z]+)-?(?P<id>[0-9]+)",
# 'branch_finder_template': ".*(?i){project}.*"
# }

HIERARCHY_REGEXES = [
'master',
'develop',
'story/{FEATURE_ID}',
'story/{FEATURE_ID}/[a-z_]*',
'{PARENT}[/_][a-z]*',
'dev/{FEATURE_ID}/[a-z]*',
'{PARENT}[/_][a-z]*',
]
6 changes: 3 additions & 3 deletions deploystream/apps/feature/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ def get_feature_info(feature_provider, feature_id, providers):

# First get feature info from the management provider
planning_provider = providers[feature_provider]
feature_info = planning_provider.get_feature_info(feature_id)
feature = Feature(planning_provider, **feature_info)

feature = Feature(planning_provider,
**planning_provider.get_feature_info(feature_id))
# Then get any branch info from any source control providers
for provider in providers[ISourceCodeControlProvider]:
for branch_data in provider.get_repo_branches_involved(
feature_id, app.config['HIERARCHY_REGEXES']):
feature_id, app.config['HIERARCHY_REGEXES']):
feature.add_branch(Branch(provider=provider, **branch_data))

# Use that branch info, along with configuration regexes to create a
Expand Down
2 changes: 2 additions & 0 deletions deploystream/apps/feature/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ def __init__(self, provider, project, id, title,
self._extras = kwargs

self.branches = defaultdict(dict)
self.branch_list = []
self.trees = []

def add_branch(self, branch):
assert isinstance(branch, Branch)
self.branches[branch.repo_name][branch.branch_name] = branch
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This data structure doesn't lend itself well to being iterated in Javascript / front-end code. For want of something better, I am using a flat list of branches for now (see line below).

self.branch_list.append(branch)

def create_hierarchy_trees(self):
"Create hierarchy trees - one for each repo."
Expand Down
2 changes: 1 addition & 1 deletion deploystream/apps/feature/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def list_features(providers):
return features


@app.route('/features/<source_id>/<feature_id>', methods=['GET'])
@app.route('/features/<source_id>-<feature_id>', methods=['GET'])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The / was a bit of a pain when trying to set routes and use a single angular-js resource for Feature.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. I would have expected /features/:sourceid/:featureId to work

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's more related to using the Feature resource in angular to retrieve both detail and list (when featureId is empty). Also trying to build ":provider/:featureId" in JS was resulting in a URL-escaped value for / that returned a 404.

@needs_providers
@as_json
def view_feature(source_id, feature_id, providers):
Expand Down
1 change: 1 addition & 0 deletions deploystream/static/font-awesome
154 changes: 154 additions & 0 deletions deploystream/static/github-70.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Structure seems fine to me.

Presumably additional details could be added to the details list. Not sure how we'd display that additional information since it seems we are only showing one overall colour but that's one for another day I guess...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main idea as described in the original google doc was: "Status/health is a single square with a color code. It represents an aggregated view of a number of indicators. Upon clicking/hovering one can see the detailed decomposition (e.g. build status, branch relevance, branch staleness, ready to deploy...) "

I will add some more details for illustration and completeness.

"description": "",
"title": "Ability to view the branch hierarchy for a feature, and what is merged into what.",
"url": "https://github.com/pretenders/deploystream/issues/70",
"project": "pretenders/deploystream",
"owner": "alexcouper",
"provider": "github",
"type": "story",
"id": 70,
"repositories": [
{
"name": "deploystream",
"branches": [
{
"latest_commit": "9770a5e",
"branch_name": "master",
"health": {
"status": "green",
"details": [
{
"type": "build",
"provider": "travis-ci",
"status": "green",
"url": "https://travis-ci.org/pretenders/deploystream/builds/8604410"
}
]
},
"children": [
{
"latest_commit": "dfa9217",
"branch_name": "develop",
"health": {
"status": "green",
"details": [
{
"type": "build",
"provider": "travis-ci",
"status": "green",
"url": "https://travis-ci.org/pretenders/deploystream/builds/8604410"
},
{
"type": "relevant",
"provider": "git",
"status": "green"
}
]
},
"children": [
{
"latest_commit": "98457ab",
"branch_name": "story/70/view-hierarchy",
"health": {
"status": "red",
"details": [
{
"type": "build",
"provider": "travis-ci",
"status": "red",
"url": "https://travis-ci.org/pretenders/deploystream/builds/8604410"
},
{
"type": "relevant",
"provider": "git",
"status": "green"
},
{
"type": "updated",
"provider": "git",
"status": "yellow",
"message": "this branch is not up to date with develop"
}
]
},
"children": [
{
"latest_commit": "5719681",
"branch_name": "dev/70/alex",
"repo_name": "deploystream",
"health": {
"status": "unknown",
"details": [
{
"type": "build",
"provider": "travis-ci",
"status": "unknown",
"url": "https://travis-ci.org/pretenders/deploystream/builds/8604410"
}
]
},
"children": []
},
{
"latest_commit": "aace02c",
"branch_name": "dev/70/carles",
"health": {
"status": "yellow",
"details": [
{
"type": "build",
"provider": "travis-ci",
"status": "yellow",
"url": "https://travis-ci.org/pretenders/deploystream/builds/8604410"
}
]
},
"children": []
}
]
}
]
}
]
}
]
},
{
"name": "somecomponent",
"branches": [
{
"latest_commit": "7923a5e",
"branch_name": "develop",
"health": {
"status": "green",
"details": [
{
"type": "build",
"provider": "travis-ci",
"status": "green",
"url": "https://travis-ci.org/pretenders/deploystream/builds/8604410"
}
]
},
"children": [
{
"latest_commit": "e3457ab",
"branch_name": "story/70/view-hierarchy",
"health": {
"status": "green",
"details": [
{
"type": "build",
"provider": "travis-ci",
"status": "green",
"url": "https://travis-ci.org/pretenders/deploystream/builds/8604410"
}
]
}
}
]
}
]
}
]
}
6 changes: 5 additions & 1 deletion deploystream/static/js/app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// global angular, FeatureListCtrl
// global angular, FeatureListCtrl, FeatureDetailCtrl
'use strict';


Expand All @@ -16,5 +16,9 @@ angular.module('deploystream', [
templateUrl: '/static/partials/features.html',
controller: FeatureListCtrl
});
$routeProvider.when('/features/:featureId', {
templateUrl: '/static/partials/feature.html',
controller: FeatureDetailCtrl
});
}]
);
17 changes: 17 additions & 0 deletions deploystream/static/js/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,21 @@ function FeatureListCtrl($scope, Feature) {
$scope.features = features;
});
}


function FeatureDetailCtrl($scope, $routeParams, Feature) {

var featureId = $routeParams.featureId;

Feature.query('', function (features) {
$scope.features = features;
});

Feature.get({featureId: featureId}, function (feature) {
$scope.feature = feature;
$scope.root = 'master';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something that will need to come from the backend, as part of the feature branch data.
As you have been taking great care to provide properly hierarchified branch info, the frontend code only needs the root branch, and work with its children. A lot of the branch data that comes in the JSON is redundant and I don't think we really need it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we address this now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe. I believe at the feature "repo" level we may have a couple of pieces of data that will be useful: 1) which is the root branch of the hierarchy to display and 2) which is the "main" feature branch for this feature - as both have display relevance in different situations.

});
}


//FeatureListCtrl.$inject = [];
8 changes: 5 additions & 3 deletions deploystream/static/js/directives.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// global angular
/* global angular */
'use strict';

/* Directives */


angular.module('deploystream.directives', [])
.directive('appVersion', ['version', function (version) {
return function (scope, elm, attrs) {
elm.text(version);
return function ($scope, $element) {
$element.text(version);
};
}]);
// .directive('featureHealth', function() {
// });
4 changes: 2 additions & 2 deletions deploystream/static/js/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ angular.module('deploystream.services', ['ngResource'])
.value('version', '0.1')
.factory('Feature', function ($resource) {
return $resource(
'/features/:featureId',
//'/features/:featureId',
'/static/:featureId.json',
{},
{
query: {
method: 'GET',
params: {featureId: ''},
isArray: true
}
});
Expand Down
6 changes: 6 additions & 0 deletions deploystream/static/less/colours.less
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,9 @@
@altDarkBackground: darken(@color5, 30%);
@btnPrimaryColor: @color5;

@secondaryTitle: @color5;

@statusGreen: @color1;
@statusRed: @color4;
@statusYellow: @yellow;
@statusUnknown: #888;
Loading