Skip to content

Commit

Permalink
menu deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexMalakov committed Apr 25, 2024
1 parent 50f9b95 commit 810bd5e
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/widgets/lightbulb_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import JSONbigInt from 'json-bigint';

import './bulb.css';
import lightbulb_base_svg from '!svg-inline-loader!#src/images/lightbulb-base.svg';
import { NullarySignal } from 'neuroglancer/unstable/util/signal.js';

const br = () => document.createElement('br');
const JSONBS = JSONbigInt({storeAsString: true});
Expand Down Expand Up @@ -206,39 +207,40 @@ export class LightBulbService {
return bulb;
};

generateSection(segmentIDString : string) : HTMLDivElement{
generateSection(segmentIDString : string, queryURL: string) : HTMLDivElement{
const popup_body = document.createElement('div');

// const url = "https://cave.fanc-fly.com/neurons/api/v1/datastack/brain_and_nerve_cord/proofreading_status/root_id/";
// https://cave.fanc-fly.com/neurons/api/v1/datastack/brain_and_nerve_cord/proofreading_status?filter_by=root_id&as_json=1&ignore_bad_ids=True&filter_string=<COMMA SEPERATED VALUES>

(async () => {
const {url: parsedUrl, credentialsProvider} = parseSpecialUrl(
'middleauth+https://cave.fanc-fly.com/neurons/api/v1/datastack/brain_and_nerve_cord/proofreading_status/root_id/' + segmentIDString,
queryURL + segmentIDString,
defaultCredentialsManager,
);
const nodeStatuses = JSONBS.parse(await(cancellableFetchSpecialOk(credentialsProvider,parsedUrl,{},responseJsonString).then((val : string) => {
return val;
})));

const nodeStatuses = JSONBS.parse(await(cancellableFetchSpecialOk(credentialsProvider,parsedUrl,{},responseJsonString)));
popup_body.textContent = "Segment infoirmation: " + JSONBS.stringify(nodeStatuses);
})();

return popup_body;
}

makeMenu(parent: HTMLElement, segmentIDString: string): ContextMenu {
const contextMenu = new ContextMenu(parent);
let contextMenu : ContextMenu | undefined = new ContextMenu(parent);
const menu = contextMenu.element;
menu.style.left = `${parseInt(menu.style.left || '0') - 100}px`;
menu.classList.add(
'neuroglancer-layer-group-viewer-context-menu', 'nge_lbmenu');

menu.append(
br(),
this.generateSection(segmentIDString),
this.generateSection(segmentIDString, 'middleauth+https://cave.fanc-fly.com/neurons/api/v1/datastack/brain_and_nerve_cord/proofreading_status/root_id/'),
br(),
br(),
this.generateSection(segmentIDString, 'middleauth+https://cave.fanc-fly.com/neurons/api/v1/datastack/brain_and_nerve_cord/cell_identification?filter_by=root_id&as_json=1&ignore_bad_ids=True&filter_string='),
br(),
br());

const signal = new NullarySignal();
signal.add(() => {contextMenu = undefined}) //absolutely no idea if this will work but this is my best guess for right now???
contextMenu.closed = signal;
return contextMenu;
}
}
Expand Down

0 comments on commit 810bd5e

Please sign in to comment.