diff --git a/endpoints/api/build.py b/endpoints/api/build.py index 0a5319a5c..1456ce8b0 100644 --- a/endpoints/api/build.py +++ b/endpoints/api/build.py @@ -14,7 +14,9 @@ from endpoints.building import start_build, PreparedBuild from endpoints.trigger import BuildTriggerHandler from data import model, database from auth.auth_context import get_authenticated_user -from auth.permissions import ModifyRepositoryPermission, AdministerOrganizationPermission +from auth.permissions import (ReadRepositoryPermission, ModifyRepositoryPermission, + AdministerRepositoryPermission, AdministerOrganizationPermission) + from data.buildlogs import BuildStatusRetrievalError from util.names import parse_robot_username @@ -33,7 +35,7 @@ def get_job_config(build_obj): try: return json.loads(build_obj.job_config) except: - return None + return {} def user_view(user): @@ -43,11 +45,12 @@ def user_view(user): 'is_robot': user.robot, } -def trigger_view(trigger, can_admin=False): +def trigger_view(trigger, can_read=False, can_admin=False): if trigger and trigger.uuid: build_trigger = BuildTriggerHandler.get_handler(trigger) return { 'service': trigger.service.name, + 'build_source': build_trigger.config.get('build_source') if can_read else None, 'config': build_trigger.config if can_admin else {}, 'id': trigger.uuid, 'connected_user': trigger.connected_user.username, @@ -58,7 +61,7 @@ def trigger_view(trigger, can_admin=False): return None -def build_status_view(build_obj, can_write=False, can_admin=False): +def build_status_view(build_obj): phase = build_obj.phase try: status = build_logs.get_status(build_obj.uuid) @@ -81,21 +84,32 @@ def build_status_view(build_obj, can_write=False, can_admin=False): if not retry: phase = database.BUILD_PHASE.ERROR - logger.debug('Can write: %s job_config: %s', can_write, build_obj.job_config) + repo_namespace = build_obj.repository.namespace_user.username + repo_name = build_obj.repository.name + + can_read = ReadRepositoryPermission(repo_namespace, repo_name).can() + can_write = ModifyRepositoryPermission(repo_namespace, repo_name).can() + can_admin = AdministerRepositoryPermission(repo_namespace, repo_name).can() + + job_config = get_job_config(build_obj) + resp = { 'id': build_obj.uuid, 'phase': phase, 'started': format_date(build_obj.started), 'display_name': build_obj.display_name, 'status': status or {}, - 'job_config': get_job_config(build_obj) if can_write else None, + 'subdirectory': job_config.get('build_subdir', ''), + 'tags': job_config.get('docker_tags', []), + 'manual_user': job_config.get('manual_user', None), 'is_writer': can_write, - 'trigger': trigger_view(build_obj.trigger, can_admin), + 'trigger': trigger_view(build_obj.trigger, can_read, can_admin), + 'trigger_metadata': job_config.get('trigger_metadata', None) if can_read else None, 'resource_key': build_obj.resource_key, 'pull_robot': user_view(build_obj.pull_robot) if build_obj.pull_robot else None, 'repository': { - 'namespace': build_obj.repository.namespace_user.username, - 'name': build_obj.repository.name + 'namespace': repo_namespace, + 'name': repo_name } } @@ -157,9 +171,8 @@ class RepositoryBuildList(RepositoryParamResource): since = datetime.datetime.utcfromtimestamp(since) builds = model.list_repository_builds(namespace, repository, limit, since=since) - can_write = ModifyRepositoryPermission(namespace, repository).can() return { - 'builds': [build_status_view(build, can_write) for build in builds] + 'builds': [build_status_view(build) for build in builds] } @require_repo_write @@ -211,7 +224,7 @@ class RepositoryBuildList(RepositoryParamResource): prepared.metadata = {} build_request = start_build(repo, prepared, pull_robot_name=pull_robot_name) - resp = build_status_view(build_request, can_write=True) + resp = build_status_view(build_request) repo_string = '%s/%s' % (namespace, repository) headers = { 'Location': api.url_for(RepositoryBuildStatus, repository=repo_string, @@ -236,8 +249,7 @@ class RepositoryBuildResource(RepositoryParamResource): except model.InvalidRepositoryBuildException: raise NotFound() - can_write = ModifyRepositoryPermission(namespace, repository).can() - return build_status_view(build, can_write) + return build_status_view(build) @require_repo_admin @nickname('cancelRepoBuild') @@ -271,8 +283,7 @@ class RepositoryBuildStatus(RepositoryParamResource): build.repository.namespace_user.username != namespace): raise NotFound() - can_write = ModifyRepositoryPermission(namespace, repository).can() - return build_status_view(build, can_write) + return build_status_view(build) @resource('/v1/repository//build//logs') diff --git a/endpoints/api/trigger.py b/endpoints/api/trigger.py index 805ea08bc..35dc6b9e9 100644 --- a/endpoints/api/trigger.py +++ b/endpoints/api/trigger.py @@ -432,7 +432,7 @@ class ActivateBuildTrigger(RepositoryParamResource): except TriggerStartException as tse: raise InvalidRequest(tse.message) - resp = build_status_view(build_request, can_write=True) + resp = build_status_view(build_request) repo_string = '%s/%s' % (namespace, repository) headers = { 'Location': api.url_for(RepositoryBuildStatus, repository=repo_string, @@ -456,7 +456,7 @@ class TriggerBuildList(RepositoryParamResource): builds = list(model.list_trigger_builds(namespace, repository, trigger_uuid, limit)) return { - 'builds': [build_status_view(build, can_write=True) for build in builds] + 'builds': [build_status_view(build) for build in builds] } diff --git a/external_libraries.py b/external_libraries.py index 7004a2cca..72da2f90e 100644 --- a/external_libraries.py +++ b/external_libraries.py @@ -18,7 +18,7 @@ EXTERNAL_JS = [ ] EXTERNAL_CSS = [ - 'netdna.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.css', + 'netdna.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.css', 'netdna.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css', 'fonts.googleapis.com/css?family=Source+Sans+Pro:400,700', 's3.amazonaws.com/cdn.core-os.net/icons/core-icons.css' diff --git a/static/css/directives/ui/setup-trigger-dialog.css b/static/css/directives/ui/setup-trigger-dialog.css new file mode 100644 index 000000000..482a687bf --- /dev/null +++ b/static/css/directives/ui/setup-trigger-dialog.css @@ -0,0 +1,28 @@ +.setup-trigger-directive-element .dockerfile-found-content { + margin-left: 32px; +} + +.setup-trigger-directive-element .dockerfile-found-content:before { + content: "\f071"; + font-family: FontAwesome; + color: rgb(255, 194, 0); + position: absolute; + top: 0px; + left: 0px; + font-size: 20px; +} + +.setup-trigger-directive-element .loading { + text-align: center; +} + +.setup-trigger-directive-element .loading .cor-loader-inline { + margin-right: 4px; +} + +.setup-trigger-directive-element .dockerfile-found { + position: relative; + margin-bottom: 16px; + padding-bottom: 16px; + border-bottom: 1px solid #eee; +} \ No newline at end of file diff --git a/static/css/directives/ui/source-commit-link.css b/static/css/directives/ui/source-commit-link.css index 489b79c9a..b16c15248 100644 --- a/static/css/directives/ui/source-commit-link.css +++ b/static/css/directives/ui/source-commit-link.css @@ -1,8 +1,42 @@ -.source-commit-link-element .fa { - margin-right: 4px; +.source-commit-link-element .commit-circle { + margin-right: 6px; display: inline-block; + padding-top: 2px; } +.source-commit-link-element .commit-circle { + display: inline-block; + border: 2px solid #999; + width: 10px; + height: 10px; + border-radius: 50%; + position: relative; +} + +.source-commit-link-element .commit-circle:before, +.source-commit-link-element .commit-circle:after { + content: ""; + display: inline-block; + border-top: 2px solid #999; + height: 10px; + width: 4px; + position: absolute; + top: 2px; +} + +.source-commit-link-element .commit-circle:before { + left: -5px; +} + +.source-commit-link-element .commit-circle:after { + left: 7px; +} + + .source-commit-link-element { white-space: nowrap; +} + +.source-commit-link-element .anchor { + vertical-align: middle; } \ No newline at end of file diff --git a/static/css/directives/ui/step-view-step.css b/static/css/directives/ui/step-view-step.css new file mode 100644 index 000000000..16f31abda --- /dev/null +++ b/static/css/directives/ui/step-view-step.css @@ -0,0 +1,9 @@ +.step-view-step-content .loading-message { + position: relative; + text-align: center; + display: block; +} + +.step-view-step-content .loading-message .cor-loader-inline { + margin-right: 6px; +} \ No newline at end of file diff --git a/static/css/directives/ui/trigger-setup-githost.css b/static/css/directives/ui/trigger-setup-githost.css index edaf63c86..b4ac0f94f 100644 --- a/static/css/directives/ui/trigger-setup-githost.css +++ b/static/css/directives/ui/trigger-setup-githost.css @@ -42,7 +42,7 @@ vertical-align: middle; } -.trigger-setup-githost-element li.repo-listing i { +.trigger-setup-githost-element li.host-repo-listing i { margin-right: 10px; margin-left: 6px; } diff --git a/static/css/directives/ui/triggered-build-description.css b/static/css/directives/ui/triggered-build-description.css index a3b0bda1a..803a58472 100644 --- a/static/css/directives/ui/triggered-build-description.css +++ b/static/css/directives/ui/triggered-build-description.css @@ -10,9 +10,8 @@ .triggered-build-description-element .commit-who img { width: 16px; height: 16px; - margin-left: 2px; + margin-left: 4px; margin-right: 2px; - border-radius: 50%; } .triggered-build-description-element .fa-github { diff --git a/static/css/quay.css b/static/css/quay.css index 02409c42a..b570ffa22 100644 --- a/static/css/quay.css +++ b/static/css/quay.css @@ -3768,27 +3768,6 @@ pre.command:before { border-bottom-left-radius: 0px; } -.setup-trigger-directive-element .dockerfile-found-content { - margin-left: 32px; -} - -.setup-trigger-directive-element .dockerfile-found-content:before { - content: "\f071"; - font-family: FontAwesome; - color: rgb(255, 194, 0); - position: absolute; - top: 0px; - left: 0px; - font-size: 20px; -} - -.setup-trigger-directive-element .dockerfile-found { - position: relative; - margin-bottom: 16px; - padding-bottom: 16px; - border-bottom: 1px solid #eee; -} - .slideinout { -webkit-transition:0.5s all; transition:0.5s linear all; diff --git a/static/directives/anchor.html b/static/directives/anchor.html index 563fbe581..258f441e8 100644 --- a/static/directives/anchor.html +++ b/static/directives/anchor.html @@ -1,4 +1,4 @@ - + diff --git a/static/directives/repo-view/repo-panel-builds.html b/static/directives/repo-view/repo-panel-builds.html index 3079d06f0..d4f2b1db7 100644 --- a/static/directives/repo-view/repo-panel-builds.html +++ b/static/directives/repo-view/repo-panel-builds.html @@ -54,7 +54,6 @@ style="min-width: 66px;"> Tags - @@ -139,6 +138,7 @@ {{ trigger.config.branchtag_regex || 'All' }} + (None) diff --git a/static/directives/setup-trigger-dialog.html b/static/directives/setup-trigger-dialog.html index 66a1c52b7..d20398ec5 100644 --- a/static/directives/setup-trigger-dialog.html +++ b/static/directives/setup-trigger-dialog.html @@ -1,5 +1,4 @@
-