Skip to content

Commit

Permalink
Merge pull request #401 from mieweb/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
wreiske authored Jan 12, 2024
2 parents b79298d + 1912dc5 commit 03e36b5
Show file tree
Hide file tree
Showing 51 changed files with 1,438 additions and 983 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/DevelopServerDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
- run: sudo apt-get update
- run: sudo apt-get install -y libkrb5-dev

- name: Use Node.js 18.x
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20
cache: npm

- name: Install node_modules
Expand All @@ -36,10 +36,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Use Node.js 18.x
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20
cache: npm

- name: Build action runner
Expand Down Expand Up @@ -73,8 +73,8 @@ jobs:
docker run -d --name wikigdrive-develop \
--restart unless-stopped \
-v wikiGDriveDevelop:/data \
-v /home/githubactions/wikigdrive/service_account.json:/service_account.json \
-v /home/githubactions/wikigdrive/env.develop:/usr/src/app/.env \
-v /home/wikigdrive/service_account.json:/service_account.json \
-v /home/wikigdrive/env.develop:/usr/src/app/.env \
-v /var/run/docker.sock:/var/run/docker.sock \
-v "/var/www/dev.wikigdrive.com:/usr/src/app/dist/hugo" \
-e "GIT_SHA=${GITHUB_SHA}" \
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ProdServerDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
- run: sudo apt-get update
- run: sudo apt-get install -y libkrb5-dev

- name: Use Node.js 18.x
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20
cache: npm

- name: Install node_modules
Expand All @@ -37,10 +37,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Use Node.js 18.x
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20
cache: npm

- name: Build action runner
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
- run: sudo apt-get update
- run: sudo apt-get install -y libkrb5-dev

- name: Use Node.js 18.x
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20
cache: npm

- name: Install node_modules
Expand All @@ -35,20 +35,23 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Use Node.js 18.x
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20
cache: npm

- name: Build action runner
run: docker build -t "wgd-action-runner:test" --build-arg "GIT_SHA=${GITHUB_SHA}" apps/wgd-action-runner

- name: Build hugo docs
run: |
docker run \
-v "${GITHUB_WORKSPACE}/hugo:/site" \
-v "${GITHUB_WORKSPACE}/website:/website" \
-v "/var/www/test.wikigdrive.com:/dist/hugo" \
--env CONFIG_TOML="/site/config/_default/config.toml" --env BASE_URL="https://test.wikigdrive.com" \
wgd-action-runner:develop /steps/step_render_hugo
wgd-action-runner:test /steps/step_render_hugo
- name: Copy index for vite
run: mkdir -p dist/hugo && cp -rf /var/www/test.wikigdrive.com/* dist/hugo
Expand All @@ -65,4 +68,4 @@ jobs:
continue-on-error: true

- name: Start
run: docker run -t -v wikiGDriveExample:/data -v /home/githubactions/wikigdrive/service_account.json:/service_account.json -v "/var/www/dev.wikigdrive.com:/usr/src/app/dist/hugo" wikigdrive-test wikigdrive --service_account /service_account.json --share_email mie-docs-wikigdrive@wikigdrive.iam.gserviceaccount.com --workdir /data pull 0AIkOKXbzWCtSUk9PVA
run: docker run -t -v wikiGDriveExample:/data -v /home/wikigdrive/service_account.json:/service_account.json -v "/var/www/dev.wikigdrive.com:/usr/src/app/dist/hugo" wikigdrive-test wikigdrive --service_account /service_account.json --share_email mie-docs-wikigdrive@wikigdrive.iam.gserviceaccount.com --workdir /data pull 0AIkOKXbzWCtSUk9PVA
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.12.1
20.10.0
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18-alpine
FROM node:20-alpine

RUN apk add --no-cache bash openssh-keygen git-lfs openssh-client
WORKDIR /usr/src/app
Expand Down
50 changes: 23 additions & 27 deletions apps/ui/src/components/ChangesViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
Jobs
</div>
<div class="card-body">

<div class="row py-1 align-items-center" v-if="last_job.dateStr">
<div class="col-8">
<span v-if="last_job.kind === 'full'" class="fw-bold">Last full sync </span>
Expand All @@ -64,40 +63,26 @@
</div>
</div>

<table class="table table-bordered jobs-list mt-3" v-if="active_jobs.length > 0">
<table class="table table-bordered jobs-list mt-3">
<thead>
<th>Job</th>
<th>Progress</th>
<tr>
<th>Job</th>
<th>Started</th>
<th>Finished</th>
</tr>
</thead>
<tbody>
<tr v-for="(job, idx) of active_jobs" :key="idx" class="jobs-list__item" :class="{ active: 'running' === job.state }">

<tbody v-if="active_jobs_reverse.length > 0">
<tr v-for="(job, idx) of active_jobs_reverse" :key="idx" class="jobs-list__item" :class="{ active: 'running' === job.state }">
<td>{{ job.title }}</td>
<td>{{ job.startedStr || job.state }}</td>
<td>
<span v-if="job.progress && job.progress.total > job.progress.completed">&nbsp;{{ job.progress.completed }} / {{ job.progress.total }}</span>
<span v-else>{{ job.state }}</span>
<a v-if="job.id && job.started" class="btn float-end" :href="'#drive_logs:job-' + job.id" @click.prevent="showLogs(job)">Logs</a>
</td>
</tr>
</tbody>
</table>

<div v-if="active_jobs.length === 0" class="mt-3">
No active jobs
</div>

</div>
</div>

<div class="card mt-3" v-if="archive.length > 0">
<div class="card-header">
Jobs done
</div>
<div class="card-body">
<table class="table table-bordered jobs-list mt-3">
<thead>
<th>Job</th>
<th>Started</th>
<th>Finished</th>
</thead>
<tbody>
<tr v-for="(job, idx) of archive" :key="idx" class="jobs-list__item" :class="{ active: 'running' === job.state, 'text-danger': 'failed' === job.state, 'text-warning': job.progress && job.progress.warnings > 0 }">
<td>{{ job.title }}</td>
Expand All @@ -111,7 +96,6 @@
</tbody>
</table>
</div>

</div>

</div>
Expand All @@ -133,6 +117,18 @@ export default {
},
components: {StatusToolBar},
computed: {
active_jobs_reverse() {
return [].concat(this.active_jobs)
.map(a => {
return {
...a,
finishedStr: a.finished ? new Date(a.finished).toISOString() : undefined,
startedStr: a.started ? new Date(a.started).toISOString() : undefined,
durationStr: a.started && a.finished ? Math.round((+new Date(a.finished) - +new Date(a.started)) / 100)/10 + 's' : undefined
};
})
.reverse();
},
fileChanges() {
return this.changes.filter(change => change.mimeType !== 'application/vnd.google-apps.folder');
},
Expand Down
36 changes: 31 additions & 5 deletions apps/ui/src/components/JobLogsViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import {UtilsMixin} from './UtilsMixin.ts';
import StatusToolBar from './StatusToolBar.vue';
import {Prism} from './prismFix';
// import {Prism} from './prismFix';
export default {
mixins: [UtilsMixin],
Expand All @@ -36,15 +36,22 @@ export default {
},
contentDir: {
type: String
},
autoRefresh: {
type: Boolean
}
},
data() {
return {
errorsOnly: false,
logs: []
logs: [],
intervalHandle: null
};
},
computed: {
currentJob() {
return this.$root.jobs.find(job => 'job-' + job.id === this.jobId);
},
absPath() {
return '/drive/' + this.driveId + this.contentDir;
},
Expand All @@ -63,13 +70,19 @@ export default {
}
const jobId = this.jobId.substring('job-'.length);
const response = await this.authenticatedClient.fetchApi(`/api/logs/${this.driveId}?order=asc&jobId=` + (jobId));
const response = await this.authenticatedClient.fetchApi(`/api/logs/${this.driveId}?order=asc&jobId=` + (jobId) + '&offset=' + this.logs.length);
const logs = await response.json();
if (this.intervalHandle && this.currentJob && this.currentJob.finished) {
clearInterval(this.intervalHandle);
this.intervalHandle = null;
}
if (logs.length === 0) {
return;
}
this.logs = logs;
this.logs = this.logs.concat(logs);
if (logs.length > 0) {
this.handleScroll();
Expand Down Expand Up @@ -109,7 +122,8 @@ export default {
return new Date(v).toISOString();
},
highLight(str) {
return Prism.highlight(str, Prism.languages.markdown, 'markdown');
return str;
// FIXME: return Prism.highlight(str, Prism.languages.markdown, 'markdown');
},
rewriteLinks() {
const links = this.$el.querySelectorAll('a[data-to-rewrite]');
Expand Down Expand Up @@ -138,6 +152,18 @@ export default {
this.handleScroll();
// Prism.highlightElement(this.$refs.code);
if (!this.intervalHandle && this.currentJob && !this.currentJob.finished) {
this.intervalHandle = setInterval(() => {
this.fetch();
}, 1000);
}
},
beforeUnmount() {
if (!this.intervalHandle) {
return;
}
clearInterval(this.intervalHandle);
this.intervalHandle = null;
}
};
</script>
5 changes: 5 additions & 0 deletions apps/ui/src/components/UserSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@
<label>Config.toml for preview</label>
<CodeEditor v-model="user_config.config_toml" lang="toml" />
</div>

<div class="form-group">
<label>Markdown Links Rewrite Rules</label>
<CodeEditor v-model="user_config.rewrite_rules_yaml" lang="yaml" />
</div>
</form>
<br/>
<button class="btn btn-primary" type="button" @click="save">Save</button>
Expand Down
2 changes: 1 addition & 1 deletion apps/ui/src/components/ZipkinViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default {
data() {
return {
traces: [],
ZIPKIN_URL
ZIPKIN_URL: ZIPKIN_URL.startsWith('http://localhost:9411') ? ZIPKIN_URL + '/zipkin' : ZIPKIN_URL
};
},
created() {
Expand Down
4 changes: 2 additions & 2 deletions apps/ui/src/services/CachedFileClientService.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {FileClientService} from './FileClientService.js';
import {FileClientService} from './FileClientService.ts';

export class CachedFileClientService extends FileClientService {
private cache: any;
private cache: unknown;

constructor(authenticatedClient) {
super(authenticatedClient);
Expand Down
1 change: 1 addition & 0 deletions apps/ui/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"module": "ESNext",
"moduleResolution": "node",
"target": "ESNext",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"sourceMap": true,
Expand Down
Loading

0 comments on commit 03e36b5

Please sign in to comment.