Browse Source

AMBARI-5349 Views: Embedding View with iFrame. (ababiichuk)

aBabiichuk 11 năm trước cách đây
mục cha
commit
0ebb16dca9

+ 2 - 1
ambari-web/app/config.js

@@ -75,7 +75,8 @@ App.supports = {
   autoRollbackHA: false,
   appTimelineServer: true,
   jobs: true,
-  ubuntu: true
+  ubuntu: true,
+  views: false
 };
 
 if (App.enableExperimental) {

+ 1 - 0
ambari-web/app/controllers.js

@@ -117,6 +117,7 @@ require('controllers/main/mirroring/edit_dataset_controller');
 require('controllers/main/mirroring/datasets_controller');
 require('controllers/main/mirroring/jobs_controller');
 require('controllers/main/mirroring/manage_clusters_controller');
+require('controllers/main/views');
 require('controllers/wizard/slave_component_groups_controller');
 require('controllers/wizard/step0_controller');
 require('controllers/wizard/step1_controller');

+ 23 - 0
ambari-web/app/controllers/main/views.js

@@ -0,0 +1,23 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+App.MainViewsController = Em.Controller.extend({
+  name:'mainViewsController'
+})

+ 1 - 0
ambari-web/app/messages.js

@@ -1973,6 +1973,7 @@ Em.I18n.translations = {
   'menu.item.mirroring':'Mirroring',
   'menu.item.jobs':'Jobs',
   'menu.item.admin':'Admin',
+  'menu.item.views':'Views',
 
   'jobs.nothingToShow': 'No jobs to display',
   'jobs.loadingTasks': 'Loading...',

+ 8 - 0
ambari-web/app/routes/main.js

@@ -62,6 +62,14 @@ module.exports = Em.Route.extend({
     redirectsTo: 'dashboard'
   }),
 
+
+  views: Ember.Route.extend({
+    route: '/views',
+    connectOutlets: function (router, context) {
+      router.get('mainController').connectOutlet('mainViews');
+    }
+
+  }),
   test: Em.Route.extend({
     route: '/test',
     connectOutlets: function (router, context) {

+ 5 - 0
ambari-web/app/styles/application.less

@@ -5987,3 +5987,8 @@ i.icon-asterisks {
     }
   }
 }
+
+.views_sizes {
+  width:100%;
+  min-height:600px;
+}

+ 3 - 0
ambari-web/app/views.js

@@ -235,6 +235,9 @@ require('views/main/mirroring/edit_dataset_view');
 require('views/main/mirroring/datasets_view');
 require('views/main/mirroring/jobs_view');
 require('views/main/mirroring/manage_clusters_view');
+
+require('views/main/views');
+
 require('views/installer');
 require('views/wizard/controls_view');
 require('views/wizard/step0_view');

+ 4 - 0
ambari-web/app/views/main/menu.js

@@ -47,6 +47,10 @@ App.MainMenuView = Em.CollectionView.extend({
     if (App.get('isAdmin')) {
       result.push({ label:Em.I18n.t('menu.item.admin'), routing:'admin'});
     }
+
+    if (App.supports.views) {
+      result.push({ label:Em.I18n.t('menu.item.views'), routing:'views'});
+    }
     return result;
   }.property(),
     /**

+ 44 - 0
ambari-web/app/views/main/views.js

@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+App.MainViewsView = Em.View.extend({
+
+  tagName: "iframe",
+
+  classNames: ["views_sizes"],
+
+  attributeBindings: ['src','seamless'],
+
+  seamless: "seamless",
+
+  src: function() {
+    return window.location.origin + this.get('views')[1].link;
+  }.property("views"),
+
+  views: [{
+      name: "filebrowser",
+      link: "/views/FILE_BROWSER/FILEBROWSER_1/#/?path=/"
+    },
+    {
+      name: "pig",
+      link: "/views/PIG/PIG_1/"
+  }]
+
+});