-
Notifications
You must be signed in to change notification settings - Fork 11
/
detail.html
313 lines (284 loc) · 13.2 KB
/
detail.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
{% extends "base.html" %}
{% load humanize %}
{% block metatitle %}{{ workspace.name }} | OpenSAFELY Jobs{% endblock metatitle %}
{% block extra_meta %}
<meta property="og:title" content="{{ workspace.name }}" />
<meta property="og:type" content="website" />
<meta property="og:url" content="{{ request.build_absolute_uri }}" />
<meta property="og:description" content="Repo: {{ workspace.repo.name }} ({{ workspace.branch }})" />
{% endblock extra_meta %}
{% block breadcrumbs %}
{% #breadcrumbs %}
{% url 'home' as home_url %}
{% breadcrumb title="Home" url=home_url %}
{% breadcrumb location="Project" title=workspace.project.name url=workspace.project.get_absolute_url %}
{% breadcrumb location="Workspace" title=workspace.name active=True %}
{% /breadcrumbs %}
{% endblock breadcrumbs %}
{% block content %}
{% if workspace.is_archived %}
{% #alert variant="warning" title="Archived Workspace" class="mb-6" %}
<p class="text-sm mb-2">
This Workspace has been archived.
Logs are still available but new Jobs can no longer be requested.
</p>
<p class="text-sm">
If you think this has been done in error,
{% link text="contact an admin" href="mailto:[email protected]" append_after="." %}
</p>
{% /alert %}
{% endif %}
{% if workspace.project.slug == "opensafely-internal" %}
{% #alert variant="warning" title="This workspace belongs to an internal OpenSAFELY project" class="mb-6" %}
The project exists for internal purposes only.
More information can be found in the
{% link text="OpenSAFELY access policy" href="https://docs.opensafely.org/developer-access-policy/" append_after="." %}
{% /alert %}
{% endif %}
<div class="grid grid-cols-1 gap-6 lg:grid-cols-3">
<div class="flex flex-col text-center items-center gap-y-2 lg:text-left lg:items-start lg:col-span-full">
<div class="flex flex-col items-center gap-y-2 w-full lg:flex-row lg:justify-between lg:items-start">
<div class="order-2 w-full lg:mr-auto lg:order-1">
<h1 class="mb-2 text-3xl tracking-tight break-words font-bold text-slate-900 sm:text-4xl">
{{ workspace.name }}
</h1>
<dl class="flex flex-col gap-2 text-sm text-slate-600 items-center sm:flex-row sm:gap-x-6 sm:justify-center lg:justify-start">
<dt class="sr-only">Organisation:</dt>
<dd class="flex flex-row items-start overflow-hidden">
{% icon_building_library_outline class="mr-1.5 h-5 w-5 flex-shrink-0 text-slate-400" %}
<span class="truncate">{{ workspace.project.org.name }}</span>
</dd>
<dt class="sr-only">Project:</dt>
<dd class="flex flex-row items-start overflow-hidden">
{% icon_rectangle_stack_outline class="mr-1.5 h-5 w-5 flex-shrink-0 text-slate-400" %}
<span class="truncate">{{ workspace.project.name }}</span>
</dd>
</dl>
</div>
{% if user_can_view_staff_area %}
<div class="order-1 lg:order-2 flex-shrink-0">
{% #button href=workspace.get_staff_url type="link" variant="danger" class="flex-shrink-0" %}
View in Staff Area
{% icon_lifebuoy_outline class="h-4 w-4 ml-2 -mr-2" %}
{% /button %}
</div>
{% endif %}
</div>
<div class="flex flex-col mt-2 sm:flex-row gap-2 lg:items-start">
{% if is_member %}
{% #button href=workspace.get_edit_url type="link" variant="secondary" %}
Edit workspace
{% icon_pencil_outline class="h-4 w-4 ml-2 -mr-2" %}
{% /button %}
{% endif %}
{% if workspace.is_archived %}
{% #button type="button" variant="info" disabled=True tooltip="Jobs cannot be run on an archived workspace" %}
Run jobs
{% icon_play_outline class="h-4 w-4 ml-2 -mr-2" %}
{% /button %}
{% elif not user_can_run_jobs %}
{% #button type="button" variant="info" disabled=True tooltip="You do not have permission to run jobs on this workspace" %}
Run jobs
{% icon_play_outline class="h-4 w-4 ml-2 -mr-2" %}
{% /button %}
{% elif not user_has_backends %}
{% #button type="button" variant="info" disabled=True tooltip="You do not have permission to run jobs on any OpenSAFELY backends" %}
Run jobs
{% icon_play_outline class="h-4 w-4 ml-2 -mr-2" %}
{% /button %}
{% else %}
{% #button href=workspace.get_jobs_url type="link" variant="success" %}
Run jobs
{% icon_play_outline class="h-4 w-4 ml-2 -mr-2" %}
{% /button %}
{% endif %}
{% if show_interactive_button %}
{% if workspace.is_archived %}
{% #button type="button" variant="info" disabled=True tooltip="Analyses cannot be run on an archived workspace" %}
Run interactive analysis
{% icon_play_outline class="h-4 w-4 ml-2 -mr-2" %}
{% /button %}
{% else %}
{% #button href=workspace.project.get_interactive_url type="link" variant="success" %}
Run interactive analysis
{% icon_play_outline class="h-4 w-4 ml-2 -mr-2" %}
{% /button %}
{% endif %}
{% endif %}
{% #button href=workspace.get_logs_url type="link" variant="primary" %}
View logs
{% icon_queue_list_outline class="h-4 w-4 ml-2 -mr-2" %}
{% /button %}
</div>
</div>
<div class="space-y-6 md:space-y-6 lg:col-span-1 lg:row-start-2">
{% if show_admin %}
{% #card title="Workspace admin" class="text-center" container=True %}
{% if user_can_archive_workspace %}
<form method="POST" action="{{ workspace.get_archive_toggle_url }}" class="mb-2">
{% csrf_token %}
<input type="hidden" name="is_archived" value="{{ workspace.is_archived|yesno:",True" }}" />
{% if workspace.is_archived %}
{% #button variant="primary" type="submit" %}
Unarchive workspace
{% /button %}
{% else %}
{% #button variant="danger" type="submit" class="" %}
Archive workspace
{% /button %}
{% endif %}
</form>
{% endif %}
{% if repo_is_private %}
{% #button variant="warning" type="link" href=workspace.repo.get_sign_off_url class="mb-2" %}
Change repo visibility
{% /button %}
{% endif %}
{% if user_can_toggle_notifications %}
<form method="POST" action="{{ workspace.get_notifications_toggle_url }}">
{% csrf_token %}
<input type="hidden" name="should_notify" value="{{ workspace.should_notify|yesno:",True" }}" />
{% if workspace.should_notify %}
{% #button variant="warning" type="submit" %}
Disable notifications
{% /button %}
{% else %}
{% #button variant="success" type="submit" %}
Enable notification
{% /button %}
{% endif %}
</form>
{% endif %}
{% /card %}
{% endif %}
{% #card title="Workspace information" %}
<dl class="border-t border-slate-200 sm:divide-y sm:divide-slate-200">
{% #description_item title="Repo" %}
{% link text=workspace.repo.name href=workspace.repo.url %}
{% if repo_is_private %}
<p class="mt-2 mb-1">This repo is not publicly viewable.</p>
<details class="group">
<summary
class="
text-oxford-600 font-semibold cursor-pointer
hover:text-oxford-900 hover:underline
"
>
Why is this repo private?
</summary>
<div class="pl-3">
<p class="my-1">In accordance with the <a href="https://www.opensafely.org/about/#transparency-and-public-logs">Principles of OpenSAFELY</a> we expect all code from all users to be made public.</p>
<p class="mb-0">However, some GitHub repositories may be private during the development stage of a project, which means any links to them from this site will return a '404 Not Found' error unless you are logged in and have the relevant permissions.</p>
</div>
</details>
{% endif %}
{% /description_item %}
{% #description_item title="Branch" %}
{% link text=workspace.branch href=workspace.repo.url|add:"/tree/"|add:workspace.branch %}
{% /description_item %}
{% #description_item title="Created" %}
<time
datetime="{{ workspace.created_at|date:"Y-m-d H:i:sO" }}"
title="{{ workspace.created_at|date:"Y-m-d H:i:sO" }}"
>
{{ workspace.created_at|naturaltime }}
</time>
{% /description_item %}
{% #description_item title="Created by" %}
{{ workspace.created_by.name }}
{% /description_item %}
</dl>
{% /card %}
</div>
<div class="grid gap-6 place-content-start lg:col-span-2">
{% if show_publish_repo_warning %}
{% #alert variant="warning" title="Repository is currently private" %}
<p class="text-sm mb-2">
The
{% link text="first job to run against the git repository" href=first_job.get_absolute_url %}
for this workspace ran over 11 months ago. Per our
{% link text="platform policy" href="https://docs.opensafely.org/repositories/#when-you-need-to-make-your-code-public" %}
we ask that repositories are made public 12 months after they
are first executed against patient data.
</p>
<p class="text-sm">
{% link text="Change repository visibility →" href=workspace.repo.get_sign_off_url %}
</p>
{% /alert %}
{% endif %}
{% #card container=True class="font-lg text-slate-700" %}
<p class="mb-1">
This is an OpenSAFELY workspace. It represents a working directory for the
{% link text=workspace.project.title href=workspace.project.get_absolute_url %}
project on all of the secure environments supported by
OpenSAFELY.
</p>
<p>
On each secure environment, the directory includes code from the
{% spaceless %}
{% link text="repository" href=workspace.repo.url|add:"/tree/"|add:workspace.branch %}
{% endspaceless %},
and the results of running it against real data ("jobs").
Researchers can request jobs are run from this page.
</p>
{% /card %}
{# Remove this check once we can rely on the purpose field #}
{% if workspace.purpose %}
{% #card title="Workspace purpose" container=True %}
<p class="prose">
{{ workspace.purpose|linebreaksbr|urlize }}
</p>
{% /card %}
{% endif %}
{% #card title="Releases" %}
{% #list_group small=True %}
{% #list_group_item href=workspace.get_releases_url disabled=outputs.released.disabled %}
Released Outputs
{% /list_group_item%}
{% #list_group_item href=workspace.get_outputs_url %}
Published Outputs
{% /list_group_item%}
{% /list_group %}
{% /card %}
{% #card title="Reports" %}
{% #list_group small=True %}
{% for report in reports %}
{% #list_group_item href=report.get_absolute_url disabled=report.is_draft %}
{{ report.title }}
{% if report.is_draft %}
{% pill class="ml-2" text="Not published" variant="primary" %}
{% endif %}
{% /list_group_item %}
{% empty %}
{% list_group_empty description="No reports added to this workspace" %}
{% endfor %}
{% /list_group %}
{% /card %}
{% if analyses %}
{% #card title="Interactive analyses" %}
{% #list_group small=True %}
{% for analysis in analyses %}
{% #list_group_item href=analysis.get_absolute_url %}
{{ analysis.title }}
{% pill class="ml-2" text=analysis.job_request.status variant=analysis.job_request.status|match:"pending:info,running:primary,succeeded:success,failed:danger"|default:"info" %}
{% /list_group_item %}
{% empty %}
{% list_group_empty description="No analyses requested for this workspace" %}
{% endfor %}
{% #card_footer no_container=True %}
{% url "job-list" as job_list_url %}
{% link href=workspace.get_analyses_url text="View all Interactive analyses →" %}
{% /card_footer %}
{% /list_group %}
{% /card %}
{% endif %}
{% #card title="Monitoring" subtitle="Honeycomb login required" %}
{% #list_group small=True %}
{% #list_group_item href=honeycomb_link %}
Heatmap of runtimes for completed jobs in this workspace
{% /list_group_item%}
{% /list_group %}
{% /card %}
</div>
</div>
{% endblock content %}