Sha256: e3262a03723caf512c0ad07f801fbb59aa48297baffcbe7165a428a9b24297ed

Contents?: true

Size: 1.21 KB

Versions: 4

Compression:

Stored size: 1.21 KB

Contents

import Component from "@ember/component";
import { computed } from "@ember/object";
import { buildHashString } from "client-app/lib/utilities";

export default Component.extend({
  current: 1,

  didUpdateAttrs() {
    this.set("current", 1);
  },

  isEnvArray: computed("message.env", function() {
    return Array.isArray(this.get("message.env"));
  }),

  html: computed("isEnvArray", "current", function() {
    if (!this.get("isEnvArray")) {
      return buildHashString(this.get("message.env"));
    } else {
      const currentEnv = this.get("message.env")[this.get("current") - 1];
      return buildHashString(currentEnv);
    }
  }),

  disableBackButtons: computed("current", function() {
    return this.get("current") === 1;
  }),

  disableForwardButtons: computed("current", "message.env.length", function() {
    return this.get("current") === this.get("message.env.length");
  }),

  actions: {
    takeStep(dir) {
      const amount = dir === "back" ? -1 : 1;
      this.set("current", this.get("current") + amount);
    },

    bigJump(dir) {
      const newCurrent = dir === "back" ? 1 : this.get("message.env.length");
      this.set("current", newCurrent);
    }
  }
});

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
logster-2.1.0 client-app/app/components/env-tab.js
logster-2.0.1 client-app/app/components/env-tab.js
logster-2.0.0.pre client-app/app/components/env-tab.js
logster-1.4.0.pre client-app/app/components/env-tab.js