diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 47059c26..15483610 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,27 +1,42 @@
stages:
- analysis
- build
+ - package
- deploy
-# Cache modules in between jobs
-cache:
- key: ${CI_COMMIT_REF_SLUG}
- paths:
- - node_modules/
+# Re-usable block to install (and cache) Poetry and openflexure-microscope-server
+.poetry-install-template: &poetry-install
+ before_script:
+ - curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
+ - source $HOME/.poetry/env
+ - poetry config virtualenvs.in-project true
+ - poetry install -vv
+ cache:
+ key: "${CI_COMMIT_REF_SLUG}"
+ paths:
+ - .cache/pip
+ - .venv
+# Re-usable block to install (and cache) openflexure-microscope-server static app
+.node-install-template: &node-install
+ before_script:
+ - cd openflexure_microscope/api/static/
+ - npm install
+ cache:
+ key: "${CI_COMMIT_REF_SLUG}"
+ paths:
+ - openflexure_microscope/api/static/node_modules
+
+# Python static analysis with PyLint
pylint:
stage: analysis
image: python:3.7
retry: 1
- before_script:
- - curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
+ <<: *poetry-install
script:
- # Install server
- - $HOME/.poetry/bin/poetry install
- # Run static build script
- - $HOME/.poetry/bin/poetry run pylint ./openflexure_microscope/
+ - poetry run pylint ./openflexure_microscope/
only:
- branches
@@ -29,19 +44,17 @@ pylint:
- tags
- web
+# Python style analysis with Black
black:
stage: analysis
image: python:3.7
retry: 1
- before_script:
- - curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
+ <<: *poetry-install
script:
- # Install server
- - $HOME/.poetry/bin/poetry install
# Run static build script
- - $HOME/.poetry/bin/poetry run black --check .
+ - poetry run black --check .
only:
- branches
@@ -49,19 +62,53 @@ black:
- tags
- web
-# Electron app build
-build:
- stage: build
- image: nikolaik/python-nodejs:python3.7-nodejs14
+# JavaScript linting with ESLint (via Vue CLI)
+eslint:
+ stage: analysis
+ image: node:15
- before_script:
- - curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
+ <<: *node-install
+
+ script:
+ # Build JS application for production
+ - npm run lint
+
+ only:
+ - merge_requests
+ - tags
+ - web
+
+# Build JS app
+build:
+ stage: build
+ image: node:15
+
+ <<: *node-install
+
+ script:
+ # Build JS application for production
+ - npm run build
+
+ artifacts:
+ name: "dist"
+ expire_in: 1 week
+ paths:
+ - "./openflexure_microscope/api/static/dist/"
+
+ only:
+ - merge_requests
+ - tags
+ - web
+
+# Package application into distribution tarball
+package:
+ stage: package
+ dependencies:
+ - build
+
+ image: ubuntu:latest
script:
- # Install server
- - $HOME/.poetry/bin/poetry install
- # Run static build script
- - $HOME/.poetry/bin/poetry run build_static
# Build distribution archive
- mkdir -p dist
- tar -c --exclude-vcs --exclude-from .tarignore -vzf dist/openflexure-microscope-server-${CI_COMMIT_REF_NAME}.tar.gz .
@@ -72,7 +119,8 @@ build:
name: "dist"
expire_in: 1 week
paths:
- - "./dist/*"
+ - "./dist/openflexure-microscope-server-${CI_COMMIT_REF_NAME}.tar.gz"
+ - "./dist/openflexure-microscope-server-${CI_COMMIT_REF_NAME}.tar.gz.sha256"
only:
- merge_requests
@@ -83,7 +131,8 @@ build:
deploy:
stage: deploy
dependencies:
- - build
+ - package
+
image: ubuntu:latest
before_script:
diff --git a/.tarignore b/.tarignore
index ad462e28..66a3d39a 100644
--- a/.tarignore
+++ b/.tarignore
@@ -1,10 +1,12 @@
-Distribution archive rules
node_modules
.gitlab-ci.yml
-.gitlab/
+.gitlab
./dist
!openflexure_microscope/api/static/dist
+# VCS files
+.pre-commit-config.yaml
+
# Pyenv files
.python-version
.venv*
diff --git a/openflexure_microscope/api/static/.eslintrc.js b/openflexure_microscope/api/static/.eslintrc.js
index e7ec7f8b..a75de351 100644
--- a/openflexure_microscope/api/static/.eslintrc.js
+++ b/openflexure_microscope/api/static/.eslintrc.js
@@ -5,26 +5,14 @@ module.exports = {
node: true
},
- extends: [
- "plugin:vue/recommended",
- "eslint:recommended",
- "prettier/vue",
- "plugin:prettier/recommended",
- "plugin:vue/essential",
- "@vue/prettier"
- ],
+ parserOptions: {
+ parser: "babel-eslint"
+ },
rules: {
- "vue/component-name-in-template-casing": ["error", "PascalCase"],
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off"
},
- globals: {
- $nuxt: true
- },
-
- parserOptions: {
- parser: "babel-eslint"
- }
+ extends: ["plugin:vue/recommended", "eslint:recommended", "@vue/prettier"]
};
diff --git a/openflexure_microscope/api/static/CONTRIBUTING.md b/openflexure_microscope/api/static/CONTRIBUTING.md
index 42d43a66..7ca2832b 100644
--- a/openflexure_microscope/api/static/CONTRIBUTING.md
+++ b/openflexure_microscope/api/static/CONTRIBUTING.md
@@ -17,7 +17,7 @@ Please note we have a working flow, and a code of conduct. Please follow it in a
* Once we've merged a few things in and want to make a release, we tag it on master.
* Not every commit on master will get a tag, we'll accumulate a few changes before making a release, unless there's a reason to release straight away.
-* Once we're confident that the tagged release is building and stable, we merge it into the stable branch.
+* Once the tagged release passes checks, it is deployed to the build server.
## Code of Conduct
diff --git a/openflexure_microscope/api/static/package-lock.json b/openflexure_microscope/api/static/package-lock.json
index d40891cb..f4abe921 100644
--- a/openflexure_microscope/api/static/package-lock.json
+++ b/openflexure_microscope/api/static/package-lock.json
@@ -2613,12 +2613,12 @@
}
},
"@vue/cli-plugin-eslint": {
- "version": "4.5.8",
- "resolved": "https://registry.npmjs.org/@vue/cli-plugin-eslint/-/cli-plugin-eslint-4.5.8.tgz",
- "integrity": "sha512-1lg3K2D/harXbN4FvRoA1b0X9947H+G4Ql/43rxJY39OqswfK/d1ck438Fo9M4l1+zhBSUNDmcjn7Q2EH6qWmA==",
+ "version": "4.5.9",
+ "resolved": "https://registry.npmjs.org/@vue/cli-plugin-eslint/-/cli-plugin-eslint-4.5.9.tgz",
+ "integrity": "sha512-wTsWRiRWPW5ik4bgtlh4P4h63Zgjsyvqx2FY0kcj+bSAnQGPJ3bKUOMU9KQP5EyNH6pAXMVGh2LEXK9WwJMf1w==",
"dev": true,
"requires": {
- "@vue/cli-shared-utils": "^4.5.8",
+ "@vue/cli-shared-utils": "^4.5.9",
"eslint-loader": "^2.2.1",
"globby": "^9.2.0",
"inquirer": "^7.1.0",
@@ -2627,9 +2627,9 @@
},
"dependencies": {
"@vue/cli-shared-utils": {
- "version": "4.5.8",
- "resolved": "https://registry.npmjs.org/@vue/cli-shared-utils/-/cli-shared-utils-4.5.8.tgz",
- "integrity": "sha512-pa6oenhBO/5HeDLRSokiwVN01gROACEDy3ESXWuPmragOREGNmmFKtkPHlqeYavGEX6LFp7f0VK3uMX6UYS5mQ==",
+ "version": "4.5.9",
+ "resolved": "https://registry.npmjs.org/@vue/cli-shared-utils/-/cli-shared-utils-4.5.9.tgz",
+ "integrity": "sha512-anvsrv+rkQC+hgxaT2nQQxnSWSsIzyysZ36LO7qPjXvDRBvcvKLAAviFlUkYbZ+ntbV8puzJ3zw+gUhQw4SEVA==",
"dev": true,
"requires": {
"@hapi/joi": "^15.0.1",
@@ -13760,9 +13760,9 @@
}
},
"vue-loader-v16": {
- "version": "npm:vue-loader@16.0.0-rc.1",
- "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.0.0-rc.1.tgz",
- "integrity": "sha512-yR+BS90EOXTNieasf8ce9J3TFCpm2DGqoqdbtiwQ33hon3FyIznLX7sKavAq1VmfBnOeV6It0Htg4aniv8ph1g==",
+ "version": "npm:vue-loader@16.0.0-rc.2",
+ "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.0.0-rc.2.tgz",
+ "integrity": "sha512-cz8GK4dgIf1UTC+do80pGvh8BHcCRHLIQVHV9ONVQ8wtoqS9t/+H02rKcQP+TVNg7khgLyQV2+8eHUq7/AFq3g==",
"dev": true,
"optional": true,
"requires": {
@@ -13862,12 +13862,6 @@
"resolved": "https://registry.npmjs.org/vue-observe-visibility/-/vue-observe-visibility-0.4.6.tgz",
"integrity": "sha512-xo0CEVdkjSjhJoDdLSvoZoQrw/H2BlzB5jrCBKGZNXN2zdZgMuZ9BKrxXDjNP2AxlcCoKc8OahI3F3r3JGLv2Q=="
},
- "vue-plugin-load-script": {
- "version": "1.3.2",
- "resolved": "https://registry.npmjs.org/vue-plugin-load-script/-/vue-plugin-load-script-1.3.2.tgz",
- "integrity": "sha512-UQcFanuWBf72/339LxgsPZbMsT5LKUjBzkQfV3xf4ni5fc6Nnx5GNYclODFaQ9FHtOjWhu423bhHrlBHz4MIFg==",
- "dev": true
- },
"vue-style-loader": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/vue-style-loader/-/vue-style-loader-4.1.2.tgz",
diff --git a/openflexure_microscope/api/static/package.json b/openflexure_microscope/api/static/package.json
index 3e8d753d..8e2a5f33 100644
--- a/openflexure_microscope/api/static/package.json
+++ b/openflexure_microscope/api/static/package.json
@@ -8,7 +8,7 @@
"serve": "vue-cli-service serve --mode development",
"build": "vue-cli-service build --mode production",
"lint": "vue-cli-service lint",
- "prettier": "vue-cli-service lint --fix"
+ "lint:fix": "vue-cli-service lint --fix"
},
"dependencies": {
"material-design-icons": "^3.0.1",
@@ -17,14 +17,13 @@
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.12.1",
- "@vue/cli-plugin-eslint": "^4.5.8",
+ "@vue/cli-plugin-eslint": "^4.5.9",
"@vue/cli-service": "^4.5.8",
"@vue/eslint-config-prettier": "^6.0.0",
"axios": "^0.19.2",
"babel-eslint": "^10.1.0",
"css-loader": "^3.6.0",
"eslint": "^6.8.0",
- "eslint-config-prettier": "^6.15.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-vue": "^6.2.2",
"less": "^3.12.2",
@@ -34,7 +33,6 @@
"uikit": "^3.5.9",
"vue": "^2.6.12",
"vue-friendly-iframe": "^0.17.0",
- "vue-plugin-load-script": "^1.3.2",
"vue-template-compiler": "^2.6.12",
"vue-tour": "^1.5.0",
"vuejs-paginate": "^2.1.0",
diff --git a/openflexure_microscope/api/static/src/App.vue b/openflexure_microscope/api/static/src/App.vue
index 320b0384..26165824 100644
--- a/openflexure_microscope/api/static/src/App.vue
+++ b/openflexure_microscope/api/static/src/App.vue
@@ -102,9 +102,9 @@ export default {
},
handleTheme: function() {
var isDark = false;
- if (this.$store.state.globalSettings.appTheme == "dark") {
+ if (this.$store.state.appTheme == "dark") {
isDark = true;
- } else if (this.$store.state.globalSettings.appTheme == "system") {
+ } else if (this.$store.state.appTheme == "system") {
if (this.systemDark) {
isDark = true;
}
@@ -199,15 +199,13 @@ export default {
(state, getters) => {
return getters.uriV2;
},
- uriV2 => {
+ () => {
this.checkConnection();
- console.log(uriV2);
}
);
// Keyboard shortcuts
Mousetrap.bind("?", () => {
- console.log(this.keyboardManual);
this.toggleModalElement(this.$refs["keyboardManualModal"]); // Calls the mixin
});
@@ -290,7 +288,6 @@ export default {
// Remove origin watcher
this.unwatchOriginFunction();
// Remove key listeners
- console.log("Resetting Mousetrap");
Mousetrap.reset();
},
@@ -313,7 +310,6 @@ export default {
},
handleExit: function() {
- console.log("Triggered beforeunload");
this.$root.$emit("globalTogglePreview", false);
},
diff --git a/openflexure_microscope/api/static/src/assets/less/app.less b/openflexure_microscope/api/static/src/assets/less/app.less
deleted file mode 100644
index f762eda0..00000000
--- a/openflexure_microscope/api/static/src/assets/less/app.less
+++ /dev/null
@@ -1,18 +0,0 @@
-// Theming specific to the electron app
-
-.menubar-menu-container {
- box-shadow: 0.5px 1px 4px 0px rgba(0, 0, 0, 0.3) !important;
-}
-
-.menubar-menu-container>* {
- box-shadow: none !important;
-}
-
-.menubar-menu-container .action-menu-item,
-.menubar-menu-container .action-label {
- cursor: default
-}
-
-.menubar-menu-container a:hover {
- text-decoration: none;
-}
\ No newline at end of file
diff --git a/openflexure_microscope/api/static/src/assets/less/theme.less b/openflexure_microscope/api/static/src/assets/less/theme.less
index 9c96d036..54a22eef 100644
--- a/openflexure_microscope/api/static/src/assets/less/theme.less
+++ b/openflexure_microscope/api/static/src/assets/less/theme.less
@@ -4,9 +4,6 @@
// Highlight.js
@import "./highlight.less";
-// Electron app theming
-@import "./app.less";
-
// Custom OpenFlexure theming
//
diff --git a/openflexure_microscope/api/static/src/components/appContent.vue b/openflexure_microscope/api/static/src/components/appContent.vue
index 6410db42..cd084c63 100644
--- a/openflexure_microscope/api/static/src/components/appContent.vue
+++ b/openflexure_microscope/api/static/src/components/appContent.vue
@@ -214,7 +214,7 @@ export default {
computed: {
enabledTopTabs: function() {
var enabledTabs = this.topTabs;
- if (this.$store.state.globalSettings.IHIEnabled) {
+ if (this.$store.state.IHIEnabled) {
enabledTabs.push({
id: "slidescan",
icon: "settings_overscan",
@@ -230,7 +230,6 @@ export default {
pluginsGuiList: function() {
// List of plugin GUIs, obtained from this.plugins values
- console.log("Recalculating plugins");
var pluginGuis = [];
for (let plugin of Object.values(this.plugins)) {
if (plugin.meta.gui) {
@@ -267,9 +266,9 @@ export default {
window.location.hostname
)
) {
- this.$store.commit("changeSetting", ["disableStream", true]);
- this.$store.commit("changeSetting", ["autoGpuPreview", true]);
- this.$store.commit("changeSetting", ["trackWindow", true]);
+ this.$store.commit("changeDisableStream", true);
+ this.$store.commit("changeAutoGpuPreview", true);
+ this.$store.commit("changeTrackWindow", true);
}
// Update plugins
this.updatePlugins().then(() => {
@@ -304,11 +303,9 @@ export default {
methods: {
updatePlugins: function() {
- console.log("Updating plugin forms");
return axios
.get(this.pluginsUri)
.then(response => {
- console.log(response);
this.plugins = response.data;
})
.catch(error => {
@@ -333,8 +330,6 @@ export default {
},
enterApp: function() {
// Stuff to do once connected and all init modals are finished
- console.log("Entering main application");
- //this.currentTab = "view";
}
}
};
diff --git a/openflexure_microscope/api/static/src/components/fieldComponents/keyvalList.vue b/openflexure_microscope/api/static/src/components/fieldComponents/keyvalList.vue
index ed884a4a..4d7743a4 100644
--- a/openflexure_microscope/api/static/src/components/fieldComponents/keyvalList.vue
+++ b/openflexure_microscope/api/static/src/components/fieldComponents/keyvalList.vue
@@ -111,11 +111,6 @@ export default {
this.$delete(newSelected, key);
this.$emit("input", newSelected);
- },
-
- modifyValue: function(e, v) {
- console.log(e);
- console.log(v);
}
}
};
diff --git a/openflexure_microscope/api/static/src/components/genericComponents/taskSubmitter.vue b/openflexure_microscope/api/static/src/components/genericComponents/taskSubmitter.vue
index 9f80e3bf..cb11e22a 100644
--- a/openflexure_microscope/api/static/src/components/genericComponents/taskSubmitter.vue
+++ b/openflexure_microscope/api/static/src/components/genericComponents/taskSubmitter.vue
@@ -138,7 +138,6 @@ export default {
checkExistingTasks: function() {
axios.get(this.submitUrl).then(response => {
- console.log(response.data);
for (const task of response.data) {
if (task.status == "pending" || task.status == "running") {
this.taskStarted = true;
@@ -165,10 +164,10 @@ export default {
startTask: function() {
// Starts a new Action task
- console.log("Task start clicked");
+
this.$emit("submit", this.submitData);
// Send a request to start a task
- console.log("Submitting to ", this.submitUrl);
+
this.taskStarted = true;
this.$emit("taskStarted", this.taskId);
axios
@@ -191,7 +190,7 @@ export default {
this.pollTask(this.taskId, this.pollInterval)
.then(response => {
// Do something with the final response
- console.log("Emitting onResponse: ", response);
+
this.$emit("response", response);
this.$emit("finished");
})
@@ -199,12 +198,11 @@ export default {
if (!error) {
error = Error("Unknown error");
}
- console.log("Emitting onError: ", error);
+
this.$emit("error", error);
this.$emit("finished");
})
.finally(() => {
- console.log("Cleaning up after task.");
// Reset taskRunning and taskId
this.taskRunning = false;
this.taskStarted = false;
@@ -223,7 +221,6 @@ export default {
var checkCondition = (resolve, reject) => {
// If the condition is met, we're done!
axios.get(this.taskUrl).then(response => {
- console.log(response.data.status);
var result = response.data.status;
// If the task ends with success
if (result == "completed") {
@@ -232,13 +229,13 @@ export default {
// If task ends with an error
else if (result == "error") {
// Pass the error string back with reject
- console.log("Rejecting pollTask due to error");
+
reject(new Error(response.data.output));
}
// If task ends with termination
else if (result == "cancelled") {
// Pass a generic termination error back with reject
- console.log("Rejecting pollTask due to cancellation");
+
reject(new Error("Task cancelled"));
} else {
// Since the task is still running, we can update the progress bar
@@ -253,19 +250,13 @@ export default {
},
pollProgress: function() {
- console.log("Starting progress polling");
-
axios.get(this.taskUrl).then(response => {
- console.log("PROGRESS RESPONSE: ", response.data.progress);
this.progress = response.data.progress;
});
},
terminateTask: function() {
- console.log("Terminating task...");
- axios.delete(this.taskUrl).then(response => {
- console.log("TERMINATION RESPONSE: ", response.data);
- });
+ axios.delete(this.taskUrl);
}
}
};
diff --git a/openflexure_microscope/api/static/src/components/modalComponents/calibrationModal.vue b/openflexure_microscope/api/static/src/components/modalComponents/calibrationModal.vue
index feda2acb..fab205bf 100644
--- a/openflexure_microscope/api/static/src/components/modalComponents/calibrationModal.vue
+++ b/openflexure_microscope/api/static/src/components/modalComponents/calibrationModal.vue
@@ -265,7 +265,6 @@ export default {
},
onHide: function() {
- console.log("UIKit modal hidden");
this.$emit("onClose");
},
diff --git a/openflexure_microscope/api/static/src/components/pluginComponents/JsonForm.vue b/openflexure_microscope/api/static/src/components/pluginComponents/JsonForm.vue
index d53e9eb1..18a495ee 100644
--- a/openflexure_microscope/api/static/src/components/pluginComponents/JsonForm.vue
+++ b/openflexure_microscope/api/static/src/components/pluginComponents/JsonForm.vue
@@ -201,8 +201,6 @@ export default {
},
updateForm() {
- // Trigger a plugin form update
- console.log("Emitting reloadForms");
this.$emit("reloadForms");
},
@@ -214,14 +212,10 @@ export default {
},
newQuickRequest: function(params) {
- console.log(this.submitApiUri);
- console.log(params);
// Send a quick request
axios
.post(this.submitApiUri, params)
- .then(response => {
- // Do something with the response
- console.log(response);
+ .then(() => {
// Do all the finished request stuff
this.onSubmissionCompleted();
})
@@ -232,8 +226,7 @@ export default {
onTaskSubmit: function() {},
- onTaskResponse: function(responseData) {
- console.log("Task finished with response data: ", responseData);
+ onTaskResponse: function() {
// Do all the finished request stuff
this.onSubmissionCompleted();
},
diff --git a/openflexure_microscope/api/static/src/components/pluginComponents/WebComponentLoader.vue b/openflexure_microscope/api/static/src/components/pluginComponents/WebComponentLoader.vue
deleted file mode 100644
index 810a73af..00000000
--- a/openflexure_microscope/api/static/src/components/pluginComponents/WebComponentLoader.vue
+++ /dev/null
@@ -1,61 +0,0 @@
-
-