Skip to content

Commit

Permalink
Rossum SA ext: remove localUnleashOverrides functionality
Browse files Browse the repository at this point in the history
It is no longer needed as it was added directly to the product.
  • Loading branch information
mrtnzlml committed Sep 18, 2024
1 parent 0824bbb commit 1518740
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 120 deletions.
1 change: 0 additions & 1 deletion src/rossum-sa-extension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Head over to https://chrome.google.com/webstore/detail/bljkbinljmhdbipklfcljongi
- shows datapoint `schema_id` on the annotation screen (headers and line items)
- adds `devFeatureEnabled` toggle
- adds `devDebugEnabled` toggle
- supports displaying and changing `localUnleashOverrides` values

![header fields](./assets/header_fields.png)

Expand Down
33 changes: 2 additions & 31 deletions src/rossum-sa-extension/popup/popup.css
Original file line number Diff line number Diff line change
@@ -1,42 +1,13 @@
body {
width: 38rem;
padding: 0.5rem;
width: 19rem;
margin: 0;
}

h3 {
margin-block-end: 0.5rem;
}

.panelWrapper {
display: flex;
flex-direction: row;
}

.panelWrapper > .leftPanel {
padding: 0.5rem;
width: 50%;
background-color: #f2f2f2;
display: flex;
flex-direction: column;
}

.panelWrapper > .leftPanel > .configuration {
display: flex;
flex-direction: column;
flex: 1;
}

.panelWrapper > .leftPanel > .configuration textarea {
resize: none;
font-size: 10px;
height: 100%;
}

.panelWrapper > .rightPanel {
padding: 0.5rem;
width: 50%;
}

.checkboxes label {
display: block;
padding-right: 10px;
Expand Down
86 changes: 35 additions & 51 deletions src/rossum-sa-extension/popup/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,57 +5,41 @@
</head>
<link href="popup.css" rel="stylesheet" />
<body>
<div class="panelWrapper">
<div class="leftPanel">
<div class="configuration">
<label for="localUnleashOverrides">
<span class="help"><code>localUnleashOverrides</code></span>
</label>
<textarea id="localUnleashOverrides"></textarea>
</div>
<div><button id="localUnleashOverridesApply">Apply and reload</button></div>
</div>

<div class="rightPanel">
<div>
<div><button id="masterDataHub">Master Data Hub</button></div>
</div>

<div class="checkboxes">
<h3>Rossum lens</h3>

<label>
<input type="checkbox" id="schemaAnnotationsEnabled" />
<span>Show Rossum schema IDs</span>
</label>

<label>
<input type="checkbox" id="devFeaturesEnabled" />
<span>Rossum dev <em>features</em> flag</span>
<span class="help">(<code>devFeaturesEnabled</code>)</span>
</label>

<label>
<input type="checkbox" id="devDebugEnabled" />
<span>Rossum dev <em>debug</em> flag</span>
<span class="help">(<code>devDebugEnabled</code>)</span>
</label>

<h3>NetSuite lens</h3>

<label>
<input type="checkbox" id="netsuiteFieldNamesEnabled" />
<span>Show NetSuite field names</span>
</label>
</div>

<div class="info">
<div>0.13.0</div>
<div>
<a href="https://rossum.university/" target="_blank">Rossum.ai University</a> 🧑‍🎓
</div>
</div>
</div>
<div>
<button id="masterDataHub">Master Data Hub</button>
</div>

<div class="checkboxes">
<h3>Rossum lens</h3>

<label>
<input type="checkbox" id="schemaAnnotationsEnabled" />
<span>Show Rossum schema IDs</span>
</label>

<label>
<input type="checkbox" id="devFeaturesEnabled" />
<span>Rossum dev <em>features</em> flag</span>
<span class="help">(<code>devFeaturesEnabled</code>)</span>
</label>

<label>
<input type="checkbox" id="devDebugEnabled" />
<span>Rossum dev <em>debug</em> flag</span>
<span class="help">(<code>devDebugEnabled</code>)</span>
</label>

<h3>NetSuite lens</h3>

<label>
<input type="checkbox" id="netsuiteFieldNamesEnabled" />
<span>Show NetSuite field names</span>
</label>
</div>

<div class="info">
<div>0.13.0</div>
<div><a href="https://rossum.university/" target="_blank">Rossum.ai University</a> 🧑‍🎓</div>
</div>

<script src="popup.js"></script>
Expand Down
26 changes: 0 additions & 26 deletions src/rossum-sa-extension/popup/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,32 +82,6 @@ document.addEventListener('DOMContentLoaded', async function () {
});
});

chrome.tabs.sendMessage(tab.id, 'get-localUnleashOverrides', async function (response) {
const [tab] = await chrome.tabs.query({ active: true, lastFocusedWindow: true });

const textAreaElement = document.getElementById('localUnleashOverrides');
const textAreaButtonElement = document.getElementById('localUnleashOverridesApply');

if (textAreaElement != null) {
// $FlowFixMe[prop-missing]: refine from HTMLElement to HTMLTextAreaElement
textAreaElement.value = JSON.stringify(response ?? {}, null, 2);
}

textAreaButtonElement?.addEventListener('click', () => {
chrome.tabs.sendMessage(
tab.id,
{
name: 'set-localUnleashOverrides',
// $FlowFixMe[prop-missing]: refine from HTMLElement to HTMLTextAreaElement
payload: textAreaElement?.value ?? {},
},
function () {
chrome.tabs.reload(tab.id);
},
);
});
});

chrome.storage.local.get(['schemaAnnotationsEnabled']).then((result) => {
observeCheckbox(
'schemaAnnotationsEnabled',
Expand Down
11 changes: 0 additions & 11 deletions src/rossum-sa-extension/scripts/rossum.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,4 @@ chrome.runtime.onMessage.addListener(function (message, sender, sendResponse) {
}
sendResponse(true);
}

// localUnleashOverrides:
if (message === 'get-localUnleashOverrides') {
const localUnleashOverrides = JSON.parse(window.localStorage.getItem('localUnleashOverrides'));
sendResponse(localUnleashOverrides);
}

if (message?.name === 'set-localUnleashOverrides') {
window.localStorage.setItem('localUnleashOverrides', message.payload);
sendResponse();
}
});

0 comments on commit 1518740

Please sign in to comment.