Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: resource explorer #1128

Merged
merged 75 commits into from
Nov 30, 2021
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
401a657
create new tab for resources
thewahome Sep 13, 2021
02d9627
create resource explorer component
thewahome Sep 13, 2021
cde4dc8
create action creators and reducers
thewahome Sep 13, 2021
5444d1a
add services to provide resources
thewahome Sep 13, 2021
e687f08
refactor method to filter labels
thewahome Sep 13, 2021
03d8806
connect resource explorer component to data
thewahome Sep 13, 2021
bfe407a
display first level of items
thewahome Sep 14, 2021
274ee89
display content on navigation bar
thewahome Sep 15, 2021
8275995
display different icons
thewahome Sep 15, 2021
c3f11e9
enable search and filtering
thewahome Sep 17, 2021
3130b55
add context menu
thewahome Sep 18, 2021
6acf706
add isolation function
thewahome Sep 19, 2021
d16a5f0
enable isolation of resource
thewahome Sep 19, 2021
810c695
show unclickable breadcrumb paths
thewahome Sep 19, 2021
bfa2919
navigate using breadcrumbs
thewahome Sep 19, 2021
d740698
enhance methods to get current tree
thewahome Sep 20, 2021
c8cb5c2
Merge branch 'dev' into feature/resource-explorer
thewahome Sep 20, 2021
72416b2
remove comments
thewahome Sep 20, 2021
bea1425
create unique keys
thewahome Sep 21, 2021
1510a5d
utilise new payload
thewahome Sep 21, 2021
d21c216
filter children by version
thewahome Sep 21, 2021
e6ab8a2
make functions strongly typed
thewahome Sep 23, 2021
1d2c70e
Merge branch 'dev' into feature/resource-explorer
thewahome Sep 23, 2021
abedf28
Merge branch 'dev' into feature/resource-explorer
thewahome Sep 23, 2021
9e682f0
Fix linting errors
thewahome Sep 23, 2021
fee9c6e
consume api to get resources; adds sample dataset as failover
thewahome Sep 23, 2021
6904fa5
Merge branch 'dev' into feature/resource-explorer
thewahome Oct 18, 2021
3ad3819
Merge branch 'dev' into feature/resource-explorer
thewahome Oct 21, 2021
65f4222
indicate methods available for each resource
thewahome Oct 25, 2021
773a7a1
display key for the methods available
thewahome Oct 26, 2021
39f2305
set default properties for checkboxes
thewahome Oct 26, 2021
cabf7f6
filter items using displayed methods
thewahome Oct 27, 2021
5fafa46
remove click message
thewahome Oct 27, 2021
27a8589
Enable users to run the resource as a sample query
thewahome Oct 28, 2021
6167635
Merge branch 'dev' into feature/resource-explorer
thewahome Oct 28, 2021
8e817f3
remove method based filtering
thewahome Oct 28, 2021
7cf5331
conditionally run a query
thewahome Oct 29, 2021
66ffcf7
create separate elements file structure
thewahome Oct 29, 2021
c549e8d
display query parameters for requests
thewahome Oct 29, 2021
4115b8a
prevent defaults when link item is selected
thewahome Nov 1, 2021
3bd187b
use dropdowns instead of choice options
thewahome Nov 2, 2021
7da1261
only show applicable query parameters
thewahome Nov 2, 2021
538f536
Merge branch 'dev' into feature/resource-explorer
thewahome Nov 8, 2021
76e947e
Merge branch 'dev' into feature/resource-explorer
thewahome Nov 11, 2021
60ffb38
Merge branch 'dev' into feature/resource-explorer
thewahome Nov 15, 2021
6f1f16e
remove duplicate declarations
thewahome Nov 15, 2021
8fa4a8b
Merge branch 'dev' into feature/resource-explorer
thewahome Nov 16, 2021
9f5eb81
vertically align available methods
thewahome Nov 16, 2021
9194cf7
Move resources closer to samples
thewahome Nov 16, 2021
d01a278
add icons and colours to available methods
thewahome Nov 17, 2021
d10fdd3
remove right click; display methods inside context
thewahome Nov 17, 2021
cca43aa
show methods in uppercase
thewahome Nov 17, 2021
cdd73d9
remove methods legend
thewahome Nov 17, 2021
59ea978
Merge branch 'dev' into feature/resource-explorer
thewahome Nov 17, 2021
790f179
display available methods
thewahome Nov 18, 2021
43f7143
prevent crashing on early navigation
thewahome Nov 19, 2021
243238a
toggle available methods; sets support in list
thewahome Nov 22, 2021
ee1147b
Replace 'Run Query' option with 'Set query'
thewahome Nov 23, 2021
633324c
Merge branch 'dev' into feature/resource-explorer
thewahome Nov 23, 2021
849c461
more actions button styling
thewahome Nov 24, 2021
8c1f631
Merge branch 'dev' into feature/resource-explorer
thewahome Nov 24, 2021
18125c1
cleanup unnecessary code
thewahome Nov 25, 2021
d92254b
remove method components
thewahome Nov 25, 2021
de71621
add tooltip to more actions button
thewahome Nov 25, 2021
4283646
Merge branch 'dev' into feature/resource-explorer
thewahome Nov 30, 2021
800ad22
reduce code smells
thewahome Nov 30, 2021
5bbe5a0
add tests to validate getCurrentTree
thewahome Nov 30, 2021
87ef7e0
add happy path checks for utility file
thewahome Nov 30, 2021
919f30a
add reducer tests
thewahome Nov 30, 2021
5234e5a
reducer tests
thewahome Nov 30, 2021
5780a77
set action creator tests
thewahome Nov 30, 2021
d3659fe
Merge branch 'dev' into feature/resource-explorer
thewahome Nov 30, 2021
7bdcffc
fix tooltip alignment
thewahome Nov 30, 2021
52f384a
Merge branch 'feature/resource-explorer' of https://github.com/micros…
thewahome Nov 30, 2021
d729db9
make queryparameters component strongly typed
thewahome Nov 30, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ module.exports = {
'no-multiple-empty-lines': 'error',
'no-new-wrappers': 'error',
'quotes': ['error', 'single'],
'no-shadow': [
'no-shadow': 'off',
thewahome marked this conversation as resolved.
Show resolved Hide resolved
'@typescript-eslint/no-shadow': [
'warn',
{
hoist: 'all',
Expand Down
51 changes: 51 additions & 0 deletions src/app/services/actions/resource-explorer-action-creators.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { IAction } from '../../../types/action';
import { FETCH_RESOURCES_SUCCESS, FETCH_RESOURCES_PENDING, FETCH_RESOURCES_ERROR } from '../redux-constants';
import { IResource } from '../../../types/resources';
import { IRootState } from '../../../types/root';
import { IRequestOptions } from '../../../types/request';

export function fetchResourcesSuccess(response: object): IAction {
return {
type: FETCH_RESOURCES_SUCCESS,
response
};
}

export function fetchResourcesPending(): any {
return {
type: FETCH_RESOURCES_PENDING
};
}

export function fetchResourcesError(response: object): IAction {
return {
type: FETCH_RESOURCES_ERROR,
response
};
}

export function fetchResources(): Function {
return async (dispatch: Function, getState: Function) => {
try {
const { devxApi }: IRootState = getState();
const resourcesUrl = `${devxApi.baseUrl}/openapi/tree`;

const headers = {
'Content-Type': 'application/json'
};

const options: IRequestOptions = { headers };

dispatch(fetchResourcesPending());

const response = await fetch(resourcesUrl, options);
if (response.ok) {
const resources = await response.json() as IResource;
return dispatch(fetchResourcesSuccess(resources));
}
throw response;
} catch (error) {
return dispatch(fetchResourcesError({ error }));
}
};
}
15 changes: 9 additions & 6 deletions src/app/services/reducers/index.ts
Original file line number Diff line number Diff line change
@@ -1,47 +1,50 @@
import { combineReducers } from 'redux';

import { adaptiveCard } from './adaptive-cards-reducer';
import { authToken, consentedScopes } from './auth-reducers';
import { autoComplete } from './autocomplete-reducer';
import { devxApi } from './devxApi-reducers';
import { dimensions } from './dimensions-reducers';
import { permissionsPanelOpen } from './permissions-panel-reducer';
import { graphExplorerMode } from './graph-explorer-mode-reducer';
import { permissionsPanelOpen } from './permissions-panel-reducer';
import { scopes } from './permissions-reducer';
import { profile } from './profile-reducer';
import { proxyUrl } from './proxy-url-reducer';
import { sampleQuery } from './query-input-reducers';
import { isLoadingData } from './query-loading-reducers';
import { graphResponse } from './query-runner-reducers';
import { queryRunnerStatus } from './query-runner-status-reducers';
import { history } from './request-history-reducers';
import { resources } from './resources-reducer';
import { responseAreaExpanded } from './response-expanded-reducer';
import { samples } from './samples-reducers';
import { snippets } from './snippet-reducer';
import { termsOfUse } from './terms-of-use-reducer';
import { theme } from './theme-reducer';
import { sidebarProperties } from './toggle-sidebar-reducer';
import { proxyUrl } from './proxy-url-reducer';

export default combineReducers({
adaptiveCard,
authToken,
autoComplete,
consentedScopes,
devxApi,
dimensions,
graphExplorerMode,
graphResponse,
devxApi,
history,
isLoadingData,
permissionsPanelOpen,
profile,
proxyUrl,
queryRunnerStatus,
resources,
responseAreaExpanded,
sampleQuery,
samples,
scopes,
sidebarProperties,
snippets,
termsOfUse,
theme,
dimensions,
permissionsPanelOpen
theme
});
40 changes: 40 additions & 0 deletions src/app/services/reducers/resources-reducer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { IAction } from '../../../types/action';
import { IResource, IResources } from '../../../types/resources';
import content from '../../utils/resources/resources.json';
import { FETCH_RESOURCES_ERROR, FETCH_RESOURCES_PENDING, FETCH_RESOURCES_SUCCESS } from '../redux-constants';

const res = JSON.parse(JSON.stringify(content)) as IResource;
const initialState: IResources = {
pending: false,
data: {
children: [],
labels: [],
segment: ''
},
error: null
};

export function resources(state: IResources = initialState, action: IAction): any {
switch (action.type) {
case FETCH_RESOURCES_SUCCESS:
return {
pending: false,
data: action.response,
error: null
};
case FETCH_RESOURCES_ERROR:
return {
pending: false,
error: action.response,
data: res
};
case FETCH_RESOURCES_PENDING:
return {
pending: true,
data: {},
error: null
};
default:
return state;
}
}
3 changes: 3 additions & 0 deletions src/app/services/redux-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ export const RESPONSE_EXPANDED = 'RESPONSE_EXPANDED';
export const PERMISSIONS_PANEL_OPEN = 'PERMISSIONS_PANEL_OPEN';
export const AUTHENTICATION_PENDING = 'AUTHENTICATION_PENDING';
export const SET_GRAPH_PROXY_URL = 'SET_GRAPH_PROXY_URL';
export const FETCH_RESOURCES_SUCCESS = 'RESOURCES_FETCH_SUCCESS';
export const FETCH_RESOURCES_ERROR = 'RESOURCES_FETCH_ERROR';
export const FETCH_RESOURCES_PENDING = 'FETCH_RESOURCES_PENDING';
1 change: 1 addition & 0 deletions src/app/utils/generate-groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export function generateGroupsFromList(list: any[], property: string) {
isCollapsed = true;
}
groups.push({
...listItem,
name: listItem[property],
key: listItem[property],
startIndex: previousCount,
Expand Down
2 changes: 2 additions & 0 deletions src/app/utils/resources/resource-payload-filter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { IResource } from '../../../types/resources';

Loading