Skip to content

Commit

Permalink
Merge pull request #472 from cumulus-nasa/remove_defaultversion
Browse files Browse the repository at this point in the history
remove defaultVersion as it introduces lots of bugs
  • Loading branch information
Alireza authored Apr 23, 2018
2 parents 805b8a9 + c326bf8 commit 7f08743
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 46 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## Unreleased

## [v1.1.0] - 2018-04-20
### Added
- Expandable errors. [CUMULUS-394]

### Changed
- In `components/logs/viewer.js`, changed references to `type` to `level` to match cumulus v1 logging [CUMULUS-306].
- Tests use ava instead of tape. [CUMULUS-418]
- Remove `defaultVersion` from the config. To use a particular version of the API, just set that in the API URL.

## [v1.0.1] - 2018-03-07
## v1.0.1 - 2018-03-07

### Added
- Versioning and changelog [CUMULUS-197] by @kkelly51

[Unreleased]: https://github.com/cumulus-nasa/cumulus/compare/v1.1.0...HEAD
[v1.1.0]: https://github.com/cumulus-nasa/cumulus/compare/v1.0.1...v1.1.0
83 changes: 41 additions & 42 deletions app/scripts/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import _config from '../config';
import { getCollectionId } from '../utils/format';

const root = _config.apiRoot;
const defaultVersion = _config.defaultVersion;
const { pageLimit } = _config;

export const LOGOUT = 'LOGOUT';
Expand Down Expand Up @@ -219,40 +218,40 @@ export const interval = function (action, wait, immediate) {
};

export const getCollection = (name, version) => wrapRequest(
getCollectionId({name, version}), get, `${defaultVersion}/collections?name=${name}&version=${version}`, COLLECTION);
getCollectionId({name, version}), get, `collections?name=${name}&version=${version}`, COLLECTION);

export const listCollections = (options) => wrapRequest(null, get, {
url: url.resolve(root, defaultVersion + '/collections'),
url: url.resolve(root, 'collections'),
qs: Object.assign({ limit: pageLimit }, options)
}, COLLECTIONS);

export const createCollection = (payload) => wrapRequest(
getCollectionId(payload), post, `${defaultVersion}/collections`, NEW_COLLECTION, payload);
getCollectionId(payload), post, 'collections', NEW_COLLECTION, payload);

export const updateCollection = (payload) => wrapRequest(
getCollectionId(payload), put, `${defaultVersion}/collections/${payload.name}/${payload.version}`, UPDATE_COLLECTION, payload);
getCollectionId(payload), put, `collections/${payload.name}/${payload.version}`, UPDATE_COLLECTION, payload);

export const clearUpdateCollection = (collectionName) => ({ type: UPDATE_COLLECTION_CLEAR, id: collectionName });

export const deleteCollection = (name, version) => wrapRequest(
getCollectionId({name, version}), del, `${defaultVersion}/collections/${name}/${version}`, COLLECTION_DELETE);
getCollectionId({name, version}), del, `collections/${name}/${version}`, COLLECTION_DELETE);

export const searchCollections = (prefix) => ({ type: SEARCH_COLLECTIONS, prefix: prefix });
export const clearCollectionsSearch = () => ({ type: CLEAR_COLLECTIONS_SEARCH });
export const filterCollections = (param) => ({ type: FILTER_COLLECTIONS, param: param });
export const clearCollectionsFilter = (paramKey) => ({ type: CLEAR_COLLECTIONS_FILTER, paramKey: paramKey });

export const getGranule = (granuleId) => wrapRequest(
granuleId, get, `${defaultVersion}/granules/${granuleId}`, GRANULE);
granuleId, get, `granules/${granuleId}`, GRANULE);

export const listGranules = (options) => wrapRequest(null, get, {
url: url.resolve(root, defaultVersion + '/granules'),
url: url.resolve(root, 'granules'),
qs: Object.assign({ limit: pageLimit }, options)
}, GRANULES);

// only query the granules from the last hour
export const getRecentGranules = () => wrapRequest(null, get, {
url: url.resolve(root, defaultVersion + '/granules'),
url: url.resolve(root, 'granules'),
qs: {
limit: 1,
fields: 'granuleId',
Expand All @@ -261,90 +260,90 @@ export const getRecentGranules = () => wrapRequest(null, get, {
}, RECENT_GRANULES);

export const reprocessGranule = (granuleId) => wrapRequest(
granuleId, put, `${defaultVersion}/granules/${granuleId}`, GRANULE_REPROCESS, {
granuleId, put, `granules/${granuleId}`, GRANULE_REPROCESS, {
action: 'reprocess'
});

export const reingestGranule = (granuleId) => wrapRequest(
granuleId, put, `${defaultVersion}/granules/${granuleId}`, GRANULE_REINGEST, {
granuleId, put, `granules/${granuleId}`, GRANULE_REINGEST, {
action: 'reingest'
});

export const removeGranule = (granuleId) => wrapRequest(
granuleId, put, `${defaultVersion}/granules/${granuleId}`, GRANULE_REMOVE, {
granuleId, put, `granules/${granuleId}`, GRANULE_REMOVE, {
action: 'removeFromCmr'
});

export const deleteGranule = (granuleId) => wrapRequest(
granuleId, del, `${defaultVersion}/granules/${granuleId}`, GRANULE_DELETE);
granuleId, del, `granules/${granuleId}`, GRANULE_DELETE);

export const searchGranules = (prefix) => ({ type: SEARCH_GRANULES, prefix: prefix });
export const clearGranulesSearch = () => ({ type: CLEAR_GRANULES_SEARCH });
export const filterGranules = (param) => ({ type: FILTER_GRANULES, param: param });
export const clearGranulesFilter = (paramKey) => ({ type: CLEAR_GRANULES_FILTER, paramKey: paramKey });

export const getOptionsCollectionName = () => wrapRequest(null, get, {
url: url.resolve(root, defaultVersion + '/collections'),
url: url.resolve(root, 'collections'),
qs: { limit: 100, fields: 'name,version' }
}, OPTIONS_COLLECTIONNAME);

export const getStats = (options) => wrapRequest(null, get, {
url: url.resolve(root, defaultVersion + '/stats'),
url: url.resolve(root, 'stats'),
qs: options
}, STATS);

// count queries *must* include type and field properties.
export const getCount = (options) => wrapRequest(null, get, {
url: url.resolve(root, defaultVersion + '/stats/aggregate'),
url: url.resolve(root, 'stats/aggregate'),
qs: Object.assign({ type: 'must-include-type', field: 'status' }, options)
}, COUNT);

export const listPdrs = (options) => wrapRequest(null, get, {
url: url.resolve(root, defaultVersion + '/pdrs'),
url: url.resolve(root, 'pdrs'),
qs: Object.assign({ limit: pageLimit }, options)
}, PDRS);

export const getPdr = (pdrName) => wrapRequest(
pdrName, get, `${defaultVersion}/pdrs/${pdrName}`, PDR);
pdrName, get, `pdrs/${pdrName}`, PDR);

export const searchPdrs = (prefix) => ({ type: SEARCH_PDRS, prefix: prefix });
export const clearPdrsSearch = () => ({ type: CLEAR_PDRS_SEARCH });
export const filterPdrs = (param) => ({ type: FILTER_PDRS, param: param });
export const clearPdrsFilter = (paramKey) => ({ type: CLEAR_PDRS_FILTER, paramKey: paramKey });

export const listProviders = (options) => wrapRequest(null, get, {
url: url.resolve(root, defaultVersion + '/providers'),
url: url.resolve(root, 'providers'),
qs: Object.assign({ limit: pageLimit }, options)
}, PROVIDERS);

export const getOptionsProviderGroup = () => wrapRequest(null, get, {
url: url.resolve(root, defaultVersion + '/providers'),
url: url.resolve(root, 'providers'),
qs: { limit: 100, fields: 'providerName' }
}, OPTIONS_PROVIDERGROUP);

export const getProvider = (providerId) => wrapRequest(
providerId, get, `${defaultVersion}/providers/${providerId}`, PROVIDER);
providerId, get, `providers/${providerId}`, PROVIDER);

export const createProvider = (providerId, payload) => wrapRequest(
providerId, post, `${defaultVersion}/providers`, NEW_PROVIDER, payload);
providerId, post, 'providers', NEW_PROVIDER, payload);

export const updateProvider = (providerId, payload) => wrapRequest(
providerId, put, `${defaultVersion}/providers/${providerId}`, UPDATE_PROVIDER, payload);
providerId, put, `providers/${providerId}`, UPDATE_PROVIDER, payload);

export const clearUpdateProvider = (providerId) => ({ type: UPDATE_PROVIDER_CLEAR, id: providerId });

export const deleteProvider = (providerId) => wrapRequest(
providerId, del, `${defaultVersion}/providers/${providerId}`, PROVIDER_DELETE);
providerId, del, `providers/${providerId}`, PROVIDER_DELETE);

export const restartProvider = (providerId) => wrapRequest(
providerId, put, `${defaultVersion}/providers/${providerId}`, PROVIDER_RESTART, {
providerId, put, `providers/${providerId}`, PROVIDER_RESTART, {
action: 'restart'
});

export const clearRestartedProvider = (providerId) => ({ type: CLEAR_RESTARTED_PROVIDER, id: providerId });

export const stopProvider = (providerId) => wrapRequest(
providerId, put, `${defaultVersion}/providers/${providerId}`, PROVIDER_STOP, {
providerId, put, `providers/${providerId}`, PROVIDER_STOP, {
action: 'stop'
});

Expand All @@ -355,10 +354,10 @@ export const filterProviders = (param) => ({ type: FILTER_PROVIDERS, param: para
export const clearProvidersFilter = (paramKey) => ({ type: CLEAR_PROVIDERS_FILTER, paramKey: paramKey });

export const deletePdr = (pdrName) => wrapRequest(
pdrName, del, `${defaultVersion}/pdrs/${pdrName}`, PDR_DELETE);
pdrName, del, `pdrs/${pdrName}`, PDR_DELETE);

export const getLogs = (options) => wrapRequest(null, get, {
url: url.resolve(root, defaultVersion + '/logs'),
url: url.resolve(root, 'logs'),
qs: Object.assign({limit: 100}, options)
}, LOGS);
export const clearLogs = () => ({ type: CLEAR_LOGS });
Expand All @@ -371,65 +370,65 @@ export const logout = () => {
export const login = (token) => {
// dummy request to test the auth token
return wrapRequest('auth', get, {
url: url.resolve(root, defaultVersion + '/granules'),
url: url.resolve(root, 'granules'),
qs: { limit: 1, fields: 'granuleId' },
headers: {
Authorization: 'Bearer ' + token
}
}, LOGIN);
};

export const getSchema = (type) => wrapRequest(null, get, `${defaultVersion}/schemas/${type}`, SCHEMA);
export const getSchema = (type) => wrapRequest(null, get, `schemas/${type}`, SCHEMA);

export const queryHistogram = (options) => wrapRequest(null, get, {
url: url.resolve(root, defaultVersion + '/stats/histogram'),
url: url.resolve(root, 'stats/histogram'),
qs: options
}, HISTOGRAM);

export const listWorkflows = (options) => wrapRequest(null, get, `${defaultVersion}/workflows`, WORKFLOWS);
export const listWorkflows = (options) => wrapRequest(null, get, 'workflows', WORKFLOWS);

export const getExecutionStatus = (arn) => wrapRequest(null, get, {
url: url.resolve(root, defaultVersion + '/executions/status/' + arn)
url: url.resolve(root, 'executions/status/' + arn)
}, EXECUTION_STATUS);

export const listExecutions = (options) => wrapRequest(null, get, {
url: url.resolve(root, defaultVersion + '/executions'),
url: url.resolve(root, 'executions'),
qs: Object.assign({ limit: pageLimit }, options)
}, EXECUTIONS);

export const filterExecutions = (param) => ({ type: FILTER_EXECUTIONS, param: param });
export const clearExecutionsFilter = (paramKey) => ({ type: CLEAR_EXECUTIONS_FILTER, paramKey: paramKey });

export const listRules = (options) => wrapRequest(null, get, {
url: url.resolve(root, defaultVersion + '/rules'),
url: url.resolve(root, 'rules'),
qs: Object.assign({ limit: pageLimit }, options)
}, RULES);

export const getRule = (ruleName) => wrapRequest(
ruleName, get, `${defaultVersion}/rules?name=${ruleName}`, RULE);
ruleName, get, `rules?name=${ruleName}`, RULE);

export const updateRule = (name, payload) => wrapRequest(
name, put, `${defaultVersion}/rules/${name}`, UPDATE_RULE, payload);
name, put, `rules/${name}`, UPDATE_RULE, payload);

export const clearUpdateRule = (ruleName) => ({ type: UPDATE_RULE_CLEAR, id: ruleName });

export const createRule = (id, payload) => wrapRequest(
id, post, `${defaultVersion}/rules`, NEW_RULE, payload);
id, post, 'rules', NEW_RULE, payload);

export const deleteRule = (ruleName) => wrapRequest(
ruleName, del, `${defaultVersion}/rules/${ruleName}`, RULE_DELETE);
ruleName, del, `rules/${ruleName}`, RULE_DELETE);

export const enableRule = (ruleName) => wrapRequest(
ruleName, put, `${defaultVersion}/rules/${ruleName}`, RULE_ENABLE, {
ruleName, put, `rules/${ruleName}`, RULE_ENABLE, {
state: 'ENABLED'
});

export const disableRule = (ruleName) => wrapRequest(
ruleName, put, `${defaultVersion}/rules/${ruleName}`, RULE_DISABLE, {
ruleName, put, `rules/${ruleName}`, RULE_DISABLE, {
state: 'DISABLED'
});

export const rerunRule = (ruleName) => wrapRequest(
ruleName, put, `${defaultVersion}/rules/${ruleName}`, RULE_RERUN, {
ruleName, put, `rules/${ruleName}`, RULE_RERUN, {
action: 'rerun'
});
2 changes: 0 additions & 2 deletions app/scripts/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ const baseConfig = {
requireEarthdataLogin: true,
apiRoot: 'https://wjdkfyb6t6.execute-api.us-east-1.amazonaws.com/dev/',

defaultVersion: 'v1',

graphicsPath: '/graphics/',

// settings for Ace editor
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cumulus-dashboard",
"version": "1.0.1",
"version": "1.1.0",
"description": "A dashboard for Cumulus API",
"repository": {
"type": "git",
Expand Down

0 comments on commit 7f08743

Please sign in to comment.