@backstage-community/plugin-servicenow 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +34 -0
- package/dist/api/ServiceNowBackendClient.esm.js +45 -0
- package/dist/api/ServiceNowBackendClient.esm.js.map +1 -0
- package/dist/components/Servicenow/ClosedIcon.esm.js +14 -0
- package/dist/components/Servicenow/ClosedIcon.esm.js.map +1 -0
- package/dist/components/Servicenow/CustomSvgIcon.esm.js +13 -0
- package/dist/components/Servicenow/CustomSvgIcon.esm.js.map +1 -0
- package/dist/components/Servicenow/InProgressIcon.esm.js +14 -0
- package/dist/components/Servicenow/InProgressIcon.esm.js.map +1 -0
- package/dist/components/Servicenow/IncidentsFilter.esm.js +69 -0
- package/dist/components/Servicenow/IncidentsFilter.esm.js.map +1 -0
- package/dist/components/Servicenow/IncidentsListColumns.esm.js +43 -0
- package/dist/components/Servicenow/IncidentsListColumns.esm.js.map +1 -0
- package/dist/components/Servicenow/IncidentsTableBody.esm.js +28 -0
- package/dist/components/Servicenow/IncidentsTableBody.esm.js.map +1 -0
- package/dist/components/Servicenow/IncidentsTableHeader.esm.js +44 -0
- package/dist/components/Servicenow/IncidentsTableHeader.esm.js.map +1 -0
- package/dist/components/Servicenow/IncidentsTableRow.esm.js +54 -0
- package/dist/components/Servicenow/IncidentsTableRow.esm.js.map +1 -0
- package/dist/components/Servicenow/ModerateIcon.esm.js +14 -0
- package/dist/components/Servicenow/ModerateIcon.esm.js.map +1 -0
- package/dist/components/Servicenow/ServicenowContent.esm.js +196 -0
- package/dist/components/Servicenow/ServicenowContent.esm.js.map +1 -0
- package/dist/components/Servicenow/index.esm.js +2 -0
- package/dist/components/Servicenow/index.esm.js.map +1 -0
- package/dist/components/shared-components/IncidentEnumFilter.esm.js +79 -0
- package/dist/components/shared-components/IncidentEnumFilter.esm.js.map +1 -0
- package/dist/hooks/useDebouncedValue.esm.js +13 -0
- package/dist/hooks/useDebouncedValue.esm.js.map +1 -0
- package/dist/hooks/useQueryArrayFilter.esm.js +38 -0
- package/dist/hooks/useQueryArrayFilter.esm.js.map +1 -0
- package/dist/hooks/useQueryArrayState.esm.js +44 -0
- package/dist/hooks/useQueryArrayState.esm.js.map +1 -0
- package/dist/hooks/useQueryHelpers.esm.js +24 -0
- package/dist/hooks/useQueryHelpers.esm.js.map +1 -0
- package/dist/hooks/useQueryState.esm.js +50 -0
- package/dist/hooks/useQueryState.esm.js.map +1 -0
- package/dist/hooks/useUserEmail.esm.js +22 -0
- package/dist/hooks/useUserEmail.esm.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.esm.js +2 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/plugin.esm.js +43 -0
- package/dist/plugin.esm.js.map +1 -0
- package/dist/routes.esm.js +8 -0
- package/dist/routes.esm.js.map +1 -0
- package/dist/types.esm.js +13 -0
- package/dist/types.esm.js.map +1 -0
- package/dist/utils/incidentUtils.esm.js +58 -0
- package/dist/utils/incidentUtils.esm.js.map +1 -0
- package/dist/utils/queryParamsUtils.esm.js +37 -0
- package/dist/utils/queryParamsUtils.esm.js.map +1 -0
- package/dist/utils/stringUtils.esm.js +13 -0
- package/dist/utils/stringUtils.esm.js.map +1 -0
- package/package.json +88 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { createPlugin, createApiFactory, identityApiRef, fetchApiRef, discoveryApiRef, createRoutableExtension } from '@backstage/core-plugin-api';
|
|
2
|
+
import { rootRouteRef } from './routes.esm.js';
|
|
3
|
+
import { ServiceNowBackendClient, serviceNowApiRef } from './api/ServiceNowBackendClient.esm.js';
|
|
4
|
+
import { parseEntityRef, stringifyEntityRef } from '@backstage/catalog-model';
|
|
5
|
+
|
|
6
|
+
const servicenowPlugin = createPlugin({
|
|
7
|
+
id: "servicenow",
|
|
8
|
+
apis: [
|
|
9
|
+
createApiFactory({
|
|
10
|
+
api: serviceNowApiRef,
|
|
11
|
+
deps: {
|
|
12
|
+
discoveryApi: discoveryApiRef,
|
|
13
|
+
fetchApi: fetchApiRef,
|
|
14
|
+
identityApi: identityApiRef
|
|
15
|
+
},
|
|
16
|
+
factory: ({ discoveryApi, fetchApi, identityApi }) => new ServiceNowBackendClient(discoveryApi, fetchApi, identityApi)
|
|
17
|
+
})
|
|
18
|
+
],
|
|
19
|
+
routes: {
|
|
20
|
+
root: rootRouteRef
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const ServicenowPage = servicenowPlugin.provide(
|
|
24
|
+
createRoutableExtension({
|
|
25
|
+
name: "ServicenowPage",
|
|
26
|
+
component: () => import('./components/Servicenow/index.esm.js').then((m) => m.ServicenowContent),
|
|
27
|
+
mountPoint: rootRouteRef
|
|
28
|
+
})
|
|
29
|
+
);
|
|
30
|
+
const isMyProfile = (entity) => {
|
|
31
|
+
const currentUserRef = localStorage.getItem("userEntityRef");
|
|
32
|
+
if (!currentUserRef) return false;
|
|
33
|
+
try {
|
|
34
|
+
const a = parseEntityRef(currentUserRef);
|
|
35
|
+
const b = parseEntityRef(stringifyEntityRef(entity));
|
|
36
|
+
return a.kind.toLowerCase() === b.kind.toLowerCase() && a.namespace.toLowerCase() === b.namespace.toLowerCase() && a.name.toLowerCase() === b.name.toLowerCase();
|
|
37
|
+
} catch {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export { ServicenowPage, isMyProfile, servicenowPlugin };
|
|
43
|
+
//# sourceMappingURL=plugin.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n createApiFactory,\n createPlugin,\n createRoutableExtension,\n discoveryApiRef,\n fetchApiRef,\n identityApiRef,\n} from '@backstage/core-plugin-api';\n\nimport { rootRouteRef } from './routes';\nimport {\n serviceNowApiRef,\n ServiceNowBackendClient,\n} from './api/ServiceNowBackendClient';\n\nimport {\n Entity,\n parseEntityRef,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\n\n/**\n * Servicenow Plugin\n * @public\n */\nexport const servicenowPlugin = createPlugin({\n id: 'servicenow',\n apis: [\n createApiFactory({\n api: serviceNowApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n fetchApi: fetchApiRef,\n identityApi: identityApiRef,\n },\n factory: ({ discoveryApi, fetchApi, identityApi }) =>\n new ServiceNowBackendClient(discoveryApi, fetchApi, identityApi),\n }),\n ],\n routes: {\n root: rootRouteRef,\n },\n});\n\n/**\n * Servicenow Page\n * @public\n */\nexport const ServicenowPage = servicenowPlugin.provide(\n createRoutableExtension({\n name: 'ServicenowPage',\n component: () =>\n import('./components/Servicenow').then(m => m.ServicenowContent),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @public\n * Check if the current entity is the logged-in user\n */\n\nexport const isMyProfile = (entity: Entity): boolean => {\n const currentUserRef = localStorage.getItem('userEntityRef');\n if (!currentUserRef) return false;\n\n try {\n const a = parseEntityRef(currentUserRef);\n const b = parseEntityRef(stringifyEntityRef(entity));\n return (\n a.kind.toLowerCase() === b.kind.toLowerCase() &&\n a.namespace.toLowerCase() === b.namespace.toLowerCase() &&\n a.name.toLowerCase() === b.name.toLowerCase()\n );\n } catch {\n return false;\n }\n};\n"],"names":[],"mappings":";;;;;AAwCO,MAAM,mBAAmB,YAAa,CAAA;AAAA,EAC3C,EAAI,EAAA,YAAA;AAAA,EACJ,IAAM,EAAA;AAAA,IACJ,gBAAiB,CAAA;AAAA,MACf,GAAK,EAAA,gBAAA;AAAA,MACL,IAAM,EAAA;AAAA,QACJ,YAAc,EAAA,eAAA;AAAA,QACd,QAAU,EAAA,WAAA;AAAA,QACV,WAAa,EAAA;AAAA,OACf;AAAA,MACA,OAAA,EAAS,CAAC,EAAE,YAAc,EAAA,QAAA,EAAU,WAAY,EAAA,KAC9C,IAAI,uBAAA,CAAwB,YAAc,EAAA,QAAA,EAAU,WAAW;AAAA,KAClE;AAAA,GACH;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA;AAAA;AAEV,CAAC;AAMM,MAAM,iBAAiB,gBAAiB,CAAA,OAAA;AAAA,EAC7C,uBAAwB,CAAA;AAAA,IACtB,IAAM,EAAA,gBAAA;AAAA,IACN,SAAA,EAAW,MACT,OAAO,sCAAyB,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,iBAAiB,CAAA;AAAA,IACjE,UAAY,EAAA;AAAA,GACb;AACH;AAOa,MAAA,WAAA,GAAc,CAAC,MAA4B,KAAA;AACtD,EAAM,MAAA,cAAA,GAAiB,YAAa,CAAA,OAAA,CAAQ,eAAe,CAAA;AAC3D,EAAI,IAAA,CAAC,gBAAuB,OAAA,KAAA;AAE5B,EAAI,IAAA;AACF,IAAM,MAAA,CAAA,GAAI,eAAe,cAAc,CAAA;AACvC,IAAA,MAAM,CAAI,GAAA,cAAA,CAAe,kBAAmB,CAAA,MAAM,CAAC,CAAA;AACnD,IACE,OAAA,CAAA,CAAE,KAAK,WAAY,EAAA,KAAM,EAAE,IAAK,CAAA,WAAA,EAChC,IAAA,CAAA,CAAE,SAAU,CAAA,WAAA,OAAkB,CAAE,CAAA,SAAA,CAAU,aAC1C,IAAA,CAAA,CAAE,KAAK,WAAY,EAAA,KAAM,CAAE,CAAA,IAAA,CAAK,WAAY,EAAA;AAAA,GAExC,CAAA,MAAA;AACN,IAAO,OAAA,KAAA;AAAA;AAEX;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes.esm.js","sources":["../src/routes.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { createRouteRef } from '@backstage/core-plugin-api';\n\nexport const rootRouteRef = createRouteRef({\n id: 'servicenow',\n});\n"],"names":[],"mappings":";;AAiBO,MAAM,eAAe,cAAe,CAAA;AAAA,EACzC,EAAI,EAAA;AACN,CAAC;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IncidentFieldEnum } from '@backstage-community/plugin-servicenow-common';
|
|
2
|
+
|
|
3
|
+
const IncidentTableFieldEnum = {
|
|
4
|
+
Created: IncidentFieldEnum.Created,
|
|
5
|
+
IncidentState: IncidentFieldEnum.IncidentState,
|
|
6
|
+
Number: IncidentFieldEnum.Number,
|
|
7
|
+
Priority: IncidentFieldEnum.Priority,
|
|
8
|
+
ShortDescription: IncidentFieldEnum.ShortDescription,
|
|
9
|
+
Url: IncidentFieldEnum.Url
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { IncidentTableFieldEnum };
|
|
13
|
+
//# sourceMappingURL=types.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.esm.js","sources":["../src/types.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { IncidentFieldEnum } from '@backstage-community/plugin-servicenow-common';\n\nexport type IncidentsData = {\n sysId: string;\n number: string;\n shortDescription: string;\n description: string;\n sysCreatedOn: string;\n priority: number;\n incidentState: number;\n url: string;\n};\n\nexport type IncidentTableFieldEnumType = Omit<\n typeof IncidentFieldEnum,\n 'Description'\n>;\n\nexport const IncidentTableFieldEnum: IncidentTableFieldEnumType = {\n Created: IncidentFieldEnum.Created,\n IncidentState: IncidentFieldEnum.IncidentState,\n Number: IncidentFieldEnum.Number,\n Priority: IncidentFieldEnum.Priority,\n ShortDescription: IncidentFieldEnum.ShortDescription,\n Url: IncidentFieldEnum.Url,\n};\n\nexport type IncidentTableField =\n (typeof IncidentTableFieldEnum)[keyof typeof IncidentTableFieldEnum];\n\nexport type PaginatedIncidentsData = {\n incidents: IncidentsData[];\n totalCount: number;\n};\n"],"names":[],"mappings":";;AAkCO,MAAM,sBAAqD,GAAA;AAAA,EAChE,SAAS,iBAAkB,CAAA,OAAA;AAAA,EAC3B,eAAe,iBAAkB,CAAA,aAAA;AAAA,EACjC,QAAQ,iBAAkB,CAAA,MAAA;AAAA,EAC1B,UAAU,iBAAkB,CAAA,QAAA;AAAA,EAC5B,kBAAkB,iBAAkB,CAAA,gBAAA;AAAA,EACpC,KAAK,iBAAkB,CAAA;AACzB;;;;"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import LabelImportantIcon from '@mui/icons-material/LabelImportant';
|
|
3
|
+
import KeyboardDoubleArrowDownIcon from '@mui/icons-material/KeyboardDoubleArrowDown';
|
|
4
|
+
import KeyboardDoubleArrowUpIcon from '@mui/icons-material/KeyboardDoubleArrowUp';
|
|
5
|
+
import FormatListNumberedIcon from '@mui/icons-material/FormatListNumbered';
|
|
6
|
+
import PendingOutlinedIcon from '@mui/icons-material/PendingOutlined';
|
|
7
|
+
import CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline';
|
|
8
|
+
import PauseCircleOutlineIcon from '@mui/icons-material/PauseCircleOutline';
|
|
9
|
+
import { ModerateIcon } from '../components/Servicenow/ModerateIcon.esm.js';
|
|
10
|
+
import { InProgressIcon } from '../components/Servicenow/InProgressIcon.esm.js';
|
|
11
|
+
import { ClosedIcon } from '../components/Servicenow/ClosedIcon.esm.js';
|
|
12
|
+
import Typography from '@mui/material/Typography';
|
|
13
|
+
|
|
14
|
+
const iconStyleBase = { marginRight: 8 };
|
|
15
|
+
const typographyStyleBase = { display: "flex", alignItems: "center" };
|
|
16
|
+
const PRIORITY_MAP = {
|
|
17
|
+
1: {
|
|
18
|
+
Icon: LabelImportantIcon,
|
|
19
|
+
color: "#C9190B",
|
|
20
|
+
label: "Critical",
|
|
21
|
+
transform: "rotate(-90deg)"
|
|
22
|
+
},
|
|
23
|
+
2: { Icon: KeyboardDoubleArrowUpIcon, color: "#EC7A08", label: "High" },
|
|
24
|
+
3: { Icon: ModerateIcon, color: "#F0AB00", label: "Moderate" },
|
|
25
|
+
4: { Icon: KeyboardDoubleArrowDownIcon, color: "#2B9AF3", label: "Low" },
|
|
26
|
+
5: { Icon: FormatListNumberedIcon, color: "#6A6E73", label: "Planning" }
|
|
27
|
+
};
|
|
28
|
+
const INCIDENT_STATE_MAP = {
|
|
29
|
+
1: { Icon: PendingOutlinedIcon, color: "#6A6E73", label: "New" },
|
|
30
|
+
2: { Icon: InProgressIcon, color: "#6A6E73", label: "In Progress" },
|
|
31
|
+
3: { Icon: PauseCircleOutlineIcon, color: "#6A6E73", label: "On Hold" },
|
|
32
|
+
6: { Icon: CheckCircleOutlineIcon, color: "#3E8635", label: "Resolved" },
|
|
33
|
+
7: { Icon: ClosedIcon, color: "#6A6E73", label: "Closed" },
|
|
34
|
+
8: { Icon: ClosedIcon, color: "#6A6E73", label: "Cancelled" }
|
|
35
|
+
};
|
|
36
|
+
const renderStatusLabel = (data) => {
|
|
37
|
+
if (!data) return "";
|
|
38
|
+
const { Icon, color, label, transform } = data;
|
|
39
|
+
return /* @__PURE__ */ jsxs(Typography, { variant: "body2", style: typographyStyleBase, children: [
|
|
40
|
+
/* @__PURE__ */ jsx(
|
|
41
|
+
Icon,
|
|
42
|
+
{
|
|
43
|
+
fontSize: "small",
|
|
44
|
+
style: {
|
|
45
|
+
color,
|
|
46
|
+
marginRight: iconStyleBase.marginRight,
|
|
47
|
+
...transform ? { transform } : {}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
),
|
|
51
|
+
label
|
|
52
|
+
] });
|
|
53
|
+
};
|
|
54
|
+
const getPriorityValue = (priority) => renderStatusLabel(PRIORITY_MAP[priority]);
|
|
55
|
+
const getIncidentStateValue = (state) => renderStatusLabel(INCIDENT_STATE_MAP[state]);
|
|
56
|
+
|
|
57
|
+
export { INCIDENT_STATE_MAP, PRIORITY_MAP, getIncidentStateValue, getPriorityValue, renderStatusLabel };
|
|
58
|
+
//# sourceMappingURL=incidentUtils.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"incidentUtils.esm.js","sources":["../../src/utils/incidentUtils.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { ElementType } from 'react';\nimport LabelImportantIcon from '@mui/icons-material/LabelImportant';\nimport KeyboardDoubleArrowDownIcon from '@mui/icons-material/KeyboardDoubleArrowDown';\nimport KeyboardDoubleArrowUpIcon from '@mui/icons-material/KeyboardDoubleArrowUp';\nimport FormatListNumberedIcon from '@mui/icons-material/FormatListNumbered';\nimport PendingOutlinedIcon from '@mui/icons-material/PendingOutlined';\nimport CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline';\nimport PauseCircleOutlineIcon from '@mui/icons-material/PauseCircleOutline';\nimport { ModerateIcon } from '../components/Servicenow/ModerateIcon';\nimport { InProgressIcon } from '../components/Servicenow/InProgressIcon';\nimport { ClosedIcon } from '../components/Servicenow/ClosedIcon';\n\nimport Typography from '@mui/material/Typography';\n\ninterface StatusData {\n Icon: ElementType;\n color: string;\n label: string;\n transform?: string;\n}\n\nconst iconStyleBase = { marginRight: 8 };\nconst typographyStyleBase = { display: 'flex', alignItems: 'center' };\n\nexport const PRIORITY_MAP: Record<number, StatusData> = {\n 1: {\n Icon: LabelImportantIcon,\n color: '#C9190B',\n label: 'Critical',\n transform: 'rotate(-90deg)',\n },\n 2: { Icon: KeyboardDoubleArrowUpIcon, color: '#EC7A08', label: 'High' },\n 3: { Icon: ModerateIcon, color: '#F0AB00', label: 'Moderate' },\n 4: { Icon: KeyboardDoubleArrowDownIcon, color: '#2B9AF3', label: 'Low' },\n 5: { Icon: FormatListNumberedIcon, color: '#6A6E73', label: 'Planning' },\n};\n\nexport const INCIDENT_STATE_MAP: Record<number, StatusData> = {\n 1: { Icon: PendingOutlinedIcon, color: '#6A6E73', label: 'New' },\n 2: { Icon: InProgressIcon, color: '#6A6E73', label: 'In Progress' },\n 3: { Icon: PauseCircleOutlineIcon, color: '#6A6E73', label: 'On Hold' },\n 6: { Icon: CheckCircleOutlineIcon, color: '#3E8635', label: 'Resolved' },\n 7: { Icon: ClosedIcon, color: '#6A6E73', label: 'Closed' },\n 8: { Icon: ClosedIcon, color: '#6A6E73', label: 'Cancelled' },\n};\n\nexport const renderStatusLabel = (data?: StatusData) => {\n if (!data) return '';\n\n const { Icon, color, label, transform } = data;\n return (\n <Typography variant=\"body2\" style={typographyStyleBase}>\n <Icon\n fontSize=\"small\"\n style={{\n color,\n marginRight: iconStyleBase.marginRight,\n ...(transform ? { transform } : {}),\n }}\n />\n {label}\n </Typography>\n );\n};\n\nexport const getPriorityValue = (priority: number) =>\n renderStatusLabel(PRIORITY_MAP[priority]);\nexport const getIncidentStateValue = (state: number) =>\n renderStatusLabel(INCIDENT_STATE_MAP[state]);\n"],"names":[],"mappings":";;;;;;;;;;;;;AAoCA,MAAM,aAAA,GAAgB,EAAE,WAAA,EAAa,CAAE,EAAA;AACvC,MAAM,mBAAsB,GAAA,EAAE,OAAS,EAAA,MAAA,EAAQ,YAAY,QAAS,EAAA;AAE7D,MAAM,YAA2C,GAAA;AAAA,EACtD,CAAG,EAAA;AAAA,IACD,IAAM,EAAA,kBAAA;AAAA,IACN,KAAO,EAAA,SAAA;AAAA,IACP,KAAO,EAAA,UAAA;AAAA,IACP,SAAW,EAAA;AAAA,GACb;AAAA,EACA,GAAG,EAAE,IAAA,EAAM,2BAA2B,KAAO,EAAA,SAAA,EAAW,OAAO,MAAO,EAAA;AAAA,EACtE,GAAG,EAAE,IAAA,EAAM,cAAc,KAAO,EAAA,SAAA,EAAW,OAAO,UAAW,EAAA;AAAA,EAC7D,GAAG,EAAE,IAAA,EAAM,6BAA6B,KAAO,EAAA,SAAA,EAAW,OAAO,KAAM,EAAA;AAAA,EACvE,GAAG,EAAE,IAAA,EAAM,wBAAwB,KAAO,EAAA,SAAA,EAAW,OAAO,UAAW;AACzE;AAEO,MAAM,kBAAiD,GAAA;AAAA,EAC5D,GAAG,EAAE,IAAA,EAAM,qBAAqB,KAAO,EAAA,SAAA,EAAW,OAAO,KAAM,EAAA;AAAA,EAC/D,GAAG,EAAE,IAAA,EAAM,gBAAgB,KAAO,EAAA,SAAA,EAAW,OAAO,aAAc,EAAA;AAAA,EAClE,GAAG,EAAE,IAAA,EAAM,wBAAwB,KAAO,EAAA,SAAA,EAAW,OAAO,SAAU,EAAA;AAAA,EACtE,GAAG,EAAE,IAAA,EAAM,wBAAwB,KAAO,EAAA,SAAA,EAAW,OAAO,UAAW,EAAA;AAAA,EACvE,GAAG,EAAE,IAAA,EAAM,YAAY,KAAO,EAAA,SAAA,EAAW,OAAO,QAAS,EAAA;AAAA,EACzD,GAAG,EAAE,IAAA,EAAM,YAAY,KAAO,EAAA,SAAA,EAAW,OAAO,WAAY;AAC9D;AAEa,MAAA,iBAAA,GAAoB,CAAC,IAAsB,KAAA;AACtD,EAAI,IAAA,CAAC,MAAa,OAAA,EAAA;AAElB,EAAA,MAAM,EAAE,IAAA,EAAM,KAAO,EAAA,KAAA,EAAO,WAAc,GAAA,IAAA;AAC1C,EAAA,uBACG,IAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EAAQ,OAAO,mBACjC,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,IAAA;AAAA,MAAA;AAAA,QACC,QAAS,EAAA,OAAA;AAAA,QACT,KAAO,EAAA;AAAA,UACL,KAAA;AAAA,UACA,aAAa,aAAc,CAAA,WAAA;AAAA,UAC3B,GAAI,SAAA,GAAY,EAAE,SAAA,KAAc;AAAC;AACnC;AAAA,KACF;AAAA,IACC;AAAA,GACH,EAAA,CAAA;AAEJ;AAEO,MAAM,mBAAmB,CAAC,QAAA,KAC/B,iBAAkB,CAAA,YAAA,CAAa,QAAQ,CAAC;AACnC,MAAM,wBAAwB,CAAC,KAAA,KACpC,iBAAkB,CAAA,kBAAA,CAAmB,KAAK,CAAC;;;;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
function buildIncidentQueryParams({
|
|
2
|
+
userEmail,
|
|
3
|
+
entityId,
|
|
4
|
+
limit,
|
|
5
|
+
offset,
|
|
6
|
+
order,
|
|
7
|
+
orderBy,
|
|
8
|
+
search,
|
|
9
|
+
priority,
|
|
10
|
+
state
|
|
11
|
+
}) {
|
|
12
|
+
const params = {
|
|
13
|
+
order,
|
|
14
|
+
orderBy,
|
|
15
|
+
limit: String(limit),
|
|
16
|
+
offset: String(offset)
|
|
17
|
+
};
|
|
18
|
+
if (priority?.length) {
|
|
19
|
+
params.priority = `IN${priority.join(",")}`;
|
|
20
|
+
}
|
|
21
|
+
if (state?.length) {
|
|
22
|
+
params.state = `IN${state.join(",")}`;
|
|
23
|
+
}
|
|
24
|
+
if (search) {
|
|
25
|
+
params.search = search;
|
|
26
|
+
}
|
|
27
|
+
if (entityId) {
|
|
28
|
+
params.entityId = entityId;
|
|
29
|
+
}
|
|
30
|
+
if (userEmail) {
|
|
31
|
+
params.userEmail = userEmail;
|
|
32
|
+
}
|
|
33
|
+
return new URLSearchParams(params);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { buildIncidentQueryParams };
|
|
37
|
+
//# sourceMappingURL=queryParamsUtils.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queryParamsUtils.esm.js","sources":["../../src/utils/queryParamsUtils.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { IncidentTableField } from '../types';\n\nexport function buildIncidentQueryParams({\n userEmail,\n entityId,\n limit,\n offset,\n order,\n orderBy,\n search,\n priority,\n state,\n}: {\n limit: number;\n offset: number;\n order: 'asc' | 'desc';\n orderBy: IncidentTableField;\n search?: string;\n priority?: string[];\n state?: string[];\n userEmail?: string;\n entityId?: string;\n}) {\n const params: Record<string, string> = {\n order,\n orderBy,\n limit: String(limit),\n offset: String(offset),\n };\n\n if (priority?.length) {\n params.priority = `IN${priority.join(',')}`;\n }\n\n if (state?.length) {\n params.state = `IN${state.join(',')}`;\n }\n\n if (search) {\n params.search = search;\n }\n\n if (entityId) {\n params.entityId = entityId;\n }\n\n if (userEmail) {\n params.userEmail = userEmail;\n }\n\n return new URLSearchParams(params);\n}\n"],"names":[],"mappings":"AAkBO,SAAS,wBAAyB,CAAA;AAAA,EACvC,SAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA,MAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA,EACA,MAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAUG,EAAA;AACD,EAAA,MAAM,MAAiC,GAAA;AAAA,IACrC,KAAA;AAAA,IACA,OAAA;AAAA,IACA,KAAA,EAAO,OAAO,KAAK,CAAA;AAAA,IACnB,MAAA,EAAQ,OAAO,MAAM;AAAA,GACvB;AAEA,EAAA,IAAI,UAAU,MAAQ,EAAA;AACpB,IAAA,MAAA,CAAO,QAAW,GAAA,CAAA,EAAA,EAAK,QAAS,CAAA,IAAA,CAAK,GAAG,CAAC,CAAA,CAAA;AAAA;AAG3C,EAAA,IAAI,OAAO,MAAQ,EAAA;AACjB,IAAA,MAAA,CAAO,KAAQ,GAAA,CAAA,EAAA,EAAK,KAAM,CAAA,IAAA,CAAK,GAAG,CAAC,CAAA,CAAA;AAAA;AAGrC,EAAA,IAAI,MAAQ,EAAA;AACV,IAAA,MAAA,CAAO,MAAS,GAAA,MAAA;AAAA;AAGlB,EAAA,IAAI,QAAU,EAAA;AACZ,IAAA,MAAA,CAAO,QAAW,GAAA,QAAA;AAAA;AAGpB,EAAA,IAAI,SAAW,EAAA;AACb,IAAA,MAAA,CAAO,SAAY,GAAA,SAAA;AAAA;AAGrB,EAAO,OAAA,IAAI,gBAAgB,MAAM,CAAA;AACnC;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const convertDateFormat = (created) => {
|
|
2
|
+
if (!created) return "";
|
|
3
|
+
const date = new Date(created.replace(" ", "T"));
|
|
4
|
+
if (isNaN(date.getTime())) return "";
|
|
5
|
+
return date.toLocaleDateString("en-US", {
|
|
6
|
+
year: "numeric",
|
|
7
|
+
month: "long",
|
|
8
|
+
day: "numeric"
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { convertDateFormat };
|
|
13
|
+
//# sourceMappingURL=stringUtils.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stringUtils.esm.js","sources":["../../src/utils/stringUtils.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const convertDateFormat = (created: string) => {\n if (!created) return '';\n\n const date = new Date(created.replace(' ', 'T'));\n\n if (isNaN(date.getTime())) return '';\n\n return date.toLocaleDateString('en-US', {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n });\n};\n"],"names":[],"mappings":"AAgBa,MAAA,iBAAA,GAAoB,CAAC,OAAoB,KAAA;AACpD,EAAI,IAAA,CAAC,SAAgB,OAAA,EAAA;AAErB,EAAA,MAAM,OAAO,IAAI,IAAA,CAAK,QAAQ,OAAQ,CAAA,GAAA,EAAK,GAAG,CAAC,CAAA;AAE/C,EAAA,IAAI,KAAM,CAAA,IAAA,CAAK,OAAQ,EAAC,GAAU,OAAA,EAAA;AAElC,EAAO,OAAA,IAAA,CAAK,mBAAmB,OAAS,EAAA;AAAA,IACtC,IAAM,EAAA,SAAA;AAAA,IACN,KAAO,EAAA,MAAA;AAAA,IACP,GAAK,EAAA;AAAA,GACN,CAAA;AACH;;;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@backstage-community/plugin-servicenow",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"main": "dist/index.esm.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public",
|
|
9
|
+
"main": "dist/index.esm.js",
|
|
10
|
+
"types": "dist/index.d.ts"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/backstage/community-plugins",
|
|
15
|
+
"directory": "workspaces/servicenow/plugins/servicenow"
|
|
16
|
+
},
|
|
17
|
+
"backstage": {
|
|
18
|
+
"role": "frontend-plugin",
|
|
19
|
+
"pluginId": "servicenow",
|
|
20
|
+
"pluginPackages": [
|
|
21
|
+
"@backstage-community/plugin-servicenow",
|
|
22
|
+
"@backstage-community/plugin-servicenow-backend",
|
|
23
|
+
"@backstage-community/plugin-servicenow-common"
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
"sideEffects": false,
|
|
27
|
+
"scripts": {
|
|
28
|
+
"start": "backstage-cli package start",
|
|
29
|
+
"build": "backstage-cli package build",
|
|
30
|
+
"lint": "backstage-cli package lint",
|
|
31
|
+
"test": "backstage-cli package test",
|
|
32
|
+
"clean": "backstage-cli package clean",
|
|
33
|
+
"prepack": "backstage-cli package prepack",
|
|
34
|
+
"postpack": "backstage-cli package postpack"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@backstage-community/plugin-servicenow-common": "^1.0.0",
|
|
38
|
+
"@backstage/catalog-model": "^1.7.4",
|
|
39
|
+
"@backstage/core-components": "^0.17.2",
|
|
40
|
+
"@backstage/core-plugin-api": "^1.10.7",
|
|
41
|
+
"@backstage/plugin-catalog-react": "^1.18.0",
|
|
42
|
+
"@backstage/theme": "^0.6.6",
|
|
43
|
+
"@mui/icons-material": "^5.15.17",
|
|
44
|
+
"@mui/lab": "^5.0.0-alpha.153",
|
|
45
|
+
"@mui/material": "^5.17.1",
|
|
46
|
+
"@mui/styles": "5.16.14",
|
|
47
|
+
"react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
48
|
+
"react-router-dom": "^6.0.0",
|
|
49
|
+
"react-use": "^17.2.4"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"react": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
53
|
+
"react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
54
|
+
"react-router-dom": "^6.0.0"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@backstage/cli": "^0.32.1",
|
|
58
|
+
"@backstage/core-app-api": "^1.17.0",
|
|
59
|
+
"@backstage/dev-utils": "^1.1.10",
|
|
60
|
+
"@backstage/test-utils": "^1.7.8",
|
|
61
|
+
"@material-ui/core": "^4.12.4",
|
|
62
|
+
"@testing-library/jest-dom": "^6.0.0",
|
|
63
|
+
"@testing-library/react": "^14.0.0",
|
|
64
|
+
"@testing-library/user-event": "^14.0.0",
|
|
65
|
+
"msw": "^1.0.0",
|
|
66
|
+
"react": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
67
|
+
"rxjs": "^7.8.2"
|
|
68
|
+
},
|
|
69
|
+
"files": [
|
|
70
|
+
"dist"
|
|
71
|
+
],
|
|
72
|
+
"bugs": "https://github.com/backstage/community-plugins/issues",
|
|
73
|
+
"maintainers": [
|
|
74
|
+
"@ciiay",
|
|
75
|
+
"@AndrienkoAleksandr",
|
|
76
|
+
"@PatAKnight",
|
|
77
|
+
"@christoph-jerolimov"
|
|
78
|
+
],
|
|
79
|
+
"author": "Red Hat",
|
|
80
|
+
"typesVersions": {
|
|
81
|
+
"*": {
|
|
82
|
+
"package.json": [
|
|
83
|
+
"package.json"
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"module": "./dist/index.esm.js"
|
|
88
|
+
}
|