Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Documentation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
RWTHjupyter
Documentation
Commits
afa15018
Commit
afa15018
authored
4 years ago
by
Steffen Vogel
Browse files
Options
Downloads
Patches
Plain Diff
fix link wizard
parent
8b676dd7
No related branches found
No related tags found
No related merge requests found
Pipeline
#353189
passed
4 years ago
Stage: prepare
Stage: deploy
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
script.js
+18
-36
18 additions, 36 deletions
script.js
src/usage/Links.md
+1
-1
1 addition, 1 deletion
src/usage/Links.md
with
19 additions
and
37 deletions
script.js
+
18
−
36
View file @
afa15018
...
...
@@ -12,33 +12,11 @@ function escapeHtml(unsafe) {
.
replace
(
/'/g
,
"
'
"
);
}
function
getProfiles
()
{
window
.
fetch
(
serviceUrl
+
'
/profile/all
'
,
{
mode
:
'
no-cors
'
})
.
then
((
response
)
=>
response
.
json
())
.
then
((
json
)
=>
{
this
.
console
.
log
(
json
);
for
(
const
i
in
json
.
jobs
)
{
let
job
=
json
.
jobs
[
i
];
elm
=
this
.
document
.
getElementById
(
'
build-
'
+
job
.
name
);
if
(
elm
)
{
elm
.
classList
.
add
(
job
.
status
);
elm
.
innerText
=
job
.
status
;
elm
.
insertAdjacentHTML
(
'
afterend
'
,
'
<span class="build-log">(open <a href="
'
+
job
.
web_url
+
'
">build log</a> #
'
+
job
.
id
+
'
from
'
+
new
Date
(
job
.
created_at
).
toLocaleString
()
+
'
)</span>
'
);
}
}
});
async
function
getProfiles
()
{
let
response
=
await
fetch
(
serviceUrl
+
'
/profile/api/all
'
);
let
json
=
await
response
.
json
();
return
[
{
slug
:
"
pti
"
,
display_name
:
"
[PTI] Praktikum Technische Informatik
"
},
{
slug
:
"
gdet3
"
,
display_name
:
"
[GDET3] Grundgebiete der Elektrotechnik 3
"
}
]
return
json
.
profiles
;
}
function
updateLink
(
event
)
{
...
...
@@ -46,6 +24,7 @@ function updateLink(event) {
var
filePath
=
document
.
getElementById
(
"
link-wizard-path
"
);
var
outputDiv
=
document
.
getElementById
(
"
link-wizard-output
"
);
var
directLink
=
document
.
getElementById
(
"
link-wizard-direct-link
"
);
var
badgeDiv
=
document
.
getElementById
(
"
link-wizard-badge
"
);
var
badgePre_md
=
document
.
getElementById
(
"
link-wizard-badge-md
"
);
var
badgePreHtml
=
document
.
getElementById
(
"
link-wizard-badge-html
"
);
...
...
@@ -56,23 +35,26 @@ function updateLink(event) {
if
(
profileSlug
.
length
>
0
)
{
var
link
=
updateDirectLink
(
slug
,
path
);
// Link
directLink
.
innerHTML
=
link
;
// Badges
// Badge Code
var
badge_md
=
'
[](
'
+
link
+
'
)
'
;
var
badgeHtml
=
'
<a href="
'
+
link
+
'
"><img src="
'
+
badgeURL
+
'
" /></a>
'
;
badgePre_md
.
innerHTML
=
badge_md
;
badgePreHtml
.
innerHTML
=
escapeHtml
(
badgeHtml
);
// Link
directLink
.
innerHTML
=
'
<a href="
'
+
link
+
'
">
'
+
link
+
'
</a>
'
;
// Badge
badgeDiv
.
innerHTML
=
badgeHtml
outputDiv
.
style
.
display
=
'
block
'
;
}
}
function
generateProfileDropdown
(
profilesSelect
)
{
async
function
generateProfileDropdown
(
profilesSelect
)
{
// Fill profiles select
var
profiles
=
getProfiles
();
let
profiles
=
await
getProfiles
();
for
(
var
i
=
0
;
i
<
profiles
.
length
;
i
++
)
{
var
o
=
document
.
createElement
(
"
option
"
);
...
...
@@ -95,8 +77,8 @@ function updateDirectLink(profileSlug, path) {
function
loadBuildStatus
()
{
window
.
fetch
(
serviceUrl
+
'
/profile/all
'
)
.
then
(
(
response
)
=>
response
.
json
())
.
then
(
(
json
)
=>
{
.
then
(
response
=>
response
.
json
())
.
then
(
json
=>
{
this
.
console
.
log
(
json
);
for
(
const
i
in
json
.
jobs
)
{
let
job
=
json
.
jobs
[
i
];
...
...
@@ -203,10 +185,10 @@ function insertVersionCollapsibles() {
}
}
window
.
addEventListener
(
'
load
'
,
function
()
{
window
.
addEventListener
(
'
load
'
,
e
=>
{
if
(
window
.
location
.
pathname
.
endsWith
(
'
/Profiles.html
'
))
{
loadBuildStatus
();
insertVersionCollapsibles
();
loadBuildStatus
();
}
if
(
window
.
location
.
pathname
.
endsWith
(
'
/Links.html
'
))
{
...
...
This diff is collapsed.
Click to expand it.
src/usage/Links.md
+
1
−
1
View file @
afa15018
...
...
@@ -25,7 +25,7 @@ You can use the following wizard to generate links and badges which open specifi
<h3>
Link
</h3>
<pre
id=
"link-wizard-direct-link"
></pre>
<h3>
Badge
</h3>
<img
src=
"https://jupyter.pages.rwth-aachen.de/documentation/images/badge-launch-rwth-jupyter.svg"
alt=
"RWTHjupyter badge"
>
<div
id=
"link-wizard-badge"
>
<img
src=
"https://jupyter.pages.rwth-aachen.de/documentation/images/badge-launch-rwth-jupyter.svg"
alt=
"RWTHjupyter badge"
>
</div>
<h5>
Markdown Snippet
</h5>
<pre
id=
"link-wizard-badge-md"
></pre>
<h5>
HTML Snippet
</h5>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment