Commit Graph

110 Commits

Author SHA1 Message Date
Francesco Torchia 0ae05b59a9
Merge pull request #8552 from torchiaf/fix/5958
`ConfigMap`, handle chomping
2023-05-10 12:42:58 +02:00
Francesco Torchia 6a7362f5e3
calculate indentation in yaml creation
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
2023-05-09 20:35:25 +02:00
Neil MacDougall da0d60720d
Auth Provider: Support Okta with LDAP search (#8679)
* Auth Provider: Support Okta with LDAP search

* Minor fixes

* Update UX and add detail of LDAP configuration

* Fix issues when logging out

* Fix i18n key
2023-05-03 10:07:58 +01:00
LiuYan 19e3217381
fix(grafana.js):add try-catch block to monitoring version request (#8722) 2023-05-02 11:05:23 +01:00
Francesco Torchia 98c91ce5a3
improve code comments
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
2023-04-28 09:48:13 +02:00
Francesco Torchia 8f6b8c30df
Merge pull request #8271 from torchiaf/fix/5070-5
Remove jquery from SortableTable
2023-04-20 19:18:31 +02:00
Cody Jackson 487cf0d6a4 Migrating all of the files out of the nuxt directory into reasonable places within shell 2023-04-20 11:56:58 +02:00
Francesco Torchia 61adce9898
dom util, getParent function refactoring for readability
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
2023-04-19 16:18:19 +02:00
Francesco Torchia eb1b97da1e
remove jquery, SortableTable
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
2023-04-19 16:17:58 +02:00
Richard Cox cdc96df61d
Merge pull request #8347 from bashofmann/fix-grafana-url
Fix Grafana URLs in local cluster for new monitoring version
2023-04-18 10:44:01 +01:00
Francesco Torchia c3eedb3b31
Handle block styles in yaml files
- add the possibility to specify what Scalar Style to use in the yaml blocks ('|' or '>') and what Chomping style ('+' , '-' or empty)
  see https://yaml-multiline.info
- set default to style to '|+' (keep all newlines)
- adapt CruResource to get in input the new yaml options

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
2023-03-29 15:59:42 +02:00
Giuseppe Leo da037a946e
Modify PSP deprecation warning message when upgrading a K3s custom cluster to v1.25 (#8464)
* Add decode utils for escaped HTML

* Allow to inject HTML in the markup as for i18n

* Correct wording and markup for PSP modal confirmation
2023-03-21 11:47:20 +01:00
Cody Jackson eecefff26a Moving the route files outside of the nuxt subfolder 2023-03-14 17:00:42 -07:00
Francesco Torchia 82ec6a4eda
Merge pull request #8220 from torchiaf/fix/5070-2
Remove jquery from position.js, select.js
2023-03-14 11:41:19 +01:00
Francesco Torchia fe2370db43
Merge pull request #8214 from torchiaf/fix/7758
Jobs, fix Duration field format
2023-03-14 11:26:55 +01:00
Richard Cox cc8b824be3
Use custom `storeName` instead of hardocoded 'cluster' 2023-03-10 14:17:39 +01:00
Bastian Hofmann c7dfbe5c5d
Make grafana urls version dependent, so that they work correctly in the local cluster with old and new monitoring versions
Signed-off-by: Bastian Hofmann <mail@bastianhofmann.de>
2023-03-10 12:15:17 +01:00
Bastian Hofmann 2b235e159c
Fix Grafana URLs in local cluster for new monitoring version
Fixes https://github.com/rancher/dashboard/issues/8346

Signed-off-by: Bastian Hofmann <mail@bastianhofmann.de>
2023-03-10 12:15:15 +01:00
wujun bcfeb79d98 enhancement use dynamic store 2023-02-28 21:09:30 +08:00
Shavindra e12939115e
Allow basic fleet user to manage fleet without cluster permissions. (#7446)
* Allow basic fleet user to manage fleet without cluster permissions.

* Handle no workspaces.

* Add Fleet bundle namespace mapping - fleet.cattle.io.bundlenamespacemapping

* Add git repo restrictions.

* Handle auth errors for checkSchemasForFindAllHash.

* Fix workspace switcher and handle fleetworkspaces 401 issues.

* Update workspace switcher.

* Fix Gitrepo restriction creation from the Workspace create

* Disable workspace creation
* Fix workspace loading after creation

* Fix Bundle creation error.

* Remove redudant FLEET.TOKEN request.
2023-02-23 14:15:32 +00:00
Francesco Torchia d1e7734ece
jquery from position.js, select.js
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
2023-02-22 13:05:42 +01:00
Richard Cox e73c55c782 Fix issue where gap between resource.stop and resource.start lead to missed resource changes
- changes cover create, change and remove
- resource.stop events happen
  - we unusb
  - after socket errors (that rancher sends, like revision `too old`)
  - after resource type permissions change
- there would be a gap between resource.stop (fetch latest revision, wait 5 seconds) and resource.start
- this could lead to missed resource changes and stale info on screen

Linking a couple of pertinent changes

- forceWatch partially implemented - 14862b2924 (diff-42632b5ed3c30e60abade8a67748b16d45e0778091713dd71a46d4bbe9211d2c)
- too old originally removed https://github.com/rancher/dashboard/pull/3743/files
  - this was implemented before the backend fixed their spam

Note - resource.stop can be forced with CATTLE_WATCH_TIMEOUT_SECONDS=300 (on v1 will resource.stop every 5 mins)
Note - Too old can be forced by editing resource.stop with
      // const revision = type === '' ? undefined : 1;
      // dispatch('watch', { ...obj, revision });
2023-02-21 16:56:31 +00:00
Francesco Torchia 6e36eed511
elapsedTime, calculate days
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
2023-02-21 09:24:00 +01:00
Giuseppe Leo 54b484fce4
Add integer test case for decimal with zero (#8006) 2023-01-24 11:26:43 +01:00
Giuseppe Leo 942c0442b9
Feature/6633 min password again (#7930)
* Change key for min password due inconsistency with the server value

* Allow to edit env var in settings model

* Allow to pass simple validators in the global settings editor

* Add validation for integer values on global settings password

* Add integer validation

* Add simple validators tests

* Allow integer validation to allow strings from inputs

* Simplify function and extend naming for settings rules

* Add further validations for the min password setting

* Replace logic with regular expression
2023-01-23 17:56:55 +01:00
Francesco Torchia d8422f29b6
Merge pull request #7936 from torchiaf/fix/7902
[type-map.js], fix pluralize function
2023-01-23 16:46:15 +01:00
wujun 41300c7d07
support multi nic (#7899) 2023-01-20 12:19:03 -07:00
Giuseppe Leo 8497f587d7
Add PSA custom resource in Cluster Manager (#7678)
* Add PSA resource model, edit, list, types, config, utils and navigation

* Remove controls sorting from config file in PSA form due unnecessary added logic

* Add missing type to exemptions

* Remove component specific grid alignment styling

* Add meaningful values on PSA form tests

* Add prefix for the namespace PSA form

* Correct PSA form test

* Revert RKE cluster erroneous changes

* Rename all the PSA form values to match specification and avoid issues

* Create function to convert array to dictionary

* Add types and replace function with utility in PSA form

* Trim exemptions values for PSA form

* Correct util test and function

* Enable YAML editor for PSA resource
2023-01-20 16:26:43 +01:00
Francesco Torchia 9a40885420
fix pluralize() function
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
2023-01-17 16:15:34 +01:00
Sean-McQ ca1b810c7b
Moves sockets into the advanced worker (#7760)
* Moves sockets into the advanced worker

* worker can die peacefully now, making switching between cluster work.

* Make waitFor generic, wire in to waitForTestFn

* General Changes
- Fixes for switching cluster
  - includes using common getPerformanceSetting
  - avoid new code to unsub before socket disconnect
- handle `watch` `stop` requests
- lots of TODO's (questions, work, checks, test, etc)
- use common

* Switch socket fixes
- isAdvancedWorker should only be true for cluster store
- advancedWorker to be wired in

* Fix socket id for cluster workers
- sockets use an incremented local var for id
- when we nuke the socket file within the worker this resets, so they all ahve id of 1
- work around this by applying the unix time

* Fix handling of new partical counts response
- seen in dex cluster explorer dashboard
- count cards would be removed when partial counts response received

* Make resourceWatcher the sole location for watch state
- getters canWatch, watchStarted now are worked around (they look at state in the UI thread)
  - we now don't call resource.stop or restart.start in subscription
- tidied up `forgetType`
- moved clearFromQueue from steve mutations into subscription mutations (better location)
- added and removed some TODOs
- fixed watch (stop handler should be higher up, include force watch handling)

* pushes the csrf value into worker and adds it to fetch request headers.

* refactors batchChanges to address ref concerns and be more performant

* Maintain schema reference whilst updating
- This change mutates input in a function, which is bad...
- but ensures the reference isn't broken, which is needed to maintain similar functionality as before

* Fix waitForTestFn
- Seen when creating or viewing clusters

* On unwatch ensure any pending watch requests are removed from the queue
- the probably would have been a problem if the worker wasn't nuked
- however as the codes there lets make it safe

Also added `trace` feature in advanced worker, will probably bring out to other places as well

* Fix navigation from cluster manager world to any cluster
- Ensure that we handle the case where the advanced worker was created but the resource watcher wasn't
- ... but fix case where this was happening (aka ensure that a blank cluster context is ignored)

* Tidy some TODOs

* Add perf settings page
- This will help test normal flow (when advanced worker is disabled)
- Note - setting is now in a bag. This may help us better support further settings (enable client side pagination, etc)
  ```
  advancedWorker: { enabled: false },
  ```

* FIX - Nav from cluster dashboard --> specific event --> cluster dashboard and events not re-subbed
- Ensure we block default handling of resource.start (keep state in resource watcher)

* Tidying up some TODOs

* Adds in a cache and uses it to validate SCHEMA messages before batching.

* Forgot to actually save CSRF to the resourceWatcher when instantiated.

* an empty resource in a batchChange to signal remove

* Move addSchemaIndexFields to and created removeSchemaIndexFields in new file
- this avoids bringing class files into the worker

* Fix disconnect/reconnect
- Remove `syncWatch` (do the watch/unwatch straight away)
- Test/Fix re-sub on reconnect
- Test/Fix growls on disconnect

* Tidying up some TODO's
- including clean of workerQueue on resource.stop (this is SUPER defensive)

* batchChanges will now handle aliases

* Fix pods list - WIP
- ensure podsByNamespace is updated on batchChange

TODO
- the final update to the pod is ignored
- removing a namespace cleans the cache correctly
- disabling advanced worker still works

* Fix pods list - fixes
- ensure podsByNamespace is updated on batchChange

Tested / Fixed
- the final update to the pod is ignored
- removing a namespace cleans the cache correctly
- disabling advanced worker still works

* Tidying TODOs

* Remove default same-origin header
- https://developer.mozilla.org/en-US/docs/Web/API/Request/credentials

* Fixed TODO description

* Refactor subscribe, make it clear which vuex feature relates to what

* Lots of Fixes
- batchChanges fixes
  - fix index is 0 issues (!/!!index)
  - only `set` if we have to
  - ensure we set the correct index after pushing to list
  - ensure map is updated after reducing list size with limit
- podsByNamespace fixes
  - ensure when ew replace... we don't use the same referenced object
- general service resource fixes
  - ensure service's pods list stays up to date with store

* Multiple improvements/fixes
- resourceCache - store the hash instead of the whole object. This means longer load time be reduces memory footprint
- resourceWatcher
  - don't re-sub on socket reconnect if watcher is in error
  - don't sub if watcher is in error
  - don't unwatch for 'failed to find schema' and 'too old' errors
    - this clears the error, we won't to keep it to ensure we don't watch
- Remove #5997 comments, follow on work #7917

* toggle debug, remap alias types, cleaned up comments and console

* Unit tests for batchChanges
Much more scope for some crazy content

* Logging tweaks
- disable logging by default
- initWorker comes in too late to affect initial trace, so just rely on the `debug` to toggle at runtime

Co-authored-by: Richard Cox <richard.cox@suse.com>
2023-01-13 16:03:00 -05:00
Neil MacDougall 9f3922424a
Add support for svg icons (#7769)
* Fix lint

* Fix bad merge

* Fix bad merge

* Fix issue with custom color
2023-01-13 12:59:59 +00:00
Richard Cox d4b9840d28
Merge pull request #7207 from mantis-toboggan-md/plugins-harvester-manager
Create a Harvester Manager plugin
2023-01-11 10:19:57 +00:00
Nancy 14afb83a72
Revert "get docs base url version from getVersionInfo (#7436)" (#7863)
This reverts commit 129568d991.
2023-01-10 11:12:13 -07:00
Nancy Butler 7500405cf5 fix cloud-credential and machine-config imports 2023-01-09 10:48:42 -07:00
Giuseppe Leo 3e31e9f138
Add support for Pod Security Admission in the Namespace resource (#7619)
* Create models, config and utils for PSA

* Create PSA tab form view

* Create custom labels for Namespace

* Add icon option for Namespace detail view

* Add icon for Namespace list

* Add PSA tab for Namespace edit view

* Add i18n for all the PSA parts

* Separate PSA labels between mode and versions

* Filter DetailTop Namespace labels from PSA versions

* Correct unit test

* Correct Namespace tooltips for details, to be created after fetching the resources

* Remove unnecessary model

* Add todo for PSA implementation

* Add TODO for tests with checkbox and select

* Correct namespace list link with model method

* Add TODO

* Move i18n key for PSA

* Align Namespace detail view chips icon to the top

* Restore labels and annotation to the Namespace view

* Merge LabelsPSA features to existing Labels component

* Move all the PSA logic from the view to the model

* Tweaks following review

DetailTop
- Remove PSA specific code from generic component

ResourceDetail
- Remove PSA specific code from generic component
- Remove plumbing for descriptions and icons from parent component to DetailTop

Labels&Annotations component
- Default `show system labels` to off
- Ensure size of `Labels` and `Annotations` titles are the same
- Improve padding
- Remove PSA specific code from generic component
- Removed un-needed margin-bottom

Project/Namespace List
- Improve padlock icon alignment
- Improve spacing around PSA list in tooltip (this will pop up often)

PodSecurtyAdmission settings component
- Improved alignment on PSA checkbox

General Improvements
- Always show Labels&Annotations on Namespace config (view) page

* Changes following testing
- Fix display of show/hide system labels when there are no system labels
- Ensure PSA order shown in project/namespaces list PSA tooltip matches PSA controls in Namespace edit/config page
- Remove two usages of lodash
  - pickBy --> new common pickBy
  - values --> Object.values

* Fix unit tests

Co-authored-by: Richard Cox <richard.cox@suse.com>
2023-01-06 16:01:40 +01:00
Nancy 129568d991
get docs base url version from getVersionInfo (#7436)
*update docs links in translation file

*update chinese translation doc links

* fetch latest rancher version tag to determine doc url versioning

* fix hardcoded links to 2.6-only documentation

* update doc base url
2023-01-04 09:09:26 -07:00
Francesco Torchia cca7dd12f8
move elapsedTime function to time.js
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
2022-12-16 10:46:31 +01:00
Richard Cox 77530b6404
Merge pull request #7674 from richard-cox/improve-socket-logging
Improve util socket logging
2022-12-13 09:48:02 +00:00
Richard Cox e5b507c25f Updates following review 2022-12-12 09:24:48 +00:00
Richard Cox 3eb3332bc6 Improve util socket logging
- Ensure exception is logged (JSON.stringify(new Error('dsf')) returns empty object)
- Ensure details of closed sockets are printed
Use common log statement
- Use a base level logging method to ensure consistent output
  - used where we might not know some basic info like socket id
- Use a top level logging method to add common socket info
2022-12-09 17:48:54 +00:00
Cody Jackson 90ca1209f4 This fixes an issue where catalog/charts were stale after a repo was updated
The catalog.cattle.io.clusterrepos/{repo} resource doesn't subscribe to updates. We now force a full request in the areas where it's appropriate to do so.

fixes #7668
2022-12-09 08:38:28 -07:00
Francesco Torchia 84dd46c9e1
ui:Job List, fix Duration field sorting
- fix sorting
- code refactoring

- Jobs view: fix duration field in case of Pod never starts

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
2022-11-18 15:01:16 +01:00
Phillip Rak 3d410d0974 Apply linter auto-fixes
Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
2022-11-16 18:38:20 -07:00
Giuseppe Leo 75c01c7ab7
Validation for the minimum length requirement for user password setting (#6897)
* Convert Rancher settings into Typescript and add interface

* Allow Rancher settings to be validated

* Add Rancher Settings min password length validation

* Replace settings number input with labeled input of type number for validation; Added missing required, focus, locale and labels attributes

* Add min/max/between value/length cases to global validation cases

* Correct validation syntax

* Add tests for the global settings

* Correct naming and assign directly rules to the inputs

* Create initial tests for CreateEditView

* Prevent Settings view to break if no setting is found for given ID

* Add max password length validation

* Add i18n to settings validation

* Add form validation to the CRUD component

* Prevent form to fail for resource types without validation

* Add test for no validation cases

* Remove form validation in favor of local view logic, due complexity issues

* Correct validator linting issue

* Correct i18n; Add types; Correct min/max/between validations i18n and combine the last

* Add translation type

* Correct validation translation types and definitions

* Replace custom validations with predefined rules

* Reintroduce form validation in abstracted configuration to pass settings through

* Add tests for new generic form validations

* Correct between values and length validation

* Split tests to use pre-existing rulesets due complexity and different cases

* Cleanup jsdoc in form validation

* Cleanup form validation mixin

* Add global settings test for generating rules from config

* Replace value.value with value for validating the resource

* Correct validation call and test instantiation

* Add note about value.value exception

* Disable faulty test due lacks of information

* Replace min/max value validation with between

* Add missing type for settings getter

* Move type folder within shell

* Move settings logic from config to utils
2022-11-15 15:32:02 +01:00
Neil MacDougall 6d15349c45
Fix brand for csp (#7428) 2022-11-14 16:28:41 +00:00
Francesco Torchia 6050e8f0a6
StringList, new component (#7326)
* StringList, new component

- add StringList.vue
- add unit tests

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>

* StringList, findIndex findDuplicates refactoring

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>

* StringList, types refactoring

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>

* StringList, fix setTimeout handling

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>

* StringList, disable remove btn by default

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>

* StringList, css refatoring

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>

* StringList, fix unit tests

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>

* StringList, refactoring

- scrollbar value not-hardcoded
- findStringDuplicates changed to hasDuplicatedStrings
- seTimeout changed to $nextTick and eliminated on item selection

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>

* StringList, adapt LabeledInput

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
2022-11-07 18:23:20 +01:00
Nancy 4b4a91ad02
Fix createYaml data deletion (#7218)
* do not clean up on yamlize

* fix ACE, fix createYaml when schema has no resourceFields

* fix createYaml comment indentation
2022-10-18 14:40:45 -07:00
Richard Cox 0250ef1891
Merge pull request #6907 from richard-cox/gc
Garbage Collect Stale Resources
2022-10-11 14:28:10 +01:00
Neil MacDougall f759519c9d
Update favicon when suse brand is used (#7151) 2022-10-11 14:11:03 +01:00
Richard Cox 2fac6c1d36 Fix two setup & one setting issues
- Geniune bug in GC during setup flow
- Ensure setup e2e tests check for successful setup
- Ensure that updates to settings don't incorrectly stop GC on interval

Also improved docker:local:stop when running locallyTEMP - Add screenshots
2022-10-11 12:08:29 +01:00