yarn-queue-partition-capacity-labels.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the "License");
  7. * you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. import Ember from "ember";
  19. import { PARTITION_LABEL } from "../constants";
  20. export default Ember.Component.extend({
  21. didUpdateAttrs: function({ oldAttrs, newAttrs }) {
  22. this._super(...arguments);
  23. this.set("data", this.initData());
  24. },
  25. init() {
  26. this._super(...arguments);
  27. this.set("data", this.initData());
  28. },
  29. initData() {
  30. const queue = this.get("queue");
  31. const partitionMap = this.get("partitionMap");
  32. const filteredParition = this.get("filteredPartition") || PARTITION_LABEL;
  33. const userLimit = queue.get("userLimit");
  34. const userLimitFactor = queue.get("userLimitFactor");
  35. const isLeafQueue = queue.get("isLeafQueue");
  36. return {
  37. ...partitionMap[filteredParition],
  38. userLimit,
  39. userLimitFactor,
  40. isLeafQueue
  41. };
  42. }
  43. });