address feedback
Signed-off-by: williamwu-mongodb <william.t.wu@mongodb.com>
This commit is contained in:
@@ -25,8 +25,23 @@
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": "./src/index.ts",
|
||||
"./alpha": "./src/alpha.ts",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
"typesVersions": {
|
||||
"*": {
|
||||
"alpha": [
|
||||
"src/alpha.ts"
|
||||
],
|
||||
"package.json": [
|
||||
"package.json"
|
||||
]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
## API Report File for "@backstage/plugin-devtools-common"
|
||||
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
```ts
|
||||
import { BasicPermission } from '@backstage/plugin-permission-common';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
|
||||
// @alpha (undocumented)
|
||||
export const devToolsTaskSchedulerCreatePermission: BasicPermission;
|
||||
|
||||
// @alpha (undocumented)
|
||||
export const devToolsTaskSchedulerReadPermission: BasicPermission;
|
||||
|
||||
// @alpha (undocumented)
|
||||
export type ScheduledTasks = {
|
||||
scheduledTasks?: TaskApiTasksResponse[];
|
||||
error?: string;
|
||||
};
|
||||
|
||||
// @alpha
|
||||
export interface TaskApiTasksResponse {
|
||||
// (undocumented)
|
||||
pluginId: string;
|
||||
// (undocumented)
|
||||
scope: 'global' | 'local';
|
||||
// (undocumented)
|
||||
settings: {
|
||||
version: number;
|
||||
} & JsonObject;
|
||||
// (undocumented)
|
||||
taskId: string;
|
||||
// (undocumented)
|
||||
taskState:
|
||||
| {
|
||||
status: 'running';
|
||||
startedAt: string;
|
||||
timesOutAt?: string;
|
||||
lastRunError?: string;
|
||||
lastRunEndedAt?: string;
|
||||
}
|
||||
| {
|
||||
status: 'idle';
|
||||
startsAt?: string;
|
||||
lastRunError?: string;
|
||||
lastRunEndedAt?: string;
|
||||
}
|
||||
| null;
|
||||
// (undocumented)
|
||||
workerState:
|
||||
| {
|
||||
status: 'initial-wait';
|
||||
}
|
||||
| {
|
||||
status: 'idle';
|
||||
}
|
||||
| {
|
||||
status: 'running';
|
||||
}
|
||||
| null;
|
||||
}
|
||||
|
||||
// @alpha (undocumented)
|
||||
export type TriggerScheduledTask = {
|
||||
error?: string;
|
||||
};
|
||||
|
||||
// (No @packageDocumentation comment for this package)
|
||||
```
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
```ts
|
||||
import { BasicPermission } from '@backstage/plugin-permission-common';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
import { JsonValue } from '@backstage/types';
|
||||
|
||||
// @public (undocumented)
|
||||
@@ -45,12 +44,6 @@ export const devToolsInfoReadPermission: BasicPermission;
|
||||
// @public
|
||||
export const devToolsPermissions: BasicPermission[];
|
||||
|
||||
// @public (undocumented)
|
||||
export const devToolsTaskSchedulerCreatePermission: BasicPermission;
|
||||
|
||||
// @public (undocumented)
|
||||
export const devToolsTaskSchedulerReadPermission: BasicPermission;
|
||||
|
||||
// @public (undocumented)
|
||||
export type Endpoint = {
|
||||
name: string;
|
||||
@@ -90,57 +83,4 @@ export type PackageDependency = {
|
||||
name: string;
|
||||
versions: string;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type ScheduledTasks = {
|
||||
scheduledTasks?: TaskApiTasksResponse[];
|
||||
error?: string;
|
||||
};
|
||||
|
||||
// @public
|
||||
export interface TaskApiTasksResponse {
|
||||
// (undocumented)
|
||||
pluginId: string;
|
||||
// (undocumented)
|
||||
scope: 'global' | 'local';
|
||||
// (undocumented)
|
||||
settings: {
|
||||
version: number;
|
||||
} & JsonObject;
|
||||
// (undocumented)
|
||||
taskId: string;
|
||||
// (undocumented)
|
||||
taskState:
|
||||
| {
|
||||
status: 'running';
|
||||
startedAt: string;
|
||||
timesOutAt?: string;
|
||||
lastRunError?: string;
|
||||
lastRunEndedAt?: string;
|
||||
}
|
||||
| {
|
||||
status: 'idle';
|
||||
startsAt?: string;
|
||||
lastRunError?: string;
|
||||
lastRunEndedAt?: string;
|
||||
}
|
||||
| null;
|
||||
// (undocumented)
|
||||
workerState:
|
||||
| {
|
||||
status: 'initial-wait';
|
||||
}
|
||||
| {
|
||||
status: 'idle';
|
||||
}
|
||||
| {
|
||||
status: 'running';
|
||||
}
|
||||
| null;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export type TriggerScheduledTask = {
|
||||
error?: string;
|
||||
};
|
||||
```
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright 2025 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export {
|
||||
devToolsTaskSchedulerReadPermission,
|
||||
devToolsTaskSchedulerCreatePermission,
|
||||
} from './permissions';
|
||||
export type {
|
||||
ScheduledTasks,
|
||||
TaskApiTasksResponse,
|
||||
TriggerScheduledTask,
|
||||
} from './types';
|
||||
@@ -20,5 +20,19 @@
|
||||
* @packageDocumentation
|
||||
*/
|
||||
|
||||
export * from './types';
|
||||
export * from './permissions';
|
||||
export type {
|
||||
ConfigError,
|
||||
ConfigInfo,
|
||||
DevToolsInfo,
|
||||
Endpoint,
|
||||
ExternalDependency,
|
||||
PackageDependency,
|
||||
} from './types';
|
||||
export { ExternalDependencyStatus } from './types';
|
||||
export {
|
||||
devToolsAdministerPermission,
|
||||
devToolsConfigReadPermission,
|
||||
devToolsExternalDependenciesReadPermission,
|
||||
devToolsInfoReadPermission,
|
||||
devToolsPermissions,
|
||||
} from './permissions';
|
||||
|
||||
@@ -49,7 +49,7 @@ export const devToolsExternalDependenciesReadPermission = createPermission({
|
||||
});
|
||||
|
||||
/**
|
||||
* @public
|
||||
* @alpha
|
||||
*/
|
||||
export const devToolsTaskSchedulerReadPermission = createPermission({
|
||||
name: 'devtools.task-scheduler',
|
||||
@@ -57,7 +57,7 @@ export const devToolsTaskSchedulerReadPermission = createPermission({
|
||||
});
|
||||
|
||||
/**
|
||||
* @public
|
||||
* @alpha
|
||||
*/
|
||||
export const devToolsTaskSchedulerCreatePermission = createPermission({
|
||||
name: 'devtools.task-scheduler',
|
||||
@@ -74,6 +74,4 @@ export const devToolsPermissions = [
|
||||
devToolsInfoReadPermission,
|
||||
devToolsConfigReadPermission,
|
||||
devToolsExternalDependenciesReadPermission,
|
||||
devToolsTaskSchedulerReadPermission,
|
||||
devToolsTaskSchedulerCreatePermission,
|
||||
];
|
||||
|
||||
@@ -88,7 +88,7 @@ export type ConfigError = {
|
||||
* This is a duplication of the below:
|
||||
* @see https://github.com/backstage/backstage/blob/master/packages/backend-defaults/src/entrypoints/scheduler/lib/types.ts
|
||||
*
|
||||
* @public
|
||||
* @alpha
|
||||
*/
|
||||
export interface TaskApiTasksResponse {
|
||||
taskId: string;
|
||||
@@ -123,13 +123,13 @@ export interface TaskApiTasksResponse {
|
||||
| null;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
/** @alpha */
|
||||
export type ScheduledTasks = {
|
||||
scheduledTasks?: TaskApiTasksResponse[];
|
||||
error?: string;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
/** @alpha */
|
||||
export type TriggerScheduledTask = {
|
||||
error?: string;
|
||||
};
|
||||
|
||||
@@ -9,7 +9,7 @@ import { JSX as JSX_2 } from 'react/jsx-runtime';
|
||||
import { ReactNode } from 'react';
|
||||
import { RouteRef } from '@backstage/core-plugin-api';
|
||||
import { TabProps } from '@material-ui/core/Tab';
|
||||
import { TaskApiTasksResponse } from '@backstage/plugin-devtools-common';
|
||||
import { TaskApiTasksResponse } from '@backstage/plugin-devtools-common/alpha';
|
||||
|
||||
// @public (undocumented)
|
||||
export const ConfigContent: () => JSX_2.Element;
|
||||
|
||||
@@ -19,9 +19,11 @@ import {
|
||||
ConfigInfo,
|
||||
DevToolsInfo,
|
||||
ExternalDependency,
|
||||
} from '@backstage/plugin-devtools-common';
|
||||
import {
|
||||
ScheduledTasks,
|
||||
TriggerScheduledTask,
|
||||
} from '@backstage/plugin-devtools-common';
|
||||
} from '@backstage/plugin-devtools-common/alpha';
|
||||
|
||||
export const devToolsApiRef = createApiRef<DevToolsApi>({
|
||||
id: 'plugin.devtools.service',
|
||||
|
||||
@@ -19,9 +19,11 @@ import {
|
||||
ConfigInfo,
|
||||
DevToolsInfo,
|
||||
ExternalDependency,
|
||||
} from '@backstage/plugin-devtools-common';
|
||||
import {
|
||||
ScheduledTasks,
|
||||
TriggerScheduledTask,
|
||||
} from '@backstage/plugin-devtools-common';
|
||||
} from '@backstage/plugin-devtools-common/alpha';
|
||||
import { ResponseError } from '@backstage/errors';
|
||||
import { DevToolsApi } from './DevToolsApi';
|
||||
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { TaskApiTasksResponse } from '@backstage/plugin-devtools-common';
|
||||
import { TaskApiTasksResponse } from '@backstage/plugin-devtools-common/alpha';
|
||||
import Grid from '@material-ui/core/Grid';
|
||||
import Typography from '@material-ui/core/Typography';
|
||||
import Box from '@material-ui/core/Box';
|
||||
|
||||
+35
-13
@@ -22,18 +22,23 @@ import Tooltip from '@material-ui/core/Tooltip';
|
||||
import Autocomplete from '@material-ui/lab/Autocomplete';
|
||||
import TextField from '@material-ui/core/TextField';
|
||||
import { makeStyles, createStyles, Theme } from '@material-ui/core/styles';
|
||||
import { Progress, Table, TableColumn } from '@backstage/core-components';
|
||||
import {
|
||||
ErrorPanel,
|
||||
Progress,
|
||||
Table,
|
||||
TableColumn,
|
||||
} from '@backstage/core-components';
|
||||
import Alert from '@material-ui/lab/Alert';
|
||||
import { useScheduledTasks, useTriggerScheduledTask } from '../../../hooks';
|
||||
import { TaskApiTasksResponse } from '@backstage/plugin-devtools-common';
|
||||
import { TaskApiTasksResponse } from '@backstage/plugin-devtools-common/alpha';
|
||||
import { alertApiRef, configApiRef, useApi } from '@backstage/core-plugin-api';
|
||||
import RefreshIcon from '@material-ui/icons/Refresh';
|
||||
import NightsStay from '@material-ui/icons/NightsStay';
|
||||
import Error from '@material-ui/icons/Error';
|
||||
import ErrorIcon from '@material-ui/icons/Error';
|
||||
import CircularProgress from '@material-ui/core/CircularProgress';
|
||||
import { ScheduledTaskDetailPanel } from './ScheduledTaskDetailedPanel';
|
||||
import { RequirePermission } from '@backstage/plugin-permission-react';
|
||||
import { devToolsTaskSchedulerCreatePermission } from '@backstage/plugin-devtools-common';
|
||||
import { devToolsTaskSchedulerCreatePermission } from '@backstage/plugin-devtools-common/alpha';
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) =>
|
||||
createStyles({
|
||||
@@ -141,7 +146,7 @@ export const ScheduledTasksContent = () => {
|
||||
return (
|
||||
<Box display="flex" alignItems="center">
|
||||
{rowData.taskState?.lastRunError && (
|
||||
<Error style={errorIconStyle} />
|
||||
<ErrorIcon style={errorIconStyle} />
|
||||
)}
|
||||
<Typography>{rowData.taskId}</Typography>
|
||||
</Box>
|
||||
@@ -197,11 +202,9 @@ export const ScheduledTasksContent = () => {
|
||||
<Tooltip title="Run Task">
|
||||
<IconButton
|
||||
aria-label="Trigger"
|
||||
disabled={isTriggering}
|
||||
onClick={() => {
|
||||
triggerTask(selectedPlugin, rowData.taskId);
|
||||
if (isTriggering) {
|
||||
<CircularProgress color="inherit" size="30px" />;
|
||||
}
|
||||
if (triggerError) {
|
||||
alertApi.post({
|
||||
message: `Error triggering task ${rowData.taskId}: ${error}`,
|
||||
@@ -252,11 +255,30 @@ export const ScheduledTasksContent = () => {
|
||||
{loading && <Progress />}
|
||||
|
||||
{error && (
|
||||
<Alert severity="warning">
|
||||
The plugin ID "{selectedPlugin}" doesn't have any scheduled tasks or
|
||||
may contain a typo. Please verify the plugin ID is correct and that
|
||||
the plugin has registered scheduled tasks.
|
||||
</Alert>
|
||||
<ErrorPanel
|
||||
error={new Error(`No scheduled tasks found for "${selectedPlugin}"`)}
|
||||
title="No Scheduled Tasks Found"
|
||||
>
|
||||
<Typography variant="body2">
|
||||
The plugin ID "{selectedPlugin}" doesn't have any scheduled tasks or
|
||||
may contain a typo.
|
||||
</Typography>
|
||||
<Typography variant="body2" style={{ marginTop: 8 }}>
|
||||
Please verify:
|
||||
</Typography>
|
||||
<ul>
|
||||
<li>
|
||||
<Typography variant="body2">
|
||||
The plugin ID is spelled correctly
|
||||
</Typography>
|
||||
</li>
|
||||
<li>
|
||||
<Typography variant="body2">
|
||||
The plugin has registered scheduled tasks
|
||||
</Typography>
|
||||
</li>
|
||||
</ul>
|
||||
</ErrorPanel>
|
||||
)}
|
||||
|
||||
{!loading && !error && (
|
||||
|
||||
@@ -17,9 +17,8 @@
|
||||
import {
|
||||
devToolsConfigReadPermission,
|
||||
devToolsInfoReadPermission,
|
||||
devToolsTaskSchedulerReadPermission,
|
||||
} from '@backstage/plugin-devtools-common';
|
||||
|
||||
import { devToolsTaskSchedulerReadPermission } from '@backstage/plugin-devtools-common/alpha';
|
||||
import { ConfigContent } from '../Content/ConfigContent';
|
||||
import { DevToolsLayout } from '../DevToolsLayout';
|
||||
import { InfoContent } from '../Content/InfoContent';
|
||||
|
||||
Reference in New Issue
Block a user