mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 14:49:53 +00:00
c48daaea44
* Add pinning behavior * add fa-thumb-tack * Updated package-lock files * Allow only top level request and request group to be pinned * Prevent dnd for pinned request * Efficiency change * Reverted changes * Revert changes to selectors.js * Fixed pin and add thumbtack * Changes * Pin styling * Fix overflow bug * styling complete * Remove additional style * Updated package-lock.json * Mergie * Boolean to boolean * allow nested requests to be pinned * Remove unused arg * Remove folder pinning functionality * Remove comment * Revert change to open tag on group * Render separator with dsiplay: none so that sync menu is in correct place * Don't reset parent id on request pin * Remove extra checks * Move pin filter to selectors to prevent duplicate childTree traversal * Decouple pinned items from search results * Hide pin on hover * Pin keyboard shortcut via shift+ctrl+p * Typo fix * Update mac hotkey + activeRequest nullcheck * Disable drag and drop only for items in the pinned list * Filter to Find
55 lines
1.1 KiB
JavaScript
55 lines
1.1 KiB
JavaScript
import * as db from '../common/database';
|
|
import { PREVIEW_MODE_FRIENDLY } from '../common/constants';
|
|
|
|
export const name = 'Request Meta';
|
|
export const type = 'RequestMeta';
|
|
export const prefix = 'reqm';
|
|
export const canDuplicate = false;
|
|
export const canSync = false;
|
|
|
|
export function init() {
|
|
return {
|
|
parentId: null,
|
|
previewMode: PREVIEW_MODE_FRIENDLY,
|
|
responseFilter: '',
|
|
responseFilterHistory: [],
|
|
activeResponseId: null,
|
|
savedRequestBody: {},
|
|
pinned: false,
|
|
};
|
|
}
|
|
|
|
export function migrate(doc) {
|
|
return doc;
|
|
}
|
|
|
|
export function create(patch = {}) {
|
|
if (!patch.parentId) {
|
|
throw new Error('New RequestMeta missing `parentId`', patch);
|
|
}
|
|
|
|
return db.docCreate(type, patch);
|
|
}
|
|
|
|
export function update(requestMeta, patch) {
|
|
return db.docUpdate(requestMeta, patch);
|
|
}
|
|
|
|
export function getByParentId(parentId) {
|
|
return db.getWhere(type, { parentId });
|
|
}
|
|
|
|
export async function getOrCreateByParentId(parentId) {
|
|
const requestMeta = await getByParentId(parentId);
|
|
|
|
if (requestMeta) {
|
|
return requestMeta;
|
|
}
|
|
|
|
return create({ parentId });
|
|
}
|
|
|
|
export function all() {
|
|
return db.all(type);
|
|
}
|