Skip to content

Commit

Permalink
change the location of chaise-config
Browse files Browse the repository at this point in the history
but still keep the old location so deployments don't break. we will remove the old location later.
  • Loading branch information
RFSH committed Nov 7, 2023
1 parent b6dc97b commit b45253e
Show file tree
Hide file tree
Showing 15 changed files with 45 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ module.exports = {
ignorePatterns: [
'common/**/*', 'viewer/**/*', 'lib/**/*', 'styles/**/*',
// we might want to remove the following later:
'test/**/*'
'test/**/*', 'config/*'
]
};
11 changes: 8 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ dist
deployment-config.json
.make-*
index.html
/chaise-config.js
/google-dataset-config.js
viewer/viewer-config.js
sftp-config.json
npm-debug.log
version.txt
Expand All @@ -35,3 +32,11 @@ common/styles/navbar.css

# sass temporary compiled files
.sass-cache

# config files
config/*-config.js

# old config files (should be removed when we deprecated these locations
/chaise-config.js
/google-dataset-config.js
viewer/viewer-config.js
31 changes: 21 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ SOURCE=src

DIST=dist

# where config files are
CONFIG=config

# Shared utilities
COMMON=common

Expand Down Expand Up @@ -272,11 +275,21 @@ $(SASS): $(shell find $(COMMON)/styles/scss/)
@npx sass --style=compressed --embed-source-map --source-map-urls=relative $(COMMON)/styles/scss/app.scss $(COMMON)/styles/app.css
@npx sass --load-path=$(COMMON)/styles/scss/_variables.scss --style=compressed --embed-source-map --source-map-urls=relative $(COMMON)/styles/scss/_navbar.scss $(COMMON)/styles/navbar.css

JS_CONFIG=chaise-config.js
$(JS_CONFIG): chaise-config-sample.js
cp -n chaise-config-sample.js $(JS_CONFIG) || true
# should eventually be removed
DEPRECATED_JS_CONFIG=chaise-config.js

JS_CONFIG_SAMPLE= $(CONFIG)/chaise-config-sample.js
JS_CONFIG=$(CONFIG)/chaise-config.js
$(JS_CONFIG): $(JS_CONFIG_SAMPLE)
cp -n $(CONFIG)/chaise-config-sample.js $(JS_CONFIG) || true
touch $(JS_CONFIG)

VIEWER_CONFIG_SAMPLE=$(CONFIG)/viewer-config-sample.js
VIEWER_CONFIG=$(CONFIG)/viewer-config.js
$(VIEWER_CONFIG): $(VIEWER_CONFIG_SAMPLE)
cp -n $(CONFIG)/viewer-config-sample.js $(VIEWER_CONFIG) || true
touch $(VIEWER_CONFIG)

$(DIST)/$(MAKEFILE_VAR): $(BUILD_VERSION)
$(info - creating makefile_variables.js)
@echo 'var chaiseBuildVariables = {};' > $(DIST)/$(MAKEFILE_VAR)
Expand All @@ -290,7 +303,7 @@ $(DIST)/chaise-dependencies.html: $(BUILD_VERSION)
$(info - creating chaise-dependencies.html)
@> $(DIST)/chaise-dependencies.html
@$(call add_css_link,$(DIST)/chaise-dependencies.html,)
@$(call add_js_script,$(DIST)/chaise-dependencies.html,$(ANGULARJS) $(DIST)/$(SHARED_JS_VENDOR_ASSET_MIN) $(JS_CONFIG) $(DIST)/$(SHARED_JS_SOURCE_MIN))
@$(call add_js_script,$(DIST)/chaise-dependencies.html,$(ANGULARJS) $(DIST)/$(SHARED_JS_VENDOR_ASSET_MIN) $(DEPRECATED_JS_CONFIG) $(JS_CONFIG) $(DIST)/$(SHARED_JS_SOURCE_MIN))
@$(call add_ermrestjs_script,$(DIST)/chaise-dependencies.html)

# list of file and folders that will be sent to the given location
Expand Down Expand Up @@ -329,10 +342,8 @@ WEBPACK_EXTERNAL_VENDOR_FILES= \
# -------------------------- viewer app -------------------------- #
VIEWER_ROOT=viewer

VIEWER_CONFIG=$(VIEWER_ROOT)/viewer-config.js
$(VIEWER_CONFIG): $(VIEWER_ROOT)/viewer-config-sample.js
cp -n $(VIEWER_ROOT)/viewer-config-sample.js $(VIEWER_CONFIG) || true
touch $(VIEWER_CONFIG)
# should eventually be removed
DEPRECATED_VIEWER_CONFIG=$(VIEWER_ROOT)/viewer-config.js

VIEWER_JS_SOURCE=$(VIEWER_ROOT)/viewer.app.js \
$(VIEWER_ROOT)/viewer.controller.js \
Expand Down Expand Up @@ -363,7 +374,7 @@ VIEWER_CSS_SOURCE=$(COMMON)/vendor/MarkdownEditor/styles/bootstrap-markdown.min.
@> .make-viewer-includes
$(info - creating .make-viewer-includes)
@$(call add_css_link, .make-viewer-includes,$(VIEWER_CSS_SOURCE))
@$(call add_js_script, .make-viewer-includes, $(SHARED_JS_VENDOR_BASE) $(DIST)/$(SHARED_JS_VENDOR_ASSET_MIN) $(JS_CONFIG) $(DIST)/$(SHARED_JS_SOURCE_MIN) $(VIEWER_JS_VENDOR_ASSET) $(VIEWER_CONFIG) $(DIST)/$(VIEWER_JS_SOURCE_MIN))
@$(call add_js_script, .make-viewer-includes, $(SHARED_JS_VENDOR_BASE) $(DIST)/$(SHARED_JS_VENDOR_ASSET_MIN) $(DEPRECATED_JS_CONFIG) $(JS_CONFIG) $(DIST)/$(SHARED_JS_SOURCE_MIN) $(VIEWER_JS_VENDOR_ASSET) $(DEPRECATED_VIEWER_CONFIG) $(VIEWER_CONFIG) $(DIST)/$(VIEWER_JS_SOURCE_MIN))
@$(call add_ermrestjs_script,.make-viewer-includes)

viewer/index.html: viewer/index.html.in .make-viewer-includes
Expand Down Expand Up @@ -509,7 +520,7 @@ run-webpack: $(SOURCE) $(BUILD_VERSION)
.PHONY: deploy
deploy: dont_deploy_in_root .make-rsync-list
$(info - deploying the package)
@rsync -ravz --files-from=.make-rsync-list --exclude='$(DIST)/react' --exclude='$(VIEWER_CONFIG)' . $(CHAISEDIR)
@rsync -ravz --files-from=.make-rsync-list --exclude='$(DIST)/react' --exclude='$(DEPRECATED_VIEWER_CONFIG)' . $(CHAISEDIR)
@rsync -avz --exclude='$(REACT_BUNDLES_FOLDERNAME)' $(DIST)/react/ $(CHAISEDIR)
@rsync -avz --delete $(REACT_BUNDLES) $(CHAISEDIR)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions docs/user-docs/chaise-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

**Chaise** uses a set of default configuration parameters. You can overwrite them through the `chaise-config.js` file and/or the search parameters in the URL.

A Chaise deployment includes a sample config file ([chaise-config-sample.js](https://github.com/informatics-isi-edu/chaise/blob/master/chaise-config-sample.js)) at the root directory that you can edit and then rename to `chaise-config.js`.
A Chaise deployment includes a sample config file ([chaise-config-sample.js](https://github.com/informatics-isi-edu/chaise/blob/master/config/chaise-config-sample.js)) at the root directory that you can edit and then rename to `chaise-config.js`.

Each chaise config property below can be defined in each place that we allow for a chaise configuration with a few exceptions noted below. Chaise config uses a set order for determining which chaise configuration's properties will be used. The order that the properties will be checked and then applied are as follows:
1. Default values defined in [chaise configuration document](https://github.com/informatics-isi-edu/chaise/blob/master/docs/user-docs/chaise-config.md).
2. Any properties defined at the root of the object returned from [chaise-config.js](https://github.com/informatics-isi-edu/chaise/blob/master/chaise-config-sample.js).
2. Any properties defined at the root of the object returned from [chaise-config.js](https://github.com/informatics-isi-edu/chaise/blob/master/config/chaise-config-sample.js).
3. Any matching `configRules` in the order they appear in the `configRules` array. Properties in the last matching rule will take precedence
4. Any properties defined at the root of the object returned from the "tag:isrd.isi.edu,2019:chaise-config" annotation.
5. Step 3 from above, but with the `configRules` from the "tag:isrd.isi.edu,2019:chaise-config" annotation.
Expand Down
2 changes: 1 addition & 1 deletion docs/user-docs/google-dataset.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

1. Setup the [annotation](https://github.com/informatics-isi-edu/ermrestjs/blob/master/docs/user-docs/annotation.md#tag-2021-google-dataset) correctly using pattern expansion. ERMrestJS validates the generated JSON-LD and any incorrect attributes are discarded and the rest is appended to the `<head>` tag. Check the browser console for any logs about any issues discovered during the validation of JSON-LD.

2. For more fine grain control of cases where JSON-LD should be added, a config file called [`google-dataset-config.js`](https://github.com/informatics-isi-edu/chaise/blob/master/google-dataset-config-sample.js) is used to specify the cases that should contain the JSON-LD. It can be plugged in similar to chaise-config.js. So you can use the same [`configRules`](chaise-config.md#configrules) property can be used to define different `config`s for each host.
2. For more fine grain control of cases where JSON-LD should be added, a config file called [`google-dataset-config.js`](https://github.com/informatics-isi-edu/chaise/blob/master/config/google-dataset-config-sample.js) is used to specify the cases that should contain the JSON-LD. It can be plugged in similar to chaise-config.js. So you can use the same [`configRules`](chaise-config.md#configrules) property can be used to define different `config`s for each host.

JSON-LD will only be appended when the row in question is in the config (if it exists for the table) and the annotation is setup correctly as well. This is an optional step and if no config file exists then the JSON-LD will still be appended if the annotation is setup correctly. Example below:

Expand Down
4 changes: 2 additions & 2 deletions docs/viewer/viewer-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Each configuration is specified by a given key name. When users go to
the viewer app, we will use the `config` query parameter to determine which
configuration we should use.

The configuration file must be defined under `viewer/viewer-config.js` and the following is the structure of this config file:
The configuration file must be defined under `config/viewer-config.js` and the following is the structure of this config file:
```javascript
var viewerConfigs = {
<config-name>: <configuration>
Expand Down Expand Up @@ -64,7 +64,7 @@ query parameters other than "img1" and "img2", will use `<config1>`.

### Parameters

The parameters are explained in the [`viewer-config-sample.js`](https://github.com/informatics-isi-edu/chaise/tree/master/viewer/viewer-config-sample.js) file.
The parameters are explained in the [`viewer-config-sample.js`](https://github.com/informatics-isi-edu/chaise/tree/master/config/viewer-config-sample.js) file.

## Channel Configuration

Expand Down
1 change: 1 addition & 0 deletions lib/login/login.app.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ const ANGULAR_JS = chaiseBasePath + "scripts/vendor/angular.js";
const JS_DEPS = [
chaiseBasePath + 'dist/chaise.vendor.min.js',
chaiseBasePath + 'chaise-config.js',
chaiseBasePath + 'config/chaise-config.js',
chaiseBasePath + 'dist/chaise.min.js',
ermrestjsBasePath + 'ermrest.min.js'
];
Expand Down
1 change: 1 addition & 0 deletions lib/navbar/navbar.app.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ const ANGULAR_JS = chaiseBasePath + "scripts/vendor/angular.js";
const JS_DEPS = [
chaiseBasePath + 'dist/chaise.vendor.min.js',
chaiseBasePath + 'chaise-config.js',
chaiseBasePath + 'config/chaise-config.js',
chaiseBasePath + 'dist/chaise.min.js',
ermrestjsBasePath + 'ermrest.min.js'
];
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@isrd-isi-edu/chaise",
"description": "An adaptive User Interface for ERMrest data sources",
"version": "0.0.18",
"version": "0.0.19",
"license": "Apache-2.0",
"engines": {
"node": ">=14.0.0",
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/utils/protractor.configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ exports.getConfig = function(options) {

var execSync = require('child_process').execSync;
var remoteChaiseDirPath = process.env.REMOTE_CHAISE_DIR_PATH;
var cmd = 'sudo cp ' + chaiseFilePath + " " + ("/var/www/html/chaise/chaise-config.js");
var cmd = 'sudo cp ' + chaiseFilePath + " " + ("/var/www/html/chaise/config/chaise-config.js");

// The tests will take this path when it is not running on CI and remoteChaseDirPath is not null
if (typeof remoteChaiseDirPath == 'string') {
cmd = 'scp ' + chaiseFilePath + ' ' + remoteChaiseDirPath + '/chaise-config.js';
cmd = 'scp ' + chaiseFilePath + ' ' + remoteChaiseDirPath + '/config/chaise-config.js';
console.log("Copying using scp");
} else {
console.log("Copying using cp");
Expand Down
4 changes: 3 additions & 1 deletion webpack/app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ const getWebPackConfig = (appConfigs, mode, env, options) => {
// ermrestjs
`${ermrestjsPath}ermrest.vendor.min.js?v=${buildVersion}`,
`${ermrestjsPath}ermrest.min.js?v=${buildVersion}`,
// chaise-config
// old chaise-config location TODO should be removed
`${chaisePath}chaise-config.js?v=${buildVersion}`,
// chaise-config
`${chaisePath}config/chaise-config.js?v=${buildVersion}`,
// the specific app config file
...ac.appConfigLocation ? [`${ac.appConfigLocation}?v=${buildVersion}`] : [],
// external files that the app might need
Expand Down
3 changes: 2 additions & 1 deletion webpack/main.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ module.exports = (env) => {
appTitle: 'Record',
externalFiles: [
...recordsetExtFiles,
`${chaisePath}google-dataset-config.js`
`${chaisePath}google-dataset-config.js`,
`${chaisePath}config/google-dataset-config.js`
]
},
{
Expand Down

0 comments on commit b45253e

Please sign in to comment.