Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
Update from fix-cim-impacted-objects (#184)
Browse files Browse the repository at this point in the history
* Updated CHANGELOG
* Refactored the impacted services
* Show impacted objects with and without subscriptions
* New GUI for CIM impacted objects
* Fixed update of impact override
* Fixed react select usage with dark theme + use absolute paths for import
* Cleanup in typescript and components
* Fixed version number and Changelog. Added Changelog and Readme to the linter.
* Fixed discussion items

Co-authored-by: René Dohmen <[email protected]>
  • Loading branch information
github-actions[bot] and acidjunk authored Dec 2, 2022
1 parent 46362fb commit 616aa5b
Show file tree
Hide file tree
Showing 13 changed files with 598 additions and 392 deletions.
13 changes: 11 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,24 @@ reference the gitlab/github issue that is related to the change.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v10.5.0] - TBD
## [v10.6.0] - TBD

- `#47` Fix subscription dropdowns to not resize when typing and fixes alignments with other input fields
- Added description text in Owner_Subscription_Id and added a copy-to-clipboard button
- Updated service ticket detail page to show "last_update_time"
- `#41` Converted most components to a Functions based approach
- Selecting "auto scroll" on process detail page is now stored in localstorage
- `#44` Include subscription description of first product block relation on Subscription detail page

Surf specific:

- Added a log viewer to Service ticket detail
- Refactored Impacted objects tables to also show IMS Circuits
- Fix CIM impacted objects without a subscription ID
- Updated service ticket detail page to show "last_update_time"
- Added button to restart CIM open relate step

## [v10.5.0] - 2022-10-24

- `#42` Fix help button hidden on subscriptions page
- `#141` Convert sass files to emotion 3
- `#157` Redirect workflow submit to process detail
Expand Down
68 changes: 32 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ seems to fix that issue, whilst keeping hot reload intact. So try adding this to
To run the storybook, do: `yarn storybook`.
Your browser should open to http://localhost:9009/?path=/story/welcome--to-storybook.


## Actions and page views depending on who you are.

The orchestrator client can be configured to allow access to a page or to buttons in the client. The react app
consumes a webassembly OPA policy and evaluates if the user has the correct claims to view certain resources.
The function that gets called is the ```allowed()``` function in `src/utils/policy.ts`. The implementation of `allowed()`
The function that gets called is the `allowed()` function in `src/utils/policy.ts`. The implementation of `allowed()`
is done as follows:

```typescript jsx
Expand All @@ -163,58 +163,54 @@ Basically it boils down to: when a call to `allowed` returns true the component
**When no policy is found, the orchestrator-client will allow access to the resource.
Any real access must be enforced by the API. The client only disables features with the `allowed` function**


### Pages

These are the pages in the orchestrator client and how the resources can be viewed. In the implementation we only disable
menu items, not the actual pages. If a user has a direct url they will still be able to access the resource.

|Page|Resource name|
|---|---|
|Processes Pages|`/orchestrator/processes/`|
|Subscriptions Pages|`/orchestrator/subscriptions/`|
|Metadata Pages|`/orchestrator/metadata/`|
|Tasks Pages|`/orchestrator/tasks/`|
|Settings Pages|`/orchestrator/settings/`|
| Page | Resource name |
| ------------------- | ------------------------------ |
| Processes Pages | `/orchestrator/processes/` |
| Subscriptions Pages | `/orchestrator/subscriptions/` |
| Metadata Pages | `/orchestrator/metadata/` |
| Tasks Pages | `/orchestrator/tasks/` |
| Settings Pages | `/orchestrator/settings/` |

If you would like to add an extra menu item you are free to name it as you wish. It is defined in the `allowed` function.

### Actions

Actions are disabled in the same manner as menu items. The following actions are configurable:

|Action|Location|Resource name| Explanation|
|---|---|---|---|
|Modify a subscription|Subscription detail page action menu|`/orchestrator/subscriptions/modify/*`|This resource can be configured per workflow|
|Terminate a subscription| " "|`/orchestrator/subscriptions/terminate/*`|With this resource you can terminate a subscription|
|Validate a subscription|" "|`/orchestrator/subscriptions/validate/*`|With this resource you can validate a certain subscription|
|View a subscription from the process detail page|The process detail page|`/orchestrator/subscriptions/view/from-process`|Interact with a subscription from the process detail page|
|Abort a process|" " |`/orchestrator/processes/abort/*`| The ability to abort a process|
|Delete a process|" "|`/orchestrator/processes/delete/*`| The ability to delete a process, this is always disabled for processes not for tasks|
|Retry a process|" "|`/orchestrator/processes/retry/*`| The ability to retry a failed process or task|
|View a subscription from a process|" "|`/orchestrator/subscriptons/view/from-process` |This enables the link towards the subscription detail page|
|View a process detail page| The process list page| `/orchestrator/processes/details/*`| The allows the person to visit a process detail page|
|Retry all tasks| The tasks list page|`/orchestrator/processes/all-tasks/retry`| The Retry all tasks button|
|Create a task| The tasks list page|`/orchestrator/processes/create/task`| Create a task|
|Create a new subscription|The new process button|`/orchestrator/processes/create/process/menu`||
|Render a user_input_form|Allow access to input steps| `/orchestrator/processes/user_inout/*`|Allow access to input_steps|
|Allow deletion of product blocks| Product block detail page|`/orchestrator/metadata/product-block/delete/*`||
|Edit a product block| " "|`/orchestrator/metadata/product-block/edit/*`||
|View a product block|Product block list page|`/orchestrator/metadata/prodcut-block/view/*`||
|View a product|Product list page|`/orchestrator/metadata/product/view/*`||
|Edit a product|Product detail page|`/orchestrator/metadata/product/edit/*`||
|Delete a product|Product detail page|`/orchestrator/metadata/product/delete/*`||
| Action | Location | Resource name | Explanation |
| ------------------------------------------------ | ------------------------------------ | ----------------------------------------------- | ------------------------------------------------------------------------------------ |
| Modify a subscription | Subscription detail page action menu | `/orchestrator/subscriptions/modify/*` | This resource can be configured per workflow |
| Terminate a subscription | " " | `/orchestrator/subscriptions/terminate/*` | With this resource you can terminate a subscription |
| Validate a subscription | " " | `/orchestrator/subscriptions/validate/*` | With this resource you can validate a certain subscription |
| View a subscription from the process detail page | The process detail page | `/orchestrator/subscriptions/view/from-process` | Interact with a subscription from the process detail page |
| Abort a process | " " | `/orchestrator/processes/abort/*` | The ability to abort a process |
| Delete a process | " " | `/orchestrator/processes/delete/*` | The ability to delete a process, this is always disabled for processes not for tasks |
| Retry a process | " " | `/orchestrator/processes/retry/*` | The ability to retry a failed process or task |
| View a subscription from a process | " " | `/orchestrator/subscriptons/view/from-process` | This enables the link towards the subscription detail page |
| View a process detail page | The process list page | `/orchestrator/processes/details/*` | The allows the person to visit a process detail page |
| Retry all tasks | The tasks list page | `/orchestrator/processes/all-tasks/retry` | The Retry all tasks button |
| Create a task | The tasks list page | `/orchestrator/processes/create/task` | Create a task |
| Create a new subscription | The new process button | `/orchestrator/processes/create/process/menu` | |
| Render a user_input_form | Allow access to input steps | `/orchestrator/processes/user_inout/*` | Allow access to input_steps |
| Allow deletion of product blocks | Product block detail page | `/orchestrator/metadata/product-block/delete/*` | |
| Edit a product block | " " | `/orchestrator/metadata/product-block/edit/*` | |
| View a product block | Product block list page | `/orchestrator/metadata/prodcut-block/view/*` | |
| View a product | Product list page | `/orchestrator/metadata/product/view/*` | |
| Edit a product | Product detail page | `/orchestrator/metadata/product/edit/*` | |
| Delete a product | Product detail page | `/orchestrator/metadata/product/delete/*` | |

New actions or other actions can be enabled or disabled in the same way as menu items, by adding an arbitrary resource
to the project.


## Development tips

### IDE plugins


**Visual Studio Code**

* [vscode-styled-components](https://marketplace.visualstudio.com/items?itemName=styled-components.vscode-styled-components) for syntax highlighting `emotion/css`


- [vscode-styled-components](https://marketplace.visualstudio.com/items?itemName=styled-components.vscode-styled-components) for syntax highlighting `emotion/css`
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "workflow-client",
"version": "1.0.0",
"version": "10.6.0",
"private": false,
"license": "Apache-2.0",
"proxy": "http://localhost:8080",
Expand All @@ -15,8 +15,8 @@
"storybook": "start-storybook -p 9009 -s ./public",
"storybook-build": "build-storybook -s ./public",
"storybook-deploy": "PUBLIC_URL=https://workfloworchestrator.github.io/orchestrator-core-gui gh-pages -d storybook-static",
"prettier": "prettier -c \"{**/*.{js,jsx,scss,md,ts,tsx,json},public/**/*.html}\"",
"prettier-fix": "prettier --write \"{**/*.{js,jsx,scss,md,ts,tsx,json},public/**/*.html}\"",
"prettier": "prettier -c \"{**/*.{js,jsx,scss,md,ts,tsx,json},public/**/*.html,*.md}\"",
"prettier-fix": "prettier --write \"{**/*.{js,jsx,scss,md,ts,tsx,json},public/**/*.html,*.md}\"",
"extract": "formatjs extract",
"compile": "formatjs compile"
},
Expand Down
17 changes: 5 additions & 12 deletions src/custom-surf/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
OpenServiceTicketPayload,
ServiceTicket,
ServiceTicketBackgroundJobCount,
ServiceTicketImpactedIMSCircuit,
ServiceTicketProcessState,
ServiceTicketWithDetails,
} from "custom/types";
Expand Down Expand Up @@ -72,9 +71,8 @@ abstract class CustomApiClientInterface extends BaseApiClient {
abstract cimTicketById: (ticket_id: string) => Promise<ServiceTicketWithDetails>;
abstract cimPatchImpactedObject: (
ticket_id: string,
subscription_id: string,
circuit_id: number,
impactedObject: ServiceTicketImpactedIMSCircuit
index: number,
impact: string
) => Promise<ServiceTicketWithDetails>;
}

Expand Down Expand Up @@ -280,15 +278,10 @@ export class CustomApiClient extends CustomApiClientInterface {
);
};

cimPatchImpactedObject = (
ticket_id: string,
subscription_id: string,
circuit_id: number,
impactedObject: ServiceTicketImpactedIMSCircuit
): Promise<ServiceTicketWithDetails> => {
cimPatchImpactedObject = (ticket_id: string, index: number, impact: string): Promise<ServiceTicketWithDetails> => {
return this.postPutJson(
prefix_cim_dev_uri(`surf/cim/objects/${ticket_id}/subscription/${subscription_id}/circuit/${circuit_id}`),
impactedObject,
prefix_cim_dev_uri(`surf/cim/objects/${ticket_id}/${index}`),
{ impact_override: impact },
"patch",
true,
false
Expand Down
59 changes: 59 additions & 0 deletions src/custom-surf/components/cim/BackgroundJobLogs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { EuiBasicTable } from "@elastic/eui";
import { BackgroundJobLog } from "custom/types";
import { renderStringAsDateTime } from "custom/Utils";
import React, { Fragment } from "react";
import { WrappedComponentProps, injectIntl } from "react-intl";

interface IProps extends WrappedComponentProps {
data: BackgroundJobLog[];
}

const BackgroundJobLogs = ({ data }: IProps) => {
let columns = [
{
field: "entry_time",
name: "Date",
render: (entry_time: string, data: any) => renderStringAsDateTime(data.entry_time),
width: 200,
schema: "date",
},
{
field: "process_state",
name: "State",
truncateText: true,
sortable: true,
width: 100,
},
{
field: "message",
name: "Log message",
sortable: true,
truncateText: true,
width: "40%",
},
{
field: "subscription_id",
name: "Subscription ID",
sortable: true,
width: 200,
},
{
field: "customer ID",
name: "Customer ID",
sortable: true,
width: 200,
},
];

return (
<Fragment>
<EuiBasicTable
tableCaption={`Background jobs log table`}
items={data}
// @ts-ignore
columns={columns}
/>
</Fragment>
);
};
export default injectIntl(BackgroundJobLogs);
Loading

0 comments on commit 616aa5b

Please sign in to comment.