Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
15855c1
WBSTACK MODIFICATIONS
addshore Dec 4, 2020
c070da4
Github actions for docker build
addshore Dec 4, 2020
abb4205
Standardize docker workflows
addshore Dec 5, 2020
79cb84f
ADD CHANGELOG.md
addshore Dec 5, 2020
ed489ec
Merge branch 'main' into upstream
addshore Dec 8, 2020
e5bfd9b
Merge pull request #1 from wbstack/upstream
addshore Dec 8, 2020
cf43380
CHANGELOG for 1.1 image
addshore Dec 8, 2020
de3cc23
Jan 2010 Merge in https://github.com/wikimedia/wikidata-query-gui
addshore Jan 31, 2021
d31258f
CHANGELOG
addshore Jan 31, 2021
20255b1
Upgrade to GitHub-native Dependabot
dependabot-preview[bot] Apr 29, 2021
4901a83
Bump luke142367/Docker-Lint-Action from v1.0.0 to v1.1.1
dependabot[bot] May 2, 2021
84657aa
Bump crazy-max/ghaction-docker-meta from v1 to v2.4.0
dependabot[bot] May 2, 2021
b232f1b
Bump actions/cache from 2 to 2.1.5 (#18)
dependabot[bot] May 14, 2021
a7e79c6
Bump docker/setup-qemu-action from 1 to 1.1.0 (#17)
dependabot[bot] May 14, 2021
c8dfd5b
Bump docker/build-push-action from 2 to 2.4.0 (#15)
dependabot[bot] May 14, 2021
0c13d31
Bump crazy-max/ghaction-docker-meta from 2.4.0 to 3.1.0 (#14)
dependabot[bot] May 14, 2021
e7f7aa4
Bump docker/login-action from 1 to 1.9.0 (#13)
dependabot[bot] May 14, 2021
7068cda
Bump actions/checkout from 2 to 2.3.4 (#12)
dependabot[bot] May 14, 2021
57fe29f
Don't require GITHUB_TOKEN in docker related flows (#19)
addshore May 14, 2021
13ce6b3
Merge branch 'master' of github.com:wikimedia/wikidata-query-gui into…
addshore Jun 23, 2021
f1a451b
Merge pull request #25 from wbstack/upstream-changes-june-2021-0
addshore Jun 23, 2021
8040959
CHANGELOG 1.3
addshore Jun 23, 2021
073e391
Bump crazy-max/ghaction-docker-meta from 3.1.0 to 3.3.0 (#21)
dependabot[bot] Jun 23, 2021
77b701e
Bump docker/build-push-action from 2.4.0 to 2.5.0 (#22)
dependabot[bot] Jun 23, 2021
e0e973b
Bump docker/setup-qemu-action from 1.1.0 to 1.2.0 (#23)
dependabot[bot] Jun 23, 2021
d4ff28f
Bump actions/cache from 2.1.5 to 2.1.6 (#24)
dependabot[bot] Jun 23, 2021
7853f0f
Dependapile Github Actions June 30th (#28)
addshore Jun 30, 2021
ac224ef
Add .github/workflows/github.prs.combine.yml
addshore Sep 1, 2021
183cd16
Combined PR for prefix: dependabot/github_actions (#37)
addshore Sep 1, 2021
583adcb
Blanket ${{ secrets.GITHUB_TOKEN }}
addshore Oct 13, 2021
8cf8ba7
Bump actions/github-script from 4.1 to 5 (#39)
dependabot[bot] Oct 13, 2021
575b428
Merge pull request #40 from wbstack/ghtoken
toban Oct 13, 2021
70d7b25
Merge https://github.com/wikimedia/wikidata-query-gui into addshore-w…
addshore Feb 10, 2022
1b514f1
Hide #query-builder-dd on wb.cloud
addshore Feb 10, 2022
6cab5c1
Merge pull request #51 from wbstack/addshore-wmde.5-update
tarrow Feb 10, 2022
ca78c10
CHANGELOG: 1.4
tarrow Feb 10, 2022
34bc69f
Bump stylelint-config-wikimedia from 0.11.1 to 0.12.1
dependabot[bot] Feb 21, 2022
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
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# We only want to ignore these for the docker build
# I hope they are included in docker-compose...
/src/node_modules
/src/build
57 changes: 57 additions & 0 deletions .github/workflows/docker.build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Docker build

on:
push:
branches:
- 'main'
tags:
- '*'
pull_request:

jobs:
docker-build:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/[email protected]
-
name: Docker meta
id: docker_meta
uses: crazy-max/[email protected]
with:
images: ghcr.io/${{ github.repository }}
-
name: Set up QEMU
uses: docker/[email protected]
-
name: Set up Docker Buildx
uses: docker/[email protected]
-
name: Cache Docker layers
uses: actions/[email protected]
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
-
name: Login to GitHub Container Registry
uses: docker/[email protected]
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push
uses: docker/[email protected]
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
18 changes: 18 additions & 0 deletions .github/workflows/docker.lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Docker lint

on:
push:
branches:
- 'main'
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: lint
uses: hadolint/[email protected]
with:
dockerfile: Dockerfile
136 changes: 136 additions & 0 deletions .github/workflows/github.prs.combine.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# From https://github.com/testcontainers/testcontainers-java/blob/master/.github/workflows/combine-prs.yml
name: 'Combine PRs'

# Controls when the action will run - in this case triggered manually
on:
workflow_dispatch:
inputs:
branchPrefix:
description: 'Branch prefix to find combinable PRs based on'
required: true
default: 'dependabot'
mustBeGreen:
description: 'Only combine PRs that are green (status is success)'
required: true
default: 'true'
combineBranchName:
description: 'Name of the branch to combine PRs into'
required: true
default: 'combine-prs-branch'
ignoreLabel:
description: 'Exclude PRs with this label'
required: true
default: 'nocombine'

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "combine-prs"
combine-prs:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/github-script@v5
id: fetch-branch-names
name: Fetch branch names
with:
github-token: ${{secrets.GH_TOKEN_PLUSW}}
script: |
const pulls = await github.paginate('GET /repos/:owner/:repo/pulls', {
owner: context.repo.owner,
repo: context.repo.repo
});
branches = [];
prs = [];
base_branch = null;
for (const pull of pulls) {
const branch = pull['head']['ref'];
console.log('Pull for branch: ' + branch);
if (branch.startsWith('${{ github.event.inputs.branchPrefix }}')) {
console.log('Branch matched: ' + branch);
statusOK = true;
if(${{ github.event.inputs.mustBeGreen }}) {
console.log('Checking green status: ' + branch);
const checkRuns = await github.request('GET /repos/{owner}/{repo}/commits/{ref}/check-runs', {
owner: context.repo.owner,
repo: context.repo.repo,
ref: branch
});
for await (const cr of checkRuns.data.check_runs) {
console.log('Validating check conclusion: ' + cr.conclusion);
if(cr.conclusion != 'success') {
console.log('Discarding ' + branch + ' with check conclusion ' + cr.conclusion);
statusOK = false;
}
}
}
console.log('Checking labels: ' + branch);
const labels = pull['labels'];
for(const label of labels) {
const labelName = label['name'];
console.log('Checking label: ' + labelName);
if(labelName == '${{ github.event.inputs.ignoreLabel }}') {
console.log('Discarding ' + branch + ' with label ' + labelName);
statusOK = false;
}
}
if (statusOK) {
console.log('Adding branch to array: ' + branch);
branches.push(branch);
prs.push('#' + pull['number'] + ' ' + pull['title']);
base_branch = pull['base']['ref'];
}
}
}
if (branches.length == 0) {
core.setFailed('No PRs/branches matched criteria');
return;
}
core.setOutput('base-branch', base_branch);
core.setOutput('prs-string', prs.join('\n'));
combined = branches.join(' ')
console.log('Combined: ' + combined);
return combined
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/[email protected]
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN_PLUSW }}
# Creates a branch with other PR branches merged together
- name: Created combined branch
env:
BASE_BRANCH: ${{ steps.fetch-branch-names.outputs.base-branch }}
BRANCHES_TO_COMBINE: ${{ steps.fetch-branch-names.outputs.result }}
COMBINE_BRANCH_NAME: ${{ github.event.inputs.combineBranchName }}
run: |
echo "$BRANCHES_TO_COMBINE"
sourcebranches="${BRANCHES_TO_COMBINE%\"}"
sourcebranches="${sourcebranches#\"}"
basebranch="${BASE_BRANCH%\"}"
basebranch="${basebranch#\"}"
git config pull.rebase false
git config user.name github-actions
git config user.email [email protected]
git branch $COMBINE_BRANCH_NAME $basebranch
git checkout $COMBINE_BRANCH_NAME
git pull origin $sourcebranches --no-edit
git push origin $COMBINE_BRANCH_NAME --force-with-lease
# Creates a PR with the new combined branch
- uses: actions/github-script@v5
name: Create Combined Pull Request
env:
PRS_STRING: ${{ steps.fetch-branch-names.outputs.prs-string }}
with:
github-token: ${{secrets.GH_TOKEN_PLUSW}}
script: |
const prString = process.env.PRS_STRING;
const body = 'This PR was created by the Combine PRs action by combining the following PRs:\n' + prString;
await github.pulls.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: 'Combined PR for prefix: ${{ github.event.inputs.branchPrefix }}',
head: '${{ github.event.inputs.combineBranchName }}',
base: '${{ steps.fetch-branch-names.outputs.base-branch }}',
body: body
});
58 changes: 58 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# WBStack queryservice-ui

## 1.4

Feburary 2022 updates from upstream.
Security patches.
Includes hotfix until upstream [bug](https://phabricator.wikimedia.org/T301255) is resolved

## 1.3

June 2021 updates from upstream.

## 1.2

January 2021 updates from upstream.

## 1.1

December 2020 updates from upstream. [PR](https://github.com/wbstack/queryservice-ui/pull/1)

## 1.0

Github Build (first)

## May 2020

- 0.26 - Build: remove more non modified files from wbstack git (pt2)
- 0.25 - git pull, (2 may 2020)
- 0.21 - Build: without having all code files in wbstack git

## April 2029

- 0.20 - git pull, (17 April 2020)
- 0.19 - git pull, (5 April 2020)

## December 2019

- 0.18 - git pull, should fix https://github.com/addshore/wbstack/issues/32 ([edit] in examples)

## November 2019

- 0.17 - 2x XSS fixes
- 0.16 - Help examples link fix / rewrite on load
- 0.15 - Examples button
- 0.14 - Tidy up after security fix
- 0.13 - SECURITY fix - https://phabricator.wikimedia.org/T233213 (XSS in math)

## October 2019

- 0.12 - THURSDAY, tiny fix to title
- 0.11 - THURSDAY, fix config generation (missing first /)
- 0.10 - Wednesday before Wikidatacon
- 0.6 - Better dev localhost stuff
- 0.5 - Don't try to get last updated time (it wont work)
- 0.4 - Also allow sparql and wikibase config for localhost development
- 0.3 - CSS hacks to make the UI smaller and remove wikidata things
- 0.2 - sparql and wikibase API based on request host
- 0.1 - Initial version.
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM node:12 as builder

WORKDIR /src/app

COPY package.json package-lock.json ./

# TODO remove the --force from the install...
RUN npm install --force && npm cache clean --force

COPY . .

RUN npm run-script build


FROM nginx:1-alpine
LABEL org.opencontainers.image.source="https://github.com/wbstack/queryservice-ui"


COPY ./docker/default.conf /etc/nginx/conf.d/default.conf
COPY --from=builder --chown=nginx:nginx /src/app/build /usr/share/nginx/html
10 changes: 10 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: "3.7"
services:
debug:
image: node:12-alpine
working_dir: /home/node/app
command: npm start
volumes:
- ./src:/home/node/app
expose:
- "8080"
35 changes: 35 additions & 0 deletions docker/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name localhost;
charset utf-8;

# files transfer
client_body_in_file_only clean;
client_body_buffer_size 32K;
client_max_body_size 1026g;
sendfile on;
send_timeout 300s;

# redirect server error pages / and set response status to 200 / ok
#error_page 404 =200 /;

root /usr/share/nginx/html;
index index.html index.html;

# Always serve index.html for any request
# location / {
# root /usr/share/nginx/html;
# try_files $uri /index.html;
# }

# deny access to .htaccess files, if Apache's document root concurs with nginx's one
location ~ /\.ht {
deny all;
}

# deny access to hidden files (beginning with a period)
location ~ /\. {
access_log off; log_not_found off; deny all;
}
}
9 changes: 9 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,14 @@ <h5 class="modal-title" id="keyboardShortcutHelpModalLabel" data-i18n="wdqs-dial
</div>
</div>

<!-- Query Builder Discovery feedback banner -->
<div id="query-builder-discovery-feedback">
We want to make querying Wikidata easier.
<a href="https://www.wikidata.org/wiki/Wikidata:Improve_the_workflows_for_queries_and_lists/Simple_query_Builder" target="_blank">Give us your feedback on our suggestions</a>
(Opens in new tab)
<button type="button" class="close" aria-label="Close"><span aria-hidden="true">&times;</span></button>
</div>

<!-- JS files -->
<!-- build:js js/vendor.min.js -->
<script src="node_modules/jquery/dist/jquery.js"></script>
Expand Down Expand Up @@ -551,6 +559,7 @@ <h5 class="modal-title" id="keyboardShortcutHelpModalLabel" data-i18n="wdqs-dial
<script src="wikibase/queryService/RdfNamespaces.js"></script>
<script src="wikibase/queryService/ui/Banner.js"></script>
<script src="wikibase/init.js"></script>
<script src="wikibase/feedbackBannerInit.js"></script>
<!-- endbuild -->

</body>
Expand Down
Loading