-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ui: Exclude all debug-like files from the build #11211
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
(function(data) { | ||
const appNameJS = data.appName.split('-') | ||
.map((item, i) => i ? `${item.substr(0, 1).toUpperCase()}${item.substr(1)}` : item) | ||
.join(''); | ||
data[`${appNameJS}Routes`] = JSON.stringify({ | ||
dc: { | ||
acls: { | ||
tokens: { | ||
_options: { | ||
abilities: ['read tokens'], | ||
}, | ||
(routes => routes({ | ||
dc: { | ||
acls: { | ||
tokens: { | ||
_options: { | ||
abilities: ['read tokens'], | ||
}, | ||
}, | ||
}, | ||
}); | ||
})(document.currentScript.dataset); | ||
}, | ||
}))( | ||
(json, data = document.currentScript.dataset) => { | ||
const appNameJS = data.appName.split('-') | ||
.map((item, i) => i ? `${item.substr(0, 1).toUpperCase()}${item.substr(1)}` : item) | ||
.join(''); | ||
data[`${appNameJS}Routes`] = JSON.stringify(json); | ||
} | ||
); |
64 changes: 33 additions & 31 deletions
64
ui/packages/consul-partitions/vendor/consul-partitions/routes.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,38 @@ | ||
(function(data) { | ||
const appNameJS = data.appName.split('-') | ||
.map((item, i) => i ? `${item.substr(0, 1).toUpperCase()}${item.substr(1)}` : item) | ||
.join(''); | ||
data[`${appNameJS}Routes`] = JSON.stringify({ | ||
dc: { | ||
partitions: { | ||
_options: { | ||
path: '/partitions', | ||
queryParams: { | ||
sortBy: 'sort', | ||
searchproperty: { | ||
as: 'searchproperty', | ||
empty: [['Name', 'Description']], | ||
}, | ||
search: { | ||
as: 'filter', | ||
replace: true, | ||
}, | ||
(routes => routes({ | ||
dc: { | ||
partitions: { | ||
_options: { | ||
path: '/partitions', | ||
queryParams: { | ||
sortBy: 'sort', | ||
searchproperty: { | ||
as: 'searchproperty', | ||
empty: [['Name', 'Description']], | ||
}, | ||
abilities: ['read partitions'], | ||
}, | ||
edit: { | ||
_options: { path: '/:name' }, | ||
}, | ||
create: { | ||
_options: { | ||
template: 'dc/partitions/edit', | ||
path: '/create', | ||
abilities: ['create partitions'], | ||
search: { | ||
as: 'filter', | ||
replace: true, | ||
}, | ||
}, | ||
abilities: ['read partitions'], | ||
}, | ||
edit: { | ||
_options: { path: '/:name' }, | ||
}, | ||
create: { | ||
_options: { | ||
template: 'dc/partitions/edit', | ||
path: '/create', | ||
abilities: ['create partitions'], | ||
}, | ||
}, | ||
}, | ||
}); | ||
})(document.currentScript.dataset); | ||
}, | ||
}))( | ||
(json, data = document.currentScript.dataset) => { | ||
const appNameJS = data.appName.split('-') | ||
.map((item, i) => i ? `${item.substr(0, 1).toUpperCase()}${item.substr(1)}` : item) | ||
.join(''); | ||
data[`${appNameJS}Routes`] = JSON.stringify(json); | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
(services => services({ | ||
"route:application": { | ||
"class": "consul-ui/routing/application-debug" | ||
}, | ||
"service:intl": { | ||
"class": "consul-ui/services/i18n-debug" | ||
} | ||
}))( | ||
(json, data = document.currentScript.dataset) => { | ||
const appNameJS = data.appName.split('-') | ||
.map((item, i) => i ? `${item.substr(0, 1).toUpperCase()}${item.substr(1)}` : item) | ||
.join(''); | ||
data[`${appNameJS}Services`] = JSON.stringify(json); | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a blocking comment/question, but curious to know if there are advantages to hand-rolling this as opposed to using something like
@ember/string/classify
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose the main reason is this file gets sourced/exec'd before ember is even loaded, and it's in a separate file (that is very very small and quick to load). So we don't have any ember things available to use at this point, and loading anything ember related in this file would bloat it out quite a bit I think.
I thought it might be worth briefly going over some of the objectives here as an FYI:
Right now we 'safely' move this data from this file into our/Ember's service container using the app name to namespace the script tags that get 'slurped' up by the our/Ember's service container (to ensure we only slurp the correct data for the app). I'm unsure right now if doing this extra detail/level of 'safety' is complete overkill, and its the reason for this bit of code. So it's highly likely that we'll stop doing this by the time this hits a proper release. We could also just hardcode the
consulUi
string that this produces, hardcoding here wouldn't be a major issue at all either. All in all I've not decided yet, would be good to hear what you thoughts there are also tho.