Skip to content

feat: Custom tab renaming#44

Open
itvi-1234 wants to merge 2 commits intohyperjump-io:mainfrom
itvi-1234:custom-tab
Open

feat: Custom tab renaming#44
itvi-1234 wants to merge 2 commits intohyperjump-io:mainfrom
itvi-1234:custom-tab

Conversation

@itvi-1234
Copy link
Copy Markdown
Contributor

Description:

Done custom tab renaming

Screenshots:

image

Signed-off-by: itvi-1234 <rjsumit71@gmail.com>
@itvi-1234
Copy link
Copy Markdown
Contributor Author

Hi @jdesrosiers , Could you please review this PR 🚀

Comment on lines +37 to +61
try {
const uriObj = new URL(uri);
const baseObj = new URL(baseUri);

if (uriObj.origin === baseObj.origin) {
const uriParts = uriObj.pathname.split('/');
const baseParts = baseObj.pathname.split('/');
baseParts.pop();

let i = 0;
while (i < uriParts.length && i < baseParts.length && uriParts[i] === baseParts[i]) {
i++;
}

let rel = "";
for (let j = i; j < baseParts.length; j++) {
rel += "../";
}
rel += uriParts.slice(i).join('/');
if (uriObj.hash) rel += uriObj.hash;
label = rel;
}
} catch (_e) {
// Ignore invalid URIs
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use toRelativeIri from @hyperjump/uri.

// Ignore invalid URIs
}

label = label.replace(/\.(json|yaml|yml)$/i, "");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's *.schema.json|yaml|whatever, it should remove the .schema also.

Comment on lines +68 to +70
if (label.length > 30) {
label = label.slice(0, 15) + "…" + label.slice(-10);
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

30 characters is much too long. Try 20. I don't think including the first characters necessary. Just the ellipsis and the last 20 or so characters should be enough. The most identifying information is usually at the end of the path.

Comment on lines +120 to +168
const externalId = selectedSchema === 0 ? schemaUrl : "";
const externalId = index === 0 ? schemaUrl : "";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did this change?

Signed-off-by: itvi-1234 <rjsumit71@gmail.com>
@itvi-1234
Copy link
Copy Markdown
Contributor Author

Hi @jdesrosiers , I have made some fixes , Could you please review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants