-
Notifications
You must be signed in to change notification settings - Fork 73
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
Allow editing extensions and creating customs ones through the UI #1256
Conversation
4a132e5
to
45d212f
Compare
import { VForm } from '@/types/vuetify' | ||
import back_axios from '@/utils/api' | ||
|
||
import { InstalledExtensionData } from '../../types/kraken' |
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.
use @
and not relative reference
this.new_extension = null | ||
}, | ||
validate_identifier(input: string): (true | string) { | ||
const re = /[A-Za-z]+[A-Za-z0-9]*\.[A-Za-z]+[A-Za-z0-9]*/ |
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.
[A-Za-z]+[A-Za-z0-9]*
is weird, why not [A-Za-z][A-Za-z0-9]*
? The plus characters does not make sense to me.
Can you add an example if what this is validating ?
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.
yeah, in hindsight the + is meaningless. it is there so that the identifiers do not start with numbers
return 'This field must container two words separated by a period. Numbers are allowed if not the first character' | ||
}, | ||
validate_dockerhub(input: string): (true | string) { | ||
const re = /[A-Za-z]+[A-Za-z0-9]*\/[A-Za-z]+[A-Za-z0-9]*/ |
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.
Can you add example for valid strings ?
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'll take the pluses out. this is based on dockerhub`s description:
A tag name must be valid ASCII and may contain lowercase and uppercase letters, digits, underscores, periods and dashes. A tag name may not start with a period or a dash and may contain a maximum of 128 characters.
+ 'Numbers are allowed if not the first character. e.g example/docker1' | ||
}, | ||
validate_name(input: string): (true | string) { | ||
const re = /[A-Za-z]+[A-Za-z0-9 ]/ |
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.
The 3 three regex appears to be an abstraction over two string groups, if that is the case, we should split the regex in two groups and merge it for better readability of the proposal of each regex group.
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.
validate_identifier(input: string): (true | string) { | ||
// Identifiers should be two words separated by a period | ||
// They can contain lower and uppercase characters, but cannot begin with a number | ||
const re = /^[A-Za-z][A-Za-z0-9]*\.[A-Za-z]+[A-Za-z0-9]*/ |
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.
You can make it simpler by:
const name_validator = '[A-Za-z][A-Za-z0-9]+'
const regex = RegExp('^${name_validor}\.${name_validator}')
validate_name(input: string): (true | string) { | ||
// Lowercase, uppercase characters, and spaces | ||
const re = /[A-Za-z0-9 ]/ | ||
if (re.test(input)) { |
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.
A string that only contains spaces should not be valid, like: " "
}, | ||
validate_name(input: string): (true | string) { | ||
// Lowercase, uppercase characters, and spaces | ||
const re = /[A-Za-z0-9 ]/ |
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.
This regex only validate the first character, ' {}{}{}{}' is valid since the first character is a space.
I updated the validation. Your issue was that kraken was having issues with the updated settings format. I made it a big sturdier, but it will likely remove your currently installed extensions, now. I could go further, but beta features shouldn't need to deal with settings format changes anyway. |
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.
return 'This field must not be empty' | ||
} | ||
if (input.length > 128) { | ||
return 'This field must at most 128 characters long' |
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.
It looks a bit weird, maybe: This field must be no more than 128 characters long
or This field should be not longer than 128 characters
JSON.parse(input) | ||
return true | ||
} catch { | ||
return 'This field must be a valid Json' |
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.
Maybe: Invalid json format
or This field is not a valid json format
core: kraken: refactor
…hange between betas
I changed the texts and made sure that if there are any running extensions, the dockers are stopped as well as it is uninstalled |
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.
There a some TODOs but we can fix that later
No description provided.