Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ide.vue « components « ide « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 015e750525a0d280a9657eb017baf25e9ba655ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<script>
  import { mapState, mapGetters } from 'vuex';
  import ideSidebar from './ide_side_bar.vue';
  import ideContextbar from './ide_context_bar.vue';
  import repoTabs from './repo_tabs.vue';
  import repoFileButtons from './repo_file_buttons.vue';
  import ideStatusBar from './ide_status_bar.vue';
  import repoEditor from './repo_editor.vue';

  export default {
    components: {
      ideSidebar,
      ideContextbar,
      repoTabs,
      repoFileButtons,
      ideStatusBar,
      repoEditor,
    },
    props: {
      emptyStateSvgPath: {
        type: String,
        required: true,
      },
      noChangesStateSvgPath: {
        type: String,
        required: true,
      },
      committedStateSvgPath: {
        type: String,
        required: true,
      },
    },
    computed: {
      ...mapState(['changedFiles', 'openFiles', 'viewer']),
      ...mapGetters(['activeFile', 'hasChanges']),
    },
    mounted() {
      const returnValue = 'Are you sure you want to lose unsaved changes?';
      window.onbeforeunload = e => {
        if (!this.changedFiles.length) return undefined;

        Object.assign(e, {
          returnValue,
        });
        return returnValue;
      };
    },
  };
</script>

<template>
  <div
    class="ide-view"
  >
    <ide-sidebar />
    <div
      class="multi-file-edit-pane"
    >
      <template
        v-if="activeFile"
      >
        <repo-tabs
          :files="openFiles"
          :viewer="viewer"
          :has-changes="hasChanges"
        />
        <repo-editor
          class="multi-file-edit-pane-content"
          :file="activeFile"
        />
        <repo-file-buttons
          :file="activeFile"
        />
        <ide-status-bar
          :file="activeFile"
        />
      </template>
      <template
        v-else
      >
        <div
          v-once
          class="ide-empty-state"
        >
          <div class="row js-empty-state">
            <div class="col-xs-12">
              <div class="svg-content svg-250">
                <img :src="emptyStateSvgPath" />
              </div>
            </div>
            <div class="col-xs-12">
              <div class="text-content text-center">
                <h4>
                  Welcome to the GitLab IDE
                </h4>
                <p>
                  You can select a file in the left sidebar to begin
                  editing and use the right sidebar to commit your changes.
                </p>
              </div>
            </div>
          </div>
        </div>
      </template>
    </div>
    <ide-contextbar
      :no-changes-state-svg-path="noChangesStateSvgPath"
      :committed-state-svg-path="committedStateSvgPath"
    />
  </div>
</template>