Skip to content

Commit

Permalink
Merge pull request #88 from NASA-PDS/develop
Browse files Browse the repository at this point in the history
Merge develop to main for release
  • Loading branch information
jordanpadams authored Sep 23, 2024
2 parents 45e91e1 + 750279d commit 82b4586
Show file tree
Hide file tree
Showing 11 changed files with 186 additions and 73 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/branch-cicd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# 🏃‍♀️ Continuous Integration and Delivery: Branch Testing
# ======================================================


---

name: 🔁 Branch integration testing


# Driving Event
# -------------
#
# What event starts this workflow: a push to any branch other than main

on:
push:
branches:
- '**'
- '!main'


# What to Do
# ----------
#
# Test the software with tox

jobs:
branch-testing:
name: 🪵 Branch Testing
runs-on: ubuntu-latest
if: github.actor != 'pdsen-ci'
steps:
-
name: 💳 Checkout
uses: actions/checkout@v4
with:
lfs: true
fetch-depth: 0
token: ${{secrets.ADMIN_GITHUB_TOKEN || github.token}}
-
name: 🟢 Setup up Node
uses: actions/setup-node@v4
with:
node-version: 'latest'
-
name: 🩺 Test Software
run:
npm clean-install
npm test --if-present

...
36 changes: 0 additions & 36 deletions .github/workflows/branch-cicd.yml

This file was deleted.

116 changes: 105 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,110 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# Copyright © 2023, California Institute of Technology ("Caltech").
# U.S. Government sponsorship acknowledged.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# • Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# • Redistributions must reproduce the above copyright notice, this list of
# conditions and the following disclaimer in the documentation and/or other
# materials provided with the distribution.
# • Neither the name of Caltech nor its operating division, the Jet Propulsion
# Laboratory, nor the names of its contributors may be used to endorse or
# promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Items for Git to ignore

# dependencies
/node_modules
/.pnp
.pnp.js
# Node.js reproducibles
node_modules/

# build
/dist
# JSDoc.app output
out/

# misc
# Eclipse files
.settings/
*.project
*.classpath

# IntelliJ files
.idea/
*.iml

# Sublime Text files
*.sublime-*

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app

# Temporary files
*~
.*.swp
var/

# other stuff
*.xpr
*.swp
bin/
typescript

# macOS specific stuff
.DS_Store
._*

# Local .terraform directories
**/.terraform/*

# .tfstate files
*.tfstate
*.tfstate.*

# Crash log files
crash.log
crash.*.log

# Exclude all .tfvars files, which are likely to contain sensitive data, such as
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# to change depending on the environment.
*.tfvars
*.tfvars.json

# Ignore override files as they are usually used to override resources locally and so
# are not checked in
override.tf
override.tf.json
*_override.tf
*_override.tf.json

# Include override files you do wish to add to version control using negated pattern
# !example_override.tf

# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*

npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Ignore CLI configuration files
.terraformrc
terraform.rc
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
# PDS S3 Web Browser Using Cloudfront

## macOS
## Full Original Instructions For MacOS

For one time setup instructions see [setup for macOS](./docs/setup-mac.md)

For everyday use see [work on macOS](./docs/work-mac.md)

## Deployment Short Version

1. Clone this repository.
2. Run `nvm` (go to https://github.com/nvm-sh/nvm?tab=readme-ov-file#intro to install nvm)
3. Run `npm install` (go to https://nodejs.org/en to install nodejs)
4. Open `webpack.config.js` Search for `new webpack.EnvironmentPlugin` and change the value for `PUBLIC_PATH` to the desired path the application will be deployed to. By default it is set to `/data/`
5. Run `npm run build`
6. The built files will be placed in the dist directory. These can then be placed on an aws bucket. Follow instructions from your AWS SA to set up an s3 bucket and cloudfront.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "aria-s3-browser",
"name": "pds-s3-browser",
"version": "0.1.0",
"scripts": {
"start": "webpack serve --mode development",
Expand Down
2 changes: 1 addition & 1 deletion src/js/autoindex.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function render(subdir) {
var path_url = "/" + search;
var path_urls = [{
html: create_icon("fa-fw fas fa-home", document.title),
url: sanitizeUrl(path_url),
url: process.env.PUBLIC_PATH.slice(0,-1) + sanitizeUrl(path_url),
}];

path_segments.forEach(function(segment) {
Expand Down
10 changes: 6 additions & 4 deletions src/js/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function getS3Data(marker, table) {
var s3_rest_url = createS3QueryUrl(marker);

// set loading notice
$('#files').html('<div class="spinner-container"><img class="ajax-load-spinner" src="/index-style/images/explorer/ajaxload-circle.gif"/></div>');
$('#files').html('<div class="spinner-container"><img class="ajax-load-spinner" src="' + process.env.PUBLIC_PATH + 'index-style/images/explorer/ajaxload-circle.gif"/></div>');
$.get(s3_rest_url).done(function(data) {
// clear loading notice
$('#files').html('');
Expand All @@ -55,7 +55,7 @@ function getS3Data(marker, table) {
// $('#files').append(h2);

var xml = $(data);
var info = getInfoFromS3Data(xml);
var info = getInfoFromS3Data(xml);
if (info.directories.length > 0 || info.files.length > 0) {
if (table == null) {
table = prepareTable(info);
Expand Down Expand Up @@ -111,7 +111,9 @@ function createS3QueryUrl(marker) {
if (S3BL_IGNORE_PATH==false) {
var prefix = location.pathname.replace(/^\//, S3B_ROOT_DIR);
SUBDIRS.some(w => {
var path = w.slice(1);
var path = process.env.PUBLIC_PATH + w;
path = path.slice(1);

if (prefix.includes(path)) {
prefix = prefix.replace(path, "");
}
Expand Down Expand Up @@ -374,7 +376,7 @@ function renderTableHeader() {
var headers = [];

var th_icon = $("<th>", {'class' : 'icon unsortable'});
th_icon.html('<img src="/index-style/images/explorer/blank.gif" alt="" height="16" width="16">');
th_icon.html('<img src="' + process.env.PUBLIC_PATH + 'index-style/images/explorer/blank.gif" alt="" height="16" width="16">');
headers.push(th_icon);

var th_name = $("<th>", {'class' : 'name'});
Expand Down
4 changes: 2 additions & 2 deletions src/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import { missions } from './missions.js';
// Show the <main>
$("main").show();

if (location.pathname == "/"){
if (location.pathname == process.env.PUBLIC_PATH){
$.each( missions, function( key, value ) {
var items = [];
$( ".bucketlist").append("<tr class='even'> <th scope='row'><div class='position-relative'><i class='fa-fw fas fa-folder' title='Directory' aria-hidden='true'></i><span class='sr-only'>(Directory)</span><a href='" + value.Path + "' class='stretched-link'></a></div></th><td class='name'> <div class='position-relative'> <a href='" + value.Path + "' class='stretched-link'>" + key + "</a></div></td></tr>" );
$( ".bucketlist").append("<tr class='even'> <th scope='row'><div class='position-relative'><i class='fa-fw fas fa-folder' title='Directory' aria-hidden='true'></i><span class='sr-only'>(Directory)</span><a href='" + process.env.PUBLIC_PATH + value.Path + "' class='stretched-link'></a></div></th><td class='name'> <div class='position-relative'> <a href='" + process.env.PUBLIC_PATH + value.Path + "' class='stretched-link'>" + key + "</a></div></td></tr>" );
});
}

Expand Down
16 changes: 2 additions & 14 deletions src/js/missions.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
export const missions = {
"pds-aria-share-setup-copy-test": {
"Path": "/pds-aria-share-setup-copy-test/",
"URL": "https://dwfmsppt3a750.cloudfront.net"
},
"pds-infrastructure-temp": {
"Path": "/pds-infrastructure-temp/",
"URL": "https://pds-infrastructure-temp.s3.us-west-2.amazonaws.com"
},
"css" : {
"Path": "/css/",
"open-data-registry" : {
"Path": "open-data-registry/",
"URL": "https://pds-css-archive.s3.us-west-2.amazonaws.com"
},
"aria-share" : {
"Path": "/aria-share/",
"URL": "https://d1z62tir4fw0q0.cloudfront.net"
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/js/sort-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Version 1.5.8
*/

/* You can change these values */
var image_path = "/index-style/images/sort-table/";
var image_path = process.env.PUBLIC_PATH + "index-style/images/sort-table/";
var image_up = "arrow-up.gif"; /* sort up */
var image_down = "arrow-down.gif"; /* sort down */
var image_none = "arrow-none.gif"; /* this is added to any column header that the table is not currently sorted by */
Expand Down
8 changes: 6 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const path = require('path');

const webpack = require("webpack")
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CopyWebPackPlugin = require("copy-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
Expand All @@ -22,12 +23,15 @@ module.exports = (env) => {
new HtmlWebpackPlugin({
template: 'src/index.html',
filename: 'index.html'
})
}) ,
new webpack.EnvironmentPlugin({
PUBLIC_PATH: '/data/',
})
],
output: {
filename: 'index-style/js/main.js',
path: buildPath,
publicPath: '/'
publicPath: '/data/'
},
devtool: "source-map",
devServer: {
Expand Down

0 comments on commit 82b4586

Please sign in to comment.