mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix(site): hide hidden apps in Tasks tabs (#24823)
## Summary - Exclude `hidden` workspace apps from the Tasks page app tabs. - Keep terminal link agent selection based on the full app list so hidden apps do not affect terminal routing. - Add a focused unit test covering hidden app filtering in `TaskApps`. ## Test plan - `pnpm --dir site test TaskApps.test.tsx` - `pnpm -C site exec biome check src/pages/TaskPage/TaskApps.tsx src/pages/TaskPage/TaskApps.test.tsx` Made with [Cursor](https://cursor.com)
This commit is contained in:
@@ -65,6 +65,19 @@ export const WithMixedApps: Story = {
|
||||
},
|
||||
};
|
||||
|
||||
export const WithHiddenApps: Story = {
|
||||
args: {
|
||||
task: mockTask,
|
||||
workspace: mockWorkspaceWithApps([
|
||||
mockEmbeddedApp("Visible App"),
|
||||
{
|
||||
...mockEmbeddedApp("Hidden App"),
|
||||
hidden: true,
|
||||
},
|
||||
]),
|
||||
},
|
||||
};
|
||||
|
||||
export const WithWildcardWarning: Story = {
|
||||
decorators: [
|
||||
withAuthProvider,
|
||||
|
||||
@@ -31,16 +31,17 @@ type TaskAppsProps = {
|
||||
const TERMINAL_TAB_ID = "terminal";
|
||||
|
||||
export const TaskApps: FC<TaskAppsProps> = ({ task, workspace }) => {
|
||||
const apps = getAllAppsWithAgent(workspace).filter(
|
||||
const allApps = getAllAppsWithAgent(workspace);
|
||||
const apps = allApps.filter(
|
||||
// The Chat UI app will be displayed in the sidebar, so we don't want to
|
||||
// show it as a web app.
|
||||
(app) => app.id !== task.workspace_app_id,
|
||||
(app) => app.id !== task.workspace_app_id && !app.hidden,
|
||||
);
|
||||
const [embeddedApps, externalApps] = splitEmbeddedAndExternalApps(apps);
|
||||
const [activeAppId, setActiveAppId] = useState(embeddedApps.at(0)?.id);
|
||||
const hasAvailableAppsToDisplay =
|
||||
embeddedApps.length > 0 || externalApps.length > 0;
|
||||
const taskAgent = apps.at(0)?.agent;
|
||||
const taskAgent = allApps.at(0)?.agent;
|
||||
const terminalHref = getTerminalHref({
|
||||
username: task.owner_name,
|
||||
workspace: task.workspace_name,
|
||||
|
||||
Reference in New Issue
Block a user